@govtechsg/sgds-web-component 3.1.0-rc.6 → 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/button.js +1 -1
- 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/Accordion/index.umd.js +7 -5
- package/components/Accordion/index.umd.js.map +1 -1
- package/components/Accordion/sgds-accordion-item.d.ts +0 -1
- package/components/Accordion/sgds-accordion-item.js +7 -5
- package/components/Accordion/sgds-accordion-item.js.map +1 -1
- package/components/Breadcrumb/index.umd.js +5 -2
- package/components/Breadcrumb/index.umd.js.map +1 -1
- package/components/Button/button.js +1 -1
- package/components/Button/index.umd.js +3 -6
- package/components/Button/index.umd.js.map +1 -1
- package/components/Button/sgds-button.js +1 -4
- package/components/Button/sgds-button.js.map +1 -1
- package/components/Checkbox/checkbox.js +1 -1
- package/components/Checkbox/index.umd.js +42 -34
- package/components/Checkbox/index.umd.js.map +1 -1
- package/components/Checkbox/sgds-checkbox-group.d.ts +6 -4
- package/components/Checkbox/sgds-checkbox-group.js +34 -17
- package/components/Checkbox/sgds-checkbox-group.js.map +1 -1
- package/components/Checkbox/sgds-checkbox.d.ts +2 -3
- package/components/Checkbox/sgds-checkbox.js +9 -21
- package/components/Checkbox/sgds-checkbox.js.map +1 -1
- package/components/ComboBox/combo-box.js +1 -1
- package/components/ComboBox/index.umd.js +492 -500
- 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 +4 -7
- package/components/Datepicker/index.umd.js.map +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/FileUpload/index.umd.js +3 -6
- package/components/FileUpload/index.umd.js.map +1 -1
- package/components/IconButton/index.umd.js +1 -1
- package/components/Mainnav/index.umd.js +13 -10
- package/components/Mainnav/index.umd.js.map +1 -1
- package/components/Mainnav/mainnav-dropdown.js +1 -1
- package/components/Mainnav/mainnav-item.js +1 -1
- package/components/Mainnav/mainnav.js +1 -1
- package/components/Pagination/index.umd.js +3 -6
- package/components/Pagination/index.umd.js.map +1 -1
- package/components/QuantityToggle/index.umd.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/Subnav/index.d.ts +8 -0
- package/components/Subnav/index.js +6 -0
- package/components/Subnav/index.js.map +1 -0
- package/components/Subnav/index.umd.js +6074 -0
- package/components/Subnav/index.umd.js.map +1 -0
- package/components/Subnav/sgds-subnav-item.d.ts +16 -0
- package/components/Subnav/sgds-subnav-item.js +68 -0
- package/components/Subnav/sgds-subnav-item.js.map +1 -0
- package/components/Subnav/sgds-subnav.d.ts +47 -0
- package/components/Subnav/sgds-subnav.js +253 -0
- package/components/Subnav/sgds-subnav.js.map +1 -0
- package/components/Subnav/subnav-item.js +6 -0
- package/components/Subnav/subnav-item.js.map +1 -0
- package/components/Subnav/subnav.js +6 -0
- package/components/Subnav/subnav.js.map +1 -0
- package/components/index.d.ts +2 -0
- package/components/index.js +2 -0
- package/components/index.js.map +1 -1
- package/components/index.umd.js +812 -355
- package/components/index.umd.js.map +1 -1
- package/css/grid.js +6 -0
- package/css/grid.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/index.umd.js +897 -376
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/base/button.cjs.js +1 -1
- package/react/base/button.js +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/checkbox/index.cjs.js +2 -1
- package/react/checkbox/index.cjs.js.map +1 -1
- package/react/checkbox/index.js +2 -1
- package/react/checkbox/index.js.map +1 -1
- package/react/checkbox-group/index.cjs.js +3 -1
- package/react/checkbox-group/index.cjs.js.map +1 -1
- package/react/checkbox-group/index.js +3 -1
- package/react/checkbox-group/index.js.map +1 -1
- package/react/components/Accordion/sgds-accordion-item.cjs.js +7 -5
- package/react/components/Accordion/sgds-accordion-item.cjs.js.map +1 -1
- package/react/components/Accordion/sgds-accordion-item.js +7 -5
- package/react/components/Accordion/sgds-accordion-item.js.map +1 -1
- package/react/components/Button/button.cjs.js +1 -1
- package/react/components/Button/button.js +1 -1
- package/react/components/Button/sgds-button.cjs.js +1 -4
- package/react/components/Button/sgds-button.cjs.js.map +1 -1
- package/react/components/Button/sgds-button.js +1 -4
- package/react/components/Button/sgds-button.js.map +1 -1
- 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 +33 -16
- package/react/components/Checkbox/sgds-checkbox-group.cjs.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox-group.js +34 -17
- package/react/components/Checkbox/sgds-checkbox-group.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.cjs.js +9 -21
- package/react/components/Checkbox/sgds-checkbox.cjs.js.map +1 -1
- package/react/components/Checkbox/sgds-checkbox.js +9 -21
- 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/Mainnav/mainnav-item.cjs.js +1 -1
- package/react/components/Mainnav/mainnav-item.js +1 -1
- package/react/components/Mainnav/mainnav.cjs.js +1 -1
- package/react/components/Mainnav/mainnav.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/components/Subnav/sgds-subnav-item.cjs.js +74 -0
- package/react/components/Subnav/sgds-subnav-item.cjs.js.map +1 -0
- package/react/components/Subnav/sgds-subnav-item.js +69 -0
- package/react/components/Subnav/sgds-subnav-item.js.map +1 -0
- package/react/components/Subnav/sgds-subnav.cjs.js +259 -0
- package/react/components/Subnav/sgds-subnav.cjs.js.map +1 -0
- package/react/components/Subnav/sgds-subnav.js +254 -0
- package/react/components/Subnav/sgds-subnav.js.map +1 -0
- package/react/components/Subnav/subnav-item.cjs.js +11 -0
- package/react/components/Subnav/subnav-item.cjs.js.map +1 -0
- package/react/components/Subnav/subnav-item.js +7 -0
- package/react/components/Subnav/subnav-item.js.map +1 -0
- package/react/components/Subnav/subnav.cjs.js +11 -0
- package/react/components/Subnav/subnav.cjs.js.map +1 -0
- package/react/components/Subnav/subnav.js +7 -0
- package/react/components/Subnav/subnav.js.map +1 -0
- package/react/css/grid.cjs.js +11 -0
- package/react/css/grid.cjs.js.map +1 -0
- package/react/css/grid.js +7 -0
- package/react/css/grid.js.map +1 -0
- package/react/index.cjs.js +38 -32
- package/react/index.cjs.js.map +1 -1
- package/react/index.d.ts +3 -0
- package/react/index.js +3 -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
- package/react/subnav/index.cjs.js +45 -0
- package/react/subnav/index.cjs.js.map +1 -0
- package/react/subnav/index.d.ts +2 -0
- package/react/subnav/index.js +21 -0
- package/react/subnav/index.js.map +1 -0
- package/react/subnav-item/index.cjs.js +40 -0
- package/react/subnav-item/index.cjs.js.map +1 -0
- package/react/subnav-item/index.d.ts +2 -0
- package/react/subnav-item/index.js +16 -0
- package/react/subnav-item/index.js.map +1 -0
- package/react/utils/breakpoints.cjs.js +4 -4
- package/react/utils/breakpoints.cjs.js.map +1 -1
- package/react/utils/breakpoints.js +4 -4
- package/react/utils/breakpoints.js.map +1 -1
- package/utils/breakpoints.d.ts +4 -4
- package/utils/breakpoints.js +4 -4
- package/utils/breakpoints.js.map +1 -1
package/base/button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
|
|
3
|
-
var css_248z = css`:host{--btn-font-weight:var(--sgds-font-weight-regular);--btn-bg:var(--sgds-primary-surface-default);--btn-hover-bg:var(--sgds-primary-surface-emphasis);--btn-border-radius:var(--sgds-border-radius-md)}:host([variant=primary]){--btn-bg:var(--sgds-primary-surface-default);--btn-color:var(--sgds-color-fixed-light)}:host([variant=outline]){--btn-bg:var(--sgds-bg-transparent);--btn-hover-bg:var(--sgds-primary-surface-translucent);--btn-color:var(--sgds-primary-color-default);--btn-border-width:var(--sgds-border-width-1);--btn-border-color:var(--sgds-primary-border-color-default)}:host([variant=ghost]){--btn-bg:var(--sgds-bg-transparent);--btn-hover-bg:var(--sgds-primary-surface-translucent);--btn-color:var(--sgds-primary-color-default)}:host([variant=danger]){--btn-bg:var(--sgds-danger-surface-default);--btn-hover-bg:var(--sgds-danger-surface-emphasis);--btn-color:var(--sgds-color-fixed-light)}.btn{align-items:center;background-color:var(--btn-bg);border:1px solid var(--sgds-border-color-transparent);border-radius:var(--btn-border-radius);color:var(--sgds-color-fixed-light);cursor:pointer;display:inline-flex;font-size:var(--sgds-font-size-2);font-weight:var(--btn-font-weight);gap:var(--sgds-gap-2-xs);height:var(--sgds-dimension-48);justify-content:center;line-height:var(--sgds-line-height-body);min-width:var(--sgds-dimension-96);padding:0 var(--sgds-padding-lg);text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;user-select:none;vertical-align:middle}
|
|
3
|
+
var css_248z = css`:host{--btn-font-weight:var(--sgds-font-weight-regular);--btn-bg:var(--sgds-primary-surface-default);--btn-hover-bg:var(--sgds-primary-surface-emphasis);--btn-border-radius:var(--sgds-border-radius-md)}:host([variant=primary]){--btn-bg:var(--sgds-primary-surface-default);--btn-color:var(--sgds-color-fixed-light)}:host([variant=outline]){--btn-bg:var(--sgds-bg-transparent);--btn-hover-bg:var(--sgds-primary-surface-translucent);--btn-color:var(--sgds-primary-color-default);--btn-border-width:var(--sgds-border-width-1);--btn-border-color:var(--sgds-primary-border-color-default)}:host([variant=ghost]){--btn-bg:var(--sgds-bg-transparent);--btn-hover-bg:var(--sgds-primary-surface-translucent);--btn-color:var(--sgds-primary-color-default)}:host([variant=danger]){--btn-bg:var(--sgds-danger-surface-default);--btn-hover-bg:var(--sgds-danger-surface-emphasis);--btn-color:var(--sgds-color-fixed-light)}:host([variant=ghost]) .btn,:host([variant=outline]) .btn,:host([variant=primary]) .btn{color:var(--btn-color)}:host([variant=outline]) .btn{border:var(--btn-border-width) solid var(--btn-border-color)}:host([size=lg]) .btn{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-56);min-width:var(--sgds-dimension-112);padding:0 var(--sgds-padding-xl)}:host([size=sm]) .btn{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-40);min-width:var(--sgds-dimension-80);padding:0 var(--sgds-padding-md)}.btn{align-items:center;background-color:var(--btn-bg);border:1px solid var(--sgds-border-color-transparent);border-radius:var(--btn-border-radius);color:var(--sgds-color-fixed-light);cursor:pointer;display:inline-flex;font-size:var(--sgds-font-size-2);font-weight:var(--btn-font-weight);gap:var(--sgds-gap-2-xs);height:var(--sgds-dimension-48);justify-content:center;line-height:var(--sgds-line-height-body);min-width:var(--sgds-dimension-96);padding:0 var(--sgds-padding-lg);text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;user-select:none;vertical-align:middle}@media (prefers-reduced-motion:reduce){.btn{transition:none}}.btn.active,.btn:hover{background-color:var(--btn-hover-bg)}.btn:focus,.btn:focus-visible{background-color:var(--btn-hover-bg);border-color:transparent;box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn.disabled,.btn:disabled{color:var(--btn-color);cursor:not-allowed;opacity:var(--sgds-opacity-50)}.btn slot::slotted(*){color:var(--btn-color)}`;
|
|
4
4
|
|
|
5
5
|
export { css_248z as default };
|
|
6
6
|
//# sourceMappingURL=button.js.map
|
|
@@ -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,CA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EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAsB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGpB,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAiB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,SAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAQjC,UAAA,CAAA;AAA1B,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAAqC,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGrD,UAAA,CAAA;AADT,IAAA,KAAK,EAAE;AAC2C,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;;;;"}
|
|
@@ -4688,10 +4688,6 @@
|
|
|
4688
4688
|
/** Disables the accordion item */
|
|
4689
4689
|
this.disabled = false;
|
|
4690
4690
|
}
|
|
4691
|
-
firstUpdated() {
|
|
4692
|
-
if (!this.open)
|
|
4693
|
-
this.body.classList.add("hidden");
|
|
4694
|
-
}
|
|
4695
4691
|
handleSummaryClick() {
|
|
4696
4692
|
if (this.open) {
|
|
4697
4693
|
this.hide();
|
|
@@ -4770,6 +4766,7 @@
|
|
|
4770
4766
|
return waitForEvent(this, "sgds-after-hide");
|
|
4771
4767
|
}
|
|
4772
4768
|
render() {
|
|
4769
|
+
const isHydrated = this.hasUpdated;
|
|
4773
4770
|
return html `
|
|
4774
4771
|
<div class="accordion-item">
|
|
4775
4772
|
<button
|
|
@@ -4792,7 +4789,12 @@
|
|
|
4792
4789
|
<sgds-icon name="chevron-down" size=${this.getAttribute("density") === "compact" ? "md" : "lg"}></sgds-icon>
|
|
4793
4790
|
</slot>
|
|
4794
4791
|
</button>
|
|
4795
|
-
<div
|
|
4792
|
+
<div
|
|
4793
|
+
class=${classMap({
|
|
4794
|
+
"accordion-body": true,
|
|
4795
|
+
hidden: !this.open && !isHydrated
|
|
4796
|
+
})}
|
|
4797
|
+
>
|
|
4796
4798
|
<slot id="content" name="content" class="content" role="region" aria-labelledby="header"></slot>
|
|
4797
4799
|
</div>
|
|
4798
4800
|
</div>
|