fluentui-svelte 0.2.0 → 0.2.1
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/auto-suggest-box/auto-suggest-box.svelte +68 -56
- package/dist/components/auto-suggest-box/docs/llms.md +46 -14
- package/dist/components/auto-suggest-box/option.svelte +2 -1
- package/dist/components/avatar/docs/llms.md +20 -14
- package/dist/components/badge/docs/llms.md +29 -16
- package/dist/components/button/button.svelte +11 -5
- package/dist/components/button/docs/llms.md +33 -24
- package/dist/components/calendar-date-picker/docs/llms.md +17 -7
- package/dist/components/calendar-view/calendar-view-header.svelte +2 -2
- package/dist/components/calendar-view/calendar-view-header.svelte.d.ts +2 -17
- package/dist/components/calendar-view/calendar-view-months.svelte +1 -1
- package/dist/components/calendar-view/calendar-view-years.svelte +1 -1
- package/dist/components/calendar-view/calendar-view.svelte +66 -52
- package/dist/components/calendar-view/docs/llms.md +42 -30
- package/dist/components/card/docs/llms.md +54 -34
- package/dist/components/checkbox/docs/llms.md +18 -12
- package/dist/components/date-picker/docs/llms.md +25 -15
- package/dist/components/dialog/dialog-surface.svelte +8 -8
- package/dist/components/dialog/dialog.svelte +41 -39
- package/dist/components/dialog/docs/llms.md +59 -34
- package/dist/components/divider/docs/llms.md +14 -9
- package/dist/components/dropdown/docs/llms.md +34 -15
- package/dist/components/dropdown/dropdown.svelte +4 -2
- package/dist/components/dropdown-select/docs/llms.md +28 -14
- package/dist/components/expander/docs/llms.md +19 -12
- package/dist/components/flyout/docs/llms.md +17 -11
- package/dist/components/hyperlink/docs/llms.md +11 -7
- package/dist/components/info-bar/docs/llms.md +15 -9
- package/dist/components/label/docs/llms.md +15 -11
- package/dist/components/list-view/docs/llms.md +34 -24
- package/dist/components/list-view/list-view-item.svelte +10 -4
- package/dist/components/list-view/list-view.svelte +68 -63
- package/dist/components/menu/context-menu-trigger.svelte +45 -40
- package/dist/components/menu/docs/llms.md +63 -34
- package/dist/components/menu/menu-item-checkbox.svelte +3 -1
- package/dist/components/menu/menu-item-radio.svelte +3 -1
- package/dist/components/menu/menu-item-switch.svelte +3 -1
- package/dist/components/menu/menu-item.svelte +5 -1
- package/dist/components/menu/menu-popover.svelte +21 -10
- package/dist/components/menu/menu-trigger.svelte +22 -9
- package/dist/components/menu/menu.svelte +98 -87
- package/dist/components/number-box/docs/llms.md +10 -6
- package/dist/components/persona/docs/llms.md +19 -14
- package/dist/components/progress-bar/docs/llms.md +18 -10
- package/dist/components/progress-ring/docs/llms.md +19 -12
- package/dist/components/radio-button/docs/llms.md +13 -8
- package/dist/components/skeleton/docs/llms.md +13 -8
- package/dist/components/slider/docs/llms.md +33 -21
- package/dist/components/slider/slider.svelte +13 -11
- package/dist/components/text-box/docs/llms.md +23 -17
- package/dist/components/textarea/docs/llms.md +16 -7
- package/dist/components/time-picker/docs/llms.md +20 -10
- package/dist/components/toggle-switch/docs/llms.md +13 -9
- package/dist/components/tooltip/docs/llms.md +24 -10
- package/dist/components/tree-view/docs/llms.md +53 -35
- package/dist/components/tree-view/tree-view-item-content.svelte +1 -1
- package/dist/components/tree-view/tree-view-item.svelte +3 -3
- package/dist/components/tree-view/tree-view.svelte +89 -93
- package/dist/providers/fluentui-svelte/fluentui-svelte.svelte +15 -15
- package/package.json +1 -1
|
@@ -80,52 +80,77 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
|
|
|
80
80
|
|
|
81
81
|
## Dialog Props
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
| `
|
|
83
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
84
|
+
<!-- props:DialogProps -->
|
|
85
|
+
|
|
86
|
+
| Name | Type | Default | Description |
|
|
87
|
+
| ----------------- | ----------------------------------------------- | --------- | ------------------------------------------------- |
|
|
88
|
+
| `type` | `'modal'` | `'non-modal'` | `'alert'` | `'modal'` | How the dialog behaves once open. |
|
|
89
|
+
| `open` _bindable_ | `boolean` | | Controls the open state of the dialog. |
|
|
90
|
+
| `onOpenChange` | `(open: boolean) => void` | | Called whenever the dialog opens or closes. |
|
|
91
|
+
| `children` | `Snippet` | | The parts of the dialog: a trigger and a surface. |
|
|
92
|
+
|
|
93
|
+
<!-- /props:DialogProps -->
|
|
89
94
|
|
|
90
95
|
## DialogTrigger Props
|
|
91
96
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
98
|
+
<!-- props:DialogTriggerProps -->
|
|
99
|
+
|
|
100
|
+
| Name | Type | Default | Description |
|
|
101
|
+
| ----------------------- | ------------------- | ------- | ----------------------------------------- |
|
|
102
|
+
| `ref` | `HTMLButtonElement` | | The DOM reference of the trigger element. |
|
|
103
|
+
| `ButtonProps<'button'>` | | | |
|
|
104
|
+
|
|
105
|
+
<!-- /props:DialogTriggerProps -->
|
|
97
106
|
|
|
98
107
|
## DialogSurface Props
|
|
99
108
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
|
104
|
-
|
|
|
109
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
110
|
+
<!-- props:DialogSurfaceProps -->
|
|
111
|
+
|
|
112
|
+
| Name | Type | Default | Description |
|
|
113
|
+
| ----------------------------- | ------------------- | ------- | ---------------------------------------- |
|
|
114
|
+
| `ref` _bindable_ | `HTMLDialogElement` | | The DOM reference of the dialog element. |
|
|
115
|
+
| Element Attributes (`dialog`) | | | |
|
|
116
|
+
|
|
117
|
+
<!-- /props:DialogSurfaceProps -->
|
|
105
118
|
|
|
106
119
|
## DialogTitle Props
|
|
107
120
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
121
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
122
|
+
<!-- props:DialogTitleProps -->
|
|
123
|
+
|
|
124
|
+
| Name | Type | Default | Description |
|
|
125
|
+
| ---------------- | -------------------------------------------- | ------- | ---------------------------------------- |
|
|
126
|
+
| `ref` _bindable_ | `HTMLDivElement` | `HTMLHeadingElement` | | The DOM reference of the title element. |
|
|
127
|
+
| `as` | `DialogTitleTag` | `'h3'` | The HTML element to render the title as. |
|
|
128
|
+
| HTML Attributes | | | |
|
|
129
|
+
|
|
130
|
+
<!-- /props:DialogTitleProps -->
|
|
114
131
|
|
|
115
132
|
## DialogContent Props
|
|
116
133
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
|
121
|
-
|
|
|
134
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
135
|
+
<!-- props:DialogContentProps -->
|
|
136
|
+
|
|
137
|
+
| Name | Type | Default | Description |
|
|
138
|
+
| -------------------------- | ---------------- | ------- | ----------------------------------------- |
|
|
139
|
+
| `ref` | `HTMLDivElement` | | The DOM reference of the content element. |
|
|
140
|
+
| Element Attributes (`div`) | | | |
|
|
141
|
+
|
|
142
|
+
<!-- /props:DialogContentProps -->
|
|
122
143
|
|
|
123
144
|
## DialogActions Props
|
|
124
145
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
|
129
|
-
|
|
|
130
|
-
| `
|
|
131
|
-
|
|
|
146
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
147
|
+
<!-- props:DialogActionsProps -->
|
|
148
|
+
|
|
149
|
+
| Name | Type | Default | Description |
|
|
150
|
+
| -------------------------- | ------------------------------------------ | ------- | ----------------------------------------------------------- |
|
|
151
|
+
| `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the actions element. |
|
|
152
|
+
| `fluid` | `boolean` | | Stretches every action to share the available width evenly. |
|
|
153
|
+
| `position` | `'start'` | `'center'` | `'end'` | `'end'` | Where the actions sit along the main axis. |
|
|
154
|
+
| Element Attributes (`div`) | | | |
|
|
155
|
+
|
|
156
|
+
<!-- /props:DialogActionsProps -->
|
|
@@ -72,12 +72,17 @@ The `as` prop lets you change the underlying HTML element rendered by the divide
|
|
|
72
72
|
|
|
73
73
|
## Divider Props
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
75
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
76
|
+
<!-- props:DividerProps -->
|
|
77
|
+
|
|
78
|
+
| Name | Type | Default | Description |
|
|
79
|
+
| ---------------- | ------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------- |
|
|
80
|
+
| `as` | `'div'` | `'hr'` | `'span'` | `'div'` | The HTML element to render the divider as. |
|
|
81
|
+
| `ref` _bindable_ | `HTMLDivElement` | `HTMLHRElement` | `HTMLSpanElement` | | The DOM reference of the divider element. |
|
|
82
|
+
| `vertical` | `boolean` | | Renders the divider vertically instead of horizontally. |
|
|
83
|
+
| `alignContent` | `'start'` | `'center'` | `'end'` | `'center'` | Where the content of the divider sits along the line. |
|
|
84
|
+
| `inset` | `boolean` | | Removes the padding around the divider line. |
|
|
85
|
+
| `appearance` | `'accent'` | `'standard'` | `'subtle'` | `'default'` | `'default'` | The divider line can be styled for greater emphasis or to be subtle. |
|
|
86
|
+
| HTML Attributes | | | |
|
|
87
|
+
|
|
88
|
+
<!-- /props:DividerProps -->
|
|
@@ -50,21 +50,40 @@ Set the `multiple` prop to allow selecting more than one option.
|
|
|
50
50
|
|
|
51
51
|
## Component Props
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
| `
|
|
59
|
-
| `
|
|
60
|
-
| `
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
53
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
54
|
+
<!-- props:DropdownProps -->
|
|
55
|
+
|
|
56
|
+
| Name | Type | Default | Description |
|
|
57
|
+
| ---------------------------------------------------- | -------------------------- | -------------------- | ----------------------------------------------------------------------- |
|
|
58
|
+
| `value` _bindable_ | `string` | `string[]` | `multiple ? [] : ''` | The selected value. An array of values when `multiple` is set. |
|
|
59
|
+
| `multiple` | `boolean` | | Allows more than one option to be selected at a time. |
|
|
60
|
+
| `placeholder` | `string` | `'Select an option'` | The text shown by the trigger while no option is selected. |
|
|
61
|
+
| `disabled` | `boolean` | | Disables the user interaction. |
|
|
62
|
+
| `name` | `string` | `null` | `id` | The name submitted with the form. Falls back to the id of the dropdown. |
|
|
63
|
+
| `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the dropdown element. |
|
|
64
|
+
| `onclick` | `(e: MouseEvent) => void` | | Called when the dropdown is clicked. |
|
|
65
|
+
| `wrapperProps` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
66
|
+
| `buttonRef` _bindable_ | `HTMLButtonElement` | | The DOM reference of the button that opens the dropdown. |
|
|
67
|
+
| `buttonProps` | `HTMLButtonAttributes` | | The attributes to spread on the button that opens the dropdown. |
|
|
68
|
+
| `inputRef` | `HTMLInputElement` | | The DOM reference of the hidden input holding the value. |
|
|
69
|
+
| `flyoutRef` _bindable_ | `HTMLDivElement` | | The DOM reference of the flyout element. |
|
|
70
|
+
| `flyoutProps` | `FlyoutProps` | | The props to spread on the flyout. |
|
|
71
|
+
| `flyoutMaxHeight` | `string` | | The maximum height of the flyout, as a CSS length. |
|
|
72
|
+
| `listboxRef` _bindable_ | `HTMLUListElement` | | The DOM reference of the listbox element. |
|
|
73
|
+
| `listboxProps` | `ListViewProps` | | The props to spread on the listbox rendered inside the flyout. |
|
|
74
|
+
| `DropdownMultipleValue` | `DropdownSingleValue` | | | |
|
|
75
|
+
| `HTMLInputAttributes` without `value`, `onclick` | | | |
|
|
76
|
+
|
|
77
|
+
<!-- /props:DropdownProps -->
|
|
63
78
|
|
|
64
79
|
## DropdownOption Props
|
|
65
80
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
|
70
|
-
|
|
|
81
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
82
|
+
<!-- props:DropdownOptionProps -->
|
|
83
|
+
|
|
84
|
+
| Name | Type | Default | Description |
|
|
85
|
+
| ------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------ |
|
|
86
|
+
| `text` | `string` | | The text shown by the dropdown once the option is selected. Falls back to the rendered children. |
|
|
87
|
+
| `ListViewItemProps<'li'>` | | | |
|
|
88
|
+
|
|
89
|
+
<!-- /props:DropdownOptionProps -->
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { onClickOutside } from 'runed';
|
|
3
3
|
import ChevronDownFilled from 'fluentui-icons-svelte/ChevronDownFilled.svelte';
|
|
4
4
|
import { Flyout, ListView, ListViewItem } from '../../index.js';
|
|
5
|
-
import type { DropdownProps } from './types.js';
|
|
5
|
+
import type { DropdownContext, DropdownProps } from './types.js';
|
|
6
6
|
import { tick } from 'svelte';
|
|
7
7
|
import { SvelteMap } from 'svelte/reactivity';
|
|
8
8
|
import { setTabspotAttributes, unsetTabspotSection } from 'tabspot';
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
// for every value here to keep rendering the selection once the list is closed.
|
|
46
46
|
const optionLabels = new SvelteMap<string, string>();
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
const context: DropdownContext = $state({
|
|
49
49
|
config: null,
|
|
50
50
|
state: null,
|
|
51
51
|
events: null,
|
|
@@ -54,6 +54,8 @@
|
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
+
setDropdownContext(context);
|
|
58
|
+
|
|
57
59
|
const selectedValues = $derived(multiple ? (Array.isArray(value) ? value : []) : value ? [value as string] : []);
|
|
58
60
|
|
|
59
61
|
const hasValue = $derived(selectedValues.length > 0);
|
|
@@ -53,20 +53,34 @@ Set the `multiple` prop to allow selecting more than one option.
|
|
|
53
53
|
|
|
54
54
|
## Component Props
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
|
60
|
-
|
|
|
61
|
-
| `
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
56
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
57
|
+
<!-- props:DropdownSelectProps -->
|
|
58
|
+
|
|
59
|
+
| Name | Type | Default | Description |
|
|
60
|
+
| ----------------------------- | -------------------------- | -------------------------- | ---------------------------------------------------------------------- |
|
|
61
|
+
| `value` _bindable_ | `string` | `string[]` | `multiple ? [] : ''` | The selected value. An array of values when `multiple` is set. |
|
|
62
|
+
| `multiple` | `boolean` | | Allows more than one option to be selected at a time. |
|
|
63
|
+
| `placeholder` | `string` | `'Native Select Dropdown'` | The text shown while no option is selected. |
|
|
64
|
+
| `hidePlaceholder` | `boolean` | | Keeps the placeholder out of the option list once a value is selected. |
|
|
65
|
+
| `ref` _bindable_ | `HTMLSelectElement` | | The DOM reference of the select element. |
|
|
66
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | | The DOM reference of the wrapper element. |
|
|
67
|
+
| `wrapperProps` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
68
|
+
| Element Attributes (`select`) | | | |
|
|
69
|
+
|
|
70
|
+
<!-- /props:DropdownSelectProps -->
|
|
65
71
|
|
|
66
72
|
## DropdownSelectOption Props
|
|
67
73
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
|
74
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
75
|
+
<!-- props:DropdownSelectOptionProps -->
|
|
76
|
+
|
|
77
|
+
| Name | Type | Default | Description |
|
|
78
|
+
| ----------------------------- | ------------- | ------- | ------------------------------------------------------------- |
|
|
79
|
+
| `value` | `string` | | The value reported to the select when the option is picked. |
|
|
80
|
+
| `text` | `string` | | The label of the option. Falls back to the rendered children. |
|
|
81
|
+
| `disabled` | `boolean` | | Disables the user interaction. |
|
|
82
|
+
| `ref` _bindable_ | `HTMLElement` | | The DOM reference of the option element. |
|
|
83
|
+
| `children` | `Snippet` | | The content of the option, used when no `text` is given. |
|
|
84
|
+
| Element Attributes (`option`) | | | |
|
|
85
|
+
|
|
86
|
+
<!-- /props:DropdownSelectOptionProps -->
|
|
@@ -74,15 +74,22 @@ You can easily add an icon to an expander's header using the `Icon` prop. You ca
|
|
|
74
74
|
|
|
75
75
|
## Component Props
|
|
76
76
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
77
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
78
|
+
<!-- props:ExpanderProps -->
|
|
79
|
+
|
|
80
|
+
| Name | Type | Default | Description |
|
|
81
|
+
| ------------------------------ | --------------------------------------- | -------- | ------------------------------------------------------------------------- |
|
|
82
|
+
| `header` | `string` | | Label of the expander. |
|
|
83
|
+
| `description` | `string` | | Description to render below the header. |
|
|
84
|
+
| `direction` | `'down'` | `'up'` | `'down'` | Set the opening direction of the expander. |
|
|
85
|
+
| `justify` | `boolean` | `false` | The expander is justified to the full width of the container. |
|
|
86
|
+
| `disabled` | `boolean` | `false` | Disables the user interaction. |
|
|
87
|
+
| `animation` | `{ duration: number; easing: string; }` | | The animation configuration. Reduced motion is always honoured over this. |
|
|
88
|
+
| `expanded` _bindable_ | `boolean` | `false` | Control the opening state of the expander. |
|
|
89
|
+
| `ref` _bindable_ | `HTMLDetailsElement` | | The DOM reference of the expander element. |
|
|
90
|
+
| `Icon` | `Snippet` | `Component` | | The icon to display before the label. |
|
|
91
|
+
| `summaryRef` _bindable_ | `HTMLElement` | | The DOM reference of the summary element. |
|
|
92
|
+
| `summaryProps` | `HTMLAttributes` | | The props to spread on the summary element. |
|
|
93
|
+
| Element Attributes (`details`) | | | |
|
|
94
|
+
|
|
95
|
+
<!-- /props:ExpanderProps -->
|
|
@@ -18,14 +18,20 @@ The Flyout.
|
|
|
18
18
|
|
|
19
19
|
## Component Props
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
|
25
|
-
|
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
|
|
|
21
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
22
|
+
<!-- props:FlyoutProps -->
|
|
23
|
+
|
|
24
|
+
| Name | Type | Default | Description |
|
|
25
|
+
| -------------------------- | ------------------------------------------------------------------------- | ---------- | ------------------------------------------------------------------------------- |
|
|
26
|
+
| `ref` _bindable_ | `HTMLElement` | | The DOM reference of the flyout element. |
|
|
27
|
+
| `children` | `Snippet` | | The content of the flyout. |
|
|
28
|
+
| `floating` | `boolean` | `false` | Positions the flyout with floating-ui instead of leaving it in the normal flow. |
|
|
29
|
+
| `reference` | `HTMLElement` | | The element the flyout is positioned against when `floating` is set. |
|
|
30
|
+
| `placement` | `Placement` | `'bottom'` | Where the flyout is placed relative to its reference. |
|
|
31
|
+
| `onPlacementChange` | `(placement: Placement) => void` | | Called whenever floating-ui settles on a different placement. |
|
|
32
|
+
| `roundCorners` | `'all'` | `'top'` | `'bottom'` | `'left'` | `'right'` | `'all'` | Which corners of the flyout are rounded. |
|
|
33
|
+
| `offset` | `number` | `8` | The distance in pixels between the flyout and its reference. |
|
|
34
|
+
| `placementConfig` | `AutoPlacementOptions` | | The auto placement configuration handed over to floating-ui. |
|
|
35
|
+
| Element Attributes (`div`) | | | |
|
|
36
|
+
|
|
37
|
+
<!-- /props:FlyoutProps -->
|
|
@@ -24,10 +24,14 @@ Disables the hyperlink and prevents navigation.
|
|
|
24
24
|
|
|
25
25
|
## Component Props
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
| `
|
|
33
|
-
|
|
|
27
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
28
|
+
<!-- props:HyperlinkProps -->
|
|
29
|
+
|
|
30
|
+
| Name | Type | Default | Description |
|
|
31
|
+
| ------------------------ | ------------------- | ------- | ---------------------------------------- |
|
|
32
|
+
| `href` | `string` | `'#'` | The URL the hyperlink points to. |
|
|
33
|
+
| `disabled` | `boolean` | | Disables the user interaction. |
|
|
34
|
+
| `ref` _bindable_ | `HTMLAnchorElement` | | The DOM reference of the anchor element. |
|
|
35
|
+
| Element Attributes (`a`) | | | |
|
|
36
|
+
|
|
37
|
+
<!-- /props:HyperlinkProps -->
|
|
@@ -70,12 +70,18 @@ The hideCloseButton prop allows you to hide the close button in the InfoBar.
|
|
|
70
70
|
|
|
71
71
|
## Component Props
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
73
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
74
|
+
<!-- props:InfoBarProps -->
|
|
75
|
+
|
|
76
|
+
| Name | Type | Default | Description |
|
|
77
|
+
| -------------------------- | ---------------------------------------------------------------------------------------------- | --------------- | ---------------------------------------------------------------------------- |
|
|
78
|
+
| `status` | `'information'` | `'attention'` | `'warning'` | `'critical'` | `'success'` | `'information'` | The severity of the message, which picks the icon and the colors. |
|
|
79
|
+
| `style` | `'inline'` | `'multiline'` | `'inline'` | Lays the message out on a single line, or stacked below the title. |
|
|
80
|
+
| `title` | `string` | | The title of the InfoBar. |
|
|
81
|
+
| `icon` | `Snippet` | `Component` | | Custom icon, rendered instead of the one the `status` would pick on its own. |
|
|
82
|
+
| `iconSize` | `number` | `20` | The size of the icon in pixels. |
|
|
83
|
+
| `hideCloseButton` | `boolean` | | Removes the button that dismisses the InfoBar. |
|
|
84
|
+
| `children` | `Snippet` | | The message of the InfoBar. |
|
|
85
|
+
| Element Attributes (`div`) | | | |
|
|
86
|
+
|
|
87
|
+
<!-- /props:InfoBarProps -->
|
|
@@ -54,14 +54,18 @@ Pass a `required` object to mark the label as required and render a required ind
|
|
|
54
54
|
|
|
55
55
|
## Component Props
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
| `
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
57
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
58
|
+
<!-- props:LabelProps -->
|
|
59
|
+
|
|
60
|
+
| Name | Type | Default | Description |
|
|
61
|
+
| ---------------------------- | ------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------- |
|
|
62
|
+
| `label` | `string` | `'Label Element'` | The text of the label. Falls back to the rendered children. |
|
|
63
|
+
| `size` | `'small'` | `'medium'` | `'large'` | `'medium'` | The size of the label text. |
|
|
64
|
+
| `weight` | `'regular'` | `'semibold'` | `'regular'` | The weight of the label text. |
|
|
65
|
+
| `labelPosition` | `'before'` | `'after'` | `'above'` | `'below'` | `'after'` | Where the label sits relative to the field it describes. |
|
|
66
|
+
| `required` | `{ abbr?: string; message: string; }` | | Marks the field as required, and describes why through the given message. |
|
|
67
|
+
| `disabled` | `boolean` | | Renders the label as disabled, to match the field it describes. |
|
|
68
|
+
| `ref` _bindable_ | `HTMLLabelElement` | | The DOM reference of the label element. |
|
|
69
|
+
| Element Attributes (`label`) | | | |
|
|
70
|
+
|
|
71
|
+
<!-- /props:LabelProps -->
|
|
@@ -81,30 +81,40 @@ Add and configure a checkbox for the element. You can use the same props for the
|
|
|
81
81
|
|
|
82
82
|
## ListView Props
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
|
|
|
84
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
85
|
+
<!-- props:ListViewProps -->
|
|
86
|
+
|
|
87
|
+
| Name | Type | Default | Description |
|
|
88
|
+
| -------------------------- | --------------------------------------------------------------------- | ----------- | ----------------------------------------------------------------------------- |
|
|
89
|
+
| `selectionMode` | `'none'` | `'single'` | `'multiselect'` | `'extended'` | `'none'` | How many items can be selected, and how the selection is made. |
|
|
90
|
+
| `navigationMode` | `'items'` | `'composite'` | `'items'` | Whether the list itself takes a single tab stop, or every item takes its own. |
|
|
91
|
+
| `selectedItems` _bindable_ | `string[]` | | The values of the selected items. |
|
|
92
|
+
| `shape` | `'circular'` | `'rounded'` | `'square'` | `'rounded'` | The items can have a circular, rounded or square shape. |
|
|
93
|
+
| `onSelectionChange` | `(e: Event, selectedItems: string[]` | `[]) => void` | | Called whenever the selection changes. |
|
|
94
|
+
| `as` | `'ul'` | `'ol'` | `'div'` | `'ul'` | The HTML element to render the list as. |
|
|
95
|
+
| `ref` _bindable_ | `HTMLUListElement` | `HTMLOListElement` | `HTMLDivElement` | | The DOM reference of the list element. |
|
|
96
|
+
| `disableTabspot` | `boolean` | `false` | Opts the list out of the tabspot focus management, to wire your own. |
|
|
97
|
+
| HTML Attributes | | | |
|
|
98
|
+
|
|
99
|
+
<!-- /props:ListViewProps -->
|
|
95
100
|
|
|
96
101
|
## ListViewItem Props
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
|
102
|
-
|
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
| `
|
|
110
|
-
|
|
|
103
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
104
|
+
<!-- props:ListViewItemProps -->
|
|
105
|
+
|
|
106
|
+
| Name | Type | Default | Description |
|
|
107
|
+
| ---------------- | ------------------------------------------------------------------ | ------- | ------------------------------------------------------------------------------------------ |
|
|
108
|
+
| `as` | `'li'` | `'a'` | `'div'` | `'li'` | The HTML element to render the item as. |
|
|
109
|
+
| `shape` | `'circular'` | `'rounded'` | `'square'` | | The item can have a circular, rounded or square shape. Inherited from the list by default. |
|
|
110
|
+
| `value` | `string` | | The value reported to the list when the item is selected. Falls back to a generated id. |
|
|
111
|
+
| `active` | `boolean` | | Renders the item in its pressed state. |
|
|
112
|
+
| `role` | `'treeitem'` | `'menuitem'` | `'option'` | `'row'` | | The ARIA role of the item. Derived from the list by default. |
|
|
113
|
+
| `disabled` | `boolean` | | Disables the user interaction. |
|
|
114
|
+
| `checkmark` | `CheckboxProps` | | The props to spread on the checkbox rendered when the list is multiselect. |
|
|
115
|
+
| `onAction` | `(e: MouseEvent, value: string) => void` | | Called when the item is clicked or activated with the keyboard. |
|
|
116
|
+
| `onfocus` | `(e: Event, value: string) => void` | | Called when the item receives the focus. |
|
|
117
|
+
| `ref` _bindable_ | `HTMLLIElement` | `HTMLAnchorElement` | `HTMLDivElement` | | The DOM reference of the item element. |
|
|
118
|
+
| HTML Attributes | | | |
|
|
119
|
+
|
|
120
|
+
<!-- /props:ListViewItemProps -->
|
|
@@ -24,14 +24,20 @@
|
|
|
24
24
|
...attributes
|
|
25
25
|
}: ListViewItemProps<T> = $props();
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* The tag the invariant rules over. The markup renders it through here, so it is checked
|
|
29
|
+
* during SSR and on every prop update rather than only once on mount.
|
|
30
|
+
*/
|
|
31
|
+
const _as = $derived.by(() => {
|
|
32
|
+
if (!ITEM_TAG.includes(as)) throw new Error(`Invalid tag: ${as}. Must be one of ${ITEM_TAG.join(', ')}`);
|
|
33
|
+
return as;
|
|
34
|
+
});
|
|
29
35
|
|
|
30
36
|
const CONTEXT = getListViewContext();
|
|
31
37
|
|
|
32
38
|
if (!CONTEXT) throw new Error('ListViewItem must be used within a ListView');
|
|
33
39
|
|
|
34
|
-
const
|
|
40
|
+
const _shape = $derived(CONTEXT.config.shape);
|
|
35
41
|
const { state: _state } = CONTEXT;
|
|
36
42
|
const { handleSelection, registerItem, unregisterItem, getChildrenRole } = CONTEXT.methods;
|
|
37
43
|
const role = $derived(_role || getChildrenRole(as));
|
|
@@ -58,7 +64,7 @@
|
|
|
58
64
|
</script>
|
|
59
65
|
|
|
60
66
|
<svelte:element
|
|
61
|
-
this={
|
|
67
|
+
this={_as}
|
|
62
68
|
{role}
|
|
63
69
|
data-value={value}
|
|
64
70
|
aria-selected={role === 'option' ? active : undefined}
|