@govtechsg/sgds-web-component 3.0.6 → 3.1.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/components/Checkbox/checkbox-group.js +1 -1
  2. package/components/Checkbox/checkbox.js +1 -1
  3. package/components/Checkbox/index.umd.js +195 -31
  4. package/components/Checkbox/index.umd.js.map +1 -1
  5. package/components/Checkbox/sgds-checkbox-group.d.ts +49 -10
  6. package/components/Checkbox/sgds-checkbox-group.js +161 -25
  7. package/components/Checkbox/sgds-checkbox-group.js.map +1 -1
  8. package/components/Checkbox/sgds-checkbox.d.ts +5 -1
  9. package/components/Checkbox/sgds-checkbox.js +39 -6
  10. package/components/Checkbox/sgds-checkbox.js.map +1 -1
  11. package/components/ComboBox/index.umd.js +39 -6
  12. package/components/ComboBox/index.umd.js.map +1 -1
  13. package/components/index.umd.js +195 -31
  14. package/components/index.umd.js.map +1 -1
  15. package/index.umd.js +195 -31
  16. package/index.umd.js.map +1 -1
  17. package/package.json +1 -1
  18. package/react/components/Checkbox/checkbox-group.cjs.js +1 -1
  19. package/react/components/Checkbox/checkbox-group.js +1 -1
  20. package/react/components/Checkbox/checkbox.cjs.js +1 -1
  21. package/react/components/Checkbox/checkbox.js +1 -1
  22. package/react/components/Checkbox/sgds-checkbox-group.cjs.js +160 -24
  23. package/react/components/Checkbox/sgds-checkbox-group.cjs.js.map +1 -1
  24. package/react/components/Checkbox/sgds-checkbox-group.js +161 -25
  25. package/react/components/Checkbox/sgds-checkbox-group.js.map +1 -1
  26. package/react/components/Checkbox/sgds-checkbox.cjs.js +38 -5
  27. package/react/components/Checkbox/sgds-checkbox.cjs.js.map +1 -1
  28. package/react/components/Checkbox/sgds-checkbox.js +39 -6
  29. package/react/components/Checkbox/sgds-checkbox.js.map +1 -1
@@ -1,4 +1,6 @@
1
- import SgdsElement from "../../base/sgds-element";
1
+ import FormControlElement from "../../base/form-control-element";
2
+ import { SgdsFormControl } from "../../utils/formSubmitController";
3
+ declare const SgdsCheckboxGroup_base: (new (...args: any[]) => import("../../utils/validatorMixin").ToBeValidatedElementInterface) & typeof FormControlElement;
2
4
  /**
3
5
  * @summary CheckboxGroup is the container that group multiple checkboxes under a single question field.
4
6
  * It handles the display of validation feedback of its checkboxes children.
@@ -7,12 +9,11 @@ import SgdsElement from "../../base/sgds-element";
7
9
  * @slot invalidIcon - The slot for invalid icon
8
10
  *
9
11
  */
