@sveltia/ui 0.26.1 → 0.26.3
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/bottom-navigation/bottom-navigation.svelte +3 -0
- package/dist/components/button/button.svelte +37 -37
- package/dist/components/button/select-button-group.svelte +9 -9
- package/dist/components/button/split-button.svelte +4 -4
- package/dist/components/calendar/calendar.svelte +5 -7
- package/dist/components/checkbox/checkbox.svelte +8 -8
- package/dist/components/dialog/dialog.svelte +1 -2
- package/dist/components/disclosure/disclosure.svelte +2 -2
- package/dist/components/drawer/drawer.svelte +1 -2
- package/dist/components/grid/grid-body.svelte +2 -2
- package/dist/components/grid/grid.svelte +2 -4
- package/dist/components/listbox/listbox.svelte +13 -8
- package/dist/components/listbox/option.svelte +10 -11
- package/dist/components/menu/menu-item.svelte +4 -4
- package/dist/components/menu/menu.svelte +6 -1
- package/dist/components/radio/radio-group.svelte +3 -3
- package/dist/components/radio/radio.svelte +9 -8
- package/dist/components/select/combobox.svelte +31 -28
- package/dist/components/table/table-body.svelte +2 -2
- package/dist/components/table/table.svelte +2 -4
- package/dist/components/text-editor/lexical-root.svelte +16 -63
- package/dist/components/text-editor/toolbar/toolbar-wrapper.svelte +2 -2
- package/dist/components/text-field/number-input.svelte +6 -6
- package/dist/components/text-field/password-input.svelte +1 -1
- package/dist/components/text-field/search-bar.svelte +4 -4
- package/dist/components/text-field/text-area.svelte +4 -9
- package/dist/components/text-field/text-input.svelte +4 -6
- package/dist/components/toast/toast.svelte +6 -6
- package/dist/components/toolbar/toolbar.svelte +5 -6
- package/dist/components/util/app-shell.svelte +13 -36
- package/dist/components/util/modal.svelte +20 -7
- package/dist/components/util/popup.svelte +1 -1
- package/dist/styles/core.scss +16 -36
- package/dist/styles/variables.scss +3 -3
- package/dist/typedefs.d.ts +5 -0
- package/dist/typedefs.js +2 -0
- package/package.json +8 -8
|
@@ -36,12 +36,15 @@
|
|
|
36
36
|
/* eslint-enable prefer-const */
|
|
37
37
|
} = $props();
|
|
38
38
|
|
|
39
|
+
let opening = false;
|
|
40
|
+
let closing = false;
|
|
41
|
+
|
|
39
42
|
/**
|
|
40
43
|
* Close the modal.
|
|
41
44
|
* @param {string} returnValue Return value to be used for `<dialog>`.
|
|
42
45
|
*/
|
|
43
46
|
export const close = (returnValue) => {
|
|
44
|
-
if (!dialog) {
|
|
47
|
+
if (!dialog || !dialog.open || opening || closing) {
|
|
45
48
|
return;
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -77,10 +80,15 @@
|
|
|
77
80
|
* Show the modal.
|
|
78
81
|
*/
|
|
79
82
|
const openDialog = async () => {
|
|
80
|
-
if (!dialog || dialog?.open) {
|
|
83
|
+
if (!dialog || dialog?.open || opening || closing) {
|
|
84
|
+
if (closing) {
|
|
85
|
+
open = false;
|
|
86
|
+
}
|
|
87
|
+
|
|
81
88
|
return;
|
|
82
89
|
}
|
|
83
90
|
|
|
91
|
+
opening = true;
|
|
84
92
|
onOpening?.(new CustomEvent('Opening'));
|
|
85
93
|
showContent = true;
|
|
86
94
|
dialog.showModal();
|
|
@@ -89,18 +97,24 @@
|
|
|
89
97
|
setOpenClass = true;
|
|
90
98
|
await waitForTransition();
|
|
91
99
|
setActiveClass = true;
|
|
100
|
+
opening = false;
|
|
92
101
|
};
|
|
93
102
|
|
|
94
103
|
/**
|
|
95
104
|
* Hide the modal.
|
|
96
105
|
*/
|
|
97
106
|
const closeDialog = async () => {
|
|
98
|
-
if (!dialog || !dialog.open) {
|
|
107
|
+
if (!dialog || !dialog.open || opening || closing) {
|
|
108
|
+
if (opening) {
|
|
109
|
+
open = false;
|
|
110
|
+
}
|
|
111
|
+
|
|
99
112
|
return;
|
|
100
113
|
}
|
|
101
114
|
|
|
102
115
|
const { returnValue } = dialog;
|
|
103
116
|
|
|
117
|
+
closing = true;
|
|
104
118
|
onClosing?.(new CustomEvent('Closing'));
|
|
105
119
|
// Prevent a button behind the `<dialog>` from being clicked erroneously (Svelte bug)
|
|
106
120
|
document.body.inert = true;
|
|
@@ -121,6 +135,7 @@
|
|
|
121
135
|
|
|
122
136
|
onClose?.(new CustomEvent('Close', { detail: { returnValue } }));
|
|
123
137
|
dialog.returnValue = '';
|
|
138
|
+
closing = false;
|
|
124
139
|
};
|
|
125
140
|
|
|
126
141
|
$effect(() => {
|
|
@@ -162,8 +177,7 @@
|
|
|
162
177
|
lightDismiss &&
|
|
163
178
|
/** @type {HTMLElement | undefined} */ (target)?.matches('dialog')
|
|
164
179
|
) {
|
|
165
|
-
|
|
166
|
-
open = false;
|
|
180
|
+
close('cancel');
|
|
167
181
|
}
|
|
168
182
|
}}
|
|
169
183
|
oncancel={(event) => {
|
|
@@ -171,8 +185,7 @@
|
|
|
171
185
|
|
|
172
186
|
// Escape key is pressed
|
|
173
187
|
if (dialog && escapeDismiss) {
|
|
174
|
-
|
|
175
|
-
open = false;
|
|
188
|
+
close('cancel');
|
|
176
189
|
}
|
|
177
190
|
}}
|
|
178
191
|
>
|
package/dist/styles/core.scss
CHANGED
|
@@ -48,12 +48,7 @@
|
|
|
48
48
|
z-index: 2;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
h1,
|
|
52
|
-
h2,
|
|
53
|
-
h3,
|
|
54
|
-
h4,
|
|
55
|
-
h5,
|
|
56
|
-
h6 {
|
|
51
|
+
:is(h1, h2, h3, h4, h5, h6) {
|
|
57
52
|
margin: 0;
|
|
58
53
|
font-weight: var(--sui-font-weight-bold, bold);
|
|
59
54
|
line-height: var(--sui-line-height-default);
|
|
@@ -92,33 +87,25 @@
|
|
|
92
87
|
text-decoration: none;
|
|
93
88
|
text-underline-offset: 2px;
|
|
94
89
|
|
|
95
|
-
&:hover,
|
|
96
|
-
&:focus,
|
|
97
|
-
&:active {
|
|
90
|
+
&:is(:hover, :focus, :active) {
|
|
98
91
|
text-decoration: underline;
|
|
99
92
|
}
|
|
100
93
|
|
|
101
|
-
:
|
|
102
|
-
:global(:host[data-underline-links="true"]) & {
|
|
94
|
+
:is(:root, :host)[data-underline-links="true"] & {
|
|
103
95
|
text-decoration: underline;
|
|
104
96
|
}
|
|
105
97
|
}
|
|
106
98
|
|
|
107
|
-
p,
|
|
108
|
-
ul,
|
|
109
|
-
ol,
|
|
110
|
-
dl {
|
|
99
|
+
:is(p, ul, ol, dl) {
|
|
111
100
|
margin: var(--sui-paragraph-margin) 0;
|
|
112
101
|
line-height: var(--sui-line-height-comfortable);
|
|
113
102
|
}
|
|
114
103
|
|
|
115
|
-
ul,
|
|
116
|
-
ol {
|
|
104
|
+
:is(ul, ol) {
|
|
117
105
|
padding-inline: 2em;
|
|
118
106
|
}
|
|
119
107
|
|
|
120
|
-
code,
|
|
121
|
-
pre {
|
|
108
|
+
:is(code, pre) {
|
|
122
109
|
border-radius: 4px;
|
|
123
110
|
background-color: var(--sui-code-background-color);
|
|
124
111
|
font-family: var(--sui-font-family-monospace);
|
|
@@ -141,8 +128,7 @@
|
|
|
141
128
|
border-collapse: collapse;
|
|
142
129
|
}
|
|
143
130
|
|
|
144
|
-
th,
|
|
145
|
-
td {
|
|
131
|
+
:is(th, td) {
|
|
146
132
|
border: 1px solid var(--sui-textbox-border-color);
|
|
147
133
|
padding: 8px;
|
|
148
134
|
}
|
|
@@ -153,30 +139,24 @@
|
|
|
153
139
|
padding-inline-start: 12px;
|
|
154
140
|
}
|
|
155
141
|
|
|
156
|
-
.disabled,
|
|
157
|
-
.readonly,
|
|
158
|
-
[aria-disabled="true"],
|
|
159
|
-
[aria-readonly="true"],
|
|
160
|
-
[inert]:not(body) {
|
|
142
|
+
:is(.disabled, .readonly, [aria-disabled="true"], [aria-readonly="true"], [inert]):not(body) {
|
|
161
143
|
cursor: default;
|
|
162
144
|
pointer-events: none;
|
|
163
145
|
-webkit-user-select: none;
|
|
164
146
|
user-select: none;
|
|
165
147
|
filter: grayscale(1) opacity(0.35);
|
|
166
148
|
|
|
167
|
-
|
|
149
|
+
* {
|
|
168
150
|
filter: grayscale(0) opacity(1); // Maintain the opacity on child nodes
|
|
169
151
|
}
|
|
170
152
|
}
|
|
171
153
|
|
|
172
|
-
.disabled
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
-webkit-user-select: none;
|
|
180
|
-
user-select: none;
|
|
154
|
+
:is(.disabled, .readonly, [aria-disabled="true"], [aria-readonly="true"], [inert]) {
|
|
155
|
+
* {
|
|
156
|
+
cursor: default;
|
|
157
|
+
pointer-events: none;
|
|
158
|
+
-webkit-user-select: none;
|
|
159
|
+
user-select: none;
|
|
160
|
+
}
|
|
181
161
|
}
|
|
182
162
|
}
|
|
@@ -243,9 +243,9 @@
|
|
|
243
243
|
|
|
244
244
|
// Make controls larger on touch devices, e.g. mobile & tablet
|
|
245
245
|
@media (pointer: coarse) {
|
|
246
|
-
--sui-control-small-height:
|
|
247
|
-
--sui-control-medium-height:
|
|
248
|
-
--sui-control-large-height:
|
|
246
|
+
--sui-control-small-height: 32px;
|
|
247
|
+
--sui-control-medium-height: 40px;
|
|
248
|
+
--sui-control-large-height: 48px;
|
|
249
249
|
--sui-checkbox-height: 24px;
|
|
250
250
|
--sui-secondary-row-height: 48px;
|
|
251
251
|
}
|
package/dist/typedefs.d.ts
CHANGED
|
@@ -370,6 +370,11 @@ export type ComboboxProps = {
|
|
|
370
370
|
* Where to show the dropdown menu.
|
|
371
371
|
*/
|
|
372
372
|
position?: PopupPosition | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* Number of items to start showing the filter. Default: `5`.
|
|
375
|
+
* Use `-1` to always hide the filter.
|
|
376
|
+
*/
|
|
377
|
+
filterThreshold?: number | undefined;
|
|
373
378
|
/**
|
|
374
379
|
* Primary slot content.
|
|
375
380
|
*/
|
package/dist/typedefs.js
CHANGED
|
@@ -127,6 +127,8 @@
|
|
|
127
127
|
* @property {string} [value] Selected option’s value.
|
|
128
128
|
* @property {boolean} [editable] Whether to make the `combobox` editable.
|
|
129
129
|
* @property {PopupPosition} [position] Where to show the dropdown menu.
|
|
130
|
+
* @property {number} [filterThreshold] Number of items to start showing the filter. Default: `5`.
|
|
131
|
+
* Use `-1` to always hide the filter.
|
|
130
132
|
* @property {Snippet} [children] Primary slot content.
|
|
131
133
|
* @property {Snippet} [chevronIcon] Chevron icon slot content.
|
|
132
134
|
* @property {(event: CustomEvent) => void} [onChange] Custom `change` event handler.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"svelte": "^5.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@playwright/test": "^1.
|
|
49
|
+
"@playwright/test": "^1.52.0",
|
|
50
50
|
"@sveltejs/adapter-auto": "^6.0.0",
|
|
51
|
-
"@sveltejs/kit": "^2.20.
|
|
52
|
-
"@sveltejs/package": "^2.3.
|
|
51
|
+
"@sveltejs/kit": "^2.20.7",
|
|
52
|
+
"@sveltejs/package": "^2.3.11",
|
|
53
53
|
"@sveltejs/vite-plugin-svelte": "5.0.3",
|
|
54
|
-
"cspell": "^8.
|
|
54
|
+
"cspell": "^8.19.1",
|
|
55
55
|
"eslint": "^8.57.1",
|
|
56
56
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
57
57
|
"eslint-config-prettier": "^10.1.2",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"stylelint": "^16.18.0",
|
|
67
67
|
"stylelint-config-recommended-scss": "^14.1.0",
|
|
68
68
|
"stylelint-scss": "^6.11.1",
|
|
69
|
-
"svelte": "5.
|
|
70
|
-
"svelte-check": "^4.1.
|
|
69
|
+
"svelte": "5.28.1",
|
|
70
|
+
"svelte-check": "^4.1.6",
|
|
71
71
|
"svelte-i18n": "^4.0.1",
|
|
72
72
|
"svelte-preprocess": "^6.0.3",
|
|
73
73
|
"tslib": "^2.8.1",
|
|
74
|
-
"vite": "^6.2
|
|
74
|
+
"vite": "^6.3.2",
|
|
75
75
|
"vitest": "^3.1.1"
|
|
76
76
|
},
|
|
77
77
|
"exports": {
|