@agnos-ui/svelte-bootstrap 0.7.0-next.0 → 0.7.1
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.
|
@@ -5,7 +5,43 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
|
|
|
5
5
|
import type {SliderSlotHandleContext} from './slider.gen';
|
|
6
6
|
|
|
7
7
|
let {item, directives}: SliderSlotHandleContext = $props();
|
|
8
|
+
|
|
9
|
+
let refocusElement: HTMLElement | undefined = $state(undefined);
|
|
10
|
+
let updateTimeout: NodeJS.Timeout;
|
|
11
|
+
|
|
12
|
+
// Manually keep focus as scheduling goal elements are re-ordered.
|
|
13
|
+
// Svelte currently does not retain focus as elements are moved, even when keyed.
|
|
14
|
+
// See discussion here: https://github.com/sveltejs/svelte/issues/3973
|
|
15
|
+
$effect(() => {
|
|
16
|
+
if (refocusElement) {
|
|
17
|
+
updateTimeout = setTimeout(() => {
|
|
18
|
+
refocusElement?.focus();
|
|
19
|
+
refocusElement = undefined;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Key handler that sets the refocus element only on the key strokes that move
|
|
26
|
+
* the element up the DOM
|
|
27
|
+
* @param event object containting key stroke and the target element
|
|
28
|
+
*/
|
|
29
|
+
function onkeydown(event: KeyboardEvent) {
|
|
30
|
+
switch (event.key) {
|
|
31
|
+
case 'ArrowUp':
|
|
32
|
+
case 'ArrowRight':
|
|
33
|
+
case 'End':
|
|
34
|
+
case 'ArrowDown':
|
|
35
|
+
case 'ArrowLeft':
|
|
36
|
+
case 'Home':
|
|
37
|
+
refocusElement = event.target as HTMLElement;
|
|
38
|
+
clearTimeout(updateTimeout);
|
|
39
|
+
break;
|
|
40
|
+
default:
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
8
44
|
</script>
|
|
9
45
|
|
|
10
46
|
<!-- svelte-ignore a11y_consider_explicit_label -->
|
|
11
|
-
<button use:directives.handleDirective={{item}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.handleDirective, {item}])}> </button>
|
|
47
|
+
<button {onkeydown} use:directives.handleDirective={{item}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.handleDirective, {item}])}> </button>
|
|
@@ -9,7 +9,7 @@ import {BROWSER as __AgnosUISveltePreprocess__BROWSER} from 'esm-env';
|
|
|
9
9
|
let {state, directives} = widget;
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
|
-
{#each state.progressDisplayOptions as option}
|
|
12
|
+
{#each state.progressDisplayOptions as option (option.id)}
|
|
13
13
|
<div use:directives.progressDisplayDirective={{option}} {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes([directives.progressDisplayDirective, {option}])}></div>
|
|
14
14
|
{/each}
|
|
15
15
|
<div use:directives.clickableAreaDirective {...__AgnosUISveltePreprocess__BROWSER ? {} : __AgnosUISveltePreprocess__ssrAttributes(directives.clickableAreaDirective)}></div>
|
|
@@ -165,28 +165,35 @@ export interface SliderState {
|
|
|
165
165
|
export interface SliderProps {
|
|
166
166
|
/**
|
|
167
167
|
* Return the value for the 'aria-label' attribute for the handle
|
|
168
|
-
* @param value - value of the handle
|
|
169
168
|
* @param sortedIndex - index of the handle in the sorted list
|
|
170
|
-
* @param index - index of the handle in the original list
|
|
171
169
|
*
|
|
172
170
|
* @defaultValue
|
|
173
171
|
* ```ts
|
|
174
|
-
* (
|
|
172
|
+
* () => 'Value'
|
|
175
173
|
* ```
|
|
176
174
|
*/
|
|
177
|
-
|
|
175
|
+
ariaLabel: (sortedIndex: number) => string;
|
|
176
|
+
/**
|
|
177
|
+
* Return the value for the 'aria-labelledBy' attribute for the handle
|
|
178
|
+
* @param sortedIndex - index of the handle in the sorted list
|
|
179
|
+
*
|
|
180
|
+
* @defaultValue
|
|
181
|
+
* ```ts
|
|
182
|
+
* () => ''
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
ariaLabelledBy: (sortedIndex: number) => string;
|
|
178
186
|
/**
|
|
179
187
|
* Return the value for the 'aria-valuetext' attribute for the handle
|
|
180
188
|
* @param value - value of the handle
|
|
181
189
|
* @param sortedIndex - index of the handle in the sorted list
|
|
182
|
-
* @param index - index of the handle in the original list
|
|
183
190
|
*
|
|
184
191
|
* @defaultValue
|
|
185
192
|
* ```ts
|
|
186
|
-
* (value: number) => ''
|
|
193
|
+
* (value: number) => ''
|
|
187
194
|
* ```
|
|
188
195
|
*/
|
|
189
|
-
ariaValueText: (value: number, sortedIndex: number
|
|
196
|
+
ariaValueText: (value: number, sortedIndex: number) => string;
|
|
190
197
|
/**
|
|
191
198
|
* An event emitted when slider values are changed
|
|
192
199
|
*
|
|
@@ -318,9 +325,13 @@ export interface ProgressDisplayOptions {
|
|
|
318
325
|
*/
|
|
319
326
|
width: number;
|
|
320
327
|
/**
|
|
321
|
-
* Height of
|
|
328
|
+
* Height of the progress in %
|
|
322
329
|
*/
|
|
323
330
|
height: number;
|
|
331
|
+
/**
|
|
332
|
+
* Id of the progress
|
|
333
|
+
*/
|
|
334
|
+
id: number;
|
|
324
335
|
}
|
|
325
336
|
/**
|
|
326
337
|
* Options for displaying a handle in a slider component.
|
|
@@ -350,11 +361,15 @@ export interface SliderHandle {
|
|
|
350
361
|
/**
|
|
351
362
|
* ariaLabel of the handle
|
|
352
363
|
*/
|
|
353
|
-
ariaLabel: string;
|
|
364
|
+
ariaLabel: string | undefined;
|
|
354
365
|
/**
|
|
355
366
|
* ariaValueText of the handle
|
|
356
367
|
*/
|
|
357
|
-
ariaValueText: string;
|
|
368
|
+
ariaValueText: string | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* aria-labelledBy of the handle
|
|
371
|
+
*/
|
|
372
|
+
ariaLabelledBy: string | undefined;
|
|
358
373
|
}
|
|
359
374
|
/**
|
|
360
375
|
* Interface representing various directives used in the slider component.
|
|
@@ -91,7 +91,7 @@ export interface TreeProps {
|
|
|
91
91
|
* (node: HTMLElement) => node.querySelectorAll('button')
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
|
-
navSelector(node: HTMLElement): NodeListOf<
|
|
94
|
+
navSelector(node: HTMLElement): NodeListOf<HTMLElement>;
|
|
95
95
|
/**
|
|
96
96
|
* Return the value for the 'aria-label' attribute of the toggle
|
|
97
97
|
* @param label - tree item label
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agnos-ui/svelte-bootstrap",
|
|
3
3
|
"description": "Bootstrap-based component library for Svelte.",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"module": "./index.js",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
}
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@agnos-ui/core-bootstrap": "0.7.
|
|
53
|
-
"@agnos-ui/svelte-headless": "0.7.
|
|
52
|
+
"@agnos-ui/core-bootstrap": "0.7.1",
|
|
53
|
+
"@agnos-ui/svelte-headless": "0.7.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@amadeus-it-group/tansu": "^2.0.0",
|
|
57
57
|
"esm-env": "^1.2.1",
|
|
58
|
-
"svelte": "^5.
|
|
58
|
+
"svelte": "^5.0.0"
|
|
59
59
|
},
|
|
60
60
|
"sideEffects": false,
|
|
61
61
|
"homepage": "https://www.agnosui.dev/latest/",
|