fluentui-svelte 0.5.0 → 0.7.0
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/app-surface/app-surface.svelte +96 -0
- package/dist/components/app-surface/app-surface.svelte.d.ts +22 -0
- package/dist/components/app-surface/docs/llms.md +73 -0
- package/dist/components/app-surface/types.d.ts +19 -0
- package/dist/components/app-surface/types.js +1 -0
- package/dist/components/app-window/app-window.d.ts +3 -0
- package/dist/components/app-window/app-window.js +3 -0
- package/dist/components/app-window/app-window.svelte +193 -0
- package/dist/components/app-window/app-window.svelte.d.ts +25 -0
- package/dist/components/app-window/docs/llms.md +119 -0
- package/dist/components/app-window/types.d.ts +66 -0
- package/dist/components/app-window/types.js +1 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte +47 -31
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte.d.ts +2 -2
- package/dist/components/auto-suggest-box/docs/llms.md +34 -33
- package/dist/components/auto-suggest-box/option.svelte +6 -4
- package/dist/components/auto-suggest-box/types.d.ts +13 -16
- package/dist/components/avatar/avatar.svelte +4 -3
- package/dist/components/avatar/docs/llms.md +1 -1
- package/dist/components/avatar/type.d.ts +1 -1
- package/dist/components/badge/badge-icon.svelte +2 -2
- package/dist/components/badge/badge.svelte +2 -2
- package/dist/components/badge/docs/llms.md +2 -2
- package/dist/components/badge/types.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-button.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-divider.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb.svelte +10 -5
- package/dist/components/breadcrumb/docs/llms.md +11 -11
- package/dist/components/breadcrumb/types.d.ts +7 -7
- package/dist/components/button/button.svelte +2 -2
- package/dist/components/button/docs/llms.md +17 -17
- package/dist/components/button/split-button.svelte +7 -7
- package/dist/components/button/types.d.ts +5 -5
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte +98 -10
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte.d.ts +1 -1
- package/dist/components/calendar-date-picker/docs/llms.md +19 -14
- package/dist/components/calendar-date-picker/types.d.ts +22 -8
- package/dist/components/calendar-view/calendar-view-days.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-grid.js +8 -3
- package/dist/components/calendar-view/calendar-view-item.svelte +10 -4
- package/dist/components/calendar-view/calendar-view-months.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-years.svelte +3 -2
- package/dist/components/calendar-view/calendar-view.svelte +11 -4
- package/dist/components/calendar-view/calendar-view.svelte.js +5 -0
- package/dist/components/calendar-view/docs/llms.md +20 -19
- package/dist/components/calendar-view/types.d.ts +6 -1
- package/dist/components/card/card-footer.svelte +2 -2
- package/dist/components/card/card-header.svelte +5 -4
- package/dist/components/card/card-preview.svelte +13 -2
- package/dist/components/card/card.svelte +5 -5
- package/dist/components/card/docs/llms.md +22 -21
- package/dist/components/card/types.d.ts +8 -4
- package/dist/components/checkbox/checkbox.svelte +47 -26
- package/dist/components/checkbox/checkbox.svelte.d.ts +3 -24
- package/dist/components/checkbox/docs/llms.md +24 -23
- package/dist/components/checkbox/types.d.ts +10 -23
- package/dist/components/date-picker/date-picker.svelte +98 -27
- package/dist/components/date-picker/date-picker.svelte.d.ts +1 -1
- package/dist/components/date-picker/docs/llms.md +23 -20
- package/dist/components/date-picker/types.d.ts +24 -15
- package/dist/components/dialog/dialog-actions.svelte +17 -2
- package/dist/components/dialog/dialog-content.svelte +2 -2
- package/dist/components/dialog/dialog-content.svelte.d.ts +1 -1
- package/dist/components/dialog/dialog-surface.svelte +130 -8
- package/dist/components/dialog/dialog-title.svelte +23 -6
- package/dist/components/dialog/dialog-trigger.svelte +8 -2
- package/dist/components/dialog/dialog-trigger.svelte.d.ts +1 -1
- package/dist/components/dialog/dialog.svelte +22 -11
- package/dist/components/dialog/docs/llms.md +56 -19
- package/dist/components/dialog/types.d.ts +31 -9
- package/dist/components/dialog/utils.d.ts +2 -0
- package/dist/components/dialog/utils.js +1 -0
- package/dist/components/divider/divider.svelte +6 -4
- package/dist/components/divider/types.d.ts +1 -1
- package/dist/components/dropdown/docs/llms.md +30 -28
- package/dist/components/dropdown/dropdown-option.svelte +17 -5
- package/dist/components/dropdown/dropdown.svelte +182 -84
- package/dist/components/dropdown/dropdown.svelte.d.ts +1 -1
- package/dist/components/dropdown/types.d.ts +26 -20
- package/dist/components/dropdown-select/docs/llms.md +24 -22
- package/dist/components/dropdown-select/dropdown-select-option.svelte +2 -2
- package/dist/components/dropdown-select/dropdown-select.svelte +42 -7
- package/dist/components/dropdown-select/types.d.ts +4 -4
- package/dist/components/expander/docs/llms.md +3 -3
- package/dist/components/expander/expander.svelte +13 -8
- package/dist/components/expander/types.d.ts +5 -5
- package/dist/components/flyout/docs/llms.md +1 -1
- package/dist/components/flyout/flyout.svelte +17 -6
- package/dist/components/flyout/types.d.ts +1 -1
- package/dist/components/hyperlink/docs/llms.md +6 -6
- package/dist/components/hyperlink/hyperlink.svelte +13 -4
- package/dist/components/hyperlink/types.d.ts +1 -1
- package/dist/components/info-bar/docs/llms.md +11 -10
- package/dist/components/info-bar/info-bar.svelte +3 -2
- package/dist/components/info-bar/types.d.ts +4 -0
- package/dist/components/label/docs/llms.md +75 -22
- package/dist/components/label/label-context.d.ts +14 -0
- package/dist/components/label/label-context.js +10 -0
- package/dist/components/label/label.svelte +153 -30
- package/dist/components/label/label.svelte.d.ts +1 -1
- package/dist/components/label/types.d.ts +48 -4
- package/dist/components/list-view/docs/llms.md +103 -33
- package/dist/components/list-view/list-view-item-branch.svelte +257 -0
- package/dist/components/list-view/list-view-item-branch.svelte.d.ts +4 -0
- package/dist/components/list-view/list-view-item.svelte +164 -46
- package/dist/components/list-view/list-view-item.svelte.d.ts +5 -5
- package/dist/components/list-view/list-view.svelte +73 -25
- package/dist/components/list-view/types.d.ts +71 -8
- package/dist/components/list-view/utils.d.ts +10 -0
- package/dist/components/list-view/utils.js +17 -1
- package/dist/components/menu/docs/llms.md +98 -15
- package/dist/components/menu/menu-command-bar-item.svelte +61 -0
- package/dist/components/menu/menu-command-bar-item.svelte.d.ts +14 -0
- package/dist/components/menu/menu-command-bar.svelte +218 -0
- package/dist/components/menu/menu-command-bar.svelte.d.ts +21 -0
- package/dist/components/menu/menu-group.svelte +6 -3
- package/dist/components/menu/menu-item-checkbox.svelte +5 -4
- package/dist/components/menu/menu-item-radio.svelte +5 -4
- package/dist/components/menu/menu-item-switch.svelte +5 -4
- package/dist/components/menu/menu-item.svelte +5 -5
- package/dist/components/menu/menu-item.svelte.d.ts +2 -3
- package/dist/components/menu/menu-list.svelte +10 -1
- package/dist/components/menu/menu-popover.svelte +9 -5
- package/dist/components/menu/menu-trigger.svelte +2 -1
- package/dist/components/menu/menu.svelte.js +1 -0
- package/dist/components/menu/types.d.ts +62 -7
- package/dist/components/number-box/docs/llms.md +6 -4
- package/dist/components/number-box/number-box.svelte +35 -29
- package/dist/components/number-box/number-box.svelte.d.ts +1 -1
- package/dist/components/number-box/types.d.ts +1 -1
- package/dist/components/persona/docs/llms.md +29 -25
- package/dist/components/persona/persona.svelte +8 -6
- package/dist/components/persona/types.d.ts +4 -3
- package/dist/components/progress-bar/docs/llms.md +13 -13
- package/dist/components/progress-bar/progress-bar.svelte +6 -6
- package/dist/components/progress-bar/types.d.ts +4 -4
- package/dist/components/progress-ring/docs/llms.md +14 -14
- package/dist/components/progress-ring/progress-ring.svelte +5 -5
- package/dist/components/progress-ring/types.d.ts +3 -3
- package/dist/components/radio-button/docs/llms.md +11 -8
- package/dist/components/radio-button/radio-button.svelte +38 -12
- package/dist/components/radio-button/radio-button.svelte.d.ts +1 -1
- package/dist/components/radio-button/types.d.ts +11 -8
- package/dist/components/rating/docs/llms.md +111 -0
- package/dist/components/rating/rating.svelte +247 -0
- package/dist/components/rating/rating.svelte.d.ts +19 -0
- package/dist/components/rating/types.d.ts +44 -0
- package/dist/components/rating/types.js +1 -0
- package/dist/components/side-nav/docs/llms.md +110 -0
- package/dist/components/side-nav/side-nav-branch.svelte +43 -0
- package/dist/components/side-nav/side-nav-branch.svelte.d.ts +4 -0
- package/dist/components/side-nav/side-nav-item.svelte +75 -0
- package/dist/components/side-nav/side-nav-item.svelte.d.ts +25 -0
- package/dist/components/side-nav/side-nav-list.svelte +32 -0
- package/dist/components/side-nav/side-nav-list.svelte.d.ts +7 -0
- package/dist/components/side-nav/side-nav.d.ts +2 -0
- package/dist/components/side-nav/side-nav.js +2 -0
- package/dist/components/side-nav/side-nav.svelte +355 -0
- package/dist/components/side-nav/side-nav.svelte.d.ts +24 -0
- package/dist/components/side-nav/types.d.ts +149 -0
- package/dist/components/side-nav/types.js +1 -0
- package/dist/components/skeleton/docs/llms.md +1 -1
- package/dist/components/skeleton/skeleton.svelte +2 -2
- package/dist/components/skeleton/types.d.ts +1 -1
- package/dist/components/slider/docs/llms.md +31 -28
- package/dist/components/slider/slider.svelte +126 -61
- package/dist/components/slider/slider.svelte.d.ts +1 -3
- package/dist/components/slider/types.d.ts +21 -14
- package/dist/components/tab-view/docs/llms.md +7 -7
- package/dist/components/tab-view/tab-view-tab.svelte +16 -14
- package/dist/components/tab-view/tab-view.svelte +16 -9
- package/dist/components/tab-view/types.d.ts +6 -6
- package/dist/components/table/docs/llms.md +38 -33
- package/dist/components/table/table-body.svelte +2 -2
- package/dist/components/table/table-cell-actions.svelte +8 -2
- package/dist/components/table/table-cell-layout.svelte +2 -2
- package/dist/components/table/table-cell.svelte +2 -2
- package/dist/components/table/table-header-cell.svelte +2 -2
- package/dist/components/table/table-header.svelte +2 -2
- package/dist/components/table/table-row.svelte +2 -2
- package/dist/components/table/table-selection-cell.svelte +6 -6
- package/dist/components/table/table.svelte +2 -2
- package/dist/components/table/types.d.ts +11 -11
- package/dist/components/tag/docs/llms.md +383 -0
- package/dist/components/tag/tag-group.d.ts +2 -0
- package/dist/components/tag/tag-group.js +2 -0
- package/dist/components/tag/tag-group.svelte +117 -0
- package/dist/components/tag/tag-group.svelte.d.ts +20 -0
- package/dist/components/tag/tag.svelte +459 -0
- package/dist/components/tag/tag.svelte.d.ts +19 -0
- package/dist/components/tag/types.d.ts +137 -0
- package/dist/components/tag/types.js +1 -0
- package/dist/components/tag-picker/docs/llms.md +298 -0
- package/dist/components/tag-picker/option-group.svelte +51 -0
- package/dist/components/tag-picker/option-group.svelte.d.ts +4 -0
- package/dist/components/tag-picker/option.svelte +82 -0
- package/dist/components/tag-picker/option.svelte.d.ts +4 -0
- package/dist/components/tag-picker/tag-picker.d.ts +2 -0
- package/dist/components/tag-picker/tag-picker.js +2 -0
- package/dist/components/tag-picker/tag-picker.svelte +716 -0
- package/dist/components/tag-picker/tag-picker.svelte.d.ts +21 -0
- package/dist/components/tag-picker/types.d.ts +142 -0
- package/dist/components/tag-picker/types.js +1 -0
- package/dist/components/text-box/docs/llms.md +31 -4
- package/dist/components/text-box/text-box-button.svelte +3 -3
- package/dist/components/text-box/text-box-button.svelte.d.ts +1 -1
- package/dist/components/text-box/text-box.svelte +41 -14
- package/dist/components/text-box/types.d.ts +5 -5
- package/dist/components/textarea/docs/llms.md +4 -3
- package/dist/components/textarea/textarea.svelte +14 -6
- package/dist/components/textarea/types.d.ts +2 -4
- package/dist/components/time-picker/docs/llms.md +18 -15
- package/dist/components/time-picker/time-picker.svelte +133 -33
- package/dist/components/time-picker/time-picker.svelte.d.ts +1 -1
- package/dist/components/time-picker/types.d.ts +23 -13
- package/dist/components/title-bar/docs/llms.md +382 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte +215 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte.d.ts +22 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte +190 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte.d.ts +27 -0
- package/dist/components/title-bar/title-bar.d.ts +3 -0
- package/dist/components/title-bar/title-bar.js +4 -0
- package/dist/components/title-bar/title-bar.svelte +224 -0
- package/dist/components/title-bar/title-bar.svelte.d.ts +26 -0
- package/dist/components/title-bar/types.d.ts +165 -0
- package/dist/components/title-bar/types.js +1 -0
- package/dist/components/toggle-switch/docs/llms.md +11 -9
- package/dist/components/toggle-switch/toggle-switch.svelte +23 -14
- package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +1 -1
- package/dist/components/toggle-switch/types.d.ts +12 -10
- package/dist/components/tooltip/docs/llms.md +1 -1
- package/dist/components/tooltip/tooltip.svelte +5 -4
- package/dist/components/tooltip/types.d.ts +1 -1
- package/dist/components/top-nav/docs/llms.md +1 -1
- package/dist/components/top-nav/top-nav-item.svelte +2 -2
- package/dist/components/top-nav/top-nav.svelte +2 -2
- package/dist/components/top-nav/types.d.ts +2 -2
- package/dist/components/tree-view/docs/llms.md +11 -11
- package/dist/components/tree-view/tree-view-item-content.svelte +3 -3
- package/dist/components/tree-view/tree-view-item.svelte +13 -5
- package/dist/components/tree-view/tree-view.svelte +20 -5
- package/dist/components/tree-view/tree-view.svelte.d.ts +1 -1
- package/dist/components/tree-view/tree-view.svelte.js +31 -3
- package/dist/components/tree-view/types.d.ts +7 -3
- package/dist/index.d.ts +25 -0
- package/dist/index.js +32 -0
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +26 -5
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +2 -0
- package/dist/internal/constants.d.ts +0 -4
- package/dist/internal/constants.js +0 -4002
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/native-field.svelte.d.ts +44 -0
- package/dist/internal/native-field.svelte.js +85 -0
- package/dist/internal/utils.d.ts +16 -2
- package/dist/internal/utils.js +25 -3
- package/dist/types/index.d.ts +3 -3
- package/package.json +51 -37
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { claimLabel } from '../label/label-context.js';
|
|
2
3
|
import { onMount, tick } from 'svelte';
|
|
3
4
|
import { SvelteMap } from 'svelte/reactivity';
|
|
4
5
|
import { on } from 'svelte/events';
|
|
5
6
|
import { onClickOutside } from 'runed';
|
|
7
|
+
import { invokeHandlers } from '../../internal/index.js';
|
|
6
8
|
import { PREFIX } from '../../internal/constants.js';
|
|
7
9
|
import { setAutoSuggestBoxContext } from './auto-suggest-box.js';
|
|
8
10
|
import { Flyout, TextBox, ListView, ListViewItem } from '../../index.js';
|
|
@@ -19,23 +21,29 @@
|
|
|
19
21
|
|
|
20
22
|
const FALLBACK_ID = $props.id();
|
|
21
23
|
const ID = `${PREFIX}autosuggestbox-${FALLBACK_ID}`;
|
|
22
|
-
|
|
24
|
+
|
|
25
|
+
const labelContext = claimLabel(() => id);
|
|
23
26
|
|
|
24
27
|
let {
|
|
28
|
+
id = labelContext?.fieldId ?? `${ID}-input`,
|
|
29
|
+
name = id,
|
|
30
|
+
wrapperAttributes,
|
|
31
|
+
onfocus,
|
|
32
|
+
onClear,
|
|
25
33
|
placeholder,
|
|
26
34
|
hideActionButtons,
|
|
27
35
|
type = 'search',
|
|
28
36
|
open = $bindable(false),
|
|
29
37
|
multiselect,
|
|
30
|
-
|
|
38
|
+
wrapperRef = $bindable(null),
|
|
31
39
|
value = $bindable(''),
|
|
32
|
-
|
|
40
|
+
ref = $bindable(null),
|
|
33
41
|
selectOnFocus,
|
|
34
42
|
openOnFocus = false,
|
|
35
43
|
virtualizer,
|
|
36
|
-
flyoutRef = $bindable(),
|
|
44
|
+
flyoutRef = $bindable(null),
|
|
37
45
|
flyoutProps,
|
|
38
|
-
listViewRef = $bindable(),
|
|
46
|
+
listViewRef = $bindable(null),
|
|
39
47
|
selectedOptions = $bindable([]),
|
|
40
48
|
listViewProps,
|
|
41
49
|
showTextualMultiselect,
|
|
@@ -44,7 +52,8 @@
|
|
|
44
52
|
textChanged,
|
|
45
53
|
querySubmitted,
|
|
46
54
|
suggestionChosen,
|
|
47
|
-
children
|
|
55
|
+
children,
|
|
56
|
+
...attributes
|
|
48
57
|
}: AutoSuggestBoxProps = $props();
|
|
49
58
|
|
|
50
59
|
/**
|
|
@@ -69,7 +78,7 @@
|
|
|
69
78
|
|
|
70
79
|
const OPTIONS = '.fs-autosuggest-option';
|
|
71
80
|
|
|
72
|
-
const NAVIGATION: TabspotNodeOptions = {
|
|
81
|
+
const NAVIGATION: TabspotNodeOptions = $derived({
|
|
73
82
|
root: {},
|
|
74
83
|
mover: {
|
|
75
84
|
axis: 'vertical',
|
|
@@ -77,11 +86,11 @@
|
|
|
77
86
|
skip: "[aria-disabled='true']",
|
|
78
87
|
activation: {
|
|
79
88
|
mode: 'activedescendant',
|
|
80
|
-
controller: `#${
|
|
89
|
+
controller: `#${CSS.escape(id ?? ID)}`,
|
|
81
90
|
mark: { attribute: 'data-active' }
|
|
82
91
|
}
|
|
83
92
|
}
|
|
84
|
-
};
|
|
93
|
+
});
|
|
85
94
|
|
|
86
95
|
const context: AutoSuggestBoxContext = $state({
|
|
87
96
|
config: {
|
|
@@ -106,7 +115,7 @@
|
|
|
106
115
|
open = v;
|
|
107
116
|
},
|
|
108
117
|
get textBoxRef() {
|
|
109
|
-
return
|
|
118
|
+
return ref;
|
|
110
119
|
},
|
|
111
120
|
get activeOption() {
|
|
112
121
|
return activeOption;
|
|
@@ -220,7 +229,7 @@
|
|
|
220
229
|
|
|
221
230
|
/** The two keys that are the box's own business rather than the list's. */
|
|
222
231
|
function handleKeyDown(e: KeyboardEvent) {
|
|
223
|
-
if (e.target !==
|
|
232
|
+
if (e.target !== ref) return;
|
|
224
233
|
|
|
225
234
|
if (e.key === 'Escape') {
|
|
226
235
|
e.preventDefault();
|
|
@@ -230,12 +239,13 @@
|
|
|
230
239
|
|
|
231
240
|
if (e.key !== 'Enter') return;
|
|
232
241
|
|
|
233
|
-
e.preventDefault();
|
|
234
|
-
|
|
235
242
|
if (activeOption) {
|
|
243
|
+
// Enter chooses the suggestion under the cursor rather than submitting the form.
|
|
244
|
+
e.preventDefault();
|
|
236
245
|
context.methods.toggleSelection(e, activeOption.id);
|
|
237
246
|
open = false;
|
|
238
247
|
} else {
|
|
248
|
+
// The free text is the value: the form submits it, unless `querySubmitted` prevents it.
|
|
239
249
|
querySubmitted?.(e, value);
|
|
240
250
|
}
|
|
241
251
|
}
|
|
@@ -260,14 +270,14 @@
|
|
|
260
270
|
// end of the list: a second arrow pressed while this one is still in flight is
|
|
261
271
|
// a second move, and two cursor sets onto the same option would be one.
|
|
262
272
|
// Untrusted, so it passes straight through to Tabspot this time.
|
|
263
|
-
|
|
273
|
+
ref?.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true, cancelable: true }));
|
|
264
274
|
}
|
|
265
275
|
|
|
266
276
|
function handleFocus() {
|
|
267
277
|
if (openOnFocus) open = true;
|
|
268
278
|
}
|
|
269
279
|
|
|
270
|
-
async function handleTextChanged(e:
|
|
280
|
+
async function handleTextChanged(e: Event, val: string) {
|
|
271
281
|
if (val.length > 0 && !open) open = true;
|
|
272
282
|
lastTypedValue = val;
|
|
273
283
|
textChanged?.(e, val);
|
|
@@ -290,15 +300,15 @@
|
|
|
290
300
|
}
|
|
291
301
|
|
|
292
302
|
onClickOutside(
|
|
293
|
-
() =>
|
|
303
|
+
() => wrapperRef,
|
|
294
304
|
() => (open = false)
|
|
295
305
|
);
|
|
296
306
|
|
|
297
307
|
onMount(() => {
|
|
298
|
-
if (!
|
|
308
|
+
if (!ref) return;
|
|
299
309
|
|
|
300
310
|
const off = [
|
|
301
|
-
on(
|
|
311
|
+
on(ref, 'keydown', handleKeyDown),
|
|
302
312
|
// Tabspot listens on `document` in the capture phase,
|
|
303
313
|
// `window` comes first on the capture path, to note the
|
|
304
314
|
// key that caused a move,and to hold a move back until
|
|
@@ -307,7 +317,7 @@
|
|
|
307
317
|
window,
|
|
308
318
|
'keydown',
|
|
309
319
|
(event) => {
|
|
310
|
-
if (event.target !==
|
|
320
|
+
if (event.target !== ref || !event.isTrusted) return;
|
|
311
321
|
|
|
312
322
|
const key = event.key;
|
|
313
323
|
|
|
@@ -366,48 +376,54 @@
|
|
|
366
376
|
</script>
|
|
367
377
|
|
|
368
378
|
<div
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
379
|
+
{...wrapperAttributes}
|
|
380
|
+
class={['fs-autosuggestbox', { open, multiselect: _box.multiselect }, wrapperAttributes?.class]}
|
|
381
|
+
style="--max-items: {maxItemsInView}; --current-items: {items.size}; {wrapperAttributes?.style ?? ''}"
|
|
382
|
+
bind:this={wrapperRef}
|
|
372
383
|
>
|
|
373
384
|
<TextBox
|
|
385
|
+
{...attributes}
|
|
374
386
|
{type}
|
|
375
387
|
{placeholder}
|
|
376
388
|
{hideActionButtons}
|
|
377
|
-
id
|
|
389
|
+
{id}
|
|
390
|
+
{name}
|
|
378
391
|
bind:value
|
|
379
|
-
bind:ref
|
|
392
|
+
bind:ref
|
|
380
393
|
querySubmitted={(e) => querySubmitted?.(e, value)}
|
|
381
394
|
textChanged={(e) => handleTextChanged(e, value)}
|
|
382
|
-
onClear={handleClear}
|
|
383
|
-
onfocus={handleFocus}
|
|
395
|
+
onClear={(e) => invokeHandlers(e, [], [handleClear, onClear])}
|
|
396
|
+
onfocus={(e) => invokeHandlers(e, [], [handleFocus, onfocus])}
|
|
384
397
|
role="combobox"
|
|
385
398
|
aria-expanded={open}
|
|
386
399
|
aria-autocomplete="list"
|
|
387
400
|
aria-controls={open ? `${ID}-list` : undefined}
|
|
388
401
|
aria-haspopup="listbox"
|
|
389
|
-
class
|
|
402
|
+
wrapperAttributes={{ class: `square-${roundClass}` }}
|
|
390
403
|
/>
|
|
391
404
|
{#if open}
|
|
392
405
|
<Flyout
|
|
406
|
+
{...flyoutProps}
|
|
393
407
|
floating
|
|
394
408
|
offset={0}
|
|
395
|
-
reference={
|
|
409
|
+
reference={wrapperRef}
|
|
396
410
|
bind:ref={flyoutRef}
|
|
397
411
|
roundCorners="bottom"
|
|
398
412
|
placementConfig={{ allowedPlacements: ['bottom', 'top'] }}
|
|
399
|
-
onPlacementChange={(place) =>
|
|
413
|
+
onPlacementChange={(place) => {
|
|
414
|
+
handlePlacementChange(place);
|
|
415
|
+
flyoutProps?.onPlacementChange?.(place);
|
|
416
|
+
}}
|
|
400
417
|
class={['fs-autosuggestbox-flyout', roundClass === 'top' && 'top-shadow', flyoutProps?.class]}
|
|
401
|
-
{...flyoutProps}
|
|
402
418
|
>
|
|
403
419
|
<ListView
|
|
420
|
+
{...listViewProps as any}
|
|
404
421
|
role="listbox"
|
|
405
422
|
navigationMode="items"
|
|
406
423
|
disableTabspot
|
|
407
424
|
id="{ID}-list"
|
|
408
425
|
selectedItems={Array.from(selectedOptions.values()).map((opt) => opt.value)}
|
|
409
426
|
bind:ref={listViewRef}
|
|
410
|
-
{...listViewProps as any}
|
|
411
427
|
>
|
|
412
428
|
{#if items.size === 0}
|
|
413
429
|
<ListViewItem disabled>{notFoundText}</ListViewItem>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AutoSuggestBoxProps } from './types.
|
|
2
|
-
declare const AutoSuggestBox: import("svelte").Component<AutoSuggestBoxProps, {}, "ref" | "value" | "open" | "
|
|
1
|
+
import type { AutoSuggestBoxProps } from './types.js';
|
|
2
|
+
declare const AutoSuggestBox: import("svelte").Component<AutoSuggestBoxProps, {}, "ref" | "value" | "open" | "wrapperRef" | "flyoutRef" | "listViewRef" | "selectedOptions">;
|
|
3
3
|
type AutoSuggestBox = ReturnType<typeof AutoSuggestBox>;
|
|
4
4
|
export default AutoSuggestBox;
|
|
@@ -117,35 +117,36 @@ A virtualized list must filter its source data itself and report the filtered le
|
|
|
117
117
|
</AutoSuggestBox>
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
HTML attributes, including class, id and ARIA attributes, apply to the control element. Bind ref to access that control. Use wrapperAttributes and wrapperRef for the outer container.
|
|
121
|
+
|
|
120
122
|
## Component Props
|
|
121
123
|
|
|
122
124
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
123
125
|
<!-- props:AutoSuggestBoxProps -->
|
|
124
126
|
|
|
125
|
-
| Name
|
|
126
|
-
|
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `value` _bindable_
|
|
130
|
-
| `open` _bindable_
|
|
131
|
-
| `multiselect`
|
|
132
|
-
| `selectOnFocus`
|
|
133
|
-
| `openOnFocus`
|
|
134
|
-
| `showTextualMultiselect`
|
|
135
|
-
| `notFoundText`
|
|
136
|
-
| `selectedOptions` _bindable_
|
|
137
|
-
| `suggestionChosen`
|
|
138
|
-
| `querySubmitted`
|
|
139
|
-
| `virtualizer`
|
|
140
|
-
| `maxItemsInView`
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| Element Attributes (`div`) | | | |
|
|
127
|
+
| Name | Type | Default | Description |
|
|
128
|
+
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
129
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the wrapper element. |
|
|
130
|
+
| `ref` _bindable_ | `HTMLInputElement` | `null` | | The DOM reference of the text box element. |
|
|
131
|
+
| `value` _bindable_ | `string` | `''` | The current text of the box. |
|
|
132
|
+
| `open` _bindable_ | `boolean` | `false` | Controls the open state of the suggestion list. |
|
|
133
|
+
| `multiselect` | `boolean` | | Lets more than one suggestion be chosen, and keeps the list open after each one. |
|
|
134
|
+
| `selectOnFocus` | `boolean` | | Mirrors the suggestion under the cursor into the text box as it is walked over. Not supported together with `multiselect`. |
|
|
135
|
+
| `openOnFocus` | `boolean` | `false` | Opens the suggestion list as soon as the text box takes focus, instead of waiting for the first keystroke. Useful on touch devices, which have no arrow key to open the list with. |
|
|
136
|
+
| `showTextualMultiselect` | `boolean` | | Lists every chosen suggestion in the text box, comma separated. Multiselect only. |
|
|
137
|
+
| `notFoundText` | `string` | `'No results found'` | The message shown in place of the list when nothing matches. |
|
|
138
|
+
| `selectedOptions` _bindable_ | `{ id: string; value: string }[]` | `[]` | The suggestions currently chosen. |
|
|
139
|
+
| `suggestionChosen` | `(e: Event, selection: string) => void` | | Called when a suggestion is chosen: by clicking it, by pressing Enter on it, or by walking onto it while `selectOnFocus` is set. |
|
|
140
|
+
| `querySubmitted` | `(e: MouseEvent` | `KeyboardEvent, query: string) => void` | | Called when Enter is pressed with no suggestion under the cursor, or when the search button is clicked. This is where a fresh set of suggestions is fetched. Enter then also submits the form with the typed text, unless the event is prevented. |
|
|
141
|
+
| `virtualizer` | `AutoSuggestVirtualizer` | | Bridge to a windowed list, for suggestion sets too long to render whole. |
|
|
142
|
+
| `maxItemsInView` | `number` | `6` | How many suggestions are visible before the list scrolls. |
|
|
143
|
+
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
144
|
+
| `flyoutRef` _bindable_ | `HTMLElement` | `null` | | The DOM reference of the flyout holding the suggestion list. |
|
|
145
|
+
| `flyoutProps` | `FlyoutProps` | | The props to spread on the flyout. |
|
|
146
|
+
| `listViewRef` _bindable_ | `HTMLUListElement` | `null` | | The DOM reference of the suggestion list. |
|
|
147
|
+
| `listViewProps` | `ListViewItemProps` | | The props to spread on the suggestion list. |
|
|
148
|
+
| `type`, `placeholder`, `hideActionButtons`, `textChanged`, `onClear` from `TextBoxProps` | | | |
|
|
149
|
+
| `HTMLInputAttributes` without `value`, `type`, `role`, `size`, `placeholder` | | | |
|
|
149
150
|
|
|
150
151
|
<!-- /props:AutoSuggestBoxProps -->
|
|
151
152
|
|
|
@@ -154,14 +155,14 @@ A virtualized list must filter its source data itself and report the filtered le
|
|
|
154
155
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
155
156
|
<!-- props:AutoSuggestOptionProps -->
|
|
156
157
|
|
|
157
|
-
| Name | Type
|
|
158
|
-
| ----------------------------------------------- |
|
|
159
|
-
| `value` | `string`
|
|
160
|
-
| `text` | `string`
|
|
161
|
-
| `id` | `string`
|
|
162
|
-
| `ref` _bindable_ | `HTMLLIElement` | | The DOM reference of the option element. |
|
|
163
|
-
| `disabled` | `boolean`
|
|
164
|
-
| `index` | `number`
|
|
165
|
-
| `ListViewItemProps<'li'>` without `as`, `value` |
|
|
158
|
+
| Name | Type | Default | Description |
|
|
159
|
+
| ----------------------------------------------- | ----------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
160
|
+
| `value` | `string` | | The value reported to the box when the suggestion is chosen. Falls back to the id. |
|
|
161
|
+
| `text` | `string` | | The text shown in the box once the suggestion is chosen. Falls back to `value`. |
|
|
162
|
+
| `id` | `string` | | The id of the option element, referenced by the box through `aria-activedescendant`. Falls back to a generated id. |
|
|
163
|
+
| `ref` _bindable_ | `HTMLLIElement` | `null` | | The DOM reference of the option element. |
|
|
164
|
+
| `disabled` | `boolean` | | Takes the suggestion out of reach: it is shown, but the cursor steps over it. |
|
|
165
|
+
| `index` | `number` | | Where the suggestion sits in the whole set. A windowed list needs the real index, not the position within the rendered slice. |
|
|
166
|
+
| `ListViewItemProps<'li'>` without `as`, `value` | | | |
|
|
166
167
|
|
|
167
168
|
<!-- /props:AutoSuggestOptionProps -->
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { invokeHandlers } from '../../internal/index.js';
|
|
2
3
|
import { PREFIX } from '../../internal/constants.js';
|
|
3
4
|
import ListViewItem from '../list-view/list-view-item.svelte';
|
|
4
5
|
import { getAutoSuggestBoxContext } from './auto-suggest-box.js';
|
|
@@ -9,12 +10,13 @@
|
|
|
9
10
|
|
|
10
11
|
let {
|
|
11
12
|
disabled,
|
|
12
|
-
ref = $bindable(),
|
|
13
|
+
ref = $bindable(null),
|
|
13
14
|
id = ID,
|
|
14
15
|
value = id!,
|
|
15
16
|
text,
|
|
16
17
|
index,
|
|
17
18
|
children,
|
|
19
|
+
onclick,
|
|
18
20
|
...attributes
|
|
19
21
|
}: AutoSuggestOptionProps = $props();
|
|
20
22
|
|
|
@@ -58,16 +60,16 @@
|
|
|
58
60
|
|
|
59
61
|
{#if isVisible || virtualized}
|
|
60
62
|
<ListViewItem
|
|
63
|
+
{...attributes}
|
|
61
64
|
{id}
|
|
62
65
|
role="option"
|
|
63
66
|
{value}
|
|
64
67
|
tabindex={-1}
|
|
65
68
|
data-index={index}
|
|
66
|
-
class={['fs-autosuggest-option', selectOnFocus && 'no-outline']}
|
|
67
|
-
onclick={handleClick}
|
|
69
|
+
class={['fs-autosuggest-option', selectOnFocus && 'no-outline', attributes?.class]}
|
|
70
|
+
onclick={(e) => invokeHandlers(e, disabled, [handleClick, onclick])}
|
|
68
71
|
bind:ref
|
|
69
72
|
{disabled}
|
|
70
|
-
{...attributes}
|
|
71
73
|
>
|
|
72
74
|
{@render children?.()}
|
|
73
75
|
</ListViewItem>
|
|
@@ -2,17 +2,17 @@ import type { FSContext } from '../../internal/index.js';
|
|
|
2
2
|
import type { TextBoxProps } from '../text-box/types.ts';
|
|
3
3
|
import type { ListViewItemProps } from '../list-view/types.ts';
|
|
4
4
|
import type { FlyoutProps } from '../flyout/types.ts';
|
|
5
|
-
import type { HTMLAttributes } from 'svelte/elements';
|
|
5
|
+
import type { HTMLAttributes, HTMLInputAttributes } from 'svelte/elements';
|
|
6
6
|
/** @propsmith AutoSuggestBoxProps */
|
|
7
7
|
export type AutoSuggestBoxProps = {
|
|
8
8
|
/** The DOM reference of the wrapper element.
|
|
9
9
|
* @bindable
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
wrapperRef?: HTMLDivElement | null;
|
|
12
12
|
/** The DOM reference of the text box element.
|
|
13
13
|
* @bindable
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
ref?: HTMLInputElement | null;
|
|
16
16
|
/** The current text of the box.
|
|
17
17
|
* @default ''
|
|
18
18
|
* @bindable
|
|
@@ -53,7 +53,8 @@ export type AutoSuggestBoxProps = {
|
|
|
53
53
|
*/
|
|
54
54
|
suggestionChosen?: (e: Event, selection: string) => void;
|
|
55
55
|
/** Called when Enter is pressed with no suggestion under the cursor, or when the search
|
|
56
|
-
* button is clicked. This is where a fresh set of suggestions is fetched.
|
|
56
|
+
* button is clicked. This is where a fresh set of suggestions is fetched. Enter then also
|
|
57
|
+
* submits the form with the typed text, unless the event is prevented.
|
|
57
58
|
*/
|
|
58
59
|
querySubmitted?: (e: MouseEvent | KeyboardEvent, query: string) => void;
|
|
59
60
|
/** Bridge to a windowed list, for suggestion sets too long to render whole.
|
|
@@ -64,18 +65,14 @@ export type AutoSuggestBoxProps = {
|
|
|
64
65
|
* @default 6
|
|
65
66
|
*/
|
|
66
67
|
maxItemsInView?: number;
|
|
67
|
-
/** The
|
|
68
|
-
* @
|
|
69
|
-
*/
|
|
70
|
-
textBoxRef?: HTMLInputElement;
|
|
71
|
-
/** The props to spread on the text box.
|
|
72
|
-
* @type TextBoxProps
|
|
68
|
+
/** The attributes to spread on the wrapper element.
|
|
69
|
+
* @type HTMLAttributes
|
|
73
70
|
*/
|
|
74
|
-
|
|
71
|
+
wrapperAttributes?: HTMLAttributes<HTMLDivElement>;
|
|
75
72
|
/** The DOM reference of the flyout holding the suggestion list.
|
|
76
73
|
* @bindable
|
|
77
74
|
*/
|
|
78
|
-
flyoutRef?: HTMLElement;
|
|
75
|
+
flyoutRef?: HTMLElement | null;
|
|
79
76
|
/** The props to spread on the flyout.
|
|
80
77
|
* @type FlyoutProps
|
|
81
78
|
*/
|
|
@@ -83,12 +80,12 @@ export type AutoSuggestBoxProps = {
|
|
|
83
80
|
/** The DOM reference of the suggestion list.
|
|
84
81
|
* @bindable
|
|
85
82
|
*/
|
|
86
|
-
listViewRef?: HTMLUListElement;
|
|
83
|
+
listViewRef?: HTMLUListElement | null;
|
|
87
84
|
/** The props to spread on the suggestion list.
|
|
88
85
|
* @type ListViewItemProps
|
|
89
86
|
*/
|
|
90
87
|
listViewProps?: Omit<ListViewItemProps, 'as' | 'role' | 'ref' | 'navigationMode' | 'selectedItems'>;
|
|
91
|
-
} & Pick<TextBoxProps, 'type' | 'placeholder' | 'hideActionButtons' | 'textChanged'> &
|
|
88
|
+
} & Pick<TextBoxProps, 'type' | 'placeholder' | 'hideActionButtons' | 'textChanged' | 'onClear'> & Omit<HTMLInputAttributes, 'value' | 'type' | 'role' | 'size' | 'placeholder'>;
|
|
92
89
|
/**
|
|
93
90
|
* Bridge to a windowed list. `size` is the total number of suggestions, not the
|
|
94
91
|
* number currently rendered — it is how the box knows where the list really ends
|
|
@@ -106,7 +103,7 @@ export type AutoSuggestBoxContext = FSContext<{
|
|
|
106
103
|
multiselect?: boolean;
|
|
107
104
|
}, {
|
|
108
105
|
readonly searchValue?: string;
|
|
109
|
-
readonly textBoxRef?: HTMLInputElement;
|
|
106
|
+
readonly textBoxRef?: HTMLInputElement | null;
|
|
110
107
|
readonly lastTypedValue?: string;
|
|
111
108
|
open?: boolean;
|
|
112
109
|
activeOption?: OptionType | null;
|
|
@@ -135,7 +132,7 @@ export type AutoSuggestOptionProps = {
|
|
|
135
132
|
/** The DOM reference of the option element.
|
|
136
133
|
* @bindable
|
|
137
134
|
*/
|
|
138
|
-
ref?: HTMLLIElement;
|
|
135
|
+
ref?: HTMLLIElement | null;
|
|
139
136
|
/** Takes the suggestion out of reach: it is shown, but the cursor steps over it. */
|
|
140
137
|
disabled?: boolean;
|
|
141
138
|
/** Where the suggestion sits in the whole set. A windowed list needs the real index,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
color = 'attention',
|
|
16
16
|
style,
|
|
17
17
|
activeAppearance = 'ring',
|
|
18
|
-
ref = $bindable(),
|
|
18
|
+
ref = $bindable(null),
|
|
19
19
|
idForColor,
|
|
20
20
|
badge,
|
|
21
21
|
...attributes
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
```
|
|
50
50
|
-->
|
|
51
51
|
<div
|
|
52
|
+
{...attributes}
|
|
52
53
|
role="img"
|
|
53
54
|
aria-label={name}
|
|
54
55
|
bind:this={ref}
|
|
@@ -60,9 +61,9 @@
|
|
|
60
61
|
active,
|
|
61
62
|
shape,
|
|
62
63
|
hideBg && 'hide-bg',
|
|
63
|
-
(badge?.status || badge?.icon) && 'mask'
|
|
64
|
+
(badge?.status || badge?.icon) && 'mask',
|
|
65
|
+
attributes?.class
|
|
64
66
|
]}
|
|
65
|
-
{...attributes}
|
|
66
67
|
>
|
|
67
68
|
<span class="content">
|
|
68
69
|
{#if image}
|
|
@@ -83,7 +83,7 @@ An avatar can have its color automatically picked based on the name prop, or idF
|
|
|
83
83
|
| ------------------ | ------------------------------------------------------------------------------ | ------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
84
84
|
| `name` | `string` | `'Avatar'` | The name of the person or entity represented by this Avatar. This should always be provided if it is available. |
|
|
85
85
|
| `image` | `{ src: string; }` | | The Avatar's image |
|
|
86
|
-
| `ref` _bindable_ | `HTMLDivElement`
|
|
86
|
+
| `ref` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the avatar element. |
|
|
87
87
|
| `size` | `number` | `48` | Size of the avatar in pixels. |
|
|
88
88
|
| `shape` | `'circular'` | `'rounded'` | `'square'` | `'circular'` | The avatar can have a circular, rounded or square shape. |
|
|
89
89
|
| `color` | [`Colors`](https://fluentui-svelte.dev/docs/types/#colors) | `'colorful'` | `'attention'` | The color when displaying either an icon or initials. For now it only supports system colors (plus colorful). |
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
class: classes,
|
|
12
12
|
color,
|
|
13
13
|
style,
|
|
14
|
-
ref = $bindable(),
|
|
14
|
+
ref = $bindable(null),
|
|
15
15
|
...attributes
|
|
16
16
|
}: BadgeIconProps = $props();
|
|
17
17
|
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
```
|
|
42
42
|
-->
|
|
43
43
|
<span
|
|
44
|
+
{...attributes}
|
|
44
45
|
bind:this={ref}
|
|
45
46
|
aria-label={arialabel}
|
|
46
47
|
role="img"
|
|
47
48
|
class={['fs-badge-icon', color || colors[status], classes]}
|
|
48
49
|
style="--badge-size: {pxToRem(size)}; {style}"
|
|
49
|
-
{...attributes}
|
|
50
50
|
>
|
|
51
51
|
{#if Icon}
|
|
52
52
|
<RenderSoC SoC={Icon} args={{ 'aria-hidden': true, width: `${size}px`, height: `${size}px` }} />
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
children,
|
|
14
14
|
class: classes,
|
|
15
15
|
style,
|
|
16
|
-
ref = $bindable(),
|
|
16
|
+
ref = $bindable(null),
|
|
17
17
|
...attributes
|
|
18
18
|
}: BadgeProps = $props();
|
|
19
19
|
</script>
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
```
|
|
37
37
|
-->
|
|
38
38
|
<span
|
|
39
|
+
{...attributes}
|
|
39
40
|
bind:this={ref}
|
|
40
41
|
class={['fs-badge', shape, appearance, color, classes]}
|
|
41
42
|
style="--badge-shapes: {shapes[shape]}; --badge-size: {pxToRem(size)}; {style}"
|
|
42
|
-
{...attributes}
|
|
43
43
|
>
|
|
44
44
|
{#if iconPosition === 'after'}
|
|
45
45
|
{@render children?.()}
|
|
@@ -90,7 +90,7 @@ Use the icon prop to render an icon inside the badge. You can pass the icon as a
|
|
|
90
90
|
| `iconPosition` | `'before'` | `'after'` | `'before'` | The position of the icon relative to the badge content. |
|
|
91
91
|
| `color` | [`Colors`](https://fluentui-svelte.dev/docs/types/#colors) | `'information'` | The color of the badge. For now it only supports system colors. |
|
|
92
92
|
| `icon` | `Snippet` | `Component` | | Icon to render inside the badge. |
|
|
93
|
-
| `ref` _bindable_ | `HTMLSpanElement`
|
|
93
|
+
| `ref` _bindable_ | `HTMLSpanElement` | `null` | | The DOM reference of the badge element. |
|
|
94
94
|
| HTML Attributes | | | |
|
|
95
95
|
|
|
96
96
|
<!-- /props:BadgeProps -->
|
|
@@ -140,7 +140,7 @@ By default, Avatar uses an instance of BadgeIcon. As you can see, the first exam
|
|
|
140
140
|
| `size` | `number` | `20` | The size of the badge in pixels. |
|
|
141
141
|
| `color` | [`Colors`](https://fluentui-svelte.dev/docs/types/#colors) | | Overrides the color the status would pick on its own. |
|
|
142
142
|
| `icon` | `Snippet` | `Component` | | Custom icon, rendered instead of the one the status would pick on its own. |
|
|
143
|
-
| `ref` _bindable_ | `HTMLSpanElement`
|
|
143
|
+
| `ref` _bindable_ | `HTMLSpanElement` | `null` | | The DOM reference of the badge element. |
|
|
144
144
|
| HTML Attributes | | | |
|
|
145
145
|
|
|
146
146
|
<!-- /props:BadgeIconProps -->
|
|
@@ -30,7 +30,7 @@ export type BadgeProps = {
|
|
|
30
30
|
/** The DOM reference of the badge element.
|
|
31
31
|
* @bindable
|
|
32
32
|
*/
|
|
33
|
-
ref?: HTMLSpanElement;
|
|
33
|
+
ref?: HTMLSpanElement | null;
|
|
34
34
|
} & PolymorphicProps<'span'>;
|
|
35
35
|
/** The presence of a person, rendered by BadgeIcon on its own or by an Avatar through its badge prop. */
|
|
36
36
|
export type BadgePresence = {
|
|
@@ -66,5 +66,5 @@ export type BadgeIconProps = {
|
|
|
66
66
|
/** The DOM reference of the badge element.
|
|
67
67
|
* @bindable
|
|
68
68
|
*/
|
|
69
|
-
ref?: HTMLSpanElement;
|
|
69
|
+
ref?: HTMLSpanElement | null;
|
|
70
70
|
} & Omit<PolymorphicProps<'span'>, 'children'>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
6
|
as = 'button' as T,
|
|
7
|
-
ref = $bindable(),
|
|
7
|
+
ref = $bindable(null),
|
|
8
8
|
icon,
|
|
9
9
|
iconPosition = 'before',
|
|
10
10
|
current = false,
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
-->
|
|
38
38
|
<svelte:element
|
|
39
39
|
this={_as}
|
|
40
|
+
{...attributes}
|
|
40
41
|
bind:this={ref as BreadcrumbItemElementDOMType[T]}
|
|
41
42
|
type={_as === 'button' ? 'button' : undefined}
|
|
42
43
|
disabled={nativelyDisabled || undefined}
|
|
@@ -44,7 +45,6 @@
|
|
|
44
45
|
aria-current={current ? 'page' : undefined}
|
|
45
46
|
class={['fs-breadcrumb-button', { current, disabled }, classes]}
|
|
46
47
|
onclick={(e: MouseEvent) => invokeHandlers(e, disabled, [onclick])}
|
|
47
|
-
{...attributes}
|
|
48
48
|
>
|
|
49
49
|
{#if icon && iconPosition === 'before'}
|
|
50
50
|
<span class="fs-breadcrumb-button-icon">
|