@govtechsg/sgds-web-component 3.1.0-rc.7 → 3.1.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.
- package/base/select-element.d.ts +80 -0
- package/base/select-element.js +201 -0
- package/base/select-element.js.map +1 -0
- package/components/Breadcrumb/index.umd.js +5 -2
- package/components/Breadcrumb/index.umd.js.map +1 -1
- package/components/Checkbox/checkbox.js +1 -1
- package/components/Checkbox/index.umd.js +22 -14
- package/components/Checkbox/index.umd.js.map +1 -1
- package/components/Checkbox/sgds-checkbox-group.d.ts +2 -2
- package/components/Checkbox/sgds-checkbox-group.js +19 -14
- package/components/Checkbox/sgds-checkbox-group.js.map +1 -1
- package/components/Checkbox/sgds-checkbox.js +4 -4
- package/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/components/ComboBox/combo-box.js +1 -1
- package/components/ComboBox/index.umd.js +500 -496
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/ComboBox/sgds-combo-box.d.ts +9 -82
- package/components/ComboBox/sgds-combo-box.js +13 -202
- package/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/components/Datepicker/index.umd.js +1 -1
- package/components/Dropdown/dropdown-menu.js +1 -1
- package/components/Dropdown/dropdown.js +1 -1
- package/components/Dropdown/index.umd.js +5 -2
- package/components/Dropdown/index.umd.js.map +1 -1
- package/components/Dropdown/sgds-dropdown-item.js +3 -0
- package/components/Dropdown/sgds-dropdown-item.js.map +1 -1
- package/components/Mainnav/index.umd.js +6 -3
- package/components/Mainnav/index.umd.js.map +1 -1
- package/components/Mainnav/mainnav-dropdown.js +1 -1
- package/components/Select/index.d.ts +6 -0
- package/components/Select/index.js +4 -0
- package/components/Select/index.js.map +1 -0
- package/components/Select/index.umd.js +10317 -0
- package/components/Select/index.umd.js.map +1 -0
- package/components/Select/select-item.d.ts +17 -0
- package/components/Select/select-item.js +61 -0
- package/components/Select/select-item.js.map +1 -0
- package/components/Select/select-item2.js +6 -0
- package/components/Select/select-item2.js.map +1 -0
- package/components/Select/select.js +6 -0
- package/components/Select/select.js.map +1 -0
- package/components/Select/sgds-select.d.ts +27 -0
- package/components/Select/sgds-select.js +158 -0
- package/components/Select/sgds-select.js.map +1 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/index.js.map +1 -1
- package/components/index.umd.js +528 -312
- package/components/index.umd.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/index.umd.js +565 -348
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/base/select-element.cjs.js +206 -0
- package/react/base/select-element.cjs.js.map +1 -0
- package/react/base/select-element.js +202 -0
- package/react/base/select-element.js.map +1 -0
- package/react/components/Checkbox/checkbox.cjs.js +1 -1
- package/react/components/Checkbox/checkbox.js +1 -1
- package/react/components/Checkbox/sgds-checkbox-group.cjs.js +18 -13
- package/react/components/Checkbox/sgds-checkbox-group.cjs.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox-group.js +19 -14
- package/react/components/Checkbox/sgds-checkbox-group.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.cjs.js +4 -4
- package/react/components/Checkbox/sgds-checkbox.cjs.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.js +4 -4
- package/react/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/react/components/ComboBox/combo-box.cjs.js +1 -1
- package/react/components/ComboBox/combo-box.js +1 -1
- package/react/components/ComboBox/sgds-combo-box.cjs.js +12 -201
- package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.js +13 -202
- package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/react/components/Dropdown/dropdown-menu.cjs.js +1 -1
- package/react/components/Dropdown/dropdown-menu.js +1 -1
- package/react/components/Dropdown/dropdown.cjs.js +1 -1
- package/react/components/Dropdown/dropdown.js +1 -1
- package/react/components/Dropdown/sgds-dropdown-item.cjs.js +3 -0
- package/react/components/Dropdown/sgds-dropdown-item.cjs.js.map +1 -1
- package/react/components/Dropdown/sgds-dropdown-item.js +3 -0
- package/react/components/Dropdown/sgds-dropdown-item.js.map +1 -1
- package/react/components/Mainnav/mainnav-dropdown.cjs.js +1 -1
- package/react/components/Mainnav/mainnav-dropdown.js +1 -1
- package/react/components/Select/select-item.cjs.js +67 -0
- package/react/components/Select/select-item.cjs.js.map +1 -0
- package/react/components/Select/select-item.cjs2.js +11 -0
- package/react/components/Select/select-item.cjs2.js.map +1 -0
- package/react/components/Select/select-item.js +62 -0
- package/react/components/Select/select-item.js.map +1 -0
- package/react/components/Select/select-item2.js +7 -0
- package/react/components/Select/select-item2.js.map +1 -0
- package/react/components/Select/select.cjs.js +11 -0
- package/react/components/Select/select.cjs.js.map +1 -0
- package/react/components/Select/select.js +7 -0
- package/react/components/Select/select.js.map +1 -0
- package/react/components/Select/sgds-select.cjs.js +164 -0
- package/react/components/Select/sgds-select.cjs.js.map +1 -0
- package/react/components/Select/sgds-select.js +159 -0
- package/react/components/Select/sgds-select.js.map +1 -0
- package/react/index.cjs.js +38 -36
- package/react/index.cjs.js.map +1 -1
- package/react/index.d.ts +1 -0
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/react/select/index.cjs.js +46 -0
- package/react/select/index.cjs.js.map +1 -0
- package/react/select/index.d.ts +2 -0
- package/react/select/index.js +22 -0
- package/react/select/index.js.map +1 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { SgdsFormControl } from "../utils/formSubmitController";
|
|
2
|
+
import { DropdownListElement } from "./dropdown-list-element";
|
|
3
|
+
declare const SelectElement_base: (new (...args: any[]) => import("../utils/validatorMixin").ToBeValidatedElementInterface) & typeof DropdownListElement;
|
|
4
|
+
export declare class SelectElement extends SelectElement_base implements SgdsFormControl {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
/** The input's label */
|
|
7
|
+
label: string;
|
|
8
|
+
/** The input's hint text below the label */
|
|
9
|
+
hintText: string;
|
|
10
|
+
/** The input's name attribute */
|
|
11
|
+
name: string;
|
|
12
|
+
/** The input's placeholder text. */
|
|
13
|
+
placeholder: string;
|
|
14
|
+
/** Autofocus the input */
|
|
15
|
+
autofocus: boolean;
|
|
16
|
+
/** Disables the input. */
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
/** Makes the input a required field. */
|
|
19
|
+
required: boolean;
|
|
20
|
+
/** Makes the input readonly. */
|
|
21
|
+
readonly: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* IMPORTANT:
|
|
24
|
+
* We still expose `.value` externally, but this is now the underlying ID or data
|
|
25
|
+
* (e.g. 1, 2, 'abc', ...), not the label that appears in the input box.
|
|
26
|
+
*/
|
|
27
|
+
value: string;
|
|
28
|
+
protected displayValue: string;
|
|
29
|
+
/** @internal Gets or sets the default value used to reset this element. */
|
|
30
|
+
defaultValue: string;
|
|
31
|
+
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
32
|
+
hasFeedback: boolean;
|
|
33
|
+
/** Feedback text for error state when validated */
|
|
34
|
+
invalidFeedback: string;
|
|
35
|
+
/** Marks the component as invalid. Replace the pseudo :invalid selector. */
|
|
36
|
+
invalid: boolean;
|
|
37
|
+
/** The list of items to display in the dropdown.
|
|
38
|
+
* `interface SgdsComboBoxItemData {
|
|
39
|
+
* label: string;
|
|
40
|
+
* value: string;
|
|
41
|
+
* }`
|
|
42
|
+
*/
|
|
43
|
+
menuList: SgdsSelectItemData[];
|
|
44
|
+
/** Track selected items (even for single-select, but it will have at most one). */
|
|
45
|
+
protected selectedItems: SgdsSelectItemData[];
|
|
46
|
+
/** @internal Managed filtered menu on the fly with input change*/
|
|
47
|
+
protected filteredMenuList: SgdsSelectItemData[];
|
|
48
|
+
protected _isTouched: boolean;
|
|
49
|
+
constructor();
|
|
50
|
+
protected _input: Promise<HTMLInputElement>;
|
|
51
|
+
connectedCallback(): void;
|
|
52
|
+
/**
|
|
53
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
54
|
+
* 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
|
|
55
|
+
*/
|
|
56
|
+
reportValidity(): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Checks for validity without any native error popup message
|
|
59
|
+
*/
|
|
60
|
+
checkValidity(): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the ValidityState object
|
|
63
|
+
*/
|
|
64
|
+
get validity(): ValidityState;
|
|
65
|
+
/**
|
|
66
|
+
* Returns the validation message based on the ValidityState
|
|
67
|
+
*/
|
|
68
|
+
get validationMessage(): string;
|
|
69
|
+
protected _controlId: string;
|
|
70
|
+
protected _renderFeedback(): import("lit-html").TemplateResult<1>;
|
|
71
|
+
protected _renderHintText(): import("lit-html").TemplateResult<1>;
|
|
72
|
+
protected _labelId: string;
|
|
73
|
+
protected _renderLabel(): import("lit-html").TemplateResult<1>;
|
|
74
|
+
protected _handleClick(): any;
|
|
75
|
+
}
|
|
76
|
+
export interface SgdsSelectItemData {
|
|
77
|
+
label: string;
|
|
78
|
+
value: string;
|
|
79
|
+
}
|
|
80
|
+
export {};
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
import { property, state, queryAsync } from 'lit/decorators.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import css_248z from '../components/Dropdown/dropdown-menu.js';
|
|
6
|
+
import css_248z$2 from '../styles/feedback.js';
|
|
7
|
+
import css_248z$1 from '../styles/form-hint.js';
|
|
8
|
+
import { defaultValue } from '../utils/defaultvalue.js';
|
|
9
|
+
import genId from '../utils/generateId.js';
|
|
10
|
+
import { SgdsFormValidatorMixin } from '../utils/validatorMixin.js';
|
|
11
|
+
import { DropdownListElement } from './dropdown-list-element.js';
|
|
12
|
+
|
|
13
|
+
class SelectElement extends SgdsFormValidatorMixin(DropdownListElement) {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
/** The input's label */
|
|
17
|
+
this.label = "";
|
|
18
|
+
/** The input's hint text below the label */
|
|
19
|
+
this.hintText = "";
|
|
20
|
+
/** Autofocus the input */
|
|
21
|
+
this.autofocus = false;
|
|
22
|
+
/** Disables the input. */
|
|
23
|
+
this.disabled = false;
|
|
24
|
+
/** Makes the input a required field. */
|
|
25
|
+
this.required = false;
|
|
26
|
+
/** Makes the input readonly. */
|
|
27
|
+
this.readonly = false;
|
|
28
|
+
/**
|
|
29
|
+
* IMPORTANT:
|
|
30
|
+
* We still expose `.value` externally, but this is now the underlying ID or data
|
|
31
|
+
* (e.g. 1, 2, 'abc', ...), not the label that appears in the input box.
|
|
32
|
+
*/
|
|
33
|
+
this.value = "";
|
|
34
|
+
this.displayValue = "";
|
|
35
|
+
/** @internal Gets or sets the default value used to reset this element. */
|
|
36
|
+
this.defaultValue = "";
|
|
37
|
+
/** Allows invalidFeedback, invalid and valid styles to be visible with the input */
|
|
38
|
+
this.hasFeedback = false;
|
|
39
|
+
/** Feedback text for error state when validated */
|
|
40
|
+
this.invalidFeedback = "";
|
|
41
|
+
/** Marks the component as invalid. Replace the pseudo :invalid selector. */
|
|
42
|
+
this.invalid = false;
|
|
43
|
+
/** The list of items to display in the dropdown.
|
|
44
|
+
* `interface SgdsComboBoxItemData {
|
|
45
|
+
* label: string;
|
|
46
|
+
* value: string;
|
|
47
|
+
* }`
|
|
48
|
+
*/
|
|
49
|
+
this.menuList = [];
|
|
50
|
+
/** Track selected items (even for single-select, but it will have at most one). */
|
|
51
|
+
this.selectedItems = [];
|
|
52
|
+
/** @internal Managed filtered menu on the fly with input change*/
|
|
53
|
+
this.filteredMenuList = [];
|
|
54
|
+
this._isTouched = false;
|
|
55
|
+
this._controlId = genId("input");
|
|
56
|
+
this._labelId = genId("label");
|
|
57
|
+
/** @internal */
|
|
58
|
+
this.modifierOpt = [
|
|
59
|
+
{
|
|
60
|
+
name: "offset",
|
|
61
|
+
options: {
|
|
62
|
+
offset: [0, 8]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
}
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
super.connectedCallback();
|
|
69
|
+
this.addEventListener("blur", async () => {
|
|
70
|
+
this.invalid = !this._mixinReportValidity();
|
|
71
|
+
});
|
|
72
|
+
if (this.readonly) {
|
|
73
|
+
this._handleKeyboardMenuEvent = null;
|
|
74
|
+
this._handleKeyboardMenuItemsEvent = null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
|
|
79
|
+
* 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
|
|
80
|
+
*/
|
|
81
|
+
reportValidity() {
|
|
82
|
+
return this._mixinReportValidity();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Checks for validity without any native error popup message
|
|
86
|
+
*/
|
|
87
|
+
checkValidity() {
|
|
88
|
+
return this._mixinCheckValidity();
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns the ValidityState object
|
|
92
|
+
*/
|
|
93
|
+
get validity() {
|
|
94
|
+
return this._mixinGetValidity();
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Returns the validation message based on the ValidityState
|
|
98
|
+
*/
|
|
99
|
+
get validationMessage() {
|
|
100
|
+
return this._mixinGetValidationMessage();
|
|
101
|
+
}
|
|
102
|
+
_renderFeedback() {
|
|
103
|
+
return this.invalid && this.hasFeedback
|
|
104
|
+
? html ` <div class="invalid-feedback-container">
|
|
105
|
+
<slot name="invalidIcon">
|
|
106
|
+
<sgds-icon name="exclamation-circle-fill" size="md"></sgds-icon>
|
|
107
|
+
</slot>
|
|
108
|
+
<div id="${this._controlId}-invalid" class="invalid-feedback">
|
|
109
|
+
${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}
|
|
110
|
+
</div>
|
|
111
|
+
</div>`
|
|
112
|
+
: html `${this._renderHintText()}`;
|
|
113
|
+
}
|
|
114
|
+
_renderHintText() {
|
|
115
|
+
const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
|
|
116
|
+
return this.hintText && hintTextTemplate;
|
|
117
|
+
}
|
|
118
|
+
_renderLabel() {
|
|
119
|
+
const labelTemplate = html `
|
|
120
|
+
<label
|
|
121
|
+
for=${this._controlId}
|
|
122
|
+
id=${this._labelId}
|
|
123
|
+
class=${classMap({
|
|
124
|
+
"form-label": true,
|
|
125
|
+
required: this.required
|
|
126
|
+
})}
|
|
127
|
+
>${this.label}</label
|
|
128
|
+
>
|
|
129
|
+
`;
|
|
130
|
+
return this.label && labelTemplate;
|
|
131
|
+
}
|
|
132
|
+
_handleClick() {
|
|
133
|
+
if (this.readonly) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
if (!this.menuIsOpen) {
|
|
137
|
+
this.showMenu();
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
this.hideMenu();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
SelectElement.styles = [...DropdownListElement.styles, css_248z, css_248z$1, css_248z$2];
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ reflect: true })
|
|
147
|
+
], SelectElement.prototype, "label", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ reflect: true })
|
|
150
|
+
], SelectElement.prototype, "hintText", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ reflect: true })
|
|
153
|
+
], SelectElement.prototype, "name", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
property({ type: String, reflect: true })
|
|
156
|
+
], SelectElement.prototype, "placeholder", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: Boolean, reflect: true })
|
|
159
|
+
], SelectElement.prototype, "autofocus", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: Boolean, reflect: true })
|
|
162
|
+
], SelectElement.prototype, "disabled", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ type: Boolean, reflect: true })
|
|
165
|
+
], SelectElement.prototype, "required", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
property({ type: Boolean, reflect: true })
|
|
168
|
+
], SelectElement.prototype, "readonly", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
property({ type: String, reflect: true })
|
|
171
|
+
], SelectElement.prototype, "value", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
state()
|
|
174
|
+
], SelectElement.prototype, "displayValue", void 0);
|
|
175
|
+
__decorate([
|
|
176
|
+
defaultValue()
|
|
177
|
+
], SelectElement.prototype, "defaultValue", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ type: Boolean, reflect: true })
|
|
180
|
+
], SelectElement.prototype, "hasFeedback", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
property({ type: String, reflect: true })
|
|
183
|
+
], SelectElement.prototype, "invalidFeedback", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
property({ type: Boolean, reflect: true })
|
|
186
|
+
], SelectElement.prototype, "invalid", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
property({ type: Array })
|
|
189
|
+
], SelectElement.prototype, "menuList", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
state()
|
|
192
|
+
], SelectElement.prototype, "selectedItems", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
state()
|
|
195
|
+
], SelectElement.prototype, "filteredMenuList", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
queryAsync("input.form-control")
|
|
198
|
+
], SelectElement.prototype, "_input", void 0);
|
|
199
|
+
|
|
200
|
+
export { SelectElement };
|
|
201
|
+
//# sourceMappingURL=select-element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-element.js","sources":["../../src/base/select-element.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property, queryAsync, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport dropdownMenuStyle from \"../components/Dropdown/dropdown-menu.css\";\nimport feedbackStyles from \"../styles/feedback.css\";\nimport hintTextStyles from \"../styles/form-hint.css\";\nimport { defaultValue } from \"../utils/defaultvalue\";\nimport { SgdsFormControl } from \"../utils/formSubmitController\";\nimport generateId from \"../utils/generateId\";\nimport { SgdsFormValidatorMixin } from \"../utils/validatorMixin\";\nimport { DropdownListElement } from \"./dropdown-list-element\";\n\nexport class SelectElement extends SgdsFormValidatorMixin(DropdownListElement) implements SgdsFormControl {\n static styles = [...DropdownListElement.styles, dropdownMenuStyle, hintTextStyles, feedbackStyles];\n\n /** The input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** The input's name attribute */\n @property({ reflect: true }) name: string;\n\n /** The input's placeholder text. */\n @property({ type: String, reflect: true }) placeholder: string;\n\n /** Autofocus the input */\n @property({ type: Boolean, reflect: true }) autofocus = false;\n\n /** Disables the input. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Makes the input a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n /** Makes the input readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n /**\n * IMPORTANT:\n * We still expose `.value` externally, but this is now the underlying ID or data\n * (e.g. 1, 2, 'abc', ...), not the label that appears in the input box.\n */\n @property({ type: String, reflect: true })\n value = \"\";\n\n @state()\n protected displayValue = \"\";\n\n /** @internal Gets or sets the default value used to reset this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /** Allows invalidFeedback, invalid and valid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** Feedback text for error state when validated */\n @property({ type: String, reflect: true }) invalidFeedback = \"\";\n\n /** Marks the component as invalid. Replace the pseudo :invalid selector. */\n @property({ type: Boolean, reflect: true }) invalid = false;\n\n /** The list of items to display in the dropdown.\n * `interface SgdsComboBoxItemData {\n * label: string;\n * value: string;\n * }`\n */\n @property({ type: Array }) menuList: SgdsSelectItemData[] = [];\n /** Track selected items (even for single-select, but it will have at most one). */\n @state()\n protected selectedItems: SgdsSelectItemData[] = [];\n /** @internal Managed filtered menu on the fly with input change*/\n @state()\n protected filteredMenuList: SgdsSelectItemData[] = [];\n\n protected _isTouched = false;\n\n constructor() {\n super();\n /** @internal */\n this.modifierOpt = [\n {\n name: \"offset\",\n options: {\n offset: [0, 8]\n }\n }\n ];\n }\n\n @queryAsync(\"input.form-control\") protected _input: Promise<HTMLInputElement>;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"blur\", async () => {\n this.invalid = !this._mixinReportValidity();\n });\n if (this.readonly) {\n this._handleKeyboardMenuEvent = null;\n this._handleKeyboardMenuItemsEvent = null;\n }\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 * 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(): string {\n return this._mixinGetValidationMessage();\n }\n protected _controlId = generateId(\"input\");\n protected _renderFeedback() {\n return this.invalid && this.hasFeedback\n ? html` <div class=\"invalid-feedback-container\">\n <slot name=\"invalidIcon\">\n <sgds-icon name=\"exclamation-circle-fill\" size=\"md\"></sgds-icon>\n </slot>\n <div id=\"${this._controlId}-invalid\" class=\"invalid-feedback\">\n ${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}\n </div>\n </div>`\n : html`${this._renderHintText()}`;\n }\n\n protected _renderHintText() {\n const hintTextTemplate = html` <div id=\"${this._controlId}Help\" class=\"form-text\">${this.hintText}</div> `;\n return this.hintText && hintTextTemplate;\n }\n protected _labelId = generateId(\"label\");\n protected _renderLabel() {\n const labelTemplate = html`\n <label\n for=${this._controlId}\n id=${this._labelId}\n class=${classMap({\n \"form-label\": true,\n required: this.required\n })}\n >${this.label}</label\n >\n `;\n return this.label && labelTemplate;\n }\n\n protected _handleClick() {\n if (this.readonly) {\n return null;\n }\n if (!this.menuIsOpen) {\n this.showMenu();\n } else {\n this.hideMenu();\n }\n }\n}\n\nexport interface SgdsSelectItemData {\n label: string;\n value: string;\n}\n"],"names":["generateId","dropdownMenuStyle","hintTextStyles","feedbackStyles"],"mappings":";;;;;;;;;;;;MAYa,aAAc,SAAQ,sBAAsB,CAAC,mBAAmB,CAAC,CAAA;AAkE5E,IAAA,WAAA,GAAA;AACE,QAAA,KAAK,EAAE,CAAC;;QA/DmB,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;;QAGX,IAAQ,CAAA,QAAA,GAAG,EAAE,CAAC;;QASC,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGlB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGjB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGjB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;AAC7D;;;;AAIG;QAEH,IAAK,CAAA,KAAA,GAAG,EAAE,CAAC;QAGD,IAAY,CAAA,YAAA,GAAG,EAAE,CAAC;;QAI5B,IAAY,CAAA,YAAA,GAAG,EAAE,CAAC;;QAG0B,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;QAGrB,IAAe,CAAA,eAAA,GAAG,EAAE,CAAC;;QAGpB,IAAO,CAAA,OAAA,GAAG,KAAK,CAAC;AAE5D;;;;;AAKG;QACwB,IAAQ,CAAA,QAAA,GAAyB,EAAE,CAAC;;QAGrD,IAAa,CAAA,aAAA,GAAyB,EAAE,CAAC;;QAGzC,IAAgB,CAAA,gBAAA,GAAyB,EAAE,CAAC;QAE5C,IA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CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGzC,UAAA,CAAA;AADT,IAAA,KAAK,EAAE;AAC8C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAiBV,UAAA,CAAA;IAA3C,UAAU,CAAC,oBAAoB,CAAC;AAA6C,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,QAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
|
|
@@ -8461,9 +8461,9 @@
|
|
|
8461
8461
|
};
|
|
8462
8462
|
}
|
|
8463
8463
|
|
|
8464
|
-
var css_248z$6 = css`.dropdown-menu{background-clip:padding-box;background-color:var(--sgds-surface-default);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 1px 0 hsla(0,0%,5%,.12),0 4px 8px 0 hsla(0,0%,5%,.12);color:var(--sgds-color-default);display:none;list-style:none;margin:0;min-width:var(--sgds-dimension-280);overflow-y:auto;padding:var(--sgds-padding-xs) 0;position:absolute;text-align:left;z-index:1000}.dropdown
|
|
8464
|
+
var css_248z$6 = css`.dropdown-menu{background-clip:padding-box;background-color:var(--sgds-surface-default);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 1px 0 hsla(0,0%,5%,.12),0 4px 8px 0 hsla(0,0%,5%,.12);color:var(--sgds-color-default);display:none;list-style:none;margin:0;max-height:var(--sgds-dimension-480);min-width:var(--sgds-dimension-280);overflow-y:auto;padding:var(--sgds-padding-xs) 0;position:absolute;text-align:left;z-index:1000}.dropdown-menu.show{display:block}.nav-tabs .dropdown-menu{border-top-left-radius:0;border-top-right-radius:0;margin-top:calc(var(--sgds-nav-tabs-border-width)*-1)}@media (min-width:576px){.navbar-expand-sm .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:768px){.navbar-expand-md .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:992px){.navbar-expand-lg .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1200px){.navbar-expand-xl .navbar-nav .dropdown-menu{position:absolute}}@media (min-width:1400px){.navbar-expand-xxl .navbar-nav .dropdown-menu{position:absolute}}.navbar-expand .navbar-nav .dropdown-menu{position:absolute}.sgds.navbar .dropdown-menu.megamenu{left:0;right:0;width:100%}.sgds.combobox>.dropdown-menu{min-width:100%}`;
|
|
8465
8465
|
|
|
8466
|
-
var css_248z$5 = css`:host{position:relative}.dropdown{display:flex;height:
|
|
8466
|
+
var css_248z$5 = css`:host{position:relative}.dropdown{display:flex;height:inherit}`;
|
|
8467
8467
|
|
|
8468
8468
|
/**
|
|
8469
8469
|
* @summary `SgdsDropdown` toggles contextual overlays for displaying lists of links.
|
|
@@ -8788,6 +8788,9 @@
|
|
|
8788
8788
|
this.anchor[0].click();
|
|
8789
8789
|
}
|
|
8790
8790
|
});
|
|
8791
|
+
this.addEventListener("click", () => {
|
|
8792
|
+
this.anchor.length > 0 && this.anchor[0].click();
|
|
8793
|
+
});
|
|
8791
8794
|
this.setAttribute("role", "menuitem");
|
|
8792
8795
|
this.setAttribute("aria-disabled", `${this.disabled}`);
|
|
8793
8796
|
}
|