svelte-fluentui 1.0.0-rc01
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/LICENSE +21 -0
- package/README.md +191 -0
- package/dist/actions/use-actions.d.ts +1 -0
- package/dist/actions/use-actions.js +6 -0
- package/dist/components/Accordion.svelte +68 -0
- package/dist/components/Accordion.svelte.d.ts +11 -0
- package/dist/components/AccordionItem.svelte +52 -0
- package/dist/components/AccordionItem.svelte.d.ts +17 -0
- package/dist/components/Anchor.svelte +53 -0
- package/dist/components/Anchor.svelte.d.ts +25 -0
- package/dist/components/Badge.svelte +14 -0
- package/dist/components/Badge.svelte.d.ts +15 -0
- package/dist/components/Breadcrumb.svelte +8 -0
- package/dist/components/Breadcrumb.svelte.d.ts +8 -0
- package/dist/components/BreadcrumbItem.svelte +17 -0
- package/dist/components/BreadcrumbItem.svelte.d.ts +10 -0
- package/dist/components/Button.svelte +31 -0
- package/dist/components/Button.svelte.d.ts +24 -0
- package/dist/components/Calendar.svelte +442 -0
- package/dist/components/Calendar.svelte.d.ts +27 -0
- package/dist/components/Card.svelte +14 -0
- package/dist/components/Card.svelte.d.ts +14 -0
- package/dist/components/Checkbox.svelte +38 -0
- package/dist/components/Checkbox.svelte.d.ts +17 -0
- package/dist/components/Combobox.svelte +91 -0
- package/dist/components/Combobox.svelte.d.ts +21 -0
- package/dist/components/ContentRegion.svelte +7 -0
- package/dist/components/ContentRegion.svelte.d.ts +7 -0
- package/dist/components/DataGrid.svelte +26 -0
- package/dist/components/DataGrid.svelte.d.ts +16 -0
- package/dist/components/DataGridCell.svelte +33 -0
- package/dist/components/DataGridCell.svelte.d.ts +20 -0
- package/dist/components/DataGridRow.svelte +33 -0
- package/dist/components/DataGridRow.svelte.d.ts +16 -0
- package/dist/components/Dialog.svelte +86 -0
- package/dist/components/Dialog.svelte.d.ts +27 -0
- package/dist/components/Divider.svelte +9 -0
- package/dist/components/Divider.svelte.d.ts +4 -0
- package/dist/components/Listbox.svelte +34 -0
- package/dist/components/Listbox.svelte.d.ts +13 -0
- package/dist/components/Menu.svelte +9 -0
- package/dist/components/Menu.svelte.d.ts +4 -0
- package/dist/components/MenuItem.svelte +9 -0
- package/dist/components/MenuItem.svelte.d.ts +4 -0
- package/dist/components/NumberField.svelte +57 -0
- package/dist/components/NumberField.svelte.d.ts +29 -0
- package/dist/components/Option.svelte +28 -0
- package/dist/components/Option.svelte.d.ts +13 -0
- package/dist/components/Paginator.svelte +85 -0
- package/dist/components/Paginator.svelte.d.ts +21 -0
- package/dist/components/PositioningRegion.svelte +7 -0
- package/dist/components/PositioningRegion.svelte.d.ts +8 -0
- package/dist/components/Progress.svelte +9 -0
- package/dist/components/Progress.svelte.d.ts +4 -0
- package/dist/components/README.md +75 -0
- package/dist/components/Radio.svelte +23 -0
- package/dist/components/Radio.svelte.d.ts +11 -0
- package/dist/components/RadioGroup.svelte +26 -0
- package/dist/components/RadioGroup.svelte.d.ts +13 -0
- package/dist/components/Search.svelte +51 -0
- package/dist/components/Search.svelte.d.ts +30 -0
- package/dist/components/Select.svelte +41 -0
- package/dist/components/Select.svelte.d.ts +23 -0
- package/dist/components/Slider.svelte +9 -0
- package/dist/components/Slider.svelte.d.ts +4 -0
- package/dist/components/Switch.svelte +45 -0
- package/dist/components/Switch.svelte.d.ts +22 -0
- package/dist/components/Tab.svelte +52 -0
- package/dist/components/Tab.svelte.d.ts +23 -0
- package/dist/components/TabPanel.svelte +10 -0
- package/dist/components/TabPanel.svelte.d.ts +13 -0
- package/dist/components/Tabs.svelte +35 -0
- package/dist/components/Tabs.svelte.d.ts +21 -0
- package/dist/components/TextField.svelte +57 -0
- package/dist/components/TextField.svelte.d.ts +27 -0
- package/dist/components/Textarea.svelte +53 -0
- package/dist/components/Textarea.svelte.d.ts +32 -0
- package/dist/components/Toast.svelte +90 -0
- package/dist/components/Toast.svelte.d.ts +18 -0
- package/dist/components/Toolbar.svelte +16 -0
- package/dist/components/Toolbar.svelte.d.ts +12 -0
- package/dist/components/Tooltip.svelte +28 -0
- package/dist/components/Tooltip.svelte.d.ts +18 -0
- package/dist/components/Tree.svelte +9 -0
- package/dist/components/Tree.svelte.d.ts +4 -0
- package/dist/components/TreeItem.svelte +9 -0
- package/dist/components/TreeItem.svelte.d.ts +4 -0
- package/dist/components/icons/ChevronDoubleRight.svelte +1 -0
- package/dist/components/icons/ChevronDoubleRight.svelte.d.ts +26 -0
- package/dist/components/icons/ExpandIcon.svelte +9 -0
- package/dist/components/icons/ExpandIcon.svelte.d.ts +26 -0
- package/dist/components/icons/HamburgerIcon.svelte +8 -0
- package/dist/components/icons/HamburgerIcon.svelte.d.ts +26 -0
- package/dist/components/icons/ResourcesIcon.svelte +17 -0
- package/dist/components/icons/ResourcesIcon.svelte.d.ts +6 -0
- package/dist/components/icons/index.d.ts +4 -0
- package/dist/components/icons/index.js +4 -0
- package/dist/components/index.d.ts +45 -0
- package/dist/components/index.js +45 -0
- package/dist/components/layout/BodyContent.svelte +20 -0
- package/dist/components/layout/BodyContent.svelte.d.ts +7 -0
- package/dist/components/layout/Footer.svelte +13 -0
- package/dist/components/layout/Footer.svelte.d.ts +8 -0
- package/dist/components/layout/Header.svelte +13 -0
- package/dist/components/layout/Header.svelte.d.ts +8 -0
- package/dist/components/layout/Layout.svelte +10 -0
- package/dist/components/layout/Layout.svelte.d.ts +8 -0
- package/dist/components/layout/Spacer.svelte +18 -0
- package/dist/components/layout/Spacer.svelte.d.ts +6 -0
- package/dist/components/layout/Stack.svelte +19 -0
- package/dist/components/layout/Stack.svelte.d.ts +18 -0
- package/dist/components/layout/index.d.ts +6 -0
- package/dist/components/layout/index.js +6 -0
- package/dist/components/nav/AppBar.svelte +15 -0
- package/dist/components/nav/AppBar.svelte.d.ts +10 -0
- package/dist/components/nav/AppBarItem.svelte +34 -0
- package/dist/components/nav/AppBarItem.svelte.d.ts +14 -0
- package/dist/components/nav/NavExpander.svelte +18 -0
- package/dist/components/nav/NavExpander.svelte.d.ts +7 -0
- package/dist/components/nav/NavGroup.svelte +244 -0
- package/dist/components/nav/NavGroup.svelte.d.ts +12 -0
- package/dist/components/nav/NavIcon.svelte +7 -0
- package/dist/components/nav/NavIcon.svelte.d.ts +7 -0
- package/dist/components/nav/NavItem.svelte +17 -0
- package/dist/components/nav/NavItem.svelte.d.ts +11 -0
- package/dist/components/nav/NavLink.svelte +31 -0
- package/dist/components/nav/NavLink.svelte.d.ts +13 -0
- package/dist/components/nav/NavLinkItem.svelte +23 -0
- package/dist/components/nav/NavLinkItem.svelte.d.ts +17 -0
- package/dist/components/nav/NavMenu.svelte +19 -0
- package/dist/components/nav/NavMenu.svelte.d.ts +11 -0
- package/dist/components/nav/index.d.ts +8 -0
- package/dist/components/nav/index.js +8 -0
- package/dist/constants/date.d.ts +1 -0
- package/dist/constants/date.js +1 -0
- package/dist/data/selected-options.svelte.d.ts +8 -0
- package/dist/data/selected-options.svelte.js +51 -0
- package/dist/fluent-ui/calendar/calendar-day.d.ts +17 -0
- package/dist/fluent-ui/calendar/calendar-day.js +56 -0
- package/dist/fluent-ui/calendar/calendar-month.d.ts +12 -0
- package/dist/fluent-ui/calendar/calendar-month.js +56 -0
- package/dist/fluent-ui/calendar/calendar-titles.d.ts +15 -0
- package/dist/fluent-ui/calendar/calendar-titles.js +99 -0
- package/dist/fluent-ui/calendar/calendar-year.d.ts +12 -0
- package/dist/fluent-ui/calendar/calendar-year.js +46 -0
- package/dist/fluent-ui/calendar/day-format.d.ts +4 -0
- package/dist/fluent-ui/calendar/day-format.js +3 -0
- package/dist/fluent-ui/calendar/fluent-calendar-extended.d.ts +44 -0
- package/dist/fluent-ui/calendar/fluent-calendar-extended.js +170 -0
- package/dist/fluent-ui/calendar/fluent-calendar.d.ts +18 -0
- package/dist/fluent-ui/calendar/fluent-calendar.js +1 -0
- package/dist/fluent-ui/calendar/range-of-dates.d.ts +8 -0
- package/dist/fluent-ui/calendar/range-of-dates.js +34 -0
- package/dist/fluent-ui/constants/app-bar.d.ts +4 -0
- package/dist/fluent-ui/constants/app-bar.js +5 -0
- package/dist/fluent-ui/constants/button.d.ts +7 -0
- package/dist/fluent-ui/constants/button.js +8 -0
- package/dist/fluent-ui/constants/calendar-vertical-position.d.ts +5 -0
- package/dist/fluent-ui/constants/calendar-vertical-position.js +6 -0
- package/dist/fluent-ui/constants/stack.d.ts +20 -0
- package/dist/fluent-ui/constants/stack.js +23 -0
- package/dist/fluent-ui/setup.d.ts +1 -0
- package/dist/fluent-ui/setup.js +7 -0
- package/dist/fluent-ui/util/range-of.d.ts +21 -0
- package/dist/fluent-ui/util/range-of.js +84 -0
- package/dist/helpers/array.d.ts +2 -0
- package/dist/helpers/array.js +6 -0
- package/dist/helpers/html.d.ts +2 -0
- package/dist/helpers/html.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/main.scss +1 -0
- package/dist/types/combobox.d.ts +7 -0
- package/dist/types/combobox.js +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +1 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 KeenMate
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Svelte FluentUI
|
|
2
|
+
|
|
3
|
+
A comprehensive Svelte wrapper library for Microsoft FluentUI web components (v2.6.x), providing a seamless way to use FluentUI components in Svelte applications.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🎨 **Complete FluentUI Component Set** - Wraps all major FluentUI web components
|
|
8
|
+
- 🔧 **TypeScript Support** - Full type definitions for all components
|
|
9
|
+
- 📱 **Responsive Design** - Built-in responsive layout components
|
|
10
|
+
- 🎯 **Svelte 5 Compatible** - Works with the latest Svelte features
|
|
11
|
+
- 🎨 **SCSS & Tailwind CSS** - Flexible styling options
|
|
12
|
+
- 📦 **Tree-shakeable** - Import only what you need
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install svelte-fluentui
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```svelte
|
|
23
|
+
<script>
|
|
24
|
+
import { Button, TextField, Card } from 'svelte-fluentui'
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<Card>
|
|
28
|
+
<TextField placeholder="Enter your name" />
|
|
29
|
+
<Button appearance="accent">Submit</Button>
|
|
30
|
+
</Card>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Available Components
|
|
34
|
+
|
|
35
|
+
### Form Controls
|
|
36
|
+
- `Button` - Various button styles and appearances
|
|
37
|
+
- `TextField` - Text input with validation
|
|
38
|
+
- `NumberField` - Numeric input control
|
|
39
|
+
- `Textarea` - Multi-line text input
|
|
40
|
+
- `Checkbox` - Checkbox input
|
|
41
|
+
- `Radio` / `RadioGroup` - Radio button controls
|
|
42
|
+
- `Switch` - Toggle switch
|
|
43
|
+
- `Select` - Dropdown selection
|
|
44
|
+
- `Combobox` - Searchable dropdown
|
|
45
|
+
- `Slider` - Range slider control
|
|
46
|
+
- `Search` - Search input field
|
|
47
|
+
|
|
48
|
+
### Data Display
|
|
49
|
+
- `DataGrid` / `DataGridRow` / `DataGridCell` - Data table components
|
|
50
|
+
- `Card` - Content container
|
|
51
|
+
- `Badge` - Status indicators
|
|
52
|
+
- `ProgressBar` - Progress indication
|
|
53
|
+
- `Tooltip` - Contextual information
|
|
54
|
+
- `Calendar` - Date picker and calendar
|
|
55
|
+
|
|
56
|
+
### Navigation
|
|
57
|
+
- `Tabs` / `Tab` / `TabPanel` - Tab navigation
|
|
58
|
+
- `Breadcrumb` / `BreadcrumbItem` - Breadcrumb navigation
|
|
59
|
+
- `Menu` / `MenuItem` - Context menus
|
|
60
|
+
- `AppBar` / `AppBarItem` - Application bar
|
|
61
|
+
- `NavMenu` / `NavItem` / `NavLink` - Navigation components
|
|
62
|
+
- `Anchor` - Link component
|
|
63
|
+
|
|
64
|
+
### Layout
|
|
65
|
+
- `Stack` - Flexible layout container
|
|
66
|
+
- `Layout` - Page layout wrapper
|
|
67
|
+
- `Header` / `Footer` / `BodyContent` - Layout sections
|
|
68
|
+
- `Spacer` - Spacing utility
|
|
69
|
+
- `Divider` - Visual separator
|
|
70
|
+
|
|
71
|
+
### Feedback
|
|
72
|
+
- `Dialog` - Modal dialogs
|
|
73
|
+
- `Toast` - Notification messages
|
|
74
|
+
- `Accordion` / `AccordionItem` - Collapsible content
|
|
75
|
+
|
|
76
|
+
### Utilities
|
|
77
|
+
- `Listbox` / `Option` - List selection
|
|
78
|
+
- `Tree` / `TreeItem` - Hierarchical data
|
|
79
|
+
- `Toolbar` - Action toolbars
|
|
80
|
+
- `Paginator` - Pagination control
|
|
81
|
+
|
|
82
|
+
## Usage Examples
|
|
83
|
+
|
|
84
|
+
### Form with Validation
|
|
85
|
+
```svelte
|
|
86
|
+
<script>
|
|
87
|
+
import { TextField, Button, Stack } from 'svelte-fluentui'
|
|
88
|
+
|
|
89
|
+
let email = ''
|
|
90
|
+
let password = ''
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<Stack orientation="vertical" gap="16">
|
|
94
|
+
<TextField
|
|
95
|
+
bind:value={email}
|
|
96
|
+
type="email"
|
|
97
|
+
placeholder="Enter email"
|
|
98
|
+
required
|
|
99
|
+
/>
|
|
100
|
+
<TextField
|
|
101
|
+
bind:value={password}
|
|
102
|
+
type="password"
|
|
103
|
+
placeholder="Enter password"
|
|
104
|
+
required
|
|
105
|
+
/>
|
|
106
|
+
<Button appearance="accent">Sign In</Button>
|
|
107
|
+
</Stack>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Data Grid
|
|
111
|
+
```svelte
|
|
112
|
+
<script>
|
|
113
|
+
import { DataGrid, DataGridRow, DataGridCell } from 'svelte-fluentui'
|
|
114
|
+
|
|
115
|
+
const users = [
|
|
116
|
+
{ name: 'Alice', email: 'alice@example.com', role: 'Admin' },
|
|
117
|
+
{ name: 'Bob', email: 'bob@example.com', role: 'User' }
|
|
118
|
+
]
|
|
119
|
+
</script>
|
|
120
|
+
|
|
121
|
+
<DataGrid>
|
|
122
|
+
{#each users as user}
|
|
123
|
+
<DataGridRow>
|
|
124
|
+
<DataGridCell>{user.name}</DataGridCell>
|
|
125
|
+
<DataGridCell>{user.email}</DataGridCell>
|
|
126
|
+
<DataGridCell>{user.role}</DataGridCell>
|
|
127
|
+
</DataGridRow>
|
|
128
|
+
{/each}
|
|
129
|
+
</DataGrid>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Navigation Layout
|
|
133
|
+
```svelte
|
|
134
|
+
<script>
|
|
135
|
+
import { Layout, Header, NavMenu, NavItem, BodyContent } from 'svelte-fluentui'
|
|
136
|
+
</script>
|
|
137
|
+
|
|
138
|
+
<Layout>
|
|
139
|
+
<Header slot="header">
|
|
140
|
+
<h1>My App</h1>
|
|
141
|
+
</Header>
|
|
142
|
+
|
|
143
|
+
<NavMenu slot="navigation">
|
|
144
|
+
<NavItem href="/">Home</NavItem>
|
|
145
|
+
<NavItem href="/about">About</NavItem>
|
|
146
|
+
<NavItem href="/contact">Contact</NavItem>
|
|
147
|
+
</NavMenu>
|
|
148
|
+
|
|
149
|
+
<BodyContent>
|
|
150
|
+
<!-- Main content here -->
|
|
151
|
+
</BodyContent>
|
|
152
|
+
</Layout>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Development
|
|
156
|
+
|
|
157
|
+
Clone the repository and install dependencies:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
git clone https://github.com/KeenMate/svelte-fluentui.git
|
|
161
|
+
cd svelte-fluentui
|
|
162
|
+
npm install
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Start the development server:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
npm run dev
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Visit `http://localhost:5173` to see the component showcase and examples.
|
|
172
|
+
|
|
173
|
+
## Building
|
|
174
|
+
|
|
175
|
+
Build the library:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
npm run build
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Contributing
|
|
182
|
+
|
|
183
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
MIT © [KeenMate](https://github.com/KeenMate)
|
|
188
|
+
|
|
189
|
+
## Credits
|
|
190
|
+
|
|
191
|
+
Built on top of [Microsoft FluentUI Web Components](https://github.com/microsoft/fluentui) v2.6.x.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useActions(node: HTMLElement, options?: ((node: HTMLElement) => any) | null | undefined): any;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script lang="ts">import { fluentAccordion, provideFluentDesignSystem } from "@fluentui/web-components";
|
|
2
|
+
import { setContext } from "svelte";
|
|
3
|
+
provideFluentDesignSystem().register(fluentAccordion());
|
|
4
|
+
let { value = $bindable(), multi = undefined, children = undefined, ...restProps } = $props();
|
|
5
|
+
const ctx = $state({ value: toContextValue(value) });
|
|
6
|
+
setContext("fluent-accordion", ctx);
|
|
7
|
+
$effect(() => {
|
|
8
|
+
ctx.value = toContextValue(value);
|
|
9
|
+
});
|
|
10
|
+
// $effect(() => {
|
|
11
|
+
// if ($state.snapshot(internalValue) !== value) {
|
|
12
|
+
// internalValue = value
|
|
13
|
+
// }
|
|
14
|
+
// })
|
|
15
|
+
function handleAccordionChange(ev) {
|
|
16
|
+
const accordionItemTarget = ev.target;
|
|
17
|
+
if (ev.target?.nodeName !== "FLUENT-ACCORDION-ITEM") {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// to allow fluent-accordion-item to update HTML attributes that are to be relied upon
|
|
21
|
+
window.requestAnimationFrame(() => {
|
|
22
|
+
const accordionItemId = accordionItemTarget.dataset.customId;
|
|
23
|
+
const accordionItemIsExpanded = accordionItemTarget.attributes["expanded"]?.value === "";
|
|
24
|
+
// console.log("Accordion change", {
|
|
25
|
+
// ev,
|
|
26
|
+
// accordionItemTarget,
|
|
27
|
+
// accordionItemId,
|
|
28
|
+
// expandedValue: accordionItemTarget.attributes["expanded" as unknown as number]?.value,
|
|
29
|
+
// accordionItemIsExpanded
|
|
30
|
+
// })
|
|
31
|
+
if (ev.target?.nodeName !== "FLUENT-ACCORDION-ITEM") {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (multi) {
|
|
35
|
+
let tmp = typeof value === "string" ? [$state.snapshot(value)] : value?.slice() || [];
|
|
36
|
+
if (accordionItemIsExpanded) {
|
|
37
|
+
tmp.push(accordionItemId);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
tmp = tmp.filter((x) => x !== accordionItemId);
|
|
41
|
+
}
|
|
42
|
+
setExpanded(tmp);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
setExpanded(accordionItemIsExpanded ? accordionItemId : null);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function setExpanded(newValue) {
|
|
50
|
+
if (multi && newValue?.length === 0) {
|
|
51
|
+
newValue = null;
|
|
52
|
+
}
|
|
53
|
+
value = newValue;
|
|
54
|
+
// ctx.value = toContextValue(newValue)
|
|
55
|
+
}
|
|
56
|
+
function toContextValue(value) {
|
|
57
|
+
if (multi) {
|
|
58
|
+
return typeof value === "string" ? [$state.snapshot(value)] : $state.snapshot(value);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
return typeof value === "string" ? [value] : null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
<fluent-accordion expand-mode={multi} {...restProps} onchange={handleAccordionChange}>
|
|
67
|
+
{@render children?.()}
|
|
68
|
+
</fluent-accordion>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SlotType } from "../types/index.js";
|
|
2
|
+
type ValueType = string | string[] | null | undefined;
|
|
3
|
+
type Props = {
|
|
4
|
+
value?: ValueType;
|
|
5
|
+
multi?: boolean;
|
|
6
|
+
children?: SlotType;
|
|
7
|
+
[prop: string]: any;
|
|
8
|
+
};
|
|
9
|
+
declare const Accordion: import("svelte").Component<Props, {}, "value">;
|
|
10
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
11
|
+
export default Accordion;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">import { fluentAccordionItem, provideFluentDesignSystem } from "@fluentui/web-components";
|
|
2
|
+
import { getContext } from "svelte";
|
|
3
|
+
provideFluentDesignSystem().register(fluentAccordionItem());
|
|
4
|
+
let { id, headingLevel = undefined, expanded = undefined, header = undefined, heading = undefined, start = undefined, end = undefined, icon = undefined, children = undefined, onChange = undefined, ...restProps } = $props();
|
|
5
|
+
const ctx = getContext("fluent-accordion");
|
|
6
|
+
$inspect(id, expanded, ctx.value);
|
|
7
|
+
function handleOnChange(ev) {
|
|
8
|
+
// console.log("Accordion item change", ev)
|
|
9
|
+
const target = ev.target;
|
|
10
|
+
onChange?.(ev, target.attributes["expanded"]?.value === "");
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<!-- todo: investigate flicker during switching of accordions -->
|
|
15
|
+
<fluent-accordion-item
|
|
16
|
+
{id}
|
|
17
|
+
data-custom-id={id}
|
|
18
|
+
heading-level={headingLevel}
|
|
19
|
+
expanded={expanded === undefined && ctx.value !== undefined ? !!ctx.value?.includes(id) : expanded}
|
|
20
|
+
{...restProps}
|
|
21
|
+
onchange={handleOnChange}
|
|
22
|
+
>
|
|
23
|
+
<div slot="heading">
|
|
24
|
+
{#if heading}
|
|
25
|
+
{@render heading()}
|
|
26
|
+
{:else}
|
|
27
|
+
{header}
|
|
28
|
+
{/if}
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
{#if start}
|
|
32
|
+
<div slot="start">
|
|
33
|
+
{@render start()}
|
|
34
|
+
</div>
|
|
35
|
+
{/if}
|
|
36
|
+
{#if end}
|
|
37
|
+
<div slot="end">
|
|
38
|
+
{@render end()}
|
|
39
|
+
</div>
|
|
40
|
+
{/if}
|
|
41
|
+
{#if icon}
|
|
42
|
+
<div slot="expanded-icon">
|
|
43
|
+
{@render icon(true)}
|
|
44
|
+
</div>
|
|
45
|
+
<div slot="collapsed-icon">
|
|
46
|
+
{@render icon(false)}
|
|
47
|
+
</div>
|
|
48
|
+
{/if}
|
|
49
|
+
|
|
50
|
+
{@render children?.()}
|
|
51
|
+
</fluent-accordion-item>
|
|
52
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SlotType } from "../types/index.js";
|
|
2
|
+
type Props = {
|
|
3
|
+
id: string;
|
|
4
|
+
headingLevel?: string | number;
|
|
5
|
+
header?: string;
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
heading?: SlotType;
|
|
8
|
+
start?: SlotType;
|
|
9
|
+
end?: SlotType;
|
|
10
|
+
icon?: SlotType;
|
|
11
|
+
children?: SlotType;
|
|
12
|
+
onChange?: (ev: Event, isExpanded: boolean) => void;
|
|
13
|
+
[prop: string]: any;
|
|
14
|
+
};
|
|
15
|
+
declare const AccordionItem: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type AccordionItem = ReturnType<typeof AccordionItem>;
|
|
17
|
+
export default AccordionItem;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<script lang="ts">import { fluentAnchor, provideFluentDesignSystem } from "@fluentui/web-components";
|
|
2
|
+
import useActions from "../actions/use-actions.js";
|
|
3
|
+
provideFluentDesignSystem().register(fluentAnchor());
|
|
4
|
+
let element;
|
|
5
|
+
let { id = undefined, class: className = "", style = "", download = undefined, href = undefined, hreflang = undefined, ping = undefined, referrerpolicy = undefined, rel = undefined, target = undefined, type = undefined, appearance = undefined, iconStart = undefined, iconEnd = undefined, children = undefined, preventDefault = false, use = undefined, onClick = undefined, ...restProps } = $props();
|
|
6
|
+
$effect(() => {
|
|
7
|
+
const a = element.shadowRoot?.querySelector("a");
|
|
8
|
+
if (a)
|
|
9
|
+
use?.(a);
|
|
10
|
+
});
|
|
11
|
+
function handleClick(event) {
|
|
12
|
+
if (preventDefault) {
|
|
13
|
+
event.preventDefault();
|
|
14
|
+
}
|
|
15
|
+
if (onClick) {
|
|
16
|
+
onClick(event);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<fluent-anchor
|
|
22
|
+
bind:this={element}
|
|
23
|
+
{id}
|
|
24
|
+
class={className}
|
|
25
|
+
{style}
|
|
26
|
+
{download}
|
|
27
|
+
{href}
|
|
28
|
+
{hreflang}
|
|
29
|
+
{ping}
|
|
30
|
+
{referrerpolicy}
|
|
31
|
+
{rel}
|
|
32
|
+
{target}
|
|
33
|
+
{type}
|
|
34
|
+
{appearance}
|
|
35
|
+
onclick={handleClick}
|
|
36
|
+
{...restProps}
|
|
37
|
+
>
|
|
38
|
+
{#if iconStart}
|
|
39
|
+
<span slot={children ? "start" : undefined}>
|
|
40
|
+
{@render iconStart?.()}
|
|
41
|
+
</span>
|
|
42
|
+
{/if}
|
|
43
|
+
|
|
44
|
+
{#if children}
|
|
45
|
+
{@render children?.()}
|
|
46
|
+
{/if}
|
|
47
|
+
|
|
48
|
+
{#if iconEnd}
|
|
49
|
+
<span slot={children ? "end" : undefined}>
|
|
50
|
+
{@render iconEnd?.()}
|
|
51
|
+
</span>
|
|
52
|
+
{/if}
|
|
53
|
+
</fluent-anchor>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { SlotType } from "../types/index.js";
|
|
2
|
+
type Props = {
|
|
3
|
+
id?: string;
|
|
4
|
+
class?: string;
|
|
5
|
+
style?: string;
|
|
6
|
+
download?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
hreflang?: string;
|
|
9
|
+
ping?: string;
|
|
10
|
+
referrerpolicy?: string;
|
|
11
|
+
rel?: string;
|
|
12
|
+
target?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
appearance?: "neutral" | "accent" | "hypertext" | "stealth" | "transparent";
|
|
15
|
+
iconStart?: SlotType;
|
|
16
|
+
iconEnd?: SlotType;
|
|
17
|
+
children?: SlotType;
|
|
18
|
+
preventDefault?: boolean;
|
|
19
|
+
use?: ((node: HTMLElement) => any) | undefined;
|
|
20
|
+
onClick?: (event: MouseEvent) => void;
|
|
21
|
+
[prop: string]: any;
|
|
22
|
+
};
|
|
23
|
+
declare const Anchor: import("svelte").Component<Props, {}, "">;
|
|
24
|
+
type Anchor = ReturnType<typeof Anchor>;
|
|
25
|
+
export default Anchor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script lang="ts">import { fluentBadge, provideFluentDesignSystem } from "@fluentui/web-components";
|
|
2
|
+
provideFluentDesignSystem().register(fluentBadge());
|
|
3
|
+
let { color = undefined, appearance = undefined, circular = undefined, children = undefined, onClick = undefined, ...restProps } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<fluent-badge
|
|
7
|
+
{...restProps}
|
|
8
|
+
{color}
|
|
9
|
+
{appearance}
|
|
10
|
+
{circular}
|
|
11
|
+
onclick={onClick}
|
|
12
|
+
>
|
|
13
|
+
{@render children?.()}
|
|
14
|
+
</fluent-badge>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SlotType } from "../types/index.js";
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* for `color` prop to work a CSS variable `--badge-color-[color]` must be defined
|
|
5
|
+
*/
|
|
6
|
+
color?: string;
|
|
7
|
+
appearance?: string;
|
|
8
|
+
circular?: boolean;
|
|
9
|
+
children?: SlotType;
|
|
10
|
+
onClick?: (ev: MouseEvent) => void;
|
|
11
|
+
[prop: string]: any;
|
|
12
|
+
};
|
|
13
|
+
declare const Badge: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type Badge = ReturnType<typeof Badge>;
|
|
15
|
+
export default Badge;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<script lang="ts">import { fluentBreadcrumb, provideFluentDesignSystem } from "@fluentui/web-components";
|
|
2
|
+
provideFluentDesignSystem().register(fluentBreadcrumb());
|
|
3
|
+
let { children = undefined, ...restProps } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<fluent-breadcrumb {...restProps}>
|
|
7
|
+
{@render children?.()}
|
|
8
|
+
</fluent-breadcrumb>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SlotType } from "../types/index.js";
|
|
2
|
+
type Props = {
|
|
3
|
+
children?: SlotType;
|
|
4
|
+
[prop: string]: any;
|
|
5
|
+
};
|
|
6
|
+
declare const Breadcrumb: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type Breadcrumb = ReturnType<typeof Breadcrumb>;
|
|
8
|
+
export default Breadcrumb;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">import { fluentBreadcrumbItem, provideFluentDesignSystem } from "@fluentui/web-components";
|
|
2
|
+
provideFluentDesignSystem().register(fluentBreadcrumbItem());
|
|
3
|
+
let { href = undefined, separator = undefined, children = undefined, ...restProps } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<fluent-breadcrumb-item
|
|
7
|
+
{...restProps}
|
|
8
|
+
{href}
|
|
9
|
+
>
|
|
10
|
+
{#if separator}
|
|
11
|
+
<span slot="separator">
|
|
12
|
+
{@render separator?.()}
|
|
13
|
+
</span>
|
|
14
|
+
{/if}
|
|
15
|
+
|
|
16
|
+
{@render children?.()}
|
|
17
|
+
</fluent-breadcrumb-item>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SlotType } from "../types/index.js";
|
|
2
|
+
type Props = {
|
|
3
|
+
href?: string;
|
|
4
|
+
separator?: SlotType;
|
|
5
|
+
children?: SlotType;
|
|
6
|
+
[prop: string]: any;
|
|
7
|
+
};
|
|
8
|
+
declare const BreadcrumbItem: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type BreadcrumbItem = ReturnType<typeof BreadcrumbItem>;
|
|
10
|
+
export default BreadcrumbItem;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<script lang="ts">import { fluentButton, provideFluentDesignSystem } from "@fluentui/web-components";
|
|
2
|
+
provideFluentDesignSystem().register(fluentButton());
|
|
3
|
+
let { appearance = undefined, autofocus = undefined, disabled = undefined, form = undefined, formaction = undefined, formenctype = undefined, formmethod = undefined, formnovalidate = undefined, formtarget = undefined, name = undefined, type = undefined, value = undefined, start = undefined, end = undefined, children = undefined, style = "", onClick = undefined, ...restProps } = $props();
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<fluent-button
|
|
7
|
+
{type}
|
|
8
|
+
{name}
|
|
9
|
+
{value}
|
|
10
|
+
{appearance}
|
|
11
|
+
{formaction}
|
|
12
|
+
{form}
|
|
13
|
+
{formenctype}
|
|
14
|
+
{formmethod}
|
|
15
|
+
{formnovalidate}
|
|
16
|
+
{formtarget}
|
|
17
|
+
{disabled}
|
|
18
|
+
{style}
|
|
19
|
+
{...restProps}
|
|
20
|
+
onclick={onClick}
|
|
21
|
+
>
|
|
22
|
+
|
|
23
|
+
{@render start?.()}
|
|
24
|
+
|
|
25
|
+
{@render children?.()}
|
|
26
|
+
{#if end}
|
|
27
|
+
<template slot="end">
|
|
28
|
+
{@render end()}
|
|
29
|
+
</template>
|
|
30
|
+
{/if}
|
|
31
|
+
</fluent-button>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { SlotType } from "../types/index.js";
|
|
2
|
+
type Props = {
|
|
3
|
+
appearance?: string;
|
|
4
|
+
autofocus?: string;
|
|
5
|
+
disabled?: string;
|
|
6
|
+
form?: string;
|
|
7
|
+
formaction?: string;
|
|
8
|
+
formenctype?: string;
|
|
9
|
+
formmethod?: string;
|
|
10
|
+
formnovalidate?: string;
|
|
11
|
+
formtarget?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
value?: string;
|
|
15
|
+
start?: SlotType;
|
|
16
|
+
end?: SlotType;
|
|
17
|
+
children?: SlotType;
|
|
18
|
+
style?: string;
|
|
19
|
+
onClick?: (ev: MouseEvent) => void;
|
|
20
|
+
[prop: string]: any;
|
|
21
|
+
};
|
|
22
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
23
|
+
type Button = ReturnType<typeof Button>;
|
|
24
|
+
export default Button;
|