@sondor-technology/sondor-components 1.0.0 → 1.0.1-develop.2
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 +8 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.d.ts.map +1 -0
- package/dist/components/alert/alert.js +105 -0
- package/dist/components/badge/badge.d.ts +13 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +101 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +19 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.js +99 -0
- package/dist/components/button/button.d.ts +23 -0
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/button/button.js +304 -0
- package/dist/components/button-group/button-group.d.ts +6 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +74 -0
- package/dist/components/card/card.d.ts +11 -0
- package/dist/components/card/card.d.ts.map +1 -0
- package/dist/components/card/card.js +54 -0
- package/dist/components/checkbox/checkbox.d.ts +28 -0
- package/dist/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.js +247 -0
- package/dist/components/code-block/code-block.d.ts +20 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -0
- package/dist/components/code-block/code-block.js +260 -0
- package/dist/components/content-card/content-card.d.ts +13 -0
- package/dist/components/content-card/content-card.d.ts.map +1 -0
- package/dist/components/content-card/content-card.js +140 -0
- package/dist/components/divider/divider.d.ts +16 -0
- package/dist/components/divider/divider.d.ts.map +1 -0
- package/dist/components/divider/divider.js +82 -0
- package/dist/components/drawer/drawer.d.ts +22 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -0
- package/dist/components/drawer/drawer.js +226 -0
- package/dist/components/field/field.d.ts +11 -0
- package/dist/components/field/field.d.ts.map +1 -0
- package/dist/components/field/field.js +32 -0
- package/dist/components/footer/footer.d.ts +6 -0
- package/dist/components/footer/footer.d.ts.map +1 -0
- package/dist/components/footer/footer.js +65 -0
- package/dist/components/form/form-step.d.ts +13 -0
- package/dist/components/form/form-step.d.ts.map +1 -0
- package/dist/components/form/form-step.js +41 -0
- package/dist/components/form/form.d.ts +25 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.js +358 -0
- package/dist/components/grid/grid-row.d.ts +17 -0
- package/dist/components/grid/grid-row.d.ts.map +1 -0
- package/dist/components/grid/grid-row.js +92 -0
- package/dist/components/grid/grid.d.ts +13 -0
- package/dist/components/grid/grid.d.ts.map +1 -0
- package/dist/components/grid/grid.js +42 -0
- package/dist/components/icon/icon-paths.d.ts +116 -0
- package/dist/components/icon/icon-paths.d.ts.map +1 -0
- package/dist/components/icon/icon-paths.js +121 -0
- package/dist/components/icon/icon.d.ts +16 -0
- package/dist/components/icon/icon.d.ts.map +1 -0
- package/dist/components/icon/icon.js +95 -0
- package/dist/components/input/input.d.ts +31 -0
- package/dist/components/input/input.d.ts.map +1 -0
- package/dist/components/input/input.js +268 -0
- package/dist/components/link/link.d.ts +16 -0
- package/dist/components/link/link.d.ts.map +1 -0
- package/dist/components/link/link.js +116 -0
- package/dist/components/metadata/metadata.d.ts +18 -0
- package/dist/components/metadata/metadata.d.ts.map +1 -0
- package/dist/components/metadata/metadata.js +71 -0
- package/dist/components/modal/modal.d.ts +24 -0
- package/dist/components/modal/modal.d.ts.map +1 -0
- package/dist/components/modal/modal.js +163 -0
- package/dist/components/page-layout/page-layout.d.ts +46 -0
- package/dist/components/page-layout/page-layout.d.ts.map +1 -0
- package/dist/components/page-layout/page-layout.js +697 -0
- package/dist/components/radio/radio.d.ts +16 -0
- package/dist/components/radio/radio.d.ts.map +1 -0
- package/dist/components/radio/radio.js +152 -0
- package/dist/components/radio-group/radio-group.d.ts +27 -0
- package/dist/components/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group/radio-group.js +161 -0
- package/dist/components/router/router.d.ts +7 -0
- package/dist/components/router/router.d.ts.map +1 -0
- package/dist/components/router/router.js +37 -0
- package/dist/components/select/select.d.ts +16 -0
- package/dist/components/select/select.d.ts.map +1 -0
- package/dist/components/select/select.js +172 -0
- package/dist/components/skeleton/skeleton.d.ts +17 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +78 -0
- package/dist/components/switch/switch.d.ts +25 -0
- package/dist/components/switch/switch.d.ts.map +1 -0
- package/dist/components/switch/switch.js +185 -0
- package/dist/components/table/data-table.d.ts +72 -0
- package/dist/components/table/data-table.d.ts.map +1 -0
- package/dist/components/table/data-table.js +551 -0
- package/dist/components/table/table.d.ts +22 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +167 -0
- package/dist/components/tabs/tab-panel.d.ts +8 -0
- package/dist/components/tabs/tab-panel.d.ts.map +1 -0
- package/dist/components/tabs/tab-panel.js +46 -0
- package/dist/components/tabs/tab.d.ts +9 -0
- package/dist/components/tabs/tab.d.ts.map +1 -0
- package/dist/components/tabs/tab.js +91 -0
- package/dist/components/tabs/tabs.d.ts +14 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.js +85 -0
- package/dist/components/textarea/textarea.d.ts +36 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -0
- package/dist/components/textarea/textarea.js +231 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts +15 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.js +130 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts +9 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-group.js +111 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts +8 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-item.js +65 -0
- package/dist/styles/index.css +171 -0
- package/dist/styles/reset.d.ts +2 -0
- package/dist/styles/reset.d.ts.map +1 -0
- package/dist/styles/reset.js +50 -0
- package/package.json +3 -2
- package/src/components/alert/alert.ts +100 -100
- package/src/components/badge/badge.ts +96 -96
- package/src/components/breadcrumb/breadcrumb.ts +98 -98
- package/src/components/button/button.ts +281 -281
- package/src/components/button-group/button-group.ts +67 -67
- package/src/components/card/card.ts +52 -52
- package/src/components/checkbox/checkbox.ts +238 -238
- package/src/components/code-block/code-block.ts +256 -256
- package/src/components/content-card/content-card.ts +133 -133
- package/src/components/divider/divider.ts +68 -68
- package/src/components/drawer/drawer.ts +217 -217
- package/src/components/field/field.ts +30 -30
- package/src/components/footer/footer.ts +58 -58
- package/src/components/form/form-step.ts +32 -32
- package/src/components/form/form.ts +376 -376
- package/src/components/grid/grid-row.ts +75 -75
- package/src/components/grid/grid.ts +36 -36
- package/src/components/icon/icon-paths.ts +124 -124
- package/src/components/icon/icon.ts +82 -82
- package/src/components/input/input.ts +248 -248
- package/src/components/link/link.ts +97 -97
- package/src/components/metadata/metadata.ts +66 -66
- package/src/components/modal/modal.ts +158 -158
- package/src/components/page-layout/page-layout.ts +704 -704
- package/src/components/radio/radio.ts +142 -142
- package/src/components/radio-group/radio-group.ts +157 -157
- package/src/components/router/router.ts +46 -46
- package/src/components/select/select.ts +161 -161
- package/src/components/skeleton/skeleton.ts +67 -67
- package/src/components/switch/switch.ts +181 -181
- package/src/components/table/data-table.ts +556 -556
- package/src/components/table/table.ts +153 -153
- package/src/components/tabs/tab-panel.ts +30 -30
- package/src/components/tabs/tab.ts +76 -76
- package/src/components/tabs/tabs.ts +88 -88
- package/src/components/textarea/textarea.ts +215 -215
- package/src/components/theme-toggle/theme-toggle.ts +131 -131
- package/src/components/vertical-nav/vertical-nav-group.ts +96 -96
- package/src/components/vertical-nav/vertical-nav-item.ts +49 -49
- package/src/styles/globals.css +58 -58
- package/src/styles/index.css +80 -80
- package/src/styles/reset.ts +50 -50
- package/src/styles/theme.css +58 -58
- package/src/styles/typography.css +25 -25
- package/tsconfig.json +15 -15
|
@@ -1,154 +1,154 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
export type TableMode = 'horizontal' | 'vertical';
|
|
6
|
-
|
|
7
|
-
export interface TableColumn {
|
|
8
|
-
header: string;
|
|
9
|
-
key: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@customElement('st-table')
|
|
13
|
-
export class StTable extends LitElement {
|
|
14
|
-
@property({ type: Array }) columns: TableColumn[] = [];
|
|
15
|
-
@property({ type: Array }) data: Record<string, any>[] = [];
|
|
16
|
-
|
|
17
|
-
@property({ type: String, reflect: true }) mode: TableMode = 'horizontal';
|
|
18
|
-
@property({ type: Boolean, reflect: true }) striped = false;
|
|
19
|
-
@property({ type: Boolean, reflect: true }) hoverable = false;
|
|
20
|
-
@property({ type: Boolean, reflect: true }) dense = false;
|
|
21
|
-
|
|
22
|
-
static styles = [
|
|
23
|
-
resetStyles,
|
|
24
|
-
css`
|
|
25
|
-
:host {
|
|
26
|
-
display: block;
|
|
27
|
-
width: 100%;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.table-wrapper {
|
|
31
|
-
width: 100%;
|
|
32
|
-
overflow-x: auto;
|
|
33
|
-
-webkit-overflow-scrolling: touch;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
table {
|
|
37
|
-
width: 100%;
|
|
38
|
-
border-collapse: collapse;
|
|
39
|
-
text-align: left;
|
|
40
|
-
font-size: var(--st-font-size-base, 1rem);
|
|
41
|
-
color: var(--st-color-text);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
th {
|
|
45
|
-
font-weight: 600;
|
|
46
|
-
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
47
|
-
border-bottom: 2px solid var(--st-color-border);
|
|
48
|
-
color: var(--st-color-text-muted);
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
td {
|
|
53
|
-
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
54
|
-
border-bottom: 1px solid var(--st-color-border);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* Modifiers */
|
|
58
|
-
:host([dense]) th,
|
|
59
|
-
:host([dense]) td {
|
|
60
|
-
padding: var(--st-spacing-sm) var(--st-spacing-md);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:host([striped]) tbody tr:nth-of-type(odd) {
|
|
64
|
-
background-color: var(--st-color-surface-muted);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:host([hoverable]) tbody tr:hover {
|
|
68
|
-
background-color: var(--st-color-surface-hover);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* ==========================================================
|
|
72
|
-
Vertical Mode (Responsive Stacked Cards)
|
|
73
|
-
========================================================== */
|
|
74
|
-
:host([mode="vertical"]) table,
|
|
75
|
-
:host([mode="vertical"]) tbody,
|
|
76
|
-
:host([mode="vertical"]) tr,
|
|
77
|
-
:host([mode="vertical"]) td {
|
|
78
|
-
display: block;
|
|
79
|
-
width: 100%;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/* Visually hide header but keep for screen readers */
|
|
83
|
-
:host([mode="vertical"]) thead {
|
|
84
|
-
position: absolute;
|
|
85
|
-
width: 1px;
|
|
86
|
-
height: 1px;
|
|
87
|
-
padding: 0;
|
|
88
|
-
margin: -1px;
|
|
89
|
-
overflow: hidden;
|
|
90
|
-
clip: rect(0, 0, 0, 0);
|
|
91
|
-
white-space: nowrap;
|
|
92
|
-
border: 0;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
:host([mode="vertical"]) tr {
|
|
96
|
-
margin-bottom: var(--st-spacing-md);
|
|
97
|
-
border: 1px solid var(--st-color-border);
|
|
98
|
-
border-radius: var(--st-radius-md);
|
|
99
|
-
background-color: var(--st-color-surface);
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
:host([mode="vertical"]) td {
|
|
104
|
-
display: flex;
|
|
105
|
-
justify-content: space-between;
|
|
106
|
-
align-items: center;
|
|
107
|
-
border-bottom: 1px solid var(--st-color-border);
|
|
108
|
-
text-align: right;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
:host([mode="vertical"]) td:last-child {
|
|
112
|
-
border-bottom: none;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
/* Inject the header name on the left */
|
|
116
|
-
:host([mode="vertical"]) td::before {
|
|
117
|
-
content: attr(data-label);
|
|
118
|
-
font-weight: 600;
|
|
119
|
-
text-align: left;
|
|
120
|
-
padding-right: var(--st-spacing-md);
|
|
121
|
-
color: var(--st-color-text-muted);
|
|
122
|
-
}
|
|
123
|
-
`
|
|
124
|
-
];
|
|
125
|
-
|
|
126
|
-
render() {
|
|
127
|
-
return html`
|
|
128
|
-
<div class="table-wrapper">
|
|
129
|
-
<table>
|
|
130
|
-
<thead>
|
|
131
|
-
<tr>
|
|
132
|
-
${this.columns.map(col => html`<th scope="col">${col.header}</th>`)}
|
|
133
|
-
</tr>
|
|
134
|
-
</thead>
|
|
135
|
-
<tbody>
|
|
136
|
-
${this.data.map(row => html`
|
|
137
|
-
<tr>
|
|
138
|
-
${this.columns.map(col => html`
|
|
139
|
-
<td data-label=${col.header}>${row[col.key]}</td>
|
|
140
|
-
`)}
|
|
141
|
-
</tr>
|
|
142
|
-
`)}
|
|
143
|
-
</tbody>
|
|
144
|
-
</table>
|
|
145
|
-
</div>
|
|
146
|
-
`;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
declare global {
|
|
151
|
-
interface HTMLElementTagNameMap {
|
|
152
|
-
'st-table': StTable;
|
|
153
|
-
}
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
export type TableMode = 'horizontal' | 'vertical';
|
|
6
|
+
|
|
7
|
+
export interface TableColumn {
|
|
8
|
+
header: string;
|
|
9
|
+
key: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@customElement('st-table')
|
|
13
|
+
export class StTable extends LitElement {
|
|
14
|
+
@property({ type: Array }) columns: TableColumn[] = [];
|
|
15
|
+
@property({ type: Array }) data: Record<string, any>[] = [];
|
|
16
|
+
|
|
17
|
+
@property({ type: String, reflect: true }) mode: TableMode = 'horizontal';
|
|
18
|
+
@property({ type: Boolean, reflect: true }) striped = false;
|
|
19
|
+
@property({ type: Boolean, reflect: true }) hoverable = false;
|
|
20
|
+
@property({ type: Boolean, reflect: true }) dense = false;
|
|
21
|
+
|
|
22
|
+
static styles = [
|
|
23
|
+
resetStyles,
|
|
24
|
+
css`
|
|
25
|
+
:host {
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.table-wrapper {
|
|
31
|
+
width: 100%;
|
|
32
|
+
overflow-x: auto;
|
|
33
|
+
-webkit-overflow-scrolling: touch;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
table {
|
|
37
|
+
width: 100%;
|
|
38
|
+
border-collapse: collapse;
|
|
39
|
+
text-align: left;
|
|
40
|
+
font-size: var(--st-font-size-base, 1rem);
|
|
41
|
+
color: var(--st-color-text);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
th {
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
47
|
+
border-bottom: 2px solid var(--st-color-border);
|
|
48
|
+
color: var(--st-color-text-muted);
|
|
49
|
+
white-space: nowrap;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
td {
|
|
53
|
+
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
54
|
+
border-bottom: 1px solid var(--st-color-border);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/* Modifiers */
|
|
58
|
+
:host([dense]) th,
|
|
59
|
+
:host([dense]) td {
|
|
60
|
+
padding: var(--st-spacing-sm) var(--st-spacing-md);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([striped]) tbody tr:nth-of-type(odd) {
|
|
64
|
+
background-color: var(--st-color-surface-muted);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
:host([hoverable]) tbody tr:hover {
|
|
68
|
+
background-color: var(--st-color-surface-hover);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* ==========================================================
|
|
72
|
+
Vertical Mode (Responsive Stacked Cards)
|
|
73
|
+
========================================================== */
|
|
74
|
+
:host([mode="vertical"]) table,
|
|
75
|
+
:host([mode="vertical"]) tbody,
|
|
76
|
+
:host([mode="vertical"]) tr,
|
|
77
|
+
:host([mode="vertical"]) td {
|
|
78
|
+
display: block;
|
|
79
|
+
width: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Visually hide header but keep for screen readers */
|
|
83
|
+
:host([mode="vertical"]) thead {
|
|
84
|
+
position: absolute;
|
|
85
|
+
width: 1px;
|
|
86
|
+
height: 1px;
|
|
87
|
+
padding: 0;
|
|
88
|
+
margin: -1px;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
clip: rect(0, 0, 0, 0);
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
border: 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
:host([mode="vertical"]) tr {
|
|
96
|
+
margin-bottom: var(--st-spacing-md);
|
|
97
|
+
border: 1px solid var(--st-color-border);
|
|
98
|
+
border-radius: var(--st-radius-md);
|
|
99
|
+
background-color: var(--st-color-surface);
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
:host([mode="vertical"]) td {
|
|
104
|
+
display: flex;
|
|
105
|
+
justify-content: space-between;
|
|
106
|
+
align-items: center;
|
|
107
|
+
border-bottom: 1px solid var(--st-color-border);
|
|
108
|
+
text-align: right;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
:host([mode="vertical"]) td:last-child {
|
|
112
|
+
border-bottom: none;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/* Inject the header name on the left */
|
|
116
|
+
:host([mode="vertical"]) td::before {
|
|
117
|
+
content: attr(data-label);
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
text-align: left;
|
|
120
|
+
padding-right: var(--st-spacing-md);
|
|
121
|
+
color: var(--st-color-text-muted);
|
|
122
|
+
}
|
|
123
|
+
`
|
|
124
|
+
];
|
|
125
|
+
|
|
126
|
+
render() {
|
|
127
|
+
return html`
|
|
128
|
+
<div class="table-wrapper">
|
|
129
|
+
<table>
|
|
130
|
+
<thead>
|
|
131
|
+
<tr>
|
|
132
|
+
${this.columns.map(col => html`<th scope="col">${col.header}</th>`)}
|
|
133
|
+
</tr>
|
|
134
|
+
</thead>
|
|
135
|
+
<tbody>
|
|
136
|
+
${this.data.map(row => html`
|
|
137
|
+
<tr>
|
|
138
|
+
${this.columns.map(col => html`
|
|
139
|
+
<td data-label=${col.header}>${row[col.key]}</td>
|
|
140
|
+
`)}
|
|
141
|
+
</tr>
|
|
142
|
+
`)}
|
|
143
|
+
</tbody>
|
|
144
|
+
</table>
|
|
145
|
+
</div>
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare global {
|
|
151
|
+
interface HTMLElementTagNameMap {
|
|
152
|
+
'st-table': StTable;
|
|
153
|
+
}
|
|
154
154
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
@customElement('st-tab-panel')
|
|
6
|
-
export class StTabPanel extends LitElement {
|
|
7
|
-
@property({ type: String, reflect: true }) name = '';
|
|
8
|
-
@property({ type: Boolean, reflect: true }) active = false;
|
|
9
|
-
|
|
10
|
-
static styles = [
|
|
11
|
-
resetStyles,
|
|
12
|
-
css`
|
|
13
|
-
:host {
|
|
14
|
-
display: block;
|
|
15
|
-
padding: var(--st-spacing-md) 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
:host(:not([active])) {
|
|
19
|
-
display: none;
|
|
20
|
-
}
|
|
21
|
-
`
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
render() {
|
|
25
|
-
return html`
|
|
26
|
-
<div role="tabpanel" aria-hidden=${this.active ? 'false' : 'true'}>
|
|
27
|
-
<slot></slot>
|
|
28
|
-
</div>
|
|
29
|
-
`;
|
|
30
|
-
}
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
@customElement('st-tab-panel')
|
|
6
|
+
export class StTabPanel extends LitElement {
|
|
7
|
+
@property({ type: String, reflect: true }) name = '';
|
|
8
|
+
@property({ type: Boolean, reflect: true }) active = false;
|
|
9
|
+
|
|
10
|
+
static styles = [
|
|
11
|
+
resetStyles,
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
display: block;
|
|
15
|
+
padding: var(--st-spacing-md) 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
:host(:not([active])) {
|
|
19
|
+
display: none;
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
render() {
|
|
25
|
+
return html`
|
|
26
|
+
<div role="tabpanel" aria-hidden=${this.active ? 'false' : 'true'}>
|
|
27
|
+
<slot></slot>
|
|
28
|
+
</div>
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
31
31
|
}
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
@customElement('st-tab')
|
|
6
|
-
export class StTab extends LitElement {
|
|
7
|
-
@property({ type: String, reflect: true }) panel = '';
|
|
8
|
-
@property({ type: Boolean, reflect: true }) active = false;
|
|
9
|
-
|
|
10
|
-
static styles = [
|
|
11
|
-
resetStyles,
|
|
12
|
-
css`
|
|
13
|
-
:host {
|
|
14
|
-
display: inline-block;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
button {
|
|
18
|
-
display: inline-flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
gap: var(--st-spacing-sm);
|
|
21
|
-
background: transparent;
|
|
22
|
-
border: none;
|
|
23
|
-
border-bottom: 2px solid transparent;
|
|
24
|
-
padding: var(--st-spacing-sm) var(--st-spacing-md);
|
|
25
|
-
color: var(--st-color-text-muted);
|
|
26
|
-
font-size: var(--st-font-size-sm);
|
|
27
|
-
font-weight: var(--st-font-weight-medium);
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
transition: all 0.2s ease;
|
|
30
|
-
white-space: nowrap;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
button:hover {
|
|
34
|
-
color: var(--st-color-text);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
button:focus-visible {
|
|
38
|
-
outline: none;
|
|
39
|
-
background-color: var(--st-color-surface);
|
|
40
|
-
border-radius: 4px 4px 0 0;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/* Active State */
|
|
44
|
-
:host([active]) button {
|
|
45
|
-
color: var(--st-color-primary);
|
|
46
|
-
border-bottom-color: var(--st-color-primary);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
::slotted(svg) {
|
|
50
|
-
width: 1.125rem;
|
|
51
|
-
height: 1.125rem;
|
|
52
|
-
fill: currentColor;
|
|
53
|
-
}
|
|
54
|
-
`
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
private _handleClick() {
|
|
58
|
-
this.dispatchEvent(new CustomEvent('st-tab-select', {
|
|
59
|
-
detail: { panel: this.panel },
|
|
60
|
-
bubbles: true,
|
|
61
|
-
composed: true
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
render() {
|
|
66
|
-
return html`
|
|
67
|
-
<button
|
|
68
|
-
role="tab"
|
|
69
|
-
aria-selected=${this.active ? 'true' : 'false'}
|
|
70
|
-
tabindex=${this.active ? '0' : '-1'}
|
|
71
|
-
@click=${this._handleClick}
|
|
72
|
-
>
|
|
73
|
-
<slot></slot>
|
|
74
|
-
</button>
|
|
75
|
-
`;
|
|
76
|
-
}
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
@customElement('st-tab')
|
|
6
|
+
export class StTab extends LitElement {
|
|
7
|
+
@property({ type: String, reflect: true }) panel = '';
|
|
8
|
+
@property({ type: Boolean, reflect: true }) active = false;
|
|
9
|
+
|
|
10
|
+
static styles = [
|
|
11
|
+
resetStyles,
|
|
12
|
+
css`
|
|
13
|
+
:host {
|
|
14
|
+
display: inline-block;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
button {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--st-spacing-sm);
|
|
21
|
+
background: transparent;
|
|
22
|
+
border: none;
|
|
23
|
+
border-bottom: 2px solid transparent;
|
|
24
|
+
padding: var(--st-spacing-sm) var(--st-spacing-md);
|
|
25
|
+
color: var(--st-color-text-muted);
|
|
26
|
+
font-size: var(--st-font-size-sm);
|
|
27
|
+
font-weight: var(--st-font-weight-medium);
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
transition: all 0.2s ease;
|
|
30
|
+
white-space: nowrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
button:hover {
|
|
34
|
+
color: var(--st-color-text);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
button:focus-visible {
|
|
38
|
+
outline: none;
|
|
39
|
+
background-color: var(--st-color-surface);
|
|
40
|
+
border-radius: 4px 4px 0 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* Active State */
|
|
44
|
+
:host([active]) button {
|
|
45
|
+
color: var(--st-color-primary);
|
|
46
|
+
border-bottom-color: var(--st-color-primary);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
::slotted(svg) {
|
|
50
|
+
width: 1.125rem;
|
|
51
|
+
height: 1.125rem;
|
|
52
|
+
fill: currentColor;
|
|
53
|
+
}
|
|
54
|
+
`
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
private _handleClick() {
|
|
58
|
+
this.dispatchEvent(new CustomEvent('st-tab-select', {
|
|
59
|
+
detail: { panel: this.panel },
|
|
60
|
+
bubbles: true,
|
|
61
|
+
composed: true
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
render() {
|
|
66
|
+
return html`
|
|
67
|
+
<button
|
|
68
|
+
role="tab"
|
|
69
|
+
aria-selected=${this.active ? 'true' : 'false'}
|
|
70
|
+
tabindex=${this.active ? '0' : '-1'}
|
|
71
|
+
@click=${this._handleClick}
|
|
72
|
+
>
|
|
73
|
+
<slot></slot>
|
|
74
|
+
</button>
|
|
75
|
+
`;
|
|
76
|
+
}
|
|
77
77
|
}
|