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.
Files changed (87) hide show
  1. package/README.md +0 -6
  2. package/dist/components/auto-suggest-box/auto-suggest-box.svelte +74 -56
  3. package/dist/components/auto-suggest-box/docs/llms.md +46 -13
  4. package/dist/components/auto-suggest-box/option.svelte +2 -1
  5. package/dist/components/auto-suggest-box/types.d.ts +5 -0
  6. package/dist/components/avatar/avatar.svelte +1 -1
  7. package/dist/components/avatar/docs/llms.md +20 -14
  8. package/dist/components/badge/badge-icon.svelte +5 -8
  9. package/dist/components/badge/badge.svelte +6 -2
  10. package/dist/components/badge/docs/llms.md +29 -16
  11. package/dist/components/button/button.svelte +13 -7
  12. package/dist/components/button/docs/llms.md +33 -24
  13. package/dist/components/button/types.d.ts +5 -1
  14. package/dist/components/calendar-date-picker/docs/llms.md +17 -7
  15. package/dist/components/calendar-view/calendar-view-header.svelte +2 -2
  16. package/dist/components/calendar-view/calendar-view-header.svelte.d.ts +2 -17
  17. package/dist/components/calendar-view/calendar-view-months.svelte +1 -1
  18. package/dist/components/calendar-view/calendar-view-years.svelte +1 -1
  19. package/dist/components/calendar-view/calendar-view.svelte +66 -52
  20. package/dist/components/calendar-view/docs/llms.md +42 -30
  21. package/dist/components/card/card-context.svelte.d.ts +2 -0
  22. package/dist/components/card/card-context.svelte.js +2 -0
  23. package/dist/components/card/card-footer.svelte +37 -0
  24. package/dist/components/card/card-footer.svelte.d.ts +4 -0
  25. package/dist/components/card/card-header.svelte +81 -0
  26. package/dist/components/card/card-header.svelte.d.ts +4 -0
  27. package/dist/components/card/card-preview.svelte +64 -0
  28. package/dist/components/card/card-preview.svelte.d.ts +4 -0
  29. package/dist/components/card/card.svelte +242 -0
  30. package/dist/components/card/card.svelte.d.ts +39 -0
  31. package/dist/components/card/docs/llms.md +226 -0
  32. package/dist/components/card/types.d.ts +129 -0
  33. package/dist/components/card/types.js +1 -0
  34. package/dist/components/checkbox/checkbox.svelte +5 -3
  35. package/dist/components/checkbox/docs/llms.md +18 -12
  36. package/dist/components/date-picker/docs/llms.md +25 -15
  37. package/dist/components/dialog/dialog-surface.svelte +8 -8
  38. package/dist/components/dialog/dialog.svelte +41 -39
  39. package/dist/components/dialog/docs/llms.md +59 -34
  40. package/dist/components/divider/docs/llms.md +14 -9
  41. package/dist/components/dropdown/docs/llms.md +34 -15
  42. package/dist/components/dropdown/dropdown.svelte +4 -2
  43. package/dist/components/dropdown-select/docs/llms.md +28 -14
  44. package/dist/components/expander/docs/llms.md +19 -12
  45. package/dist/components/flyout/docs/llms.md +17 -11
  46. package/dist/components/hyperlink/docs/llms.md +11 -7
  47. package/dist/components/info-bar/docs/llms.md +15 -9
  48. package/dist/components/label/docs/llms.md +15 -11
  49. package/dist/components/list-view/docs/llms.md +34 -24
  50. package/dist/components/list-view/list-view-item.svelte +10 -4
  51. package/dist/components/list-view/list-view.svelte +68 -63
  52. package/dist/components/menu/context-menu-trigger.svelte +45 -40
  53. package/dist/components/menu/docs/llms.md +63 -34
  54. package/dist/components/menu/menu-item-checkbox.svelte +4 -2
  55. package/dist/components/menu/menu-item-radio.svelte +4 -2
  56. package/dist/components/menu/menu-item-switch.svelte +4 -2
  57. package/dist/components/menu/menu-item.svelte +6 -2
  58. package/dist/components/menu/menu-popover.svelte +21 -10
  59. package/dist/components/menu/menu-trigger.svelte +22 -9
  60. package/dist/components/menu/menu.svelte +98 -87
  61. package/dist/components/number-box/docs/llms.md +10 -6
  62. package/dist/components/persona/docs/llms.md +19 -14
  63. package/dist/components/progress-bar/docs/llms.md +18 -10
  64. package/dist/components/progress-ring/docs/llms.md +19 -12
  65. package/dist/components/radio-button/docs/llms.md +13 -8
  66. package/dist/components/skeleton/docs/llms.md +13 -8
  67. package/dist/components/slider/docs/llms.md +33 -21
  68. package/dist/components/slider/slider.svelte +13 -11
  69. package/dist/components/text-box/docs/llms.md +23 -17
  70. package/dist/components/textarea/docs/llms.md +16 -7
  71. package/dist/components/time-picker/docs/llms.md +20 -10
  72. package/dist/components/toggle-switch/docs/llms.md +13 -9
  73. package/dist/components/tooltip/docs/llms.md +24 -10
  74. package/dist/components/tree-view/docs/llms.md +53 -35
  75. package/dist/components/tree-view/tree-view-item-content.svelte +1 -1
  76. package/dist/components/tree-view/tree-view-item.svelte +3 -3
  77. package/dist/components/tree-view/tree-view.svelte +89 -93
  78. package/dist/css/class-darkmode.css +3 -1
  79. package/dist/css/media-darkmode.css +3 -1
  80. package/dist/css/theme.css +3 -1
  81. package/dist/index.d.ts +4 -0
  82. package/dist/index.js +6 -0
  83. package/dist/internal/components/render-soc/render-soc.svelte +17 -23
  84. package/dist/internal/components/render-soc/render-soc.svelte.d.ts +16 -16
  85. package/dist/providers/fluentui-svelte/fluentui-svelte.svelte +15 -15
  86. package/dist/types/index.d.ts +1 -0
  87. 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
