@sondor-technology/sondor-components 1.0.1-develop.13 → 1.0.1-develop.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/alert/alert.constants.d.ts +3 -0
- package/dist/components/alert/alert.constants.d.ts.map +1 -0
- package/dist/components/alert/alert.constants.js +2 -0
- package/dist/components/alert/alert.constants.js.map +1 -0
- package/dist/components/alert/alert.d.ts +4 -3
- package/dist/components/alert/alert.d.ts.map +1 -1
- package/dist/components/alert/alert.js +21 -11
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/badge/badge.constants.d.ts +3 -0
- package/dist/components/badge/badge.constants.d.ts.map +1 -0
- package/dist/components/badge/badge.constants.js +2 -0
- package/dist/components/badge/badge.constants.js.map +1 -0
- package/dist/components/badge/badge.d.ts +1 -1
- package/dist/components/badge/badge.d.ts.map +1 -1
- package/dist/components/badge/badge.js +3 -2
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/button/button.constants.d.ts +7 -0
- package/dist/components/button/button.constants.d.ts.map +1 -0
- package/dist/components/button/button.constants.js +4 -0
- package/dist/components/button/button.constants.js.map +1 -0
- package/dist/components/button/button.d.ts +8 -4
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +181 -137
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button-group/button-group.d.ts +1 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -1
- package/dist/components/button-group/button-group.js +17 -21
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +36 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +439 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/checkbox/checkbox.constants.d.ts +3 -0
- package/dist/components/checkbox/checkbox.constants.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.constants.js +2 -0
- package/dist/components/checkbox/checkbox.constants.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +5 -1
- package/dist/components/checkbox/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox/checkbox.js +21 -5
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/code-block/code-block.d.ts +7 -7
- package/dist/components/code-block/code-block.d.ts.map +1 -1
- package/dist/components/code-block/code-block.js +130 -66
- package/dist/components/code-block/code-block.js.map +1 -0
- package/dist/components/content-card/content-card.d.ts.map +1 -1
- package/dist/components/content-card/content-card.js +10 -15
- package/dist/components/content-card/content-card.js.map +1 -0
- package/dist/components/cron-builder/cron-builder.d.ts +34 -0
- package/dist/components/cron-builder/cron-builder.d.ts.map +1 -0
- package/dist/components/cron-builder/cron-builder.js +456 -0
- package/dist/components/cron-builder/cron-builder.js.map +1 -0
- package/dist/components/divider/divider.constants.d.ts +5 -0
- package/dist/components/divider/divider.constants.d.ts.map +1 -0
- package/dist/components/divider/divider.constants.js +3 -0
- package/dist/components/divider/divider.constants.js.map +1 -0
- package/dist/components/divider/divider.d.ts +4 -2
- package/dist/components/divider/divider.d.ts.map +1 -1
- package/dist/components/divider/divider.js +18 -9
- package/dist/components/divider/divider.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +7 -4
- package/dist/components/drawer/drawer.d.ts.map +1 -1
- package/dist/components/drawer/drawer.js +73 -30
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/field/field.d.ts +2 -2
- package/dist/components/field/field.d.ts.map +1 -1
- package/dist/components/field/field.js +8 -9
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/footer/footer.d.ts +8 -1
- package/dist/components/footer/footer.d.ts.map +1 -1
- package/dist/components/footer/footer.js +42 -12
- package/dist/components/footer/footer.js.map +1 -0
- package/dist/components/form/form-step.js +1 -0
- package/dist/components/form/form-step.js.map +1 -0
- package/dist/components/form/form.d.ts +3 -0
- package/dist/components/form/form.d.ts.map +1 -1
- package/dist/components/form/form.js +109 -69
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/grid/grid-row.d.ts +3 -3
- package/dist/components/grid/grid-row.d.ts.map +1 -1
- package/dist/components/grid/grid-row.js +36 -22
- package/dist/components/grid/grid-row.js.map +1 -0
- package/dist/components/grid/grid.d.ts +2 -2
- package/dist/components/grid/grid.d.ts.map +1 -1
- package/dist/components/grid/grid.js +5 -2
- package/dist/components/grid/grid.js.map +1 -0
- package/dist/components/icon/icon-paths.d.ts +161 -86
- package/dist/components/icon/icon-paths.d.ts.map +1 -1
- package/dist/components/icon/icon-paths.js +176 -106
- package/dist/components/icon/icon-paths.js.map +1 -0
- package/dist/components/icon/icon.d.ts +1 -1
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +6 -5
- package/dist/components/icon/icon.js.map +1 -0
- package/dist/components/input/input.d.ts +10 -0
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +59 -43
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/link/link.d.ts +6 -6
- package/dist/components/link/link.d.ts.map +1 -1
- package/dist/components/link/link.js +42 -19
- package/dist/components/link/link.js.map +1 -0
- package/dist/components/metadata/metadata.d.ts +3 -3
- package/dist/components/metadata/metadata.d.ts.map +1 -1
- package/dist/components/metadata/metadata.js +23 -20
- package/dist/components/metadata/metadata.js.map +1 -0
- package/dist/components/modal/modal.d.ts +4 -16
- package/dist/components/modal/modal.d.ts.map +1 -1
- package/dist/components/modal/modal.js +99 -62
- package/dist/components/modal/modal.js.map +1 -0
- package/dist/components/page-layout/page-layout.d.ts +4 -3
- package/dist/components/page-layout/page-layout.d.ts.map +1 -1
- package/dist/components/page-layout/page-layout.js +95 -68
- package/dist/components/page-layout/page-layout.js.map +1 -0
- package/dist/components/pin-input/pin-input.d.ts +33 -0
- package/dist/components/pin-input/pin-input.d.ts.map +1 -0
- package/dist/components/pin-input/pin-input.js +253 -0
- package/dist/components/pin-input/pin-input.js.map +1 -0
- package/dist/components/popover/popover.d.ts +26 -0
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/popover/popover.js +196 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/radio/radio.d.ts +8 -0
- package/dist/components/radio/radio.d.ts.map +1 -1
- package/dist/components/radio/radio.js +8 -12
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +6 -1
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.js +44 -18
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/router/router.d.ts +5 -7
- package/dist/components/router/router.d.ts.map +1 -1
- package/dist/components/router/router.js +54 -38
- package/dist/components/router/router.js.map +1 -0
- package/dist/components/select/select.d.ts +5 -4
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +40 -9
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +3 -2
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +10 -13
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/switch/switch.d.ts +12 -0
- package/dist/components/switch/switch.d.ts.map +1 -1
- package/dist/components/switch/switch.js +28 -22
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/data-table.d.ts +3 -25
- package/dist/components/table/data-table.d.ts.map +1 -1
- package/dist/components/table/data-table.js +211 -146
- package/dist/components/table/data-table.js.map +1 -0
- package/dist/components/table/table.d.ts +3 -3
- package/dist/components/table/table.d.ts.map +1 -1
- package/dist/components/table/table.js +39 -20
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/tab-panel.d.ts +3 -1
- package/dist/components/tabs/tab-panel.d.ts.map +1 -1
- package/dist/components/tabs/tab-panel.js +21 -11
- package/dist/components/tabs/tab-panel.js.map +1 -0
- package/dist/components/tabs/tab.d.ts +5 -1
- package/dist/components/tabs/tab.d.ts.map +1 -1
- package/dist/components/tabs/tab.js +46 -28
- package/dist/components/tabs/tab.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +4 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -1
- package/dist/components/tabs/tabs.js +76 -13
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +13 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -1
- package/dist/components/textarea/textarea.js +59 -13
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.constants.d.ts +3 -0
- package/dist/components/theme-toggle/theme-toggle.constants.d.ts.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.constants.js +2 -0
- package/dist/components/theme-toggle/theme-toggle.constants.js.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts +3 -2
- package/dist/components/theme-toggle/theme-toggle.d.ts.map +1 -1
- package/dist/components/theme-toggle/theme-toggle.js +46 -19
- package/dist/components/theme-toggle/theme-toggle.js.map +1 -0
- package/dist/components/time-picker/time-picker.d.ts +38 -0
- package/dist/components/time-picker/time-picker.d.ts.map +1 -0
- package/dist/components/time-picker/time-picker.js +280 -0
- package/dist/components/time-picker/time-picker.js.map +1 -0
- package/dist/components/toggle-group/toggle-button.d.ts +23 -0
- package/dist/components/toggle-group/toggle-button.d.ts.map +1 -0
- package/dist/components/toggle-group/toggle-button.js +115 -0
- package/dist/components/toggle-group/toggle-button.js.map +1 -0
- package/dist/components/toggle-group/toggle-group.d.ts +32 -0
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group/toggle-group.js +150 -0
- package/dist/components/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +33 -0
- package/dist/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.js +293 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts +5 -2
- package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -1
- package/dist/components/vertical-nav/vertical-nav-group.js +50 -14
- package/dist/components/vertical-nav/vertical-nav-group.js.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts +3 -2
- package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -1
- package/dist/components/vertical-nav/vertical-nav-item.js +30 -8
- package/dist/components/vertical-nav/vertical-nav-item.js.map +1 -0
- package/dist/styles/index.css +49 -17
- package/dist/styles/reset.js +1 -0
- package/dist/styles/reset.js.map +1 -0
- package/package.json +30 -1
- package/src/components/alert/alert.constants.ts +2 -0
- package/src/components/alert/alert.ts +24 -15
- package/src/components/badge/badge.constants.ts +2 -0
- package/src/components/badge/badge.ts +3 -4
- package/src/components/breadcrumb/breadcrumb.ts +2 -2
- package/src/components/button/button.constants.ts +8 -0
- package/src/components/button/button.ts +184 -144
- package/src/components/button-group/button-group.ts +18 -22
- package/src/components/calendar/calendar.ts +444 -0
- package/src/components/checkbox/checkbox.constants.ts +2 -0
- package/src/components/checkbox/checkbox.ts +33 -18
- package/src/components/code-block/code-block.ts +151 -84
- package/src/components/content-card/content-card.ts +10 -16
- package/src/components/cron-builder/cron-builder.ts +452 -0
- package/src/components/divider/divider.constants.ts +5 -0
- package/src/components/divider/divider.ts +22 -11
- package/src/components/drawer/drawer.ts +79 -34
- package/src/components/field/field.ts +9 -11
- package/src/components/footer/footer.ts +43 -12
- package/src/components/form/form.ts +121 -84
- package/src/components/grid/grid-row.ts +45 -32
- package/src/components/grid/grid.ts +7 -4
- package/src/components/icon/icon-paths.ts +175 -106
- package/src/components/icon/icon.ts +6 -6
- package/src/components/input/input.ts +59 -45
- package/src/components/link/link.ts +45 -21
- package/src/components/metadata/metadata.ts +26 -24
- package/src/components/modal/modal.ts +108 -74
- package/src/components/page-layout/page-layout.ts +97 -72
- package/src/components/pin-input/pin-input.ts +249 -0
- package/src/components/popover/popover.ts +192 -0
- package/src/components/radio/radio.ts +8 -13
- package/src/components/radio-group/radio-group.ts +45 -21
- package/src/components/router/router.ts +73 -50
- package/src/components/select/select.ts +41 -80
- package/src/components/skeleton/skeleton.ts +14 -14
- package/src/components/switch/switch.ts +31 -25
- package/src/components/table/data-table.ts +248 -177
- package/src/components/table/table.ts +52 -29
- package/src/components/tabs/tab-panel.ts +25 -13
- package/src/components/tabs/tab.ts +58 -33
- package/src/components/tabs/tabs.ts +77 -15
- package/src/components/textarea/textarea.ts +63 -15
- package/src/components/theme-toggle/theme-toggle.constants.ts +2 -0
- package/src/components/theme-toggle/theme-toggle.ts +47 -22
- package/src/components/time-picker/time-picker.ts +272 -0
- package/src/components/toggle-group/toggle-button.ts +104 -0
- package/src/components/toggle-group/toggle-group.ts +148 -0
- package/src/components/tooltip/tooltip.ts +286 -0
- package/src/components/vertical-nav/vertical-nav-group.ts +57 -18
- package/src/components/vertical-nav/vertical-nav-item.ts +35 -12
- package/src/styles/globals.css +27 -4
- package/src/styles/theme.css +40 -32
- package/tsconfig.json +2 -1
- package/dist/components/card/card.d.ts +0 -11
- package/dist/components/card/card.d.ts.map +0 -1
- package/dist/components/card/card.js +0 -54
- package/src/components/card/card.ts +0 -53
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sondor-technology/sondor-components",
|
|
3
|
-
"version": "1.0.1-develop.
|
|
3
|
+
"version": "1.0.1-develop.15",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"./button": {
|
|
17
17
|
"types": "./dist/components/button/button.d.ts",
|
|
18
|
+
"development": "./src/components/button/button.ts",
|
|
18
19
|
"default": "./dist/components/button/button.js"
|
|
19
20
|
},
|
|
20
21
|
"./styles.css": {
|
|
@@ -172,6 +173,34 @@
|
|
|
172
173
|
"./modal": {
|
|
173
174
|
"types": "./dist/components/modal/modal.d.ts",
|
|
174
175
|
"default": "./dist/components/modal/modal.js"
|
|
176
|
+
},
|
|
177
|
+
"./toggle-group": {
|
|
178
|
+
"types": "./dist/components/toggle-group/toggle-group.d.ts",
|
|
179
|
+
"default": "./dist/components/toggle-group/toggle-group.js"
|
|
180
|
+
},
|
|
181
|
+
"./calendar": {
|
|
182
|
+
"types": "./dist/components/calendar/calendar.d.ts",
|
|
183
|
+
"default": "./dist/components/calendar/calendar.js"
|
|
184
|
+
},
|
|
185
|
+
"./time-picker": {
|
|
186
|
+
"types": "./dist/components/time-picker/time-picker.d.ts",
|
|
187
|
+
"default": "./dist/components/time-picker/time-picker.js"
|
|
188
|
+
},
|
|
189
|
+
"./cron-builder": {
|
|
190
|
+
"types": "./dist/components/cron-builder/cron-builder.d.ts",
|
|
191
|
+
"default": "./dist/components/cron-builder/cron-builder.js"
|
|
192
|
+
},
|
|
193
|
+
"./pin-input": {
|
|
194
|
+
"types": "./dist/components/pin-input/pin-input.d.ts",
|
|
195
|
+
"default": "./dist/components/pin-input/pin-input.js"
|
|
196
|
+
},
|
|
197
|
+
"./tooltip": {
|
|
198
|
+
"types": "./dist/components/tooltip/tooltip.d.ts",
|
|
199
|
+
"default": "./dist/components/tooltip/tooltip.js"
|
|
200
|
+
},
|
|
201
|
+
"./popover": {
|
|
202
|
+
"types": "./dist/components/popover/popover.d.ts",
|
|
203
|
+
"default": "./dist/components/popover/popover.js"
|
|
175
204
|
}
|
|
176
205
|
},
|
|
177
206
|
"sideEffects": [
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import {LitElement, html, css} from "lit";
|
|
2
|
+
import {customElement, property} from "lit/decorators.js";
|
|
3
|
+
import {resetStyles} from "../../styles/reset.js";
|
|
4
|
+
import { AlertColor } from "./alert.constants.js";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
@customElement('st-alert')
|
|
6
|
+
@customElement("st-alert")
|
|
8
7
|
export class StAlert extends LitElement {
|
|
9
|
-
@property({
|
|
8
|
+
@property({type: String, reflect: true}) color: AlertColor = "info";
|
|
10
9
|
|
|
11
10
|
static styles = [
|
|
12
11
|
resetStyles,
|
|
@@ -19,32 +18,34 @@ export class StAlert extends LitElement {
|
|
|
19
18
|
border: 1px solid transparent;
|
|
20
19
|
font-size: var(--st-font-size-base);
|
|
21
20
|
line-height: 1.5;
|
|
22
|
-
|
|
21
|
+
|
|
23
22
|
/* Default Palette */
|
|
24
23
|
--_alert-bg: var(--st-color-info-bg);
|
|
25
24
|
--_alert-border: var(--st-color-info);
|
|
26
|
-
--_alert-text: var(--st-color-
|
|
25
|
+
--_alert-text: var(--st-color-info);
|
|
27
26
|
--_alert-icon: var(--st-color-info);
|
|
28
27
|
}
|
|
29
|
-
|
|
28
|
+
|
|
30
29
|
/* State Modifiers */
|
|
31
30
|
:host([color="error"]) {
|
|
32
31
|
--_alert-bg: var(--st-color-error-bg);
|
|
33
32
|
--_alert-border: var(--st-color-error);
|
|
34
33
|
--_alert-icon: var(--st-color-error);
|
|
34
|
+
--_alert-text: var(--st-color-error);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
:host([color="success"]) {
|
|
38
38
|
--_alert-bg: var(--st-color-success-bg);
|
|
39
39
|
--_alert-border: var(--st-color-success);
|
|
40
40
|
--_alert-icon: var(--st-color-success);
|
|
41
|
+
--_alert-text: var(--st-color-success);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
:host([color="warning"]) {
|
|
44
45
|
--_alert-bg: var(--st-color-warning-bg);
|
|
45
46
|
--_alert-border: var(--st-color-warning);
|
|
46
47
|
--_alert-icon: var(--st-color-warning);
|
|
47
|
-
|
|
48
|
+
--_alert-text: var(--st-color-warning);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
/* Apply the variables */
|
|
@@ -60,7 +61,7 @@ export class StAlert extends LitElement {
|
|
|
60
61
|
flex-shrink: 0;
|
|
61
62
|
color: var(--_alert-icon);
|
|
62
63
|
/* Align icon with the first line of text */
|
|
63
|
-
margin-top: 2px;
|
|
64
|
+
margin-top: 2px;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
::slotted([slot="icon"]) {
|
|
@@ -79,9 +80,17 @@ export class StAlert extends LitElement {
|
|
|
79
80
|
gap: var(--st-spacing-xs);
|
|
80
81
|
flex: 1;
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
+
`,
|
|
83
84
|
];
|
|
84
85
|
|
|
86
|
+
connectedCallback() {
|
|
87
|
+
super.connectedCallback();
|
|
88
|
+
// Ensure screen readers announce this component dynamically
|
|
89
|
+
if (!this.hasAttribute("role")) {
|
|
90
|
+
this.setAttribute("role", "alert");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
85
94
|
render() {
|
|
86
95
|
return html`
|
|
87
96
|
<div class="icon-container">
|
|
@@ -96,6 +105,6 @@ export class StAlert extends LitElement {
|
|
|
96
105
|
|
|
97
106
|
declare global {
|
|
98
107
|
interface HTMLElementTagNameMap {
|
|
99
|
-
|
|
108
|
+
"st-alert": StAlert;
|
|
100
109
|
}
|
|
101
|
-
}
|
|
110
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
export type BadgeColor = 'primary' | 'neutral' | 'success' | 'warning' | 'error' | 'info';
|
|
4
|
+
import { BadgeColor } from './badge.constants.js';
|
|
6
5
|
|
|
7
6
|
@customElement('st-badge')
|
|
8
7
|
export class StBadge extends LitElement {
|
|
@@ -39,8 +38,8 @@ export class StBadge extends LitElement {
|
|
|
39
38
|
Soft Semantic Variants
|
|
40
39
|
========================================================== */
|
|
41
40
|
:host([color="primary"]) {
|
|
42
|
-
--_badge-bg: var(--st-color-primary);
|
|
43
|
-
--_badge-text: var(--st-
|
|
41
|
+
--_badge-bg: var(--st-color-primary-bg);
|
|
42
|
+
--_badge-text: var(--st-color-primary-text);
|
|
44
43
|
--_badge-border: transparent;
|
|
45
44
|
}
|
|
46
45
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
1
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import { resetStyles } from '../../styles/reset.js';
|
|
4
4
|
|
|
@@ -79,7 +79,7 @@ export class StBreadcrumb extends LitElement {
|
|
|
79
79
|
${this.items.map((item, index) => {
|
|
80
80
|
const isLast = index === this.items.length - 1;
|
|
81
81
|
return html`
|
|
82
|
-
<li>
|
|
82
|
+
<li .ariaCurrent=${isLast ? 'page' : null}>
|
|
83
83
|
${!isLast && item.href
|
|
84
84
|
? html`<a href=${item.href}>${item.label}</a>`
|
|
85
85
|
: html`<span>${item.label}</span>`}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const buttonColors = ["default", "primary", "info", "success", "warning", "error"] as const;
|
|
2
|
+
export type ButtonColor = typeof buttonColors[number];
|
|
3
|
+
|
|
4
|
+
export const buttonVariants = ["solid", "outline", "secondary"] as const;
|
|
5
|
+
export type ButtonVariant = typeof buttonVariants[number];
|
|
6
|
+
|
|
7
|
+
export const buttonSizes = ["sm", "md", "lg"] as const;
|
|
8
|
+
export type ButtonSize = typeof buttonSizes[number];
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import {LitElement, html, css, nothing} from "lit";
|
|
2
2
|
import {customElement, property} from "lit/decorators.js";
|
|
3
3
|
import {resetStyles} from "../../styles/reset.js";
|
|
4
|
-
|
|
5
|
-
export type ButtonVariant = "primary" | "secondary" | "outline";
|
|
6
|
-
export type ButtonSize = "sm" | "md" | "lg";
|
|
7
|
-
export type ButtonColor = "primary" | "error" | "success" | "warning" | "info";
|
|
4
|
+
import {ButtonColor, ButtonSize, ButtonVariant} from "./button.constants.js";
|
|
8
5
|
|
|
9
6
|
@customElement("st-button")
|
|
10
7
|
export class StButton extends LitElement {
|
|
@@ -12,210 +9,206 @@ export class StButton extends LitElement {
|
|
|
12
9
|
@property({type: String}) target: "_blank" | "_self" = "_self";
|
|
13
10
|
@property({type: Boolean, reflect: true}) disabled = false;
|
|
14
11
|
@property({type: Boolean, reflect: true}) loading = false;
|
|
15
|
-
@property({type: String, reflect: true}) variant: ButtonVariant = "
|
|
12
|
+
@property({type: String, reflect: true}) variant: ButtonVariant = "solid";
|
|
13
|
+
@property({type: String, reflect: true}) color: ButtonColor = "default";
|
|
16
14
|
@property({type: String, reflect: true}) size: ButtonSize = "md";
|
|
17
|
-
@property({type:
|
|
18
|
-
@property({
|
|
19
|
-
@property({
|
|
15
|
+
@property({type: Boolean, reflect: true}) active = false;
|
|
16
|
+
@property({type: String, attribute: "aria-label"}) ariaLabel: string | null = null;
|
|
17
|
+
@property({type: String, reflect: true}) type: "button" | "submit" | "reset" = "button";
|
|
18
|
+
@property({type: Boolean, reflect: true}) block = false;
|
|
20
19
|
|
|
21
20
|
static styles = [
|
|
22
21
|
resetStyles,
|
|
23
22
|
css`
|
|
24
23
|
:host {
|
|
25
|
-
/* ==========================================================
|
|
26
|
-
1. Base Palette (Defaults to Primary Theme)
|
|
27
|
-
========================================================== */
|
|
28
|
-
--_palette-base: var(--st-color-primary);
|
|
29
|
-
--_palette-hover: var(--st-color-primary-hover);
|
|
30
|
-
--_palette-surface: var(--st-color-surface);
|
|
31
|
-
--_palette-surface-hover: var(--st-color-border);
|
|
32
|
-
|
|
33
|
-
--_palette-text-on-base: var(--st-color-surface);
|
|
34
|
-
--_palette-text-on-surface: var(--st-color-text);
|
|
35
|
-
|
|
36
|
-
/* Sizing Tokens */
|
|
37
24
|
--_btn-padding: var(--st-spacing-sm) var(--st-spacing-md);
|
|
38
25
|
--_btn-font-size: var(--st-font-size-sm);
|
|
39
26
|
--_btn-radius: 4px;
|
|
40
27
|
--_btn-gap: var(--st-spacing-sm);
|
|
41
|
-
|
|
42
28
|
display: inline-block;
|
|
43
29
|
}
|
|
44
30
|
|
|
45
31
|
/* ==========================================================
|
|
46
|
-
|
|
32
|
+
VARIANT: SOLID (Filled background, contrasting text)
|
|
47
33
|
========================================================== */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
--
|
|
51
|
-
--
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
--
|
|
60
|
-
--
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
--
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
:host([color="warning"]) {
|
|
67
|
-
--
|
|
68
|
-
--
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
--
|
|
72
|
-
--
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
:host([
|
|
76
|
-
|
|
77
|
-
--_palette-hover: color-mix(in srgb, var(--st-color-info), black 15%);
|
|
78
|
-
--_palette-surface: var(--st-color-info-bg);
|
|
79
|
-
--_palette-surface-hover: color-mix(in srgb, var(--st-color-info-bg), black 10%);
|
|
80
|
-
--_palette-text-on-base: var(--st-white);
|
|
81
|
-
--_palette-text-on-surface: var(--st-color-info);
|
|
34
|
+
/* 'default' consumes surface-hover and text, which naturally invert */
|
|
35
|
+
:host([variant="solid"][color="default"]) {
|
|
36
|
+
--_bg: var(--st-color-surface-hover);
|
|
37
|
+
--_text: var(--st-color-text);
|
|
38
|
+
}
|
|
39
|
+
/* Semantic colors use the semantic token for bg, and the global app bg (white/dark gray) for text */
|
|
40
|
+
:host([variant="solid"][color="primary"]) {
|
|
41
|
+
--_bg: var(--st-color-primary);
|
|
42
|
+
--_text: var(--st-color-bg);
|
|
43
|
+
}
|
|
44
|
+
:host([variant="solid"][color="error"]) {
|
|
45
|
+
--_bg: var(--st-color-error);
|
|
46
|
+
--_text: var(--st-color-bg);
|
|
47
|
+
}
|
|
48
|
+
:host([variant="solid"][color="success"]) {
|
|
49
|
+
--_bg: var(--st-color-success);
|
|
50
|
+
--_text: var(--st-color-bg);
|
|
51
|
+
}
|
|
52
|
+
:host([variant="solid"][color="warning"]) {
|
|
53
|
+
--_bg: var(--st-color-warning);
|
|
54
|
+
--_text: var(--st-color-bg);
|
|
55
|
+
}
|
|
56
|
+
:host([variant="solid"][color="info"]) {
|
|
57
|
+
--_bg: var(--st-color-info);
|
|
58
|
+
--_text: var(--st-color-bg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([variant="solid"]) .btn:hover {
|
|
62
|
+
filter: brightness(var(--st-hover-brightness, 0.9));
|
|
82
63
|
}
|
|
83
64
|
|
|
84
65
|
/* ==========================================================
|
|
85
|
-
|
|
66
|
+
VARIANT: OUTLINE (Transparent bg, semantic text/border)
|
|
86
67
|
========================================================== */
|
|
68
|
+
:host([variant="outline"]) {
|
|
69
|
+
--_bg: transparent;
|
|
70
|
+
}
|
|
71
|
+
:host([variant="outline"][color="default"]) {
|
|
72
|
+
--_border: var(--st-gray-500, #71717a);
|
|
73
|
+
--_text: var(--st-color-text);
|
|
74
|
+
}
|
|
75
|
+
:host([variant="outline"][color="primary"]) {
|
|
76
|
+
--_border: var(--st-color-primary-text);
|
|
77
|
+
--_text: var(--st-color-primary-text);
|
|
78
|
+
}
|
|
79
|
+
:host([variant="outline"][color="error"]) {
|
|
80
|
+
--_border: var(--st-color-error-text);
|
|
81
|
+
--_text: var(--st-color-error-text);
|
|
82
|
+
}
|
|
83
|
+
:host([variant="outline"][color="success"]) {
|
|
84
|
+
--_border: var(--st-color-success);
|
|
85
|
+
--_text: var(--st-color-success);
|
|
86
|
+
}
|
|
87
|
+
:host([variant="outline"][color="warning"]) {
|
|
88
|
+
--_border: var(--st-color-warning);
|
|
89
|
+
--_text: var(--st-color-warning);
|
|
90
|
+
}
|
|
91
|
+
:host([variant="outline"][color="info"]) {
|
|
92
|
+
--_border: var(--st-color-info-text);
|
|
93
|
+
--_text: var(--st-color-info-text);
|
|
94
|
+
}
|
|
87
95
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
--_btn-bg: var(--_palette-base);
|
|
91
|
-
--_btn-bg-hover: var(--_palette-hover);
|
|
92
|
-
--_btn-text: var(--_palette-text-on-base);
|
|
93
|
-
--_btn-border: transparent;
|
|
96
|
+
:host([variant="outline"]) .btn:hover {
|
|
97
|
+
background-color: var(--st-color-surface-hover);
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
/*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
--
|
|
101
|
-
--
|
|
100
|
+
/* ==========================================================
|
|
101
|
+
VARIANT: SECONDARY (Soft background, semantic text)
|
|
102
|
+
========================================================== */
|
|
103
|
+
:host([variant="secondary"][color="default"]) {
|
|
104
|
+
--_bg: var(--st-color-surface);
|
|
105
|
+
--_text: var(--st-color-text);
|
|
106
|
+
}
|
|
107
|
+
:host([variant="secondary"][color="primary"]) {
|
|
108
|
+
--_bg: var(--st-color-primary-bg);
|
|
109
|
+
--_text: var(--st-color-primary-text);
|
|
110
|
+
}
|
|
111
|
+
:host([variant="secondary"][color="error"]) {
|
|
112
|
+
--_bg: var(--st-color-error-bg);
|
|
113
|
+
--_text: var(--st-color-error-text);
|
|
114
|
+
}
|
|
115
|
+
:host([variant="secondary"][color="success"]) {
|
|
116
|
+
--_bg: var(--st-color-success-bg);
|
|
117
|
+
--_text: var(--st-color-success);
|
|
118
|
+
}
|
|
119
|
+
:host([variant="secondary"][color="warning"]) {
|
|
120
|
+
--_bg: var(--st-color-warning-bg);
|
|
121
|
+
--_text: var(--st-color-warning);
|
|
122
|
+
}
|
|
123
|
+
:host([variant="secondary"][color="info"]) {
|
|
124
|
+
--_bg: var(--st-color-info-bg);
|
|
125
|
+
--_text: var(--st-color-info-text);
|
|
102
126
|
}
|
|
103
127
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
--_btn-bg: transparent;
|
|
107
|
-
--_btn-bg-hover: var(--_palette-surface);
|
|
108
|
-
--_btn-text: var(--_palette-base);
|
|
109
|
-
--_btn-border: var(--_palette-base);
|
|
128
|
+
:host([variant="secondary"]) .btn:hover {
|
|
129
|
+
filter: brightness(var(--st-hover-brightness, 0.9));
|
|
110
130
|
}
|
|
111
131
|
|
|
112
132
|
/* ==========================================================
|
|
113
|
-
|
|
133
|
+
LAYOUT, SIZE & BASE APPLICATION
|
|
114
134
|
========================================================== */
|
|
135
|
+
:host([block]) {
|
|
136
|
+
display: block;
|
|
137
|
+
width: 100%;
|
|
138
|
+
}
|
|
139
|
+
:host([block]) .btn {
|
|
140
|
+
width: 100%;
|
|
141
|
+
}
|
|
142
|
+
|
|
115
143
|
:host([size="sm"]) {
|
|
116
144
|
--_btn-padding: var(--st-spacing-xs) var(--st-spacing-sm);
|
|
117
145
|
--_btn-font-size: var(--st-font-size-xs);
|
|
118
146
|
--_btn-radius: 2px;
|
|
119
147
|
--_btn-gap: var(--st-spacing-xs);
|
|
120
148
|
}
|
|
121
|
-
|
|
122
149
|
:host([size="lg"]) {
|
|
123
150
|
--_btn-padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
124
151
|
--_btn-font-size: var(--st-font-size-base);
|
|
125
152
|
--_btn-radius: 6px;
|
|
126
|
-
--_btn-gap: var(--st-spacing-sm);
|
|
127
153
|
}
|
|
128
154
|
|
|
129
|
-
/* ==========================================================
|
|
130
|
-
5. Base Button Rules
|
|
131
|
-
========================================================== */
|
|
132
155
|
.btn {
|
|
133
156
|
display: inline-flex;
|
|
134
157
|
align-items: center;
|
|
135
158
|
justify-content: center;
|
|
136
159
|
gap: var(--_btn-gap);
|
|
137
160
|
|
|
138
|
-
background-color: var(--
|
|
139
|
-
color: var(--
|
|
140
|
-
border: 1px solid var(--
|
|
161
|
+
background-color: var(--_bg);
|
|
162
|
+
color: var(--_text);
|
|
163
|
+
border: 1px solid var(--_border, transparent);
|
|
164
|
+
|
|
141
165
|
padding: var(--_btn-padding);
|
|
142
166
|
font-size: var(--_btn-font-size);
|
|
143
|
-
border-radius: var(--_btn-radius);
|
|
144
167
|
line-height: 1;
|
|
145
168
|
|
|
146
169
|
cursor: pointer;
|
|
147
|
-
font-weight: var(--st-font-weight-medium);
|
|
170
|
+
font-weight: var(--st-font-weight-medium, 500);
|
|
148
171
|
transition: all 0.2s ease;
|
|
149
|
-
|
|
172
|
+
text-decoration: none;
|
|
150
173
|
|
|
151
|
-
/* 1. Split the border radius into 4 independent corners */
|
|
152
174
|
border-radius: var(--btn-radius-tl, var(--st-radius-md, 0.5rem))
|
|
153
175
|
var(--btn-radius-tr, var(--st-radius-md, 0.5rem))
|
|
154
176
|
var(--btn-radius-br, var(--st-radius-md, 0.5rem))
|
|
155
177
|
var(--btn-radius-bl, var(--st-radius-md, 0.5rem));
|
|
156
|
-
|
|
157
|
-
/* 2. Add a hook for the group wrapper to inject a divider line */
|
|
158
|
-
box-shadow: var(--btn-divider, none);
|
|
159
|
-
|
|
160
|
-
font-weight: 500;
|
|
161
|
-
text-decoration: none;
|
|
162
|
-
border: 1px solid transparent;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.btn:hover {
|
|
166
|
-
color: var(--_btn-text);
|
|
167
|
-
background-color: var(--_btn-bg-hover);
|
|
168
178
|
}
|
|
169
179
|
|
|
170
|
-
/* ==========================================================
|
|
171
|
-
Logical Active States (Selected/Toggled)
|
|
172
|
-
========================================================== */
|
|
173
180
|
:host([active]) .btn {
|
|
174
181
|
filter: brightness(0.9);
|
|
175
182
|
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
|
|
176
|
-
|
|
177
|
-
color: var(--_btn-text);
|
|
178
|
-
background-color: var(--_btn-bg-hover);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
:host([active]) .btn[color="primary"] {
|
|
182
|
-
filter: brightness(0.85);
|
|
183
|
-
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); /* Inset shadow gives a pressed look */
|
|
183
|
+
background-color: var(--_bg); /* Retain base background */
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
/* ==========================================================
|
|
187
|
-
Focus State (Accessibility)
|
|
188
|
-
========================================================== */
|
|
189
|
-
/* focus-visible ensures this only shows for keyboard navigation, not mouse clicks */
|
|
190
186
|
.btn:focus-visible {
|
|
191
|
-
outline:
|
|
192
|
-
|
|
193
|
-
|
|
187
|
+
outline: none;
|
|
188
|
+
box-shadow:
|
|
189
|
+
0 0 0 2px var(--st-color-bg, #ffffff),
|
|
190
|
+
0 0 0 4px var(--st-color-primary);
|
|
191
|
+
z-index: 1;
|
|
194
192
|
}
|
|
195
193
|
|
|
196
|
-
/* ==========================================================
|
|
197
|
-
Physical Active State (Mouse down)
|
|
198
|
-
========================================================== */
|
|
199
194
|
.btn:active {
|
|
200
195
|
transform: scale(0.98);
|
|
201
196
|
}
|
|
202
197
|
|
|
203
|
-
/* Disabled & Loading */
|
|
204
198
|
:host([disabled]),
|
|
205
199
|
:host([loading]) {
|
|
206
200
|
pointer-events: none;
|
|
207
201
|
}
|
|
208
202
|
|
|
209
|
-
:host([disabled])
|
|
203
|
+
:host([disabled]) .btn {
|
|
210
204
|
opacity: 0.5;
|
|
211
205
|
cursor: not-allowed;
|
|
212
206
|
}
|
|
213
207
|
|
|
214
|
-
:host([loading])
|
|
208
|
+
:host([loading]) .btn {
|
|
215
209
|
opacity: 0.8;
|
|
216
210
|
}
|
|
217
211
|
|
|
218
|
-
/* Icons & Spinner */
|
|
219
212
|
::slotted(svg),
|
|
220
213
|
svg.spinner {
|
|
221
214
|
width: 1.25em;
|
|
@@ -239,39 +232,86 @@ export class StButton extends LitElement {
|
|
|
239
232
|
`,
|
|
240
233
|
];
|
|
241
234
|
|
|
235
|
+
disconnectedCallback() {
|
|
236
|
+
super.disconnectedCallback();
|
|
237
|
+
this.removeEventListener("click", this._handleClick);
|
|
238
|
+
}
|
|
239
|
+
|
|
242
240
|
render() {
|
|
243
241
|
const content = html`<slot></slot>`;
|
|
244
242
|
|
|
245
243
|
if (this.href) {
|
|
246
|
-
return html`<a
|
|
244
|
+
return html`<a
|
|
245
|
+
href="${this.href}"
|
|
246
|
+
target="${this.target}"
|
|
247
|
+
class="btn"
|
|
248
|
+
aria-label=${this.ariaLabel || nothing}
|
|
247
249
|
>${content}</a
|
|
248
250
|
>`;
|
|
249
251
|
}
|
|
250
252
|
|
|
253
|
+
// ADDED: Passing this.type to the native button element
|
|
251
254
|
return html`
|
|
252
|
-
<button
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
d="M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"
|
|
261
|
-
fill="currentColor"
|
|
262
|
-
/>
|
|
263
|
-
<path
|
|
264
|
-
d="M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z"
|
|
265
|
-
fill="currentColor"
|
|
266
|
-
/>
|
|
267
|
-
</svg>
|
|
268
|
-
`
|
|
269
|
-
: html`<slot name="prefix"></slot>`}
|
|
255
|
+
<button
|
|
256
|
+
class="btn"
|
|
257
|
+
type="${this.type}"
|
|
258
|
+
?disabled=${this.disabled || this.loading}
|
|
259
|
+
@click="${this._handleClick}"
|
|
260
|
+
>
|
|
261
|
+
${this.renderLoadingSpinner()}
|
|
262
|
+
${this.renderPrefixSlot()}
|
|
270
263
|
${content}
|
|
271
264
|
<slot name="suffix"></slot>
|
|
272
265
|
</button>
|
|
273
266
|
`;
|
|
274
267
|
}
|
|
268
|
+
|
|
269
|
+
private renderLoadingSpinner() {
|
|
270
|
+
if (!this.loading) {
|
|
271
|
+
return html``;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return html`<svg class="spinner" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
275
|
+
<path
|
|
276
|
+
opacity="0.2"
|
|
277
|
+
fill-rule="evenodd"
|
|
278
|
+
clip-rule="evenodd"
|
|
279
|
+
d="M12 19C15.866 19 19 15.866 19 12C19 8.13401 15.866 5 12 5C8.13401 5 5 8.13401 5 12C5 15.866 8.13401 19 12 19ZM12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z"
|
|
280
|
+
fill="currentColor"
|
|
281
|
+
/>
|
|
282
|
+
<path d="M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z" fill="currentColor" />
|
|
283
|
+
</svg>`;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
private renderPrefixSlot() {
|
|
287
|
+
if (this.loading) {
|
|
288
|
+
return html``;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
return html`<slot name="prefix"></slot>`;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
private _handleClick(e: MouseEvent) {
|
|
295
|
+
if (this.disabled || this.loading) {
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
e.stopPropagation();
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (this.type === "submit") {
|
|
302
|
+
const form = this.closest("form");
|
|
303
|
+
if (form) {
|
|
304
|
+
e.preventDefault(); // Prevent duplicate events
|
|
305
|
+
form.requestSubmit(); // Natively triggers the form's submit event and validation
|
|
306
|
+
}
|
|
307
|
+
} else if (this.type === "reset") {
|
|
308
|
+
const form = this.closest("form");
|
|
309
|
+
if (form) {
|
|
310
|
+
e.preventDefault();
|
|
311
|
+
form.reset();
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
275
315
|
}
|
|
276
316
|
|
|
277
317
|
declare global {
|