@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,134 +1,134 @@
|
|
|
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-content-card')
|
|
6
|
-
export class StContentCard extends LitElement {
|
|
7
|
-
// Use href to align with native HTML web standards
|
|
8
|
-
@property({ type: String }) href?: string;
|
|
9
|
-
@property({ type: String }) target: '_blank' | '_self' = '_self';
|
|
10
|
-
|
|
11
|
-
static styles = [
|
|
12
|
-
resetStyles,
|
|
13
|
-
css`
|
|
14
|
-
:host {
|
|
15
|
-
display: block;
|
|
16
|
-
/* Ensures cards stretch to equal heights if placed in a flex/grid container */
|
|
17
|
-
height: 100%;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.card {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
height: 100%;
|
|
24
|
-
background-color: var(--st-color-surface);
|
|
25
|
-
border: 1px solid var(--st-color-border);
|
|
26
|
-
border-radius: var(--st-radius-md, 0.5rem);
|
|
27
|
-
overflow: hidden;
|
|
28
|
-
text-decoration: none;
|
|
29
|
-
color: inherit;
|
|
30
|
-
|
|
31
|
-
/* Smooth transitions for the hover effects */
|
|
32
|
-
transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* ==========================================================
|
|
36
|
-
Hover Effects (Only applied if it is a link)
|
|
37
|
-
========================================================== */
|
|
38
|
-
a.card {
|
|
39
|
-
cursor: pointer;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
a.card:hover,
|
|
43
|
-
a.card:focus-visible {
|
|
44
|
-
outline: none;
|
|
45
|
-
border-color: var(--st-color-primary);
|
|
46
|
-
transform: translateY(-2px);
|
|
47
|
-
/* Subtle shadow to lift the card off the background */
|
|
48
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/* Dark mode specific shadow adjustment */
|
|
52
|
-
:host-context([data-theme="dark"]) a.card:hover {
|
|
53
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/* ==========================================================
|
|
57
|
-
Internal Layout
|
|
58
|
-
========================================================== */
|
|
59
|
-
.media {
|
|
60
|
-
display: flex;
|
|
61
|
-
align-items: center;
|
|
62
|
-
justify-content: center;
|
|
63
|
-
aspect-ratio: 16 / 9;
|
|
64
|
-
background-color: var(--st-color-bg);
|
|
65
|
-
border-bottom: 1px solid var(--st-color-border);
|
|
66
|
-
overflow: hidden;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/* Image formatting */
|
|
70
|
-
::slotted(img[slot="media"]) {
|
|
71
|
-
width: 100%;
|
|
72
|
-
height: 100%;
|
|
73
|
-
object-fit: cover;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/* SVG formatting (for the icons we just created) */
|
|
77
|
-
::slotted(svg[slot="media"]) {
|
|
78
|
-
width: 3rem;
|
|
79
|
-
height: 3rem;
|
|
80
|
-
color: var(--st-color-primary);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.content {
|
|
84
|
-
display: flex;
|
|
85
|
-
flex-direction: column;
|
|
86
|
-
padding: var(--st-spacing-md, 1.25rem);
|
|
87
|
-
gap: var(--st-spacing-sm, 0.5rem);
|
|
88
|
-
flex: 1;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.title {
|
|
92
|
-
font-weight: 600;
|
|
93
|
-
font-size: 1.125rem;
|
|
94
|
-
color: var(--st-color-text);
|
|
95
|
-
margin: 0;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.body {
|
|
99
|
-
color: var(--st-color-text-muted);
|
|
100
|
-
font-size: 0.875rem;
|
|
101
|
-
margin: 0;
|
|
102
|
-
line-height: 1.5;
|
|
103
|
-
}
|
|
104
|
-
`
|
|
105
|
-
];
|
|
106
|
-
|
|
107
|
-
render() {
|
|
108
|
-
// 1. Define the inner content once to avoid duplication
|
|
109
|
-
const innerContent = html`
|
|
110
|
-
<div class="media">
|
|
111
|
-
<slot name="media"></slot>
|
|
112
|
-
</div>
|
|
113
|
-
<div class="content">
|
|
114
|
-
<div class="title">
|
|
115
|
-
<slot name="title"></slot>
|
|
116
|
-
</div>
|
|
117
|
-
<div class="body">
|
|
118
|
-
<slot></slot>
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
`;
|
|
122
|
-
|
|
123
|
-
// 2. Conditionally wrap it in an anchor or a div
|
|
124
|
-
return this.href
|
|
125
|
-
? html`<a href="${this.href}" target="${this.target}" class="card">${innerContent}</a>`
|
|
126
|
-
: html`<div class="card">${innerContent}</div>`;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
declare global {
|
|
131
|
-
interface HTMLElementTagNameMap {
|
|
132
|
-
'st-content-card': StContentCard;
|
|
133
|
-
}
|
|
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-content-card')
|
|
6
|
+
export class StContentCard extends LitElement {
|
|
7
|
+
// Use href to align with native HTML web standards
|
|
8
|
+
@property({ type: String }) href?: string;
|
|
9
|
+
@property({ type: String }) target: '_blank' | '_self' = '_self';
|
|
10
|
+
|
|
11
|
+
static styles = [
|
|
12
|
+
resetStyles,
|
|
13
|
+
css`
|
|
14
|
+
:host {
|
|
15
|
+
display: block;
|
|
16
|
+
/* Ensures cards stretch to equal heights if placed in a flex/grid container */
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.card {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
height: 100%;
|
|
24
|
+
background-color: var(--st-color-surface);
|
|
25
|
+
border: 1px solid var(--st-color-border);
|
|
26
|
+
border-radius: var(--st-radius-md, 0.5rem);
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
color: inherit;
|
|
30
|
+
|
|
31
|
+
/* Smooth transitions for the hover effects */
|
|
32
|
+
transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* ==========================================================
|
|
36
|
+
Hover Effects (Only applied if it is a link)
|
|
37
|
+
========================================================== */
|
|
38
|
+
a.card {
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
a.card:hover,
|
|
43
|
+
a.card:focus-visible {
|
|
44
|
+
outline: none;
|
|
45
|
+
border-color: var(--st-color-primary);
|
|
46
|
+
transform: translateY(-2px);
|
|
47
|
+
/* Subtle shadow to lift the card off the background */
|
|
48
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* Dark mode specific shadow adjustment */
|
|
52
|
+
:host-context([data-theme="dark"]) a.card:hover {
|
|
53
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* ==========================================================
|
|
57
|
+
Internal Layout
|
|
58
|
+
========================================================== */
|
|
59
|
+
.media {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
aspect-ratio: 16 / 9;
|
|
64
|
+
background-color: var(--st-color-bg);
|
|
65
|
+
border-bottom: 1px solid var(--st-color-border);
|
|
66
|
+
overflow: hidden;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/* Image formatting */
|
|
70
|
+
::slotted(img[slot="media"]) {
|
|
71
|
+
width: 100%;
|
|
72
|
+
height: 100%;
|
|
73
|
+
object-fit: cover;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* SVG formatting (for the icons we just created) */
|
|
77
|
+
::slotted(svg[slot="media"]) {
|
|
78
|
+
width: 3rem;
|
|
79
|
+
height: 3rem;
|
|
80
|
+
color: var(--st-color-primary);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.content {
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
padding: var(--st-spacing-md, 1.25rem);
|
|
87
|
+
gap: var(--st-spacing-sm, 0.5rem);
|
|
88
|
+
flex: 1;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.title {
|
|
92
|
+
font-weight: 600;
|
|
93
|
+
font-size: 1.125rem;
|
|
94
|
+
color: var(--st-color-text);
|
|
95
|
+
margin: 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.body {
|
|
99
|
+
color: var(--st-color-text-muted);
|
|
100
|
+
font-size: 0.875rem;
|
|
101
|
+
margin: 0;
|
|
102
|
+
line-height: 1.5;
|
|
103
|
+
}
|
|
104
|
+
`
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
render() {
|
|
108
|
+
// 1. Define the inner content once to avoid duplication
|
|
109
|
+
const innerContent = html`
|
|
110
|
+
<div class="media">
|
|
111
|
+
<slot name="media"></slot>
|
|
112
|
+
</div>
|
|
113
|
+
<div class="content">
|
|
114
|
+
<div class="title">
|
|
115
|
+
<slot name="title"></slot>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="body">
|
|
118
|
+
<slot></slot>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
// 2. Conditionally wrap it in an anchor or a div
|
|
124
|
+
return this.href
|
|
125
|
+
? html`<a href="${this.href}" target="${this.target}" class="card">${innerContent}</a>`
|
|
126
|
+
: html`<div class="card">${innerContent}</div>`;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
declare global {
|
|
131
|
+
interface HTMLElementTagNameMap {
|
|
132
|
+
'st-content-card': StContentCard;
|
|
133
|
+
}
|
|
134
134
|
}
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit';
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset';
|
|
4
|
-
|
|
5
|
-
@customElement('st-divider')
|
|
6
|
-
export class StDivider extends LitElement {
|
|
7
|
-
@property({ type: String, reflect: true }) direction: 'horizontal' | 'vertical' = 'horizontal';
|
|
8
|
-
@property({ type: String }) thickness = '1px';
|
|
9
|
-
@property({ type: String }) margin = '0';
|
|
10
|
-
@property({ type: String, reflect: true }) color: 'default' | 'primary' | 'border' = 'border';
|
|
11
|
-
|
|
12
|
-
static styles = [
|
|
13
|
-
resetStyles,
|
|
14
|
-
css`
|
|
15
|
-
:host {
|
|
16
|
-
display: block;
|
|
17
|
-
background-color: var(--divider-color, var(--st-color-border));
|
|
18
|
-
margin: var(--divider-margin, 0);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/* Horizontal Layout */
|
|
22
|
-
:host([direction="horizontal"]) {
|
|
23
|
-
width: 100%;
|
|
24
|
-
height: var(--divider-thickness, 1px);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Vertical Layout */
|
|
28
|
-
:host([direction="vertical"]) {
|
|
29
|
-
width: var(--divider-thickness, 1px);
|
|
30
|
-
height: 100%;
|
|
31
|
-
display: inline-block;
|
|
32
|
-
vertical-align: middle;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* Color Variants */
|
|
36
|
-
:host([color="primary"]) {
|
|
37
|
-
background-color: var(--st-color-primary);
|
|
38
|
-
}
|
|
39
|
-
:host([color="default"]) {
|
|
40
|
-
background-color: var(--st-color-text);
|
|
41
|
-
opacity: 0.2;
|
|
42
|
-
}
|
|
43
|
-
`
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
updated(changedProperties: Map<string, any>) {
|
|
47
|
-
super.updated(changedProperties);
|
|
48
|
-
|
|
49
|
-
// Sync properties to CSS variables for dynamic adjustment
|
|
50
|
-
this.style.setProperty('--divider-thickness', this.thickness);
|
|
51
|
-
this.style.setProperty('--divider-margin', this.margin);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
render() {
|
|
55
|
-
// Accessibility: Set role and aria-orientation
|
|
56
|
-
return html`
|
|
57
|
-
<div
|
|
58
|
-
role="separator"
|
|
59
|
-
aria-orientation="${this.direction === 'horizontal' ? 'horizontal' : 'vertical'}"
|
|
60
|
-
></div>
|
|
61
|
-
`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare global {
|
|
66
|
-
interface HTMLElementTagNameMap {
|
|
67
|
-
'st-divider': StDivider;
|
|
68
|
-
}
|
|
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-divider')
|
|
6
|
+
export class StDivider extends LitElement {
|
|
7
|
+
@property({ type: String, reflect: true }) direction: 'horizontal' | 'vertical' = 'horizontal';
|
|
8
|
+
@property({ type: String }) thickness = '1px';
|
|
9
|
+
@property({ type: String }) margin = '0';
|
|
10
|
+
@property({ type: String, reflect: true }) color: 'default' | 'primary' | 'border' = 'border';
|
|
11
|
+
|
|
12
|
+
static styles = [
|
|
13
|
+
resetStyles,
|
|
14
|
+
css`
|
|
15
|
+
:host {
|
|
16
|
+
display: block;
|
|
17
|
+
background-color: var(--divider-color, var(--st-color-border));
|
|
18
|
+
margin: var(--divider-margin, 0);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/* Horizontal Layout */
|
|
22
|
+
:host([direction="horizontal"]) {
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: var(--divider-thickness, 1px);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* Vertical Layout */
|
|
28
|
+
:host([direction="vertical"]) {
|
|
29
|
+
width: var(--divider-thickness, 1px);
|
|
30
|
+
height: 100%;
|
|
31
|
+
display: inline-block;
|
|
32
|
+
vertical-align: middle;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Color Variants */
|
|
36
|
+
:host([color="primary"]) {
|
|
37
|
+
background-color: var(--st-color-primary);
|
|
38
|
+
}
|
|
39
|
+
:host([color="default"]) {
|
|
40
|
+
background-color: var(--st-color-text);
|
|
41
|
+
opacity: 0.2;
|
|
42
|
+
}
|
|
43
|
+
`
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
updated(changedProperties: Map<string, any>) {
|
|
47
|
+
super.updated(changedProperties);
|
|
48
|
+
|
|
49
|
+
// Sync properties to CSS variables for dynamic adjustment
|
|
50
|
+
this.style.setProperty('--divider-thickness', this.thickness);
|
|
51
|
+
this.style.setProperty('--divider-margin', this.margin);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
render() {
|
|
55
|
+
// Accessibility: Set role and aria-orientation
|
|
56
|
+
return html`
|
|
57
|
+
<div
|
|
58
|
+
role="separator"
|
|
59
|
+
aria-orientation="${this.direction === 'horizontal' ? 'horizontal' : 'vertical'}"
|
|
60
|
+
></div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
'st-divider': StDivider;
|
|
68
|
+
}
|
|
69
69
|
}
|