fluentui-svelte 0.1.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/LICENSE +21 -0
- package/README.md +201 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.d.ts +2 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.js +2 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte +457 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte.d.ts +4 -0
- package/dist/components/auto-suggest-box/docs/llms.md +73 -0
- package/dist/components/auto-suggest-box/option.svelte +82 -0
- package/dist/components/auto-suggest-box/option.svelte.d.ts +4 -0
- package/dist/components/auto-suggest-box/types.d.ts +140 -0
- package/dist/components/auto-suggest-box/types.js +1 -0
- package/dist/components/avatar/avatar.svelte +269 -0
- package/dist/components/avatar/avatar.svelte.d.ts +20 -0
- package/dist/components/avatar/docs/llms.md +92 -0
- package/dist/components/avatar/type.d.ts +63 -0
- package/dist/components/avatar/type.js +1 -0
- package/dist/components/badge/badge-icon.svelte +103 -0
- package/dist/components/badge/badge-icon.svelte.d.ts +25 -0
- package/dist/components/badge/badge.svelte +163 -0
- package/dist/components/badge/badge.svelte.d.ts +20 -0
- package/dist/components/badge/docs/llms.md +133 -0
- package/dist/components/badge/types.d.ts +70 -0
- package/dist/components/badge/types.js +1 -0
- package/dist/components/badge/utils.svelte.d.ts +16 -0
- package/dist/components/badge/utils.svelte.js +35 -0
- package/dist/components/button/button.svelte +203 -0
- package/dist/components/button/button.svelte.d.ts +38 -0
- package/dist/components/button/docs/llms.md +102 -0
- package/dist/components/button/split-button.svelte +66 -0
- package/dist/components/button/split-button.svelte.d.ts +4 -0
- package/dist/components/button/types.d.ts +84 -0
- package/dist/components/button/types.js +1 -0
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte +119 -0
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte.d.ts +4 -0
- package/dist/components/calendar-date-picker/docs/llms.md +33 -0
- package/dist/components/calendar-date-picker/types.d.ts +36 -0
- package/dist/components/calendar-date-picker/types.js +1 -0
- package/dist/components/calendar-view/calendar-view-controls.svelte +115 -0
- package/dist/components/calendar-view/calendar-view-controls.svelte.d.ts +3 -0
- package/dist/components/calendar-view/calendar-view-days.svelte +210 -0
- package/dist/components/calendar-view/calendar-view-days.svelte.d.ts +3 -0
- package/dist/components/calendar-view/calendar-view-grid.d.ts +38 -0
- package/dist/components/calendar-view/calendar-view-grid.js +140 -0
- package/dist/components/calendar-view/calendar-view-header.svelte +66 -0
- package/dist/components/calendar-view/calendar-view-header.svelte.d.ts +18 -0
- package/dist/components/calendar-view/calendar-view-item.svelte +181 -0
- package/dist/components/calendar-view/calendar-view-item.svelte.d.ts +4 -0
- package/dist/components/calendar-view/calendar-view-months.svelte +165 -0
- package/dist/components/calendar-view/calendar-view-months.svelte.d.ts +3 -0
- package/dist/components/calendar-view/calendar-view-years.svelte +161 -0
- package/dist/components/calendar-view/calendar-view-years.svelte.d.ts +3 -0
- package/dist/components/calendar-view/calendar-view.svelte +451 -0
- package/dist/components/calendar-view/calendar-view.svelte.d.ts +9 -0
- package/dist/components/calendar-view/calendar-view.svelte.js +196 -0
- package/dist/components/calendar-view/docs/llms.md +121 -0
- package/dist/components/calendar-view/index.d.ts +1 -0
- package/dist/components/calendar-view/index.js +1 -0
- package/dist/components/calendar-view/types.d.ts +174 -0
- package/dist/components/calendar-view/types.js +1 -0
- package/dist/components/checkbox/checkbox.svelte +171 -0
- package/dist/components/checkbox/checkbox.svelte.d.ts +40 -0
- package/dist/components/checkbox/docs/llms.md +78 -0
- package/dist/components/checkbox/types.d.ts +50 -0
- package/dist/components/checkbox/types.js +1 -0
- package/dist/components/date-picker/date-picker.svelte +381 -0
- package/dist/components/date-picker/date-picker.svelte.d.ts +4 -0
- package/dist/components/date-picker/docs/llms.md +52 -0
- package/dist/components/date-picker/index.d.ts +1 -0
- package/dist/components/date-picker/index.js +1 -0
- package/dist/components/date-picker/types.d.ts +74 -0
- package/dist/components/date-picker/types.js +1 -0
- package/dist/components/dialog/dialog-actions.svelte +37 -0
- package/dist/components/dialog/dialog-actions.svelte.d.ts +4 -0
- package/dist/components/dialog/dialog-content.svelte +17 -0
- package/dist/components/dialog/dialog-content.svelte.d.ts +4 -0
- package/dist/components/dialog/dialog-surface.svelte +95 -0
- package/dist/components/dialog/dialog-surface.svelte.d.ts +4 -0
- package/dist/components/dialog/dialog-title.svelte +33 -0
- package/dist/components/dialog/dialog-title.svelte.d.ts +25 -0
- package/dist/components/dialog/dialog-trigger.svelte +23 -0
- package/dist/components/dialog/dialog-trigger.svelte.d.ts +4 -0
- package/dist/components/dialog/dialog.svelte +64 -0
- package/dist/components/dialog/dialog.svelte.d.ts +7 -0
- package/dist/components/dialog/dialog.svelte.js +2 -0
- package/dist/components/dialog/docs/llms.md +131 -0
- package/dist/components/dialog/types.d.ts +92 -0
- package/dist/components/dialog/types.js +1 -0
- package/dist/components/divider/divider.svelte +120 -0
- package/dist/components/divider/divider.svelte.d.ts +39 -0
- package/dist/components/divider/docs/llms.md +83 -0
- package/dist/components/divider/types.d.ts +32 -0
- package/dist/components/divider/types.js +1 -0
- package/dist/components/dropdown/docs/llms.md +70 -0
- package/dist/components/dropdown/dropdown-context.d.ts +2 -0
- package/dist/components/dropdown/dropdown-context.js +2 -0
- package/dist/components/dropdown/dropdown-option.svelte +31 -0
- package/dist/components/dropdown/dropdown-option.svelte.d.ts +4 -0
- package/dist/components/dropdown/dropdown.svelte +309 -0
- package/dist/components/dropdown/dropdown.svelte.d.ts +4 -0
- package/dist/components/dropdown/types.d.ts +82 -0
- package/dist/components/dropdown/types.js +1 -0
- package/dist/components/dropdown-select/docs/llms.md +72 -0
- package/dist/components/dropdown-select/dropdown-select-option.svelte +87 -0
- package/dist/components/dropdown-select/dropdown-select-option.svelte.d.ts +4 -0
- package/dist/components/dropdown-select/dropdown-select.svelte +165 -0
- package/dist/components/dropdown-select/dropdown-select.svelte.d.ts +4 -0
- package/dist/components/dropdown-select/dropdown-select.svelte.js +48 -0
- package/dist/components/dropdown-select/index.d.ts +2 -0
- package/dist/components/dropdown-select/index.js +2 -0
- package/dist/components/dropdown-select/types.d.ts +46 -0
- package/dist/components/dropdown-select/types.js +1 -0
- package/dist/components/expander/docs/llms.md +88 -0
- package/dist/components/expander/expander.svelte +249 -0
- package/dist/components/expander/expander.svelte.d.ts +21 -0
- package/dist/components/expander/types.d.ts +47 -0
- package/dist/components/expander/types.js +1 -0
- package/dist/components/flyout/docs/llms.md +31 -0
- package/dist/components/flyout/flyout.svelte +148 -0
- package/dist/components/flyout/flyout.svelte.d.ts +19 -0
- package/dist/components/flyout/types.d.ts +36 -0
- package/dist/components/flyout/types.js +1 -0
- package/dist/components/hyperlink/docs/llms.md +33 -0
- package/dist/components/hyperlink/hyperlink.svelte +66 -0
- package/dist/components/hyperlink/hyperlink.svelte.d.ts +16 -0
- package/dist/components/hyperlink/types.d.ts +14 -0
- package/dist/components/hyperlink/types.js +1 -0
- package/dist/components/info-bar/docs/llms.md +81 -0
- package/dist/components/info-bar/info-bar.svelte +140 -0
- package/dist/components/info-bar/info-bar.svelte.d.ts +19 -0
- package/dist/components/info-bar/types.d.ts +27 -0
- package/dist/components/info-bar/types.js +1 -0
- package/dist/components/label/docs/llms.md +67 -0
- package/dist/components/label/label.svelte +95 -0
- package/dist/components/label/label.svelte.d.ts +4 -0
- package/dist/components/label/types.d.ts +32 -0
- package/dist/components/label/types.js +1 -0
- package/dist/components/list-view/docs/llms.md +110 -0
- package/dist/components/list-view/list-view-item.svelte +168 -0
- package/dist/components/list-view/list-view-item.svelte.d.ts +25 -0
- package/dist/components/list-view/list-view.svelte +137 -0
- package/dist/components/list-view/list-view.svelte.d.ts +25 -0
- package/dist/components/list-view/types.d.ts +95 -0
- package/dist/components/list-view/types.js +1 -0
- package/dist/components/list-view/utils.d.ts +6 -0
- package/dist/components/list-view/utils.js +12 -0
- package/dist/components/menu/context-menu-trigger.svelte +84 -0
- package/dist/components/menu/context-menu-trigger.svelte.d.ts +9 -0
- package/dist/components/menu/docs/llms.md +169 -0
- package/dist/components/menu/menu-divider.svelte +9 -0
- package/dist/components/menu/menu-divider.svelte.d.ts +26 -0
- package/dist/components/menu/menu-group.svelte +31 -0
- package/dist/components/menu/menu-group.svelte.d.ts +4 -0
- package/dist/components/menu/menu-item-checkbox.svelte +143 -0
- package/dist/components/menu/menu-item-checkbox.svelte.d.ts +15 -0
- package/dist/components/menu/menu-item-radio.svelte +147 -0
- package/dist/components/menu/menu-item-radio.svelte.d.ts +15 -0
- package/dist/components/menu/menu-item-switch.svelte +194 -0
- package/dist/components/menu/menu-item-switch.svelte.d.ts +15 -0
- package/dist/components/menu/menu-item.svelte +124 -0
- package/dist/components/menu/menu-item.svelte.d.ts +18 -0
- package/dist/components/menu/menu-list.svelte +38 -0
- package/dist/components/menu/menu-list.svelte.d.ts +5 -0
- package/dist/components/menu/menu-popover.svelte +125 -0
- package/dist/components/menu/menu-popover.svelte.d.ts +12 -0
- package/dist/components/menu/menu-trigger.svelte +121 -0
- package/dist/components/menu/menu-trigger.svelte.d.ts +4 -0
- package/dist/components/menu/menu.svelte +124 -0
- package/dist/components/menu/menu.svelte.d.ts +4 -0
- package/dist/components/menu/menu.svelte.js +77 -0
- package/dist/components/menu/types.d.ts +127 -0
- package/dist/components/menu/types.js +1 -0
- package/dist/components/number-box/docs/llms.md +37 -0
- package/dist/components/number-box/number-box.svelte +115 -0
- package/dist/components/number-box/number-box.svelte.d.ts +15 -0
- package/dist/components/number-box/types.d.ts +16 -0
- package/dist/components/number-box/types.js +1 -0
- package/dist/components/persona/docs/llms.md +107 -0
- package/dist/components/persona/persona.svelte +79 -0
- package/dist/components/persona/persona.svelte.d.ts +4 -0
- package/dist/components/persona/types.d.ts +42 -0
- package/dist/components/persona/types.js +1 -0
- package/dist/components/progress-bar/docs/llms.md +67 -0
- package/dist/components/progress-bar/progress-bar.svelte +167 -0
- package/dist/components/progress-bar/progress-bar.svelte.d.ts +15 -0
- package/dist/components/progress-bar/types.d.ts +39 -0
- package/dist/components/progress-bar/types.js +1 -0
- package/dist/components/progress-ring/docs/llms.md +76 -0
- package/dist/components/progress-ring/progress-ring.svelte +145 -0
- package/dist/components/progress-ring/progress-ring.svelte.d.ts +15 -0
- package/dist/components/progress-ring/types.d.ts +42 -0
- package/dist/components/progress-ring/types.js +1 -0
- package/dist/components/radio-button/docs/llms.md +64 -0
- package/dist/components/radio-button/radio-button.svelte +129 -0
- package/dist/components/radio-button/radio-button.svelte.d.ts +19 -0
- package/dist/components/radio-button/types.d.ts +24 -0
- package/dist/components/radio-button/types.js +1 -0
- package/dist/components/skeleton/docs/llms.md +67 -0
- package/dist/components/skeleton/skeleton.svelte +106 -0
- package/dist/components/skeleton/skeleton.svelte.d.ts +39 -0
- package/dist/components/skeleton/types.d.ts +24 -0
- package/dist/components/skeleton/types.js +1 -0
- package/dist/components/slider/docs/llms.md +75 -0
- package/dist/components/slider/slider.svelte +486 -0
- package/dist/components/slider/slider.svelte.d.ts +19 -0
- package/dist/components/slider/types.d.ts +102 -0
- package/dist/components/slider/types.js +1 -0
- package/dist/components/text-box/docs/llms.md +86 -0
- package/dist/components/text-box/text-box-button.svelte +65 -0
- package/dist/components/text-box/text-box-button.svelte.d.ts +9 -0
- package/dist/components/text-box/text-box.svelte +299 -0
- package/dist/components/text-box/text-box.svelte.d.ts +16 -0
- package/dist/components/text-box/types.d.ts +60 -0
- package/dist/components/text-box/types.js +1 -0
- package/dist/components/textarea/docs/llms.md +55 -0
- package/dist/components/textarea/textarea.svelte +151 -0
- package/dist/components/textarea/textarea.svelte.d.ts +17 -0
- package/dist/components/textarea/types.d.ts +33 -0
- package/dist/components/textarea/types.js +1 -0
- package/dist/components/time-picker/docs/llms.md +47 -0
- package/dist/components/time-picker/index.d.ts +1 -0
- package/dist/components/time-picker/index.js +1 -0
- package/dist/components/time-picker/time-picker.svelte +336 -0
- package/dist/components/time-picker/time-picker.svelte.d.ts +4 -0
- package/dist/components/time-picker/types.d.ts +54 -0
- package/dist/components/time-picker/types.js +1 -0
- package/dist/components/toggle-switch/docs/llms.md +39 -0
- package/dist/components/toggle-switch/toggle-switch.svelte +151 -0
- package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +17 -0
- package/dist/components/toggle-switch/types.d.ts +20 -0
- package/dist/components/toggle-switch/types.js +1 -0
- package/dist/components/tooltip/docs/llms.md +74 -0
- package/dist/components/tooltip/tooltip.svelte +246 -0
- package/dist/components/tooltip/tooltip.svelte.d.ts +18 -0
- package/dist/components/tooltip/types.d.ts +67 -0
- package/dist/components/tooltip/types.js +1 -0
- package/dist/components/tree-view/docs/llms.md +117 -0
- package/dist/components/tree-view/tree-view-item-content.svelte +158 -0
- package/dist/components/tree-view/tree-view-item-content.svelte.d.ts +4 -0
- package/dist/components/tree-view/tree-view-item.svelte +197 -0
- package/dist/components/tree-view/tree-view-item.svelte.d.ts +4 -0
- package/dist/components/tree-view/tree-view.svelte +220 -0
- package/dist/components/tree-view/tree-view.svelte.d.ts +4 -0
- package/dist/components/tree-view/tree-view.svelte.js +111 -0
- package/dist/components/tree-view/types.d.ts +185 -0
- package/dist/components/tree-view/types.js +1 -0
- package/dist/css/class-darkmode.css +186 -0
- package/dist/css/media-darkmode.css +189 -0
- package/dist/css/reset.css +53 -0
- package/dist/css/theme.css +276 -0
- package/dist/css/typography.css +67 -0
- package/dist/css/utils.d.ts +1 -0
- package/dist/css/utils.js +153 -0
- package/dist/index.d.ts +63 -0
- package/dist/index.js +129 -0
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +449 -0
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +22 -0
- package/dist/internal/components/render-soc/render-soc.svelte +29 -0
- package/dist/internal/components/render-soc/render-soc.svelte.d.ts +30 -0
- package/dist/internal/constants.d.ts +26 -0
- package/dist/internal/constants.js +4036 -0
- package/dist/internal/context.d.ts +14 -0
- package/dist/internal/context.js +13 -0
- package/dist/internal/dom-utils.svelte.d.ts +6 -0
- package/dist/internal/dom-utils.svelte.js +46 -0
- package/dist/internal/floating-ui/floating.svelte.d.ts +15 -0
- package/dist/internal/floating-ui/floating.svelte.js +26 -0
- package/dist/internal/floating-ui/utils.d.ts +3 -0
- package/dist/internal/floating-ui/utils.js +30 -0
- package/dist/internal/index.d.ts +9 -0
- package/dist/internal/index.js +9 -0
- package/dist/internal/polyfills/expander.svelte.d.ts +21 -0
- package/dist/internal/polyfills/expander.svelte.js +96 -0
- package/dist/internal/transitions.d.ts +32 -0
- package/dist/internal/transitions.js +37 -0
- package/dist/internal/utils.d.ts +22 -0
- package/dist/internal/utils.js +63 -0
- package/dist/providers/fluentui-svelte/fluentui-svelte.d.ts +19 -0
- package/dist/providers/fluentui-svelte/fluentui-svelte.js +11 -0
- package/dist/providers/fluentui-svelte/fluentui-svelte.svelte +68 -0
- package/dist/providers/fluentui-svelte/fluentui-svelte.svelte.d.ts +9 -0
- package/dist/types/index.d.ts +117 -0
- package/dist/types/index.js +1 -0
- package/package.json +142 -0
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ProgressRingProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
status,
|
|
6
|
+
size = 32,
|
|
7
|
+
class: classes,
|
|
8
|
+
hideRail,
|
|
9
|
+
min = 0,
|
|
10
|
+
max = 100,
|
|
11
|
+
role,
|
|
12
|
+
'aria-label': ariaLabel,
|
|
13
|
+
indeterminate,
|
|
14
|
+
value = $bindable(0),
|
|
15
|
+
ref = $bindable(),
|
|
16
|
+
railElement = $bindable(),
|
|
17
|
+
trackElement = $bindable(),
|
|
18
|
+
...attributes
|
|
19
|
+
}: ProgressRingProps = $props();
|
|
20
|
+
|
|
21
|
+
let circumference = $derived(
|
|
22
|
+
(trackElement && Number((Math.PI * (trackElement.r.baseVal.value * 2)).toFixed(2))) || 43.97
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
let checkValue = $derived(typeof value === 'number' ? Math.max(min, Math.min(max, value)) : undefined);
|
|
26
|
+
|
|
27
|
+
let _role = $derived(role ?? (!indeterminate ? 'progressbar' : 'status'));
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<!-- @component
|
|
31
|
+
A progress ring component that displays a circular progress indicator.
|
|
32
|
+
- Usage:
|
|
33
|
+
```tsx
|
|
34
|
+
<script>
|
|
35
|
+
import { ProgressRing } from 'fluentui-svelte';
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<ProgressRing value={50} size={32} rail />
|
|
39
|
+
```
|
|
40
|
+
-->
|
|
41
|
+
<svg
|
|
42
|
+
bind:this={ref}
|
|
43
|
+
tabindex="-1"
|
|
44
|
+
class={['progress-ring', status && `status-${status}`, classes, { indeterminate }]}
|
|
45
|
+
width={size}
|
|
46
|
+
height={size}
|
|
47
|
+
viewBox="0 0 16 16"
|
|
48
|
+
role={_role}
|
|
49
|
+
aria-label={ariaLabel ?? (indeterminate ? (!status ? 'Loading' : `Status: ${status}`) : `Progress: ${checkValue}%`)}
|
|
50
|
+
aria-valuemin={!indeterminate ? min : undefined}
|
|
51
|
+
aria-valuemax={!indeterminate ? max : undefined}
|
|
52
|
+
aria-valuenow={!indeterminate ? checkValue : undefined}
|
|
53
|
+
style="--ring-circumference: {circumference}px;"
|
|
54
|
+
{...attributes}
|
|
55
|
+
>
|
|
56
|
+
{#if !hideRail}
|
|
57
|
+
<circle
|
|
58
|
+
bind:this={railElement}
|
|
59
|
+
class="progress-ring-rail"
|
|
60
|
+
cx="50%"
|
|
61
|
+
cy="50%"
|
|
62
|
+
r="7"
|
|
63
|
+
stroke-dasharray={circumference}
|
|
64
|
+
stroke-dashoffset={0 * circumference}
|
|
65
|
+
/>
|
|
66
|
+
{/if}
|
|
67
|
+
<circle
|
|
68
|
+
bind:this={trackElement}
|
|
69
|
+
class="progress-ring-track"
|
|
70
|
+
cx="50%"
|
|
71
|
+
cy="50%"
|
|
72
|
+
r="7"
|
|
73
|
+
stroke-dasharray={circumference}
|
|
74
|
+
stroke-dashoffset={((max - (checkValue || 0)) / (max - min)) * circumference}
|
|
75
|
+
/>
|
|
76
|
+
</svg>
|
|
77
|
+
|
|
78
|
+
<style>
|
|
79
|
+
@keyframes progress-ring-indeterminate {
|
|
80
|
+
0% {
|
|
81
|
+
stroke-dasharray: 0.01px var(--ring-circumference);
|
|
82
|
+
transform: rotate(0);
|
|
83
|
+
}
|
|
84
|
+
50% {
|
|
85
|
+
stroke-dasharray: calc(var(--ring-circumference) / 2) calc(var(--ring-circumference) / 2);
|
|
86
|
+
transform: rotate(450deg);
|
|
87
|
+
}
|
|
88
|
+
100% {
|
|
89
|
+
stroke-dasharray: 0.01px var(--ring-circumference);
|
|
90
|
+
transform: rotate(1080deg);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
@keyframes fs-pulse {
|
|
94
|
+
0% {
|
|
95
|
+
opacity: 1;
|
|
96
|
+
}
|
|
97
|
+
50% {
|
|
98
|
+
opacity: 0;
|
|
99
|
+
}
|
|
100
|
+
100% {
|
|
101
|
+
opacity: 1;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.progress-ring {
|
|
106
|
+
outline: none;
|
|
107
|
+
min-inline-size: 16px;
|
|
108
|
+
min-block-size: 16px;
|
|
109
|
+
z-index: 0;
|
|
110
|
+
|
|
111
|
+
& circle {
|
|
112
|
+
transform: rotate(-90deg);
|
|
113
|
+
transform-origin: 50% 50%;
|
|
114
|
+
fill: none;
|
|
115
|
+
stroke: var(--fs-accent-fill-default);
|
|
116
|
+
stroke-width: 1.5;
|
|
117
|
+
stroke-linecap: round;
|
|
118
|
+
stroke-dasharray: var(--ring-circumference);
|
|
119
|
+
&.progress-ring-rail {
|
|
120
|
+
stroke: var(--fs-accent-fill-disabled);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
&.indeterminate circle:not(.progress-ring-rail) {
|
|
124
|
+
animation: progress-ring-indeterminate 2s linear infinite;
|
|
125
|
+
}
|
|
126
|
+
&.status-paused {
|
|
127
|
+
& .progress-ring-track {
|
|
128
|
+
stroke: var(--fs-system-caution);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
&.status-error {
|
|
132
|
+
& .progress-ring-track {
|
|
133
|
+
stroke: var(--fs-system-critical);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/*
|
|
138
|
+
* Reduced motion swaps the spin for a pulse instead of shortening it — a 0ms spin is simply
|
|
139
|
+
* invisible.
|
|
140
|
+
*/
|
|
141
|
+
:global(:root[data-fs-reduced-motion='true']) .progress-ring.indeterminate circle.progress-ring-track {
|
|
142
|
+
animation: fs-pulse 3s infinite linear;
|
|
143
|
+
stroke-dasharray: 0px;
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ProgressRingProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A progress ring component that displays a circular progress indicator.
|
|
4
|
+
* - Usage:
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <script>
|
|
7
|
+
* import { ProgressRing } from 'fluentui-svelte';
|
|
8
|
+
* </script>
|
|
9
|
+
*
|
|
10
|
+
* <ProgressRing value={50} size={32} rail />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
declare const ProgressRing: import("svelte").Component<ProgressRingProps, {}, "ref" | "value" | "railElement" | "trackElement">;
|
|
14
|
+
type ProgressRing = ReturnType<typeof ProgressRing>;
|
|
15
|
+
export default ProgressRing;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { SVGAttributes } from 'svelte/elements';
|
|
2
|
+
import type { ProgressStatus } from '../../types/index.js';
|
|
3
|
+
/** @propsmith ProgressRingProps */
|
|
4
|
+
export type ProgressRingProps = {
|
|
5
|
+
/** The current value of the progress ring.
|
|
6
|
+
* @default 0
|
|
7
|
+
* @bindable
|
|
8
|
+
*/
|
|
9
|
+
value?: number;
|
|
10
|
+
/** The minimum value of the progress ring.
|
|
11
|
+
* @default 0
|
|
12
|
+
*/
|
|
13
|
+
min?: number;
|
|
14
|
+
/** The maximum value of the progress ring.
|
|
15
|
+
* @default 100
|
|
16
|
+
*/
|
|
17
|
+
max?: number;
|
|
18
|
+
/** Spins the ring continuously instead of reporting a value. */
|
|
19
|
+
indeterminate?: boolean;
|
|
20
|
+
/** Whether to hide the rail element. */
|
|
21
|
+
hideRail?: boolean;
|
|
22
|
+
/** The size of the progress ring in pixels.
|
|
23
|
+
* @default 32
|
|
24
|
+
*/
|
|
25
|
+
size?: number;
|
|
26
|
+
/** The DOM reference of the progress ring element.
|
|
27
|
+
* @bindable
|
|
28
|
+
*/
|
|
29
|
+
ref?: SVGElement;
|
|
30
|
+
/** The DOM reference of the rail element.
|
|
31
|
+
* @bindable
|
|
32
|
+
*/
|
|
33
|
+
railElement?: SVGCircleElement;
|
|
34
|
+
/** The DOM reference of the track element.
|
|
35
|
+
* @bindable
|
|
36
|
+
*/
|
|
37
|
+
trackElement?: SVGCircleElement;
|
|
38
|
+
/** The current status of the progress ring, which recolors the track. */
|
|
39
|
+
status?: ProgressStatus;
|
|
40
|
+
/** The class to apply to the progress ring. */
|
|
41
|
+
class?: string;
|
|
42
|
+
} & SVGAttributes<SVGElement>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Radio Button
|
|
2
|
+
|
|
3
|
+
The Radio Button component lets users choose a single option from a set of mutually exclusive choices.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script>
|
|
9
|
+
import { RadioButton } from 'fluentui-svelte';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<RadioButton label="Option 1" />
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Component API
|
|
16
|
+
|
|
17
|
+
A brief explanation of the props that really need explaining. You can see the rest of the props in the Component Props section below.
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Grouping
|
|
22
|
+
|
|
23
|
+
While you can use name="inputName" to group items and have only one checked, you can use bind:group={someVariable} to update that variable with the value of the selected input and inspect it in your console. (Read More: https://svelte.dev/tutorial/svelte/group-inputs)
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<script>
|
|
27
|
+
import { RadioButton } from 'fluentui-svelte';
|
|
28
|
+
let groupValue = $state('');
|
|
29
|
+
$inspect(groupValue);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<RadioButton label="Option 1" name="group1" value="$1" bind:group={groupValue} />
|
|
33
|
+
<RadioButton label="Option 2" name="group1" value="$2" bind:group={groupValue} />
|
|
34
|
+
<RadioButton label="Option 3" name="group1" value="$3" disabled bind:group={groupValue} />
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Disabled
|
|
38
|
+
|
|
39
|
+
The disabled prop can be used to disable a radio button, preventing user interaction.
|
|
40
|
+
|
|
41
|
+
```svelte
|
|
42
|
+
<RadioButton label="Enabled Option" value="D" />
|
|
43
|
+
<RadioButton label="Disabled Option" value="E" disabled />
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Checked
|
|
47
|
+
|
|
48
|
+
The checked prop allows you to control the checked state of the radio button. This is useful for controlled components.
|
|
49
|
+
|
|
50
|
+
```svelte
|
|
51
|
+
<RadioButton label="Checked Option" value="F" checked />
|
|
52
|
+
<RadioButton label="Unchecked Option" value="G" />
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Component Props
|
|
56
|
+
|
|
57
|
+
| Name | Type | Description |
|
|
58
|
+
| ------------------ | ------------------ | ------------------------------------------------------------------------------------ |
|
|
59
|
+
| `label` | `string` | The label text for the radio button. |
|
|
60
|
+
| `group` | `unknown` | Bindable value representing a group of radio inputs that the input will be bound to. |
|
|
61
|
+
| `checked` | `boolean` | Indicates whether the radio button is checked. |
|
|
62
|
+
| `disabled` | `boolean` | Indicates whether the radio button is disabled. |
|
|
63
|
+
| `ref` | `HTMLInputElement` | Gets the DOM reference of the radio button element. |
|
|
64
|
+
| Element Attributes | | All standard HTML attributes for input elements can be applied. |
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PREFIX } from '../../internal/constants.js';
|
|
3
|
+
import type { RadioButtonProps } from './types.js';
|
|
4
|
+
|
|
5
|
+
const FALLBACK_ID = $props.id();
|
|
6
|
+
const COMPONENT_NAME = 'radio-button';
|
|
7
|
+
const ID = `${PREFIX}${COMPONENT_NAME}-${FALLBACK_ID}`;
|
|
8
|
+
|
|
9
|
+
let {
|
|
10
|
+
ref = $bindable(),
|
|
11
|
+
group = $bindable(undefined),
|
|
12
|
+
id = ID,
|
|
13
|
+
label,
|
|
14
|
+
name = id,
|
|
15
|
+
value,
|
|
16
|
+
checked = $bindable(false),
|
|
17
|
+
labelAttributes,
|
|
18
|
+
...attributes
|
|
19
|
+
}: RadioButtonProps = $props();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<!--
|
|
23
|
+
@component
|
|
24
|
+
|
|
25
|
+
This file contains the Svelte component implementation of a Fluent UI Radio Button.
|
|
26
|
+
The Fluent UI Radio Button is a customizable input element that allows users to select one option from a set.
|
|
27
|
+
|
|
28
|
+
If a `name` attribute isn't passed, `id` attribute will be used instead. If `name` & `id` aren't passed, the component will generate one and apply it to both.
|
|
29
|
+
|
|
30
|
+
- Usage:
|
|
31
|
+
```tsx
|
|
32
|
+
<script>
|
|
33
|
+
import { RadioButton } from 'fluentui-svelte';
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<RadioButton label="Radio Button label" />
|
|
37
|
+
```
|
|
38
|
+
-->
|
|
39
|
+
|
|
40
|
+
<label class="fs-radio-button" {...labelAttributes}>
|
|
41
|
+
<input type="radio" {id} {name} {value} {checked} bind:this={ref} bind:group {...attributes} />
|
|
42
|
+
{#if label}
|
|
43
|
+
<span>{label}</span>
|
|
44
|
+
{/if}
|
|
45
|
+
</label>
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
.fs-radio-button {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
border-radius: 1.125rem;
|
|
52
|
+
& input {
|
|
53
|
+
appearance: none;
|
|
54
|
+
position: relative;
|
|
55
|
+
border: 1px solid var(--fs-control-strong-default);
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
width: 1.125rem;
|
|
58
|
+
height: 1.125rem;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
outline: none;
|
|
61
|
+
background-color: var(--fs-control-alt-fill-secondary);
|
|
62
|
+
&::after {
|
|
63
|
+
content: '';
|
|
64
|
+
position: absolute;
|
|
65
|
+
width: 0.5rem;
|
|
66
|
+
height: 0.5rem;
|
|
67
|
+
inset: 0.25rem;
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
background-color: var(--fs-text-on-accent-primary);
|
|
70
|
+
transition: transform var(--fs-fast-duration) var(--fs-point-to-point);
|
|
71
|
+
transform: scale(0);
|
|
72
|
+
}
|
|
73
|
+
&:hover {
|
|
74
|
+
border-color: var(--fs-control-strong-disabled);
|
|
75
|
+
background-color: var(--fs-control-alt-fill-tertiary);
|
|
76
|
+
}
|
|
77
|
+
&:active {
|
|
78
|
+
background-color: var(--fs-control-alt-fill-quaternary);
|
|
79
|
+
&::after {
|
|
80
|
+
transform: scale(0.7);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
&:checked {
|
|
84
|
+
border-color: transparent;
|
|
85
|
+
background-color: var(--fs-accent-fill-default);
|
|
86
|
+
&::after {
|
|
87
|
+
transform: scale(1);
|
|
88
|
+
}
|
|
89
|
+
&:hover {
|
|
90
|
+
border-color: transparent;
|
|
91
|
+
background-color: var(--fs-accent-fill-secondary);
|
|
92
|
+
&::after {
|
|
93
|
+
transform: scale(1.3);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
&:active {
|
|
97
|
+
background-color: var(--fs-accent-fill-tertiary);
|
|
98
|
+
&::after {
|
|
99
|
+
transform: scale(0.7);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
&:has(input:disabled) {
|
|
105
|
+
pointer-events: none;
|
|
106
|
+
color: var(--fs-text-disabled);
|
|
107
|
+
input {
|
|
108
|
+
background-color: var(--fs-control-alt-fill-disabled);
|
|
109
|
+
border-color: var(--fs-control-strong-disabled);
|
|
110
|
+
&::after {
|
|
111
|
+
background-color: var(--fs-text-on-accent-disabled);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
&:has(input:focus-visible) {
|
|
116
|
+
outline: 0.125rem var(--fs-focus-stroke-outer) solid;
|
|
117
|
+
outline-offset: 0.125rem;
|
|
118
|
+
&:has(span) {
|
|
119
|
+
border-radius: 0.063rem;
|
|
120
|
+
outline-offset: 0.313rem;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
& span {
|
|
124
|
+
font-size: inherit;
|
|
125
|
+
color: inherit;
|
|
126
|
+
padding: 0px 0.75rem;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { RadioButtonProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* This file contains the Svelte component implementation of a Fluent UI Radio Button.
|
|
4
|
+
* The Fluent UI Radio Button is a customizable input element that allows users to select one option from a set.
|
|
5
|
+
*
|
|
6
|
+
* If a `name` attribute isn't passed, `id` attribute will be used instead. If `name` & `id` aren't passed, the component will generate one and apply it to both.
|
|
7
|
+
*
|
|
8
|
+
* - Usage:
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <script>
|
|
11
|
+
* import { RadioButton } from 'fluentui-svelte';
|
|
12
|
+
* </script>
|
|
13
|
+
*
|
|
14
|
+
* <RadioButton label="Radio Button label" />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare const RadioButton: import("svelte").Component<RadioButtonProps, {}, "ref" | "group" | "checked">;
|
|
18
|
+
type RadioButton = ReturnType<typeof RadioButton>;
|
|
19
|
+
export default RadioButton;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
import type { PolymorphicProps } from '../../types/index.js';
|
|
3
|
+
/** @propsmith RadioButtonProps */
|
|
4
|
+
export type RadioButtonProps = {
|
|
5
|
+
/** The label displayed next to the radio button. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Bindable value representing a group of radio inputs that the input will be bound to.
|
|
8
|
+
* @bindable
|
|
9
|
+
*/
|
|
10
|
+
group?: unknown;
|
|
11
|
+
/** Whether the radio button is selected.
|
|
12
|
+
* @default false
|
|
13
|
+
* @bindable
|
|
14
|
+
*/
|
|
15
|
+
checked?: boolean;
|
|
16
|
+
/** The DOM reference of the radio button element.
|
|
17
|
+
* @bindable
|
|
18
|
+
*/
|
|
19
|
+
ref?: HTMLInputElement;
|
|
20
|
+
/** The attributes to spread on the label wrapping the radio button.
|
|
21
|
+
* @type PolymorphicProps
|
|
22
|
+
*/
|
|
23
|
+
labelAttributes?: PolymorphicProps<'label'>;
|
|
24
|
+
} & HTMLInputAttributes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
The skeleton component provides a placeholder for content that is loading, giving users a visual indication of where content will appear once it has loaded.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
The skeleton renders a placeholder element and sizes itself via standard HTML/CSS. Use the `style`, `class`, `width` and `height` attributes (or the `justify` prop) to control its dimensions.
|
|
8
|
+
|
|
9
|
+
```svelte
|
|
10
|
+
<script>
|
|
11
|
+
import { Skeleton } from 'fluentui-svelte';
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<Skeleton style="width: 42px;" />
|
|
15
|
+
<Skeleton justify style="height: 12px;" />
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Component API
|
|
19
|
+
|
|
20
|
+
A brief explanation of the props that really need explaining. You can see the rest of the props in the Component Props table below.
|
|
21
|
+
|
|
22
|
+
## Examples
|
|
23
|
+
|
|
24
|
+
### Animation
|
|
25
|
+
|
|
26
|
+
The `animation` prop controls which type of animation is used for the skeleton. It can be set to `pulse` or `wave`. The default is `wave`.
|
|
27
|
+
|
|
28
|
+
```svelte
|
|
29
|
+
<Skeleton style="width: 72px;" animation="pulse" />
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Justify
|
|
33
|
+
|
|
34
|
+
Control if the skeleton should take the full width of its container or not. The default is `false`, meaning it will only take the `1:1` ratio of its width.
|
|
35
|
+
|
|
36
|
+
```svelte
|
|
37
|
+
<Skeleton style="width: 120px;" justify />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Shape
|
|
41
|
+
|
|
42
|
+
The `shape` prop allows you to change the shape of the skeleton. It can be set to `circle`, `square`, or `rounded`. The default is `rounded`.
|
|
43
|
+
|
|
44
|
+
```svelte
|
|
45
|
+
<Skeleton style="width: 72px;" shape="circle" />
|
|
46
|
+
<Skeleton style="width: 72px;" shape="rounded" />
|
|
47
|
+
<Skeleton style="width: 72px;" shape="square" />
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### As
|
|
51
|
+
|
|
52
|
+
The `as` prop lets you choose the HTML tag used to render the skeleton. Possible values: `'div'` (default) or `'span'`.
|
|
53
|
+
|
|
54
|
+
```svelte
|
|
55
|
+
<Skeleton as="span" style="width: 72px;" />
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Component Props
|
|
59
|
+
|
|
60
|
+
| Name | Type | Description |
|
|
61
|
+
| ------------------ | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `as` | `'div' \| 'span'` | The HTML element used to render the skeleton. Default: `'div'`. |
|
|
63
|
+
| `animation` | `'wave' \| 'pulse'` | The animation type for the skeleton. Default: `'wave'`. |
|
|
64
|
+
| `shape` | `'circle' \| 'rounded' \| 'square'` | The shape of the skeleton. Default: `'rounded'`. |
|
|
65
|
+
| `justify` | `boolean` | If `true` the skeleton fills the full width of its container; otherwise it keeps a `1:1` aspect ratio based on its width. |
|
|
66
|
+
| `element` | `HTMLElement` | The DOM reference of the skeleton element (`bind:element`). |
|
|
67
|
+
| Element Attributes | | All other attributes are passed to the root element of the skeleton. |
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<script lang="ts" generics="Tag extends SkeletonTags = 'div'">
|
|
2
|
+
import { getReducedMotion } from '../../providers/fluentui-svelte/fluentui-svelte.js';
|
|
3
|
+
import type { SkeletonProps, SkeletonTags } from './types.js';
|
|
4
|
+
|
|
5
|
+
let {
|
|
6
|
+
as = 'div' as Tag,
|
|
7
|
+
animation = 'wave',
|
|
8
|
+
shape = 'rounded',
|
|
9
|
+
justify,
|
|
10
|
+
class: classes,
|
|
11
|
+
ref = $bindable(),
|
|
12
|
+
...attributes
|
|
13
|
+
}: SkeletonProps<Tag> = $props();
|
|
14
|
+
|
|
15
|
+
let reducedMotion = getReducedMotion();
|
|
16
|
+
|
|
17
|
+
$effect.pre(() => {
|
|
18
|
+
animation = reducedMotion() ? 'pulse' : animation;
|
|
19
|
+
});
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<!--
|
|
23
|
+
@component
|
|
24
|
+
This is a implementation of Fluent UI Skeleton component. The skeleton supports two visual animations (wave & pulse) and three shapes (circle, square & rounded).
|
|
25
|
+
|
|
26
|
+
- Usage:
|
|
27
|
+
```tsx
|
|
28
|
+
<script>
|
|
29
|
+
import { Skeleton } from 'fluentui-svelte';
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<Skeleton />
|
|
33
|
+
<Skeleton animation="pulse" shape="circle" height="42px" />
|
|
34
|
+
<Skeleton animation="wave" shape="square" height="24px" />
|
|
35
|
+
```
|
|
36
|
+
-->
|
|
37
|
+
<svelte:element
|
|
38
|
+
this={as}
|
|
39
|
+
bind:this={ref}
|
|
40
|
+
aria-hidden="true"
|
|
41
|
+
class={['fs-skeleton', animation, shape, classes, { justify }]}
|
|
42
|
+
{...attributes}
|
|
43
|
+
></svelte:element>
|
|
44
|
+
|
|
45
|
+
<style>
|
|
46
|
+
.fs-skeleton {
|
|
47
|
+
background: var(--fs-system-neutral-bg);
|
|
48
|
+
overflow: hidden;
|
|
49
|
+
position: relative;
|
|
50
|
+
&.justify {
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
&:not(.justify) {
|
|
54
|
+
aspect-ratio: 1;
|
|
55
|
+
}
|
|
56
|
+
&.circle {
|
|
57
|
+
border-radius: 9999px;
|
|
58
|
+
}
|
|
59
|
+
&.square {
|
|
60
|
+
border-radius: 0;
|
|
61
|
+
}
|
|
62
|
+
&.rounded {
|
|
63
|
+
border-radius: 4px;
|
|
64
|
+
}
|
|
65
|
+
&::after {
|
|
66
|
+
content: '';
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
z-index: 100;
|
|
73
|
+
}
|
|
74
|
+
&.wave::after {
|
|
75
|
+
background-image: linear-gradient(
|
|
76
|
+
90deg,
|
|
77
|
+
transparent 20%,
|
|
78
|
+
color-mix(in srgb, var(--fs-control-on-image-fill-default), transparent 40%) 50%,
|
|
79
|
+
transparent 80%
|
|
80
|
+
);
|
|
81
|
+
transform: translateX(-100%);
|
|
82
|
+
animation: fs-skeleton-wave var(--fs-extra-slow-duration) infinite var(--fs-point-to-point);
|
|
83
|
+
}
|
|
84
|
+
&.pulse::after {
|
|
85
|
+
background: var(--fs-system-neutral-bg);
|
|
86
|
+
animation: fs-skeleton-pulse 2s infinite var(--fs-point-to-point);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@keyframes fs-skeleton-wave {
|
|
91
|
+
100% {
|
|
92
|
+
transform: translateX(100%);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
@keyframes fs-skeleton-pulse {
|
|
96
|
+
0% {
|
|
97
|
+
opacity: 1;
|
|
98
|
+
}
|
|
99
|
+
50% {
|
|
100
|
+
opacity: 0;
|
|
101
|
+
}
|
|
102
|
+
100% {
|
|
103
|
+
opacity: 1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</style>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { SkeletonProps, SkeletonTags } from './types.ts';
|
|
2
|
+
declare function $$render<Tag extends SkeletonTags = 'div'>(): {
|
|
3
|
+
props: SkeletonProps<Tag>;
|
|
4
|
+
exports: {};
|
|
5
|
+
bindings: "ref";
|
|
6
|
+
slots: {};
|
|
7
|
+
events: {};
|
|
8
|
+
};
|
|
9
|
+
declare class __sveltets_Render<Tag extends SkeletonTags = 'div'> {
|
|
10
|
+
props(): ReturnType<typeof $$render<Tag>>['props'];
|
|
11
|
+
events(): ReturnType<typeof $$render<Tag>>['events'];
|
|
12
|
+
slots(): ReturnType<typeof $$render<Tag>>['slots'];
|
|
13
|
+
bindings(): "ref";
|
|
14
|
+
exports(): {};
|
|
15
|
+
}
|
|
16
|
+
interface $$IsomorphicComponent {
|
|
17
|
+
new <Tag extends SkeletonTags = 'div'>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Tag>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Tag>['props']>, ReturnType<__sveltets_Render<Tag>['events']>, ReturnType<__sveltets_Render<Tag>['slots']>> & {
|
|
18
|
+
$$bindings?: ReturnType<__sveltets_Render<Tag>['bindings']>;
|
|
19
|
+
} & ReturnType<__sveltets_Render<Tag>['exports']>;
|
|
20
|
+
<Tag extends SkeletonTags = 'div'>(internal: unknown, props: ReturnType<__sveltets_Render<Tag>['props']> & {}): ReturnType<__sveltets_Render<Tag>['exports']>;
|
|
21
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* This is a implementation of Fluent UI Skeleton component. The skeleton supports two visual animations (wave & pulse) and three shapes (circle, square & rounded).
|
|
25
|
+
*
|
|
26
|
+
* - Usage:
|
|
27
|
+
* ```tsx
|
|
28
|
+
* <script>
|
|
29
|
+
* import { Skeleton } from 'fluentui-svelte';
|
|
30
|
+
* </script>
|
|
31
|
+
*
|
|
32
|
+
* <Skeleton />
|
|
33
|
+
* <Skeleton animation="pulse" shape="circle" height="42px" />
|
|
34
|
+
* <Skeleton animation="wave" shape="square" height="24px" />
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare const Skeleton: $$IsomorphicComponent;
|
|
38
|
+
type Skeleton<Tag extends SkeletonTags = 'div'> = InstanceType<typeof Skeleton<Tag>>;
|
|
39
|
+
export default Skeleton;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { PolymorphicProps, Shapes } from '../../types/index.js';
|
|
2
|
+
export type SkeletonTags = 'div' | 'span';
|
|
3
|
+
/** @propsmith SkeletonProps */
|
|
4
|
+
export type SkeletonProps<Tag extends SkeletonTags = 'div'> = {
|
|
5
|
+
/** The HTML element to render the skeleton as.
|
|
6
|
+
* @type 'div' | 'span'
|
|
7
|
+
* @default 'div'
|
|
8
|
+
*/
|
|
9
|
+
as?: Tag;
|
|
10
|
+
/** The animation played while the content is loading.
|
|
11
|
+
* @default 'wave'
|
|
12
|
+
*/
|
|
13
|
+
animation?: 'wave' | 'pulse';
|
|
14
|
+
/** The skeleton can have a circular, rounded or square shape.
|
|
15
|
+
* @default 'rounded'
|
|
16
|
+
*/
|
|
17
|
+
shape?: Shapes;
|
|
18
|
+
/** The skeleton is justified to the full width of the container. */
|
|
19
|
+
justify?: boolean;
|
|
20
|
+
/** The DOM reference of the skeleton element.
|
|
21
|
+
* @bindable
|
|
22
|
+
*/
|
|
23
|
+
ref?: HTMLElement;
|
|
24
|
+
} & PolymorphicProps<Tag>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|