fluentui-svelte 0.3.0 → 0.4.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.
Files changed (33) hide show
  1. package/dist/components/breadcrumb/breadcrumb-button.svelte +130 -0
  2. package/dist/components/breadcrumb/breadcrumb-button.svelte.d.ts +35 -0
  3. package/dist/components/breadcrumb/breadcrumb-divider.svelte +39 -0
  4. package/dist/components/breadcrumb/breadcrumb-divider.svelte.d.ts +14 -0
  5. package/dist/components/breadcrumb/breadcrumb-item.svelte +30 -0
  6. package/dist/components/breadcrumb/breadcrumb-item.svelte.d.ts +16 -0
  7. package/dist/components/breadcrumb/breadcrumb.svelte +101 -0
  8. package/dist/components/breadcrumb/breadcrumb.svelte.d.ts +25 -0
  9. package/dist/components/breadcrumb/docs/llms.md +193 -0
  10. package/dist/components/breadcrumb/types.d.ts +80 -0
  11. package/dist/components/breadcrumb/types.js +1 -0
  12. package/dist/components/tab-view/docs/llms.md +146 -0
  13. package/dist/components/tab-view/tab-view-tab.svelte +290 -0
  14. package/dist/components/tab-view/tab-view-tab.svelte.d.ts +20 -0
  15. package/dist/components/tab-view/tab-view.svelte +188 -0
  16. package/dist/components/tab-view/tab-view.svelte.d.ts +26 -0
  17. package/dist/components/tab-view/tab-view.svelte.js +15 -0
  18. package/dist/components/tab-view/types.d.ts +79 -0
  19. package/dist/components/tab-view/types.js +1 -0
  20. package/dist/components/top-nav/docs/llms.md +176 -0
  21. package/dist/components/top-nav/top-nav-item.svelte +234 -0
  22. package/dist/components/top-nav/top-nav-item.svelte.d.ts +41 -0
  23. package/dist/components/top-nav/top-nav.svelte +259 -0
  24. package/dist/components/top-nav/top-nav.svelte.d.ts +26 -0
  25. package/dist/components/top-nav/top-nav.svelte.js +18 -0
  26. package/dist/components/top-nav/types.d.ts +89 -0
  27. package/dist/components/top-nav/types.js +1 -0
  28. package/dist/css/class-darkmode.css +1 -1
  29. package/dist/css/media-darkmode.css +1 -1
  30. package/dist/css/theme.css +1 -1
  31. package/dist/index.d.ts +8 -0
  32. package/dist/index.js +14 -0
  33. package/package.json +1 -1
