fluentui-svelte 0.3.0 → 0.5.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/README.md +1 -1
- package/dist/components/auto-suggest-box/docs/llms.md +76 -15
- package/dist/components/breadcrumb/breadcrumb-button.svelte +130 -0
- package/dist/components/breadcrumb/breadcrumb-button.svelte.d.ts +35 -0
- package/dist/components/breadcrumb/breadcrumb-divider.svelte +39 -0
- package/dist/components/breadcrumb/breadcrumb-divider.svelte.d.ts +14 -0
- package/dist/components/breadcrumb/breadcrumb-item.svelte +30 -0
- package/dist/components/breadcrumb/breadcrumb-item.svelte.d.ts +16 -0
- package/dist/components/breadcrumb/breadcrumb.svelte +101 -0
- package/dist/components/breadcrumb/breadcrumb.svelte.d.ts +25 -0
- package/dist/components/breadcrumb/docs/llms.md +193 -0
- package/dist/components/breadcrumb/types.d.ts +80 -0
- package/dist/components/breadcrumb/types.js +1 -0
- package/dist/components/card/card-header.svelte +2 -2
- package/dist/components/dropdown/dropdown.svelte +1 -0
- package/dist/components/list-view/docs/llms.md +79 -27
- package/dist/components/list-view/list-view-item.svelte +14 -11
- package/dist/components/list-view/list-view.svelte +3 -2
- package/dist/components/list-view/types.d.ts +5 -1
- package/dist/components/menu/docs/llms.md +16 -0
- package/dist/components/menu/menu-popover.svelte +7 -12
- package/dist/components/menu/menu-popover.svelte.d.ts +2 -10
- package/dist/components/menu/types.d.ts +21 -0
- package/dist/components/tab-view/docs/llms.md +146 -0
- package/dist/components/tab-view/tab-view-tab.svelte +290 -0
- package/dist/components/tab-view/tab-view-tab.svelte.d.ts +20 -0
- package/dist/components/tab-view/tab-view.svelte +188 -0
- package/dist/components/tab-view/tab-view.svelte.d.ts +26 -0
- package/dist/components/tab-view/tab-view.svelte.js +15 -0
- package/dist/components/tab-view/types.d.ts +79 -0
- package/dist/components/tab-view/types.js +1 -0
- package/dist/components/top-nav/docs/llms.md +176 -0
- package/dist/components/top-nav/top-nav-item.svelte +234 -0
- package/dist/components/top-nav/top-nav-item.svelte.d.ts +41 -0
- package/dist/components/top-nav/top-nav.svelte +259 -0
- package/dist/components/top-nav/top-nav.svelte.d.ts +26 -0
- package/dist/components/top-nav/top-nav.svelte.js +18 -0
- package/dist/components/top-nav/types.d.ts +89 -0
- package/dist/components/top-nav/types.js +1 -0
- package/dist/components/tree-view/docs/llms.md +166 -1
- package/dist/components/tree-view/tree-view-item-content.svelte +41 -8
- package/dist/components/tree-view/tree-view-item.svelte +10 -1
- package/dist/components/tree-view/tree-view.svelte +17 -2
- package/dist/components/tree-view/tree-view.svelte.js +4 -2
- package/dist/components/tree-view/types.d.ts +4 -0
- package/dist/css/class-darkmode.css +1 -1
- package/dist/css/media-darkmode.css +1 -1
- package/dist/css/theme.css +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +14 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -169,7 +169,7 @@ after changing a prop's JSDoc rather than editing the generated tables by hand.
|
|
|
169
169
|
>
|
|
170
170
|
> This app demonstrates all of the Windows UI 3 library controls and styles available to make a WinUI 3 app with the Windows App SDK.
|
|
171
171
|
|
|
172
|
-
> ### Documentation: [Microsoft's Fluent UI](https://
|
|
172
|
+
> ### Documentation: [Microsoft's Fluent UI](https://developer.microsoft.com/en-us/fluentui/)
|
|
173
173
|
>
|
|
174
174
|
> Design guidelines and UI code examples for creating Windows app experiences.
|
|
175
175
|
|
|
@@ -18,44 +18,105 @@ The AutoSuggestBox component provides an input field with dynamic suggestions as
|
|
|
18
18
|
|
|
19
19
|
## Examples
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### Open on focus
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
Use `openOnFocus` to show suggestions as soon as the text box receives focus, before anything is typed.
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<AutoSuggestBox openOnFocus placeholder="Choose a fruit...">
|
|
27
|
+
{#each fruits as fruit, index (fruit.id)}
|
|
28
|
+
<AutoSuggestBoxOption {index} id={fruit.id} value={fruit.name}>
|
|
29
|
+
{fruit.name}
|
|
30
|
+
</AutoSuggestBoxOption>
|
|
31
|
+
{/each}
|
|
32
|
+
</AutoSuggestBox>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Virtualization
|
|
36
|
+
|
|
37
|
+
Window large suggestion sets by connecting AutoSuggestBox to a virtual list through the `virtualizer` prop. Its `size` is the total number of suggestions, while each option keeps its real `index`.
|
|
38
|
+
|
|
39
|
+
```svelte
|
|
40
|
+
<script>
|
|
41
|
+
import SvelteVirtualList from '@humanspeak/svelte-virtual-list';
|
|
42
|
+
|
|
43
|
+
let listRef;
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<AutoSuggestBox
|
|
47
|
+
placeholder="Type a name..."
|
|
48
|
+
virtualizer={{
|
|
49
|
+
size: people.length,
|
|
50
|
+
scrollToTop: () => listRef.scroll({ index: 0, align: 'top', smoothScroll: false }),
|
|
51
|
+
scrollToBottom: () => listRef.scroll({ index: people.length - 1, align: 'bottom', smoothScroll: false }),
|
|
52
|
+
scrollToIndex: (index) => listRef.scroll({ index, align: 'auto', smoothScroll: false })
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
<SvelteVirtualList items={people} bind:this={listRef} defaultEstimatedItemHeight={30}>
|
|
56
|
+
{#snippet renderItem(person, index)}
|
|
57
|
+
<AutoSuggestBoxOption {index} id={person.id} value={person.name}>
|
|
58
|
+
{person.name}
|
|
59
|
+
</AutoSuggestBoxOption>
|
|
60
|
+
{/snippet}
|
|
61
|
+
</SvelteVirtualList>
|
|
62
|
+
</AutoSuggestBox>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Multiselect
|
|
66
|
+
|
|
67
|
+
Allow people to choose several suggestions and optionally show the selected values in the text box.
|
|
68
|
+
|
|
69
|
+
```svelte
|
|
70
|
+
<script>
|
|
71
|
+
let selectedOptions = $state([]);
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<AutoSuggestBox multiselect showTextualMultiselect bind:selectedOptions placeholder="Choose fruits...">
|
|
75
|
+
{#each fruits as fruit, index (fruit.id)}
|
|
76
|
+
<AutoSuggestBoxOption {index} id={fruit.id} value={fruit.name}>
|
|
77
|
+
{fruit.name}
|
|
78
|
+
</AutoSuggestBoxOption>
|
|
79
|
+
{/each}
|
|
80
|
+
</AutoSuggestBox>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Virtualization with filtering
|
|
84
|
+
|
|
85
|
+
A virtualized list must filter its source data itself and report the filtered length through `virtualizer.size`.
|
|
27
86
|
|
|
28
87
|
```svelte
|
|
29
88
|
<script>
|
|
30
89
|
import SvelteVirtualList from '@humanspeak/svelte-virtual-list';
|
|
31
90
|
|
|
32
|
-
let items = $state(
|
|
91
|
+
let items = $state(people);
|
|
33
92
|
let listRef;
|
|
34
93
|
</script>
|
|
35
94
|
|
|
36
95
|
<AutoSuggestBox
|
|
37
|
-
placeholder="Type a
|
|
96
|
+
placeholder="Type a name..."
|
|
38
97
|
virtualizer={{
|
|
39
98
|
size: items.length,
|
|
40
99
|
scrollToTop: () => listRef.scroll({ index: 0, align: 'top', smoothScroll: false }),
|
|
41
|
-
scrollToBottom: () =>
|
|
100
|
+
scrollToBottom: () => {
|
|
101
|
+
if (items.length) listRef.scroll({ index: items.length - 1, align: 'bottom', smoothScroll: false });
|
|
102
|
+
},
|
|
42
103
|
scrollToIndex: (index) => listRef.scroll({ index, align: 'auto', smoothScroll: false })
|
|
43
104
|
}}
|
|
44
|
-
textChanged={(
|
|
105
|
+
textChanged={(_, value) => {
|
|
106
|
+
const query = value.trim().toLowerCase();
|
|
107
|
+
items = people.filter(({ name }) => name.toLowerCase().includes(query));
|
|
108
|
+
}}
|
|
45
109
|
>
|
|
46
110
|
<SvelteVirtualList {items} bind:this={listRef} defaultEstimatedItemHeight={30}>
|
|
47
|
-
{#snippet renderItem(
|
|
48
|
-
<AutoSuggestBoxOption {index} id={
|
|
49
|
-
{
|
|
111
|
+
{#snippet renderItem(person, index)}
|
|
112
|
+
<AutoSuggestBoxOption {index} id={person.id} value={person.name}>
|
|
113
|
+
{person.name}
|
|
50
114
|
</AutoSuggestBoxOption>
|
|
51
115
|
{/snippet}
|
|
52
116
|
</SvelteVirtualList>
|
|
53
117
|
</AutoSuggestBox>
|
|
54
118
|
```
|
|
55
119
|
|
|
56
|
-
Filtering is yours to do in `textChanged`: a windowed list renders from your data, so the
|
|
57
|
-
built-in filter that a plain option list applies is skipped.
|
|
58
|
-
|
|
59
120
|
## Component Props
|
|
60
121
|
|
|
61
122
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts" generics="T extends BreadcrumbItemGenerics = 'button'">
|
|
2
|
+
import { invokeHandlers, RenderSoC } from '../../internal/index.js';
|
|
3
|
+
import type { BreadcrumbButtonProps, BreadcrumbItemElementDOMType, BreadcrumbItemGenerics } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
as = 'button' as T,
|
|
7
|
+
ref = $bindable(),
|
|
8
|
+
icon,
|
|
9
|
+
iconPosition = 'before',
|
|
10
|
+
current = false,
|
|
11
|
+
disabled,
|
|
12
|
+
disabledFocusable = false,
|
|
13
|
+
onclick,
|
|
14
|
+
class: classes,
|
|
15
|
+
children,
|
|
16
|
+
...attributes
|
|
17
|
+
}: BreadcrumbButtonProps<T> = $props();
|
|
18
|
+
|
|
19
|
+
const _as = $derived.by(() => {
|
|
20
|
+
if (as !== 'button' && as !== 'a') throw new Error(`Invalid tag: ${as}. Must be one of button, a`);
|
|
21
|
+
return as;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const nativelyDisabled = $derived(_as === 'button' && disabled && !disabledFocusable);
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<!--
|
|
28
|
+
@component
|
|
29
|
+
A step of a `Breadcrumb` that can be activated: an anchor when it goes somewhere, a button when
|
|
30
|
+
it does something. The last step is the page itself, and `current` is what announces it.
|
|
31
|
+
|
|
32
|
+
- Usage:
|
|
33
|
+
```tsx
|
|
34
|
+
<BreadcrumbButton as="a" href="/files" icon={FolderRegular}>Files</BreadcrumbButton>
|
|
35
|
+
<BreadcrumbButton current>This page</BreadcrumbButton>
|
|
36
|
+
```
|
|
37
|
+
-->
|
|
38
|
+
<svelte:element
|
|
39
|
+
this={_as}
|
|
40
|
+
bind:this={ref as BreadcrumbItemElementDOMType[T]}
|
|
41
|
+
type={_as === 'button' ? 'button' : undefined}
|
|
42
|
+
disabled={nativelyDisabled || undefined}
|
|
43
|
+
aria-disabled={disabled || undefined}
|
|
44
|
+
aria-current={current ? 'page' : undefined}
|
|
45
|
+
class={['fs-breadcrumb-button', { current, disabled }, classes]}
|
|
46
|
+
onclick={(e: MouseEvent) => invokeHandlers(e, disabled, [onclick])}
|
|
47
|
+
{...attributes}
|
|
48
|
+
>
|
|
49
|
+
{#if icon && iconPosition === 'before'}
|
|
50
|
+
<span class="fs-breadcrumb-button-icon">
|
|
51
|
+
<RenderSoC SoC={icon} />
|
|
52
|
+
</span>
|
|
53
|
+
{/if}
|
|
54
|
+
<span class="fs-breadcrumb-button-label">
|
|
55
|
+
{@render children?.()}
|
|
56
|
+
</span>
|
|
57
|
+
{#if icon && iconPosition === 'after'}
|
|
58
|
+
<span class="fs-breadcrumb-button-icon">
|
|
59
|
+
<RenderSoC SoC={icon} />
|
|
60
|
+
</span>
|
|
61
|
+
{/if}
|
|
62
|
+
</svelte:element>
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
.fs-breadcrumb-button {
|
|
66
|
+
display: inline-flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: var(--fs-breadcrumb-gap, 0.25rem);
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
height: var(--fs-breadcrumb-height, 1.5rem);
|
|
72
|
+
padding: 0 var(--fs-breadcrumb-padding-inline, 0.375rem);
|
|
73
|
+
border: none;
|
|
74
|
+
border-radius: var(--fs-control-border-radius);
|
|
75
|
+
background: transparent;
|
|
76
|
+
color: var(--fs-text-secondary);
|
|
77
|
+
font-family: inherit;
|
|
78
|
+
font-size: var(--fs-breadcrumb-font-size, var(--fs-body2-font-size));
|
|
79
|
+
line-height: var(--fs-breadcrumb-line-height, var(--fs-body2-line-height));
|
|
80
|
+
/* An anchor arrives underlined and in the colour of a link; a step is neither. */
|
|
81
|
+
text-decoration: none;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
outline: none;
|
|
84
|
+
transition:
|
|
85
|
+
color var(--fs-fast-duration) var(--fs-point-to-point),
|
|
86
|
+
background var(--fs-fast-duration) var(--fs-point-to-point);
|
|
87
|
+
&:hover:not(.disabled) {
|
|
88
|
+
background: var(--fs-subtle-fill-secondary);
|
|
89
|
+
color: var(--fs-text-primary);
|
|
90
|
+
}
|
|
91
|
+
&:active:not(.disabled) {
|
|
92
|
+
background: var(--fs-subtle-fill-tertiary);
|
|
93
|
+
color: var(--fs-text-secondary);
|
|
94
|
+
}
|
|
95
|
+
&:focus-visible {
|
|
96
|
+
outline: 0.125rem var(--fs-focus-stroke-outer) solid;
|
|
97
|
+
outline-offset: 0.125rem;
|
|
98
|
+
}
|
|
99
|
+
/* The end of the trail is where the reader already is, so it reads as text, not as a way out. */
|
|
100
|
+
&.current {
|
|
101
|
+
color: var(--fs-text-primary);
|
|
102
|
+
font-weight: 600;
|
|
103
|
+
cursor: default;
|
|
104
|
+
&:hover,
|
|
105
|
+
&:active {
|
|
106
|
+
background: transparent;
|
|
107
|
+
color: var(--fs-text-primary);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
&.disabled {
|
|
111
|
+
color: var(--fs-text-disabled);
|
|
112
|
+
cursor: not-allowed;
|
|
113
|
+
}
|
|
114
|
+
& .fs-breadcrumb-button-icon {
|
|
115
|
+
display: flex;
|
|
116
|
+
flex: 0 0 auto;
|
|
117
|
+
align-items: center;
|
|
118
|
+
justify-content: center;
|
|
119
|
+
& :global(svg) {
|
|
120
|
+
width: var(--fs-breadcrumb-icon-size, 1rem);
|
|
121
|
+
height: var(--fs-breadcrumb-icon-size, 1rem);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
& .fs-breadcrumb-button-label {
|
|
125
|
+
overflow: hidden;
|
|
126
|
+
text-overflow: ellipsis;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { BreadcrumbButtonProps, BreadcrumbItemGenerics } from './types.ts';
|
|
2
|
+
declare function $$render<T extends BreadcrumbItemGenerics = 'button'>(): {
|
|
3
|
+
props: BreadcrumbButtonProps<T>;
|
|
4
|
+
exports: {};
|
|
5
|
+
bindings: "ref";
|
|
6
|
+
slots: {};
|
|
7
|
+
events: {};
|
|
8
|
+
};
|
|
9
|
+
declare class __sveltets_Render<T extends BreadcrumbItemGenerics = 'button'> {
|
|
10
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
11
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
12
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
13
|
+
bindings(): "ref";
|
|
14
|
+
exports(): {};
|
|
15
|
+
}
|
|
16
|
+
interface $$IsomorphicComponent {
|
|
17
|
+
new <T extends BreadcrumbItemGenerics = 'button'>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
18
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
19
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
20
|
+
<T extends BreadcrumbItemGenerics = 'button'>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
21
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A step of a `Breadcrumb` that can be activated: an anchor when it goes somewhere, a button when
|
|
25
|
+
* it does something. The last step is the page itself, and `current` is what announces it.
|
|
26
|
+
*
|
|
27
|
+
* - Usage:
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <BreadcrumbButton as="a" href="/files" icon={FolderRegular}>Files</BreadcrumbButton>
|
|
30
|
+
* <BreadcrumbButton current>This page</BreadcrumbButton>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare const BreadcrumbButton: $$IsomorphicComponent;
|
|
34
|
+
type BreadcrumbButton<T extends BreadcrumbItemGenerics = 'button'> = InstanceType<typeof BreadcrumbButton<T>>;
|
|
35
|
+
export default BreadcrumbButton;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import ChevronRightRegular from 'fluentui-icons-svelte/ChevronRightRegular.svelte';
|
|
3
|
+
import type { BreadcrumbDividerProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
let { ref = $bindable(), class: classes, children, ...attributes }: BreadcrumbDividerProps = $props();
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<!--
|
|
9
|
+
@component
|
|
10
|
+
The mark between two steps of a `Breadcrumb`. It is decoration, so it is held out of the
|
|
11
|
+
accessibility tree: a reader counting the steps of the trail should not be read a chevron
|
|
12
|
+
between each one, nor be told the list is twice as long as it is.
|
|
13
|
+
|
|
14
|
+
- Usage:
|
|
15
|
+
```tsx
|
|
16
|
+
<BreadcrumbDivider />
|
|
17
|
+
```
|
|
18
|
+
-->
|
|
19
|
+
<li bind:this={ref} aria-hidden="true" class={['fs-breadcrumb-divider', classes]} {...attributes}>
|
|
20
|
+
{#if children}
|
|
21
|
+
{@render children()}
|
|
22
|
+
{:else}
|
|
23
|
+
<ChevronRightRegular />
|
|
24
|
+
{/if}
|
|
25
|
+
</li>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.fs-breadcrumb-divider {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex: 0 0 auto;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
color: var(--fs-text-secondary);
|
|
34
|
+
& :global(svg) {
|
|
35
|
+
width: var(--fs-breadcrumb-divider-size, 0.75rem);
|
|
36
|
+
height: var(--fs-breadcrumb-divider-size, 0.75rem);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BreadcrumbDividerProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The mark between two steps of a `Breadcrumb`. It is decoration, so it is held out of the
|
|
4
|
+
* accessibility tree: a reader counting the steps of the trail should not be read a chevron
|
|
5
|
+
* between each one, nor be told the list is twice as long as it is.
|
|
6
|
+
*
|
|
7
|
+
* - Usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <BreadcrumbDivider />
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
declare const BreadcrumbDivider: import("svelte").Component<BreadcrumbDividerProps, {}, "ref">;
|
|
13
|
+
type BreadcrumbDivider = ReturnType<typeof BreadcrumbDivider>;
|
|
14
|
+
export default BreadcrumbDivider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BreadcrumbItemProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { ref = $bindable(), class: classes, children, ...attributes }: BreadcrumbItemProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
@component
|
|
9
|
+
One step of a `Breadcrumb`: the list item the step lives in. What goes inside is usually a
|
|
10
|
+
`BreadcrumbButton`, but it takes anything — a menu holding the steps that were folded away, for
|
|
11
|
+
instance.
|
|
12
|
+
|
|
13
|
+
- Usage:
|
|
14
|
+
```tsx
|
|
15
|
+
<BreadcrumbItem>
|
|
16
|
+
<BreadcrumbButton as="a" href="/">Home</BreadcrumbButton>
|
|
17
|
+
</BreadcrumbItem>
|
|
18
|
+
```
|
|
19
|
+
-->
|
|
20
|
+
<li bind:this={ref} class={['fs-breadcrumb-item', classes]} {...attributes}>
|
|
21
|
+
{@render children?.()}
|
|
22
|
+
</li>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
.fs-breadcrumb-item {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
min-width: 0;
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BreadcrumbItemProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* One step of a `Breadcrumb`: the list item the step lives in. What goes inside is usually a
|
|
4
|
+
* `BreadcrumbButton`, but it takes anything — a menu holding the steps that were folded away, for
|
|
5
|
+
* instance.
|
|
6
|
+
*
|
|
7
|
+
* - Usage:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <BreadcrumbItem>
|
|
10
|
+
* <BreadcrumbButton as="a" href="/">Home</BreadcrumbButton>
|
|
11
|
+
* </BreadcrumbItem>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare const BreadcrumbItem: import("svelte").Component<BreadcrumbItemProps, {}, "ref">;
|
|
15
|
+
type BreadcrumbItem = ReturnType<typeof BreadcrumbItem>;
|
|
16
|
+
export default BreadcrumbItem;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getTabspotAttributes } from 'tabspot';
|
|
3
|
+
import type { BreadcrumbProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
/** The steps a mover lands on when the trail takes a single tab stop. */
|
|
6
|
+
const TABSPOT_ITEMS = '.fs-breadcrumb-button';
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
ref = $bindable(),
|
|
10
|
+
listRef = $bindable(),
|
|
11
|
+
listProps,
|
|
12
|
+
size = 'medium',
|
|
13
|
+
focusMode = 'tab',
|
|
14
|
+
'aria-label': ariaLabel,
|
|
15
|
+
'aria-labelledby': ariaLabelledby,
|
|
16
|
+
class: classes,
|
|
17
|
+
children,
|
|
18
|
+
...attributes
|
|
19
|
+
}: BreadcrumbProps = $props();
|
|
20
|
+
|
|
21
|
+
const tabspotAttributes = $derived(
|
|
22
|
+
focusMode === 'arrow' &&
|
|
23
|
+
getTabspotAttributes({
|
|
24
|
+
root: { manageSpecialKeys: { Home: true, End: true } },
|
|
25
|
+
mover: { axis: 'horizontal', items: TABSPOT_ITEMS }
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<!--
|
|
31
|
+
@component
|
|
32
|
+
A breadcrumb shows where a page sits in the hierarchy above it, and gives the reader a way back
|
|
33
|
+
up. It renders a landmark of its own, so a screen reader can jump straight to it.
|
|
34
|
+
|
|
35
|
+
- Usage:
|
|
36
|
+
```tsx
|
|
37
|
+
<script>
|
|
38
|
+
import { Breadcrumb, BreadcrumbItem, BreadcrumbButton, BreadcrumbDivider } from 'fluentui-svelte';
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<Breadcrumb>
|
|
42
|
+
<BreadcrumbItem>
|
|
43
|
+
<BreadcrumbButton as="a" href="/">Home</BreadcrumbButton>
|
|
44
|
+
</BreadcrumbItem>
|
|
45
|
+
<BreadcrumbDivider />
|
|
46
|
+
<BreadcrumbItem>
|
|
47
|
+
<BreadcrumbButton current>This page</BreadcrumbButton>
|
|
48
|
+
</BreadcrumbItem>
|
|
49
|
+
</Breadcrumb>
|
|
50
|
+
```
|
|
51
|
+
-->
|
|
52
|
+
<nav
|
|
53
|
+
bind:this={ref}
|
|
54
|
+
aria-label={ariaLabelledby ? undefined : (ariaLabel ?? 'Breadcrumb')}
|
|
55
|
+
aria-labelledby={ariaLabelledby}
|
|
56
|
+
class={['fs-breadcrumb', size, classes]}
|
|
57
|
+
{...attributes}
|
|
58
|
+
>
|
|
59
|
+
<ol bind:this={listRef} class="fs-breadcrumb-list" {...tabspotAttributes} {...listProps}>
|
|
60
|
+
{@render children?.()}
|
|
61
|
+
</ol>
|
|
62
|
+
</nav>
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
.fs-breadcrumb {
|
|
66
|
+
font-family: var(--fs-font-family-base);
|
|
67
|
+
color: var(--fs-text-primary);
|
|
68
|
+
/* Read by every step and divider */
|
|
69
|
+
--fs-breadcrumb-font-size: var(--fs-body2-font-size);
|
|
70
|
+
--fs-breadcrumb-line-height: var(--fs-body2-line-height);
|
|
71
|
+
--fs-breadcrumb-height: 1.5rem;
|
|
72
|
+
--fs-breadcrumb-padding-inline: 0.375rem;
|
|
73
|
+
--fs-breadcrumb-gap: 0.25rem;
|
|
74
|
+
--fs-breadcrumb-icon-size: 1rem;
|
|
75
|
+
--fs-breadcrumb-divider-size: 1rem;
|
|
76
|
+
&.small {
|
|
77
|
+
--fs-breadcrumb-font-size: var(--fs-caption-font-size);
|
|
78
|
+
--fs-breadcrumb-line-height: var(--fs-caption-line-height);
|
|
79
|
+
--fs-breadcrumb-height: 1.25rem;
|
|
80
|
+
--fs-breadcrumb-padding-inline: 0.25rem;
|
|
81
|
+
--fs-breadcrumb-icon-size: 0.875rem;
|
|
82
|
+
--fs-breadcrumb-divider-size: 0.625rem;
|
|
83
|
+
}
|
|
84
|
+
&.large {
|
|
85
|
+
--fs-breadcrumb-font-size: var(--fs-body-font-size);
|
|
86
|
+
--fs-breadcrumb-line-height: var(--fs-body-line-height);
|
|
87
|
+
--fs-breadcrumb-height: 2rem;
|
|
88
|
+
--fs-breadcrumb-padding-inline: 0.5rem;
|
|
89
|
+
--fs-breadcrumb-icon-size: 1.25rem;
|
|
90
|
+
--fs-breadcrumb-divider-size: 1.25rem;
|
|
91
|
+
}
|
|
92
|
+
& .fs-breadcrumb-list {
|
|
93
|
+
display: flex;
|
|
94
|
+
flex-wrap: wrap;
|
|
95
|
+
align-items: center;
|
|
96
|
+
margin: 0;
|
|
97
|
+
padding: 0;
|
|
98
|
+
list-style: none;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BreadcrumbProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A breadcrumb shows where a page sits in the hierarchy above it, and gives the reader a way back
|
|
4
|
+
* up. It renders a landmark of its own, so a screen reader can jump straight to it.
|
|
5
|
+
*
|
|
6
|
+
* - Usage:
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <script>
|
|
9
|
+
* import { Breadcrumb, BreadcrumbItem, BreadcrumbButton, BreadcrumbDivider } from 'fluentui-svelte';
|
|
10
|
+
* </script>
|
|
11
|
+
*
|
|
12
|
+
* <Breadcrumb>
|
|
13
|
+
* <BreadcrumbItem>
|
|
14
|
+
* <BreadcrumbButton as="a" href="/">Home</BreadcrumbButton>
|
|
15
|
+
* </BreadcrumbItem>
|
|
16
|
+
* <BreadcrumbDivider />
|
|
17
|
+
* <BreadcrumbItem>
|
|
18
|
+
* <BreadcrumbButton current>This page</BreadcrumbButton>
|
|
19
|
+
* </BreadcrumbItem>
|
|
20
|
+
* </Breadcrumb>
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare const Breadcrumb: import("svelte").Component<BreadcrumbProps, {}, "ref" | "listRef">;
|
|
24
|
+
type Breadcrumb = ReturnType<typeof Breadcrumb>;
|
|
25
|
+
export default Breadcrumb;
|