fluentui-svelte 0.5.0 → 0.7.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/dist/components/app-surface/app-surface.svelte +96 -0
- package/dist/components/app-surface/app-surface.svelte.d.ts +22 -0
- package/dist/components/app-surface/docs/llms.md +73 -0
- package/dist/components/app-surface/types.d.ts +19 -0
- package/dist/components/app-surface/types.js +1 -0
- package/dist/components/app-window/app-window.d.ts +3 -0
- package/dist/components/app-window/app-window.js +3 -0
- package/dist/components/app-window/app-window.svelte +193 -0
- package/dist/components/app-window/app-window.svelte.d.ts +25 -0
- package/dist/components/app-window/docs/llms.md +119 -0
- package/dist/components/app-window/types.d.ts +66 -0
- package/dist/components/app-window/types.js +1 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte +47 -31
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte.d.ts +2 -2
- package/dist/components/auto-suggest-box/docs/llms.md +34 -33
- package/dist/components/auto-suggest-box/option.svelte +6 -4
- package/dist/components/auto-suggest-box/types.d.ts +13 -16
- package/dist/components/avatar/avatar.svelte +4 -3
- package/dist/components/avatar/docs/llms.md +1 -1
- package/dist/components/avatar/type.d.ts +1 -1
- package/dist/components/badge/badge-icon.svelte +2 -2
- package/dist/components/badge/badge.svelte +2 -2
- package/dist/components/badge/docs/llms.md +2 -2
- package/dist/components/badge/types.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-button.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-divider.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb.svelte +10 -5
- package/dist/components/breadcrumb/docs/llms.md +11 -11
- package/dist/components/breadcrumb/types.d.ts +7 -7
- package/dist/components/button/button.svelte +2 -2
- package/dist/components/button/docs/llms.md +17 -17
- package/dist/components/button/split-button.svelte +7 -7
- package/dist/components/button/types.d.ts +5 -5
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte +98 -10
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte.d.ts +1 -1
- package/dist/components/calendar-date-picker/docs/llms.md +19 -14
- package/dist/components/calendar-date-picker/types.d.ts +22 -8
- package/dist/components/calendar-view/calendar-view-days.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-grid.js +8 -3
- package/dist/components/calendar-view/calendar-view-item.svelte +10 -4
- package/dist/components/calendar-view/calendar-view-months.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-years.svelte +3 -2
- package/dist/components/calendar-view/calendar-view.svelte +11 -4
- package/dist/components/calendar-view/calendar-view.svelte.js +5 -0
- package/dist/components/calendar-view/docs/llms.md +20 -19
- package/dist/components/calendar-view/types.d.ts +6 -1
- package/dist/components/card/card-footer.svelte +2 -2
- package/dist/components/card/card-header.svelte +5 -4
- package/dist/components/card/card-preview.svelte +13 -2
- package/dist/components/card/card.svelte +5 -5
- package/dist/components/card/docs/llms.md +22 -21
- package/dist/components/card/types.d.ts +8 -4
- package/dist/components/checkbox/checkbox.svelte +47 -26
- package/dist/components/checkbox/checkbox.svelte.d.ts +3 -24
- package/dist/components/checkbox/docs/llms.md +24 -23
- package/dist/components/checkbox/types.d.ts +10 -23
- package/dist/components/date-picker/date-picker.svelte +98 -27
- package/dist/components/date-picker/date-picker.svelte.d.ts +1 -1
- package/dist/components/date-picker/docs/llms.md +23 -20
- package/dist/components/date-picker/types.d.ts +24 -15
- package/dist/components/dialog/dialog-actions.svelte +17 -2
- package/dist/components/dialog/dialog-content.svelte +2 -2
- package/dist/components/dialog/dialog-content.svelte.d.ts +1 -1
- package/dist/components/dialog/dialog-surface.svelte +130 -8
- package/dist/components/dialog/dialog-title.svelte +23 -6
- package/dist/components/dialog/dialog-trigger.svelte +8 -2
- package/dist/components/dialog/dialog-trigger.svelte.d.ts +1 -1
- package/dist/components/dialog/dialog.svelte +22 -11
- package/dist/components/dialog/docs/llms.md +56 -19
- package/dist/components/dialog/types.d.ts +31 -9
- package/dist/components/dialog/utils.d.ts +2 -0
- package/dist/components/dialog/utils.js +1 -0
- package/dist/components/divider/divider.svelte +6 -4
- package/dist/components/divider/types.d.ts +1 -1
- package/dist/components/dropdown/docs/llms.md +30 -28
- package/dist/components/dropdown/dropdown-option.svelte +17 -5
- package/dist/components/dropdown/dropdown.svelte +182 -84
- package/dist/components/dropdown/dropdown.svelte.d.ts +1 -1
- package/dist/components/dropdown/types.d.ts +26 -20
- package/dist/components/dropdown-select/docs/llms.md +24 -22
- package/dist/components/dropdown-select/dropdown-select-option.svelte +2 -2
- package/dist/components/dropdown-select/dropdown-select.svelte +42 -7
- package/dist/components/dropdown-select/types.d.ts +4 -4
- package/dist/components/expander/docs/llms.md +3 -3
- package/dist/components/expander/expander.svelte +13 -8
- package/dist/components/expander/types.d.ts +5 -5
- package/dist/components/flyout/docs/llms.md +1 -1
- package/dist/components/flyout/flyout.svelte +17 -6
- package/dist/components/flyout/types.d.ts +1 -1
- package/dist/components/hyperlink/docs/llms.md +6 -6
- package/dist/components/hyperlink/hyperlink.svelte +13 -4
- package/dist/components/hyperlink/types.d.ts +1 -1
- package/dist/components/info-bar/docs/llms.md +11 -10
- package/dist/components/info-bar/info-bar.svelte +3 -2
- package/dist/components/info-bar/types.d.ts +4 -0
- package/dist/components/label/docs/llms.md +75 -22
- package/dist/components/label/label-context.d.ts +14 -0
- package/dist/components/label/label-context.js +10 -0
- package/dist/components/label/label.svelte +153 -30
- package/dist/components/label/label.svelte.d.ts +1 -1
- package/dist/components/label/types.d.ts +48 -4
- package/dist/components/list-view/docs/llms.md +103 -33
- package/dist/components/list-view/list-view-item-branch.svelte +257 -0
- package/dist/components/list-view/list-view-item-branch.svelte.d.ts +4 -0
- package/dist/components/list-view/list-view-item.svelte +164 -46
- package/dist/components/list-view/list-view-item.svelte.d.ts +5 -5
- package/dist/components/list-view/list-view.svelte +73 -25
- package/dist/components/list-view/types.d.ts +71 -8
- package/dist/components/list-view/utils.d.ts +10 -0
- package/dist/components/list-view/utils.js +17 -1
- package/dist/components/menu/docs/llms.md +98 -15
- package/dist/components/menu/menu-command-bar-item.svelte +61 -0
- package/dist/components/menu/menu-command-bar-item.svelte.d.ts +14 -0
- package/dist/components/menu/menu-command-bar.svelte +218 -0
- package/dist/components/menu/menu-command-bar.svelte.d.ts +21 -0
- package/dist/components/menu/menu-group.svelte +6 -3
- package/dist/components/menu/menu-item-checkbox.svelte +5 -4
- package/dist/components/menu/menu-item-radio.svelte +5 -4
- package/dist/components/menu/menu-item-switch.svelte +5 -4
- package/dist/components/menu/menu-item.svelte +5 -5
- package/dist/components/menu/menu-item.svelte.d.ts +2 -3
- package/dist/components/menu/menu-list.svelte +10 -1
- package/dist/components/menu/menu-popover.svelte +9 -5
- package/dist/components/menu/menu-trigger.svelte +2 -1
- package/dist/components/menu/menu.svelte.js +1 -0
- package/dist/components/menu/types.d.ts +62 -7
- package/dist/components/number-box/docs/llms.md +6 -4
- package/dist/components/number-box/number-box.svelte +35 -29
- package/dist/components/number-box/number-box.svelte.d.ts +1 -1
- package/dist/components/number-box/types.d.ts +1 -1
- package/dist/components/persona/docs/llms.md +29 -25
- package/dist/components/persona/persona.svelte +8 -6
- package/dist/components/persona/types.d.ts +4 -3
- package/dist/components/progress-bar/docs/llms.md +13 -13
- package/dist/components/progress-bar/progress-bar.svelte +6 -6
- package/dist/components/progress-bar/types.d.ts +4 -4
- package/dist/components/progress-ring/docs/llms.md +14 -14
- package/dist/components/progress-ring/progress-ring.svelte +5 -5
- package/dist/components/progress-ring/types.d.ts +3 -3
- package/dist/components/radio-button/docs/llms.md +11 -8
- package/dist/components/radio-button/radio-button.svelte +38 -12
- package/dist/components/radio-button/radio-button.svelte.d.ts +1 -1
- package/dist/components/radio-button/types.d.ts +11 -8
- package/dist/components/rating/docs/llms.md +111 -0
- package/dist/components/rating/rating.svelte +247 -0
- package/dist/components/rating/rating.svelte.d.ts +19 -0
- package/dist/components/rating/types.d.ts +44 -0
- package/dist/components/rating/types.js +1 -0
- package/dist/components/side-nav/docs/llms.md +110 -0
- package/dist/components/side-nav/side-nav-branch.svelte +43 -0
- package/dist/components/side-nav/side-nav-branch.svelte.d.ts +4 -0
- package/dist/components/side-nav/side-nav-item.svelte +75 -0
- package/dist/components/side-nav/side-nav-item.svelte.d.ts +25 -0
- package/dist/components/side-nav/side-nav-list.svelte +32 -0
- package/dist/components/side-nav/side-nav-list.svelte.d.ts +7 -0
- package/dist/components/side-nav/side-nav.d.ts +2 -0
- package/dist/components/side-nav/side-nav.js +2 -0
- package/dist/components/side-nav/side-nav.svelte +355 -0
- package/dist/components/side-nav/side-nav.svelte.d.ts +24 -0
- package/dist/components/side-nav/types.d.ts +149 -0
- package/dist/components/side-nav/types.js +1 -0
- package/dist/components/skeleton/docs/llms.md +1 -1
- package/dist/components/skeleton/skeleton.svelte +2 -2
- package/dist/components/skeleton/types.d.ts +1 -1
- package/dist/components/slider/docs/llms.md +31 -28
- package/dist/components/slider/slider.svelte +126 -61
- package/dist/components/slider/slider.svelte.d.ts +1 -3
- package/dist/components/slider/types.d.ts +21 -14
- package/dist/components/tab-view/docs/llms.md +7 -7
- package/dist/components/tab-view/tab-view-tab.svelte +16 -14
- package/dist/components/tab-view/tab-view.svelte +16 -9
- package/dist/components/tab-view/types.d.ts +6 -6
- package/dist/components/table/docs/llms.md +38 -33
- package/dist/components/table/table-body.svelte +2 -2
- package/dist/components/table/table-cell-actions.svelte +8 -2
- package/dist/components/table/table-cell-layout.svelte +2 -2
- package/dist/components/table/table-cell.svelte +2 -2
- package/dist/components/table/table-header-cell.svelte +2 -2
- package/dist/components/table/table-header.svelte +2 -2
- package/dist/components/table/table-row.svelte +2 -2
- package/dist/components/table/table-selection-cell.svelte +6 -6
- package/dist/components/table/table.svelte +2 -2
- package/dist/components/table/types.d.ts +11 -11
- package/dist/components/tag/docs/llms.md +383 -0
- package/dist/components/tag/tag-group.d.ts +2 -0
- package/dist/components/tag/tag-group.js +2 -0
- package/dist/components/tag/tag-group.svelte +117 -0
- package/dist/components/tag/tag-group.svelte.d.ts +20 -0
- package/dist/components/tag/tag.svelte +459 -0
- package/dist/components/tag/tag.svelte.d.ts +19 -0
- package/dist/components/tag/types.d.ts +137 -0
- package/dist/components/tag/types.js +1 -0
- package/dist/components/tag-picker/docs/llms.md +298 -0
- package/dist/components/tag-picker/option-group.svelte +51 -0
- package/dist/components/tag-picker/option-group.svelte.d.ts +4 -0
- package/dist/components/tag-picker/option.svelte +82 -0
- package/dist/components/tag-picker/option.svelte.d.ts +4 -0
- package/dist/components/tag-picker/tag-picker.d.ts +2 -0
- package/dist/components/tag-picker/tag-picker.js +2 -0
- package/dist/components/tag-picker/tag-picker.svelte +716 -0
- package/dist/components/tag-picker/tag-picker.svelte.d.ts +21 -0
- package/dist/components/tag-picker/types.d.ts +142 -0
- package/dist/components/tag-picker/types.js +1 -0
- package/dist/components/text-box/docs/llms.md +31 -4
- package/dist/components/text-box/text-box-button.svelte +3 -3
- package/dist/components/text-box/text-box-button.svelte.d.ts +1 -1
- package/dist/components/text-box/text-box.svelte +41 -14
- package/dist/components/text-box/types.d.ts +5 -5
- package/dist/components/textarea/docs/llms.md +4 -3
- package/dist/components/textarea/textarea.svelte +14 -6
- package/dist/components/textarea/types.d.ts +2 -4
- package/dist/components/time-picker/docs/llms.md +18 -15
- package/dist/components/time-picker/time-picker.svelte +133 -33
- package/dist/components/time-picker/time-picker.svelte.d.ts +1 -1
- package/dist/components/time-picker/types.d.ts +23 -13
- package/dist/components/title-bar/docs/llms.md +382 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte +215 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte.d.ts +22 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte +190 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte.d.ts +27 -0
- package/dist/components/title-bar/title-bar.d.ts +3 -0
- package/dist/components/title-bar/title-bar.js +4 -0
- package/dist/components/title-bar/title-bar.svelte +224 -0
- package/dist/components/title-bar/title-bar.svelte.d.ts +26 -0
- package/dist/components/title-bar/types.d.ts +165 -0
- package/dist/components/title-bar/types.js +1 -0
- package/dist/components/toggle-switch/docs/llms.md +11 -9
- package/dist/components/toggle-switch/toggle-switch.svelte +23 -14
- package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +1 -1
- package/dist/components/toggle-switch/types.d.ts +12 -10
- package/dist/components/tooltip/docs/llms.md +1 -1
- package/dist/components/tooltip/tooltip.svelte +5 -4
- package/dist/components/tooltip/types.d.ts +1 -1
- package/dist/components/top-nav/docs/llms.md +1 -1
- package/dist/components/top-nav/top-nav-item.svelte +2 -2
- package/dist/components/top-nav/top-nav.svelte +2 -2
- package/dist/components/top-nav/types.d.ts +2 -2
- package/dist/components/tree-view/docs/llms.md +11 -11
- package/dist/components/tree-view/tree-view-item-content.svelte +3 -3
- package/dist/components/tree-view/tree-view-item.svelte +13 -5
- package/dist/components/tree-view/tree-view.svelte +20 -5
- package/dist/components/tree-view/tree-view.svelte.d.ts +1 -1
- package/dist/components/tree-view/tree-view.svelte.js +31 -3
- package/dist/components/tree-view/types.d.ts +7 -3
- package/dist/index.d.ts +25 -0
- package/dist/index.js +32 -0
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +26 -5
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +2 -0
- package/dist/internal/constants.d.ts +0 -4
- package/dist/internal/constants.js +0 -4002
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/native-field.svelte.d.ts +44 -0
- package/dist/internal/native-field.svelte.js +85 -0
- package/dist/internal/utils.d.ts +16 -2
- package/dist/internal/utils.js +25 -3
- package/dist/types/index.d.ts +3 -3
- package/package.json +51 -37
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import { claimLabel } from '../label/label-context.js';
|
|
3
3
|
import { floating } from '../../internal/index.js';
|
|
4
4
|
import { offset, shift } from '@floating-ui/dom';
|
|
5
5
|
import { Flyout, TextBoxButton, TextBox } from '../../index.js';
|
|
6
6
|
import { ChevronUpFilled, ChevronDownFilled, ChevronUpDownFilled } from 'fluentui-icons-svelte';
|
|
7
7
|
import type { NumberBoxProps } from './types.js';
|
|
8
|
+
import { onClickOutside } from 'runed';
|
|
8
9
|
|
|
9
10
|
const ID = $props.id();
|
|
11
|
+
/** Half of the width of the button that opens the flyout of the compact variant. */
|
|
12
|
+
const BUTTON_HALF_WIDTH = 16;
|
|
13
|
+
|
|
14
|
+
const label = claimLabel(() => id);
|
|
10
15
|
|
|
11
16
|
let {
|
|
12
|
-
id = 'input-' + ID,
|
|
17
|
+
id = label?.fieldId ?? 'input-' + ID,
|
|
13
18
|
name = id,
|
|
14
|
-
value = $bindable(),
|
|
19
|
+
value = $bindable(null),
|
|
15
20
|
variant = 'inline',
|
|
16
|
-
ref = $bindable(),
|
|
21
|
+
ref = $bindable(null),
|
|
22
|
+
wrapperRef = $bindable(null),
|
|
23
|
+
wrapperAttributes,
|
|
17
24
|
placeholder = '',
|
|
18
|
-
class: classes,
|
|
19
25
|
...attributes
|
|
20
26
|
}: NumberBoxProps = $props();
|
|
21
27
|
|
|
22
28
|
let openFlyout = $state(false);
|
|
23
|
-
let cleanEvent: () => void;
|
|
24
|
-
|
|
25
|
-
let handler = (e: Event) => {
|
|
26
|
-
if (!(e.target as HTMLElement).closest(`.${id}`)) {
|
|
27
|
-
openFlyout = false;
|
|
28
|
-
cleanEvent();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
onClickOutside(
|
|
31
|
+
() => wrapperRef,
|
|
32
|
+
() => (openFlyout = false)
|
|
33
|
+
);
|
|
36
34
|
</script>
|
|
37
35
|
|
|
38
36
|
<!-- @component
|
|
@@ -46,7 +44,18 @@
|
|
|
46
44
|
<NumberBox />
|
|
47
45
|
```
|
|
48
46
|
-->
|
|
49
|
-
<TextBox
|
|
47
|
+
<TextBox
|
|
48
|
+
{...attributes}
|
|
49
|
+
bind:wrapperRef
|
|
50
|
+
wrapperAttributes={{ ...wrapperAttributes, class: ['fs-number-box', wrapperAttributes?.class] }}
|
|
51
|
+
type="number"
|
|
52
|
+
{id}
|
|
53
|
+
{name}
|
|
54
|
+
{placeholder}
|
|
55
|
+
bind:value
|
|
56
|
+
bind:ref
|
|
57
|
+
inputmode="numeric"
|
|
58
|
+
>
|
|
50
59
|
{#if variant === 'inline'}
|
|
51
60
|
<TextBoxButton aria-label="Increase Number" onclick={() => (value = value ? ++value : 1)}>
|
|
52
61
|
<ChevronUpFilled />
|
|
@@ -55,22 +64,19 @@
|
|
|
55
64
|
<ChevronDownFilled />
|
|
56
65
|
</TextBoxButton>
|
|
57
66
|
{:else}
|
|
58
|
-
<TextBoxButton aria-label="Open" onclick={() =>
|
|
67
|
+
<TextBoxButton aria-label="Open" onclick={() => (openFlyout = !openFlyout)}>
|
|
59
68
|
<ChevronUpDownFilled />
|
|
60
69
|
</TextBoxButton>
|
|
61
70
|
{#if openFlyout}
|
|
62
71
|
<div
|
|
63
72
|
class="flyout-absolute"
|
|
64
|
-
{@attach
|
|
65
|
-
? floating(
|
|
73
|
+
{@attach wrapperRef
|
|
74
|
+
? floating(wrapperRef, {
|
|
66
75
|
placement: 'right',
|
|
67
76
|
middleware: [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
71
|
-
offset(({ rects }) => {
|
|
72
|
-
return -rects.reference.width / 1.4;
|
|
73
|
-
})
|
|
77
|
+
// Centers the flyout on the button that opened it, whatever the width of the box.
|
|
78
|
+
offset(({ rects }) => -(rects.floating.width / 2 + BUTTON_HALF_WIDTH)),
|
|
79
|
+
shift({ crossAxis: true, padding: 8 })
|
|
74
80
|
]
|
|
75
81
|
})
|
|
76
82
|
: undefined}
|
|
@@ -93,9 +99,9 @@
|
|
|
93
99
|
<style>
|
|
94
100
|
.flyout-absolute {
|
|
95
101
|
position: absolute;
|
|
96
|
-
|
|
102
|
+
left: 0;
|
|
97
103
|
top: 0;
|
|
98
|
-
z-index:
|
|
104
|
+
z-index: 3;
|
|
99
105
|
& :global(.fs-flyout) {
|
|
100
106
|
padding: 8px;
|
|
101
107
|
}
|
|
@@ -10,6 +10,6 @@ import type { NumberBoxProps } from './types.ts';
|
|
|
10
10
|
* <NumberBox />
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
|
-
declare const NumberBox: import("svelte").Component<NumberBoxProps, {}, "ref" | "value">;
|
|
13
|
+
declare const NumberBox: import("svelte").Component<NumberBoxProps, {}, "ref" | "value" | "wrapperRef">;
|
|
14
14
|
type NumberBox = ReturnType<typeof NumberBox>;
|
|
15
15
|
export default NumberBox;
|
|
@@ -15,7 +15,7 @@ A Persona is a visual representation of a person that combines an avatar, presen
|
|
|
15
15
|
secondaryText="Intranet"
|
|
16
16
|
tertiaryText="Team A"
|
|
17
17
|
presence={{ status: 'available' }}
|
|
18
|
-
|
|
18
|
+
avatarProps={{ color: 'colorful' }}
|
|
19
19
|
/>
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -26,9 +26,9 @@ A Persona is a visual representation of a person that combines an avatar, presen
|
|
|
26
26
|
A Persona supports three text alignments, with 'left' as the default position.
|
|
27
27
|
|
|
28
28
|
```svelte
|
|
29
|
-
<Persona name="Alex Johnson"
|
|
30
|
-
<Persona name="Alex Johnson"
|
|
31
|
-
<Persona name="Alex Johnson"
|
|
29
|
+
<Persona name="Alex Johnson" avatarProps={{ initials: 'AJ' }} secondaryText="Available" />
|
|
30
|
+
<Persona name="Alex Johnson" avatarProps={{ initials: 'AJ' }} secondaryText="Available" textAlign="center" />
|
|
31
|
+
<Persona name="Alex Johnson" avatarProps={{ initials: 'AJ' }} secondaryText="Available" textAlign="right" />
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
### Text Position
|
|
@@ -36,18 +36,18 @@ A Persona supports three text alignments, with 'left' as the default position.
|
|
|
36
36
|
A Persona supports four text positions: 'top', 'bottom', 'left', and 'right'. The default position is 'right'.
|
|
37
37
|
|
|
38
38
|
```svelte
|
|
39
|
-
<Persona name="Alex Johnson"
|
|
39
|
+
<Persona name="Alex Johnson" avatarProps={{ initials: 'AJ' }} secondaryText="Available" />
|
|
40
40
|
<Persona
|
|
41
41
|
name="Alex Johnson"
|
|
42
|
-
|
|
42
|
+
avatarProps={{ initials: 'AJ' }}
|
|
43
43
|
secondaryText="Available"
|
|
44
44
|
textPosition="bottom"
|
|
45
45
|
textAlign="center"
|
|
46
46
|
/>
|
|
47
|
-
<Persona name="Alex Johnson"
|
|
47
|
+
<Persona name="Alex Johnson" avatarProps={{ initials: 'AJ' }} secondaryText="Available" textPosition="left" />
|
|
48
48
|
<Persona
|
|
49
49
|
name="Alex Johnson"
|
|
50
|
-
|
|
50
|
+
avatarProps={{ initials: 'AJ' }}
|
|
51
51
|
secondaryText="Available"
|
|
52
52
|
textPosition="top"
|
|
53
53
|
textAlign="center"
|
|
@@ -69,9 +69,12 @@ A Persona supports custom sizes, with a default of 42px. You can set the size us
|
|
|
69
69
|
A Persona wraps an avatar inside it, which can be customized with all the props available to the Avatar component.
|
|
70
70
|
|
|
71
71
|
```svelte
|
|
72
|
-
<Persona name="John Doe"
|
|
73
|
-
<Persona name="John Doe"
|
|
74
|
-
<Persona
|
|
72
|
+
<Persona name="John Doe" avatarProps={{ color: 'attention' }} />
|
|
73
|
+
<Persona name="John Doe" avatarProps={{ color: 'colorful', idForColor: '' }} />
|
|
74
|
+
<Persona
|
|
75
|
+
name="John Doe"
|
|
76
|
+
avatarProps={{ image: { src: 'https://placehold.co/96x96/jpeg', alt: 'Placeholder Image' } }}
|
|
77
|
+
/>
|
|
75
78
|
```
|
|
76
79
|
|
|
77
80
|
### Presence
|
|
@@ -94,19 +97,20 @@ A Persona can display presence information, such as online status or availabilit
|
|
|
94
97
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
95
98
|
<!-- props:PersonaProps -->
|
|
96
99
|
|
|
97
|
-
| Name
|
|
98
|
-
|
|
|
99
|
-
| `name`
|
|
100
|
-
| `size`
|
|
101
|
-
| `primaryText`
|
|
102
|
-
| `secondaryText`
|
|
103
|
-
| `tertiaryText`
|
|
104
|
-
| `textAlign`
|
|
105
|
-
| `textPosition`
|
|
106
|
-
| `presenceOnly`
|
|
107
|
-
| `avatarAlign`
|
|
108
|
-
| `element` _bindable_
|
|
109
|
-
| `
|
|
110
|
-
| `presence`
|
|
100
|
+
| Name | Type | Default | Description |
|
|
101
|
+
| -------------------------- | ---------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------- |
|
|
102
|
+
| `name` | `string` | | The name of the person or entity represented by this Persona. It is also used by the avatar for its initials. |
|
|
103
|
+
| `size` | `number` | `42` | The size of the avatar in pixels. The text scales with it. |
|
|
104
|
+
| `primaryText` | `string` | | Text to display below the name. |
|
|
105
|
+
| `secondaryText` | `string` | | Text to display below the primary text. |
|
|
106
|
+
| `tertiaryText` | `string` | | Text to display below the secondary text. |
|
|
107
|
+
| `textAlign` | `'left'` | `'center'` | `'right'` | `'left'` | How the text block is aligned. |
|
|
108
|
+
| `textPosition` | `'top'` | `'bottom'` | `'left'` | `'right'` | `'right'` | Where the text block sits relative to the avatar. |
|
|
109
|
+
| `presenceOnly` | `boolean` | | Renders the presence badge on its own, without the avatar behind it. |
|
|
110
|
+
| `avatarAlign` | `'start'` | `'center'` | `'end'` | `'center'` | How the avatar is aligned against the text block. |
|
|
111
|
+
| `element` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the persona element. |
|
|
112
|
+
| `avatarProps` | `AvatarProps` | | The props to spread on the avatar. |
|
|
113
|
+
| `presence` | `BadgePresence` | | The presence badge to display as a status indicator. |
|
|
114
|
+
| Element Attributes (`div`) | | | |
|
|
111
115
|
|
|
112
116
|
<!-- /props:PersonaProps -->
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
textAlign = 'left',
|
|
12
12
|
textPosition: dir = 'right',
|
|
13
13
|
avatarAlign = 'center',
|
|
14
|
-
element = $bindable(),
|
|
15
|
-
|
|
14
|
+
element = $bindable(null),
|
|
15
|
+
avatarProps,
|
|
16
16
|
presence,
|
|
17
17
|
presenceOnly,
|
|
18
18
|
...attributes
|
|
@@ -27,15 +27,17 @@
|
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<div
|
|
30
|
-
bind:this={element}
|
|
31
|
-
class="persona"
|
|
32
|
-
style="--p-size: {size}px; --avatar-align: {avatarAlign}; flex-direction: {position[dir]}; text-align: {textAlign};"
|
|
33
30
|
{...attributes}
|
|
31
|
+
bind:this={element}
|
|
32
|
+
class={['persona', attributes?.class]}
|
|
33
|
+
style="{attributes?.style ?? ''}; --p-size: {size}px; --avatar-align: {avatarAlign}; flex-direction: {position[
|
|
34
|
+
dir
|
|
35
|
+
]}; text-align: {textAlign};"
|
|
34
36
|
>
|
|
35
37
|
{#if presenceOnly && presence?.status}
|
|
36
38
|
<BadgeIcon {size} icon={presence?.icon || undefined} status={presence.status} outOfOffice={presence?.outOfOffice} />
|
|
37
39
|
{:else}
|
|
38
|
-
<Avatar {
|
|
40
|
+
<Avatar {...avatarProps} {name} {size} badge={presence} />
|
|
39
41
|
{/if}
|
|
40
42
|
<div class="persona-data">
|
|
41
43
|
<p class="persona-name">{name}</p>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
1
2
|
import type { AvatarProps } from '../avatar/type.ts';
|
|
2
3
|
/** @propsmith PersonaProps */
|
|
3
4
|
export type PersonaProps = {
|
|
@@ -30,13 +31,13 @@ export type PersonaProps = {
|
|
|
30
31
|
/** The DOM reference of the persona element.
|
|
31
32
|
* @bindable
|
|
32
33
|
*/
|
|
33
|
-
element?: HTMLDivElement;
|
|
34
|
+
element?: HTMLDivElement | null;
|
|
34
35
|
/** The props to spread on the avatar.
|
|
35
36
|
* @type AvatarProps
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
+
avatarProps?: AvatarProps;
|
|
38
39
|
/** The presence badge to display as a status indicator.
|
|
39
40
|
* @type BadgePresence
|
|
40
41
|
*/
|
|
41
42
|
presence?: AvatarProps['badge'];
|
|
42
|
-
}
|
|
43
|
+
} & HTMLAttributes<HTMLDivElement>;
|
|
@@ -58,18 +58,18 @@ The status prop allows you to set the status of the progress bar to 'paused' or
|
|
|
58
58
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
59
59
|
<!-- props:ProgressBarProps -->
|
|
60
60
|
|
|
61
|
-
| Name | Type
|
|
62
|
-
| ---------------------------------- |
|
|
63
|
-
| `value` _bindable_ | `number` | `null`
|
|
64
|
-
| `class` | `string`
|
|
65
|
-
| `ref` _bindable_ | `SVGElement`
|
|
66
|
-
| `min` | `number`
|
|
67
|
-
| `max` | `number`
|
|
68
|
-
| `hideRail` | `boolean`
|
|
69
|
-
| `railElement` _bindable_ | `SVGRectElement`
|
|
70
|
-
| `secondaryTrackElement` _bindable_ | `SVGRectElement`
|
|
71
|
-
| `trackElement` _bindable_ | `SVGRectElement`
|
|
72
|
-
| `status` | `'paused'` | `'error'`
|
|
73
|
-
| Element Attributes |
|
|
61
|
+
| Name | Type | Default | Description |
|
|
62
|
+
| ---------------------------------- | ------------------------------ | ------- | ------------------------------------------------------------------------------- |
|
|
63
|
+
| `value` _bindable_ | `number` | `null` | | The current value of the progress bar. Leave it unset for an indeterminate bar. |
|
|
64
|
+
| `class` | `string` | | The class to apply to the progress bar. |
|
|
65
|
+
| `ref` _bindable_ | `SVGElement` | `null` | | The DOM reference of the progress bar element. |
|
|
66
|
+
| `min` | `number` | `0` | The minimum value of the progress bar. |
|
|
67
|
+
| `max` | `number` | `100` | The maximum value of the progress bar. |
|
|
68
|
+
| `hideRail` | `boolean` | | Whether to hide the rail element. |
|
|
69
|
+
| `railElement` _bindable_ | `SVGRectElement` | `null` | | The DOM reference of the rail element. |
|
|
70
|
+
| `secondaryTrackElement` _bindable_ | `SVGRectElement` | `null` | | The DOM reference of the secondary track element, used while indeterminate. |
|
|
71
|
+
| `trackElement` _bindable_ | `SVGRectElement` | `null` | | The DOM reference of the track element. |
|
|
72
|
+
| `status` | `'paused'` | `'error'` | | The current status of the progress bar, which recolors the track. |
|
|
73
|
+
| Element Attributes | | | |
|
|
74
74
|
|
|
75
75
|
<!-- /props:ProgressBarProps -->
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
'aria-label': ariaLabel,
|
|
9
9
|
min = 0,
|
|
10
10
|
max = 100,
|
|
11
|
-
value = $bindable(),
|
|
12
|
-
ref = $bindable(),
|
|
13
|
-
railElement = $bindable(),
|
|
14
|
-
trackElement = $bindable(),
|
|
15
|
-
secondaryTrackElement = $bindable(),
|
|
11
|
+
value = $bindable(null),
|
|
12
|
+
ref = $bindable(null),
|
|
13
|
+
railElement = $bindable(null),
|
|
14
|
+
trackElement = $bindable(null),
|
|
15
|
+
secondaryTrackElement = $bindable(null),
|
|
16
16
|
...attributes
|
|
17
17
|
}: ProgressBarProps = $props();
|
|
18
18
|
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
```
|
|
32
32
|
-->
|
|
33
33
|
<svg
|
|
34
|
+
{...attributes}
|
|
34
35
|
class={['fs-progress-bar', status && `status-${status}`, classes, typeof value !== 'number' && 'indeterminate']}
|
|
35
36
|
role="progressbar"
|
|
36
37
|
aria-label={ariaLabel ??
|
|
@@ -41,7 +42,6 @@
|
|
|
41
42
|
aria-valuemax={max}
|
|
42
43
|
aria-valuenow={checkValue}
|
|
43
44
|
bind:this={ref}
|
|
44
|
-
{...attributes}
|
|
45
45
|
>
|
|
46
46
|
{#if !hideRail}
|
|
47
47
|
<rect bind:this={railElement} height="1" rx="0.5" y="1" width="100%" class="progress-bar-rail" />
|
|
@@ -11,7 +11,7 @@ export type ProgressBarProps = {
|
|
|
11
11
|
/** The DOM reference of the progress bar element.
|
|
12
12
|
* @bindable
|
|
13
13
|
*/
|
|
14
|
-
ref?: SVGElement;
|
|
14
|
+
ref?: SVGElement | null;
|
|
15
15
|
/** The minimum value of the progress bar.
|
|
16
16
|
* @default 0
|
|
17
17
|
*/
|
|
@@ -25,15 +25,15 @@ export type ProgressBarProps = {
|
|
|
25
25
|
/** The DOM reference of the rail element.
|
|
26
26
|
* @bindable
|
|
27
27
|
*/
|
|
28
|
-
railElement?: SVGRectElement;
|
|
28
|
+
railElement?: SVGRectElement | null;
|
|
29
29
|
/** The DOM reference of the secondary track element, used while indeterminate.
|
|
30
30
|
* @bindable
|
|
31
31
|
*/
|
|
32
|
-
secondaryTrackElement?: SVGRectElement;
|
|
32
|
+
secondaryTrackElement?: SVGRectElement | null;
|
|
33
33
|
/** The DOM reference of the track element.
|
|
34
34
|
* @bindable
|
|
35
35
|
*/
|
|
36
|
-
trackElement?: SVGRectElement;
|
|
36
|
+
trackElement?: SVGRectElement | null;
|
|
37
37
|
/** The current status of the progress bar, which recolors the track. */
|
|
38
38
|
status?: ProgressStatus;
|
|
39
39
|
} & SVGAttributes<SVGElement>;
|
|
@@ -65,19 +65,19 @@ The status prop allows you to set the status of the progress ring for visual fee
|
|
|
65
65
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
66
66
|
<!-- props:ProgressRingProps -->
|
|
67
67
|
|
|
68
|
-
| Name | Type
|
|
69
|
-
| ------------------------- |
|
|
70
|
-
| `value` _bindable_ | `number`
|
|
71
|
-
| `min` | `number`
|
|
72
|
-
| `max` | `number`
|
|
73
|
-
| `indeterminate` | `boolean`
|
|
74
|
-
| `hideRail` | `boolean`
|
|
75
|
-
| `size` | `number`
|
|
76
|
-
| `ref` _bindable_ | `SVGElement`
|
|
77
|
-
| `railElement` _bindable_ | `SVGCircleElement`
|
|
78
|
-
| `trackElement` _bindable_ | `SVGCircleElement`
|
|
79
|
-
| `status` | `'paused'` | `'error'`
|
|
80
|
-
| `class` | `string`
|
|
81
|
-
| Element Attributes |
|
|
68
|
+
| Name | Type | Default | Description |
|
|
69
|
+
| ------------------------- | -------------------------------- | ------- | ------------------------------------------------------------------ |
|
|
70
|
+
| `value` _bindable_ | `number` | `0` | The current value of the progress ring. |
|
|
71
|
+
| `min` | `number` | `0` | The minimum value of the progress ring. |
|
|
72
|
+
| `max` | `number` | `100` | The maximum value of the progress ring. |
|
|
73
|
+
| `indeterminate` | `boolean` | | Spins the ring continuously instead of reporting a value. |
|
|
74
|
+
| `hideRail` | `boolean` | | Whether to hide the rail element. |
|
|
75
|
+
| `size` | `number` | `32` | The size of the progress ring in pixels. |
|
|
76
|
+
| `ref` _bindable_ | `SVGElement` | `null` | | The DOM reference of the progress ring element. |
|
|
77
|
+
| `railElement` _bindable_ | `SVGCircleElement` | `null` | | The DOM reference of the rail element. |
|
|
78
|
+
| `trackElement` _bindable_ | `SVGCircleElement` | `null` | | The DOM reference of the track element. |
|
|
79
|
+
| `status` | `'paused'` | `'error'` | | The current status of the progress ring, which recolors the track. |
|
|
80
|
+
| `class` | `string` | | The class to apply to the progress ring. |
|
|
81
|
+
| Element Attributes | | | |
|
|
82
82
|
|
|
83
83
|
<!-- /props:ProgressRingProps -->
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
'aria-label': ariaLabel,
|
|
13
13
|
indeterminate,
|
|
14
14
|
value = $bindable(0),
|
|
15
|
-
ref = $bindable(),
|
|
16
|
-
railElement = $bindable(),
|
|
17
|
-
trackElement = $bindable(),
|
|
15
|
+
ref = $bindable(null),
|
|
16
|
+
railElement = $bindable(null),
|
|
17
|
+
trackElement = $bindable(null),
|
|
18
18
|
...attributes
|
|
19
19
|
}: ProgressRingProps = $props();
|
|
20
20
|
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
```
|
|
40
40
|
-->
|
|
41
41
|
<svg
|
|
42
|
+
{...attributes}
|
|
42
43
|
bind:this={ref}
|
|
43
44
|
tabindex="-1"
|
|
44
45
|
class={['progress-ring', status && `status-${status}`, classes, { indeterminate }]}
|
|
@@ -50,8 +51,7 @@
|
|
|
50
51
|
aria-valuemin={!indeterminate ? min : undefined}
|
|
51
52
|
aria-valuemax={!indeterminate ? max : undefined}
|
|
52
53
|
aria-valuenow={!indeterminate ? checkValue : undefined}
|
|
53
|
-
style="--ring-circumference: {circumference}px;"
|
|
54
|
-
{...attributes}
|
|
54
|
+
style="{attributes?.style ?? ''}; --ring-circumference: {circumference}px;"
|
|
55
55
|
>
|
|
56
56
|
{#if !hideRail}
|
|
57
57
|
<circle
|
|
@@ -26,15 +26,15 @@ export type ProgressRingProps = {
|
|
|
26
26
|
/** The DOM reference of the progress ring element.
|
|
27
27
|
* @bindable
|
|
28
28
|
*/
|
|
29
|
-
ref?: SVGElement;
|
|
29
|
+
ref?: SVGElement | null;
|
|
30
30
|
/** The DOM reference of the rail element.
|
|
31
31
|
* @bindable
|
|
32
32
|
*/
|
|
33
|
-
railElement?: SVGCircleElement;
|
|
33
|
+
railElement?: SVGCircleElement | null;
|
|
34
34
|
/** The DOM reference of the track element.
|
|
35
35
|
* @bindable
|
|
36
36
|
*/
|
|
37
|
-
trackElement?: SVGCircleElement;
|
|
37
|
+
trackElement?: SVGCircleElement | null;
|
|
38
38
|
/** The current status of the progress ring, which recolors the track. */
|
|
39
39
|
status?: ProgressStatus;
|
|
40
40
|
/** The class to apply to the progress ring. */
|
|
@@ -52,18 +52,21 @@ The checked prop allows you to control the checked state of the radio button. Th
|
|
|
52
52
|
<RadioButton label="Unchecked Option" value="G" />
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
+
HTML attributes, including class, id and ARIA attributes, apply to the control element. Bind ref to access that control. Use wrapperAttributes and wrapperRef for the outer container.
|
|
56
|
+
|
|
55
57
|
## Component Props
|
|
56
58
|
|
|
57
59
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
58
60
|
<!-- props:RadioButtonProps -->
|
|
59
61
|
|
|
60
|
-
| Name | Type
|
|
61
|
-
| ---------------------------- |
|
|
62
|
-
| `label` | `string`
|
|
63
|
-
| `group` _bindable_ | `unknown`
|
|
64
|
-
| `checked` _bindable_ | `boolean` | `false` | Whether the radio button is selected. |
|
|
65
|
-
| `ref` _bindable_ | `HTMLInputElement` | | The DOM reference of the radio button element. |
|
|
66
|
-
| `
|
|
67
|
-
|
|
|
62
|
+
| Name | Type | Default | Description |
|
|
63
|
+
| ---------------------------- | -------------------------------- | ------- | ------------------------------------------------------------------------------------ |
|
|
64
|
+
| `label` | `string` | | The label displayed next to the radio button. Inside a `Label`, it is not rendered |
|
|
65
|
+
| `group` _bindable_ | `unknown` | | Bindable value representing a group of radio inputs that the input will be bound to. |
|
|
66
|
+
| `checked` _bindable_ | `boolean` | `null` | `false` | Whether the radio button is selected. |
|
|
67
|
+
| `ref` _bindable_ | `HTMLInputElement` | `null` | | The DOM reference of the radio button element. |
|
|
68
|
+
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
69
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the wrapper element. |
|
|
70
|
+
| Element Attributes (`input`) | | | |
|
|
68
71
|
|
|
69
72
|
<!-- /props:RadioButtonProps -->
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { claimLabel } from '../label/label-context.js';
|
|
2
3
|
import { PREFIX } from '../../internal/constants.js';
|
|
3
4
|
import type { RadioButtonProps } from './types.js';
|
|
4
5
|
|
|
@@ -6,17 +7,30 @@
|
|
|
6
7
|
const COMPONENT_NAME = 'radio-button';
|
|
7
8
|
const ID = `${PREFIX}${COMPONENT_NAME}-${FALLBACK_ID}`;
|
|
8
9
|
|
|
10
|
+
const labelContext = claimLabel(() => id);
|
|
11
|
+
|
|
9
12
|
let {
|
|
10
|
-
ref = $bindable(),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
ref = $bindable(null),
|
|
14
|
+
wrapperRef = $bindable(null),
|
|
15
|
+
group = $bindable(null),
|
|
16
|
+
id = labelContext?.fieldId ?? ID,
|
|
13
17
|
label,
|
|
14
18
|
name = id,
|
|
15
19
|
value,
|
|
16
|
-
checked = $bindable(
|
|
17
|
-
|
|
20
|
+
checked = $bindable(null),
|
|
21
|
+
wrapperAttributes,
|
|
18
22
|
...attributes
|
|
19
23
|
}: RadioButtonProps = $props();
|
|
24
|
+
|
|
25
|
+
/** What `bind:group` reads and writes. Without a group, `checked` decides: an empty group (`null`) matches no value. */
|
|
26
|
+
const binding = {
|
|
27
|
+
get group() {
|
|
28
|
+
return group ?? (checked ? value : null);
|
|
29
|
+
},
|
|
30
|
+
set group(selected) {
|
|
31
|
+
group = selected;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
20
34
|
</script>
|
|
21
35
|
|
|
22
36
|
<!--
|
|
@@ -37,12 +51,13 @@
|
|
|
37
51
|
```
|
|
38
52
|
-->
|
|
39
53
|
|
|
40
|
-
<
|
|
41
|
-
<input type="radio" {id} {name} {value} {checked} bind:this={ref} bind:group
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
<div {...wrapperAttributes} class={['fs-radio-button', wrapperAttributes?.class]} bind:this={wrapperRef}>
|
|
55
|
+
<input {...attributes} type="radio" {id} {name} {value} {checked} bind:this={ref} bind:group={binding.group} />
|
|
56
|
+
<!-- Inside a Label, the Label names the field instead. -->
|
|
57
|
+
{#if label && !labelContext}
|
|
58
|
+
<label for={id}>{label}</label>
|
|
44
59
|
{/if}
|
|
45
|
-
</
|
|
60
|
+
</div>
|
|
46
61
|
|
|
47
62
|
<style>
|
|
48
63
|
.fs-radio-button {
|
|
@@ -100,6 +115,15 @@
|
|
|
100
115
|
}
|
|
101
116
|
}
|
|
102
117
|
}
|
|
118
|
+
&:is(:user-invalid, [aria-invalid='true']) {
|
|
119
|
+
border-color: var(--fs-system-critical);
|
|
120
|
+
&:hover {
|
|
121
|
+
border-color: var(--fs-system-critical);
|
|
122
|
+
}
|
|
123
|
+
& + label {
|
|
124
|
+
color: var(--fs-system-critical);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
103
127
|
}
|
|
104
128
|
&:has(input:disabled) {
|
|
105
129
|
pointer-events: none;
|
|
@@ -115,12 +139,14 @@
|
|
|
115
139
|
&:has(input:focus-visible) {
|
|
116
140
|
outline: 0.125rem var(--fs-focus-stroke-outer) solid;
|
|
117
141
|
outline-offset: 0.125rem;
|
|
118
|
-
&:has(
|
|
142
|
+
&:has(> label) {
|
|
119
143
|
border-radius: 0.063rem;
|
|
120
144
|
outline-offset: 0.313rem;
|
|
121
145
|
}
|
|
122
146
|
}
|
|
123
|
-
&
|
|
147
|
+
& > label {
|
|
148
|
+
flex-grow: 1;
|
|
149
|
+
cursor: pointer;
|
|
124
150
|
font-size: inherit;
|
|
125
151
|
color: inherit;
|
|
126
152
|
padding: 0px 0.75rem;
|
|
@@ -14,6 +14,6 @@ import type { RadioButtonProps } from './types.ts';
|
|
|
14
14
|
* <RadioButton label="Radio Button label" />
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
|
-
declare const RadioButton: import("svelte").Component<RadioButtonProps, {}, "ref" | "group" | "
|
|
17
|
+
declare const RadioButton: import("svelte").Component<RadioButtonProps, {}, "ref" | "checked" | "group" | "wrapperRef">;
|
|
18
18
|
type RadioButton = ReturnType<typeof RadioButton>;
|
|
19
19
|
export default RadioButton;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
-
import type { PolymorphicProps } from '../../types/index.js';
|
|
1
|
+
import type { HTMLAttributes, HTMLInputAttributes } from 'svelte/elements';
|
|
3
2
|
/** @propsmith RadioButtonProps */
|
|
4
3
|
export type RadioButtonProps = {
|
|
5
|
-
/** The label displayed next to the radio button. */
|
|
4
|
+
/** The label displayed next to the radio button. Inside a `Label`, it is not rendered */
|
|
6
5
|
label?: string;
|
|
7
6
|
/** Bindable value representing a group of radio inputs that the input will be bound to.
|
|
8
7
|
* @bindable
|
|
@@ -12,13 +11,17 @@ export type RadioButtonProps = {
|
|
|
12
11
|
* @default false
|
|
13
12
|
* @bindable
|
|
14
13
|
*/
|
|
15
|
-
checked?: boolean;
|
|
14
|
+
checked?: boolean | null;
|
|
16
15
|
/** The DOM reference of the radio button element.
|
|
17
16
|
* @bindable
|
|
18
17
|
*/
|
|
19
|
-
ref?: HTMLInputElement;
|
|
20
|
-
/** The attributes to spread on the
|
|
21
|
-
* @type
|
|
18
|
+
ref?: HTMLInputElement | null;
|
|
19
|
+
/** The attributes to spread on the wrapper element.
|
|
20
|
+
* @type HTMLAttributes
|
|
22
21
|
*/
|
|
23
|
-
|
|
22
|
+
wrapperAttributes?: HTMLAttributes<HTMLDivElement>;
|
|
23
|
+
/** The DOM reference of the wrapper element.
|
|
24
|
+
* @bindable
|
|
25
|
+
*/
|
|
26
|
+
wrapperRef?: HTMLDivElement | null;
|
|
24
27
|
} & HTMLInputAttributes;
|