@sveltia/ui 0.7.0 → 0.7.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/package/components/button/button.svelte +25 -4
- package/package/components/checkbox/checkbox.svelte +1 -1
- package/package/components/dialog/dialog.svelte +1 -1
- package/package/components/drawer/drawer.svelte +1 -1
- package/package/components/select/combobox.svelte +1 -1
- package/package/components/switch/switch.svelte +2 -2
- package/package/components/toast/toast.svelte +37 -36
- package/package/components/util/app-shell.svelte +6 -6
- package/package/components/util/popup.svelte +1 -1
- package/package/services/group.js +2 -2
- package/package/styles/variables.scss +7 -7
- package/package.json +6 -6
|
@@ -127,10 +127,24 @@
|
|
|
127
127
|
on:select
|
|
128
128
|
>
|
|
129
129
|
<slot name="start-icon" />
|
|
130
|
-
{#if
|
|
131
|
-
|
|
130
|
+
{#if variant === 'link'}
|
|
131
|
+
{#if label}
|
|
132
|
+
<span class="label">
|
|
133
|
+
{label}
|
|
134
|
+
</span>
|
|
135
|
+
{:else}
|
|
136
|
+
<span class="label">
|
|
137
|
+
<slot />
|
|
138
|
+
</span>
|
|
139
|
+
{/if}
|
|
140
|
+
{:else}
|
|
141
|
+
{#if label}
|
|
142
|
+
<span class="label">
|
|
143
|
+
{label}
|
|
144
|
+
</span>
|
|
145
|
+
{/if}
|
|
146
|
+
<slot />
|
|
132
147
|
{/if}
|
|
133
|
-
<slot />
|
|
134
148
|
<slot name="end-icon" />
|
|
135
149
|
</button>
|
|
136
150
|
|
|
@@ -226,9 +240,16 @@ button:global(.ghost)[aria-pressed=true] {
|
|
|
226
240
|
}
|
|
227
241
|
button:global(.link) {
|
|
228
242
|
outline: 0;
|
|
243
|
+
border-radius: 0 !important;
|
|
244
|
+
padding: 0 !important;
|
|
245
|
+
height: auto !important;
|
|
229
246
|
color: var(--sui-primary-accent-color-text);
|
|
230
247
|
}
|
|
231
|
-
button:global(.link)
|
|
248
|
+
button:global(.link) :global(.label) {
|
|
249
|
+
line-height: var(--sui-line-height-compact);
|
|
250
|
+
white-space: normal;
|
|
251
|
+
}
|
|
252
|
+
button:global(.link):hover :global(.label), button:global(.link):focus :global(.label), button:global(.link):active :global(.label) {
|
|
232
253
|
text-decoration: underline;
|
|
233
254
|
}
|
|
234
255
|
button:global(.small) {
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
transition: all 200ms;
|
|
165
165
|
}
|
|
166
166
|
.checkbox :global(button) :global(.icon) {
|
|
167
|
-
font-size: calc(var(--sui-checkbox-height) -
|
|
167
|
+
font-size: calc(var(--sui-checkbox-height) - 2px);
|
|
168
168
|
}
|
|
169
169
|
.checkbox :global(button[aria-checked="true"]) {
|
|
170
170
|
border-color: var(--sui-primary-accent-color);
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
*
|
|
67
67
|
*/
|
|
68
68
|
const openDialog = async () => {
|
|
69
|
-
(document.querySelector('.sui.app-shell')
|
|
69
|
+
(document.querySelector('.sui.app-shell') ?? document.body).appendChild(dialog);
|
|
70
70
|
showContent = true;
|
|
71
71
|
dialog.showModal();
|
|
72
72
|
|
|
@@ -132,7 +132,7 @@ span {
|
|
|
132
132
|
align-items: center;
|
|
133
133
|
border-width: 1.5px;
|
|
134
134
|
border-style: solid;
|
|
135
|
-
border-color: var(--sui-
|
|
135
|
+
border-color: var(--sui-checkbox-border-color);
|
|
136
136
|
border-radius: var(--sui-checkbox-height);
|
|
137
137
|
background-color: var(--sui-control-background-color);
|
|
138
138
|
transition: all 200ms;
|
|
@@ -142,7 +142,7 @@ span::before {
|
|
|
142
142
|
width: calc(var(--sui-checkbox-height) - 6px);
|
|
143
143
|
height: calc(var(--sui-checkbox-height) - 6px);
|
|
144
144
|
border-radius: var(--sui-checkbox-height);
|
|
145
|
-
background-color: var(--sui-
|
|
145
|
+
background-color: var(--sui-checkbox-border-color);
|
|
146
146
|
transition: all 200ms;
|
|
147
147
|
content: "";
|
|
148
148
|
}</style>
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export let show = false;
|
|
15
15
|
/**
|
|
16
|
+
* Duration to automatically hide the toast. Use `0` to hide it manually from the consumer.
|
|
16
17
|
* @type {number}
|
|
17
18
|
*/
|
|
18
19
|
export let duration = 5000;
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
} else {
|
|
44
45
|
popover = popoverBase;
|
|
45
46
|
popover.classList.add('enabled');
|
|
46
|
-
document.body.appendChild(popover);
|
|
47
|
+
(document.querySelector('.sui.app-shell') ?? document.body).appendChild(popover);
|
|
47
48
|
|
|
48
49
|
// Move the element to top layer
|
|
49
50
|
if (popover.showPopover) {
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
$: {
|
|
67
|
-
if (show) {
|
|
68
|
+
if (show && duration) {
|
|
68
69
|
window.setTimeout(() => {
|
|
69
70
|
show = false;
|
|
70
71
|
}, duration);
|
|
@@ -82,38 +83,38 @@
|
|
|
82
83
|
</Alert>
|
|
83
84
|
</div>
|
|
84
85
|
|
|
85
|
-
<style
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
position: absolute;
|
|
108
|
-
inset: auto 16px 16px auto;
|
|
109
|
-
box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
|
|
110
|
-
opacity: 1;
|
|
111
|
-
transition-duration: 250ms;
|
|
112
|
-
will-change: opacity;
|
|
86
|
+
<style>.toast-base {
|
|
87
|
+
position: fixed;
|
|
88
|
+
inset: 0;
|
|
89
|
+
z-index: 99999;
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
justify-content: flex-end;
|
|
93
|
+
align-items: flex-end;
|
|
94
|
+
gap: 8px;
|
|
95
|
+
margin: 0;
|
|
96
|
+
border: 0;
|
|
97
|
+
padding: 16px;
|
|
98
|
+
width: 100vw;
|
|
99
|
+
height: 100vh;
|
|
100
|
+
background-color: transparent;
|
|
101
|
+
font-family: var(--sui-font-family-default);
|
|
102
|
+
font-size: var(--sui-font-size-default);
|
|
103
|
+
font-weight: var(--sui-font-weight-normal);
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
-webkit-user-select: none;
|
|
106
|
+
user-select: none;
|
|
107
|
+
}
|
|
113
108
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
.toast {
|
|
110
|
+
position: absolute;
|
|
111
|
+
inset: auto 16px 16px auto;
|
|
112
|
+
box-shadow: 0 8px 16px var(--sui-popup-shadow-color);
|
|
113
|
+
opacity: 1;
|
|
114
|
+
transition-duration: 250ms;
|
|
115
|
+
will-change: opacity;
|
|
116
|
+
}
|
|
117
|
+
.toast[hidden] {
|
|
118
|
+
display: block;
|
|
119
|
+
opacity: 0;
|
|
120
|
+
}</style>
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
--sui-background-color-3-hsl: var(--sui-base-hue) 5% 96%;
|
|
97
97
|
--sui-background-color-4-hsl: var(--sui-base-hue) 5% 94%;
|
|
98
98
|
--sui-background-color-5-hsl: var(--sui-base-hue) 5% 74%;
|
|
99
|
-
--sui-border-color-1-hsl: var(--sui-base-hue) 5%
|
|
99
|
+
--sui-border-color-1-hsl: var(--sui-base-hue) 5% 54%;
|
|
100
100
|
--sui-border-color-2-hsl: var(--sui-base-hue) 5% 74%;
|
|
101
101
|
--sui-border-color-3-hsl: var(--sui-base-hue) 5% 70%;
|
|
102
102
|
--sui-shadow-color: var(--sui-base-hue) 10% 0%;
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
--sui-background-color-3-hsl: var(--sui-base-hue) 10% 14%;
|
|
130
130
|
--sui-background-color-4-hsl: var(--sui-base-hue) 10% 16%;
|
|
131
131
|
--sui-background-color-5-hsl: var(--sui-base-hue) 10% 26%;
|
|
132
|
-
--sui-border-color-1-hsl: var(--sui-base-hue) 10%
|
|
132
|
+
--sui-border-color-1-hsl: var(--sui-base-hue) 10% 46%;
|
|
133
133
|
--sui-border-color-2-hsl: var(--sui-base-hue) 10% 26%;
|
|
134
134
|
--sui-border-color-3-hsl: var(--sui-base-hue) 10% 22%;
|
|
135
135
|
--sui-shadow-color: var(--sui-base-hue) 10% 0%;
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
--sui-control-large-border-radius: calc(var(--sui-control-large-height) / 8);
|
|
249
249
|
--sui-control-large-padding: 0 calc((var(--sui-control-large-height) / 3));
|
|
250
250
|
--sui-control-large-height: 48px;
|
|
251
|
-
--sui-control-border-color: hsl(var(--sui-border-color-
|
|
251
|
+
--sui-control-border-color: hsl(var(--sui-border-color-2-hsl));
|
|
252
252
|
--sui-control-foreground-color: var(--sui-primary-foreground-color);
|
|
253
253
|
--sui-control-background-color: hsl(var(--sui-background-color-4-hsl));
|
|
254
254
|
--sui-control-font-family: var(--sui-font-family-default);
|
|
@@ -267,18 +267,18 @@
|
|
|
267
267
|
--sui-button-background-color: var(--sui-control-background-color);
|
|
268
268
|
--sui-checkbox-border-radius: var(--sui-control-medium-border-radius);
|
|
269
269
|
--sui-checkbox-height: 20px;
|
|
270
|
-
--sui-checkbox-border-color: var(--sui-
|
|
270
|
+
--sui-checkbox-border-color: hsl(var(--sui-border-color-1-hsl));
|
|
271
271
|
--sui-checkbox-background-color: var(--sui-control-background-color);
|
|
272
272
|
--sui-option-border-radius: var(--sui-control-medium-border-radius);
|
|
273
273
|
--sui-option-padding: var(--sui-control-medium-padding);
|
|
274
274
|
--sui-option-height: var(--sui-control-medium-height);
|
|
275
275
|
--sui-listbox-border-radius: var(--sui-control-medium-border-radius);
|
|
276
|
-
--sui-listbox-border-color:
|
|
276
|
+
--sui-listbox-border-color: var(--sui-control-border-color);
|
|
277
277
|
--sui-listbox-foreground-color: var(--sui-control-foreground-color);
|
|
278
278
|
--sui-listbox-background-color: hsl(var(--sui-background-color-1-hsl));
|
|
279
279
|
--sui-textbox-border-radius: var(--sui-control-medium-border-radius);
|
|
280
280
|
--sui-textbox-height: var(--sui-control-medium-height);
|
|
281
|
-
--sui-textbox-border-color:
|
|
281
|
+
--sui-textbox-border-color: var(--sui-control-border-color);
|
|
282
282
|
--sui-textbox-foreground-color: var(--sui-control-foreground-color);
|
|
283
283
|
--sui-textbox-background-color: hsl(var(--sui-background-color-1-hsl));
|
|
284
284
|
--sui-textbox-font-family: var(--sui-font-family-default);
|
|
@@ -68,7 +68,7 @@ class Group {
|
|
|
68
68
|
|
|
69
69
|
this.orientation = this.grid
|
|
70
70
|
? 'horizontal'
|
|
71
|
-
: this.parent.getAttribute('aria-orientation')
|
|
71
|
+
: this.parent.getAttribute('aria-orientation') ?? orientation;
|
|
72
72
|
this.childRoles = childRoles;
|
|
73
73
|
this.childSelectedAttr = childSelectedAttr;
|
|
74
74
|
this.focusChild = focusChild;
|
|
@@ -208,7 +208,7 @@ class Group {
|
|
|
208
208
|
|
|
209
209
|
const currentTarget = (() => {
|
|
210
210
|
if (!this.focusChild) {
|
|
211
|
-
return activeMembers.find((member) => member.matches('.focused'))
|
|
211
|
+
return activeMembers.find((member) => member.matches('.focused')) ?? activeMembers[0];
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
if (target.matches(this.selector)) {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
--sui-background-color-3-hsl: var(--sui-base-hue) 5% 96%; // secondary
|
|
11
11
|
--sui-background-color-4-hsl: var(--sui-base-hue) 5% 94%; // tertiary/disabled
|
|
12
12
|
--sui-background-color-5-hsl: var(--sui-base-hue) 5% 74%; // highlight
|
|
13
|
-
--sui-border-color-1-hsl: var(--sui-base-hue) 5%
|
|
13
|
+
--sui-border-color-1-hsl: var(--sui-base-hue) 5% 54%; // control
|
|
14
14
|
--sui-border-color-2-hsl: var(--sui-base-hue) 5% 74%; // primary
|
|
15
15
|
--sui-border-color-3-hsl: var(--sui-base-hue) 5% 70%; // secondary
|
|
16
16
|
--sui-shadow-color: var(--sui-base-hue) 10% 0%;
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
--sui-background-color-3-hsl: var(--sui-base-hue) 10% 14%; // secondary
|
|
46
46
|
--sui-background-color-4-hsl: var(--sui-base-hue) 10% 16%; // tertiary/disabled
|
|
47
47
|
--sui-background-color-5-hsl: var(--sui-base-hue) 10% 26%; // highlight
|
|
48
|
-
--sui-border-color-1-hsl: var(--sui-base-hue) 10%
|
|
48
|
+
--sui-border-color-1-hsl: var(--sui-base-hue) 10% 46%; // control
|
|
49
49
|
--sui-border-color-2-hsl: var(--sui-base-hue) 10% 26%; // primary
|
|
50
50
|
--sui-border-color-3-hsl: var(--sui-base-hue) 10% 22%; // secondary
|
|
51
51
|
--sui-shadow-color: var(--sui-base-hue) 10% 0%;
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
--sui-control-large-border-radius: calc(var(--sui-control-large-height) / 8);
|
|
174
174
|
--sui-control-large-padding: 0 calc((var(--sui-control-large-height) / 3));
|
|
175
175
|
--sui-control-large-height: 48px;
|
|
176
|
-
--sui-control-border-color: hsl(var(--sui-border-color-
|
|
176
|
+
--sui-control-border-color: hsl(var(--sui-border-color-2-hsl));
|
|
177
177
|
--sui-control-foreground-color: var(--sui-primary-foreground-color);
|
|
178
178
|
--sui-control-background-color: hsl(var(--sui-background-color-4-hsl));
|
|
179
179
|
--sui-control-font-family: var(--sui-font-family-default);
|
|
@@ -191,10 +191,10 @@
|
|
|
191
191
|
--sui-button-large-height: var(--sui-control-large-height);
|
|
192
192
|
--sui-button-border-color: var(--sui-control-border-color);
|
|
193
193
|
--sui-button-background-color: var(--sui-control-background-color);
|
|
194
|
-
// Checkbox
|
|
194
|
+
// Checkbox, radio button, switch
|
|
195
195
|
--sui-checkbox-border-radius: var(--sui-control-medium-border-radius);
|
|
196
196
|
--sui-checkbox-height: 20px;
|
|
197
|
-
--sui-checkbox-border-color: var(--sui-
|
|
197
|
+
--sui-checkbox-border-color: hsl(var(--sui-border-color-1-hsl));
|
|
198
198
|
--sui-checkbox-background-color: var(--sui-control-background-color);
|
|
199
199
|
// Option & menu item
|
|
200
200
|
--sui-option-border-radius: var(--sui-control-medium-border-radius);
|
|
@@ -202,13 +202,13 @@
|
|
|
202
202
|
--sui-option-height: var(--sui-control-medium-height);
|
|
203
203
|
// Listbox
|
|
204
204
|
--sui-listbox-border-radius: var(--sui-control-medium-border-radius);
|
|
205
|
-
--sui-listbox-border-color:
|
|
205
|
+
--sui-listbox-border-color: var(--sui-control-border-color);
|
|
206
206
|
--sui-listbox-foreground-color: var(--sui-control-foreground-color);
|
|
207
207
|
--sui-listbox-background-color: hsl(var(--sui-background-color-1-hsl));
|
|
208
208
|
// Textbox: singleline & multiline text fields
|
|
209
209
|
--sui-textbox-border-radius: var(--sui-control-medium-border-radius);
|
|
210
210
|
--sui-textbox-height: var(--sui-control-medium-height);
|
|
211
|
-
--sui-textbox-border-color:
|
|
211
|
+
--sui-textbox-border-color: var(--sui-control-border-color);
|
|
212
212
|
--sui-textbox-foreground-color: var(--sui-control-foreground-color);
|
|
213
213
|
--sui-textbox-background-color: hsl(var(--sui-background-color-1-hsl));
|
|
214
214
|
--sui-textbox-font-family: var(--sui-font-family-default);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,16 +27,16 @@
|
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@playwright/test": "^1.39.0",
|
|
30
|
-
"@sveltejs/adapter-auto": "2.1.
|
|
31
|
-
"@sveltejs/kit": "^1.27.
|
|
30
|
+
"@sveltejs/adapter-auto": "2.1.1",
|
|
31
|
+
"@sveltejs/kit": "^1.27.3",
|
|
32
32
|
"@sveltejs/package": "^2.2.2",
|
|
33
33
|
"cspell": "^7.3.8",
|
|
34
|
-
"eslint": "^8.
|
|
34
|
+
"eslint": "^8.53.0",
|
|
35
35
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
36
36
|
"eslint-config-prettier": "^9.0.0",
|
|
37
37
|
"eslint-plugin-import": "^2.29.0",
|
|
38
38
|
"eslint-plugin-jsdoc": "^46.8.2",
|
|
39
|
-
"eslint-plugin-svelte": "^2.34.
|
|
39
|
+
"eslint-plugin-svelte": "^2.34.1",
|
|
40
40
|
"npm-run-all": "^4.1.5",
|
|
41
41
|
"postcss": "^8.4.31",
|
|
42
42
|
"postcss-html": "^1.5.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"prettier-plugin-svelte": "^3.0.3",
|
|
45
45
|
"sass": "^1.69.5",
|
|
46
46
|
"stylelint": "^15.11.0",
|
|
47
|
-
"stylelint-config-recommended-scss": "^13.
|
|
47
|
+
"stylelint-config-recommended-scss": "^13.1.0",
|
|
48
48
|
"stylelint-scss": "^5.3.0",
|
|
49
49
|
"svelte-check": "^3.5.2",
|
|
50
50
|
"svelte-i18n": "^4.0.0",
|