10
- export declare class SgdsCheckboxGroup extends SgdsElement {
12
+ export declare class SgdsCheckboxGroup extends SgdsCheckboxGroup_base implements SgdsFormControl {
11
13
  static styles: import("lit").CSSResult[];
12
14
  /**@internal */
13
15
  private checkboxes;
14
- private hasInvalidCheckbox;
15
- private validationMessage;
16
+ private checkboxesAsync;
16
17
  /** The checkbox group's label */
17
18
  label: string;
18
19
  /**Feedback text for error state when validated */
@@ -21,13 +22,51 @@ export declare class SgdsCheckboxGroup extends SgdsElement {
21
22
  hasFeedback: boolean;
22
23
  /** The checkbox group's hint text */
23
24
  hintText: string;
24
- constructor();
25
- private _checkInvalidState;
26
- /** Overrides hasFeedback from individual SgdsCheckbox */
27
- private _forwardHasFeedback;
25
+ /** Makes the checkbox group a required field. Only available for when multiselect is true */
26
+ required: boolean;
27
+ /** Consolidates the values of its child checked checkboxes into a single string with semi-colon delimiter. Only available when required is true */
28
+ value: string;
29
+ private _isTouched;
30
+ /**@internal */
31
+ defaultValue: string;
32
+ connectedCallback(): void;
28
33
  protected _renderHintText(): import("lit-html").TemplateResult<1>;
29
- firstUpdated(): void;
30
- updated(): void;
34
+ private _checkboxes;
35
+ private _addValue;
36
+ private _removeValue;
37
+ private _sanitizeSlot;
38
+ private _disabledChildCheckboxes;
39
+ _handleValueChange(): void;
40
+ _handleIsTouched(): void;
41
+ _updateInvalid(): void;
42
+ /**
43
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
44
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
45
+ */
46
+ reportValidity(): boolean;
47
+ /**
48
+ * Checks for validity without any native error popup message
49
+ */
50
+ checkValidity(): boolean;
51
+ /**
52
+ * Returns the ValidityState object
53
+ */
54
+ get validity(): ValidityState;
55
+ /**
56
+ * Returns the validation message based on the ValidityState
57
+ */
58
+ get validationMessage(): string;
59
+ /**
60
+ * radio requries a custom _mixinResetFormControl as the update of input value
61
+ * requires to fire a reset event manually
62
+ * */
63
+ private _mixinResetFormControl;
64
+ /**
65
+ * when input value is set programatically, need to manually dispatch a change event
66
+ * In order to prevent race conditions and ensure sequence of events, set input's value here instead of binding to value prop of input
67
+ */
68
+ private _updateInputValue;
69
+ firstUpdated(changedProperties: any): void;
31
70
  render(): import("lit-html").TemplateResult<1>;
32
71
  }
33
72
  export default SgdsCheckboxGroup;
@@ -1,11 +1,16 @@
1
1
  import { __decorate } from 'tslib';
2
2
  import { html, nothing } from 'lit';
3
- import { queryAssignedElements, state, property } from 'lit/decorators.js';
3
+ import { queryAssignedElements, queryAsync, property, state } from 'lit/decorators.js';
4
4
  import SgdsElement from '../../base/sgds-element.js';
5
5
  import css_248z from '../../styles/feedback.js';
6
6
  import css_248z$1 from '../../styles/form-label.js';
7
7
  import css_248z$2 from './checkbox-group.js';
8
8
  import css_248z$3 from '../../styles/form-hint.js';
9
+ import { SgdsFormValidatorMixin } from '../../utils/validatorMixin.js';
10
+ import FormControlElement from '../../base/form-control-element.js';
11
+ import { classMap } from 'lit/directives/class-map.js';
12
+ import { live } from 'lit/directives/live.js';
13
+ import { watch } from '../../utils/watch.js';
9
14
 
10
15
  /**
11
16
  * @summary CheckboxGroup is the container that group multiple checkboxes under a single question field.
@@ -15,10 +20,9 @@ import css_248z$3 from '../../styles/form-hint.js';
15
20
  * @slot invalidIcon - The slot for invalid icon
16
21
  *
17
22
  */
18
- class SgdsCheckboxGroup extends SgdsElement {
23
+ class SgdsCheckboxGroup extends SgdsFormValidatorMixin(FormControlElement) {
19
24
  constructor() {
20
- super();
21
- this.hasInvalidCheckbox = false;
25
+ super(...arguments);
22
26
  /** The checkbox group's label */
23
27
  this.label = "";
24
28
  /**Feedback text for error state when validated */
@@ -27,27 +31,126 @@ class SgdsCheckboxGroup extends SgdsElement {
27
31
  this.hasFeedback = false;
28
32
  /** The checkbox group's hint text */
29
33
  this.hintText = "";
30
- this.addEventListener("sgds-validity-change", (e) => {
31
- this.hasInvalidCheckbox = e.detail.invalid;
32
- this.validationMessage = e.detail.validationMessage;
33
- });
34
- }
35
- _checkInvalidState() {
36
- this.hasInvalidCheckbox = Array.from(this.checkboxes).some(checkbox => checkbox.invalid);
34
+ /** Makes the checkbox group a required field. Only available for when multiselect is true */
35
+ this.required = false;
36
+ /** Consolidates the values of its child checked checkboxes into a single string with semi-colon delimiter. Only available when required is true */
37
+ this.value = "";
38
+ this._isTouched = false;
39
+ /**@internal */
40
+ this.defaultValue = "";
37
41
  }
38
- /** Overrides hasFeedback from individual SgdsCheckbox */
39
- _forwardHasFeedback() {
40
- Array.from(this.checkboxes).forEach(checkbox => (checkbox.hasFeedback = this.hasFeedback));
42
+ connectedCallback() {
43
+ super.connectedCallback();
44
+ this.defaultValue = this.value;
45
+ this.addEventListener("sgds-check", (e) => {
46
+ const { value } = e.detail;
47
+ !this.value.includes(value) && this._addValue(value);
48
+ });
49
+ this.addEventListener("sgds-uncheck", (e) => {
50
+ const { value } = e.detail;
51
+ this._removeValue(value);
52
+ });
53
+ this.addEventListener("sgds-blur", () => {
54
+ this._isTouched = true;
55
+ });
41
56
  }
42
57
  _renderHintText() {
43
58
  const hintTextTemplate = html ` <div class="form-text">${this.hintText}</div> `;
44
59
  return this.hintText && hintTextTemplate;
45
60
  }
46
- firstUpdated() {
47
- this._forwardHasFeedback();
61
+ _addValue(newValue) {
62
+ const valueArray = this.value ? this.value.split(";") : [];
63
+ valueArray.push(newValue);
64
+ this.value = valueArray.join(";");
65
+ }
66
+ _removeValue(oldValue) {
67
+ const valueArray = this.value ? this.value.split(";") : [];
68
+ const newValueArray = valueArray.filter(v => v !== oldValue);
69
+ this.value = newValueArray.join(";");
70
+ }
71
+ _sanitizeSlot() {
72
+ const checkboxes = this._checkboxes;
73
+ checkboxes.forEach(checkbox => {
74
+ checkbox.checked = this.value.includes(checkbox.value);
75
+ checkbox.hasFeedback = this.hasFeedback ? "style" : null;
76
+ if (checkbox.required) {
77
+ console.error("Checkboxes in a group cannot have required or hasFeedback prop set to true");
78
+ checkbox.remove();
79
+ }
80
+ });
81
+ this._disabledChildCheckboxes();
82
+ }
83
+ _disabledChildCheckboxes() {
84
+ if (this.disabled) {
85
+ const checkboxes = this._checkboxes;
86
+ checkboxes.forEach(checkbox => (checkbox.disabled = this.disabled));
87
+ }
88
+ }
89
+ _handleValueChange() {
90
+ const checkboxes = this._checkboxes;
91
+ checkboxes.forEach(checkbox => {
92
+ checkbox.checked = this.value.includes(checkbox.value);
93
+ });
94
+ this._updateInputValue();
95
+ this._updateInvalid();
96
+ }
97
+ _handleIsTouched() {
98
+ if (this._isTouched) {
99
+ this.invalid = !this.input.checkValidity();
100
+ this._updateInvalid();
101
+ }
102
+ }
103
+ _updateInvalid() {
104
+ const checkboxes = this._checkboxes;
105
+ checkboxes.forEach(ch => (ch.invalid = this.invalid));
106
+ }
107
+ /**
108
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
109
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
110
+ */
111
+ reportValidity() {
112
+ return this._mixinReportValidity();
113
+ }
114
+ /**
115
+ * Checks for validity without any native error popup message
116
+ */
117
+ checkValidity() {
118
+ return this._mixinCheckValidity();
119
+ }
120
+ /**
121
+ * Returns the ValidityState object
122
+ */
123
+ get validity() {
124
+ return this._mixinGetValidity();
125
+ }
126
+ /**
127
+ * Returns the validation message based on the ValidityState
128
+ */
129
+ get validationMessage() {
130
+ return this._mixinGetValidationMessage();
48
131
  }
49
- updated() {
50
- this._checkInvalidState();
132
+ /**
133
+ * radio requries a custom _mixinResetFormControl as the update of input value
134
+ * requires to fire a reset event manually
135
+ * */
136
+ _mixinResetFormControl() {
137
+ this.value = this.input.value = this.defaultValue;
138
+ this._updateInputValue("reset");
139
+ this._mixinResetValidity(this.input);
140
+ }
141
+ /**
142
+ * when input value is set programatically, need to manually dispatch a change event
143
+ * In order to prevent race conditions and ensure sequence of events, set input's value here instead of binding to value prop of input
144
+ */
145
+ _updateInputValue(eventName = "change") {
146
+ this.input.value = this.value;
147
+ this.input.dispatchEvent(new InputEvent(eventName));
148
+ }
149
+ firstUpdated(changedProperties) {
150
+ super.firstUpdated(changedProperties);
151
+ if (this.value) {
152
+ this._updateInputValue();
153
+ }
51
154
  }
52
155
  render() {
53
156
  return html `
@@ -57,9 +160,21 @@ class SgdsCheckboxGroup extends SgdsElement {
57
160
  ${this._renderHintText()}
58
161
  </div>
59
162
  <div class="checkbox-container">
60
- <slot></slot>
163
+ <slot @slotchange=${this._sanitizeSlot}></slot>
61
164
  </div>
62
- ${this.hasInvalidCheckbox && this.hasFeedback
165
+ <input
166
+ type="text"
167
+ class="checkbox-group-validation-input ${classMap({
168
+ "is-invalid": this.hasFeedback && this.invalid
169
+ })}"
170
+ ?required=${this.required}
171
+ tabindex="-1"
172
+ @change=${(e) => {
173
+ super._mixinHandleChange(e);
174
+ }}
175
+ .value=${live(this.value)}
176
+ />
177
+ ${this.invalid && this.hasFeedback
63
178
  ? html `
64
179
  <div class="invalid-feedback-container">
65
180
  <slot name="invalidIcon">
@@ -85,11 +200,8 @@ __decorate([
85
200
  queryAssignedElements({ flatten: true })
86
201
  ], SgdsCheckboxGroup.prototype, "checkboxes", void 0);
87
202
  __decorate([
88
- state()
89
- ], SgdsCheckboxGroup.prototype, "hasInvalidCheckbox", void 0);
90
- __decorate([
91
- state()
92
- ], SgdsCheckboxGroup.prototype, "validationMessage", void 0);
203
+ queryAsync("slot")
204
+ ], SgdsCheckboxGroup.prototype, "checkboxesAsync", void 0);
93
205
  __decorate([
94
206
  property({ reflect: true })
95
207
  ], SgdsCheckboxGroup.prototype, "label", void 0);
@@ -102,6 +214,30 @@ __decorate([
102
214
  __decorate([
103
215
  property({ reflect: true })
104
216
  ], SgdsCheckboxGroup.prototype, "hintText", void 0);
217
+ __decorate([
218
+ property({ type: Boolean, reflect: true })
219
+ ], SgdsCheckboxGroup.prototype, "required", void 0);
220
+ __decorate([
221
+ property({ type: String, reflect: true })
222
+ ], SgdsCheckboxGroup.prototype, "value", void 0);
223
+ __decorate([
224
+ state()
225
+ ], SgdsCheckboxGroup.prototype, "_isTouched", void 0);
226
+ __decorate([
227
+ state()
228
+ ], SgdsCheckboxGroup.prototype, "defaultValue", void 0);
229
+ __decorate([
230
+ queryAssignedElements()
231
+ ], SgdsCheckboxGroup.prototype, "_checkboxes", void 0);
232
+ __decorate([
233
+ watch("value", { waitUntilFirstUpdate: true })
234
+ ], SgdsCheckboxGroup.prototype, "_handleValueChange", null);
235
+ __decorate([
236
+ watch("_isTouched", { waitUntilFirstUpdate: true })
237
+ ], SgdsCheckboxGroup.prototype, "_handleIsTouched", null);
238
+ __decorate([
239
+ watch("invalid", { waitUntilFirstUpdate: true })
240
+ ], SgdsCheckboxGroup.prototype, "_updateInvalid", null);
105
241
 
106
242
  export { SgdsCheckboxGroup, SgdsCheckboxGroup as default };
107
243
  //# sourceMappingURL=sgds-checkbox-group.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-checkbox-group.js","sources":["../../../src/components/Checkbox/sgds-checkbox-group.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { queryAssignedElements, state, property } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport feedbackStyles from \"../../styles/feedback.css\";\nimport formLabelStyles from \"../../styles/form-label.css\";\nimport checkboxGroupStyles from \"./checkbox-group.css\";\nimport formHintStyles from \"../../styles/form-hint.css\";\nimport SgdsCheckbox from \"./sgds-checkbox\";\n/**\n * @summary CheckboxGroup is the container that group multiple checkboxes under a single question field.\n * It handles the display of validation feedback of its checkboxes children.\n *\n * @slot default - Pass in `sgds-checkbox` into the default slot\n * @slot invalidIcon - The slot for invalid icon\n *\n */\nexport class SgdsCheckboxGroup extends SgdsElement {\n static styles = [...SgdsElement.styles, feedbackStyles, formLabelStyles, checkboxGroupStyles, formHintStyles];\n /**@internal */\n @queryAssignedElements({ flatten: true }) private checkboxes!: NodeListOf<SgdsCheckbox>;\n @state() private hasInvalidCheckbox = false;\n @state() private validationMessage: string;\n\n /** The checkbox group's label */\n @property({ reflect: true }) label = \"\";\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n\n /** Allows invalidFeedback, invalid styles to be visible. When SgdsCheckboxGroup is used, it overrides the value of hasFeedback on SgdsCheckbox with its own value. */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The checkbox group's hint text */\n @property({ reflect: true }) hintText = \"\";\n\n constructor() {\n super();\n this.addEventListener(\"sgds-validity-change\", (e: CustomEvent) => {\n this.hasInvalidCheckbox = e.detail.invalid;\n this.validationMessage = e.detail.validationMessage;\n });\n }\n\n private _checkInvalidState() {\n this.hasInvalidCheckbox = Array.from(this.checkboxes).some(checkbox => checkbox.invalid);\n }\n /** Overrides hasFeedback from individual SgdsCheckbox */\n private _forwardHasFeedback() {\n Array.from(this.checkboxes).forEach(checkbox => (checkbox.hasFeedback = this.hasFeedback));\n }\n\n protected _renderHintText() {\n const hintTextTemplate = html` <div class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n\n firstUpdated() {\n this._forwardHasFeedback();\n }\n updated() {\n this._checkInvalidState();\n }\n render() {\n return html`\n <fieldset>\n <div class=\"label-hint-container\">\n <label class=\"form-label\">${this.label}</label>\n ${this._renderHintText()}\n </div>\n <div class=\"checkbox-container\">\n <slot></slot>\n </div>\n ${this.hasInvalidCheckbox && this.hasFeedback\n ? html`\n <div class=\"invalid-feedback-container\">\n <slot name=\"invalidIcon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path\n d=\"M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10ZM10 6.25C9.49805 6.25 9.10584 6.68339 9.15578 7.18285L9.48461 10.4711C9.51109 10.7359 9.7339 10.9375 10 10.9375C10.2661 10.9375 10.4889 10.7359 10.5154 10.4711L10.8442 7.18285C10.8942 6.68339 10.5019 6.25 10 6.25ZM10.0014 11.875C9.48368 11.875 9.06394 12.2947 9.06394 12.8125C9.06394 13.3303 9.48368 13.75 10.0014 13.75C10.5192 13.75 10.9389 13.3303 10.9389 12.8125C10.9389 12.2947 10.5192 11.875 10.0014 11.875Z\"\n fill=\"currentColor\"\n />\n </svg>\n </slot>\n <div id=\"checkbox-feedback\" tabindex=\"0\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}\n </div>\n </div>\n `\n : nothing}\n </fieldset>\n `;\n }\n}\n\nexport default SgdsCheckboxGroup;\n"],"names":["feedbackStyles","formLabelStyles","checkboxGroupStyles","formHintStyles"],"mappings":";;;;;;;;;AAQA;;;;;;;AAOG;AACG,MAAO,iBAAkB,SAAQ,WAAW,CAAA;AAmBhD,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE,CAAC;QAhBO,IAAkB,CAAA,kBAAA,GAAG,KAAK,CAAC;;QAIf,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAGG,IAAe,CAAA,eAAA,GAAG,EAAE,CAAC;;QAGpB,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAGnC,IAAQ,CAAA,QAAA,GAAG,EAAE,CAAC;QAIzC,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,CAAC,CAAc,KAAI;YAC/D,IAAI,CAAC,kBAAkB,GAAG,CAAC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-group.ts"],"sourcesContent":["import { html, nothing, PropertyValues } from \"lit\";\nimport { queryAssignedElements, state, property, query, queryAsync } from \"lit/decorators.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport feedbackStyles from \"../../styles/feedback.css\";\nimport formLabelStyles from \"../../styles/form-label.css\";\nimport checkboxGroupStyles from \"./checkbox-group.css\";\nimport formHintStyles from \"../../styles/form-hint.css\";\nimport SgdsCheckbox from \"./sgds-checkbox\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { watch } from \"../../utils/watch\";\n/**\n * @summary CheckboxGroup is the container that group multiple checkboxes under a single question field.\n * It handles the display of validation feedback of its checkboxes children.\n *\n * @slot default - Pass in `sgds-checkbox` into the default slot\n * @slot invalidIcon - The slot for invalid icon\n *\n */\nexport class SgdsCheckboxGroup extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...SgdsElement.styles, feedbackStyles, formLabelStyles, checkboxGroupStyles, formHintStyles];\n /**@internal */\n @queryAssignedElements({ flatten: true }) private checkboxes!: NodeListOf<SgdsCheckbox>;\n // @state() private hasInvalidCheckbox = false;\n @queryAsync(\"slot\") private checkboxesAsync!: Promise<HTMLSlotElement>;\n\n /** The checkbox group's label */\n @property({ reflect: true }) label = \"\";\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n\n /** Allows invalidFeedback, invalid styles to be visible. When SgdsCheckboxGroup is used, it overrides the value of hasFeedback on SgdsCheckbox with its own value. */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The checkbox group's hint text */\n @property({ reflect: true }) hintText = \"\";\n\n /** Makes the checkbox group a required field. Only available for when multiselect is true */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Consolidates the values of its child checked checkboxes into a single string with semi-colon delimiter. Only available when required is true */\n @property({ type: String, reflect: true }) value = \"\";\n\n @state() private _isTouched = false;\n\n /**@internal */\n @state() defaultValue = \"\";\n\n connectedCallback() {\n super.connectedCallback();\n this.defaultValue = this.value;\n this.addEventListener(\"sgds-check\", (e: CustomEvent) => {\n const { value } = e.detail;\n !this.value.includes(value) && this._addValue(value);\n });\n this.addEventListener(\"sgds-uncheck\", (e: CustomEvent) => {\n const { value } = e.detail;\n this._removeValue(value);\n });\n this.addEventListener(\"sgds-blur\", () => {\n this._isTouched = true;\n });\n }\n\n protected _renderHintText() {\n const hintTextTemplate = html` <div class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n\n @queryAssignedElements()\n private _checkboxes!: Array<SgdsCheckbox>;\n\n private _addValue(newValue: string) {\n const valueArray = this.value ? this.value.split(\";\") : [];\n valueArray.push(newValue);\n this.value = valueArray.join(\";\");\n }\n private _removeValue(oldValue: string) {\n const valueArray = this.value ? this.value.split(\";\") : [];\n const newValueArray = valueArray.filter(v => v !== oldValue);\n this.value = newValueArray.join(\";\");\n }\n\n private _sanitizeSlot() {\n const checkboxes = this._checkboxes;\n checkboxes.forEach(checkbox => {\n checkbox.checked = this.value.includes(checkbox.value);\n checkbox.hasFeedback = this.hasFeedback ? \"style\" : null;\n if (checkbox.required) {\n console.error(\"Checkboxes in a group cannot have required or hasFeedback prop set to true\");\n checkbox.remove();\n }\n });\n this._disabledChildCheckboxes();\n }\n\n private _disabledChildCheckboxes() {\n if (this.disabled) {\n const checkboxes = this._checkboxes;\n checkboxes.forEach(checkbox => (checkbox.disabled = this.disabled));\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n _handleValueChange() {\n const checkboxes = this._checkboxes;\n checkboxes.forEach(checkbox => {\n checkbox.checked = this.value.includes(checkbox.value);\n });\n this._updateInputValue();\n this._updateInvalid();\n }\n\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._isTouched) {\n this.invalid = !this.input.checkValidity();\n this._updateInvalid();\n }\n }\n @watch(\"invalid\", { waitUntilFirstUpdate: true })\n _updateInvalid() {\n const checkboxes = this._checkboxes;\n checkboxes.forEach(ch => (ch.invalid = this.invalid));\n }\n\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n /**\n * radio requries a custom _mixinResetFormControl as the update of input value\n * requires to fire a reset event manually\n * */\n private _mixinResetFormControl() {\n this.value = this.input.value = this.defaultValue;\n this._updateInputValue(\"reset\");\n this._mixinResetValidity(this.input);\n }\n /**\n * when input value is set programatically, need to manually dispatch a change event\n * In order to prevent race conditions and ensure sequence of events, set input's value here instead of binding to value prop of input\n */\n private _updateInputValue(eventName = \"change\") {\n this.input.value = this.value;\n this.input.dispatchEvent(new InputEvent(eventName));\n }\n firstUpdated(changedProperties) {\n super.firstUpdated(changedProperties);\n if (this.value) {\n this._updateInputValue();\n }\n }\n\n render() {\n return html`\n <fieldset>\n <div class=\"label-hint-container\">\n <label class=\"form-label\">${this.label}</label>\n ${this._renderHintText()}\n </div>\n <div class=\"checkbox-container\">\n <slot @slotchange=${this._sanitizeSlot}></slot>\n </div>\n <input\n type=\"text\"\n class=\"checkbox-group-validation-input ${classMap({\n \"is-invalid\": this.hasFeedback && this.invalid\n })}\"\n ?required=${this.required}\n tabindex=\"-1\"\n @change=${(e: Event) => {\n super._mixinHandleChange(e);\n }}\n .value=${live(this.value)}\n />\n ${this.invalid && this.hasFeedback\n ? html`\n <div class=\"invalid-feedback-container\">\n <slot name=\"invalidIcon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path\n d=\"M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10ZM10 6.25C9.49805 6.25 9.10584 6.68339 9.15578 7.18285L9.48461 10.4711C9.51109 10.7359 9.7339 10.9375 10 10.9375C10.2661 10.9375 10.4889 10.7359 10.5154 10.4711L10.8442 7.18285C10.8942 6.68339 10.5019 6.25 10 6.25ZM10.0014 11.875C9.48368 11.875 9.06394 12.2947 9.06394 12.8125C9.06394 13.3303 9.48368 13.75 10.0014 13.75C10.5192 13.75 10.9389 13.3303 10.9389 12.8125C10.9389 12.2947 10.5192 11.875 10.0014 11.875Z\"\n fill=\"currentColor\"\n />\n </svg>\n </slot>\n <div id=\"checkbox-feedback\" tabindex=\"0\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}\n </div>\n </div>\n `\n : nothing}\n </fieldset>\n `;\n }\n}\n\nexport default SgdsCheckboxGroup;\n\ntype CheckedMode = \"click\" | \"key\";\n"],"names":["feedbackStyles","formLabelStyles","checkboxGroupStyles","formHintStyles"],"mappings":";;;;;;;;;;;;;;AAcA;;;;;;;AAOG;MACU,iBAAkB,SAAQ,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;AAAjF,IAAA,WAAA,GAAA;;;QAQ+B,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAGG,IAAe,CAAA,eAAA,GAAG,EAAE,CAAC;;QAGpB,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAGnC,IAAQ,CAAA,QAAA,GAAG,EAAE,CAAC;;QAGC,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGlB,IAAK,CAAA,KAAA,GAAG,EA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AA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGlB,UAAA,CAAA;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAY,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAErC,UAAA,CAAA;AAAhB,IAAA,KAAK,EAAE;AAA4B,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG3B,UAAA,CAAA;AAAR,IAAA,KAAK,EAAE;AAAmB,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,cAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAwBnB,UAAA,CAAA;AADP,IAAA,qBAAqB,EAAE;AACkB,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAkC1C,UAAA,CAAA;IADC,KAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAQ9C,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA,CAAA;AAGD,UAAA,CAAA;IADC,KAAK,CAAC,YAAY,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAMnD,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,IAAA,CAAA,CAAA;AAED,UAAA,CAAA;IADC,KAAK,CAAC,SAAS,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAIhD,CAAA,EAAA,iBAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,IAAA,CAAA;;;;"}
@@ -18,13 +18,15 @@ export declare class SgdsCheckbox extends SgdsCheckbox_base implements SgdsFormC
18
18
  /** Draws the checkbox in a checked state. */
19
19
  checked: boolean;
20
20
  /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
21
- hasFeedback: boolean;
21
+ hasFeedback: "style" | "text" | "both";
22
22
  /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
23
23
  defaultChecked: boolean;
24
24
  /** Marks the checkbox input as indeterminate , with indeterminate logo */
25
25
  indeterminate: boolean;
26
26
  /** Makes the checkbox a required field. */
27
27
  required: boolean;
28
+ /**Feedback text for error state when validated */
29
+ invalidFeedback: string;
28
30
  private _isTouched;
29
31
  _handleInvalidChange(): void;
30
32
  /** Simulates a click on the checkbox. */
@@ -41,6 +43,7 @@ export declare class SgdsCheckbox extends SgdsCheckbox_base implements SgdsFormC
41
43
  /** @internal */
42
44
  _handleDisabledChange(): void;
43
45
  _handleIsTouched(): void;
46
+ _handleChecked(): void;
44
47
  private _mixinResetFormControl;
45
48
  /**
46
49
  * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
@@ -59,6 +62,7 @@ export declare class SgdsCheckbox extends SgdsCheckbox_base implements SgdsFormC
59
62
  * Returns the validation message based on the ValidityState
60
63
  */
61
64
  get validationMessage(): string;
65
+ firstUpdated(_changedProperties: any): void;
62
66
  render(): import("lit-html").TemplateResult<1>;
63
67
  }
64
68
  export default SgdsCheckbox;
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from 'tslib';
2
- import { html } from 'lit';
2
+ import { html, nothing } from 'lit';
3
3
  import { property, state } from 'lit/decorators.js';
4
4
  import { classMap } from 'lit/directives/class-map.js';
5
5
  import { ifDefined } from 'lit/directives/if-defined.js';
@@ -25,14 +25,14 @@ class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) {
25
25
  super(...arguments);
26
26
  /** Draws the checkbox in a checked state. */
27
27
  this.checked = false;
28
- /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
29
- this.hasFeedback = false;
30
28
  /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
31
29
  this.defaultChecked = false;
32
30
  /** Marks the checkbox input as indeterminate , with indeterminate logo */
33
31
  this.indeterminate = false;
34
32
  /** Makes the checkbox a required field. */
35
33
  this.required = false;
34
+ /**Feedback text for error state when validated */
35
+ this.invalidFeedback = "";
36
36
  this._isTouched = false;
37
37
  }
38
38
  _handleInvalidChange() {
@@ -57,7 +57,6 @@ class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) {
57
57
  this.indeterminate = !this.indeterminate;
58
58
  }
59
59
  this.checked = !this.checked;
60
- this.value = this.input.value;
61
60
  super._mixinHandleChange(e);
62
61
  this.emit("sgds-change", { detail: { checked: this.checked, value: this.value } });
63
62
  }
@@ -88,6 +87,11 @@ class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) {
88
87
  this.invalid = !this.input.checkValidity();
89
88
  }
90
89
  }
90
+ _handleChecked() {
91
+ this.checked
92
+ ? this.emit("sgds-check", { detail: { value: this.value } })
93
+ : this.emit("sgds-uncheck", { detail: { value: this.value } });
94
+ }
91
95
  _mixinResetFormControl() {
92
96
  this._isTouched = false;
93
97
  this.checked = this.input.checked = this.defaultChecked;
@@ -119,14 +123,20 @@ class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) {
119
123
  get validationMessage() {
120
124
  return this._mixinGetValidationMessage();
121
125
  }
126
+ firstUpdated(_changedProperties) {
127
+ super.firstUpdated(_changedProperties);
128
+ this.checked && this.emit("sgds-check", { detail: { value: this.value } });
129
+ }
122
130
  render() {
131
+ const wantFeedbackStyle = this.hasFeedback === "both" || this.hasFeedback === "style";
132
+ const wantFeedbackText = this.hasFeedback === "both" || this.hasFeedback === "text";
123
133
  return html `
124
134
  <div class="form-check">
125
135
  <div class="form-check-input-container">
126
136
  <input
127
137
  class=${classMap({
128
138
  "form-check-input": true,
129
- "is-invalid": this.hasFeedback && this.invalid
139
+ "is-invalid": wantFeedbackStyle && this.invalid
130
140
  })}
131
141
  type="checkbox"
132
142
  id=${this._controlId}
@@ -148,6 +158,23 @@ class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) {
148
158
  </div>
149
159
  <label for="${this._controlId}" class="form-check-label" id="${this._labelId}"><slot></slot></label>
150
160
  </div>
161
+ ${wantFeedbackText && this.invalid
162
+ ? html `
163
+ <div class="invalid-feedback-container">
164
+ <slot name="invalidIcon">
165
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
166
+ <path
167
+ d="M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10ZM10 6.25C9.49805 6.25 9.10584 6.68339 9.15578 7.18285L9.48461 10.4711C9.51109 10.7359 9.7339 10.9375 10 10.9375C10.2661 10.9375 10.4889 10.7359 10.5154 10.4711L10.8442 7.18285C10.8942 6.68339 10.5019 6.25 10 6.25ZM10.0014 11.875C9.48368 11.875 9.06394 12.2947 9.06394 12.8125C9.06394 13.3303 9.48368 13.75 10.0014 13.75C10.5192 13.75 10.9389 13.3303 10.9389 12.8125C10.9389 12.2947 10.5192 11.875 10.0014 11.875Z"
168
+ fill="currentColor"
169
+ />
170
+ </svg>
171
+ </slot>
172
+ <div id="checkbox-feedback" tabindex="0" class="invalid-feedback">
173
+ ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
174
+ </div>
175
+ </div>
176
+ `
177
+ : nothing}
151
178
  `;
152
179
  }
153
180
  }
@@ -159,7 +186,7 @@ __decorate([
159
186
  property({ type: Boolean, reflect: true })
160
187
  ], SgdsCheckbox.prototype, "checked", void 0);
161
188
  __decorate([
162
- property({ type: Boolean, reflect: true })
189
+ property({ type: String, reflect: true })
163
190
  ], SgdsCheckbox.prototype, "hasFeedback", void 0);
164
191
  __decorate([
165
192
  defaultValue("checked")
@@ -170,6 +197,9 @@ __decorate([
170
197
  __decorate([
171
198
  property({ type: Boolean, reflect: true })
172
199
  ], SgdsCheckbox.prototype, "required", void 0);
200
+ __decorate([
201
+ property({ type: String, reflect: true })
202
+ ], SgdsCheckbox.prototype, "invalidFeedback", void 0);
173
203
  __decorate([
174
204
  state()
175
205
  ], SgdsCheckbox.prototype, "_isTouched", void 0);
@@ -182,6 +212,9 @@ __decorate([
182
212
  __decorate([
183
213
  watch("_isTouched", { waitUntilFirstUpdate: true })
184
214
  ], SgdsCheckbox.prototype, "_handleIsTouched", null);
215
+ __decorate([
216
+ watch("checked", { waitUntilFirstUpdate: true })
217
+ ], SgdsCheckbox.prototype, "_handleChecked", null);
185
218
 
186
219
  export { SgdsCheckbox, SgdsCheckbox as default };
187
220
  //# sourceMappingURL=sgds-checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-checkbox.js","sources":["../../../src/components/Checkbox/sgds-checkbox.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\nimport checkboxStyle from \"./checkbox.css\";\n\n/**\n * @summary Checkbox component is used when you require users to select multiple items from a list.\n *\n * @slot default - The label of checkbox.\n *\n * @event sgds-change - Emitted when the checked state changes.\n * @event sgds-blur - Emitted when input is not in focus.\n * @event sgds-focus - Emitted when input is in focus.\n * @event sgds-validity-change - Emitted when the invalid state changes. This event is used by sgds-checkbox-group to check the invalid state change of its children\n */\nexport class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...FormControlElement.styles, checkboxStyle];\n\n /** Value of the HTML form control. Primarily used to differentiate a list of related checkboxes that have the same name. */\n @property({ type: String, reflect: true }) value: string;\n\n /** Draws the checkbox in a checked state. */\n @property({ type: Boolean, reflect: true }) checked = false;\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"checked\")\n defaultChecked = false;\n\n /** Marks the checkbox input as indeterminate , with indeterminate logo */\n @property({ type: Boolean, reflect: true }) indeterminate = false;\n\n /** Makes the checkbox a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n @state() private _isTouched = false;\n\n @watch(\"invalid\", { waitUntilFirstUpdate: true })\n _handleInvalidChange() {\n this.emit(\"sgds-validity-change\", {\n detail: { invalid: this.invalid, validationMessage: this.input.validationMessage }\n });\n }\n\n /** Simulates a click on the checkbox. */\n public click() {\n this.input.click();\n }\n /** Sets focus on the checkbox. */\n public focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n /** Removes focus from the checkbox. */\n public blur() {\n this.input.blur();\n }\n\n private _handleChange(e: Event) {\n if (this.indeterminate) {\n this.indeterminate = !this.indeterminate;\n }\n\n this.checked = !this.checked;\n this.value = this.input.value;\n super._mixinHandleChange(e);\n this.emit(\"sgds-change\", { detail: { checked: this.checked, value: this.value } });\n }\n\n private _handleKeyDown(event: KeyboardEvent) {\n const hasModifier = event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n if (event.key === \"Enter\" && !hasModifier) {\n this.click();\n }\n }\n\n private _handleBlur() {\n this._isTouched = true;\n this.emit(\"sgds-blur\");\n }\n\n private _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n private _handleInvalid(e: Event) {\n e.preventDefault();\n this.invalid = true;\n }\n\n /** @internal */\n @watch(\"disabled\", { waitUntilFirstUpdate: true })\n _handleDisabledChange() {\n // Disabled form controls are always valid, so we need to recheck validity when the state changes\n this.setInvalid(false);\n }\n\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._isTouched) {\n this.invalid = !this.input.checkValidity();\n }\n }\n private _mixinResetFormControl() {\n this._isTouched = false;\n this.checked = this.input.checked = this.defaultChecked;\n this.input.dispatchEvent(new InputEvent(\"reset\"));\n this._mixinResetValidity(this.input);\n }\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n render() {\n return html`\n <div class=\"form-check\">\n <div class=\"form-check-input-container\">\n <input\n class=${classMap({\n \"form-check-input\": true,\n \"is-invalid\": this.hasFeedback && this.invalid\n })}\n type=\"checkbox\"\n id=${this._controlId}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n name=${ifDefined(this.name)}\n ?indeterminate=${this.indeterminate}\n ?required=${this.required}\n aria-disabled=${this.disabled ? \"true\" : \"false\"}\n aria-checked=${this.checked ? \"true\" : \"false\"}\n @change=${(e: Event) => this._handleChange(e)}\n @keydown=${this._handleKeyDown}\n @invalid=${(e: Event) => this._handleInvalid(e)}\n .checked=${live(this.checked)}\n .disabled=${this.disabled}\n .required=${this.required}\n @blur=${this._handleBlur}\n @focus=${this._handleFocus}\n />\n </div>\n <label for=\"${this._controlId}\" class=\"form-check-label\" id=\"${this._labelId}\"><slot></slot></label>\n </div>\n `;\n }\n}\n\nexport default SgdsCheckbox;\n"],"names":["checkboxStyle"],"mappings":";;;;;;;;;;;;AAYA;;;;;;;;;AASG;MACU,YAAa,SAAQ,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;AAA5E,IAAA,WAAA,GAAA;;;QAO8C,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;;QAGhB,IAAW,CAAA,WAAA,GA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A,CAAA;AAE5C,UAAA,CAAA;AAAhB,IAAA,KAAK,EAAE;AAA4B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGpC,UAAA,CAAA;IADC,KAAK,CAAC,SAAS,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAKhD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,sBAAA,EAAA,IAAA,CAAA,CAAA;AAkDD,UAAA,CAAA;IADC,KAAK,CAAC,UAAU,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAIjD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,uBAAA,EAAA,IAAA,CAAA,CAAA;AAGD,UAAA,CAAA;IADC,KAAK,CAAC,YAAY,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAKnD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,IAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sgds-checkbox.js","sources":["../../../src/components/Checkbox/sgds-checkbox.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport FormControlElement from \"../../base/form-control-element\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\nimport { SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { watch } from \"../../utils/watch\";\nimport checkboxStyle from \"./checkbox.css\";\n\n/**\n * @summary Checkbox component is used when you require users to select multiple items from a list.\n *\n * @slot default - The label of checkbox.\n *\n * @event sgds-change - Emitted when the checked state changes.\n * @event sgds-blur - Emitted when input is not in focus.\n * @event sgds-focus - Emitted when input is in focus.\n * @event sgds-validity-change - Emitted when the invalid state changes. This event is used by sgds-checkbox-group to check the invalid state change of its children\n */\nexport class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) implements SgdsFormControl {\n static styles = [...FormControlElement.styles, checkboxStyle];\n\n /** Value of the HTML form control. Primarily used to differentiate a list of related checkboxes that have the same name. */\n @property({ type: String, reflect: true }) value: string;\n\n /** Draws the checkbox in a checked state. */\n @property({ type: Boolean, reflect: true }) checked = false;\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: String, reflect: true }) hasFeedback: \"style\" | \"text\" | \"both\";\n\n /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue(\"checked\")\n defaultChecked = false;\n\n /** Marks the checkbox input as indeterminate , with indeterminate logo */\n @property({ type: Boolean, reflect: true }) indeterminate = false;\n\n /** Makes the checkbox a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /**Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n\n @state() private _isTouched = false;\n\n @watch(\"invalid\", { waitUntilFirstUpdate: true })\n _handleInvalidChange() {\n this.emit(\"sgds-validity-change\", {\n detail: { invalid: this.invalid, validationMessage: this.input.validationMessage }\n });\n }\n\n /** Simulates a click on the checkbox. */\n public click() {\n this.input.click();\n }\n /** Sets focus on the checkbox. */\n public focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n /** Removes focus from the checkbox. */\n public blur() {\n this.input.blur();\n }\n\n private _handleChange(e: Event) {\n if (this.indeterminate) {\n this.indeterminate = !this.indeterminate;\n }\n\n this.checked = !this.checked;\n super._mixinHandleChange(e);\n this.emit(\"sgds-change\", { detail: { checked: this.checked, value: this.value } });\n }\n\n private _handleKeyDown(event: KeyboardEvent) {\n const hasModifier = event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;\n if (event.key === \"Enter\" && !hasModifier) {\n this.click();\n }\n }\n\n private _handleBlur() {\n this._isTouched = true;\n this.emit(\"sgds-blur\");\n }\n\n private _handleFocus() {\n this.emit(\"sgds-focus\");\n }\n\n private _handleInvalid(e: Event) {\n e.preventDefault();\n this.invalid = true;\n }\n\n /** @internal */\n @watch(\"disabled\", { waitUntilFirstUpdate: true })\n _handleDisabledChange() {\n // Disabled form controls are always valid, so we need to recheck validity when the state changes\n this.setInvalid(false);\n }\n\n @watch(\"_isTouched\", { waitUntilFirstUpdate: true })\n _handleIsTouched() {\n if (this._isTouched) {\n this.invalid = !this.input.checkValidity();\n }\n }\n\n @watch(\"checked\", { waitUntilFirstUpdate: true })\n _handleChecked() {\n this.checked\n ? this.emit(\"sgds-check\", { detail: { value: this.value } })\n : this.emit(\"sgds-uncheck\", { detail: { value: this.value } });\n }\n\n private _mixinResetFormControl() {\n this._isTouched = false;\n this.checked = this.input.checked = this.defaultChecked;\n this.input.dispatchEvent(new InputEvent(\"reset\"));\n this._mixinResetValidity(this.input);\n }\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n firstUpdated(_changedProperties) {\n super.firstUpdated(_changedProperties);\n this.checked && this.emit(\"sgds-check\", { detail: { value: this.value } });\n }\n render() {\n const wantFeedbackStyle = this.hasFeedback === \"both\" || this.hasFeedback === \"style\";\n const wantFeedbackText = this.hasFeedback === \"both\" || this.hasFeedback === \"text\";\n\n return html`\n <div class=\"form-check\">\n <div class=\"form-check-input-container\">\n <input\n class=${classMap({\n \"form-check-input\": true,\n \"is-invalid\": wantFeedbackStyle && this.invalid\n })}\n type=\"checkbox\"\n id=${this._controlId}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n name=${ifDefined(this.name)}\n ?indeterminate=${this.indeterminate}\n ?required=${this.required}\n aria-disabled=${this.disabled ? \"true\" : \"false\"}\n aria-checked=${this.checked ? \"true\" : \"false\"}\n @change=${(e: Event) => this._handleChange(e)}\n @keydown=${this._handleKeyDown}\n @invalid=${(e: Event) => this._handleInvalid(e)}\n .checked=${live(this.checked)}\n .disabled=${this.disabled}\n .required=${this.required}\n @blur=${this._handleBlur}\n @focus=${this._handleFocus}\n />\n </div>\n <label for=\"${this._controlId}\" class=\"form-check-label\" id=\"${this._labelId}\"><slot></slot></label>\n </div>\n ${wantFeedbackText && this.invalid\n ? html`\n <div class=\"invalid-feedback-container\">\n <slot name=\"invalidIcon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"none\">\n <path\n d=\"M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10ZM10 6.25C9.49805 6.25 9.10584 6.68339 9.15578 7.18285L9.48461 10.4711C9.51109 10.7359 9.7339 10.9375 10 10.9375C10.2661 10.9375 10.4889 10.7359 10.5154 10.4711L10.8442 7.18285C10.8942 6.68339 10.5019 6.25 10 6.25ZM10.0014 11.875C9.48368 11.875 9.06394 12.2947 9.06394 12.8125C9.06394 13.3303 9.48368 13.75 10.0014 13.75C10.5192 13.75 10.9389 13.3303 10.9389 12.8125C10.9389 12.2947 10.5192 11.875 10.0014 11.875Z\"\n fill=\"currentColor\"\n />\n </svg>\n </slot>\n <div id=\"checkbox-feedback\" tabindex=\"0\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}\n </div>\n </div>\n `\n : nothing}\n `;\n }\n}\n\nexport default SgdsCheckbox;\n"],"names":["checkboxStyle"],"mappings":";;;;;;;;;;;;AAYA;;;;;;;;;AASG;MACU,YAAa,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