@@ -0,0 +1,79 @@
1
+ import type { FSContext } from '../../internal/index.js';
2
+ import type { Snippet, Component } from 'svelte';
3
+ import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
4
+ /** How every tab of the strip takes its width. */
5
+ export type TabWidthMode = 'equal' | 'size-to-content' | 'compact';
6
+ export type TabViewContext = FSContext<{
7
+ closable: boolean;
8
+ tabWidthMode: TabWidthMode;
9
+ }, {
10
+ activeTab: string;
11
+ }, null, {
12
+ setActiveTab: (event: Event, value: string) => void;
13
+ closeTab: (event: Event, value: string) => void;
14
+ }>;
15
+ /** @propsmith TabViewProps */
16
+ export type TabViewProps = {
17
+ /** The DOM reference of the element wrapping the strip.
18
+ * @bindable
19
+ */
20
+ ref?: HTMLDivElement;
21
+ /** The DOM reference of the tab list.
22
+ * @bindable
23
+ */
24
+ listRef?: HTMLDivElement;
25
+ /** The props to spread on the tab list element, where the `tablist` role and its label belong.
26
+ * @type HTMLAttributes
27
+ */
28
+ listProps?: HTMLAttributes<HTMLDivElement>;
29
+ /** The value of the selected tab.
30
+ * @bindable
31
+ */
32
+ activeTab?: string;
33
+ /** Fired when the selected tab changes. */
34
+ onTabChange?: (event: Event, value: string) => void;
35
+ /** Every tab shows a close button, unless the tab opts out of it.
36
+ * @default false
37
+ */
38
+ closable?: boolean;
39
+ /** Fired when a tab asks to be closed. Removing the tab is left to the consumer. */
40
+ onTabClose?: (event: Event, value: string) => void;
41
+ /** Shows the button that adds a new tab at the end of the strip.
42
+ * @default false
43
+ */
44
+ showNewTabButton?: boolean;
45
+ /** Fired when the new tab button is activated. */
46
+ onNewTab?: (event: MouseEvent) => void;
47
+ /** The props to spread on the new tab button.
48
+ * @type HTMLButtonAttributes
49
+ */
50
+ newTabButtonProps?: HTMLButtonAttributes;
51
+ /** How the tabs take their width: sharing the strip evenly, sizing to their own content, or
52
+ * shrinking to the icon of every tab but the selected one.
53
+ * @default 'equal'
54
+ */
55
+ tabWidthMode?: TabWidthMode;
56
+ /** Opts the strip out of the tabspot focus management, to wire your own.
57
+ * @default false
58
+ */
59
+ disableTabspot?: boolean;
60
+ } & HTMLAttributes<HTMLDivElement>;
61
+ /** @propsmith TabViewTabProps */
62
+ export type TabViewTabProps = {
63
+ /** The DOM reference of the tab element.
64
+ * @bindable
65
+ */
66
+ ref?: HTMLDivElement;
67
+ /** The value that identifies the tab. Defaults to a generated id. */
68
+ value?: string;
69
+ /** The icon to display before the label.
70
+ * @type Snippet | Component
71
+ */
72
+ icon?: Snippet | Component;
73
+ /** Shows the close button of the tab. Falls back to the `closable` of the strip. */
74
+ closable?: boolean;
75
+ /** Disables the user interaction. */
76
+ disabled?: boolean;
77
+ /** Fired when the tab asks to be closed, either from its close button or the `Delete` key. */
78
+ onClose?: (event: Event, value: string) => void;
79
+ } & HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,176 @@
1
+ # TopNav
2
+
3
+ TopNav gives a single selection from a row of items, with a bar that marks the selected one. Each item carries a short label and often an icon.
4
+
5
+ The bar belongs to the strip rather than to any one item: when the selection moves it travels to the item that took it, staying on screen the whole way instead of disappearing from one and reappearing under the next.
6
+
7
+ The strip owns the selection and nothing else. What an item opens is rendered by you, wherever it belongs on the page, so an item can open a panel underneath it, swap a region somewhere else, or drive a route.
8
+
9
+ To create a top nav, you will need to use the following components:
10
+
11
+ - `TopNav`: The root component that creates the context every item reads: which item is selected, the appearance, the size and the axis. It renders the `tablist` and the bar that travels across it.
12
+ - `TopNavItem`: A single item of the strip. It reports its own selection and can carry an icon.
13
+
14
+ ## Usage
15
+
16
+ A top nav expects a `value` on every item and a `selectedValue` to match it against. Bind `selectedValue` to follow the selection, and render whatever the selected item opens yourself.
17
+
18
+ ```svelte
19
+ <script>
20
+ import { TopNav, TopNavItem } from 'fluentui-svelte';
21
+
22
+ let selectedValue = $state('arrivals');
23
+ </script>
24
+
25
+ <TopNav bind:selectedValue aria-label="Flights">
26
+ <TopNavItem id="tab-arrivals" value="arrivals">Arrivals</TopNavItem>
27
+ <TopNavItem id="tab-departures" value="departures">Departures</TopNavItem>
28
+ </TopNav>
29
+
30
+ {#if selectedValue === 'arrivals'}
31
+ <div role="tabpanel" aria-labelledby="tab-arrivals">Everything landing in the next hour.</div>
32
+ {:else}
33
+ <div role="tabpanel" aria-labelledby="tab-departures">Everything leaving in the next hour.</div>
34
+ {/if}
35
+ ```
36
+
37
+ ## Examples
38
+
39
+ ### Appearance
40
+
41
+ `appearance` decides how the strip is painted. `transparent` has no background of its own and `subtle` fills an item while it is engaged; both mark the selection with the travelling bar. The two circular appearances trade that bar for a pill: `subtle-circular` outlines the selected item and `filled-circular` fills it.
42
+
43
+ ```svelte
44
+ <TopNav appearance="transparent">...</TopNav>
45
+ <TopNav appearance="subtle">...</TopNav>
46
+ <TopNav appearance="subtle-circular">...</TopNav>
47
+ <TopNav appearance="filled-circular">...</TopNav>
48
+ ```
49
+
50
+ ### Size
51
+
52
+ `size` sets the padding, the type and the thickness of the bar for every item at once.
53
+
54
+ ```svelte
55
+ <TopNav size="small">...</TopNav>
56
+ <TopNav size="medium">...</TopNav>
57
+ <TopNav size="large">...</TopNav>
58
+ ```
59
+
60
+ ### Vertical
61
+
62
+ `vertical` stacks the items in a column and moves the bar to their leading edge, where it travels up and down instead of across. The arrow keys follow the same turn.
63
+
64
+ ```svelte
65
+ <TopNav bind:selectedValue vertical>
66
+ <TopNavItem value="tab1">First Tab</TopNavItem>
67
+ <TopNavItem value="tab2">Second Tab</TopNavItem>
68
+ </TopNav>
69
+ ```
70
+
71
+ ### Icon
72
+
73
+ `icon` takes a snippet or a component and renders it before the label.
74
+
75
+ ```svelte
76
+ <script>
77
+ import { TopNav, TopNavItem } from 'fluentui-svelte';
78
+ import { AirplaneRegular, AirplaneTakeOffRegular } from 'fluentui-icons-svelte';
79
+ </script>
80
+
81
+ <TopNav bind:selectedValue>
82
+ <TopNavItem value="arrivals" icon={AirplaneRegular}>Arrivals</TopNavItem>
83
+ <TopNavItem value="departures" icon={AirplaneTakeOffRegular}>Departures</TopNavItem>
84
+ </TopNav>
85
+ ```
86
+
87
+ ### As an Anchor
88
+
89
+ `as="a"` renders the item as an anchor and takes the attributes of one, `href` among them, so the item has a real URL to open in a new tab or copy. It still reports as a `tab`, which is what a strip of tabs over one page should be; if the items are navigation between pages rather than tabs, a `nav` of plain links is the better shape.
90
+
91
+ ```svelte
92
+ <TopNav bind:selectedValue>
93
+ <TopNavItem as="a" href="#arrivals" value="arrivals">Arrivals</TopNavItem>
94
+ <TopNavItem as="a" href="#departures" value="departures">Departures</TopNavItem>
95
+ </TopNav>
96
+ ```
97
+
98
+ ### Disabled
99
+
100
+ `disabled` on the strip disables every item at once, and a single item can be disabled on its own. The arrow keys pass over a disabled item rather than landing on it.
101
+
102
+ ```svelte
103
+ <TopNav disabled>...</TopNav>
104
+
105
+ <TopNav>
106
+ <TopNavItem value="tab1">First Tab</TopNavItem>
107
+ <TopNavItem value="tab2" disabled>Second Tab</TopNavItem>
108
+ </TopNav>
109
+ ```
110
+
111
+ ### Select on Focus
112
+
113
+ `selectTabOnFocus` selects an item as soon as the focus reaches it, so the arrow keys move the selection rather than only the focus. Use it when what an item opens is already on the page; leave it off when opening one costs a request.
114
+
115
+ ```svelte
116
+ <TopNav bind:selectedValue selectTabOnFocus>
117
+ <TopNavItem value="tab1">First Tab</TopNavItem>
118
+ <TopNavItem value="tab2">Second Tab</TopNavItem>
119
+ </TopNav>
120
+ ```
121
+
122
+ ### Reserved Space
123
+
124
+ A selected item sets its label in semibold, which is wider than the same label at rest. `reserveSelectedTabSpace` is on by default and holds that width from the start, so selecting an item never shoves the ones beside it along. Turning it off lets the items size to what they are showing, and the row shifts as the selection moves.
125
+
126
+ ```svelte
127
+ <TopNav bind:selectedValue reserveSelectedTabSpace={false}>
128
+ <TopNavItem value="tab1">First Tab</TopNavItem>
129
+ <TopNavItem value="tab2">Second Tab</TopNavItem>
130
+ </TopNav>
131
+ ```
132
+
133
+ ## Component Props (TopNav)
134
+
135
+ <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
136
+ <!-- props:TopNavProps -->
137
+
138
+ | Name | Type | Default | Description |
139
+ | -------------------------- | ------------------------------------------------------------------------------ | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
140
+ | `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the strip. |
141
+ | `selectedValue` _bindable_ | `string` | | The value of the selected item. |
142
+ | `onTabSelect` | `(event: Event, value: string) => void` | | Fired when an item is selected. |
143
+ | `appearance` | [`TopNavAppearance`](https://fluentui-svelte.dev/docs/types/#topnavappearance) | `'transparent'` | How the strip is painted: `transparent` has no background of its own, `subtle` fills an item while it is engaged, and the two circular appearances trade the moving bar for a pill. |
144
+ | `size` | `'small'` &#124; `'medium'` &#124; `'large'` | `'medium'` | The size of every item of the strip. |
145
+ | `vertical` | `boolean` | `false` | Arranges the items in a column, with the bar down their leading edge. |
146
+ | `disabled` | `boolean` | `false` | Disables the user interaction on every item. |
147
+ | `selectTabOnFocus` | `boolean` | `false` | Selects an item as soon as the focus reaches it, rather than waiting to be asked. |
148
+ | `reserveSelectedTabSpace` | `boolean` | `true` | A selected item sets its label in semibold, which is wider than the same label at rest. This holds that width from the start, so selecting an item never shifts the ones beside it. |
149
+ | `disableTabspot` | `boolean` | `false` | Opts the strip out of the tabspot focus management, to wire your own. |
150
+ | Element Attributes (`div`) | | | |
151
+
152
+ <!-- /props:TopNavProps -->
153
+
154
+ ## Component Props (TopNavItem)
155
+
156
+ <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
157
+ <!-- props:TopNavItemProps -->
158
+
159
+ | Name | Type | Default | Description |
160
+ | ---------------- | ----------------------------- | ---------- | ---------------------------------------------------------------------------------------------------------------------------------- |
161
+ | `ref` _bindable_ | `TopNavItemElementDOMType[T]` | | The DOM reference of the item. |
162
+ | `as` | `'button'` &#124; `'a'` | `'button'` | The DOM element to render. An anchor takes the attributes of one, `href` among them, and is what an item that navigates should be. |
163
+ | `value` | `string` | | The value that identifies the item. Defaults to a generated id. |
164
+ | `icon` | `Snippet` &#124; `Component` | | The icon to display before the label. |
165
+ | `disabled` | `boolean` | | Disables the user interaction. |
166
+ | HTML Attributes | | | |
167
+
168
+ <!-- /props:TopNavItemProps -->
169
+
170
+ ## Keyboard Navigation
171
+
172
+ The strip is a single tab stop. The arrows walk the items along the axis they are laid out on, `Home` and `End` jump to the ends, and `Enter` and `Space` select the focused item — or `selectTabOnFocus` selects it on arrival. `disableTabspot` hands the focus management back to you.
173
+
174
+ ## Accessibility
175
+
176
+ The strip renders a `tablist` and every item a `tab`, so give it a name through `aria-label`. Since you render what an item opens, give that element a `tabpanel` role and point its `aria-labelledby` at the `id` of its item. An item with an icon and no label needs an `aria-label` of its own.
@@ -0,0 +1,234 @@
1
+ <script lang="ts" generics="T extends TopNavItemGenerics = 'button'">
2
+ import { invokeHandlers, RenderSoC } from '../../internal/index.js';
3
+ import { COMPONENT_NAME, requireTopNavContext } from './top-nav.svelte.js';
4
+ import type { TopNavItemElementDOMType, TopNavItemGenerics, TopNavItemProps } from './types.js';
5
+
6
+ const ID = $props.id();
7
+
8
+ let {
9
+ as = 'button' as T,
10
+ ref = $bindable(),
11
+ value = `${COMPONENT_NAME}-${ID}`,
12
+ icon,
13
+ disabled,
14
+ onclick,
15
+ onfocus,
16
+ class: classes,
17
+ children,
18
+ ...attributes
19
+ }: TopNavItemProps<T> = $props();
20
+
21
+ const context = requireTopNavContext();
22
+
23
+ const selected = $derived(context.state.selectedValue === value);
24
+
25
+ /** The item can be disabled on its own, and the strip can disable every one of them at once. */
26
+ const _disabled = $derived(disabled || context.config.disabled);
27
+
28
+ /**
29
+ * The tag the invariant rules over. The markup renders it through here, so it is checked during
30
+ * SSR and on every prop update rather than only once on mount.
31
+ */
32
+ const _as = $derived.by(() => {
33
+ if (as !== 'button' && as !== 'a') throw new Error(`Invalid tag: ${as}. Must be one of button, a`);
34
+ return as;
35
+ });
36
+ </script>
37
+
38
+ <!--
39
+ @component
40
+ A single item of a `TopNav`. It reports its own selection and can carry an icon.
41
+
42
+ - Usage:
43
+ ```tsx
44
+ <script>
45
+ import { TopNav, TopNavItem } from 'fluentui-svelte';
46
+ import { AirplaneRegular } from 'fluentui-icons-svelte';
47
+ </script>
48
+
49
+ <TopNav selectedValue="arrivals" aria-label="Flights">
50
+ <TopNavItem value="arrivals" icon={AirplaneRegular}>Arrivals</TopNavItem>
51
+ <TopNavItem as="a" href="/departures" value="departures">Departures</TopNavItem>
52
+ </TopNav>
53
+ ```
54
+ -->
55
+ <svelte:element
56
+ this={_as}
57
+ bind:this={ref as TopNavItemElementDOMType[T]}
58
+ type={_as === 'button' ? 'button' : undefined}
59
+ role="tab"
60
+ data-value={value}
61
+ aria-selected={selected}
62
+ disabled={_as === 'button' ? _disabled : undefined}
63
+ aria-disabled={_as === 'a' && _disabled ? true : undefined}
64
+ class={[
65
+ 'fs-top-nav-item',
66
+ context.config.appearance,
67
+ { selected, vertical: context.config.vertical, disabled: _disabled },
68
+ classes
69
+ ]}
70
+ onclick={(e: MouseEvent) => invokeHandlers(e, _disabled, [() => context.methods.selectTab(e, value), onclick])}
71
+ onfocus={(e: FocusEvent) =>
72
+ invokeHandlers(e, _disabled, [
73
+ () => context.config.selectTabOnFocus && context.methods.selectTab(e, value),
74
+ onfocus
75
+ ])}
76
+ {...attributes}
77
+ >
78
+ {#if icon}
79
+ <span class="fs-top-nav-item-icon">
80
+ <RenderSoC SoC={icon} />
81
+ </span>
82
+ {/if}
83
+ <span class="fs-top-nav-item-content">
84
+ {@render children?.()}
85
+ {#if context.config.reserveSelectedTabSpace}
86
+ <!--
87
+ The label again, in the weight it takes once selected, laid out but never shown. The item
88
+ is then already as wide as its widest state, so selecting it cannot shove its neighbours
89
+ along. It is held out of the accessibility tree, where it would read as a second label.
90
+ -->
91
+ <span class="fs-top-nav-item-reserve" aria-hidden="true">{@render children?.()}</span>
92
+ {/if}
93
+ </span>
94
+ </svelte:element>
95
+
96
+ <style>
97
+ .fs-top-nav-item {
98
+ position: relative;
99
+ display: flex;
100
+ flex: 0 0 auto;
101
+ align-items: center;
102
+ justify-content: center;
103
+ gap: var(--fs-top-nav-item-gap, 0.5rem);
104
+ padding: var(--fs-top-nav-item-padding-block, 0.375rem) var(--fs-top-nav-item-padding-inline, 0.375rem);
105
+ border: none;
106
+ border-radius: var(--fs-control-border-radius);
107
+ background: transparent;
108
+ color: var(--fs-text-secondary);
109
+ font-family: inherit;
110
+ font-size: var(--fs-top-nav-item-font-size, var(--fs-body2-font-size));
111
+ line-height: var(--fs-top-nav-item-line-height, var(--fs-body2-line-height));
112
+ white-space: nowrap;
113
+ /* An anchor arrives underlined and in the colour of a link; an item is neither. */
114
+ text-decoration: none;
115
+ cursor: pointer;
116
+ user-select: none;
117
+ outline: none;
118
+ transition:
119
+ color var(--fs-fast-duration) var(--fs-point-to-point),
120
+ background var(--fs-fast-duration) var(--fs-point-to-point);
121
+ &:hover {
122
+ color: var(--fs-text-primary);
123
+ }
124
+ &:active {
125
+ color: var(--fs-text-secondary);
126
+ }
127
+ &:focus-visible {
128
+ outline: 0.125rem var(--fs-focus-stroke-outer) solid;
129
+ outline-offset: 0.125rem;
130
+ }
131
+ &.selected {
132
+ color: var(--fs-text-primary);
133
+ font-weight: 600;
134
+ }
135
+ /* An anchor has no `:disabled` of its own, so the class is what both tags answer to. */
136
+ &.disabled {
137
+ color: var(--fs-text-disabled);
138
+ cursor: not-allowed;
139
+ }
140
+ /*
141
+ * The line an item shows under itself while the pointer is on it. It is the item's own, not
142
+ * the bar of the strip: the bar belongs to whatever is selected and never leaves it.
143
+ */
144
+ &::after {
145
+ content: '';
146
+ position: absolute;
147
+ left: var(--fs-top-nav-item-padding-inline, 0.375rem);
148
+ right: var(--fs-top-nav-item-padding-inline, 0.375rem);
149
+ bottom: 0;
150
+ height: var(--fs-top-nav-bar-thickness, 0.1875rem);
151
+ border-radius: var(--fs-top-nav-bar-thickness, 0.1875rem);
152
+ background: var(--fs-control-strong-stroke-disabled);
153
+ opacity: 0;
154
+ transition: opacity var(--fs-fast-duration) var(--fs-point-to-point);
155
+ pointer-events: none;
156
+ }
157
+ &:hover:not(.selected):not(.disabled)::after {
158
+ opacity: 1;
159
+ }
160
+ &.vertical::after {
161
+ left: auto;
162
+ right: auto;
163
+ inset-inline-start: 0;
164
+ top: var(--fs-top-nav-item-padding-block, 0.375rem);
165
+ bottom: var(--fs-top-nav-item-padding-block, 0.375rem);
166
+ width: var(--fs-top-nav-bar-thickness, 0.1875rem);
167
+ height: auto;
168
+ }
169
+ &.subtle {
170
+ &:hover:not(.disabled) {
171
+ background: var(--fs-subtle-fill-secondary);
172
+ }
173
+ &:active:not(.disabled) {
174
+ background: var(--fs-subtle-fill-tertiary);
175
+ }
176
+ }
177
+ /* A pill takes the place of the bar, so the hover line steps aside for it. */
178
+ &.subtle-circular,
179
+ &.filled-circular {
180
+ border-radius: 999rem;
181
+ &::after {
182
+ content: none;
183
+ }
184
+ &:hover:not(.disabled) {
185
+ background: var(--fs-subtle-fill-secondary);
186
+ }
187
+ &:active:not(.disabled) {
188
+ background: var(--fs-subtle-fill-tertiary);
189
+ }
190
+ }
191
+ &.filled-circular {
192
+ background: var(--fs-subtle-fill-secondary);
193
+ }
194
+ &.subtle-circular.selected {
195
+ background: var(--fs-system-attention-bg);
196
+ box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fs-system-attention-text), transparent 50%);
197
+ color: var(--fs-system-attention-text);
198
+ }
199
+ &.filled-circular.selected {
200
+ background: var(--fs-accent-fill-default);
201
+ color: var(--fs-text-on-accent-primary);
202
+ &:hover:not(.disabled) {
203
+ background: var(--fs-accent-fill-secondary);
204
+ }
205
+ &:active:not(.disabled) {
206
+ background: var(--fs-accent-fill-tertiary);
207
+ }
208
+ &.disabled {
209
+ background: var(--fs-accent-fill-disabled);
210
+ color: var(--fs-text-on-accent-disabled);
211
+ }
212
+ }
213
+ & .fs-top-nav-item-icon {
214
+ display: flex;
215
+ flex: 0 0 auto;
216
+ align-items: center;
217
+ justify-content: center;
218
+ & :global(svg) {
219
+ width: var(--fs-top-nav-item-icon-size, 1.25rem);
220
+ height: var(--fs-top-nav-item-icon-size, 1.25rem);
221
+ }
222
+ }
223
+ & .fs-top-nav-item-content {
224
+ display: block;
225
+ }
226
+ & .fs-top-nav-item-reserve {
227
+ display: block;
228
+ height: 0;
229
+ overflow: hidden;
230
+ visibility: hidden;
231
+ font-weight: 600;
232
+ }
233
+ }
234
+ </style>
@@ -0,0 +1,41 @@
1
+ import type { TopNavItemGenerics, TopNavItemProps } from './types.ts';
2
+ declare function $$render<T extends TopNavItemGenerics = 'button'>(): {
3
+ props: TopNavItemProps<T>;
4
+ exports: {};
5
+ bindings: "ref";
6
+ slots: {};
7
+ events: {};
8
+ };
9
+ declare class __sveltets_Render<T extends TopNavItemGenerics = '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 TopNavItemGenerics = '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 TopNavItemGenerics = '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 single item of a `TopNav`. It reports its own selection and can carry an icon.
25
+ *
26
+ * - Usage:
27
+ * ```tsx
28
+ * <script>
29
+ * import { TopNav, TopNavItem } from 'fluentui-svelte';
30
+ * import { AirplaneRegular } from 'fluentui-icons-svelte';
31
+ * </script>
32
+ *
33
+ * <TopNav selectedValue="arrivals" aria-label="Flights">
34
+ * <TopNavItem value="arrivals" icon={AirplaneRegular}>Arrivals</TopNavItem>
35
+ * <TopNavItem as="a" href="/departures" value="departures">Departures</TopNavItem>
36
+ * </TopNav>
37
+ * ```
38
+ */
39
+ declare const TopNavItem: $$IsomorphicComponent;
40
+ type TopNavItem<T extends TopNavItemGenerics = 'button'> = InstanceType<typeof TopNavItem<T>>;
41
+ export default TopNavItem;