@gov-design-system-ce/components 4.0.8-rc01 → 4.0.8-rc02
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/dist/cjs/constants-9dc978dd.js +27 -0
- package/dist/cjs/constants-9dc978dd.js.map +1 -0
- package/dist/cjs/core.cjs.js +1 -1
- package/dist/cjs/{form-47b5ef29.js → form-893791cf.js} +2 -2
- package/dist/cjs/{form-47b5ef29.js.map → form-893791cf.js.map} +1 -1
- package/dist/cjs/gov-form-checkbox-group.cjs.entry.js +89 -0
- package/dist/cjs/gov-form-checkbox-group.cjs.entry.js.map +1 -0
- package/dist/cjs/gov-form-checkbox.cjs.entry.js +6 -2
- package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-control.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-file.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-group.cjs.entry.js +7 -16
- package/dist/cjs/gov-form-group.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-input.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-multi-select.cjs.entry.js +4 -4
- package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-radio-group.cjs.entry.js +73 -0
- package/dist/cjs/gov-form-radio-group.cjs.entry.js.map +1 -0
- package/dist/cjs/gov-form-radio.cjs.entry.js +6 -2
- package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-form-select.cjs.entry.js +1 -1
- package/dist/cjs/gov-form-switch.cjs.entry.js +6 -2
- package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/gov-icon.cjs.entry.js +1 -1
- package/dist/cjs/index-7b6bba34.js +8 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +5 -1
- package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
- package/dist/collection/components/gov-form/group/constants.js +6 -0
- package/dist/collection/components/gov-form/group/constants.js.map +1 -1
- package/dist/collection/components/gov-form/group/gov-form-checkbox-group.js +182 -0
- package/dist/collection/components/gov-form/group/gov-form-checkbox-group.js.map +1 -0
- package/dist/collection/components/gov-form/group/gov-form-group.css +9 -9
- package/dist/collection/components/gov-form/group/gov-form-group.js.map +1 -1
- package/dist/collection/components/gov-form/group/gov-form-group.types.js +2 -0
- package/dist/collection/components/gov-form/group/gov-form-group.types.js.map +1 -0
- package/dist/collection/components/gov-form/group/gov-form-radio-group.js +166 -0
- package/dist/collection/components/gov-form/group/gov-form-radio-group.js.map +1 -0
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.css +1 -0
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +2 -2
- package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
- package/dist/collection/components/gov-form/radio/gov-form-radio.js +5 -1
- package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
- package/dist/collection/components/gov-form/switch/gov-form-switch.js +5 -1
- package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
- package/dist/collection/helpers/Dom/form.js +1 -1
- package/dist/collection/helpers/Dom/form.js.map +1 -1
- package/dist/collection/pages/Forms.js +72 -6
- package/dist/collection/pages/Forms.js.map +1 -1
- package/dist/collection/pages/Home.js +65 -40
- package/dist/collection/pages/Home.js.map +1 -1
- package/dist/components/gov-accordion-item.js +1 -1
- package/dist/components/gov-attachments-item.js +1 -1
- package/dist/components/gov-breadcrumbs.js +1 -1
- package/dist/components/gov-button.js +1 -1
- package/dist/components/gov-card.js +1 -1
- package/dist/components/gov-chip.js +1 -1
- package/dist/components/gov-form-autocomplete.js +1 -1
- package/dist/components/gov-form-checkbox-group.d.ts +11 -0
- package/dist/components/gov-form-checkbox-group.js +2 -0
- package/dist/components/gov-form-checkbox-group.js.map +1 -0
- package/dist/components/gov-form-checkbox.js +1 -1
- package/dist/components/gov-form-checkbox.js.map +1 -1
- package/dist/components/gov-form-control.js +1 -1
- package/dist/components/gov-form-file.js +1 -1
- package/dist/components/gov-form-group.js +1 -1
- package/dist/components/gov-form-group.js.map +1 -1
- package/dist/components/gov-form-input.js +1 -1
- package/dist/components/gov-form-multi-select.js +1 -1
- package/dist/components/gov-form-multi-select.js.map +1 -1
- package/dist/components/gov-form-radio-group.d.ts +11 -0
- package/dist/components/gov-form-radio-group.js +2 -0
- package/dist/components/gov-form-radio-group.js.map +1 -0
- package/dist/components/gov-form-radio.js +1 -1
- package/dist/components/gov-form-radio.js.map +1 -1
- package/dist/components/gov-form-select.js +1 -1
- package/dist/components/gov-form-switch.js +1 -1
- package/dist/components/gov-form-switch.js.map +1 -1
- package/dist/components/gov-icon.js +1 -1
- package/dist/components/gov-infobar.js +1 -1
- package/dist/components/gov-loading.js +1 -1
- package/dist/components/gov-modal.js +1 -1
- package/dist/components/gov-pagination.js +1 -1
- package/dist/components/gov-prompt.js +1 -1
- package/dist/components/gov-side-nav-item.js +1 -1
- package/dist/components/gov-tabs.js +1 -1
- package/dist/components/gov-tag.js +1 -1
- package/dist/components/gov-toast.js +1 -1
- package/dist/components/gov-tooltip-content.js +1 -1
- package/dist/components/gov-wizard-item.js +1 -1
- package/dist/components/{p-23990b41.js → p-0a1fbf26.js} +2 -2
- package/dist/components/p-3a04fb9b.js +2 -0
- package/dist/components/p-3a04fb9b.js.map +1 -0
- package/dist/components/{p-f9f8e529.js → p-4529b963.js} +2 -2
- package/dist/components/{p-e2bee1ef.js → p-4a19259c.js} +2 -2
- package/dist/components/p-75be4c94.js +2 -0
- package/dist/components/{p-c9baa62f.js.map → p-75be4c94.js.map} +1 -1
- package/dist/components/{p-26805569.js → p-8749590a.js} +2 -2
- package/dist/components/p-8fcc8483.js +2 -0
- package/dist/components/p-8fcc8483.js.map +1 -0
- package/dist/components/{p-b5a06a0a.js → p-a7443b36.js} +2 -2
- package/dist/components/p-ab5a13ea.js +2 -0
- package/dist/components/p-ab5a13ea.js.map +1 -0
- package/dist/components/{p-a6a15eb1.js → p-b5716fb6.js} +2 -2
- package/dist/components/{p-b48d3aae.js → p-f04382c3.js} +2 -2
- package/dist/components/{p-b48d3aae.js.map → p-f04382c3.js.map} +1 -1
- package/dist/core/core.esm.js +1 -1
- package/dist/core/core.esm.js.map +1 -1
- package/dist/core/{p-af9a14e3.entry.js → p-0702b541.entry.js} +2 -2
- package/dist/core/p-0702b541.entry.js.map +1 -0
- package/dist/core/{p-ef387ab2.entry.js → p-0eb3fd76.entry.js} +2 -2
- package/dist/core/{p-191e9b0c.entry.js → p-115f99f4.entry.js} +2 -2
- package/dist/core/p-115f99f4.entry.js.map +1 -0
- package/dist/core/p-1f769a40.entry.js +2 -0
- package/dist/core/p-1f769a40.entry.js.map +1 -0
- package/dist/core/p-35d6ef00.entry.js +2 -0
- package/dist/core/p-35d6ef00.entry.js.map +1 -0
- package/dist/core/{p-2a13c39c.entry.js → p-39272558.entry.js} +2 -2
- package/dist/core/p-39272558.entry.js.map +1 -0
- package/dist/core/p-3a04fb9b.js +2 -0
- package/dist/core/p-3a04fb9b.js.map +1 -0
- package/dist/core/{p-d784c44d.js → p-61a2b12a.js} +2 -2
- package/dist/core/{p-d784c44d.js.map → p-61a2b12a.js.map} +1 -1
- package/dist/core/{p-dd8816aa.entry.js → p-9c00b909.entry.js} +2 -2
- package/dist/core/{p-c0e8802d.entry.js → p-c20ee863.entry.js} +2 -2
- package/dist/core/{p-575d0c94.entry.js → p-cad17bfe.entry.js} +2 -2
- package/dist/core/p-cad17bfe.entry.js.map +1 -0
- package/dist/core/{p-8f121cad.entry.js → p-d07d3dcc.entry.js} +2 -2
- package/dist/core/{p-831edc90.entry.js → p-ead75342.entry.js} +2 -2
- package/dist/core/p-f4ef1b95.entry.js +2 -0
- package/dist/core/p-f4ef1b95.entry.js.map +1 -0
- package/dist/esm/constants-e80d9514.js +22 -0
- package/dist/esm/constants-e80d9514.js.map +1 -0
- package/dist/esm/core.js +1 -1
- package/dist/esm/{form-e3424b70.js → form-b81fd97e.js} +2 -2
- package/dist/esm/{form-e3424b70.js.map → form-b81fd97e.js.map} +1 -1
- package/dist/esm/gov-form-checkbox-group.entry.js +85 -0
- package/dist/esm/gov-form-checkbox-group.entry.js.map +1 -0
- package/dist/esm/gov-form-checkbox.entry.js +6 -2
- package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
- package/dist/esm/gov-form-control.entry.js +1 -1
- package/dist/esm/gov-form-file.entry.js +1 -1
- package/dist/esm/gov-form-group.entry.js +4 -13
- package/dist/esm/gov-form-group.entry.js.map +1 -1
- package/dist/esm/gov-form-input.entry.js +1 -1
- package/dist/esm/gov-form-multi-select.entry.js +4 -4
- package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
- package/dist/esm/gov-form-radio-group.entry.js +69 -0
- package/dist/esm/gov-form-radio-group.entry.js.map +1 -0
- package/dist/esm/gov-form-radio.entry.js +6 -2
- package/dist/esm/gov-form-radio.entry.js.map +1 -1
- package/dist/esm/gov-form-select.entry.js +1 -1
- package/dist/esm/gov-form-switch.entry.js +6 -2
- package/dist/esm/gov-form-switch.entry.js.map +1 -1
- package/dist/esm/gov-icon.entry.js +1 -1
- package/dist/esm/index-eb59f132.js +8 -0
- package/dist/esm/loader.js +1 -1
- package/dist/hydrate/index.js +236 -65
- package/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +2 -0
- package/dist/types/components/gov-form/group/constants.d.ts +6 -0
- package/dist/types/components/gov-form/group/gov-form-checkbox-group.d.ts +32 -0
- package/dist/types/components/gov-form/group/gov-form-group.types.d.ts +7 -0
- package/dist/types/components/gov-form/group/gov-form-radio-group.d.ts +32 -0
- package/dist/types/components/gov-form/radio/gov-form-radio.d.ts +2 -0
- package/dist/types/components/gov-form/switch/gov-form-switch.d.ts +2 -0
- package/dist/types/components.d.ts +94 -2
- package/package.json +2 -2
- package/dist/components/p-6c1d0f47.js +0 -2
- package/dist/components/p-6c1d0f47.js.map +0 -1
- package/dist/components/p-c9baa62f.js +0 -2
- package/dist/core/p-191e9b0c.entry.js.map +0 -1
- package/dist/core/p-2a13c39c.entry.js.map +0 -1
- package/dist/core/p-575d0c94.entry.js.map +0 -1
- package/dist/core/p-adf276b0.entry.js +0 -2
- package/dist/core/p-adf276b0.entry.js.map +0 -1
- package/dist/core/p-af9a14e3.entry.js.map +0 -1
- /package/dist/components/{p-23990b41.js.map → p-0a1fbf26.js.map} +0 -0
- /package/dist/components/{p-f9f8e529.js.map → p-4529b963.js.map} +0 -0
- /package/dist/components/{p-e2bee1ef.js.map → p-4a19259c.js.map} +0 -0
- /package/dist/components/{p-26805569.js.map → p-8749590a.js.map} +0 -0
- /package/dist/components/{p-b5a06a0a.js.map → p-a7443b36.js.map} +0 -0
- /package/dist/components/{p-a6a15eb1.js.map → p-b5716fb6.js.map} +0 -0
- /package/dist/core/{p-ef387ab2.entry.js.map → p-0eb3fd76.entry.js.map} +0 -0
- /package/dist/core/{p-dd8816aa.entry.js.map → p-9c00b909.entry.js.map} +0 -0
- /package/dist/core/{p-c0e8802d.entry.js.map → p-c20ee863.entry.js.map} +0 -0
- /package/dist/core/{p-8f121cad.entry.js.map → p-d07d3dcc.entry.js.map} +0 -0
- /package/dist/core/{p-831edc90.entry.js.map → p-ead75342.entry.js.map} +0 -0
|
@@ -6,6 +6,7 @@ export declare class GovFormRadio {
|
|
|
6
6
|
private f;
|
|
7
7
|
private inputRef?;
|
|
8
8
|
private readonly radioId;
|
|
9
|
+
private hydrated;
|
|
9
10
|
constructor();
|
|
10
11
|
host: HTMLGovFormRadioElement;
|
|
11
12
|
/**
|
|
@@ -71,6 +72,7 @@ export declare class GovFormRadio {
|
|
|
71
72
|
private passControlAttrs;
|
|
72
73
|
componentWillLoad(): void;
|
|
73
74
|
componentDidRender(): Promise<void>;
|
|
75
|
+
connectedCallback(): void;
|
|
74
76
|
render(): any;
|
|
75
77
|
private onClickHandler;
|
|
76
78
|
private onFocusHandler;
|
|
@@ -6,6 +6,7 @@ export declare class GovFormSwitch {
|
|
|
6
6
|
private f;
|
|
7
7
|
private inputRef?;
|
|
8
8
|
private readonly checkboxId;
|
|
9
|
+
private hydrated;
|
|
9
10
|
constructor();
|
|
10
11
|
host: HTMLGovFormSwitchElement;
|
|
11
12
|
/**
|
|
@@ -71,6 +72,7 @@ export declare class GovFormSwitch {
|
|
|
71
72
|
private passControlAttrs;
|
|
72
73
|
componentWillLoad(): void;
|
|
73
74
|
componentDidRender(): Promise<void>;
|
|
75
|
+
connectedCallback(): void;
|
|
74
76
|
render(): any;
|
|
75
77
|
private onClickHandler;
|
|
76
78
|
private onFocusHandler;
|
|
@@ -19,9 +19,10 @@ import { SizesType, VariantType } from "./components/gov-form/autocomplete/const
|
|
|
19
19
|
import { FormAutocompleteEvent, GovFormAutocompleteItem } from "./components/gov-form/autocomplete/gov-form-autocomplete.types";
|
|
20
20
|
import { FormCheckboxSizesType } from "./components/gov-form/checkbox/constants";
|
|
21
21
|
import { FormCheckboxEvent } from "./components/gov-form/checkbox/gov-form-checkbox.types";
|
|
22
|
+
import { FormGroupOrientationType, FormGroupSizesType } from "./components/gov-form/group/constants";
|
|
23
|
+
import { FormCheckboxGroupEvent, FormRadioGroupEvent } from "./components/gov-form/group/gov-form-group.types";
|
|
22
24
|
import { FormControlSizesType } from "./components/gov-form/control/constants";
|
|
23
25
|
import { GovFormFileEvent } from "./components/gov-form/file/gov-form-file.types";
|
|
24
|
-
import { FormGroupOrientationType, FormGroupSizesType } from "./components/gov-form/group/constants";
|
|
25
26
|
import { FormInputSizesType, FormInputVariantType, InputType, Type } from "./components/gov-form/input/constants";
|
|
26
27
|
import { Nullable } from "./types/interfaces";
|
|
27
28
|
import { FormInputEvent } from "./components/gov-form/input/gov-form-input.types";
|
|
@@ -68,9 +69,10 @@ export { SizesType, VariantType } from "./components/gov-form/autocomplete/const
|
|
|
68
69
|
export { FormAutocompleteEvent, GovFormAutocompleteItem } from "./components/gov-form/autocomplete/gov-form-autocomplete.types";
|
|
69
70
|
export { FormCheckboxSizesType } from "./components/gov-form/checkbox/constants";
|
|
70
71
|
export { FormCheckboxEvent } from "./components/gov-form/checkbox/gov-form-checkbox.types";
|
|
72
|
+
export { FormGroupOrientationType, FormGroupSizesType } from "./components/gov-form/group/constants";
|
|
73
|
+
export { FormCheckboxGroupEvent, FormRadioGroupEvent } from "./components/gov-form/group/gov-form-group.types";
|
|
71
74
|
export { FormControlSizesType } from "./components/gov-form/control/constants";
|
|
72
75
|
export { GovFormFileEvent } from "./components/gov-form/file/gov-form-file.types";
|
|
73
|
-
export { FormGroupOrientationType, FormGroupSizesType } from "./components/gov-form/group/constants";
|
|
74
76
|
export { FormInputSizesType, FormInputVariantType, InputType, Type } from "./components/gov-form/input/constants";
|
|
75
77
|
export { Nullable } from "./types/interfaces";
|
|
76
78
|
export { FormInputEvent } from "./components/gov-form/input/gov-form-input.types";
|
|
@@ -699,6 +701,20 @@ export namespace Components {
|
|
|
699
701
|
*/
|
|
700
702
|
"wcagLabelledBy": string;
|
|
701
703
|
}
|
|
704
|
+
interface GovFormCheckboxGroup {
|
|
705
|
+
/**
|
|
706
|
+
* Gap's size.
|
|
707
|
+
*/
|
|
708
|
+
"gap"?: FormGroupSizesType;
|
|
709
|
+
/**
|
|
710
|
+
* Elements orientation
|
|
711
|
+
*/
|
|
712
|
+
"orientation"?: FormGroupOrientationType;
|
|
713
|
+
/**
|
|
714
|
+
* Group's value
|
|
715
|
+
*/
|
|
716
|
+
"value"?: string | string[];
|
|
717
|
+
}
|
|
702
718
|
interface GovFormControl {
|
|
703
719
|
/**
|
|
704
720
|
* /** Indicates the form element is disabled
|
|
@@ -1145,6 +1161,20 @@ export namespace Components {
|
|
|
1145
1161
|
*/
|
|
1146
1162
|
"wcagLabelledBy": string;
|
|
1147
1163
|
}
|
|
1164
|
+
interface GovFormRadioGroup {
|
|
1165
|
+
/**
|
|
1166
|
+
* Gap's size.
|
|
1167
|
+
*/
|
|
1168
|
+
"gap"?: FormGroupSizesType;
|
|
1169
|
+
/**
|
|
1170
|
+
* Elements orientation
|
|
1171
|
+
*/
|
|
1172
|
+
"orientation"?: FormGroupOrientationType;
|
|
1173
|
+
/**
|
|
1174
|
+
* Group's value
|
|
1175
|
+
*/
|
|
1176
|
+
"value"?: string;
|
|
1177
|
+
}
|
|
1148
1178
|
interface GovFormSearch {
|
|
1149
1179
|
/**
|
|
1150
1180
|
* Style variation of the form input.
|
|
@@ -2065,6 +2095,10 @@ export interface GovFormCheckboxCustomEvent<T> extends CustomEvent<T> {
|
|
|
2065
2095
|
detail: T;
|
|
2066
2096
|
target: HTMLGovFormCheckboxElement;
|
|
2067
2097
|
}
|
|
2098
|
+
export interface GovFormCheckboxGroupCustomEvent<T> extends CustomEvent<T> {
|
|
2099
|
+
detail: T;
|
|
2100
|
+
target: HTMLGovFormCheckboxGroupElement;
|
|
2101
|
+
}
|
|
2068
2102
|
export interface GovFormFileCustomEvent<T> extends CustomEvent<T> {
|
|
2069
2103
|
detail: T;
|
|
2070
2104
|
target: HTMLGovFormFileElement;
|
|
@@ -2085,6 +2119,10 @@ export interface GovFormRadioCustomEvent<T> extends CustomEvent<T> {
|
|
|
2085
2119
|
detail: T;
|
|
2086
2120
|
target: HTMLGovFormRadioElement;
|
|
2087
2121
|
}
|
|
2122
|
+
export interface GovFormRadioGroupCustomEvent<T> extends CustomEvent<T> {
|
|
2123
|
+
detail: T;
|
|
2124
|
+
target: HTMLGovFormRadioGroupElement;
|
|
2125
|
+
}
|
|
2088
2126
|
export interface GovFormSelectCustomEvent<T> extends CustomEvent<T> {
|
|
2089
2127
|
detail: T;
|
|
2090
2128
|
target: HTMLGovFormSelectElement;
|
|
@@ -2244,6 +2282,12 @@ declare global {
|
|
|
2244
2282
|
prototype: HTMLGovFormCheckboxElement;
|
|
2245
2283
|
new (): HTMLGovFormCheckboxElement;
|
|
2246
2284
|
};
|
|
2285
|
+
interface HTMLGovFormCheckboxGroupElement extends Components.GovFormCheckboxGroup, HTMLStencilElement {
|
|
2286
|
+
}
|
|
2287
|
+
var HTMLGovFormCheckboxGroupElement: {
|
|
2288
|
+
prototype: HTMLGovFormCheckboxGroupElement;
|
|
2289
|
+
new (): HTMLGovFormCheckboxGroupElement;
|
|
2290
|
+
};
|
|
2247
2291
|
interface HTMLGovFormControlElement extends Components.GovFormControl, HTMLStencilElement {
|
|
2248
2292
|
}
|
|
2249
2293
|
var HTMLGovFormControlElement: {
|
|
@@ -2298,6 +2342,12 @@ declare global {
|
|
|
2298
2342
|
prototype: HTMLGovFormRadioElement;
|
|
2299
2343
|
new (): HTMLGovFormRadioElement;
|
|
2300
2344
|
};
|
|
2345
|
+
interface HTMLGovFormRadioGroupElement extends Components.GovFormRadioGroup, HTMLStencilElement {
|
|
2346
|
+
}
|
|
2347
|
+
var HTMLGovFormRadioGroupElement: {
|
|
2348
|
+
prototype: HTMLGovFormRadioGroupElement;
|
|
2349
|
+
new (): HTMLGovFormRadioGroupElement;
|
|
2350
|
+
};
|
|
2301
2351
|
interface HTMLGovFormSearchElement extends Components.GovFormSearch, HTMLStencilElement {
|
|
2302
2352
|
}
|
|
2303
2353
|
var HTMLGovFormSearchElement: {
|
|
@@ -2520,6 +2570,7 @@ declare global {
|
|
|
2520
2570
|
"gov-error-code": HTMLGovErrorCodeElement;
|
|
2521
2571
|
"gov-form-autocomplete": HTMLGovFormAutocompleteElement;
|
|
2522
2572
|
"gov-form-checkbox": HTMLGovFormCheckboxElement;
|
|
2573
|
+
"gov-form-checkbox-group": HTMLGovFormCheckboxGroupElement;
|
|
2523
2574
|
"gov-form-control": HTMLGovFormControlElement;
|
|
2524
2575
|
"gov-form-file": HTMLGovFormFileElement;
|
|
2525
2576
|
"gov-form-group": HTMLGovFormGroupElement;
|
|
@@ -2529,6 +2580,7 @@ declare global {
|
|
|
2529
2580
|
"gov-form-multi-select": HTMLGovFormMultiSelectElement;
|
|
2530
2581
|
"gov-form-password-power": HTMLGovFormPasswordPowerElement;
|
|
2531
2582
|
"gov-form-radio": HTMLGovFormRadioElement;
|
|
2583
|
+
"gov-form-radio-group": HTMLGovFormRadioGroupElement;
|
|
2532
2584
|
"gov-form-search": HTMLGovFormSearchElement;
|
|
2533
2585
|
"gov-form-select": HTMLGovFormSelectElement;
|
|
2534
2586
|
"gov-form-switch": HTMLGovFormSwitchElement;
|
|
@@ -3115,6 +3167,24 @@ declare namespace LocalJSX {
|
|
|
3115
3167
|
*/
|
|
3116
3168
|
"wcagLabelledBy"?: string;
|
|
3117
3169
|
}
|
|
3170
|
+
interface GovFormCheckboxGroup {
|
|
3171
|
+
/**
|
|
3172
|
+
* Gap's size.
|
|
3173
|
+
*/
|
|
3174
|
+
"gap"?: FormGroupSizesType;
|
|
3175
|
+
/**
|
|
3176
|
+
* /* Emitted when the checkbox change value.
|
|
3177
|
+
*/
|
|
3178
|
+
"onGov-change"?: (event: GovFormCheckboxGroupCustomEvent<FormCheckboxGroupEvent>) => void;
|
|
3179
|
+
/**
|
|
3180
|
+
* Elements orientation
|
|
3181
|
+
*/
|
|
3182
|
+
"orientation"?: FormGroupOrientationType;
|
|
3183
|
+
/**
|
|
3184
|
+
* Group's value
|
|
3185
|
+
*/
|
|
3186
|
+
"value"?: string | string[];
|
|
3187
|
+
}
|
|
3118
3188
|
interface GovFormControl {
|
|
3119
3189
|
/**
|
|
3120
3190
|
* /** Indicates the form element is disabled
|
|
@@ -3577,6 +3647,24 @@ declare namespace LocalJSX {
|
|
|
3577
3647
|
*/
|
|
3578
3648
|
"wcagLabelledBy"?: string;
|
|
3579
3649
|
}
|
|
3650
|
+
interface GovFormRadioGroup {
|
|
3651
|
+
/**
|
|
3652
|
+
* Gap's size.
|
|
3653
|
+
*/
|
|
3654
|
+
"gap"?: FormGroupSizesType;
|
|
3655
|
+
/**
|
|
3656
|
+
* Emitted when the checkbox change value.
|
|
3657
|
+
*/
|
|
3658
|
+
"onGov-change"?: (event: GovFormRadioGroupCustomEvent<FormRadioGroupEvent>) => void;
|
|
3659
|
+
/**
|
|
3660
|
+
* Elements orientation
|
|
3661
|
+
*/
|
|
3662
|
+
"orientation"?: FormGroupOrientationType;
|
|
3663
|
+
/**
|
|
3664
|
+
* Group's value
|
|
3665
|
+
*/
|
|
3666
|
+
"value"?: string;
|
|
3667
|
+
}
|
|
3580
3668
|
interface GovFormSearch {
|
|
3581
3669
|
/**
|
|
3582
3670
|
* Style variation of the form input.
|
|
@@ -4394,6 +4482,7 @@ declare namespace LocalJSX {
|
|
|
4394
4482
|
"gov-error-code": GovErrorCode;
|
|
4395
4483
|
"gov-form-autocomplete": GovFormAutocomplete;
|
|
4396
4484
|
"gov-form-checkbox": GovFormCheckbox;
|
|
4485
|
+
"gov-form-checkbox-group": GovFormCheckboxGroup;
|
|
4397
4486
|
"gov-form-control": GovFormControl;
|
|
4398
4487
|
"gov-form-file": GovFormFile;
|
|
4399
4488
|
"gov-form-group": GovFormGroup;
|
|
@@ -4403,6 +4492,7 @@ declare namespace LocalJSX {
|
|
|
4403
4492
|
"gov-form-multi-select": GovFormMultiSelect;
|
|
4404
4493
|
"gov-form-password-power": GovFormPasswordPower;
|
|
4405
4494
|
"gov-form-radio": GovFormRadio;
|
|
4495
|
+
"gov-form-radio-group": GovFormRadioGroup;
|
|
4406
4496
|
"gov-form-search": GovFormSearch;
|
|
4407
4497
|
"gov-form-select": GovFormSelect;
|
|
4408
4498
|
"gov-form-switch": GovFormSwitch;
|
|
@@ -4460,6 +4550,7 @@ declare module "@stencil/core" {
|
|
|
4460
4550
|
"gov-error-code": LocalJSX.GovErrorCode & JSXBase.HTMLAttributes<HTMLGovErrorCodeElement>;
|
|
4461
4551
|
"gov-form-autocomplete": LocalJSX.GovFormAutocomplete & JSXBase.HTMLAttributes<HTMLGovFormAutocompleteElement>;
|
|
4462
4552
|
"gov-form-checkbox": LocalJSX.GovFormCheckbox & JSXBase.HTMLAttributes<HTMLGovFormCheckboxElement>;
|
|
4553
|
+
"gov-form-checkbox-group": LocalJSX.GovFormCheckboxGroup & JSXBase.HTMLAttributes<HTMLGovFormCheckboxGroupElement>;
|
|
4463
4554
|
"gov-form-control": LocalJSX.GovFormControl & JSXBase.HTMLAttributes<HTMLGovFormControlElement>;
|
|
4464
4555
|
"gov-form-file": LocalJSX.GovFormFile & JSXBase.HTMLAttributes<HTMLGovFormFileElement>;
|
|
4465
4556
|
"gov-form-group": LocalJSX.GovFormGroup & JSXBase.HTMLAttributes<HTMLGovFormGroupElement>;
|
|
@@ -4469,6 +4560,7 @@ declare module "@stencil/core" {
|
|
|
4469
4560
|
"gov-form-multi-select": LocalJSX.GovFormMultiSelect & JSXBase.HTMLAttributes<HTMLGovFormMultiSelectElement>;
|
|
4470
4561
|
"gov-form-password-power": LocalJSX.GovFormPasswordPower & JSXBase.HTMLAttributes<HTMLGovFormPasswordPowerElement>;
|
|
4471
4562
|
"gov-form-radio": LocalJSX.GovFormRadio & JSXBase.HTMLAttributes<HTMLGovFormRadioElement>;
|
|
4563
|
+
"gov-form-radio-group": LocalJSX.GovFormRadioGroup & JSXBase.HTMLAttributes<HTMLGovFormRadioGroupElement>;
|
|
4472
4564
|
"gov-form-search": LocalJSX.GovFormSearch & JSXBase.HTMLAttributes<HTMLGovFormSearchElement>;
|
|
4473
4565
|
"gov-form-select": LocalJSX.GovFormSelect & JSXBase.HTMLAttributes<HTMLGovFormSelectElement>;
|
|
4474
4566
|
"gov-form-switch": LocalJSX.GovFormSwitch & JSXBase.HTMLAttributes<HTMLGovFormSwitchElement>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@gov-design-system-ce/components",
|
|
3
3
|
"description": "This package includes Gov Design System Web Components and related utilities.",
|
|
4
4
|
"author": "Zdeněk Vítek",
|
|
5
|
-
"version": "4.0.8-
|
|
5
|
+
"version": "4.0.8-rc02",
|
|
6
6
|
"license": "EUPL v1.2 Licensed",
|
|
7
7
|
"main": "./dist/index.cjs.js",
|
|
8
8
|
"unpkg": "./dist/core/core.esm.js",
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"dependencies" : {
|
|
25
25
|
"@gov-design-system-ce/icons": "0.0.12",
|
|
26
26
|
"@gov-design-system-ce/fonts": "0.0.2",
|
|
27
|
-
"@gov-design-system-ce/styles": "4.0.
|
|
27
|
+
"@gov-design-system-ce/styles": "4.0.4-rc01"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const r=r=>r!==undefined&&r!==null;const t=r=>typeof r==="object";const n=t=>r(t)&&typeof t==="string";const e=r=>{if(n(r)&&r.length){try{console.log(r);const n=JSON.parse(r);if(Array.isArray(n)||t(n)){return n}}catch(r){console.log(r);return null}}return null};const o=(r,t)=>{if(Number.isInteger(r)&&Number.isInteger(t)){return[...Array(t+1).keys()].slice(r)}return[]};const s=r=>{if(Array.isArray(r)){return r}else if(n(r)){const t=e(r);if(Array.isArray(t)){return t}}return[]};const c=r=>{setTimeout((()=>{r()}),0)};export{o as c,s as p,c as t};
|
|
2
|
-
//# sourceMappingURL=p-6c1d0f47.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["is","value","undefined","isObject","obj","isString","input","parseJSONString","length","console","log","parsed","JSON","parse","Array","isArray","e","createArrayRange","from","to","Number","isInteger","keys","slice","propsValueToArray","tick","callback","setTimeout"],"sources":["../../../packages/core/src/utils/helpers.types.ts","../../../packages/core/src/utils/object.utils.ts","../../../packages/core/src/utils/array.utils.ts","../../../packages/core/src/utils/stencil.utils.ts"],"sourcesContent":["\nexport type Optional<T> = T | undefined;\nexport type Nullable<T> = T | null;\nexport type OptionalProperty<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\nexport type ValueOf<T> = T[keyof T];\n\nexport type DeepPartial<T> = {\n\t[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];\n};\n\nexport type ObjectOrArrayType<T> = T | T[];\nexport const ObjectOrArray = {\n\tfirst: <T>(item: ObjectOrArrayType<T>): T => (Array.isArray(item) ? item[0] : item),\n\tarray: <T>(item: ObjectOrArrayType<T>): T[] => (Array.isArray(item) ? item : [item]),\n};\n\nexport const Omit = <T extends object, P extends keyof T, R extends Omit<T, P>>(properties: P[], object: T): R =>\n\tObject.entries(object).reduce(\n\t\t(all, [key, value]) => (properties.includes(key as P) ? all : { ...all, [key]: value }),\n\t\t{} as R\n\t);\n\nexport const whenDefined =\n\t<I, O>(fn: (input: I) => O) =>\n\t(value?: I): O | undefined =>\n\t\tvalue ? fn(value) : undefined;\n\n/**\n * Comparator function which defines the sort order\n * @example\n * ```\n * // sorts objects by `id` property\n * [{ id: 3 }, { id: 2 }, { id: 1 }].sort(compare(['id']))\n *\n * // sorts objects by `id` and `name` properties\n * [{ id: 3, name: 'b' }, { id: 2, name: 'a' }, { id: 1, name: 'b' }].sort(compare(['id', 'name']))\n * ```\n *\n * @param {Array<keyof T>} properties\n * @return {number}\n */\nexport const compare =\n\t<T extends object>(properties: Array<keyof T>) =>\n\t(a: T, b: T): number => {\n\t\tconst [property, ...rest] = properties;\n\t\tif (!property) {\n\t\t\treturn 0;\n\t\t}\n\t\tif (a[property] < b[property]) {\n\t\t\treturn -1;\n\t\t}\n\t\tif (a[property] > b[property]) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn rest.length > 0 ? compare(rest)(a, b) : 0;\n\t};\n\nexport const is = <T>(value: T | undefined | null): value is T => value !== undefined && value !== null;\n\nexport const has =\n\t<T extends object, P extends keyof T>(property: P) =>\n\t(object: OptionalProperty<T, P>): object is T => {\n\t\treturn !!object[property];\n\t};\n\nexport const equals =\n\t<A>(a?: A) =>\n\t(b?: A): boolean =>\n\t\ta === b;\nexport const prop =\n\t<T, P extends keyof T>(property: P) =>\n\t(object: T): T[P] =>\n\t\tobject[property];\n\nexport const propOptional =\n\t<T, P extends keyof T>(property: P) =>\n\t(object?: T): Optional<T[P]> =>\n\t\tobject ? object[property] : undefined;\n\nexport const hasOwnProperty = <X extends object, Y extends PropertyKey>(\n\tobj: X,\n\tprop: Y\n): obj is X & Record<Y, ValueOf<X>> => {\n\treturn Object.prototype.hasOwnProperty.call(obj, prop);\n};\n\nexport const isObject = <T extends object>(obj: unknown): obj is T => typeof obj === 'object';\nexport const isString = (input: unknown): input is string => is(input) && typeof input === 'string';\nexport const isNumber = (input: unknown): input is string => is(input) && typeof input === 'number';\n\ntype Entries<T> = {\n\t[K in keyof T]: [K, T[K]];\n}[keyof T][];\nexport const getEntries = <T extends object>(obj: T) => Object.entries(obj) as Entries<T>;\n\nexport const getKeys = <T extends object>(obj: T) => Object.keys(obj) as Array<keyof T>;\nexport const getValues = <T extends object>(obj: T) => Object.values(obj) as Array<ValueOf<T>>;\n\nexport const first = <T>(array: T[]): Optional<T> => array[0];\n\nexport const pairs = <T>(arr: T[]): Array<[string, string]> =>\n\tarr.flatMap((item1, index1) => arr.flatMap((item2, index2) => (index1 > index2 ? [[item1, item2]] : []))) as any;\n\nexport const find =\n\t<T, S extends T>(predicate: (item: T) => item is S) =>\n\t(array?: T[]): Optional<S> =>\n\t\t(array || []).find(predicate);\nexport const filter =\n\t<T, S extends T>(predicate: (item: T) => item is S) =>\n\t(array?: T[]): S[] =>\n\t\t(array || []).filter(predicate);\n","import {isObject, isString} from \"./helpers.types\";\n\nexport const parseJSONString = (value: unknown): object | [] | null => {\n\tif (isString(value) && value.length) {\n\t\ttry {\n\t\t\tconsole.log(value);\n\t\t\tconst parsed = JSON.parse(value);\n\t\t\tif (Array.isArray(parsed) || isObject(parsed)) {\n\t\t\t\treturn parsed;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.log(e);\n\t\t\treturn null\n\t\t}\n\t}\n\treturn null\n}\n","import {parseJSONString} from \"./object.utils\";\nimport {isString} from \"./helpers.types\";\n\nexport const createArrayRange = (from: number, to: number): number[] => {\n\tif (Number.isInteger(from) && Number.isInteger(to)) {\n\t\treturn [...Array(to + 1).keys()].slice(from)\n\t}\n\treturn []\n}\n\nexport const propsValueToArray = <T>(value: unknown): T => {\n\tif (Array.isArray(value)) {\n\t\treturn value as T;\n\t} else if (isString(value)) {\n\t\tconst parsed = parseJSONString(value)\n\t\tif (Array.isArray(parsed)) {\n\t\t\treturn parsed as T;\n\t\t}\n\t}\n\treturn [] as T;\n}\n","export const tick = (callback: () => void) => {\n\tsetTimeout(() => {\n\t\tcallback();\n\t}, 0);\n}\n"],"mappings":"AAyDO,MAAMA,EAASC,GAA4CA,IAAUC,WAAaD,IAAU,KA6B5F,MAAME,EAA8BC,UAAkCA,IAAQ,SAC9E,MAAMC,EAAYC,GAAoCN,EAAGM,WAAiBA,IAAU,SCrFpF,MAAMC,EAAmBN,IAC/B,GAAII,EAASJ,IAAUA,EAAMO,OAAQ,CACpC,IACCC,QAAQC,IAAIT,GACZ,MAAMU,EAASC,KAAKC,MAAMZ,GAC1B,GAAIa,MAAMC,QAAQJ,IAAWR,EAASQ,GAAS,CAC9C,OAAOA,C,EAEP,MAAOK,GACRP,QAAQC,IAAIM,GACZ,OAAO,I,EAGT,OAAO,IAAI,E,MCZCC,EAAmB,CAACC,EAAcC,KAC9C,GAAIC,OAAOC,UAAUH,IAASE,OAAOC,UAAUF,GAAK,CACnD,MAAO,IAAIL,MAAMK,EAAK,GAAGG,QAAQC,MAAML,E,CAExC,MAAO,EAAE,E,MAGGM,EAAwBvB,IACpC,GAAIa,MAAMC,QAAQd,GAAQ,CACzB,OAAOA,C,MACD,GAAII,EAASJ,GAAQ,CAC3B,MAAMU,EAASJ,EAAgBN,GAC/B,GAAIa,MAAMC,QAAQJ,GAAS,CAC1B,OAAOA,C,EAGT,MAAO,EAAO,E,MCnBFc,EAAQC,IACpBC,YAAW,KACVD,GAAU,GACR,EAAE,S"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{p as e,H as o,c as i,h as t,d as r}from"./p-2dee9951.js";import{g as s,o as l,p as c,q as n}from"./p-b48d3aae.js";import{g as a,a as g,t as v}from"./p-c353678b.js";import{c as m}from"./p-003e6cca.js";import{v as f}from"./p-dcb5fb35.js";import{b as d,c as h}from"./p-4ff831e3.js";import{c as p}from"./p-24636c53.js";import{d as u}from"./p-03990da5.js";import{p as z,t as w}from"./p-6c1d0f47.js";import{d as x}from"./p-f9f8e529.js";const b='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-select{position:relative;display:flex;width:100%;align-items:center}.gov-form-select .element{position:relative;display:flex;flex:1 1 auto}.gov-form-select input,.gov-form-select select,.gov-form-select textarea{width:100%;border-radius:var(--gov-border-radius, 0.1875rem);background-color:var(--gov-form-bg-color, var(--gov-color-neutral-white));font-family:var(--gov-font-family, "Roboto", sans-serif)}.gov-form-select input:focus,.gov-form-select select:focus,.gov-form-select textarea:focus{outline:none}.gov-form-select input:focus-visible,.gov-form-select select:focus-visible,.gov-form-select textarea:focus-visible{border-radius:var(--gov-border-radius, 0.1875rem);outline:var(--gov-outline-width, 0.125rem) solid var(--gov-color-focus-base);outline-offset:0}.gov-form-select input::-moz-placeholder,.gov-form-select select::-moz-placeholder,.gov-form-select textarea::-moz-placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select input::placeholder,.gov-form-select select::placeholder,.gov-form-select textarea::placeholder{color:var(--gov-form-placeholder-color, var(--gov-color-secondary-600))}.gov-form-select textarea{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);padding:0.5rem 0.75rem;resize:none}.gov-form-select *[slot=left-icon],.gov-form-select *[slot=right-icon]{position:absolute;top:50%;display:flex;justify-content:center;transform:translateY(-50%);pointer-events:none}.gov-form-select *[slot=left-icon]{left:0}.gov-form-select *[slot=right-icon]{right:0}.gov-form-select *[slot=prefix],.gov-form-select *[slot=sufix]{margin:0}[size=s].gov-form-select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);gap:0.5rem var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select input,[size=s].gov-form-select select{font-weight:var(--gov-text-s-font-weight);font-size:var(--gov-text-s-font-size);line-height:var(--gov-text-s-line-height);letter-spacing:var(--gov-text-s-letter-spacing);height:var(--gov-form-input-core-s-height, 2rem);padding:var(--gov-form-input-core-s-padding, 0.25rem 0.75rem)}[size=s].gov-form-select *[slot=left-icon],[size=s].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-s-icon-size, 1rem);height:var(--gov-form-input-core-s-icon-size, 1rem)}[size=s].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=s].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-s-icon-padding, 2rem) - var(--gov-form-input-core-s-icon-size, 1rem)) / 2)}[size=s].gov-form-select *[slot=right-icon]~input,[size=s].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-s-icon-padding, 2rem)}[size=m].gov-form-select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select input,[size=m].gov-form-select select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-m-height, 2.5rem);padding:var(--gov-form-input-core-m-padding, 0.4375rem 0.75rem)}[size=m].gov-form-select *[slot=left-icon],[size=m].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-m-icon-size, 1rem);height:var(--gov-form-input-core-m-icon-size, 1rem)}[size=m].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=m].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-m-icon-padding, 2.5rem) - var(--gov-form-input-core-m-icon-size, 1rem)) / 2)}[size=m].gov-form-select *[slot=right-icon]~input,[size=m].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-m-icon-padding, 2.5rem)}[size=l].gov-form-select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);gap:0.5rem var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select input,[size=l].gov-form-select select{font-weight:var(--gov-text-m-font-weight);font-size:var(--gov-text-m-font-size);line-height:var(--gov-text-m-line-height);letter-spacing:var(--gov-text-m-letter-spacing);height:var(--gov-form-input-core-l-height, 3rem);padding:var(--gov-form-input-core-l-padding, 0.6875rem 0.75rem)}[size=l].gov-form-select *[slot=left-icon],[size=l].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-l-icon-size, 1rem);height:var(--gov-form-input-core-l-icon-size, 1rem)}[size=l].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=l].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-l-icon-padding, 2.5rem) - var(--gov-form-input-core-l-icon-size, 1rem)) / 2)}[size=l].gov-form-select *[slot=right-icon]~input,[size=l].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-l-icon-padding, 2.5rem)}[size=xl].gov-form-select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);gap:0.5rem var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select input,[size=xl].gov-form-select select{font-weight:var(--gov-text-l-font-weight);font-size:var(--gov-text-l-font-size);line-height:var(--gov-text-l-line-height);letter-spacing:var(--gov-text-l-letter-spacing);height:var(--gov-form-input-core-xl-height, 3.5rem);padding:var(--gov-form-input-core-xl-padding, 0.9375rem 1rem 0.875rem)}[size=xl].gov-form-select *[slot=left-icon],[size=xl].gov-form-select *[slot=right-icon]{width:var(--gov-form-input-core-xl-icon-size, 1.25rem);height:var(--gov-form-input-core-xl-icon-size, 1.25rem)}[size=xl].gov-form-select *[slot=left-icon]{left:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=left-icon]~input{padding-left:var(--gov-form-input-core-xl-icon-padding, 3rem)}[size=xl].gov-form-select *[slot=right-icon]{right:calc((var(--gov-form-input-core-xl-icon-padding, 3rem) - var(--gov-form-input-core-xl-icon-size, 1.25rem)) / 2)}[size=xl].gov-form-select *[slot=right-icon]~input,[size=xl].gov-form-select *[slot=right-icon]~select{padding-right:var(--gov-form-input-core-xl-icon-padding, 3rem)}[variant=primary].gov-form-select input,[variant=primary].gov-form-select select,[variant=primary].gov-form-select textarea{color:var(--gov-form-input-color-primary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-primary, 0.0625rem solid var(--gov-color-primary-600))}[variant=primary].gov-form-select *[slot=left-icon],[variant=primary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-primary, var(--gov-color-primary))}[variant=secondary].gov-form-select input,[variant=secondary].gov-form-select select,[variant=secondary].gov-form-select textarea{color:var(--gov-form-input-color-secondary, var(--gov-color-secondary-700));border:var(--gov-form-input-border-secondary, 0.0625rem solid var(--gov-color-secondary-700))}[variant=secondary].gov-form-select *[slot=left-icon],[variant=secondary].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-input-icon-color-secondary, var(--gov-color-primary))}[disabled=""].gov-form-select,[disabled=true i].gov-form-select,[disabled="1"].gov-form-select{pointer-events:none}[disabled=""].gov-form-select input,[disabled=""].gov-form-select select,[disabled=""].gov-form-select textarea,[disabled=true i].gov-form-select input,[disabled=true i].gov-form-select select,[disabled=true i].gov-form-select textarea,[disabled="1"].gov-form-select input,[disabled="1"].gov-form-select select,[disabled="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600));background:var(--gov-form-input-disabled-bg, var(--gov-color-secondary-300));color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600))}[disabled=""].gov-form-select *[slot=left-icon],[disabled=""].gov-form-select *[slot=right-icon],[disabled=true i].gov-form-select *[slot=left-icon],[disabled=true i].gov-form-select *[slot=right-icon],[disabled="1"].gov-form-select *[slot=left-icon],[disabled="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-disabled, var(--gov-color-secondary-600)) !important}[invalid=""].gov-form-select input,[invalid=""].gov-form-select select,[invalid=""].gov-form-select textarea,[invalid=true i].gov-form-select input,[invalid=true i].gov-form-select select,[invalid=true i].gov-form-select textarea,[invalid="1"].gov-form-select input,[invalid="1"].gov-form-select select,[invalid="1"].gov-form-select textarea{border-color:var(--gov-form-state-color-error, var(--gov-color-error));color:var(--gov-form-state-color-error, var(--gov-color-error))}[invalid=""].gov-form-select input::-moz-placeholder,[invalid=""].gov-form-select select::-moz-placeholder,[invalid=""].gov-form-select textarea::-moz-placeholder,[invalid=true i].gov-form-select input::-moz-placeholder,[invalid=true i].gov-form-select select::-moz-placeholder,[invalid=true i].gov-form-select textarea::-moz-placeholder,[invalid="1"].gov-form-select input::-moz-placeholder,[invalid="1"].gov-form-select select::-moz-placeholder,[invalid="1"].gov-form-select textarea::-moz-placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select input::placeholder,[invalid=""].gov-form-select select::placeholder,[invalid=""].gov-form-select textarea::placeholder,[invalid=true i].gov-form-select input::placeholder,[invalid=true i].gov-form-select select::placeholder,[invalid=true i].gov-form-select textarea::placeholder,[invalid="1"].gov-form-select input::placeholder,[invalid="1"].gov-form-select select::placeholder,[invalid="1"].gov-form-select textarea::placeholder{color:var(--gov-form-state-color-error, var(--gov-color-error-300))}[invalid=""].gov-form-select *[slot=left-icon],[invalid=""].gov-form-select *[slot=right-icon],[invalid=true i].gov-form-select *[slot=left-icon],[invalid=true i].gov-form-select *[slot=right-icon],[invalid="1"].gov-form-select *[slot=left-icon],[invalid="1"].gov-form-select *[slot=right-icon]{color:var(--gov-form-state-color-error, var(--gov-color-error)) !important}[invalid=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[invalid="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[success=""].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-arrow){color:var(--gov-form-state-color-success, var(--gov-color-success))}[success=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow),[success="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow){display:none}[multiline=""].gov-form-select *[slot=left-icon],[multiline=""].gov-form-select *[slot=right-icon],[multiline=true i].gov-form-select *[slot=left-icon],[multiline=true i].gov-form-select *[slot=right-icon],[multiline="1"].gov-form-select *[slot=left-icon],[multiline="1"].gov-form-select *[slot=right-icon]{display:none}.gov-form-select{background:none}.gov-form-select select{-webkit-appearance:none;-moz-appearance:none}.gov-form-select select::-ms-expand{display:none}[size=s].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-s-arrow-right-position, 0.75rem);width:var(--gov-form-select-s-arrow-size, 0.75rem);height:var(--gov-form-select-s-arrow-size, 0.75rem)}[size=s][invalid=""].gov-form-select .icon-arrow,[size=s][invalid=true i].gov-form-select .icon-arrow,[size=s][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=s][success=""].gov-form-select .icon-arrow,[size=s][success=true i].gov-form-select .icon-arrow,[size=s][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-s-arrow-right-position, 0.75rem))}[size=m].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-m-arrow-right-position, 1rem);width:var(--gov-form-select-m-arrow-size, 0.75rem);height:var(--gov-form-select-m-arrow-size, 0.75rem)}[size=m][invalid=""].gov-form-select .icon-arrow,[size=m][invalid=true i].gov-form-select .icon-arrow,[size=m][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=m][success=""].gov-form-select .icon-arrow,[size=m][success=true i].gov-form-select .icon-arrow,[size=m][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-m-arrow-right-position, 1rem))}[size=l].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-l-arrow-right-position, 1rem);width:var(--gov-form-select-l-arrow-size, 1rem);height:var(--gov-form-select-l-arrow-size, 1rem)}[size=l][invalid=""].gov-form-select .icon-arrow,[size=l][invalid=true i].gov-form-select .icon-arrow,[size=l][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=l][success=""].gov-form-select .icon-arrow,[size=l][success=true i].gov-form-select .icon-arrow,[size=l][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-l-arrow-right-position, 1rem))}[size=xl].gov-form-select *[slot=right-icon]{right:var(--gov-form-select-xl-arrow-right-position, 1.3125rem);width:var(--gov-form-select-xl-arrow-size, 1rem);height:var(--gov-form-select-xl-arrow-size, 1rem)}[size=xl][invalid=""].gov-form-select .icon-arrow,[size=xl][invalid=true i].gov-form-select .icon-arrow,[size=xl][invalid="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=xl][success=""].gov-form-select .icon-arrow,[size=xl][success=true i].gov-form-select .icon-arrow,[size=xl][success="1"].gov-form-select .icon-arrow{right:calc(3 * var(--gov-form-select-xl-arrow-right-position, 1.3125rem))}[size=s][invalid=""].gov-form-select *[slot=right-icon]~select,[size=s][invalid=""].gov-form-select *[slot=right-icon]~input,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=s][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=s][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=s][success=""].gov-form-select *[slot=right-icon]~select,[size=s][success=""].gov-form-select *[slot=right-icon]~input,[size=s][success=true i].gov-form-select *[slot=right-icon]~select,[size=s][success=true i].gov-form-select *[slot=right-icon]~input,[size=s][success="1"].gov-form-select *[slot=right-icon]~select,[size=s][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-s-icon-padding, 2rem))}[size=m][invalid=""].gov-form-select *[slot=right-icon]~select,[size=m][invalid=""].gov-form-select *[slot=right-icon]~input,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=m][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=m][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=m][success=""].gov-form-select *[slot=right-icon]~select,[size=m][success=""].gov-form-select *[slot=right-icon]~input,[size=m][success=true i].gov-form-select *[slot=right-icon]~select,[size=m][success=true i].gov-form-select *[slot=right-icon]~input,[size=m][success="1"].gov-form-select *[slot=right-icon]~select,[size=m][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-m-icon-padding, 2.5rem))}[size=l][invalid=""].gov-form-select *[slot=right-icon]~select,[size=l][invalid=""].gov-form-select *[slot=right-icon]~input,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=l][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=l][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=l][success=""].gov-form-select *[slot=right-icon]~select,[size=l][success=""].gov-form-select *[slot=right-icon]~input,[size=l][success=true i].gov-form-select *[slot=right-icon]~select,[size=l][success=true i].gov-form-select *[slot=right-icon]~input,[size=l][success="1"].gov-form-select *[slot=right-icon]~select,[size=l][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-l-icon-padding, 2.5rem))}[size=xl][invalid=""].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=""].gov-form-select *[slot=right-icon]~input,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~select,[size=xl][invalid=true i].gov-form-select *[slot=right-icon]~input,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~select,[size=xl][invalid="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}[size=xl][success=""].gov-form-select *[slot=right-icon]~select,[size=xl][success=""].gov-form-select *[slot=right-icon]~input,[size=xl][success=true i].gov-form-select *[slot=right-icon]~select,[size=xl][success=true i].gov-form-select *[slot=right-icon]~input,[size=xl][success="1"].gov-form-select *[slot=right-icon]~select,[size=xl][success="1"].gov-form-select *[slot=right-icon]~input{padding-right:calc(2 * var(--gov-form-input-core-xl-icon-padding, 3rem))}';const y=e(class e extends o{constructor(){super();this.__registerHost();this.govFocus=i(this,"gov-focus",7);this.govBlur=i(this,"gov-blur",7);this.govChange=i(this,"gov-change",7);this.value=undefined;this.options=undefined;this.identifier=undefined;this.variant="secondary";this.size="m";this.name=undefined;this.required=false;this.success=undefined;this.disabled=false;this.invalid=undefined;this.wcagActiveDescendant=undefined;this.wcagControls=undefined;this.wcagDescribedBy=undefined;this.wcagLabelledBy=undefined;this.wcagOwns=undefined;this.focused=undefined;this.optionsState=[];this.h=a(this.host);this.f=s(this.h);this.selectId=p("GovSelect")}validateVariant(e){f(c,e,l.root)}validateSize(e){f(n,e,l.root)}watchOptions(e){this.optionsState=z(e)}watchDisabled(){this.passControlAttrs()}watchValue(){this.markSelectedValue()}passControlAttrs(){this.f.passAttrToControl("size",this.size);this.f.passAttrToControl("invalid",g(this.invalid));this.f.passAttrToControl("type","select")}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size);this.markSelectedValue();this.passControlAttrs();this.f.passAttrToLabel("required",String(this.required));this.optionsState=z(this.options)}async componentDidRender(){if(m()){await u(500);await this.validateWcag()}w((()=>this.markSelectedValue()))}markSelectedValue(){this.host.querySelectorAll("option").forEach((e=>{if(e.value===this.value){e.setAttribute("selected","selected")}else{e.removeAttribute("selected")}}))}render(){return t(r,{class:l.root,size:this.size,variant:this.variant},this.h.hasSlot("prefix")&&t("slot",{name:"prefix"}),t("span",{class:"element"},t("gov-icon",{slot:"right-icon",name:"chevron-down",class:"icon-arrow"}),this.h.hasSlot("right-icon")&&!(this.success||this.invalid)&&t("slot",{name:"right-icon"}),this.success&&t("gov-icon",{slot:"right-icon",class:"icon-validation",name:"check-lg"}),this.invalid&&t("gov-icon",{slot:"right-icon",class:"icon-validation",name:"exclamation-lg"}),t("select",{id:this.identifier||this.selectId,onFocus:this.onFocusHandler.bind(this),onChange:this.onChangeHandler.bind(this),onBlur:this.onBlurHandler.bind(this),required:this.required,name:this.name,disabled:this.disabled,ref:e=>this.selectRef=e,"aria-disabled":v(this.disabled),"aria-activedescendant":this.wcagActiveDescendant,"aria-controls":this.wcagControls,"aria-required":v(this.required),"aria-invalid":v(this.invalid),"aria-describedby":this.wcagDescribedBy,"aria-labelledby":this.wcagLabelledBy,"aria-owns":this.wcagOwns},t("slot",null),Array.isArray(this.optionsState)&&this.optionsState.map((e=>{var o;return t("option",{value:e.value,selected:e.value===this.value,disabled:e===null||e===void 0?void 0:e.disabled},(o=e.label)!==null&&o!==void 0?o:e.value)})))),this.h.hasSlot("sufix")&&t("slot",{name:"sufix"}))}onFocusHandler(e){this.focused=true;this.govFocus.emit({component:l.root,originalEvent:e,value:this.value})}onBlurHandler(e){this.focused=false;this.govBlur.emit({component:l.root,originalEvent:e,value:this.value})}onChangeHandler(e){this.value=e.target.value;e.stopPropagation();this.govChange.emit({component:l.root,originalEvent:e,value:this.value})}async setFocus(e){return this.selectRef.focus(e)}async getRef(){return this.selectRef}async validateWcag(){d(this.wcagActiveDescendant,"wcag-active-descendant",l.root);d(this.wcagControls,"wcag-controls",l.root);d(this.wcagDescribedBy,"wcag-described-by",l.root);d(this.wcagOwns,"wcag-owns",l.root);h(this.identifier||this.selectId,this.wcagLabelledBy,l.root)}get host(){return this}static get watchers(){return{variant:["validateVariant"],size:["validateSize","watchDisabled"],options:["watchOptions"],disabled:["watchDisabled"],invalid:["watchDisabled"],value:["watchValue"]}}static get style(){return b}},[4,"gov-form-select",{value:[1537],options:[1537],identifier:[1],variant:[1],size:[1],name:[1],required:[4],success:[4],disabled:[4],invalid:[4],wcagActiveDescendant:[1,"wcag-active-descendant"],wcagControls:[1,"wcag-controls"],wcagDescribedBy:[1,"wcag-described-by"],wcagLabelledBy:[1,"wcag-labelled-by"],wcagOwns:[1,"wcag-owns"],focused:[32],optionsState:[32],setFocus:[64],getRef:[64],validateWcag:[64]}]);function k(){if(typeof customElements==="undefined"){return}const e=["gov-form-select","gov-icon"];e.forEach((e=>{switch(e){case"gov-form-select":if(!customElements.get(e)){customElements.define(e,y)}break;case"gov-icon":if(!customElements.get(e)){x()}break}}))}k();export{y as G,k as d};
|
|
2
|
-
//# sourceMappingURL=p-c9baa62f.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["govFormRadioCss","GovFormRadio","constructor","hostRef","this","radioId","createID","h","govHost","host","f","govForm","validateSize","newValue","validateProp","FormRadioSizes","FormRadioClass","root","watchDisabled","passControlAttrs","passAttrToControl","size","toBoolAttr","invalid","componentWillLoad","componentDidRender","passAttrToLabel","identifier","String","required","canValidateWcagOnRender","delay","validateWcag","render","wrapRadio","children","noLabel","class","label","Host","checked","toBoolAttrIfDefined","holder","Fragment","input","id","type","value","name","disabled","onClick","onClickHandler","bind","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","ref","el","inputRef","wcagDescribedBy","wcagLabelledBy","e","stopPropagation","govFocus","emit","component","originalEvent","govBlur","target","govChange","getRef","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/radio/gov-form-radio.scss?tag=gov-form-radio","../../../packages/core/src/components/gov-form/radio/gov-form-radio.tsx"],"sourcesContent":["/*\n * Radio\n */\n\n@import \"../checkbox/gov-form-checkbox-core.scss\";\n$class: \".gov-form-radio\";\n\n#{$class} {\n\t@extend %form-checkbox-core;\n\tinput + span {\n\t\t&::before {\n\t\t\tborder-radius: 50%;\n\t\t}\n\t\t&::after {\n\t\t\t@include pseudo();\n\t\t\tborder-radius: 50%;\n\t\t\tbackground: $form-radio-indicator-bg;\n\t\t\topacity: 0;\n\t\t\ttransition: $t linear opacity;\n\t\t}\n\t}\n\n\t&__label {\n\t\tposition: relative;\n\t}\n\n\t// STATES\n\tinput:checked + span::after {\n\t\topacity: 1;\n\t}\n\t@include parameter(\"invalid\") {\n\t\tinput + span::after {\n\t\t\tbackground: $form-state-color-error;\n\t\t}\n\t}\n\t@include parameter(\"disabled\") {\n\t\tinput:checked + span::after {\n\t\t\tbackground-color: $form-state-bg-disabled;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $form-checkbox-core-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\tinput + span::after {\n\t\t\t\ttop: calc((get(\"indicator-size\", $definitions) - get(\"dot-size\", $definitions)) / 2);\n\t\t\t\tleft: calc((get(\"indicator-size\", $definitions) - get(\"dot-size\", $definitions)) / 2);\n\t\t\t\twidth: get(\"dot-size\", $definitions);\n\t\t\t\theight: get(\"dot-size\", $definitions);\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch } from \"@stencil/core\"\nimport { createID } from \"../../../utils/string.utils\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { FormRadioClass, FormRadioSizes, FormRadioSizesType } from \"./constants\"\nimport { govHost, toBoolAttr, toBoolAttrIfDefined } from \"../../../helpers/Dom/template\"\nimport { validateWcagLabelFor, validateWcagRef } from \"../../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { GovForm } from \"../../../helpers/Dom/form.types\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport Fragment from \"../../../helpers/Fragment\"\nimport { FormRadioEvent } from \"./gov-form-radio.types\"\n\n@Component({\n\ttag: \"gov-form-radio\",\n\tstyleUrl: \"gov-form-radio.scss\",\n})\nexport class GovFormRadio {\n\tprivate readonly h: GovHost\n\tprivate f: GovForm\n\tprivate inputRef?: HTMLInputElement\n\n\tprivate readonly radioId: string\n\n\tconstructor() {\n\t\tthis.radioId = createID(\"GovRadio\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormRadioElement\n\t/**\n\t * Value of radio\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * When you can't use the form label.\n\t */\n\t@Prop({ attribute: \"no-label\" }) readonly noLabel: boolean = false\n\t/**\n\t * Radio button state\n\t */\n\t@Prop({ reflect: true, mutable: true }) checked = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the radio component disabled.\n\t * This prevents users from being able to interact with the radio, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Name of the radio.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Radio's size.\n\t */\n\t@Prop() readonly size?: FormRadioSizesType = \"m\"\n\t/**\n\t * Custom radio identifier.\n\t */\n\t@Prop({ attribute: \"identifier\" }) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the radio has focus.\n\t */\n\t@Event({ eventName: \"gov-focus\" }) govFocus: EventEmitter<FormRadioEvent>\n\t/**\n\t * Emitted when the radio loses focus.\n\t */\n\t@Event({ eventName: \"gov-blur\" }) govBlur: EventEmitter<FormRadioEvent>\n\t/**\n\t * Emitted when the radio change value.\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<FormRadioEvent>\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormRadioSizes, newValue, FormRadioClass.root)\n\t}\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\t@Watch(\"size\")\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"size\", this.size)\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"type\", \"radio\")\n\t}\n\n\n\tcomponentWillLoad() {\n\t\tthis.passControlAttrs()\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel(\"identifier\", this.identifier || this.radioId)\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst wrapRadio = children => {\n\t\t\tif (this.noLabel) {\n\t\t\t\treturn <label class={FormRadioClass.label}>{children}</label>\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\n\t\treturn (\n\t\t\t<Host class={FormRadioClass.root} checked={this.checked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t<div class={FormRadioClass.holder}>\n\t\t\t\t\t{wrapRadio(\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass={FormRadioClass.input}\n\t\t\t\t\t\t\t\tid={this.identifier || this.radioId}\n\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\t\tchecked={this.checked}\n\t\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\t\taria-checked={this.checked}\n\t\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<slot name=\"label\" />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormRadioClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormRadioClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.checked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormRadioClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormRadioClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormRadioClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.radioId, this.wcagLabelledBy, FormRadioClass.root)\n\t}\n}\n"],"mappings":"mhBAAA,MAAMA,EAAkB,kkP,MCkBXC,EAAY,MAOxB,WAAAC,CAAAC,G,wJAe6D,M,aAIX,M,cAKb,M,cAKA,M,8BAQQ,I,8GApC5CC,KAAKC,QAAUC,EAAS,YAExBF,KAAKG,EAAIC,EAAQJ,KAAKK,MACtBL,KAAKM,EAAIC,EAAQP,KAAKG,E,CAgEvB,YAAAK,CAAaC,GACZC,EAAaC,EAAgBF,EAAUG,EAAeC,K,CAMvD,aAAAC,GACCd,KAAKe,kB,CAGE,gBAAAA,GACPf,KAAKM,EAAEU,kBAAkB,OAAQhB,KAAKiB,MACtCjB,KAAKM,EAAEU,kBAAkB,UAAWE,EAAWlB,KAAKmB,UACpDnB,KAAKM,EAAEU,kBAAkB,OAAQ,Q,CAIlC,iBAAAI,GACCpB,KAAKe,kB,CAGN,wBAAMM,GACLrB,KAAKM,EAAEgB,gBAAgB,aAActB,KAAKuB,YAAcvB,KAAKC,SAC7DD,KAAKM,EAAEgB,gBAAgB,WAAYE,OAAOxB,KAAKyB,WAC/C,GAAIC,IAA2B,OACxBC,EAAM,WACN3B,KAAK4B,c,EAIb,MAAAC,GACC,MAAMC,EAAYC,IACjB,GAAI/B,KAAKgC,QAAS,CACjB,OAAO7B,EAAA,SAAO8B,MAAOrB,EAAesB,OAAQH,E,CAE7C,OAAOA,CAAQ,EAGhB,OACC5B,EAACgC,EAAI,CAACF,MAAOrB,EAAeC,KAAMuB,QAASpC,KAAKoC,QAASnB,KAAMjB,KAAKiB,KAAME,QAASkB,EAAoBrC,KAAKmB,UAC3GhB,EAAA,OAAK8B,MAAOrB,EAAe0B,QACzBR,EACA3B,EAACoC,EAAQ,KACRpC,EAAA,SACC8B,MAAOrB,EAAe4B,MACtBC,GAAIzC,KAAKuB,YAAcvB,KAAKC,QA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BAAoB/C,EAAeC,MACxE0D,EAAqBvE,KAAKuB,YAAcvB,KAAKC,QAASD,KAAK2D,eAAgB/C,EAAeC,K"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["govFormSwitchCss","GovFormSwitch","constructor","hostRef","this","checkboxId","createID","h","govHost","host","f","govForm","validateSize","newValue","validateProp","FormSwitchSizes","FormSwitchClass","root","watchDisabled","passControlAttrs","passAttrToControl","size","toBoolAttr","invalid","componentWillLoad","componentDidRender","passAttrToLabel","identifier","String","required","canValidateWcagOnRender","delay","validateWcag","render","wrapCheckbox","children","noLabel","Host","class","classes","checked","toBoolAttrIfDefined","holder","Fragment","input","id","type","value","name","disabled","onClick","onClickHandler","bind","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","ref","el","inputRef","wcagDescribedBy","wcagLabelledBy","indicator","e","stopPropagation","govFocus","emit","component","originalEvent","govBlur","target","govChange","getRef","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/switch/gov-form-switch.scss?tag=gov-form-switch","../../../packages/core/src/components/gov-form/switch/gov-form-switch.tsx"],"sourcesContent":["/*\n * Switch\n */\n\n$class: \".gov-form-switch\";\n$indicator-ratio: calc(5 / 3);\n\n#{$class} {\n\tposition: relative;\n\tdisplay: flex;\n\t&__holder {\n\t\tdisplay: inline-flex;\n\t}\n\t&__input {\n\t\tposition: relative;\n\t\tz-index: 1;\n\t\tappearance: none;\n\t\tcursor: pointer;\n\t\tflex-shrink: 0;\n\t}\n\t.gov-form-label__label {\n\t\tposition: relative;\n\t\tz-index: 1;\n\t\tmargin-bottom: 0;\n\t\tcolor: $form-switch-color;\n\t}\n\t&__indicator {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tborder: $form-switch-indicator-border;\n\t\tbackground-color: $form-switch-indicator-bg;\n\t\ttransition: $t linear background-color;\n\t\t&::before {\n\t\t\t@include pseudo();\n\t\t\tborder-radius: 50%;\n\t\t\tbackground-color: $form-switch-indicator-circle-bg;\n\t\t\ttransition: $t linear left;\n\t\t\tbox-shadow: $form-switch-indicator-circle-box-shadow;\n\t\t}\n\t}\n\n\t// STATES\n\t// focus\n\t&__input:focus-visible ~ &__indicator {\n\t\toutline: $outline;\n\t}\n\t// checked\n\t&__input:checked + &__indicator {\n\t\tborder-color: $form-switch-indicator-bg-checked;\n\t\tbackground-color: $form-switch-indicator-bg-checked;\n\t}\n\n\t// disabled\n\t@include parameter(\"disabled\") {\n\t\tpointer-events: none;\n\t\t.gov-form-label__label {\n\t\t\tcolor: $form-state-color-disabled;\n\t\t}\n\t\t#{$class} {\n\t\t\t&__indicator {\n\t\t\t\t&::before {\n\t\t\t\t\tbackground: $form-state-bg-input-disabled;\n\t\t\t\t}\n\t\t\t}\n\t\t\t&__input:checked + #{$class}__indicator {\n\t\t\t\tborder-color: $form-state-bg-disabled;\n\t\t\t\tbackground-color: $form-state-bg-disabled;\n\t\t\t}\n\t\t}\n\t}\n\n\t// invalid\n\t@include parameter(\"invalid\") {\n\t\t.gov-form-label__label {\n\t\t\tcolor: $form-state-color-error;\n\t\t}\n\t\t#{$class} {\n\t\t\t&__indicator {\n\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t}\n\t\t\t&__input:checked + #{$class}__indicator {\n\t\t\t\tbackground-color: $form-state-color-error;\n\t\t\t}\n\t\t}\n\t}\n\n\t// sizes\n\t@each $size, $definitions in $form-switch-sizes {\n\t\t$indicator-width: calc(get(\"indicator-height\", $definitions) * $indicator-ratio);\n\t\t$indicator-height: get(\"indicator-height\", $definitions);\n\t\t$border-offset: calc(get(\"toggle-offset\", $definitions) - rem-calc(1));\n\n\t\t&[size=\"#{$size}\"] {\n\t\t\t.gov-form-label__label {\n\t\t\t\t@include typography($size);\n\t\t\t\tmargin-bottom: 0;\n\t\t\t}\n\t\t\t#{$class} {\n\t\t\t\t&__holder {\n\t\t\t\t\tgap: get(\"gap\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__input {\n\t\t\t\t\twidth: $indicator-width;\n\t\t\t\t\theight: $indicator-height;\n\t\t\t\t}\n\t\t\t\t&__indicator {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\twidth: $indicator-width;\n\t\t\t\t\theight: $indicator-height;\n\t\t\t\t\tborder-radius: calc($indicator-height * 0.5);\n\t\t\t\t\t&::before {\n\t\t\t\t\t\ttop: $border-offset;\n\t\t\t\t\t\tleft: $border-offset;\n\t\t\t\t\t\twidth: calc($indicator-height - (2 * get(\"toggle-offset\", $definitions)));\n\t\t\t\t\t\theight: calc($indicator-height - (2 * get(\"toggle-offset\", $definitions)));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// STATES\n\t\t\t\t&__input[aria-checked] + #{$class}__indicator {\n\t\t\t\t\t&::before {\n\t\t\t\t\t\tleft: calc($indicator-width - $indicator-height + $border-offset);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlabel {\n\t\t\t\tdisplay: inline-flex;\n\t\t\t\t#{$class}__input {\n\t\t\t\t\twidth: $indicator-width;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch } from \"@stencil/core\"\nimport { createID } from \"../../../utils/string.utils\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { FormSwitchClass, FormSwitchSizes, FormSwitchSizesType } from \"./constants\"\nimport { govHost, toBoolAttr, toBoolAttrIfDefined } from \"../../../helpers/Dom/template\"\nimport { validateWcagLabelFor, validateWcagRef } from \"../../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { GovForm } from \"../../../helpers/Dom/form.types\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport Fragment from \"../../../helpers/Fragment\"\nimport { FormSwitchEvent } from \"./gov-form-switch.types\"\n\n@Component({\n\ttag: \"gov-form-switch\",\n\tstyleUrl: \"gov-form-switch.scss\",\n})\nexport class GovFormSwitch {\n\tprivate readonly h: GovHost\n\tprivate f: GovForm\n\tprivate inputRef?: HTMLInputElement\n\n\tprivate readonly checkboxId: string\n\n\tconstructor() {\n\t\tthis.checkboxId = createID(\"GovCheckbox\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSwitchElement\n\t/**\n\t * Value of switch\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * When you can't use the form label.\n\t */\n\t@Prop({ attribute: \"no-label\" }) readonly noLabel: boolean = false\n\t/**\n\t * Switch button state\n\t */\n\t@Prop({ reflect: true, mutable: true }) checked = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the switch component disabled.\n\t * This prevents users from being able to interact with the switch, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Name of the switch.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Switch's size.\n\t */\n\t@Prop() readonly size?: FormSwitchSizesType = \"m\"\n\t/**\n\t * Custom switch identifier.\n\t */\n\t@Prop({ attribute: \"identifier\" }) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the switch has focus.\n\t */\n\t@Event({ eventName: \"gov-focus\" }) govFocus: EventEmitter<FormSwitchEvent>\n\t/**\n\t * Emitted when the switch loses focus.\n\t */\n\t@Event({ eventName: \"gov-blur\" }) govBlur: EventEmitter<FormSwitchEvent>\n\t/**\n\t * Emitted when the switch change value.\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<FormSwitchEvent>\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSwitchSizes, newValue, FormSwitchClass.root)\n\t}\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\t@Watch(\"size\")\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"size\", this.size)\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl(\"type\", \"switch\")\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.passControlAttrs()\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel(\"identifier\", this.identifier || this.checkboxId)\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst wrapCheckbox = (children) => {\n\t\t\tif (this.noLabel) {\n\t\t\t\treturn (\n\t\t\t\t\t<label>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</label>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\n\t\treturn (\n\t\t\t<Host class={this.h.classes(FormSwitchClass.root)} checked={this.checked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t<div class={FormSwitchClass.holder}>\n\t\t\t\t\t{wrapCheckbox(\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass={FormSwitchClass.input}\n\t\t\t\t\t\t\t\tid={this.identifier || this.checkboxId}\n\t\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\t\tchecked={this.checked}\n\t\t\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\t\taria-checked={this.checked}\n\t\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<span class={FormSwitchClass.indicator}></span>\n\t\t\t\t\t\t\t<slot name=\"label\"></slot>\n\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormSwitchClass.root,\n\t\t\tchecked: this.checked,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormSwitchClass.root,\n\t\t\tchecked: this.checked,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.checked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormSwitchClass.root,\n\t\t\tchecked: this.checked,\n\t\t\tvalue: this.value,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormSwitchClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormSwitchClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.checkboxId, this.wcagLabelledBy, FormSwitchClass.root)\n\t}\n}\n"],"mappings":"mhBAAA,MAAMA,EAAmB,stU,MCkBZC,EAAa,MAOzB,WAAAC,CAAAC,G,wJAe6D,M,aAIX,M,cAKb,M,cAKA,M,8BAQS,I,8GApC7CC,KAAKC,WAAaC,EAAS,eAE3BF,KAAKG,EAAIC,EAAQJ,KAAKK,MACtBL,KAAKM,EAAIC,EAAQP,KAAKG,E,CAgEvB,YAAAK,CAAaC,GACZC,EAAaC,EAAiBF,EAAUG,EAAgBC,K,CAMzD,aAAAC,GACCd,KAAKe,kB,CAGE,gBAAAA,GACPf,KAAKM,EAAEU,kBAAkB,OAAQhB,KAAKiB,MACtCjB,KAAKM,EAAEU,kBAAkB,UAAWE,EAAWlB,KAAKmB,UACpDnB,KAAKM,EAAEU,kBAAkB,OAAQ,S,CAGlC,iBAAAI,GACCpB,KAAKe,kB,CAGN,wBAAMM,GACLrB,KAAKM,EAAEgB,gBAAgB,aAActB,KAAKuB,YAAcvB,KAAKC,YAC7DD,KAAKM,EAAEgB,gBAAgB,WAAYE,OAAOxB,KAAKyB,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,cAAeL,G,CAIT,aAAAP,CAAcO,GACrBA,EAAEC,kBACF9D,KAAKmE,QAAQH,KAAK,CACjBC,UAAWrD,EAAgBC,KAC3BuB,QAASpC,KAAKoC,QACdO,MAAO3C,KAAK2C,MACZuB,cAAeL,G,CAIT,eAAAX,CAAgBW,GACvB7D,KAAKoC,QAAWyB,EAAEO,OAA4BhC,QAC9CyB,EAAEC,kBACF9D,KAAKqE,UAAUL,KAAK,CACnBC,UAAWrD,EAAgBC,KAC3BuB,QAASpC,KAAKoC,QACdO,MAAO3C,KAAK2C,MACZuB,cAAeL,G,CAQjB,YAAMS,GACL,OAAOtE,KAAKyD,Q,CAOb,kBAAM7B,GACL2C,EAAgBvE,KAAK0D,gBAAiB,oBAAqB9C,EAAgBC,MAC3E0D,EAAgBvE,KAAK2D,eAAgB,mBAAoB/C,EAAgBC,MACzE2D,EAAqBxE,KAAKuB,YAAcvB,KAAKC,WAAYD,KAAK2D,eAAgB/C,EAAgBC,K"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["govFormMultiSelectCss","GovFormMultiSelect","constructor","hostRef","this","selectId","createID","listId","h","govHost","host","f","govForm","validateVariant","newValue","validateProp","FormMultiselectVariants","FormMultiSelectClass","root","validateSize","FormMultiselectSizes","watchOptions","optionsState","propsValueToArray","watchValue","selectedOptionsState","watchDisabled","passControlAttrs","passAttrToControl","size","toBoolAttr","invalid","success","componentWillLoad","variant","passAttrToLabel","String","required","options","value","getAvailableOptions","ignoreFilter","Array","isArray","length","filter","option","selectedIndex","selectedValueIndex","disabled","map","_a","name","from","selectRef","querySelectorAll","selected","textContent","initAutocomplete","autocompleteRef","addEventListener","onSelectHandler","bind","_b","onInputHandler","_c","onFocusHandler","_d","onBlurHandler","_e","setSearchCallback","searchString","Promise","resolve","data","removeDiacritics","toLowerCase","indexOf","finally","findIndex","getOptionElement","querySelector","getOption","find","selectOption","newOption","notify","index","govChange","emit","component","govSelect","removeOption","splice","govRemove","componentDidLoad","componentDidRender","tick","forEach","canValidateWcagOnRender","delay","validateWcag","render","Host","class","wrap","valueState","identifier","placeholder","messageEmpty","messageLoading","ref","el","minlength","wcagDescribedBy","wcagLabelledBy","wcagOwns","slot","hasSlot","hidden","multiple","toBoolAttrIfDefined","selectedOption","hideSelectedList","role","id","list","item","wcagLabel","type","onTagRemove","e","stopPropagation","focused","govFocus","originalEvent","govBlur","detail","clearValue","focus","setFocus","setValue","getRef","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.scss?tag=gov-form-multi-select","../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.tsx"],"sourcesContent":["/*\n * Multiselect\n */\n\n@import \"../select/gov-form-select-core.scss\";\n$class: \".gov-form-multi-select\";\n\n#{$class} {\n\t@extend %form-select-core;\n\tflex-wrap: wrap;\n\t&__wrap {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\twidth: 100%;\n\t}\n\t&__list {\n\t\t@extend %reset-ul;\n\t\t@include typography($font-size-xs);\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\tflex-wrap: wrap;\n\t}\n\t&__list > &__item {\n\t\t@extend %reset-ul-li;\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tflex: 0 0 auto;\n\t\talign-items: center;\n\t\tpadding: rem-calc(0 0 0 8);\n\t\tbackground: $form-multiselect-bg;\n\t\ttransition: $t linear background-color;\n\t}\n}\n","import {Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch} from '@stencil/core'\nimport {govForm} from '../../../helpers/Dom/form'\nimport {GovForm} from '../../../helpers/Dom/form.types'\nimport {govHost, toBoolAttr, toBoolAttrIfDefined} from '../../../helpers/Dom/template'\nimport {GovHost} from '../../../helpers/Dom/template.types'\nimport {canValidateWcagOnRender} from '../../../helpers/Dom/win'\nimport {validateProp} from '../../../helpers/Validate/props'\nimport {validateWcagLabelFor, validateWcagRef} from '../../../helpers/Validate/wcag'\nimport {Nullable} from '../../../types/interfaces'\nimport {createID, removeDiacritics} from '../../../utils/string.utils'\nimport {delay} from '../../../utils/utils'\nimport {FormAutocompleteEvent} from '../autocomplete/gov-form-autocomplete.types'\nimport {\n\tFormMultiSelectClass,\n\tFormMultiselectSizes,\n\tFormMultiselectSizesType,\n\tFormMultiselectVariants,\n\tFormMultiselectVariantType\n} from './constants'\nimport {\n\tFormMultiselectEvent,\n\tGovFormMultiSelectItem,\n\tGovFormMultiSelectSelectedItem\n} from './gov-form-multi-select.types'\nimport {propsValueToArray} from \"../../../utils/array.utils\";\nimport {tick} from \"../../../utils/stencil.utils\";\n\n@Component({\n\ttag: 'gov-form-multi-select',\n\tstyleUrl: 'gov-form-multi-select.scss',\n})\nexport class GovFormMultiSelect {\n\tprivate f: GovForm\n\tprivate readonly h: GovHost\n\n\tprivate selectRef?: HTMLSelectElement\n\tprivate autocompleteRef?: HTMLGovFormAutocompleteElement\n\n\tprivate readonly selectId: string\n\tprivate readonly listId: string\n\n\tconstructor() {\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.listId = createID('GovMultiList')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Value of multi-select\n\t */\n\t@Prop({reflect: true, mutable: true}) value: string | GovFormMultiSelectSelectedItem[]\n\t/**\n\t * Options of multi-select\n\t */\n\t@Prop({reflect: true, mutable: true}) options?: string | GovFormMultiSelectItem[]\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({attribute: 'identifier'}) readonly identifier: string\n\t/**\n\t * Custom select placeholder.\n\t */\n\t@Prop({attribute: 'placeholder'}) readonly placeholder: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormMultiselectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormMultiselectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Option to hide the list of selected items\n\t */\n\t@Prop({attribute: 'hide-selected-list'}) readonly hideSelectedList: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Custom message for when there is a blank sheet\n\t */\n\t@Prop({attribute: 'message-empty'}) readonly messageEmpty: string = 'Nebyly nalezeny žádné výsledky'\n\t/**\n\t * Custom message for when data is loaded\n\t */\n\t@Prop({attribute: 'message-loading'}) readonly messageLoading: string = 'Načítám...'\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-described-by'}) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({attribute: 'wcag-labelled-by'}) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({attribute: 'wcag-owns'}) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({eventName: 'gov-focus'}) govFocus: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({eventName: 'gov-blur'}) govBlur: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({eventName: 'gov-change'}) govChange: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is selected\n\t */\n\t@Event({eventName: 'gov-select'}) govSelect: EventEmitter<FormMultiselectEvent>\n\t/**\n\t * Emitted when an item is removed\n\t */\n\t@Event({eventName: 'gov-remove'}) govRemove: EventEmitter<FormMultiselectEvent>\n\n\t@State() focused: boolean\n\t@State() valueState: string\n\t@State() selectedOptionsState: GovFormMultiSelectSelectedItem[] = []\n\t@State() optionsState: GovFormMultiSelectItem[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormMultiselectVariants, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormMultiselectSizes, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('options')\n\twatchOptions(newValue: string | GovFormMultiSelectItem[]): void {\n\t\tthis.optionsState = propsValueToArray(newValue)\n\t}\n\n\t@Watch('value')\n\twatchValue(newValue: string | GovFormMultiSelectItem[]): void {\n\t\tthis.selectedOptionsState = propsValueToArray(newValue)\n\t}\n\n\t@Watch('disabled')\n\t@Watch('invalid')\n\t@Watch('success')\n\t@Watch('size')\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl('size', this.size)\n\t\tthis.f.passAttrToControl('invalid', toBoolAttr(this.invalid))\n\t\tthis.f.passAttrToControl('success', toBoolAttr(this.success))\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.watchDisabled()\n\t\tthis.passControlAttrs()\n\t\tthis.f.passAttrToLabel('required', String(this.required))\n\t\tthis.optionsState = propsValueToArray(this.options)\n\t\tthis.selectedOptionsState = propsValueToArray(this.value)\n\t}\n\n\tprivate getAvailableOptions(ignoreFilter = false): GovFormMultiSelectItem[] {\n\t\tif (Array.isArray(this.optionsState) && this.optionsState.length) {\n\t\t\tif (ignoreFilter) {\n\t\t\t\treturn this.optionsState;\n\t\t\t}\n\t\t\treturn this.optionsState.filter((option) => {\n\t\t\t\tconst selectedIndex = this.selectedValueIndex(option.value)\n\t\t\t\treturn (selectedIndex !== -1 || option?.disabled) ? false : true\n\t\t\t}).map((option) => ({name: option.name ?? option.value, value: option.value}))\n\t\t}\n\t\treturn Array.from(this.selectRef.querySelectorAll('option'))\n\t\t\t.filter((option: HTMLOptionElement) => {\n\t\t\t\tif (ignoreFilter) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t\tconst selectedIndex = this.selectedValueIndex(option.value)\n\t\t\t\treturn !(option.disabled || option.selected || selectedIndex > -1)\n\t\t\t})\n\t\t\t.map((option: HTMLOptionElement) => ({name: option.textContent, value: option.value}))\n\t}\n\n\tprivate initAutocomplete() {\n\t\tthis.autocompleteRef?.addEventListener('gov-select', this.onSelectHandler.bind(this))\n\t\tthis.autocompleteRef?.addEventListener('gov-input', this.onInputHandler.bind(this))\n\t\tthis.autocompleteRef?.addEventListener('gov-focus', this.onFocusHandler.bind(this))\n\t\tthis.autocompleteRef?.addEventListener('gov-blur', this.onBlurHandler.bind(this))\n\t\tthis.autocompleteRef\n\t\t\t?.setSearchCallback(searchString => {\n\t\t\t\treturn new Promise(resolve => {\n\t\t\t\t\tconst data = this.getAvailableOptions()\n\t\t\t\t\tif (String(searchString).length === 0) {\n\t\t\t\t\t\treturn resolve(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(\n\t\t\t\t\t\tdata.filter(({name, value}) => {\n\t\t\t\t\t\t\tif (!name) name = value;\n\t\t\t\t\t\t\treturn removeDiacritics(name).toLowerCase().indexOf(removeDiacritics(searchString).toLowerCase()) > -1\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t})\n\t\t\t.finally()\n\t}\n\n\tprivate selectedValueIndex(value: GovFormMultiSelectSelectedItem) {\n\t\treturn this.selectedOptionsState.findIndex((selected) => selected === value)\n\t}\n\n\tprivate getOptionElement(value: GovFormMultiSelectSelectedItem): Nullable<HTMLOptionElement> {\n\t\treturn this.selectRef.querySelector('option[value=\"' + value + '\"]') as HTMLOptionElement\n\t}\n\n\tprivate getOption(value: GovFormMultiSelectSelectedItem): GovFormMultiSelectItem | null {\n\t\treturn this.getAvailableOptions(true).find((option) => option.value === value) ?? null;\n\t}\n\n\tprivate selectOption(newOption: GovFormMultiSelectSelectedItem, notify = true) {\n\t\tconst index = this.selectedValueIndex(newOption)\n\t\tif (index === -1) {\n\t\t\tthis.selectedOptionsState = [...this.selectedOptionsState, newOption]\n\t\t\tthis.value = this.selectedOptionsState;\n\t\t\tif (notify) {\n\t\t\t\tthis.govChange.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptionsState,\n\t\t\t\t})\n\t\t\t\tthis.govSelect.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptionsState,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst option = this.getOptionElement(newOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = true\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate removeOption(removeOption: GovFormMultiSelectSelectedItem, notify = true) {\n\t\tconst index = this.selectedValueIndex(removeOption)\n\t\tif (index !== -1) {\n\t\t\tthis.selectedOptionsState.splice(index, 1)\n\t\t\tthis.selectedOptionsState = [...this.selectedOptionsState]\n\t\t\tthis.value = this.selectedOptionsState;\n\t\t\tif (notify) {\n\t\t\t\tthis.govChange.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptionsState,\n\t\t\t\t})\n\t\t\t\tthis.govRemove.emit({\n\t\t\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\t\t\tvalue: this.selectedOptionsState,\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst option = this.getOptionElement(removeOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = false\n\t\t\t}\n\t\t}\n\t}\n\n\tasync componentDidLoad() {\n\t\tthis.initAutocomplete()\n\t}\n\n\tasync componentDidRender() {\n\t\ttick(() => {\n\t\t\tthis.selectRef.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\t\tif (option.selected) {\n\t\t\t\t\tthis.selectOption(option.value, false)\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormMultiSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t<div class={FormMultiSelectClass.wrap}>\n\t\t\t\t\t<div class=\"element\">\n\t\t\t\t\t\t<gov-form-autocomplete\n\t\t\t\t\t\t\tvalue={this.valueState}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tidentifier={this.identifier || this.selectId}\n\t\t\t\t\t\t\trequired={false}\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\t\tmessage-empty={this.messageEmpty}\n\t\t\t\t\t\t\tmessage-loading={this.messageLoading}\n\t\t\t\t\t\t\tref={el => (this.autocompleteRef = el as HTMLGovFormAutocompleteElement)}\n\t\t\t\t\t\t\tminlength={0}\n\t\t\t\t\t\t\twcagDescribedBy={this.wcagDescribedBy}\n\t\t\t\t\t\t\twcagLabelledBy={this.wcagLabelledBy}\n\t\t\t\t\t\t\twcagOwns={this.listId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<gov-icon slot=\"right-icon\" class=\"icon-arrow\" name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\"/>}\n\t\t\t\t\t\t{this.success && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t\t{this.invalid && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t\t<select\n\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\tclass={'hidden-select-list'}\n\t\t\t\t\t\t\taria-hidden={toBoolAttr(true)}\n\t\t\t\t\t\t\tmultiple\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t\t{Array.isArray(this.optionsState) && this.optionsState.map((option) => {\n\t\t\t\t\t\t\t\tconst selectedOption = this.selectedValueIndex(option.value);\n\t\t\t\t\t\t\t\treturn (<option value={option.value} selected={selectedOption > -1}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tdisabled={option?.disabled}>{option.name ?? option.value}</option>)\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t{this.hideSelectedList === false ? (\n\t\t\t\t\t<ul role=\"listbox\" id={this.listId} class={FormMultiSelectClass.list}>\n\t\t\t\t\t\t{Array.isArray(this.selectedOptionsState) && this.selectedOptionsState.map(selected => {\n\t\t\t\t\t\t\tconst option = this.getOption(selected);\n\t\t\t\t\t\t\tif (!option) return null\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<li class={FormMultiSelectClass.item} role=\"option\">\n\t\t\t\t\t\t\t\t\t{option.name ?? option.value}\n\t\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\t\twcagLabel={'Odebrat vybranou položku ' + option.name ?? option.value}\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onTagRemove(selected)}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t})}\n\t\t\t\t\t</ul>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptionsState,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.stopPropagation()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormMultiSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.selectedOptionsState,\n\t\t})\n\t}\n\n\tprivate onInputHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\tthis.valueState = e.detail.value\n\t\te.stopPropagation()\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent<FormAutocompleteEvent>) {\n\t\te.stopPropagation()\n\t\tconst value = e.detail.selected\n\t\tthis.selectOption(value.value)\n\t\tthis.valueState = ''\n\t\tthis.autocompleteRef.clearValue().finally()\n\t\tthis.autocompleteRef.focus()\n\t}\n\n\tprivate onTagRemove(removeOption: GovFormMultiSelectSelectedItem) {\n\t\tthis.removeOption(removeOption)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.valueState = value\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormMultiSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormMultiSelectClass.root)\n\t}\n}\n"],"mappings":"gkBAAA,MAAMA,EAAwB,i3pB,MC+BjBC,EAAkB,MAU9B,WAAAC,CAAAC,G,oUAgCmD,I,0CAQ2B,M,cAKzC,M,cAKA,M,gEAY+B,iC,oBAII,a,gKAoCN,G,kBAChB,GAtGjDC,KAAKC,SAAWC,EAAS,aACzBF,KAAKG,OAASD,EAAS,gBAEvBF,KAAKI,EAAIC,EAAQL,KAAKM,MACtBN,KAAKO,EAAIC,EAAQR,KAAKI,E,CAqGvB,eAAAK,CAAgBC,GACfC,EAAaC,EAAyBF,EAAUG,EAAqBC,K,CAItE,YAAAC,CAAaL,GACZC,EAAaK,EAAsBN,EAAUG,EAAqBC,K,CAInE,YAAAG,CAAaP,GACZV,KAAKkB,aAAeC,EAAkBT,E,CAIvC,UAAAU,CAAWV,GACVV,KAAKqB,qBAAuBF,EAAkBT,E,CAO/C,aAAAY,GACCtB,KAAKuB,kB,CAGE,gBAAAA,GACPvB,KAAKO,EAAEiB,kBAAkB,OAAQxB,KAAKyB,MACtCzB,KAAKO,E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d,OAAOlC,KAAKkD,UAAUqF,MAAMrG,E,CAO7B,cAAMuG,CAAStG,GACdnC,KAAKsG,WAAanE,C,CAOnB,YAAMuG,GACL,OAAO1I,KAAKkD,S,CAOb,kBAAM+C,GACL0C,EAAgB3I,KAAK8G,gBAAiB,oBAAqBjG,EAAqBC,MAChF6H,EAAgB3I,KAAK+G,eAAgB,mBAAoBlG,EAAqBC,MAC9E6H,EAAgB3I,KAAKgH,SAAU,YAAanG,EAAqBC,MACjE8H,EAAqB5I,KAAKuG,YAAcvG,KAAKC,SAAUD,KAAK+G,eAAgBlG,EAAqBC,K"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as o,h as r,a,g as t}from"./p-5bc604a3.js";import{p as i}from"./p-03990da5.js";import{S as s}from"./p-55500e5a.js";import{g as e}from"./p-5de606f8.js";import{v as p}from"./p-dcb5fb35.js";import"./p-7f2c9830.js";import"./p-003e6cca.js";const n=i(s,["_2XS","_XS","_S","_M","_L"]);var g;(function(o){o["HORIZONTAL"]="horizontal";o["VERTICAL"]="vertical"})(g||(g={}));const m={root:"gov-form-group"};const f='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-form-group{position:relative;display:flex;width:100%;flex-direction:column;align-items:flex-start}.gov-form-group .gov-form-label__label{margin:0}.gov-form-group[orientation=horizontal]{flex-direction:row;flex-wrap:wrap}.gov-form-group[orientation=horizontal] .gov-form-label__label{white-space:nowrap}.gov-form-group[gap="2xs"]{gap:0.25rem}.gov-form-group[gap=xs]{gap:0.5rem}.gov-form-group[gap=s]{gap:0.75rem}.gov-form-group[gap=m]{gap:1rem}.gov-form-group[gap=l]{gap:1.25rem}';const l=class{constructor(r){o(this,r);this.gap=undefined;this.orientation="vertical";this.h=e(this.host)}validateGap(o){if(o){p(n,o,m.root)}}validateOrientation(o){if(o){p(g,o,m.root)}}componentWillLoad(){this.validateGap(this.gap);this.validateOrientation(this.orientation)}render(){return r(a,{gap:this.gap,class:this.h.classes(m.root)},r("slot",null))}get host(){return t(this)}static get watchers(){return{gap:["validateGap"],orientation:["validateOrientation"]}}};l.style=f;export{l as gov_form_group};
|
|
2
|
-
//# sourceMappingURL=p-adf276b0.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["FormGroupSizes","pick","Sizes","FormGroupOrientation","FormGroupClass","root","govFormGroupCss","GovFormGroup","constructor","hostRef","undefined","this","h","govHost","host","validateGap","newValue","validateProp","validateOrientation","componentWillLoad","gap","orientation","render","Host","class","classes"],"sources":["../../../packages/core/src/components/gov-form/group/constants.ts","../../../packages/core/src/components/gov-form/group/gov-form-group.scss?tag=gov-form-group","../../../packages/core/src/components/gov-form/group/gov-form-group.tsx"],"sourcesContent":["import { pick } from \"../../../utils/utils\"\nimport { Sizes } from \"../../../core/constants/sizes\"\nimport { ValueOf } from \"../../../types/interfaces\"\n\nexport const FormGroupSizes = pick(Sizes, ['_2XS', '_XS', '_S', '_M', '_L'])\nexport type FormGroupSizesType = `${ValueOf<typeof FormGroupSizes>}`\n\nexport enum FormGroupOrientation {\n\tHORIZONTAL = 'horizontal',\n\tVERTICAL = 'vertical',\n}\nexport type FormGroupOrientationType = `${ValueOf<typeof FormGroupOrientation>}`\n\nexport const FormGroupClass = {\n\troot: 'gov-form-group',\n}\n","$class: \".gov-form-group\";\n\n#{$class} {\n\t@include base(flex);\n\tflex-direction: column;\n\talign-items: flex-start;\n\t.gov-form-label__label {\n\t\tmargin: 0;\n\t}\n\n\t&[orientation=\"horizontal\"] {\n\t\tflex-direction: row;\n\t\tflex-wrap: wrap;\n\t\t.gov-form-label__label {\n\t\t\twhite-space: nowrap;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $gap, $definitions in $form-group-gaps {\n\t\t&[gap=\"#{$gap}\"] {\n\t\t\tgap: get($gap, $sizes);\n\t\t}\n\t}\n}\n","import {Component, Element, h, Host, Prop, Watch} from \"@stencil/core\"\nimport {\n FormGroupClass,\n FormGroupOrientation,\n FormGroupOrientationType,\n FormGroupSizes,\n FormGroupSizesType\n} from \"./constants\"\nimport {GovHost} from \"../../../helpers/Dom/template.types\"\nimport {govHost} from \"../../../helpers/Dom/template\"\nimport {validateProp} from \"../../../helpers/Validate/props\"\n\n@Component({\n tag: \"gov-form-group\",\n styleUrl: \"gov-form-group.scss\",\n})\nexport class GovFormGroup {\n private readonly h: GovHost\n\n constructor() {\n this.h = govHost(this.host)\n }\n\n @Element() host: HTMLGovFormGroupElement\n /**\n * Gap's size.\n */\n @Prop() readonly gap?: FormGroupSizesType = undefined\n /**\n * Elements orientation\n */\n @Prop() readonly orientation?: FormGroupOrientationType = 'vertical'\n\n @Watch(\"gap\")\n validateGap(newValue: string): void {\n if (newValue) {\n validateProp(FormGroupSizes, newValue, FormGroupClass.root)\n }\n }\n\n @Watch(\"orientation\")\n validateOrientation(newValue: string): void {\n if (newValue) {\n validateProp(FormGroupOrientation, newValue, FormGroupClass.root)\n }\n }\n\n componentWillLoad(): void {\n this.validateGap(this.gap)\n this.validateOrientation(this.orientation)\n }\n\n render() {\n return (\n <Host gap={this.gap} class={this.h.classes(FormGroupClass.root)}>\n <slot></slot>\n </Host>\n )\n }\n}\n"],"mappings":"oPAIO,MAAMA,EAAiBC,EAAKC,EAAO,CAAC,OAAQ,MAAO,KAAM,KAAM,OAGtE,IAAYC,GAAZ,SAAYA,GACXA,EAAA,2BACAA,EAAA,sBACA,EAHD,CAAYA,MAAoB,KAMzB,MAAMC,EAAiB,CAC7BC,KAAM,kBCdP,MAAMC,EAAkB,4zB,MCgBXC,EAAY,MAGvB,WAAAC,CAAAC,G,mBAQ4CC,U,iBAIc,WAXxDC,KAAKC,EAAIC,EAAQF,KAAKG,K,CAcxB,WAAAC,CAAYC,GACV,GAAIA,EAAU,CACZC,EAAajB,EAAgBgB,EAAUZ,EAAeC,K,EAK1D,mBAAAa,CAAoBF,GAClB,GAAIA,EAAU,CACZC,EAAad,EAAsBa,EAAUZ,EAAeC,K,EAIhE,iBAAAc,GACER,KAAKI,YAAYJ,KAAKS,KACtBT,KAAKO,oBAAoBP,KAAKU,Y,CAGhC,MAAAC,GACE,OACEV,EAACW,EAAI,CAACH,IAAKT,KAAKS,IAAKI,MAAOb,KAAKC,EAAEa,QAAQrB,EAAeC,OACxDO,EAAA,a"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["govFormCheckboxCss","GovFormCheckbox","constructor","hostRef","this","checkboxId","createID","h","govHost","host","f","govForm","validateSize","newValue","validateProp","FormCheckboxSizes","FormCheckboxClass","root","watchDisabled","passControlAttrs","passAttrToControl","size","toBoolAttr","invalid","componentWillLoad","componentDidRender","passAttrToLabel","identifier","String","required","canValidateWcagOnRender","delay","validateWcag","render","wrapCheckbox","children","noLabel","class","label","Host","checked","toBoolAttrIfDefined","Fragment","id","type","value","name","onClick","onClickHandler","bind","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","disabled","ref","el","inputRef","wcagDescribedBy","wcagLabelledBy","check","e","stopPropagation","govFocus","emit","component","originalEvent","govBlur","target","govChange","getRef","validateWcagRef","validateWcagLabelFor"],"sources":["../../../packages/core/src/components/gov-form/checkbox/gov-form-checkbox.scss?tag=gov-form-checkbox","../../../packages/core/src/components/gov-form/checkbox/gov-form-checkbox.tsx"],"sourcesContent":["/*\n * Checkbox\n */\n\n@import \"../checkbox/gov-form-checkbox-core.scss\";\n\n$class: \".gov-form-checkbox\";\n\n#{$class} {\n @extend %form-checkbox-core;\n\n input + span {\n &::before {\n border-radius: $border-radius;\n }\n }\n\n &__check {\n position: absolute;\n color: $form-checkbox-check-color;\n opacity: 0;\n transition: $t linear opacity;\n }\n\n &__label {\n position: relative;\n }\n\n // STATES\n input:checked + span::before {\n background: $form-checkbox-indicator-bg;\n }\n\n input:checked + span &__check {\n opacity: 1;\n }\n\n @include parameter(\"invalid\") {\n input:checked + span::before {\n background: $form-state-color-error;\n }\n }\n @include parameter(\"disabled\") {\n input:checked + span::before {\n border-color: $form-state-bg-disabled;\n background-color: $form-state-bg-disabled;\n }\n }\n\n // VARIANTS\n @each $size, $definitions in $form-checkbox-core-sizes {\n &[size=\"#{$size}\"] {\n #{$class} {\n &__check {\n top: calc((get(\"indicator-size\", $definitions) - get(\"check-size\", $definitions)) / 2);\n left: calc((get(\"indicator-size\", $definitions) - get(\"check-size\", $definitions)) / 2);\n width: get(\"check-size\", $definitions);\n height: get(\"check-size\", $definitions);\n }\n }\n }\n }\n}\n","import { Component, Element, Event, EventEmitter, h, Host, Method, Prop, Watch } from \"@stencil/core\"\nimport { createID } from \"../../../utils/string.utils\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { FormCheckboxClass, FormCheckboxSizes, FormCheckboxSizesType } from \"./constants\"\nimport { govHost, toBoolAttr, toBoolAttrIfDefined } from \"../../../helpers/Dom/template\"\nimport { validateWcagLabelFor, validateWcagRef } from \"../../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { GovForm } from \"../../../helpers/Dom/form.types\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport Fragment from \"../../../helpers/Fragment\"\nimport { FormCheckboxEvent } from \"./gov-form-checkbox.types\"\n\n@Component({\n\ttag: \"gov-form-checkbox\",\n\tstyleUrl: \"gov-form-checkbox.scss\",\n})\nexport class GovFormCheckbox {\n\tprivate readonly h: GovHost\n\tprivate f: GovForm\n\tprivate inputRef?: HTMLInputElement\n\n\tprivate readonly checkboxId: string\n\n\tconstructor() {\n\t\tthis.checkboxId = createID(\"GovCheckbox\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormCheckboxElement\n\t/**\n\t * Value of checkbox\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * Checkbox button state\n\t */\n\t@Prop({ reflect: true, mutable: true }) checked = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the checkbox component disabled.\n\t * This prevents users from being able to interact with the checkbox, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean = false\n\t/**\n\t * Name of the checkbox.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Checkboxes size.\n\t */\n\t@Prop() readonly size?: FormCheckboxSizesType = \"m\"\n\t/**\n\t * Custom checkbox identifier.\n\t */\n\t@Prop({ attribute: \"identifier\" }) readonly identifier: string\n\t/**\n\t * When you can't use the form label.\n\t */\n\t@Prop({ attribute: \"no-label\" }) readonly noLabel: boolean = false\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the checkbox has focus.\n\t */\n\t@Event({ eventName: \"gov-focus\" }) govFocus: EventEmitter<FormCheckboxEvent>\n\t/**\n\t * Emitted when the checkbox loses focus.\n\t */\n\t@Event({ eventName: \"gov-blur\" }) govBlur: EventEmitter<FormCheckboxEvent>\n\t/**\n\t * Emitted when the checkbox change value.\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<FormCheckboxEvent>\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormCheckboxSizes, newValue, FormCheckboxClass.root)\n\t}\n\n\t@Watch(\"disabled\")\n\t@Watch(\"invalid\")\n\t@Watch(\"size\")\n\twatchDisabled(): void {\n\t\tthis.passControlAttrs()\n\t}\n\n\tprivate passControlAttrs() {\n\t\tthis.f.passAttrToControl(\"size\", this.size)\n\t\tthis.f.passAttrToControl(\"invalid\", toBoolAttr(this.invalid))\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToControl(\"type\", \"checkbox\")\n\t\tthis.passControlAttrs()\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel(\"identifier\", this.identifier || this.checkboxId)\n\t\tthis.f.passAttrToLabel(\"required\", String(this.required))\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst wrapCheckbox = (children) => {\n\t\t\tif (this.noLabel) {\n\t\t\t\treturn (\n\t\t\t\t\t<label class={FormCheckboxClass.label}>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</label>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\n\t\treturn (\n\t\t\t<Host class={FormCheckboxClass.root} checked={this.checked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t{wrapCheckbox(\n\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid={this.identifier || this.checkboxId}\n\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tchecked={this.checked}\n\t\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\t\taria-checked={toBoolAttr(this.checked)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<slot name=\"label\" />\n\t\t\t\t\t\t\t<gov-icon class={FormCheckboxClass.check} name=\"check-lg\"></gov-icon>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Fragment>,\n\t\t\t\t)}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govFocus.emit({\n\t\t\tcomponent: FormCheckboxClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormCheckboxClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onClickHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.checked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormCheckboxClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormCheckboxClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormCheckboxClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.checkboxId, this.wcagLabelledBy, FormCheckboxClass.root)\n\t}\n}\n"],"mappings":"ygBAAA,MAAMA,EAAqB,49P,MCkBdC,EAAe,MAO3B,WAAAC,CAAAC,G,wJAekD,M,cAKb,M,cAKA,M,8BAQW,I,uCAQa,M,oFAxC5DC,KAAKC,WAAaC,EAAS,eAE3BF,KAAKG,EAAIC,EAAQJ,KAAKK,MACtBL,KAAKM,EAAIC,EAAQP,KAAKG,E,CAgEvB,YAAAK,CAAaC,GACZC,EAAaC,EAAmBF,EAAUG,EAAkBC,K,CAM7D,aAAAC,GACCd,KAAKe,kB,CAGE,gBAAAA,GACPf,KAAKM,EAAEU,kBAAkB,OAAQhB,KAAKiB,MACtCjB,KAAKM,EAAEU,kBAAkB,UAAWE,EAAWlB,KAAKmB,S,CAGrD,iBAAAC,GACCpB,KAAKM,EAAEU,kBAAkB,OAAQ,YACjChB,KAAKe,kB,CAGN,wBAAMM,GACLrB,KAAKM,EAAEgB,gBAAgB,aAActB,KAAKuB,YAAcvB,KAAKC,YAC7DD,KAAKM,EAAEgB,gBAAgB,WAAYE,OAAOxB,KAAKyB,WAC/C,GAAIC,IAA2B,OACxBC,EAAM,WACN3B,KAAK4B,c,EAIb,MAAAC,GACC,MAAMC,EAAgBC,IACrB,GAAI/B,KAAKgC,QAAS,CACjB,OACC7B,EAAA,SAAO8B,MAAOrB,EAAkBsB,OAC9BH,E,CAIJ,OAAOA,CAAQ,EAGhB,OACC5B,EAACgC,EAAI,CAACF,MAAOrB,EAAkBC,KAAMuB,QAASpC,KAAKoC,QAASnB,KA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B4B,MAAOzC,KAAKyC,MACZL,QAASpC,KAAKoC,QACd4B,cAAeL,G,CAQjB,YAAMS,GACL,OAAOpE,KAAKuD,Q,CAOb,kBAAM3B,GACLyC,EAAgBrE,KAAKwD,gBAAiB,oBAAqB5C,EAAkBC,MAC7EwD,EAAgBrE,KAAKyD,eAAgB,mBAAoB7C,EAAkBC,MAC3EyD,EAAqBtE,KAAKuB,YAAcvB,KAAKC,WAAYD,KAAKyD,eAAgB7C,EAAkBC,K"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|