@sondor-technology/sondor-components 1.0.1-develop.12 → 1.0.1-develop.14
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/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/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 +9 -0
- package/dist/components/input/input.d.ts.map +1 -1
- package/dist/components/input/input.js +30 -37
- 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/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 +6 -3
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +14 -5
- 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/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 +48 -17
- package/dist/styles/reset.js +1 -0
- package/dist/styles/reset.js.map +1 -0
- package/package.json +2 -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/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/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 +32 -42
- 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/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 +23 -18
- 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/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 +38 -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
|
@@ -13,242 +13,279 @@ let StButton = class StButton extends LitElement {
|
|
|
13
13
|
this.target = "_self";
|
|
14
14
|
this.disabled = false;
|
|
15
15
|
this.loading = false;
|
|
16
|
-
this.variant = "
|
|
16
|
+
this.variant = "solid";
|
|
17
|
+
this.color = "default";
|
|
17
18
|
this.size = "md";
|
|
18
|
-
this.color = "primary";
|
|
19
19
|
this.active = false;
|
|
20
20
|
this.ariaLabel = null;
|
|
21
|
+
this.type = "button";
|
|
22
|
+
this.block = false;
|
|
23
|
+
}
|
|
24
|
+
disconnectedCallback() {
|
|
25
|
+
super.disconnectedCallback();
|
|
26
|
+
this.removeEventListener("click", this._handleClick);
|
|
21
27
|
}
|
|
22
28
|
render() {
|
|
23
29
|
const content = html `<slot></slot>`;
|
|
24
30
|
if (this.href) {
|
|
25
|
-
return html `<a
|
|
31
|
+
return html `<a
|
|
32
|
+
href="${this.href}"
|
|
33
|
+
target="${this.target}"
|
|
34
|
+
class="btn"
|
|
35
|
+
aria-label=${this.ariaLabel || nothing}
|
|
26
36
|
>${content}</a
|
|
27
37
|
>`;
|
|
28
38
|
}
|
|
39
|
+
// ADDED: Passing this.type to the native button element
|
|
29
40
|
return html `
|
|
30
|
-
<button
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
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"
|
|
39
|
-
fill="currentColor"
|
|
40
|
-
/>
|
|
41
|
-
<path
|
|
42
|
-
d="M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z"
|
|
43
|
-
fill="currentColor"
|
|
44
|
-
/>
|
|
45
|
-
</svg>
|
|
46
|
-
`
|
|
47
|
-
: html `<slot name="prefix"></slot>`}
|
|
41
|
+
<button
|
|
42
|
+
class="btn"
|
|
43
|
+
type="${this.type}"
|
|
44
|
+
?disabled=${this.disabled || this.loading}
|
|
45
|
+
@click="${this._handleClick}"
|
|
46
|
+
>
|
|
47
|
+
${this.renderLoadingSpinner()}
|
|
48
|
+
${this.renderPrefixSlot()}
|
|
48
49
|
${content}
|
|
49
50
|
<slot name="suffix"></slot>
|
|
50
51
|
</button>
|
|
51
52
|
`;
|
|
52
53
|
}
|
|
54
|
+
renderLoadingSpinner() {
|
|
55
|
+
if (!this.loading) {
|
|
56
|
+
return html ``;
|
|
57
|
+
}
|
|
58
|
+
return html `<svg class="spinner" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
59
|
+
<path
|
|
60
|
+
opacity="0.2"
|
|
61
|
+
fill-rule="evenodd"
|
|
62
|
+
clip-rule="evenodd"
|
|
63
|
+
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"
|
|
64
|
+
fill="currentColor"
|
|
65
|
+
/>
|
|
66
|
+
<path d="M2 12C2 6.47715 6.47715 2 12 2V5C8.13401 5 5 8.13401 5 12H2Z" fill="currentColor" />
|
|
67
|
+
</svg>`;
|
|
68
|
+
}
|
|
69
|
+
renderPrefixSlot() {
|
|
70
|
+
if (this.loading) {
|
|
71
|
+
return html ``;
|
|
72
|
+
}
|
|
73
|
+
return html `<slot name="prefix"></slot>`;
|
|
74
|
+
}
|
|
75
|
+
_handleClick(e) {
|
|
76
|
+
if (this.disabled || this.loading) {
|
|
77
|
+
e.preventDefault();
|
|
78
|
+
e.stopPropagation();
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (this.type === "submit") {
|
|
82
|
+
const form = this.closest("form");
|
|
83
|
+
if (form) {
|
|
84
|
+
e.preventDefault(); // Prevent duplicate events
|
|
85
|
+
form.requestSubmit(); // Natively triggers the form's submit event and validation
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
else if (this.type === "reset") {
|
|
89
|
+
const form = this.closest("form");
|
|
90
|
+
if (form) {
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
form.reset();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
53
96
|
};
|
|
54
97
|
StButton.styles = [
|
|
55
98
|
resetStyles,
|
|
56
99
|
css `
|
|
57
100
|
:host {
|
|
58
|
-
/* ==========================================================
|
|
59
|
-
1. Base Palette (Defaults to Primary Theme)
|
|
60
|
-
========================================================== */
|
|
61
|
-
--_palette-base: var(--st-color-primary);
|
|
62
|
-
--_palette-hover: var(--st-color-primary-hover);
|
|
63
|
-
--_palette-surface: var(--st-color-surface);
|
|
64
|
-
--_palette-surface-hover: var(--st-color-border);
|
|
65
|
-
|
|
66
|
-
--_palette-text-on-base: var(--st-color-surface);
|
|
67
|
-
--_palette-text-on-surface: var(--st-color-text);
|
|
68
|
-
|
|
69
|
-
/* Sizing Tokens */
|
|
70
101
|
--_btn-padding: var(--st-spacing-sm) var(--st-spacing-md);
|
|
71
102
|
--_btn-font-size: var(--st-font-size-sm);
|
|
72
103
|
--_btn-radius: 4px;
|
|
73
104
|
--_btn-gap: var(--st-spacing-sm);
|
|
74
|
-
|
|
75
105
|
display: inline-block;
|
|
76
106
|
}
|
|
77
107
|
|
|
78
108
|
/* ==========================================================
|
|
79
|
-
|
|
109
|
+
VARIANT: SOLID (Filled background, contrasting text)
|
|
80
110
|
========================================================== */
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
--
|
|
84
|
-
--
|
|
85
|
-
--_palette-surface-hover: color-mix(in srgb, var(--st-color-error-bg), black 10%);
|
|
86
|
-
--_palette-text-on-base: var(--st-white); /* Force white text */
|
|
87
|
-
--_palette-text-on-surface: var(--st-color-error);
|
|
111
|
+
/* 'default' consumes surface-hover and text, which naturally invert */
|
|
112
|
+
:host([variant="solid"][color="default"]) {
|
|
113
|
+
--_bg: var(--st-color-surface-hover);
|
|
114
|
+
--_text: var(--st-color-text);
|
|
88
115
|
}
|
|
89
|
-
|
|
90
|
-
:host([color="
|
|
91
|
-
--
|
|
92
|
-
--
|
|
93
|
-
--_palette-surface: var(--st-color-success-bg);
|
|
94
|
-
--_palette-surface-hover: color-mix(in srgb, var(--st-color-success-bg), black 10%);
|
|
95
|
-
--_palette-text-on-base: var(--st-white);
|
|
96
|
-
--_palette-text-on-surface: var(--st-color-success);
|
|
116
|
+
/* Semantic colors use the semantic token for bg, and the global app bg (white/dark gray) for text */
|
|
117
|
+
:host([variant="solid"][color="primary"]) {
|
|
118
|
+
--_bg: var(--st-color-primary);
|
|
119
|
+
--_text: var(--st-color-bg);
|
|
97
120
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
--
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
--
|
|
104
|
-
--
|
|
105
|
-
|
|
121
|
+
:host([variant="solid"][color="error"]) {
|
|
122
|
+
--_bg: var(--st-color-error);
|
|
123
|
+
--_text: var(--st-color-bg);
|
|
124
|
+
}
|
|
125
|
+
:host([variant="solid"][color="success"]) {
|
|
126
|
+
--_bg: var(--st-color-success);
|
|
127
|
+
--_text: var(--st-color-bg);
|
|
128
|
+
}
|
|
129
|
+
:host([variant="solid"][color="warning"]) {
|
|
130
|
+
--_bg: var(--st-color-warning);
|
|
131
|
+
--_text: var(--st-color-bg);
|
|
132
|
+
}
|
|
133
|
+
:host([variant="solid"][color="info"]) {
|
|
134
|
+
--_bg: var(--st-color-info);
|
|
135
|
+
--_text: var(--st-color-bg);
|
|
106
136
|
}
|
|
107
137
|
|
|
108
|
-
:host([
|
|
109
|
-
|
|
110
|
-
--_palette-hover: color-mix(in srgb, var(--st-color-info), black 15%);
|
|
111
|
-
--_palette-surface: var(--st-color-info-bg);
|
|
112
|
-
--_palette-surface-hover: color-mix(in srgb, var(--st-color-info-bg), black 10%);
|
|
113
|
-
--_palette-text-on-base: var(--st-white);
|
|
114
|
-
--_palette-text-on-surface: var(--st-color-info);
|
|
138
|
+
:host([variant="solid"]) .btn:hover {
|
|
139
|
+
filter: brightness(var(--st-hover-brightness, 0.9));
|
|
115
140
|
}
|
|
116
141
|
|
|
117
142
|
/* ==========================================================
|
|
118
|
-
|
|
143
|
+
VARIANT: OUTLINE (Transparent bg, semantic text/border)
|
|
119
144
|
========================================================== */
|
|
145
|
+
:host([variant="outline"]) {
|
|
146
|
+
--_bg: transparent;
|
|
147
|
+
}
|
|
148
|
+
:host([variant="outline"][color="default"]) {
|
|
149
|
+
--_border: var(--st-gray-500, #71717a);
|
|
150
|
+
--_text: var(--st-color-text);
|
|
151
|
+
}
|
|
152
|
+
:host([variant="outline"][color="primary"]) {
|
|
153
|
+
--_border: var(--st-color-primary-text);
|
|
154
|
+
--_text: var(--st-color-primary-text);
|
|
155
|
+
}
|
|
156
|
+
:host([variant="outline"][color="error"]) {
|
|
157
|
+
--_border: var(--st-color-error-text);
|
|
158
|
+
--_text: var(--st-color-error-text);
|
|
159
|
+
}
|
|
160
|
+
:host([variant="outline"][color="success"]) {
|
|
161
|
+
--_border: var(--st-color-success);
|
|
162
|
+
--_text: var(--st-color-success);
|
|
163
|
+
}
|
|
164
|
+
:host([variant="outline"][color="warning"]) {
|
|
165
|
+
--_border: var(--st-color-warning);
|
|
166
|
+
--_text: var(--st-color-warning);
|
|
167
|
+
}
|
|
168
|
+
:host([variant="outline"][color="info"]) {
|
|
169
|
+
--_border: var(--st-color-info-text);
|
|
170
|
+
--_text: var(--st-color-info-text);
|
|
171
|
+
}
|
|
120
172
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
--_btn-bg: var(--_palette-base);
|
|
124
|
-
--_btn-bg-hover: var(--_palette-hover);
|
|
125
|
-
--_btn-text: var(--_palette-text-on-base);
|
|
126
|
-
--_btn-border: transparent;
|
|
173
|
+
:host([variant="outline"]) .btn:hover {
|
|
174
|
+
background-color: var(--st-color-surface-hover);
|
|
127
175
|
}
|
|
128
176
|
|
|
129
|
-
/*
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
--
|
|
134
|
-
--
|
|
177
|
+
/* ==========================================================
|
|
178
|
+
VARIANT: SECONDARY (Soft background, semantic text)
|
|
179
|
+
========================================================== */
|
|
180
|
+
:host([variant="secondary"][color="default"]) {
|
|
181
|
+
--_bg: var(--st-color-surface);
|
|
182
|
+
--_text: var(--st-color-text);
|
|
183
|
+
}
|
|
184
|
+
:host([variant="secondary"][color="primary"]) {
|
|
185
|
+
--_bg: var(--st-color-primary-bg);
|
|
186
|
+
--_text: var(--st-color-primary-text);
|
|
187
|
+
}
|
|
188
|
+
:host([variant="secondary"][color="error"]) {
|
|
189
|
+
--_bg: var(--st-color-error-bg);
|
|
190
|
+
--_text: var(--st-color-error-text);
|
|
191
|
+
}
|
|
192
|
+
:host([variant="secondary"][color="success"]) {
|
|
193
|
+
--_bg: var(--st-color-success-bg);
|
|
194
|
+
--_text: var(--st-color-success);
|
|
195
|
+
}
|
|
196
|
+
:host([variant="secondary"][color="warning"]) {
|
|
197
|
+
--_bg: var(--st-color-warning-bg);
|
|
198
|
+
--_text: var(--st-color-warning);
|
|
199
|
+
}
|
|
200
|
+
:host([variant="secondary"][color="info"]) {
|
|
201
|
+
--_bg: var(--st-color-info-bg);
|
|
202
|
+
--_text: var(--st-color-info-text);
|
|
135
203
|
}
|
|
136
204
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
--_btn-bg: transparent;
|
|
140
|
-
--_btn-bg-hover: var(--_palette-surface);
|
|
141
|
-
--_btn-text: var(--_palette-base);
|
|
142
|
-
--_btn-border: var(--_palette-base);
|
|
205
|
+
:host([variant="secondary"]) .btn:hover {
|
|
206
|
+
filter: brightness(var(--st-hover-brightness, 0.9));
|
|
143
207
|
}
|
|
144
208
|
|
|
145
209
|
/* ==========================================================
|
|
146
|
-
|
|
210
|
+
LAYOUT, SIZE & BASE APPLICATION
|
|
147
211
|
========================================================== */
|
|
212
|
+
:host([block]) {
|
|
213
|
+
display: block;
|
|
214
|
+
width: 100%;
|
|
215
|
+
}
|
|
216
|
+
:host([block]) .btn {
|
|
217
|
+
width: 100%;
|
|
218
|
+
}
|
|
219
|
+
|
|
148
220
|
:host([size="sm"]) {
|
|
149
221
|
--_btn-padding: var(--st-spacing-xs) var(--st-spacing-sm);
|
|
150
222
|
--_btn-font-size: var(--st-font-size-xs);
|
|
151
223
|
--_btn-radius: 2px;
|
|
152
224
|
--_btn-gap: var(--st-spacing-xs);
|
|
153
225
|
}
|
|
154
|
-
|
|
155
226
|
:host([size="lg"]) {
|
|
156
227
|
--_btn-padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
157
228
|
--_btn-font-size: var(--st-font-size-base);
|
|
158
229
|
--_btn-radius: 6px;
|
|
159
|
-
--_btn-gap: var(--st-spacing-sm);
|
|
160
230
|
}
|
|
161
231
|
|
|
162
|
-
/* ==========================================================
|
|
163
|
-
5. Base Button Rules
|
|
164
|
-
========================================================== */
|
|
165
232
|
.btn {
|
|
166
233
|
display: inline-flex;
|
|
167
234
|
align-items: center;
|
|
168
235
|
justify-content: center;
|
|
169
236
|
gap: var(--_btn-gap);
|
|
170
237
|
|
|
171
|
-
background-color: var(--
|
|
172
|
-
color: var(--
|
|
173
|
-
border: 1px solid var(--
|
|
238
|
+
background-color: var(--_bg);
|
|
239
|
+
color: var(--_text);
|
|
240
|
+
border: 1px solid var(--_border, transparent);
|
|
241
|
+
|
|
174
242
|
padding: var(--_btn-padding);
|
|
175
243
|
font-size: var(--_btn-font-size);
|
|
176
|
-
border-radius: var(--_btn-radius);
|
|
177
244
|
line-height: 1;
|
|
178
245
|
|
|
179
246
|
cursor: pointer;
|
|
180
|
-
font-weight: var(--st-font-weight-medium);
|
|
247
|
+
font-weight: var(--st-font-weight-medium, 500);
|
|
181
248
|
transition: all 0.2s ease;
|
|
182
|
-
|
|
249
|
+
text-decoration: none;
|
|
183
250
|
|
|
184
|
-
/* 1. Split the border radius into 4 independent corners */
|
|
185
251
|
border-radius: var(--btn-radius-tl, var(--st-radius-md, 0.5rem))
|
|
186
252
|
var(--btn-radius-tr, var(--st-radius-md, 0.5rem))
|
|
187
253
|
var(--btn-radius-br, var(--st-radius-md, 0.5rem))
|
|
188
254
|
var(--btn-radius-bl, var(--st-radius-md, 0.5rem));
|
|
189
|
-
|
|
190
|
-
/* 2. Add a hook for the group wrapper to inject a divider line */
|
|
191
|
-
box-shadow: var(--btn-divider, none);
|
|
192
|
-
|
|
193
|
-
font-weight: 500;
|
|
194
|
-
text-decoration: none;
|
|
195
|
-
border: 1px solid transparent;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.btn:hover {
|
|
199
|
-
color: var(--_btn-text);
|
|
200
|
-
background-color: var(--_btn-bg-hover);
|
|
201
255
|
}
|
|
202
256
|
|
|
203
|
-
/* ==========================================================
|
|
204
|
-
Logical Active States (Selected/Toggled)
|
|
205
|
-
========================================================== */
|
|
206
257
|
:host([active]) .btn {
|
|
207
258
|
filter: brightness(0.9);
|
|
208
259
|
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
|
|
209
|
-
|
|
210
|
-
color: var(--_btn-text);
|
|
211
|
-
background-color: var(--_btn-bg-hover);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
:host([active]) .btn[color="primary"] {
|
|
215
|
-
filter: brightness(0.85);
|
|
216
|
-
box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2); /* Inset shadow gives a pressed look */
|
|
260
|
+
background-color: var(--_bg); /* Retain base background */
|
|
217
261
|
}
|
|
218
262
|
|
|
219
|
-
/* ==========================================================
|
|
220
|
-
Focus State (Accessibility)
|
|
221
|
-
========================================================== */
|
|
222
|
-
/* focus-visible ensures this only shows for keyboard navigation, not mouse clicks */
|
|
223
263
|
.btn:focus-visible {
|
|
224
|
-
outline:
|
|
225
|
-
|
|
226
|
-
|
|
264
|
+
outline: none;
|
|
265
|
+
box-shadow:
|
|
266
|
+
0 0 0 2px var(--st-color-bg, #ffffff),
|
|
267
|
+
0 0 0 4px var(--st-color-primary);
|
|
268
|
+
z-index: 1;
|
|
227
269
|
}
|
|
228
270
|
|
|
229
|
-
/* ==========================================================
|
|
230
|
-
Physical Active State (Mouse down)
|
|
231
|
-
========================================================== */
|
|
232
271
|
.btn:active {
|
|
233
272
|
transform: scale(0.98);
|
|
234
273
|
}
|
|
235
274
|
|
|
236
|
-
/* Disabled & Loading */
|
|
237
275
|
:host([disabled]),
|
|
238
276
|
:host([loading]) {
|
|
239
277
|
pointer-events: none;
|
|
240
278
|
}
|
|
241
279
|
|
|
242
|
-
:host([disabled])
|
|
280
|
+
:host([disabled]) .btn {
|
|
243
281
|
opacity: 0.5;
|
|
244
282
|
cursor: not-allowed;
|
|
245
283
|
}
|
|
246
284
|
|
|
247
|
-
:host([loading])
|
|
285
|
+
:host([loading]) .btn {
|
|
248
286
|
opacity: 0.8;
|
|
249
287
|
}
|
|
250
288
|
|
|
251
|
-
/* Icons & Spinner */
|
|
252
289
|
::slotted(svg),
|
|
253
290
|
svg.spinner {
|
|
254
291
|
width: 1.25em;
|
|
@@ -288,17 +325,24 @@ __decorate([
|
|
|
288
325
|
], StButton.prototype, "variant", void 0);
|
|
289
326
|
__decorate([
|
|
290
327
|
property({ type: String, reflect: true })
|
|
291
|
-
], StButton.prototype, "
|
|
328
|
+
], StButton.prototype, "color", void 0);
|
|
292
329
|
__decorate([
|
|
293
330
|
property({ type: String, reflect: true })
|
|
294
|
-
], StButton.prototype, "
|
|
331
|
+
], StButton.prototype, "size", void 0);
|
|
295
332
|
__decorate([
|
|
296
333
|
property({ type: Boolean, reflect: true })
|
|
297
334
|
], StButton.prototype, "active", void 0);
|
|
298
335
|
__decorate([
|
|
299
|
-
property({ type: String, attribute:
|
|
336
|
+
property({ type: String, attribute: "aria-label" })
|
|
300
337
|
], StButton.prototype, "ariaLabel", void 0);
|
|
338
|
+
__decorate([
|
|
339
|
+
property({ type: String, reflect: true })
|
|
340
|
+
], StButton.prototype, "type", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
property({ type: Boolean, reflect: true })
|
|
343
|
+
], StButton.prototype, "block", void 0);
|
|
301
344
|
StButton = __decorate([
|
|
302
345
|
customElement("st-button")
|
|
303
346
|
], StButton);
|
|
304
347
|
export { StButton };
|
|
348
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/button/button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAC,MAAM,KAAK,CAAC;AACnD,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAC,MAAM,mB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BACa,aAAc,SAAQ,UAAU;IAC3C,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"button-group.d.ts","sourceRoot":"","sources":["../../../src/components/button-group/button-group.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAY,MAAM,KAAK,CAAC;AAI1C,qBACa,aAAc,SAAQ,UAAU;IAC3C,MAAM,CAAC,MAAM,4BA0CX;IAEF,iBAAiB,SAOhB;IAED,MAAM,yCAEL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,iBAAiB,EAAE,aAAa,CAAC;KAClC;CACF"}
|
|
@@ -8,12 +8,16 @@ import { LitElement, html, css } from "lit";
|
|
|
8
8
|
import { customElement } from "lit/decorators.js";
|
|
9
9
|
import { resetStyles } from "../../styles/reset";
|
|
10
10
|
let StButtonGroup = class StButtonGroup extends LitElement {
|
|
11
|
+
connectedCallback() {
|
|
12
|
+
super.connectedCallback();
|
|
13
|
+
// Automatically apply the semantic role to the host if the developer omits it.
|
|
14
|
+
// This allows them to just write: <st-button-group aria-label="Pagination">
|
|
15
|
+
if (!this.hasAttribute("role")) {
|
|
16
|
+
this.setAttribute("role", "group");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
11
19
|
render() {
|
|
12
|
-
return html
|
|
13
|
-
<div class="group" role="group" aria-label="button group">
|
|
14
|
-
<slot></slot>
|
|
15
|
-
</div>
|
|
16
|
-
`;
|
|
20
|
+
return html `<slot></slot>`;
|
|
17
21
|
}
|
|
18
22
|
};
|
|
19
23
|
StButtonGroup.styles = [
|
|
@@ -24,10 +28,6 @@ StButtonGroup.styles = [
|
|
|
24
28
|
align-items: center;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
.group {
|
|
28
|
-
display: inline-flex;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
31
|
/* 1. Flatten all corners by default */
|
|
32
32
|
::slotted(st-button) {
|
|
33
33
|
--btn-radius-tl: 0px;
|
|
@@ -49,21 +49,16 @@ StButtonGroup.styles = [
|
|
|
49
49
|
--btn-radius-br: var(--st-radius-md, 0.5rem);
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
/* 4. Collapse borders by
|
|
53
|
-
::slotted(st-button
|
|
52
|
+
/* 4. Collapse borders by pulling adjacent buttons left */
|
|
53
|
+
::slotted(st-button:not(:first-child)) {
|
|
54
54
|
margin-left: -1px;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
/* 5.
|
|
58
|
-
::slotted(st-button
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/* 6. Pull active/hovered default buttons forward so their full border shows */
|
|
64
|
-
::slotted(st-button[color="default"]:hover),
|
|
65
|
-
::slotted(st-button[color="default"]:focus-within),
|
|
66
|
-
::slotted(st-button[color="default"]:active) {
|
|
57
|
+
/* 5. Pull active/hovered buttons forward so their full border shows */
|
|
58
|
+
::slotted(st-button:hover),
|
|
59
|
+
::slotted(st-button:focus-within),
|
|
60
|
+
::slotted(st-button:active),
|
|
61
|
+
::slotted(st-button[active]) {
|
|
67
62
|
z-index: 1;
|
|
68
63
|
}
|
|
69
64
|
`,
|
|
@@ -72,3 +67,4 @@ StButtonGroup = __decorate([
|
|
|
72
67
|
customElement("st-button-group")
|
|
73
68
|
], StButtonGroup);
|
|
74
69
|
export { StButtonGroup };
|
|
70
|
+
//# sourceMappingURL=button-group.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button-group.js","sourceRoot":"","sources":["../../../src/components/button-group/button-group.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAC,MAAM,KAAK,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAGxC,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IA6C3C,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,+EAA+E;QAC/E,4EAA4E;QAC5E,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/B,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;CACF,CAAA;AAxDQ,oBAAM,GAAG;IACd,WAAW;IACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCF;CACF,AA1CY,CA0CX;AA3CS,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAyDzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.constants.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,YAAI,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AACzD,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.constants.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { LitElement, PropertyValues } from "lit";
|
|
2
|
+
import { CheckboxSize } from "./checkbox.constants.js";
|
|
2
3
|
export declare class StCheckbox extends LitElement {
|
|
3
4
|
static formAssociated: boolean;
|
|
4
5
|
private _internals;
|
|
5
6
|
private _inputEl;
|
|
6
|
-
size:
|
|
7
|
+
size: CheckboxSize;
|
|
7
8
|
name: string;
|
|
8
9
|
value: string;
|
|
9
10
|
checked: boolean;
|
|
@@ -19,6 +20,9 @@ export declare class StCheckbox extends LitElement {
|
|
|
19
20
|
private _syncValidity;
|
|
20
21
|
checkValidity(): boolean;
|
|
21
22
|
reportValidity(): boolean;
|
|
23
|
+
get validity(): ValidityState;
|
|
24
|
+
get validationMessage(): string;
|
|
25
|
+
get willValidate(): boolean;
|
|
22
26
|
formResetCallback(): void;
|
|
23
27
|
private _handleChange;
|
|
24
28
|
render(): import("lit-html").TemplateResult<1>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAa,cAAc,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAa,cAAc,EAAC,MAAM,KAAK,CAAC;AAG1D,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAC;AAErD,qBACa,UAAW,SAAQ,UAAU;IACxC,MAAM,CAAC,cAAc,UAAQ;IAC7B,OAAO,CAAC,UAAU,CAAmB;IAErB,OAAO,CAAC,QAAQ,CAAoB;IAEX,IAAI,EAAE,YAAY,CAAQ;IAC1B,IAAI,SAAM;IACzB,KAAK,SAAQ;IAEG,OAAO,UAAS;IAChB,aAAa,UAAS;IAEtB,QAAQ,UAAS;IACjB,OAAO,UAAS;IAChB,QAAQ,UAAS;IACjC,YAAY,SAAM;IAEP,SAAS,SAAM;IAEpD,cAWC;IAED,MAAM,CAAC,MAAM,4BA6GX;IAEO,OAAO,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,QAevD;IAED,OAAO,CAAC,aAAa;IAkBd,aAAa,IAAI,OAAO,CAiB9B;IAEM,cAAc,IAAI,OAAO,CAK/B;IAED,IAAW,QAAQ,IAAI,aAAa,CAEnC;IAED,IAAW,iBAAiB,IAAI,MAAM,CAErC;IAED,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED,iBAAiB,SAMhB;IAED,OAAO,CAAC,aAAa;IAkBrB,MAAM,yCAwBL;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
|
@@ -21,16 +21,18 @@ let StCheckbox = class StCheckbox extends LitElement {
|
|
|
21
21
|
this.errorMessage = "";
|
|
22
22
|
this.ariaLabel = "";
|
|
23
23
|
this._internals = this.attachInternals();
|
|
24
|
-
this.addEventListener(
|
|
24
|
+
this.addEventListener("focusout", () => {
|
|
25
25
|
this.invalid = !this.checkValidity();
|
|
26
26
|
});
|
|
27
|
-
this.addEventListener(
|
|
27
|
+
this.addEventListener("invalid", () => {
|
|
28
28
|
this.invalid = !this.checkValidity();
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
updated(changedProperties) {
|
|
32
32
|
super.updated(changedProperties);
|
|
33
|
-
if (changedProperties.has("checked") ||
|
|
33
|
+
if (changedProperties.has("checked") ||
|
|
34
|
+
changedProperties.has("value") ||
|
|
35
|
+
changedProperties.has("errorMessage")) {
|
|
34
36
|
this._internals.setFormValue(this.checked ? this.value : null);
|
|
35
37
|
this._syncValidity();
|
|
36
38
|
}
|
|
@@ -42,7 +44,9 @@ let StCheckbox = class StCheckbox extends LitElement {
|
|
|
42
44
|
if (!this._inputEl)
|
|
43
45
|
return;
|
|
44
46
|
if (this.required && !this.checked) {
|
|
45
|
-
const message = this.errorMessage ||
|
|
47
|
+
const message = this.errorMessage ||
|
|
48
|
+
this._inputEl.validationMessage ||
|
|
49
|
+
"Please check this box if you want to proceed.";
|
|
46
50
|
this._internals.setValidity({ valueMissing: true }, message, this._inputEl);
|
|
47
51
|
}
|
|
48
52
|
else {
|
|
@@ -53,7 +57,9 @@ let StCheckbox = class StCheckbox extends LitElement {
|
|
|
53
57
|
if (!this._inputEl)
|
|
54
58
|
return true;
|
|
55
59
|
if (this.required && !this.checked) {
|
|
56
|
-
const message = this.errorMessage ||
|
|
60
|
+
const message = this.errorMessage ||
|
|
61
|
+
this._inputEl.validationMessage ||
|
|
62
|
+
"Please check this box if you want to proceed.";
|
|
57
63
|
this._internals.setValidity({ valueMissing: true }, message, this._inputEl);
|
|
58
64
|
this.invalid = true;
|
|
59
65
|
return false;
|
|
@@ -69,6 +75,15 @@ let StCheckbox = class StCheckbox extends LitElement {
|
|
|
69
75
|
this.invalid = !isValid;
|
|
70
76
|
return isValid;
|
|
71
77
|
}
|
|
78
|
+
get validity() {
|
|
79
|
+
return this._internals.validity;
|
|
80
|
+
}
|
|
81
|
+
get validationMessage() {
|
|
82
|
+
return this._internals.validationMessage;
|
|
83
|
+
}
|
|
84
|
+
get willValidate() {
|
|
85
|
+
return this._internals.willValidate;
|
|
86
|
+
}
|
|
72
87
|
formResetCallback() {
|
|
73
88
|
this.checked = false;
|
|
74
89
|
this.indeterminate = false;
|
|
@@ -263,3 +278,4 @@ StCheckbox = __decorate([
|
|
|
263
278
|
customElement("st-checkbox")
|
|
264
279
|
], StCheckbox);
|
|
265
280
|
export { StCheckbox };
|
|
281
|
+
//# sourceMappingURL=checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../src/components/checkbox/checkbox.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAC,UAAU,EAAE,IAAI,EAAE,GAAG,EAAiB,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAI3C,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAoBxC;QACE,KAAK,EAAE,CAAC;QAf+B,SAAI,GAAiB,IAAI,CAA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