fluentui-svelte 0.1.2 → 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/README.md +0 -6
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte +74 -56
- package/dist/components/auto-suggest-box/docs/llms.md +46 -13
- package/dist/components/auto-suggest-box/option.svelte +2 -1
- package/dist/components/auto-suggest-box/types.d.ts +5 -0
- package/dist/components/avatar/avatar.svelte +1 -1
- package/dist/components/avatar/docs/llms.md +20 -14
- package/dist/components/badge/badge-icon.svelte +5 -8
- package/dist/components/badge/badge.svelte +6 -2
- package/dist/components/badge/docs/llms.md +29 -16
- package/dist/components/button/button.svelte +13 -7
- package/dist/components/button/docs/llms.md +33 -24
- package/dist/components/button/types.d.ts +5 -1
- 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/card-context.svelte.d.ts +2 -0
- package/dist/components/card/card-context.svelte.js +2 -0
- package/dist/components/card/card-footer.svelte +37 -0
- package/dist/components/card/card-footer.svelte.d.ts +4 -0
- package/dist/components/card/card-header.svelte +81 -0
- package/dist/components/card/card-header.svelte.d.ts +4 -0
- package/dist/components/card/card-preview.svelte +64 -0
- package/dist/components/card/card-preview.svelte.d.ts +4 -0
- package/dist/components/card/card.svelte +242 -0
- package/dist/components/card/card.svelte.d.ts +39 -0
- package/dist/components/card/docs/llms.md +226 -0
- package/dist/components/card/types.d.ts +129 -0
- package/dist/components/card/types.js +1 -0
- package/dist/components/checkbox/checkbox.svelte +5 -3
- 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 +4 -2
- package/dist/components/menu/menu-item-radio.svelte +4 -2
- package/dist/components/menu/menu-item-switch.svelte +4 -2
- package/dist/components/menu/menu-item.svelte +6 -2
- 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/css/class-darkmode.css +3 -1
- package/dist/css/media-darkmode.css +3 -1
- package/dist/css/theme.css +3 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -0
- package/dist/internal/components/render-soc/render-soc.svelte +17 -23
- package/dist/internal/components/render-soc/render-soc.svelte.d.ts +16 -16
- package/dist/providers/fluentui-svelte/fluentui-svelte.svelte +15 -15
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -64,15 +64,21 @@ The `value` prop sets the value of the checkbox input. It is useful when the che
|
|
|
64
64
|
|
|
65
65
|
## Checkbox Props
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `wrapperAttributes`
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
|
|
|
67
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
68
|
+
<!-- props:CheckboxProps -->
|
|
69
|
+
|
|
70
|
+
| Name | Type | Default | Description |
|
|
71
|
+
| ----------------------------------------------- | ------------------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `ref` _bindable_ | `HTMLInputElement` | | The DOM reference of the checkbox element. |
|
|
73
|
+
| `wrapperAs` | `'div'` | `'label'` | `'label'` | The DOM element used to wrap the checkbox. `label` associates the children with the input; switch to `div` when the field is wrapped in a `<Label>` of its own. |
|
|
74
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `HTMLLabelElement` | | The DOM reference of the checkbox wrapper element. |
|
|
75
|
+
| `wrapperAttributes` | `PolymorphicProps` | | The attributes to spread on the wrapper element. |
|
|
76
|
+
| `indeterminate` _bindable_ | `boolean` | | Renders the checkbox in its mixed state, neither checked nor unchecked. |
|
|
77
|
+
| `name` | `string` | `null` | `id` | The name submitted with the form. Falls back to the id of the checkbox. |
|
|
78
|
+
| `group` | `string` | `null` | | The value of the group of checkboxes this input belongs to. |
|
|
79
|
+
| `checked` _bindable_ | `boolean` | | Whether the checkbox is checked. |
|
|
80
|
+
| `disabled` | `boolean` | | Disables the user interaction. |
|
|
81
|
+
| `children` | `Snippet` | | The content of the label. Only rendered when wrapperAs is set to label. |
|
|
82
|
+
| `HTMLInputAttributes` without `on:`, `children` | | | |
|
|
83
|
+
|
|
84
|
+
<!-- /props:CheckboxProps -->
|
|
@@ -35,18 +35,28 @@ Use `hideDays`, `hideMonths`, or `hideYears` to hide individual selector columns
|
|
|
35
35
|
|
|
36
36
|
## Component Props
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
38
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
39
|
+
<!-- props:DatePickerProps -->
|
|
40
|
+
|
|
41
|
+
| Name | Type | Default | Description |
|
|
42
|
+
| ----------------------------- | ------------------------------------ | ----------------- | --------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| `value` _bindable_ | `string` | `''` | Selected date as `YYYY-MM-DD` (matches the underlying `<input type="date">`). |
|
|
44
|
+
| `format` | `'MM/dd/yyyy'` | `'dd/MM/yyyy'` | `'dd/MM/yyyy'` | The order the three columns are laid out in. |
|
|
45
|
+
| `open` _bindable_ | `boolean` | `false` | Controls the open state of the picker. |
|
|
46
|
+
| `hideYears` | `boolean` | `false` | Removes the year column. |
|
|
47
|
+
| `hideMonths` | `boolean` | `false` | Removes the month column. |
|
|
48
|
+
| `hideDays` | `boolean` | `false` | Removes the day column. |
|
|
49
|
+
| `minYear` | `number` | `Current - 100` | The first year offered by the year column. |
|
|
50
|
+
| `maxYear` | `number` | `Current + 100` | The last year offered by the year column. |
|
|
51
|
+
| `disabledDates` | `Date[]` | `[]` | Specific days (year-month-day) that cannot be selected. |
|
|
52
|
+
| `disabledMonths` | `Date[]` | `[]` | Specific months (by month + year) that cannot be selected. |
|
|
53
|
+
| `disabledYears` | `Date[]` | `[]` | Specific years (by year) that cannot be selected. |
|
|
54
|
+
| `ref` _bindable_ | `HTMLButtonElement` | | The DOM reference of the trigger button. |
|
|
55
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | | The DOM reference of the element wrapping the trigger and its input. |
|
|
56
|
+
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
57
|
+
| `inputElement` _bindable_ | `HTMLInputElement` | | The DOM reference of the underlying input element. |
|
|
58
|
+
| `inputProps` | `HTMLInputAttributes` | | HTML attributes for the underlying input element. Give it a `name` to submit the value with a form. |
|
|
59
|
+
| `popupLabel` | `string` | `'Choose a date'` | The accessible name of the popup, which is announced as a dialog. |
|
|
60
|
+
| Element Attributes (`button`) | | | |
|
|
61
|
+
|
|
62
|
+
<!-- /props:DatePickerProps -->
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
|
|
18
18
|
const { closeDialog } = methods;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
// Registered unconditionally and guarded from inside, so switching `type` after mount is honored.
|
|
21
|
+
onClickOutside(
|
|
22
|
+
() => ref,
|
|
23
|
+
() => {
|
|
24
|
+
if (config.type === 'alert') return;
|
|
25
|
+
closeDialog();
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
28
|
|
|
29
29
|
$effect(() => {
|
|
30
30
|
if (!ref) return;
|
|
@@ -8,57 +8,59 @@
|
|
|
8
8
|
|
|
9
9
|
let titleId: string | undefined = $state();
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
get open() {
|
|
17
|
-
return open;
|
|
18
|
-
},
|
|
19
|
-
get dialogRef() {
|
|
20
|
-
return dialogRef;
|
|
21
|
-
},
|
|
22
|
-
set dialogRef(v) {
|
|
23
|
-
dialogRef = v;
|
|
24
|
-
},
|
|
25
|
-
get titleId() {
|
|
26
|
-
return titleId;
|
|
11
|
+
const context: DialogContext = $state({
|
|
12
|
+
config: {
|
|
13
|
+
get type() {
|
|
14
|
+
return type;
|
|
15
|
+
}
|
|
27
16
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
dialogRef
|
|
37
|
-
}
|
|
38
|
-
|
|
17
|
+
state: {
|
|
18
|
+
get open() {
|
|
19
|
+
return open;
|
|
20
|
+
},
|
|
21
|
+
get dialogRef() {
|
|
22
|
+
return dialogRef;
|
|
23
|
+
},
|
|
24
|
+
set dialogRef(v) {
|
|
25
|
+
dialogRef = v;
|
|
26
|
+
},
|
|
27
|
+
get titleId() {
|
|
28
|
+
return titleId;
|
|
29
|
+
},
|
|
30
|
+
set titleId(v) {
|
|
31
|
+
titleId = v;
|
|
39
32
|
}
|
|
40
|
-
onOpenChange?.(true);
|
|
41
33
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
events: null,
|
|
35
|
+
methods: {
|
|
36
|
+
openDialog: () => {
|
|
37
|
+
if (type !== 'non-modal') {
|
|
38
|
+
dialogRef?.showModal();
|
|
39
|
+
} else {
|
|
40
|
+
open = true;
|
|
41
|
+
}
|
|
42
|
+
onOpenChange?.(true);
|
|
43
|
+
},
|
|
44
|
+
closeDialog: () => {
|
|
45
|
+
if (type !== 'non-modal') {
|
|
46
|
+
dialogRef?.close();
|
|
47
|
+
} else {
|
|
48
|
+
open = false;
|
|
49
|
+
}
|
|
50
|
+
onOpenChange?.(false);
|
|
47
51
|
}
|
|
48
|
-
onOpenChange?.(false);
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
|
|
55
|
+
setDialogContext(context);
|
|
56
|
+
|
|
52
57
|
export function openDialog() {
|
|
53
|
-
methods.openDialog();
|
|
58
|
+
context.methods.openDialog();
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export function closeDialog() {
|
|
57
|
-
methods.closeDialog();
|
|
62
|
+
context.methods.closeDialog();
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
// svelte-ignore state_referenced_locally
|
|
61
|
-
setDialogContext({ config, state: _state, events: null, methods });
|
|
62
64
|
</script>
|
|
63
65
|
|
|
64
66
|
{@render children?.()}
|
|
@@ -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 -->
|