@govtechsg/sgds-web-component 1.0.0-rc.1 → 1.0.0-rc.3
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/README.md +82 -16
- package/base/card-element.d.ts +1 -1
- package/base/datepicker-dropdown-element.d.ts +38 -0
- package/base/sgds-element.d.ts +2 -0
- package/components/ActionCard/sgds-action-card.d.ts +7 -2
- package/components/Badge/sgds-badge.d.ts +2 -0
- package/components/Button/sgds-button.d.ts +1 -2
- package/components/Datepicker/datepicker-calendar.d.ts +41 -0
- package/components/Datepicker/datepicker-header.d.ts +19 -0
- package/components/Datepicker/index.d.ts +1 -0
- package/components/Datepicker/sgds-datepicker.d.ts +73 -0
- package/components/Drawer/index.d.ts +1 -0
- package/components/Drawer/sgds-drawer.d.ts +86 -0
- package/components/Dropdown/sgds-dropdown.d.ts +6 -1
- package/components/FileUpload/sgds-file-upload.d.ts +6 -1
- package/components/Footer/sgds-footer.d.ts +4 -4
- package/components/Mainnav/index.d.ts +1 -1
- package/components/Mainnav/sgds-mainnav-dropdown.d.ts +4 -0
- package/components/QuantityToggle/sgds-quantity-toggle.d.ts +1 -1
- package/components/Radio/sgds-radio-group.d.ts +0 -5
- package/components/Radio/sgds-radio.d.ts +0 -5
- package/components/Spinner/sgds-spinner.d.ts +2 -2
- package/components/Stepper/index.d.ts +1 -1
- package/components/Stepper/sgds-stepper.d.ts +12 -7
- package/components/Tab/index.d.ts +2 -2
- package/components/Tab/sgds-tab-group.d.ts +61 -0
- package/components/Tab/{sgds-tabpanel.d.ts → sgds-tab-panel.d.ts} +7 -9
- package/components/Tab/sgds-tab.d.ts +19 -7
- package/components/Table/sgds-table.d.ts +3 -3
- package/components/Toast/sgds-toast-container.d.ts +1 -1
- package/components/Toast/sgds-toast.d.ts +1 -1
- package/components/Tooltip/sgds-tooltip.d.ts +3 -2
- package/components-a12105b5.js +13363 -0
- package/components-a12105b5.js.map +1 -0
- package/components.d.ts +28 -0
- package/components.js +2 -0
- package/components.js.map +1 -0
- package/index.d.ts +41 -25
- package/index.js +6 -12292
- package/index.js.map +1 -1
- package/package.json +4 -2
- package/react/cjs/index.js +5223 -4821
- package/react/cjs/index.js.map +1 -1
- package/react/datepicker/index.d.ts +9 -0
- package/react/drawer/index.d.ts +10 -0
- package/react/index.d.ts +3 -2
- package/react/index.js +5777 -5376
- package/react/index.js.map +1 -1
- package/react/tab-group/index.d.ts +5 -2
- package/react/tab-panel/index.d.ts +1 -1
- package/utils/animate.d.ts +1 -1
- package/utils/animation-registry.d.ts +2 -2
- package/utils/breakpoints.d.ts +2 -2
- package/utils/form.d.ts +17 -17
- package/utils/scroll.d.ts +4 -4
- package/utils/test.d.ts +28 -0
- package/components/CloseButton/index.d.ts +0 -1
- package/components/CloseButton/sgds-closebutton.d.ts +0 -9
- package/components/Tab/sgds-tabgroup.d.ts +0 -48
- package/main.d.ts +0 -25
- package/react/closebutton/index.d.ts +0 -5
- package/umd/index.js +0 -12676
- package/umd/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ You can load SGDS's web components via CDN or by installing it locally.
|
|
|
13
13
|
|
|
14
14
|
## CDN
|
|
15
15
|
|
|
16
|
-
The CDN loader registers all SGDS elements up front. Note that, if you're only using a handful of components.
|
|
16
|
+
The CDN loader registers all SGDS elements up front. Note that, if you're only using a handful of components.
|
|
17
17
|
|
|
18
18
|
```js
|
|
19
19
|
|
|
20
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component"></script>
|
|
20
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@govtechsg/sgds-web-component@rc"></script>
|
|
21
21
|
|
|
22
22
|
```
|
|
23
23
|
|
|
@@ -27,7 +27,7 @@ You can also install SGDS web components locally with the following command
|
|
|
27
27
|
|
|
28
28
|
```js
|
|
29
29
|
|
|
30
|
-
npm install @govtechsg/sgds-web-component
|
|
30
|
+
npm install @govtechsg/sgds-web-component@rc
|
|
31
31
|
|
|
32
32
|
```
|
|
33
33
|
|
|
@@ -42,24 +42,77 @@ import "@govtechsg/sgds-web-component";
|
|
|
42
42
|
|
|
43
43
|
# Imports
|
|
44
44
|
|
|
45
|
-
## Using the custom elements
|
|
46
|
-
Once imported, the custom elements can be used throughout the project.
|
|
45
|
+
## Using the custom elements
|
|
47
46
|
|
|
48
|
-
|
|
47
|
+
Once imported, the custom elements can be used throughout the project.
|
|
49
48
|
|
|
50
|
-
|
|
49
|
+
```js
|
|
50
|
+
import "@govtechsg/sgds-web-component";
|
|
51
51
|
|
|
52
|
+
//usage
|
|
53
|
+
// <sgds-button>Hello World</sgds-button>
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
## Using the component's class
|
|
56
|
+
## Using the component's class object
|
|
55
57
|
|
|
56
|
-
|
|
58
|
+
When writing with Typescript, you might be required to type the components in certain cases. Import the component class like so.
|
|
59
|
+
Each component's Class is exported via named exports, prefixed with `Sgds`.
|
|
57
60
|
|
|
58
61
|
```js
|
|
59
62
|
|
|
60
|
-
import { SgdsButton, SgdsMainnav } from "@govtechsg/sgds-web-component"
|
|
63
|
+
import { SgdsButton, SgdsMainnav } from "@govtechsg/sgds-web-component/components";
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Scoped Elements
|
|
68
|
+
|
|
69
|
+
The CustomElementRegistry is a global registry that provides methods for registering custom elements. One of the limitations of working with this global registry is that multiple versions of the same element cannot co-exist. This causes bottlenecks in software delivery that should be managed by the teams and complex build systems. Scoped Custom Element Registries is a proposal that will solve the problem. Since this functionality won't be available (especially not cross browser) anytime soon, we've adopted [OpenWC's Scoped Elements](https://open-wc.org/docs/development/scoped-elements/).
|
|
70
|
+
|
|
71
|
+
Whenever a sgds component uses composition (meaning it uses another sgds component inside), we apply ScopedElementsMixin to make sure it uses the right version of this internal component.
|
|
72
|
+
|
|
73
|
+
For users who are using sgds component directly for builing application, use the custom elements directly by [importing the custom elements](#using-the-custom-elements)
|
|
61
74
|
|
|
75
|
+
For users who are building component libraries on top of sgds-web-component, please adopt OpenWC's scoped elements to prevent exporting our registered custom elements.
|
|
76
|
+
|
|
77
|
+
Things to note:
|
|
78
|
+
1. Import component class from `@govtechsg/sgds-web-component/components`. Here the components are not registered in the custom element registry
|
|
79
|
+
2. Define the tagName you want to assign to the component's class
|
|
80
|
+
|
|
81
|
+
Example below
|
|
82
|
+
|
|
83
|
+
```jsx
|
|
84
|
+
import { SgdsMasthead, SgdsMainnav, SgdsMainnavDropdown, SgdsMainnavItem } from "@govtechsg/sgds-web-component/components";
|
|
85
|
+
import { ScopedElementsMixin } from "@open-wc/scoped-elements";
|
|
86
|
+
|
|
87
|
+
// Lit element
|
|
88
|
+
@customElement('my-navbar')
|
|
89
|
+
export class MyNavbar extends ScopedElementsMixin(LitElement) {
|
|
90
|
+
static get scopedElements() {
|
|
91
|
+
return {
|
|
92
|
+
'sgds-mainnav': SgdsMainnav,
|
|
93
|
+
'sgds-mainnav-dropdown': SgdsMainnavDropdown,
|
|
94
|
+
'sgds-mainnav-item': SgdsMainnavItem,
|
|
95
|
+
'sgds-masthead': SgdsMasthead
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
...
|
|
99
|
+
|
|
100
|
+
render() {
|
|
101
|
+
return html`
|
|
102
|
+
<sgds-masthead fluid="false"></sgds-masthead>
|
|
103
|
+
<sgds-mainnav>
|
|
104
|
+
<img width="240" src="https://dev.assets.developer.tech.gov.sg/svg/logo.svg" slot="brand">
|
|
105
|
+
<sgds-mainnav-dropdown togglertext="Home" slot="end">
|
|
106
|
+
<sgds-dropdown-item>Logout</sgds-dropdown-item>
|
|
107
|
+
</sgds-mainnav-dropdown>
|
|
108
|
+
<sgds-mainnav-item href="#">Content</sgds-mainnav-item>
|
|
109
|
+
<sgds-mainnav-item href="#}">Biography</sgds-mainnav-item>
|
|
110
|
+
</sgds-mainnav>
|
|
111
|
+
`
|
|
112
|
+
}
|
|
113
|
+
}
|
|
62
114
|
```
|
|
115
|
+
|
|
63
116
|
# Attributes and Properties
|
|
64
117
|
|
|
65
118
|
## String
|
|
@@ -157,18 +210,31 @@ There are two kinds of slots: default and named slots. In the storybook document
|
|
|
157
210
|
|
|
158
211
|
The following css custom variable are exposed to enable users to make modifications across all web components in our library
|
|
159
212
|
|
|
160
|
-
| css custom variable name
|
|
161
|
-
| ------------------------
|
|
162
|
-
| --sgds-body-font-family
|
|
163
|
-
| --sgds-body-font-size
|
|
164
|
-
| --sgds-body-font-weight
|
|
165
|
-
| --sgds-body-line-height
|
|
213
|
+
| css custom variable name | description |
|
|
214
|
+
| ------------------------ | ----------------------------------------- |
|
|
215
|
+
| --sgds-body-font-family | Set the font family of the web components |
|
|
216
|
+
| --sgds-body-font-size | Set the font size of the web components |
|
|
217
|
+
| --sgds-body-font-weight | Set the font weight of the web components |
|
|
218
|
+
| --sgds-body-line-height | Set the line height of the web components |
|
|
219
|
+
| --sgds-{stateColor}-rgb | State colors in red,green,blue value |
|
|
220
|
+
| --sgds-{stateColor} | State colors in hexadecimal value |
|
|
221
|
+
| --sgds-{stateColor} | State colors in hexadecimal value |
|
|
222
|
+
| --sgds-{stateColor}-{weight} | State colors with different weightage in hexadecimal value |
|
|
223
|
+
| --sgds-gray-{weight} | Gray colors with different weightage in hexadecimal value |
|
|
224
|
+
|
|
225
|
+
> `{stateColor}` consists of `primary`,`secondary`,`success`,`warning`,`danger`,`info`,`light`,`dark`
|
|
226
|
+
>
|
|
227
|
+
> `{weight}` are color weightage in hundreds starting from `100` up to `900`
|
|
166
228
|
|
|
167
229
|
```css
|
|
168
230
|
|
|
169
231
|
:root {
|
|
170
232
|
--sgds-body-font-family: Helvetica;
|
|
171
233
|
--sgds-body-font-size: 5rem;
|
|
234
|
+
--sgds-primary-rgb : 89,37,220;
|
|
235
|
+
--sgds-secondary : #1f69ff;
|
|
236
|
+
--sgds-success-500 : #3bb346;
|
|
237
|
+
--sgds-gray-500 : #667085;
|
|
172
238
|
}
|
|
173
239
|
|
|
174
240
|
```
|
package/base/card-element.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import SgdsElement from "./sgds-element";
|
|
2
2
|
export type CardBorderVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "dark" | "light";
|
|
3
|
-
export type CardTextVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "dark" | "light" | "white" | "muted";
|
|
4
3
|
export declare class CardElement extends SgdsElement {
|
|
5
4
|
static styles: import("lit").CSSResultGroup;
|
|
6
5
|
/** The border's variant. */
|
|
@@ -10,3 +9,4 @@ export declare class CardElement extends SgdsElement {
|
|
|
10
9
|
/** The text's variant. */
|
|
11
10
|
textColor: CardTextVariant;
|
|
12
11
|
}
|
|
12
|
+
export type CardTextVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "dark" | "light" | "white" | "muted";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { StrictModifiers } from "@popperjs/core";
|
|
2
|
+
import * as Popper from "@popperjs/core";
|
|
3
|
+
import { Dropdown } from "bootstrap";
|
|
4
|
+
import { Ref } from "lit/directives/ref.js";
|
|
5
|
+
import SgdsElement from "./sgds-element";
|
|
6
|
+
/**
|
|
7
|
+
* @event sgds-show - Emitted event when show instance is called
|
|
8
|
+
* @event sgds-after-show - Emitted event when datepicker calendar has been made visible to the user and CSS transitions have completed
|
|
9
|
+
* @event sgds-hide - Emitted event when hide instance is called
|
|
10
|
+
* @event sgds-after-hide - Emitted event when datepicker calendar has hidden to the user and CSS transitions have completed
|
|
11
|
+
*/
|
|
12
|
+
export declare class DatepickerDropdownElement extends SgdsElement {
|
|
13
|
+
/** @internal */
|
|
14
|
+
myDropdown: Ref<HTMLElement>;
|
|
15
|
+
/** @internal */
|
|
16
|
+
bsDropdown: Dropdown;
|
|
17
|
+
/** When true, adds no flip even when placement does not fit */
|
|
18
|
+
protected noFlip: boolean;
|
|
19
|
+
/** When true, aligns right edge of menu with right edge of button */
|
|
20
|
+
protected menuAlignRight: boolean;
|
|
21
|
+
/**@internal */
|
|
22
|
+
menuIsOpen: boolean;
|
|
23
|
+
/** Disables the dropdown toggle */
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
/** @internal */
|
|
26
|
+
dropdownConfig: Partial<Popper.Options>;
|
|
27
|
+
/** @internal */
|
|
28
|
+
modifierOpt: StrictModifiers[];
|
|
29
|
+
firstUpdated(): void;
|
|
30
|
+
/** When invoked, opens the Datepicker menu */
|
|
31
|
+
showMenu(): void;
|
|
32
|
+
/** When invoked, hides the Datepicker menu */
|
|
33
|
+
hideMenu(): void;
|
|
34
|
+
_onClickInput(): void;
|
|
35
|
+
_handleKeyboardEvent(e: KeyboardEvent): void;
|
|
36
|
+
_handleClickOutOfElement(e: MouseEvent, self: DatepickerDropdownElement): void;
|
|
37
|
+
}
|
|
38
|
+
export type DropDirection = "left" | "right" | "up" | "down";
|
package/base/sgds-element.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { LitElement } from "lit";
|
|
|
4
4
|
* @cssprop --sgds-{stateColor}-rgb - State colors in rgb value
|
|
5
5
|
* @cssprop --sgds-{stateColor}-{weights} - State colors with different weightage in hexadecimal value
|
|
6
6
|
* @cssprop --sgds-gray-{weights} - State colors with different weightage in hexadecimal value
|
|
7
|
+
* @cssprop --overlay-background-color - The drawer and modal component overlay background color
|
|
8
|
+
* @cssprop --zindex-modal - The drawer and modal component z-index value
|
|
7
9
|
*/
|
|
8
10
|
export default class SgdsElement extends LitElement {
|
|
9
11
|
static styles: import("lit").CSSResultGroup;
|
|
@@ -2,7 +2,7 @@ import { Ref } from "lit/directives/ref.js";
|
|
|
2
2
|
import { CardElement } from "../../base/card-element";
|
|
3
3
|
import { SgdsCheckbox } from "../Checkbox";
|
|
4
4
|
import { SgdsRadio } from "../Radio";
|
|
5
|
-
|
|
5
|
+
declare const SgdsActionCard_base: typeof CardElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
6
6
|
/**
|
|
7
7
|
* @summary Action Card are cards with built in checkbox or radio components. The ref of input is extended to the Card's body.
|
|
8
8
|
* @slot icon - Icon content in the card-subtitile
|
|
@@ -19,8 +19,12 @@ export type TypeVariant = "checkbox" | "radio";
|
|
|
19
19
|
* @csspart text - The action card text
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
export declare class SgdsActionCard extends
|
|
22
|
+
export declare class SgdsActionCard extends SgdsActionCard_base {
|
|
23
23
|
static styles: import("lit").CSSResultGroup[];
|
|
24
|
+
static get scopedElements(): {
|
|
25
|
+
"sgds-checkbox": typeof SgdsCheckbox;
|
|
26
|
+
"sgds-radio": typeof SgdsRadio;
|
|
27
|
+
};
|
|
24
28
|
/** @internal */
|
|
25
29
|
inputRef: Ref<SgdsCheckbox | SgdsRadio>;
|
|
26
30
|
/** Name of the HTML form control. Submitted with the form as part of a name/value pair. */
|
|
@@ -46,4 +50,5 @@ export declare class SgdsActionCard extends CardElement {
|
|
|
46
50
|
handleKeyDown(event: KeyboardEvent): void;
|
|
47
51
|
render(): import("lit").TemplateResult;
|
|
48
52
|
}
|
|
53
|
+
export type TypeVariant = "checkbox" | "radio";
|
|
49
54
|
export default SgdsActionCard;
|
|
@@ -12,6 +12,8 @@ export declare class SgdsBadge extends SgdsElement {
|
|
|
12
12
|
isLight: boolean;
|
|
13
13
|
/** Visually set badge with rounded corners. */
|
|
14
14
|
roundedPill: boolean;
|
|
15
|
+
/** Forwarded to the base wrapper of sgds-badge. Can be used to insert any utility classes such as `me-auto` or `text-dark` */
|
|
16
|
+
badgeClasses: string;
|
|
15
17
|
render(): import("lit").TemplateResult<1>;
|
|
16
18
|
}
|
|
17
19
|
export default SgdsBadge;
|
|
@@ -10,8 +10,7 @@ export type ButtonVariant = "primary" | "secondary" | "success" | "danger" | "wa
|
|
|
10
10
|
*/
|
|
11
11
|
export declare class SgdsButton extends SgdsElement {
|
|
12
12
|
static styles: import("lit").CSSResultGroup[];
|
|
13
|
-
|
|
14
|
-
button: HTMLButtonElement | HTMLLinkElement;
|
|
13
|
+
private button;
|
|
15
14
|
/** @internal */
|
|
16
15
|
private readonly formSubmitController;
|
|
17
16
|
/** One or more button variant combinations buttons may be one of a variety of visual variants such as: `primary`, `secondary`, `success`, `danger`, `warning`, `info`, `dark`, `light`, `link` as well as "outline" versions (prefixed by `outline-*`) */
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import SgdsElement from "../../base/sgds-element";
|
|
2
|
+
export declare class DatepickerCalendar extends SgdsElement {
|
|
3
|
+
static styles: import("lit").CSSResultGroup[];
|
|
4
|
+
/** @internal */
|
|
5
|
+
static DAY_LABELS: string[];
|
|
6
|
+
/** @internal */
|
|
7
|
+
static daysInMonth: number[];
|
|
8
|
+
/** @internal */
|
|
9
|
+
static MONTHVIEW_LABELS: string[];
|
|
10
|
+
/** @internal */
|
|
11
|
+
selectedDate: Date[];
|
|
12
|
+
/** @internal */
|
|
13
|
+
displayDate: Date;
|
|
14
|
+
/** @internal */
|
|
15
|
+
minDate?: string;
|
|
16
|
+
/** @internal */
|
|
17
|
+
maxDate?: string;
|
|
18
|
+
/** @internal */
|
|
19
|
+
mode: "single" | "range";
|
|
20
|
+
/** @internal */
|
|
21
|
+
initialValue?: Date;
|
|
22
|
+
/** @internal */
|
|
23
|
+
year: number;
|
|
24
|
+
/** @internal */
|
|
25
|
+
month: number;
|
|
26
|
+
/** @internal */
|
|
27
|
+
view: string;
|
|
28
|
+
connectedCallback(): void;
|
|
29
|
+
/** @internal */
|
|
30
|
+
private setTimeToNoon;
|
|
31
|
+
/** @internal */
|
|
32
|
+
private generateIncrementDays;
|
|
33
|
+
/** @internal */
|
|
34
|
+
private onClickDay;
|
|
35
|
+
/** @internal */
|
|
36
|
+
private onClickMonth;
|
|
37
|
+
/** @internal */
|
|
38
|
+
private onClickYear;
|
|
39
|
+
render(): import("lit").TemplateResult<1>;
|
|
40
|
+
}
|
|
41
|
+
export default DatepickerCalendar;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import SgdsElement from "../../base/sgds-element";
|
|
2
|
+
export declare class DatepickerHeader extends SgdsElement {
|
|
3
|
+
static styles: import("lit").CSSResultGroup[];
|
|
4
|
+
/** @internal */
|
|
5
|
+
displayDate: Date;
|
|
6
|
+
/** @internal */
|
|
7
|
+
view: string;
|
|
8
|
+
connectedCallback(): void;
|
|
9
|
+
/** @internal */
|
|
10
|
+
private changeView;
|
|
11
|
+
/** @internal */
|
|
12
|
+
private renderHeader;
|
|
13
|
+
/** @internal */
|
|
14
|
+
private handleClickPrevious;
|
|
15
|
+
/** @internal */
|
|
16
|
+
private handleClickNext;
|
|
17
|
+
render(): import("lit").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
export default DatepickerHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./sgds-datepicker";
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { DatepickerDropdownElement } from "../../base/datepicker-dropdown-element";
|
|
2
|
+
import { SgdsInput } from "../Input";
|
|
3
|
+
import { DatepickerCalendar } from "./datepicker-calendar";
|
|
4
|
+
import { DatepickerHeader } from "./datepicker-header";
|
|
5
|
+
export type DateFormat = "MM/DD/YYYY" | "DD/MM/YYYY" | "YYYY/MM/DD";
|
|
6
|
+
declare const SgdsDatepicker_base: typeof DatepickerDropdownElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
7
|
+
/**
|
|
8
|
+
* @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to current date and input has no value. The input is a read-only and users can only pick dates using the Calendar.
|
|
9
|
+
*
|
|
10
|
+
* @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value
|
|
11
|
+
*
|
|
12
|
+
* @cssproperty --datepicker-theme-color - Datepicker's overall theme color
|
|
13
|
+
* @cssproperty --datepicker-hover-bg-color - Datepicker's calendar menu hover color
|
|
14
|
+
* @cssproperty --datepicker-bg-color - Datepicker's menu background color
|
|
15
|
+
* @cssproperty --datepicker-closebutton-bg-color - Datepicker's close button background color
|
|
16
|
+
* @cssproperty --datepicker-closebutton-hover-bg-color - Datepicker's close button hover background color
|
|
17
|
+
* @cssproperty --datepicker-closebutton-color - Datepicker's close button color
|
|
18
|
+
*/
|
|
19
|
+
export declare class SgdsDatepicker extends SgdsDatepicker_base {
|
|
20
|
+
static styles: import("lit").CSSResultGroup[];
|
|
21
|
+
/**@internal */
|
|
22
|
+
static get scopedElements(): {
|
|
23
|
+
"sgds-input": typeof SgdsInput;
|
|
24
|
+
"sgds-datepicker-calendar": typeof DatepickerCalendar;
|
|
25
|
+
"sgds-datepicker-header": typeof DatepickerHeader;
|
|
26
|
+
};
|
|
27
|
+
/** When true, adds required attribute to input element */
|
|
28
|
+
required: boolean;
|
|
29
|
+
/** When true, adds disabled attribute to input and button element */
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
/** The initial value of DatePicker on first load for single & range mode as array of string. eg.'["22/12/2023"]' for single & '["22/12/2023","25/12/2023"]' for range respectively */
|
|
32
|
+
initialValue: string[];
|
|
33
|
+
/** Date format reflected on input */
|
|
34
|
+
dateFormat: DateFormat;
|
|
35
|
+
/** ISO date string to set the lowest allowable date value. e.g. "2016-05-19T12:00:00.000Z" */
|
|
36
|
+
minDate: string;
|
|
37
|
+
/** ISO date string to set the highest allowable date value. e.g. "2016-05-19T12:00:00.000Z" */
|
|
38
|
+
maxDate: string;
|
|
39
|
+
/** Changes DatePicker to single date selection or range date selection */
|
|
40
|
+
mode: "single" | "range";
|
|
41
|
+
/** @internal */
|
|
42
|
+
private value;
|
|
43
|
+
/** @internal */
|
|
44
|
+
private view;
|
|
45
|
+
/** @internal */
|
|
46
|
+
private selectedDateRange;
|
|
47
|
+
/** @internal */
|
|
48
|
+
private displayDate;
|
|
49
|
+
constructor();
|
|
50
|
+
/** @internal */
|
|
51
|
+
private parseDateStringToDate;
|
|
52
|
+
/** @internal */
|
|
53
|
+
private getDateFormatRegex;
|
|
54
|
+
connectedCallback(): void;
|
|
55
|
+
disconnectedCallback(): void;
|
|
56
|
+
handleValueChange(): void;
|
|
57
|
+
/** @internal */
|
|
58
|
+
private makeInputValueString;
|
|
59
|
+
/** @internal */
|
|
60
|
+
private handleSelectDates;
|
|
61
|
+
/** @internal */
|
|
62
|
+
private handleViewChanged;
|
|
63
|
+
/** @internal */
|
|
64
|
+
private handleDateChanged;
|
|
65
|
+
/** @internal */
|
|
66
|
+
private handleSelectMonth;
|
|
67
|
+
/** @internal */
|
|
68
|
+
private handleSelectYear;
|
|
69
|
+
/** @internal */
|
|
70
|
+
private handleButtonResetClick;
|
|
71
|
+
render(): import("lit").TemplateResult<1>;
|
|
72
|
+
}
|
|
73
|
+
export default SgdsDatepicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./sgds-drawer";
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import SgdsElement from "../../base/sgds-element";
|
|
2
|
+
/**
|
|
3
|
+
* @summary Drawers slide in from a container to expose additional options and information.
|
|
4
|
+
*
|
|
5
|
+
* @slot - The drawer's main content.
|
|
6
|
+
* @slot label - The drawer's label. Alternatively, you can use the `label` attribute.
|
|
7
|
+
* @slot header-actions - Optional actions to add to the header.
|
|
8
|
+
* @slot footer - The drawer's footer, usually one or more buttons representing various options.
|
|
9
|
+
*
|
|
10
|
+
* @event sgds-show - Emitted when the drawer opens.
|
|
11
|
+
* @event sgds-after-show - Emitted after the drawer opens and all animations are complete.
|
|
12
|
+
* @event sgds-hide - Emitted when the drawer closes.
|
|
13
|
+
* @event sgds-after-hide - Emitted after the drawer closes and all animations are complete.
|
|
14
|
+
* @event sgds-initial-focus - Emitted when the drawer opens and is ready to receive focus. Calling
|
|
15
|
+
* `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.
|
|
16
|
+
* @event {{ source: 'close-button' | 'keyboard' | 'overlay' }} sgds-request-close - Emitted when the user attempts to
|
|
17
|
+
* close the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling
|
|
18
|
+
* `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in
|
|
19
|
+
* destructive behavior such as data loss.
|
|
20
|
+
*
|
|
21
|
+
* @csspart base - The component's base wrapper.
|
|
22
|
+
* @csspart overlay - The overlay that covers the screen behind the drawer.
|
|
23
|
+
* @csspart panel - The drawer's panel (where the drawer and its content are rendered).
|
|
24
|
+
* @csspart header - The drawer's header. This element wraps the title and header actions.
|
|
25
|
+
* @csspart header-actions - Optional actions to add to the header.
|
|
26
|
+
* @csspart title - The drawer's title.
|
|
27
|
+
* @csspart close-button - The close button.
|
|
28
|
+
* @csspart body - The drawer's body.
|
|
29
|
+
* @csspart footer - The drawer's footer.
|
|
30
|
+
*
|
|
31
|
+
* @cssproperty --sgds-drawer-size - The preferred size of the drawer. This will be applied to the drawer's width or height
|
|
32
|
+
* depending on its `placement`. Note that the drawer will shrink to accommodate smaller screens.
|
|
33
|
+
* @cssproperty --sgds-drawer-padding - The amount of padding to use for the header.
|
|
34
|
+
* @cssproperty --sgds-drawer-background-color - The drawer's background color.
|
|
35
|
+
* @cssproperty --sgds-drawer-button-gap - The drawer's flex gap between buttons.
|
|
36
|
+
*/
|
|
37
|
+
export declare class SgdsDrawer extends SgdsElement {
|
|
38
|
+
static styles: import("lit").CSSResultGroup[];
|
|
39
|
+
/** @internal */
|
|
40
|
+
private readonly hasSlotController;
|
|
41
|
+
/** @internal */
|
|
42
|
+
private originalTrigger;
|
|
43
|
+
/** @internal */
|
|
44
|
+
drawer: HTMLElement;
|
|
45
|
+
/** @internal */
|
|
46
|
+
panel: HTMLElement;
|
|
47
|
+
/** @internal */
|
|
48
|
+
overlay: HTMLElement;
|
|
49
|
+
/**
|
|
50
|
+
* Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can
|
|
51
|
+
* use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.
|
|
52
|
+
*/
|
|
53
|
+
open: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The drawer's label as displayed in the header. You should always include a relevant label even when using
|
|
56
|
+
* `noHeader`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.
|
|
57
|
+
*/
|
|
58
|
+
label: string;
|
|
59
|
+
/** The direction from which the drawer will open. */
|
|
60
|
+
placement: "top" | "end" | "bottom" | "start";
|
|
61
|
+
/**
|
|
62
|
+
* By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of
|
|
63
|
+
* its parent element, set this attribute and add `position: relative` to the parent.
|
|
64
|
+
*/
|
|
65
|
+
contained: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Removes the header. This will also remove the default close button, so please ensure you provide an easy,
|
|
68
|
+
* accessible way for users to dismiss the drawer.
|
|
69
|
+
*/
|
|
70
|
+
noHeader: boolean;
|
|
71
|
+
firstUpdated(): void;
|
|
72
|
+
disconnectedCallback(): void;
|
|
73
|
+
private uppercaseFirstLetter;
|
|
74
|
+
private requestClose;
|
|
75
|
+
private addOpenListeners;
|
|
76
|
+
private removeOpenListeners;
|
|
77
|
+
private handleDocumentKeyDown;
|
|
78
|
+
handleOpenChange(): Promise<void>;
|
|
79
|
+
handleNoModalChange(): void;
|
|
80
|
+
/** Shows the drawer. */
|
|
81
|
+
show(): Promise<void>;
|
|
82
|
+
/** Hides the drawer */
|
|
83
|
+
hide(): Promise<void>;
|
|
84
|
+
render(): import("lit").TemplateResult<1>;
|
|
85
|
+
}
|
|
86
|
+
export default SgdsDrawer;
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { DropdownElement } from "../../base/dropdown-element";
|
|
2
|
+
import { SgdsButton } from "../Button";
|
|
2
3
|
export type DropDirection = "left" | "right" | "up" | "down";
|
|
3
4
|
export type DropdownButtonVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark";
|
|
5
|
+
declare const SgdsDropdown_base: typeof DropdownElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
4
6
|
/**
|
|
5
7
|
* @summary `SgdsDropdown` toggles contextual overlays for displaying lists of links.
|
|
6
8
|
* @slot default - slot for sgds-dropdown-item passed into dropdown's menu
|
|
7
9
|
*
|
|
8
10
|
* @csspart menu - The dropdown's menu (ul element)
|
|
9
11
|
*/
|
|
10
|
-
export declare class SgdsDropdown extends
|
|
12
|
+
export declare class SgdsDropdown extends SgdsDropdown_base {
|
|
11
13
|
static styles: import("lit").CSSResultGroup[];
|
|
14
|
+
static get scopedElements(): {
|
|
15
|
+
"sgds-button": typeof SgdsButton;
|
|
16
|
+
};
|
|
12
17
|
constructor();
|
|
13
18
|
connectedCallback(): void;
|
|
14
19
|
/** Controls auto-flipping of menu */
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import SgdsElement from "../../base/sgds-element";
|
|
2
|
+
import { SgdsButton } from "../Button";
|
|
2
3
|
export type FileUploadButtonVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "link" | "outline-primary" | "outline-secondary" | "outline-success" | "outline-danger" | "outline-warning" | "outline-info" | "outline-light" | "outline-dark";
|
|
4
|
+
declare const SgdsFileUpload_base: typeof SgdsElement & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/types/src/types").ScopedElementsHost>;
|
|
3
5
|
/**
|
|
4
6
|
* @summary Allows users to upload files of various sizes and formats
|
|
5
7
|
* @slot default - Label for file upload button
|
|
@@ -11,8 +13,11 @@ export type FileUploadButtonVariant = "primary" | "secondary" | "success" | "dan
|
|
|
11
13
|
* @cssproperty --fileupload-remove-icon-hover-fill - Remove icon mouse over fill color
|
|
12
14
|
*
|
|
13
15
|
*/
|
|
14
|
-
export declare class SgdsFileUpload extends
|
|
16
|
+
export declare class SgdsFileUpload extends SgdsFileUpload_base {
|
|
15
17
|
static styles: import("lit").CSSResultGroup[];
|
|
18
|
+
static get scopedElements(): {
|
|
19
|
+
"sgds-button": typeof SgdsButton;
|
|
20
|
+
};
|
|
16
21
|
/** The button's variant. */
|
|
17
22
|
variant: FileUploadButtonVariant;
|
|
18
23
|
disabled: boolean;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import SgdsElement from "../../base/sgds-element";
|
|
2
|
-
export interface Links {
|
|
3
|
-
href: string;
|
|
4
|
-
label: string;
|
|
5
|
-
}
|
|
6
2
|
export interface ColumnLinks {
|
|
7
3
|
title: string;
|
|
8
4
|
links: Links[];
|
|
9
5
|
}
|
|
6
|
+
export interface Links {
|
|
7
|
+
href: string;
|
|
8
|
+
label: string;
|
|
9
|
+
}
|
|
10
10
|
/**
|
|
11
11
|
* @summary The footer contains supporting information for your service at the bottom of your website. All .gov.sg digital services shall contain a Global Footer Bar across all pages. The Global Footer Bar should include the name of the digital service, contact information, a privacy statement and the terms of use.
|
|
12
12
|
*
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { DropdownElement } from "../../base/dropdown-element";
|
|
2
|
+
/**
|
|
3
|
+
* @slot default - The menu items. Pass in sgds-dropdown-item as the menu items
|
|
4
|
+
* @slot toggler - The content of the toggler to pass in html content. `togglerText` property takes precedence over this slot when both are defined.
|
|
5
|
+
*/
|
|
2
6
|
export declare class SgdsMainnavDropdown extends DropdownElement {
|
|
3
7
|
static styles: import("lit").CSSResultGroup[];
|
|
4
8
|
connectedCallback(): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ButtonVariant } from "../Button";
|
|
2
1
|
import SgdsElement from "../../base/sgds-element";
|
|
3
2
|
import { SgdsFormControl } from "../../utils/form";
|
|
3
|
+
import { ButtonVariant } from "../Button";
|
|
4
4
|
/**
|
|
5
5
|
* @summary The quantity toggle component is used to increase or decrease an incremental venue, best used when the user needs to enter or adjust the quantity of a selected item.
|
|
6
6
|
*
|
|
@@ -48,9 +48,4 @@ export declare class SgdsRadioGroup extends SgdsElement {
|
|
|
48
48
|
updateCheckedRadio(): void;
|
|
49
49
|
render(): import("lit").TemplateResult<1>;
|
|
50
50
|
}
|
|
51
|
-
declare global {
|
|
52
|
-
interface HTMLElementTagNameMap {
|
|
53
|
-
"sgds-radio-group": SgdsRadioGroup;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
51
|
export default SgdsRadioGroup;
|
|
@@ -32,9 +32,4 @@ export declare class SgdsRadio extends SgdsElement {
|
|
|
32
32
|
private setInitialAttributes;
|
|
33
33
|
render(): import("lit").TemplateResult<1>;
|
|
34
34
|
}
|
|
35
|
-
declare global {
|
|
36
|
-
interface HTMLElementTagNameMap {
|
|
37
|
-
"sgds-radio": SgdsRadio;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
35
|
export default SgdsRadio;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import SgdsElement from "../../base/sgds-element";
|
|
2
|
-
export type SpinnerType = "border" | "grow";
|
|
3
|
-
export type SpinnerColor = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark";
|
|
4
2
|
/**
|
|
5
3
|
* @summary Spinners notify the users that their request is being processed.
|
|
6
4
|
*/
|
|
@@ -14,4 +12,6 @@ export declare class SgdsSpinner extends SgdsElement {
|
|
|
14
12
|
spinnerClasses: string;
|
|
15
13
|
render(): import("lit").TemplateResult;
|
|
16
14
|
}
|
|
15
|
+
export type SpinnerColor = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark";
|
|
16
|
+
export type SpinnerType = "border" | "grow";
|
|
17
17
|
export default SgdsSpinner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { SgdsStepper } from "./sgds-stepper";
|
|
1
|
+
export { IStepMetaData, SgdsStepper } from "./sgds-stepper";
|