- | Name | Type | Description |
68
- | ------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------- |
69
- | `wrapperAs` | `'div' \| 'label'` | The element the wrapper renders as. Set to `label` to show a visible label. Defaults to `div`. |
70
- | `children` | `Snippet` | Label content rendered next to the input. Only allowed when `wrapperAs="label"`. |
71
- | `checked` | `boolean` | Determines if the checkbox is checked. |
72
- | `indeterminate` | `boolean` | Sets the checkbox to an indeterminate state. |
73
- | `disabled` | `boolean` | Disables the checkbox, preventing user interaction. |
74
- | `value` | `string` | The value of the checkbox input, useful for form submissions. |
75
- | `wrapperAttributes` | `object` | Additional attributes for the wrapper element. |
76
- | `ref` | bindable `HTMLInputElement` | The DOM reference of the checkbox input element. |
77
- | `wrapperRef` | bindable `HTMLDivElement \| HTMLLabelElement` | The DOM reference of the checkbox wrapper element. |
78
- | Input Attributes | | Additional attributes for the checkbox input element. |
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'` &#124; `'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` &#124; `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` &#124; `null` | `id` | The name submitted with the form. Falls back to the id of the checkbox. |
78
+ | `group` | `string` &#124; `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
- | Name | Type | Description |
39
- | ---------------- | ------------------------------ | ----------------------------------------------------------------------------- |
40
- | `value` | bindable `string` | Selected date as `YYYY-MM-DD` (matches the underlying `<input type="date">`). |
41
- | `format` | `'MM/dd/yyyy' \| 'dd/MM/yyyy'` | The display format of the date. Default: `'dd/MM/yyyy'`. |
42
- | `open` | bindable `boolean` | Whether the picker flyout is open. |
43
- | `hideYears` | `boolean` | Hide the year selector column. |
44
- | `hideMonths` | `boolean` | Hide the month selector column. |
45
- | `hideDays` | `boolean` | Hide the day selector column. |
46
- | `minYear` | `number` | Earliest selectable year. Default: current year − 100. |
47
- | `maxYear` | `number` | Latest selectable year. Default: current year. |
48
- | `disabledDates` | `Date[]` | Specific days (year-month-day) that cannot be selected. |
49
- | `disabledMonths` | `Date[]` | Specific months (by month + year) that cannot be selected. |
50
- | `disabledYears` | `Date[]` | Specific years (by year) that cannot be selected. |
51
- | `element` | bindable `HTMLElement` | The DOM reference of the date picker root element. |
52
- | `inputElement` | bindable `HTMLInputElement` | The DOM reference of the underlying input element. |
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'` &#124; `'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
- const { type } = config;
21
-
22
- if (type !== 'alert') {
23
- onClickOutside(
24
- () => ref,
25
- () => closeDialog()
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 config: DialogContext['config'] = $derived({
12
- type
13
- });
14
-
15
- const _state: DialogContext['state'] = {
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
- set titleId(v) {
29
- titleId = v;
30
- }
31
- };
32
-
33
- const methods: DialogContext['methods'] = $derived({
34
- openDialog: () => {
35
- if (type !== 'non-modal') {
36
- dialogRef?.showModal();
37
- } else {
38
- open = true;
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
- closeDialog: () => {
43
- if (type !== 'non-modal') {
44
- dialogRef?.close();
45
- } else {
46
- open = false;
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
- | Name | Type | Description |
84
- | -------------- | ----------------------------------- | -------------------------------------------------- |
85
- | `type` | `'modal' \| 'non-modal' \| 'alert'` | The behavior type of the dialog. Default: `modal`. |
86
- | `open` | bindable `boolean` | Whether the dialog is open. |
87
- | `onOpenChange` | `(open: boolean) => void` | Callback fired when the dialog opens or closes. |
88
- | `children` | `Snippet` | The dialog sub-components to render. |
83
+ <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
84
+ <!-- props:DialogProps -->
85
+
86
+ | Name | Type | Default | Description |
87
+ | ----------------- | ----------------------------------------------- | --------- | ------------------------------------------------- |
88
+ | `type` | `'modal'` &#124; `'non-modal'` &#124; `'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
- | Name | Type | Description |
93
- | -------------- | ----------------------- | ---------------------------------------- |
94
- | `ref` | `HTMLButtonElement` | The DOM reference of the trigger button. |
95
- | `children` | `Snippet` | The content of the trigger button. |
96
- | ...ButtonProps | `ButtonProps<'button'>` | Inherits all `Button` props. |
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
- | Name | Type | Description |
101
- | ------------- | ----------------------------------- | ------------------------------------------------ |
102
- | `ref` | bindable `HTMLDialogElement` | The DOM reference of the dialog element. |
103
- | `children` | `Snippet` | The content to render inside the dialog surface. |
104
- | ...Attributes | `HTMLAttributes<HTMLDialogElement>` | All native `<dialog>` attributes are forwarded. |
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
- | Name | Type | Description |
109
- | ------------- | ---------------------- | ------------------------------------------------------------- |
110
- | `as` | `'div' \| 'h1'`–`'h6'` | The element to render the title as. Default: `h3`. |
111
- | `ref` | bindable element | The DOM reference of the title element. |
112
- | `children` | `Snippet` | The title content. |
113
- | ...Attributes | Polymorphic | All HTML attributes of the chosen `as` element are forwarded. |
121
+ <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
122
+ <!-- props:DialogTitleProps -->
123
+
124
+ | Name | Type | Default | Description |
125
+ | ---------------- | -------------------------------------------- | ------- | ---------------------------------------- |
126
+ | `ref` _bindable_ | `HTMLDivElement` &#124; `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
- | Name | Type | Description |
118
- | ------------- | -------------------------------- | --------------------------------------------- |
119
- | `ref` | `HTMLDivElement` | The DOM reference of the content element. |
120
- | `children` | `Snippet` | The content to render inside the dialog body. |
121
- | ...Attributes | `HTMLAttributes<HTMLDivElement>` | All native `<div>` attributes are forwarded. |
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
- | Name | Type | Description |
126
- | ------------- | -------------------------------- | ------------------------------------------------------- |
127
- | `ref` | bindable `HTMLDivElement` | The DOM reference of the actions element. |
128
- | `position` | `'start' \| 'center' \| 'end'` | Horizontal alignment of the actions. Default: `end`. |
129
- | `fluid` | `boolean` | Whether the actions container uses a full-width layout. |
130
- | `children` | `Snippet` | The action elements to render, typically buttons. |
131
- | ...Attributes | `HTMLAttributes<HTMLDivElement>` | All native `<div>` attributes are forwarded. |
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'` &#124; `'center'` &#124; `'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
- | Name | Type | Description |
76
- | -------------- | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
77
- | `as` | `string` | The HTML element to render the divider as. Possible values: `'div'`, `'hr'`, `'span'`. |
78
- | `vertical` | `boolean` | Whether the divider is rendered vertically instead of horizontally. |
79
- | `alignContent` | `string` | The alignment of the content within the divider. Possible values: `'start'`, `'center'`, `'end'`. |
80
- | `appearance` | `string` | The appearance of the divider. Possible values: `'default'`, `'accent'`, `'standard'`, `'subtle'`. |
81
- | `inset` | `boolean` | Whether the divider has inline padding applied. |
82
- | `ref` | `HTMLDivElement \| HTMLHRElement \| HTMLSpanElement` | The DOM reference of the divider element, its type depends on the `as` prop. |
83
- | `children` | `Snippet` | The content to render as a label within the divider. |
75
+ <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
76
+ <!-- props:DividerProps -->
77
+
78
+ | Name | Type | Default | Description |
79
+ | ---------------- | ------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------- |
80
+ | `as` | `'div'` &#124; `'hr'` &#124; `'span'` | `'div'` | The HTML element to render the divider as. |
81
+ | `ref` _bindable_ | `HTMLDivElement` &#124; `HTMLHRElement` &#124; `HTMLSpanElement` | | The DOM reference of the divider element. |
82
+ | `vertical` | `boolean` | | Renders the divider vertically instead of horizontally. |
83
+ | `alignContent` | `'start'` &#124; `'center'` &#124; `'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'` &#124; `'standard'` &#124; `'subtle'` &#124; `'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
- | Name | Type | Description |
54
- | ----------------- | ----------------------------- | --------------------------------------------------------------------- |
55
- | `value` | bindable `string \| string[]` | The selected value, or an array of values when `multiple` is set. |
56
- | `multiple` | `boolean` | Allow selecting more than one option. |
57
- | `placeholder` | `string` | Text shown when no option is selected. Default: `'Select an option'`. |
58
- | `disabled` | `boolean` | Disables user interaction. |
59
- | `flyoutMaxHeight` | `number` | Maximum height of the options flyout before it scrolls. |
60
- | `name` | `string` | Name of the underlying form control. |
61
- | `ref` | bindable `HTMLElement` | The DOM reference of the dropdown element. |
62
- | `children` | `Snippet` | The `DropdownOption` items to render. |
53
+ <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
54
+ <!-- props:DropdownProps -->
55
+
56
+ | Name | Type | Default | Description |
57
+ | ---------------------------------------------------- | -------------------------- | -------------------- | ----------------------------------------------------------------------- |
58
+ | `value` _bindable_ | `string` &#124; `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` &#124; `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` &#124; `DropdownSingleValue` | | | |
75
+ | `HTMLInputAttributes` without `value`, `onclick` | | | |
76
+
77
+ <!-- /props:DropdownProps -->
63
78
 
64
79
  ## DropdownOption Props
65
80
 
66
- | Name | Type | Description |
67
- | ---------- | --------- | ------------------------------------------------------------------------------ |
68
- | `value` | `string` | The value of the option, used for selection. |
69
- | `text` | `string` | Plain-text label used to display the selection when the flyout is closed. |
70
- | `children` | `Snippet` | The content rendered for the option (can be rich content such as a `Persona`). |
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
- setDropdownContext({
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
- | Name | Type | Description |
57
- | ----------------- | ----------------------------- | --------------------------------------------------------------------------- |
58
- | `value` | bindable `string \| string[]` | The selected value, or an array of values when `multiple` is set. |
59
- | `multiple` | `boolean` | Allow selecting more than one option. |
60
- | `placeholder` | `string` | Text shown when no option is selected. Default: `'Native Select Dropdown'`. |
61
- | `hidePlaceholder` | `boolean` | Hides the placeholder option. |
62
- | `ref` | bindable `HTMLSelectElement` | The DOM reference of the underlying `<select>` element. |
63
- | `wrapperRef` | bindable `HTMLDivElement` | The DOM reference of the wrapper element. |
64
- | `children` | `Snippet` | The `DropdownSelectOption` items to render. |
56
+ <!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
57
+ <!-- props:DropdownSelectProps -->
58
+
59
+ | Name | Type | Default | Description |
60
+ | ----------------------------- | -------------------------- | -------------------------- | ---------------------------------------------------------------------- |
61
+ | `value` _bindable_ | `string` &#124; `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
- | Name | Type | Description |
69
- | ---------- | --------- | ----------------------------------------------------------------------- |
70
- | `value` | `string` | The value of the option, used for selection. |
71
- | `text` | `string` | Plain-text label used to display the selection when the list is closed. |
72
- | `children` | `Snippet` | The content rendered for the option. |
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
- | Name | Type | Description |
78
- | ------------- | ---------------------- | ------------------------------------------------------------------------- |
79
- | `header` | `string` | Label of the expander. |
80
- | `description` | `string` | Description to render below the header. |
81
- | `direction` | `string` | The opening direction of the expander. Possible values: `'down'`, `'up'`. |
82
- | `justify` | `boolean` | Whether the expander is justified to the full width of the container. |
83
- | `disabled` | `boolean` | Disables the user interaction. |
84
- | `animation` | `object` | The animation configuration. |
85
- | `expanded` | `boolean` | Controls the opening state of the expander. |
86
- | `element` | `HTMLDetailsElement` | The DOM reference of the expander element. |
87
- | `Icon` | `Snippet \| Component` | The icon to display before the label. |
88
- | `children` | `Snippet` | The children elements to render inside the expander. |
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'` &#124; `'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` &#124; `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
- | Name | Type | Description |
22
- | ------------------- | ------------------------------------------------- | --------------------------------------------------------------- |
23
- | `ref` | Bindable `HTMLElement` | The DOM reference to the flyout element. |
24
- | `children` | `Snippet` | The content to be displayed inside the flyout. |
25
- | `floating` | `boolean` | Whether to use Floating UI for positioning. Default: false. |
26
- | `reference` | `HTMLElement` | The reference element for Floating UI. |
27
- | `placement` | `Placement` | The placement for Floating UI positioning. Default: 'bottom'. |
28
- | `onPlacementChange` | `(placement: Placement) => void` | A callback that is called when the placement changes. |
29
- | `roundCorners` | `'all' \| 'top' \| 'bottom' \| 'left' \| 'right'` | Which corners to round. Default: 'all'. |
30
- | `offset` | `number` | The offset for Floating UI positioning. Default: 8. |
31
- | Element Attributes | | All other attributes that can be applied to the flyout element. |
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'` &#124; `'top'` &#124; `'bottom'` &#124; `'left'` &#124; `'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 -->