@sveltia/ui 0.15.3 → 0.15.4
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/grid/grid-body.svelte +1 -0
- package/package/components/select/combobox.svelte +1 -0
- package/package/components/slider/slider.svelte +1 -0
- package/package/components/table/table-body.svelte +1 -0
- package/package/components/util/popup.svelte +9 -2
- package/package/services/group.js +6 -0
- package/package/services/popup.js +5 -0
- package/package.json +8 -8
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
{#if label}
|
|
34
34
|
<div role="row" class="row-group-caption">
|
|
35
35
|
<!-- We need `colspan` here but cannot place `<th>` under `<div>`, so use a hack -->
|
|
36
|
+
<!-- prettier-ignore -->
|
|
36
37
|
<svelte:element this={'th'} role="rowheader" id="{id}-label" colspan="9999">
|
|
37
38
|
{label}
|
|
38
39
|
</svelte:element>
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
{#if label}
|
|
34
34
|
<div role="row" class="row-group-caption">
|
|
35
35
|
<!-- We need `colspan` here but cannot place `<th>` under `<div>`, so use a hack -->
|
|
36
|
+
<!-- prettier-ignore -->
|
|
36
37
|
<svelte:element this={'th'} role="rowheader" id="{id}-label" colspan="9999">
|
|
37
38
|
{label}
|
|
38
39
|
</svelte:element>
|
|
@@ -82,10 +82,17 @@
|
|
|
82
82
|
height: undefined,
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Initialize the popup.
|
|
87
|
+
*/
|
|
88
|
+
const init = () => {
|
|
89
|
+
({ open, style } = activatePopup(anchor, modal.dialog, position, positionBaseElement));
|
|
90
|
+
contentType = anchor?.getAttribute('aria-haspopup') ?? undefined;
|
|
91
|
+
};
|
|
92
|
+
|
|
85
93
|
$: {
|
|
86
94
|
if (anchor && modal?.dialog) {
|
|
87
|
-
(
|
|
88
|
-
contentType = anchor.getAttribute('aria-haspopup') ?? undefined;
|
|
95
|
+
init();
|
|
89
96
|
}
|
|
90
97
|
}
|
|
91
98
|
|
|
@@ -106,6 +106,7 @@ class Group {
|
|
|
106
106
|
const isSelected = defaultSelected
|
|
107
107
|
? element === defaultSelected
|
|
108
108
|
: this.selectFirst && index === 0;
|
|
109
|
+
|
|
109
110
|
const controlTarget = /** @type {HTMLElement | null} */ (
|
|
110
111
|
document.querySelector(`#${element.getAttribute('aria-controls')}`)
|
|
111
112
|
);
|
|
@@ -221,6 +222,7 @@ class Group {
|
|
|
221
222
|
const targetRole = newTarget.getAttribute('role');
|
|
222
223
|
const targetParent = newTarget.closest(this.parentGroupSelector);
|
|
223
224
|
const selectByClick = event.type === 'click';
|
|
225
|
+
|
|
224
226
|
const selectByKeydown =
|
|
225
227
|
event.type === 'keydown' && /** @type {KeyboardEvent} */ (event).key === ' ';
|
|
226
228
|
|
|
@@ -336,6 +338,7 @@ class Group {
|
|
|
336
338
|
onClick(event) {
|
|
337
339
|
// eslint-disable-next-line prefer-destructuring
|
|
338
340
|
const target = /** @type {HTMLElement} */ (event.target);
|
|
341
|
+
|
|
339
342
|
const newTarget = target.matches(this.selector)
|
|
340
343
|
? target
|
|
341
344
|
: /** @type {HTMLElement | null} */ (target.closest(this.selector));
|
|
@@ -362,6 +365,7 @@ class Group {
|
|
|
362
365
|
// eslint-disable-next-line prefer-destructuring
|
|
363
366
|
const target = /** @type {HTMLElement} */ (event.target);
|
|
364
367
|
const { allMembers, activeMembers } = this;
|
|
368
|
+
|
|
365
369
|
/** @type {HTMLElement | undefined} */
|
|
366
370
|
const currentTarget = (() => {
|
|
367
371
|
if (!this.focusChild) {
|
|
@@ -460,6 +464,7 @@ class Group {
|
|
|
460
464
|
onUpdate({ searchTerms }) {
|
|
461
465
|
const terms = searchTerms.trim().toLocaleLowerCase();
|
|
462
466
|
const _terms = terms ? terms.split(/\s+/) : [];
|
|
467
|
+
|
|
463
468
|
const matched = this.allMembers
|
|
464
469
|
.map((member) => {
|
|
465
470
|
const searchValue =
|
|
@@ -469,6 +474,7 @@ class Group {
|
|
|
469
474
|
member.querySelector('.label')?.textContent ??
|
|
470
475
|
member.textContent
|
|
471
476
|
)?.toLocaleLowerCase() ?? '';
|
|
477
|
+
|
|
472
478
|
const hidden = !_terms.every((term) => searchValue.includes(term));
|
|
473
479
|
|
|
474
480
|
member.dispatchEvent(new CustomEvent('toggle', { detail: { hidden } }));
|
|
@@ -65,22 +65,27 @@ class Popup {
|
|
|
65
65
|
: position.endsWith('-top')
|
|
66
66
|
? `${Math.round(intersectionRect.top)}px`
|
|
67
67
|
: 'auto';
|
|
68
|
+
|
|
68
69
|
const right = position.startsWith('left-')
|
|
69
70
|
? `${Math.round(rootBounds.width - intersectionRect.left)}px`
|
|
70
71
|
: position.endsWith('-right')
|
|
71
72
|
? `${Math.round(rootBounds.width - intersectionRect.right)}px`
|
|
72
73
|
: 'auto';
|
|
74
|
+
|
|
73
75
|
const bottom = position.startsWith('top-')
|
|
74
76
|
? `${Math.round(rootBounds.height - intersectionRect.top)}px`
|
|
75
77
|
: position.endsWith('-bottom')
|
|
76
78
|
? `${Math.round(rootBounds.height - intersectionRect.bottom)}px`
|
|
77
79
|
: 'auto';
|
|
80
|
+
|
|
78
81
|
const left = position.startsWith('right-')
|
|
79
82
|
? `${Math.round(intersectionRect.right)}px`
|
|
80
83
|
: position.endsWith('-left')
|
|
81
84
|
? `${Math.round(intersectionRect.left)}px`
|
|
82
85
|
: 'auto';
|
|
86
|
+
|
|
83
87
|
const anchorPopup = /** @type {HTMLElement} */ (this.anchorElement.closest('.popup'));
|
|
88
|
+
|
|
84
89
|
const style = {
|
|
85
90
|
inset: [top, right, bottom, left].join(' '),
|
|
86
91
|
zIndex: anchorPopup ? Number(anchorPopup.style.zIndex) + 1 : 1000,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltia/ui",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -41,28 +41,28 @@
|
|
|
41
41
|
"@sveltejs/adapter-auto": "^3.2.1",
|
|
42
42
|
"@sveltejs/kit": "^2.5.10",
|
|
43
43
|
"@sveltejs/package": "^2.3.1",
|
|
44
|
-
"@sveltejs/vite-plugin-svelte": "^3.1.
|
|
44
|
+
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
|
45
45
|
"cspell": "^8.8.3",
|
|
46
46
|
"eslint": "^8.57.0",
|
|
47
47
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
48
48
|
"eslint-config-prettier": "^9.1.0",
|
|
49
49
|
"eslint-plugin-import": "^2.29.1",
|
|
50
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
50
|
+
"eslint-plugin-jsdoc": "^48.2.7",
|
|
51
51
|
"eslint-plugin-svelte": "^2.39.0",
|
|
52
52
|
"npm-run-all": "^4.1.5",
|
|
53
53
|
"postcss": "^8.4.38",
|
|
54
54
|
"postcss-html": "^1.7.0",
|
|
55
|
-
"prettier": "^3.
|
|
55
|
+
"prettier": "^3.3.0",
|
|
56
56
|
"prettier-plugin-svelte": "^3.2.3",
|
|
57
|
-
"sass": "^1.77.
|
|
58
|
-
"stylelint": "^16.6.
|
|
57
|
+
"sass": "^1.77.4",
|
|
58
|
+
"stylelint": "^16.6.1",
|
|
59
59
|
"stylelint-config-recommended-scss": "^14.0.0",
|
|
60
60
|
"stylelint-scss": "^6.3.0",
|
|
61
|
-
"svelte-check": "^3.
|
|
61
|
+
"svelte-check": "^3.8.0",
|
|
62
62
|
"svelte-i18n": "^4.0.0",
|
|
63
63
|
"svelte-preprocess": "^5.1.4",
|
|
64
64
|
"tslib": "^2.6.2",
|
|
65
|
-
"vite": "^5.2.
|
|
65
|
+
"vite": "^5.2.12",
|
|
66
66
|
"vitest": "^1.6.0"
|
|
67
67
|
},
|
|
68
68
|
"exports": {
|