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,31 @@
|
|
|
1
|
+
# Flyout
|
|
2
|
+
|
|
3
|
+
The Flyout component is a floating panel that can be used to display additional information or options in a non-intrusive way. It is fully accessible and follows Fluent UI design principles for a seamless user experience.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script>
|
|
9
|
+
import { Flyout } from 'fluentui-svelte';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Flyout>
|
|
13
|
+
<p>This is the content of the flyout.</p>
|
|
14
|
+
</Flyout>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The Flyout.
|
|
18
|
+
|
|
19
|
+
## Component Props
|
|
20
|
+
|
|
21
|
+
| Name | Type | Description |
|
|
22
|
+
| ------------------- | ------------------------------------------------- | --------------------------------------------------------------- |
|
|
23
|
+
| `ref` | Bindable `HTMLElement` | The DOM reference to the flyout element. |
|
|
24
|
+
| `children` | `Snippet` | The content to be displayed inside the flyout. |
|
|
25
|
+
| `floating` | `boolean` | Whether to use Floating UI for positioning. Default: false. |
|
|
26
|
+
| `reference` | `HTMLElement` | The reference element for Floating UI. |
|
|
27
|
+
| `placement` | `Placement` | The placement for Floating UI positioning. Default: 'bottom'. |
|
|
28
|
+
| `onPlacementChange` | `(placement: Placement) => void` | A callback that is called when the placement changes. |
|
|
29
|
+
| `roundCorners` | `'all' \| 'top' \| 'bottom' \| 'left' \| 'right'` | Which corners to round. Default: 'all'. |
|
|
30
|
+
| `offset` | `number` | The offset for Floating UI positioning. Default: 8. |
|
|
31
|
+
| Element Attributes | | All other attributes that can be applied to the flyout element. |
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import { computePosition, offset, autoPlacement, hide, autoUpdate, type Placement } from '@floating-ui/dom';
|
|
4
|
+
import { roundByDPR } from '../../internal/index.js';
|
|
5
|
+
import type { FlyoutProps } from './types.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(),
|
|
9
|
+
children,
|
|
10
|
+
floating = false,
|
|
11
|
+
reference,
|
|
12
|
+
placement = 'bottom',
|
|
13
|
+
onPlacementChange,
|
|
14
|
+
placementConfig,
|
|
15
|
+
roundCorners = 'all',
|
|
16
|
+
offset: offsetValue = 8,
|
|
17
|
+
class: classes,
|
|
18
|
+
...attributes
|
|
19
|
+
}: FlyoutProps = $props();
|
|
20
|
+
|
|
21
|
+
let roundClass = $derived(`round-${roundCorners}`);
|
|
22
|
+
let currentPlacement = $derived(placement);
|
|
23
|
+
|
|
24
|
+
function handlePlacementChange(newPlacement: Placement) {
|
|
25
|
+
if (newPlacement !== currentPlacement) {
|
|
26
|
+
currentPlacement = newPlacement;
|
|
27
|
+
onPlacementChange?.(newPlacement);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getRoundClass(newPlacement: string) {
|
|
32
|
+
if (roundCorners === newPlacement) return `round-${roundCorners}`;
|
|
33
|
+
if (roundCorners === 'top') return 'round-bottom';
|
|
34
|
+
if (roundCorners === 'bottom') return 'round-top';
|
|
35
|
+
if (roundCorners === 'left') return 'round-right';
|
|
36
|
+
if (roundCorners === 'right') return 'round-left';
|
|
37
|
+
return 'round-all';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
onMount(() => {
|
|
41
|
+
if (floating && reference && ref) {
|
|
42
|
+
const middleware = [offset(offsetValue), autoPlacement(placementConfig), hide()];
|
|
43
|
+
const update = async () => {
|
|
44
|
+
if (!reference || !ref) return;
|
|
45
|
+
|
|
46
|
+
const {
|
|
47
|
+
x,
|
|
48
|
+
y,
|
|
49
|
+
middlewareData,
|
|
50
|
+
placement: _placement
|
|
51
|
+
} = await computePosition(reference, ref, {
|
|
52
|
+
placement,
|
|
53
|
+
middleware
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
Object.assign(ref.style, {
|
|
57
|
+
transform: `translate(${roundByDPR(x)}px, ${roundByDPR(y)}px)`,
|
|
58
|
+
visibility: middlewareData.hide?.referenceHidden ? 'hidden' : 'visible'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
if (_placement !== currentPlacement) {
|
|
62
|
+
handlePlacementChange(_placement);
|
|
63
|
+
roundClass = getRoundClass(_placement);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const cleanup = autoUpdate(reference, ref, update);
|
|
67
|
+
return () => cleanup();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<!--
|
|
73
|
+
@component
|
|
74
|
+
A contextual popup that displays a set of actions or options. It appears when users interact with a control or action and is dismissed when users click outside of it or select an option.
|
|
75
|
+
|
|
76
|
+
- Usage:
|
|
77
|
+
```tsx
|
|
78
|
+
<script>
|
|
79
|
+
import { Flyout } from 'fluentui-svelte';
|
|
80
|
+
</script>
|
|
81
|
+
|
|
82
|
+
<Flyout>
|
|
83
|
+
<p>Content goes here</p>
|
|
84
|
+
<Button>Close Flyout</Button>
|
|
85
|
+
</Flyout>
|
|
86
|
+
```
|
|
87
|
+
-->
|
|
88
|
+
<div class={['fs-flyout', roundClass, classes, { floating }]} bind:this={ref} {...attributes}>
|
|
89
|
+
{@render children?.()}
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<style>
|
|
93
|
+
.fs-flyout {
|
|
94
|
+
display: flex;
|
|
95
|
+
position: relative;
|
|
96
|
+
padding: 1rem;
|
|
97
|
+
background: var(--fs-acrylic-background-default);
|
|
98
|
+
box-shadow: var(--fs-shadow-flyout);
|
|
99
|
+
border-radius: var(--fs-control-overlay-border-radius);
|
|
100
|
+
border: 1px solid var(--fs-control-surface-stroke-flyout);
|
|
101
|
+
background-clip: padding-box;
|
|
102
|
+
color: var(--fs-text-primary);
|
|
103
|
+
&.floating {
|
|
104
|
+
position: absolute;
|
|
105
|
+
top: 0;
|
|
106
|
+
left: 0;
|
|
107
|
+
}
|
|
108
|
+
&::before {
|
|
109
|
+
content: '';
|
|
110
|
+
border-radius: calc(var(--fs-control-overlay-border-radius) - 0.063rem);
|
|
111
|
+
width: 100%;
|
|
112
|
+
height: 100%;
|
|
113
|
+
position: absolute;
|
|
114
|
+
inset: 0;
|
|
115
|
+
background: var(--fs-acrilic-noise);
|
|
116
|
+
background-size: 2.5rem;
|
|
117
|
+
opacity: 0.1;
|
|
118
|
+
filter: grayscale(1);
|
|
119
|
+
z-index: 0;
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
& :global(> *) {
|
|
123
|
+
z-index: 1;
|
|
124
|
+
}
|
|
125
|
+
&.round-all {
|
|
126
|
+
border-radius: var(--fs-control-overlay-border-radius);
|
|
127
|
+
}
|
|
128
|
+
&.round-top,
|
|
129
|
+
&.round-top::before {
|
|
130
|
+
border-radius: var(--fs-control-overlay-border-radius) var(--fs-control-overlay-border-radius) 0 0;
|
|
131
|
+
}
|
|
132
|
+
&.round-bottom,
|
|
133
|
+
&.round-bottom::before {
|
|
134
|
+
border-radius: 0 0 var(--fs-control-overlay-border-radius) var(--fs-control-overlay-border-radius);
|
|
135
|
+
}
|
|
136
|
+
&.round-left,
|
|
137
|
+
&.round-left::before {
|
|
138
|
+
border-radius: var(--fs-control-overlay-border-radius) 0 0 var(--fs-control-overlay-border-radius);
|
|
139
|
+
}
|
|
140
|
+
&.round-right,
|
|
141
|
+
&.round-right::before {
|
|
142
|
+
border-radius: 0 var(--fs-control-overlay-border-radius) var(--fs-control-overlay-border-radius) 0;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
:global(.dark-mode) .fs-flyout::before {
|
|
146
|
+
opacity: 0.05;
|
|
147
|
+
}
|
|
148
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { FlyoutProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A contextual popup that displays a set of actions or options. It appears when users interact with a control or action and is dismissed when users click outside of it or select an option.
|
|
4
|
+
*
|
|
5
|
+
* - Usage:
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <script>
|
|
8
|
+
* import { Flyout } from 'fluentui-svelte';
|
|
9
|
+
* </script>
|
|
10
|
+
*
|
|
11
|
+
* <Flyout>
|
|
12
|
+
* <p>Content goes here</p>
|
|
13
|
+
* <Button>Close Flyout</Button>
|
|
14
|
+
* </Flyout>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare const Flyout: import("svelte").Component<FlyoutProps, {}, "ref">;
|
|
18
|
+
type Flyout = ReturnType<typeof Flyout>;
|
|
19
|
+
export default Flyout;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AutoPlacementOptions, Placement } from '@floating-ui/dom';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
4
|
+
/** @propsmith FlyoutProps */
|
|
5
|
+
export type FlyoutProps = {
|
|
6
|
+
/** The DOM reference of the flyout element.
|
|
7
|
+
* @bindable
|
|
8
|
+
*/
|
|
9
|
+
ref?: HTMLElement;
|
|
10
|
+
/** The content of the flyout. */
|
|
11
|
+
children?: Snippet;
|
|
12
|
+
/** Positions the flyout with floating-ui instead of leaving it in the normal flow.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
floating?: boolean;
|
|
16
|
+
/** The element the flyout is positioned against when `floating` is set. */
|
|
17
|
+
reference?: HTMLElement;
|
|
18
|
+
/** Where the flyout is placed relative to its reference.
|
|
19
|
+
* @default 'bottom'
|
|
20
|
+
*/
|
|
21
|
+
placement?: Placement;
|
|
22
|
+
/** Called whenever floating-ui settles on a different placement. */
|
|
23
|
+
onPlacementChange?: (placement: Placement) => void;
|
|
24
|
+
/** Which corners of the flyout are rounded.
|
|
25
|
+
* @default 'all'
|
|
26
|
+
*/
|
|
27
|
+
roundCorners?: 'all' | 'top' | 'bottom' | 'left' | 'right';
|
|
28
|
+
/** The distance in pixels between the flyout and its reference.
|
|
29
|
+
* @default 8
|
|
30
|
+
*/
|
|
31
|
+
offset?: number;
|
|
32
|
+
/** The auto placement configuration handed over to floating-ui.
|
|
33
|
+
* @type AutoPlacementOptions
|
|
34
|
+
*/
|
|
35
|
+
placementConfig?: AutoPlacementOptions;
|
|
36
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Hyperlink
|
|
2
|
+
|
|
3
|
+
The Hyperlink component is used to create clickable links that navigate to a specified URL. It follows Fluent UI design principles and ensures accessibility and smooth user interactions.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script>
|
|
9
|
+
import { Hyperlink } from 'fluentui-svelte';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<Hyperlink href="/">Go to Home</Hyperlink>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Disabled
|
|
18
|
+
|
|
19
|
+
Disables the hyperlink and prevents navigation.
|
|
20
|
+
|
|
21
|
+
```svelte
|
|
22
|
+
<Hyperlink href="/" disabled>Disabled Link</Hyperlink>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Component Props
|
|
26
|
+
|
|
27
|
+
| Name | Type | Description |
|
|
28
|
+
| ------------------ | ------------------- | ----------------------------------------------------------------------- |
|
|
29
|
+
| `href` | `string` | The URL to navigate to when the link is clicked. |
|
|
30
|
+
| `disabled` | `boolean` | Disables the hyperlink and prevents navigation. |
|
|
31
|
+
| `children` | `Snippet` | The content of the hyperlink. |
|
|
32
|
+
| `ref` | `HTMLAnchorElement` | A bindable reference to the underlying anchor element. |
|
|
33
|
+
| Element Attributes | | You can use any valid HTML anchor attributes (e.g., target, rel, etc.). |
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HyperlinkProps } from './types.js';
|
|
3
|
+
|
|
4
|
+
let { href = '#', disabled, class: classes, children, ref = $bindable(), ...attributes }: HyperlinkProps = $props();
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
@component
|
|
9
|
+
|
|
10
|
+
This is an implementation of the Fluent UI hyperlink component. The hyperlink is used to navigate to a different page or to a different section of the same page. It is used to provide additional information or to redirect the user to another location.
|
|
11
|
+
F
|
|
12
|
+
- Usage:
|
|
13
|
+
```tsx
|
|
14
|
+
<script>
|
|
15
|
+
import { Hyperlink } from 'fluentui-svelte';
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<Hyperlink href="https://fluentui-svelte.dev">Fluent UI Svelte</Hyperlink>
|
|
19
|
+
```
|
|
20
|
+
-->
|
|
21
|
+
<a
|
|
22
|
+
// eslint-disable-next-line svelte/no-navigation-without-resolve
|
|
23
|
+
{href}
|
|
24
|
+
class={['fs-hyperlink', classes, { disabled }]}
|
|
25
|
+
tabindex={disabled ? -1 : undefined}
|
|
26
|
+
aria-disabled={disabled || undefined}
|
|
27
|
+
onclick={disabled ? (e) => e?.preventDefault() : undefined}
|
|
28
|
+
bind:this={ref}
|
|
29
|
+
{...attributes}
|
|
30
|
+
>
|
|
31
|
+
{#if children}
|
|
32
|
+
{@render children()}
|
|
33
|
+
{:else}
|
|
34
|
+
{href}
|
|
35
|
+
{/if}
|
|
36
|
+
</a>
|
|
37
|
+
|
|
38
|
+
<style>
|
|
39
|
+
.fs-hyperlink {
|
|
40
|
+
color: var(--fs-accent-text-primary);
|
|
41
|
+
text-decoration: underline;
|
|
42
|
+
outline: none;
|
|
43
|
+
border-radius: 0.25rem;
|
|
44
|
+
&:hover,
|
|
45
|
+
&:active {
|
|
46
|
+
text-decoration: none;
|
|
47
|
+
}
|
|
48
|
+
&:hover {
|
|
49
|
+
color: var(--fs-accent-text-secondary);
|
|
50
|
+
}
|
|
51
|
+
&:active {
|
|
52
|
+
color: var(--fs-accent-text-tertiary);
|
|
53
|
+
}
|
|
54
|
+
&:focus-visible {
|
|
55
|
+
outline: 0.188rem var(--fs-focus-stroke-outer) solid;
|
|
56
|
+
outline-offset: 0.063rem;
|
|
57
|
+
}
|
|
58
|
+
&.disabled {
|
|
59
|
+
color: var(--fs-text-disabled);
|
|
60
|
+
&:hover {
|
|
61
|
+
cursor: not-allowed;
|
|
62
|
+
text-decoration: underline;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HyperlinkProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* This is an implementation of the Fluent UI hyperlink component. The hyperlink is used to navigate to a different page or to a different section of the same page. It is used to provide additional information or to redirect the user to another location.
|
|
4
|
+
* F
|
|
5
|
+
* - Usage:
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <script>
|
|
8
|
+
* import { Hyperlink } from 'fluentui-svelte';
|
|
9
|
+
* </script>
|
|
10
|
+
*
|
|
11
|
+
* <Hyperlink href="https://fluentui-svelte.dev">Fluent UI Svelte</Hyperlink>
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare const Hyperlink: import("svelte").Component<HyperlinkProps, {}, "ref">;
|
|
15
|
+
type Hyperlink = ReturnType<typeof Hyperlink>;
|
|
16
|
+
export default Hyperlink;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLAnchorAttributes } from 'svelte/elements';
|
|
2
|
+
/** @propsmith HyperlinkProps */
|
|
3
|
+
export type HyperlinkProps = {
|
|
4
|
+
/** The URL the hyperlink points to.
|
|
5
|
+
* @default '#'
|
|
6
|
+
*/
|
|
7
|
+
href?: string;
|
|
8
|
+
/** Disables the user interaction. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** The DOM reference of the anchor element.
|
|
11
|
+
* @bindable
|
|
12
|
+
*/
|
|
13
|
+
ref?: HTMLAnchorElement;
|
|
14
|
+
} & HTMLAnchorAttributes;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# InfoBar
|
|
2
|
+
|
|
3
|
+
The InfoBar control is for displaying app-wide status messages to users that are highly visible yet non-intrusive. There are built-in severity levels to easily indicate the type of message shown, as well as the option to include your own call to action or hyperlink button. Since the InfoBar is inline with other UI content, it can remain visible or be dismissed by the user.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { InfoBar } from 'fluentui-svelte';
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<InfoBar status="information" title="Information">
|
|
13
|
+
<p>This is an informational message.</p>
|
|
14
|
+
</InfoBar>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Component API
|
|
18
|
+
|
|
19
|
+
A brief explanation of the props that really need explaining. You can see the rest of the props in the Component Props table below.
|
|
20
|
+
|
|
21
|
+
## Examples
|
|
22
|
+
|
|
23
|
+
### Status
|
|
24
|
+
|
|
25
|
+
The status prop determines the visual style and meaning of the InfoBar.
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<InfoBar status="information" title="Information">
|
|
29
|
+
<p>This is an informational message.</p>
|
|
30
|
+
</InfoBar>
|
|
31
|
+
<InfoBar status="attention" title="Attention">
|
|
32
|
+
<p>This is an attention message.</p>
|
|
33
|
+
</InfoBar>
|
|
34
|
+
<InfoBar status="warning" title="Warning">
|
|
35
|
+
<p>This is a warning message.</p>
|
|
36
|
+
</InfoBar>
|
|
37
|
+
<InfoBar status="critical" title="Critical">
|
|
38
|
+
<p>This is a critical message.</p>
|
|
39
|
+
</InfoBar>
|
|
40
|
+
<InfoBar status="success" title="Success">
|
|
41
|
+
<p>This is a success message.</p>
|
|
42
|
+
</InfoBar>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Style
|
|
46
|
+
|
|
47
|
+
The style prop determines the layout of the InfoBar.
|
|
48
|
+
|
|
49
|
+
```svelte
|
|
50
|
+
<InfoBar status="information" style="inline" title="Inline Style">
|
|
51
|
+
<p>This is an inline styled InfoBar.</p>
|
|
52
|
+
</InfoBar>
|
|
53
|
+
<InfoBar status="information" style="multiline" title="Multiline Style">
|
|
54
|
+
<p>This is a multiline styled InfoBar.</p>
|
|
55
|
+
</InfoBar>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Hide Close Button
|
|
59
|
+
|
|
60
|
+
The hideCloseButton prop allows you to hide the close button in the InfoBar.
|
|
61
|
+
|
|
62
|
+
```svelte
|
|
63
|
+
<InfoBar status="information" title="Without Close Button" hideCloseButton>
|
|
64
|
+
<p>This InfoBar does not have a close button.</p>
|
|
65
|
+
</InfoBar>
|
|
66
|
+
<InfoBar status="information" title="With Close Button">
|
|
67
|
+
<p>This InfoBar has a close button.</p>
|
|
68
|
+
</InfoBar>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Component Props
|
|
72
|
+
|
|
73
|
+
| Name | Type | Description |
|
|
74
|
+
| ----------------- | ---------------------- | --------------------------------------------------------------------------------------------------------- |
|
|
75
|
+
| `status` | `string` | The status of the InfoBar. Possible values: 'information', 'attention', 'warning', 'critical', 'success'. |
|
|
76
|
+
| `style` | `string` | The style of the InfoBar. Possible values: 'inline', 'multiline'. |
|
|
77
|
+
| `title` | `string` | The title of the InfoBar. |
|
|
78
|
+
| `icon` | `Snippet \| Component` | The icon to display in the InfoBar. |
|
|
79
|
+
| `iconSize` | `number` | The size of the icon in pixels. Default: 20. |
|
|
80
|
+
| `hideCloseButton` | `boolean` | Whether to hide the close button. Default: false. |
|
|
81
|
+
| `children` | `Snippet` | The child elements to render inside the InfoBar. |
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Button, BadgeIcon } from '../../index.js';
|
|
3
|
+
import DismissFilled from 'fluentui-icons-svelte/DismissFilled.svelte';
|
|
4
|
+
import DismissCircleFilled from 'fluentui-icons-svelte/DismissCircleFilled.svelte';
|
|
5
|
+
import InfoFilled from 'fluentui-icons-svelte/InfoFilled.svelte';
|
|
6
|
+
import ErrorCircleFilled from 'fluentui-icons-svelte/ErrorCircleFilled.svelte';
|
|
7
|
+
import WarningFilled from 'fluentui-icons-svelte/WarningFilled.svelte';
|
|
8
|
+
import CheckmarkFilled from 'fluentui-icons-svelte/CheckmarkFilled.svelte';
|
|
9
|
+
import { RenderSoC } from '../../internal/index.js';
|
|
10
|
+
import type { InfoBarProps } from './types.js';
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
status = 'information',
|
|
14
|
+
title,
|
|
15
|
+
icon: Icon,
|
|
16
|
+
style = 'inline',
|
|
17
|
+
hideCloseButton,
|
|
18
|
+
iconSize = 20,
|
|
19
|
+
children
|
|
20
|
+
}: InfoBarProps = $props();
|
|
21
|
+
|
|
22
|
+
const icons = {
|
|
23
|
+
information: InfoFilled,
|
|
24
|
+
attention: ErrorCircleFilled,
|
|
25
|
+
warning: WarningFilled,
|
|
26
|
+
critical: DismissCircleFilled,
|
|
27
|
+
success: CheckmarkFilled
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
let closed = $state(false);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<!-- @component
|
|
34
|
+
The InfoBar component is used to display a message to the user. It can have different styles and colors based on the status prop.
|
|
35
|
+
It can also have an icon, a title, a message, and a button with a callback.
|
|
36
|
+
- Usage:
|
|
37
|
+
```tsx
|
|
38
|
+
<script>
|
|
39
|
+
import { InfoBar } from 'fluentui-svelte';
|
|
40
|
+
import { HomeIcon } from 'some-icon-library';
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<InfoBar status="success" title="Success" message="The operation was successful." buttonCallback={(e) => console.log('Button clicked')}>
|
|
44
|
+
This is a custom content.
|
|
45
|
+
</InfoBar>
|
|
46
|
+
```
|
|
47
|
+
-->
|
|
48
|
+
{#if !closed}
|
|
49
|
+
<div class={['fs-info-bar', status, style]} role={status === 'critical' ? 'alert' : 'status'}>
|
|
50
|
+
<div class="icon-wrapper">
|
|
51
|
+
{#if Icon}
|
|
52
|
+
<RenderSoC SoC={Icon} />
|
|
53
|
+
{:else}
|
|
54
|
+
<BadgeIcon color={status} icon={icons[status] as any} size={iconSize} />
|
|
55
|
+
{/if}
|
|
56
|
+
</div>
|
|
57
|
+
<div class="content">
|
|
58
|
+
{#if title}<h3>{title}</h3>{/if}
|
|
59
|
+
{@render children?.()}
|
|
60
|
+
</div>
|
|
61
|
+
{#if !hideCloseButton}
|
|
62
|
+
<div class="close">
|
|
63
|
+
<Button
|
|
64
|
+
appearance="subtle"
|
|
65
|
+
style="min-width: max-content"
|
|
66
|
+
onclick={() => (closed = true)}
|
|
67
|
+
aria-label="Close InfoBar"
|
|
68
|
+
>
|
|
69
|
+
<DismissFilled class="button-icon" />
|
|
70
|
+
</Button>
|
|
71
|
+
</div>
|
|
72
|
+
{/if}
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
|
+
|
|
76
|
+
<style>
|
|
77
|
+
.fs-info-bar {
|
|
78
|
+
position: relative;
|
|
79
|
+
display: flex;
|
|
80
|
+
gap: 0.813rem;
|
|
81
|
+
padding: 0.5rem 0.5rem 0.5rem 0.635rem;
|
|
82
|
+
background-color: var(--fs-card-background-secondary);
|
|
83
|
+
border: 1px solid var(--fs-card-stroke-default);
|
|
84
|
+
border-radius: var(--fs-control-border-radius);
|
|
85
|
+
color: var(--fs-text-primary);
|
|
86
|
+
&.multiline {
|
|
87
|
+
padding-bottom: 1rem;
|
|
88
|
+
& .icon-wrapper {
|
|
89
|
+
align-items: flex-start;
|
|
90
|
+
}
|
|
91
|
+
& .content {
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
align-items: flex-start;
|
|
94
|
+
}
|
|
95
|
+
& .close {
|
|
96
|
+
align-items: flex-start;
|
|
97
|
+
}
|
|
98
|
+
&:not(:has(.close)) .content {
|
|
99
|
+
padding-right: 0.5rem;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
&.warning {
|
|
103
|
+
background-color: var(--fs-system-caution-bg);
|
|
104
|
+
}
|
|
105
|
+
&.critical {
|
|
106
|
+
background-color: var(--fs-system-critical-bg);
|
|
107
|
+
}
|
|
108
|
+
&.success {
|
|
109
|
+
background-color: var(--fs-system-success-bg);
|
|
110
|
+
}
|
|
111
|
+
& .icon-wrapper {
|
|
112
|
+
display: flex;
|
|
113
|
+
align-items: center;
|
|
114
|
+
justify-content: center;
|
|
115
|
+
width: 2rem;
|
|
116
|
+
}
|
|
117
|
+
& .content {
|
|
118
|
+
display: flex;
|
|
119
|
+
flex: 1 1 auto;
|
|
120
|
+
align-items: center;
|
|
121
|
+
gap: 0.5rem;
|
|
122
|
+
width: 100%;
|
|
123
|
+
& h3 {
|
|
124
|
+
font-weight: semibold;
|
|
125
|
+
font-size: var(--fs-body-font-size);
|
|
126
|
+
line-height: var(--fs-body-line-height);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
& .close {
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
}
|
|
134
|
+
& :global(.button-icon) {
|
|
135
|
+
width: 1.2rem;
|
|
136
|
+
height: 1.2rem;
|
|
137
|
+
color: var(--fs-text-primary);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InfoBarProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* The InfoBar component is used to display a message to the user. It can have different styles and colors based on the status prop.
|
|
4
|
+
* It can also have an icon, a title, a message, and a button with a callback.
|
|
5
|
+
* - Usage:
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <script>
|
|
8
|
+
* import { InfoBar } from 'fluentui-svelte';
|
|
9
|
+
* import { HomeIcon } from 'some-icon-library';
|
|
10
|
+
* </script>
|
|
11
|
+
*
|
|
12
|
+
* <InfoBar status="success" title="Success" message="The operation was successful." buttonCallback={(e) => console.log('Button clicked')}>
|
|
13
|
+
* This is a custom content.
|
|
14
|
+
* </InfoBar>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
declare const InfoBar: import("svelte").Component<InfoBarProps, {}, "">;
|
|
18
|
+
type InfoBar = ReturnType<typeof InfoBar>;
|
|
19
|
+
export default InfoBar;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
/** @propsmith InfoBarProps */
|
|
4
|
+
export type InfoBarProps = {
|
|
5
|
+
/** The severity of the message, which picks the icon and the colors.
|
|
6
|
+
* @default 'information'
|
|
7
|
+
*/
|
|
8
|
+
status?: 'information' | 'attention' | 'warning' | 'critical' | 'success';
|
|
9
|
+
/** Lays the message out on a single line, or stacked below the title.
|
|
10
|
+
* @default 'inline'
|
|
11
|
+
*/
|
|
12
|
+
style?: 'inline' | 'multiline';
|
|
13
|
+
/** The title of the InfoBar. */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** Custom icon, rendered instead of the one the `status` would pick on its own.
|
|
16
|
+
* @type Snippet | Component
|
|
17
|
+
*/
|
|
18
|
+
icon?: Snippet | Component;
|
|
19
|
+
/** The size of the icon in pixels.
|
|
20
|
+
* @default 20
|
|
21
|
+
*/
|
|
22
|
+
iconSize?: number;
|
|
23
|
+
/** Removes the button that dismisses the InfoBar. */
|
|
24
|
+
hideCloseButton?: boolean;
|
|
25
|
+
/** The message of the InfoBar. */
|
|
26
|
+
children?: Snippet;
|
|
27
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|