fluentui-svelte 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/app-surface/app-surface.svelte +96 -0
- package/dist/components/app-surface/app-surface.svelte.d.ts +22 -0
- package/dist/components/app-surface/docs/llms.md +73 -0
- package/dist/components/app-surface/types.d.ts +19 -0
- package/dist/components/app-surface/types.js +1 -0
- package/dist/components/app-window/app-window.d.ts +3 -0
- package/dist/components/app-window/app-window.js +3 -0
- package/dist/components/app-window/app-window.svelte +193 -0
- package/dist/components/app-window/app-window.svelte.d.ts +25 -0
- package/dist/components/app-window/docs/llms.md +119 -0
- package/dist/components/app-window/types.d.ts +66 -0
- package/dist/components/app-window/types.js +1 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte +47 -31
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte.d.ts +2 -2
- package/dist/components/auto-suggest-box/docs/llms.md +34 -33
- package/dist/components/auto-suggest-box/option.svelte +6 -4
- package/dist/components/auto-suggest-box/types.d.ts +13 -16
- package/dist/components/avatar/avatar.svelte +4 -3
- package/dist/components/avatar/docs/llms.md +1 -1
- package/dist/components/avatar/type.d.ts +1 -1
- package/dist/components/badge/badge-icon.svelte +2 -2
- package/dist/components/badge/badge.svelte +2 -2
- package/dist/components/badge/docs/llms.md +2 -2
- package/dist/components/badge/types.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-button.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-divider.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb.svelte +10 -5
- package/dist/components/breadcrumb/docs/llms.md +11 -11
- package/dist/components/breadcrumb/types.d.ts +7 -7
- package/dist/components/button/button.svelte +2 -2
- package/dist/components/button/docs/llms.md +17 -17
- package/dist/components/button/split-button.svelte +7 -7
- package/dist/components/button/types.d.ts +5 -5
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte +98 -10
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte.d.ts +1 -1
- package/dist/components/calendar-date-picker/docs/llms.md +19 -14
- package/dist/components/calendar-date-picker/types.d.ts +22 -8
- package/dist/components/calendar-view/calendar-view-days.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-grid.js +8 -3
- package/dist/components/calendar-view/calendar-view-item.svelte +10 -4
- package/dist/components/calendar-view/calendar-view-months.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-years.svelte +3 -2
- package/dist/components/calendar-view/calendar-view.svelte +11 -4
- package/dist/components/calendar-view/calendar-view.svelte.js +5 -0
- package/dist/components/calendar-view/docs/llms.md +20 -19
- package/dist/components/calendar-view/types.d.ts +6 -1
- package/dist/components/card/card-footer.svelte +2 -2
- package/dist/components/card/card-header.svelte +5 -4
- package/dist/components/card/card-preview.svelte +13 -2
- package/dist/components/card/card.svelte +5 -5
- package/dist/components/card/docs/llms.md +22 -21
- package/dist/components/card/types.d.ts +8 -4
- package/dist/components/checkbox/checkbox.svelte +47 -26
- package/dist/components/checkbox/checkbox.svelte.d.ts +3 -24
- package/dist/components/checkbox/docs/llms.md +24 -23
- package/dist/components/checkbox/types.d.ts +10 -23
- package/dist/components/date-picker/date-picker.svelte +98 -27
- package/dist/components/date-picker/date-picker.svelte.d.ts +1 -1
- package/dist/components/date-picker/docs/llms.md +23 -20
- package/dist/components/date-picker/types.d.ts +24 -15
- package/dist/components/dialog/dialog-actions.svelte +2 -2
- package/dist/components/dialog/dialog-content.svelte +2 -2
- package/dist/components/dialog/dialog-surface.svelte +102 -9
- package/dist/components/dialog/dialog-title.svelte +2 -2
- package/dist/components/dialog/dialog-trigger.svelte +2 -2
- package/dist/components/dialog/dialog.svelte +22 -11
- package/dist/components/dialog/docs/llms.md +56 -19
- package/dist/components/dialog/types.d.ts +25 -7
- package/dist/components/divider/divider.svelte +6 -4
- package/dist/components/divider/types.d.ts +1 -1
- package/dist/components/dropdown/docs/llms.md +30 -28
- package/dist/components/dropdown/dropdown-option.svelte +17 -5
- package/dist/components/dropdown/dropdown.svelte +182 -84
- package/dist/components/dropdown/dropdown.svelte.d.ts +1 -1
- package/dist/components/dropdown/types.d.ts +26 -20
- package/dist/components/dropdown-select/docs/llms.md +24 -22
- package/dist/components/dropdown-select/dropdown-select-option.svelte +2 -2
- package/dist/components/dropdown-select/dropdown-select.svelte +42 -7
- package/dist/components/dropdown-select/types.d.ts +4 -4
- package/dist/components/expander/docs/llms.md +3 -3
- package/dist/components/expander/expander.svelte +13 -8
- package/dist/components/expander/types.d.ts +5 -5
- package/dist/components/flyout/docs/llms.md +1 -1
- package/dist/components/flyout/flyout.svelte +17 -6
- package/dist/components/flyout/types.d.ts +1 -1
- package/dist/components/hyperlink/docs/llms.md +6 -6
- package/dist/components/hyperlink/hyperlink.svelte +13 -4
- package/dist/components/hyperlink/types.d.ts +1 -1
- package/dist/components/info-bar/docs/llms.md +11 -10
- package/dist/components/info-bar/info-bar.svelte +3 -2
- package/dist/components/info-bar/types.d.ts +4 -0
- package/dist/components/label/docs/llms.md +75 -22
- package/dist/components/label/label-context.d.ts +14 -0
- package/dist/components/label/label-context.js +10 -0
- package/dist/components/label/label.svelte +153 -30
- package/dist/components/label/label.svelte.d.ts +1 -1
- package/dist/components/label/types.d.ts +48 -4
- package/dist/components/list-view/docs/llms.md +103 -33
- package/dist/components/list-view/list-view-item-branch.svelte +257 -0
- package/dist/components/list-view/list-view-item-branch.svelte.d.ts +4 -0
- package/dist/components/list-view/list-view-item.svelte +164 -46
- package/dist/components/list-view/list-view-item.svelte.d.ts +5 -5
- package/dist/components/list-view/list-view.svelte +73 -25
- package/dist/components/list-view/types.d.ts +71 -8
- package/dist/components/list-view/utils.d.ts +10 -0
- package/dist/components/list-view/utils.js +17 -1
- package/dist/components/menu/docs/llms.md +98 -15
- package/dist/components/menu/menu-command-bar-item.svelte +61 -0
- package/dist/components/menu/menu-command-bar-item.svelte.d.ts +14 -0
- package/dist/components/menu/menu-command-bar.svelte +218 -0
- package/dist/components/menu/menu-command-bar.svelte.d.ts +21 -0
- package/dist/components/menu/menu-group.svelte +6 -3
- package/dist/components/menu/menu-item-checkbox.svelte +5 -4
- package/dist/components/menu/menu-item-radio.svelte +5 -4
- package/dist/components/menu/menu-item-switch.svelte +5 -4
- package/dist/components/menu/menu-item.svelte +5 -5
- package/dist/components/menu/menu-item.svelte.d.ts +2 -3
- package/dist/components/menu/menu-list.svelte +10 -1
- package/dist/components/menu/menu-popover.svelte +9 -5
- package/dist/components/menu/menu-trigger.svelte +2 -1
- package/dist/components/menu/menu.svelte.js +1 -0
- package/dist/components/menu/types.d.ts +62 -7
- package/dist/components/number-box/docs/llms.md +6 -4
- package/dist/components/number-box/number-box.svelte +35 -29
- package/dist/components/number-box/number-box.svelte.d.ts +1 -1
- package/dist/components/number-box/types.d.ts +1 -1
- package/dist/components/persona/docs/llms.md +29 -25
- package/dist/components/persona/persona.svelte +8 -6
- package/dist/components/persona/types.d.ts +4 -3
- package/dist/components/progress-bar/docs/llms.md +13 -13
- package/dist/components/progress-bar/progress-bar.svelte +6 -6
- package/dist/components/progress-bar/types.d.ts +4 -4
- package/dist/components/progress-ring/docs/llms.md +14 -14
- package/dist/components/progress-ring/progress-ring.svelte +5 -5
- package/dist/components/progress-ring/types.d.ts +3 -3
- package/dist/components/radio-button/docs/llms.md +11 -8
- package/dist/components/radio-button/radio-button.svelte +38 -12
- package/dist/components/radio-button/radio-button.svelte.d.ts +1 -1
- package/dist/components/radio-button/types.d.ts +11 -8
- package/dist/components/rating/docs/llms.md +15 -14
- package/dist/components/rating/rating.svelte +66 -29
- package/dist/components/rating/rating.svelte.d.ts +1 -1
- package/dist/components/rating/types.d.ts +8 -8
- package/dist/components/side-nav/docs/llms.md +110 -0
- package/dist/components/side-nav/side-nav-branch.svelte +43 -0
- package/dist/components/side-nav/side-nav-branch.svelte.d.ts +4 -0
- package/dist/components/side-nav/side-nav-item.svelte +75 -0
- package/dist/components/side-nav/side-nav-item.svelte.d.ts +25 -0
- package/dist/components/side-nav/side-nav-list.svelte +32 -0
- package/dist/components/side-nav/side-nav-list.svelte.d.ts +7 -0
- package/dist/components/side-nav/side-nav.d.ts +2 -0
- package/dist/components/side-nav/side-nav.js +2 -0
- package/dist/components/side-nav/side-nav.svelte +355 -0
- package/dist/components/side-nav/side-nav.svelte.d.ts +24 -0
- package/dist/components/side-nav/types.d.ts +149 -0
- package/dist/components/side-nav/types.js +1 -0
- package/dist/components/skeleton/docs/llms.md +1 -1
- package/dist/components/skeleton/skeleton.svelte +2 -2
- package/dist/components/skeleton/types.d.ts +1 -1
- package/dist/components/slider/docs/llms.md +31 -28
- package/dist/components/slider/slider.svelte +126 -61
- package/dist/components/slider/slider.svelte.d.ts +1 -3
- package/dist/components/slider/types.d.ts +21 -14
- package/dist/components/tab-view/docs/llms.md +7 -7
- package/dist/components/tab-view/tab-view-tab.svelte +16 -14
- package/dist/components/tab-view/tab-view.svelte +16 -9
- package/dist/components/tab-view/types.d.ts +6 -6
- package/dist/components/table/docs/llms.md +38 -33
- package/dist/components/table/table-body.svelte +2 -2
- package/dist/components/table/table-cell-actions.svelte +8 -2
- package/dist/components/table/table-cell-layout.svelte +2 -2
- package/dist/components/table/table-cell.svelte +2 -2
- package/dist/components/table/table-header-cell.svelte +2 -2
- package/dist/components/table/table-header.svelte +2 -2
- package/dist/components/table/table-row.svelte +2 -2
- package/dist/components/table/table-selection-cell.svelte +6 -6
- package/dist/components/table/table.svelte +2 -2
- package/dist/components/table/types.d.ts +11 -11
- package/dist/components/tag/docs/llms.md +26 -26
- package/dist/components/tag/tag-group.svelte +2 -2
- package/dist/components/tag/tag.svelte +13 -12
- package/dist/components/tag/types.d.ts +6 -4
- package/dist/components/tag-picker/docs/llms.md +61 -55
- package/dist/components/tag-picker/option-group.svelte +17 -4
- package/dist/components/tag-picker/option-group.svelte.d.ts +1 -1
- package/dist/components/tag-picker/option.svelte +15 -4
- package/dist/components/tag-picker/tag-picker.svelte +137 -65
- package/dist/components/tag-picker/tag-picker.svelte.d.ts +2 -2
- package/dist/components/tag-picker/types.d.ts +36 -16
- package/dist/components/text-box/docs/llms.md +31 -4
- package/dist/components/text-box/text-box-button.svelte +3 -3
- package/dist/components/text-box/text-box-button.svelte.d.ts +1 -1
- package/dist/components/text-box/text-box.svelte +41 -14
- package/dist/components/text-box/types.d.ts +5 -5
- package/dist/components/textarea/docs/llms.md +4 -3
- package/dist/components/textarea/textarea.svelte +14 -6
- package/dist/components/textarea/types.d.ts +2 -4
- package/dist/components/time-picker/docs/llms.md +18 -15
- package/dist/components/time-picker/time-picker.svelte +133 -33
- package/dist/components/time-picker/time-picker.svelte.d.ts +1 -1
- package/dist/components/time-picker/types.d.ts +23 -13
- package/dist/components/title-bar/docs/llms.md +382 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte +215 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte.d.ts +22 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte +190 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte.d.ts +27 -0
- package/dist/components/title-bar/title-bar.d.ts +3 -0
- package/dist/components/title-bar/title-bar.js +4 -0
- package/dist/components/title-bar/title-bar.svelte +224 -0
- package/dist/components/title-bar/title-bar.svelte.d.ts +26 -0
- package/dist/components/title-bar/types.d.ts +165 -0
- package/dist/components/title-bar/types.js +1 -0
- package/dist/components/toggle-switch/docs/llms.md +11 -9
- package/dist/components/toggle-switch/toggle-switch.svelte +23 -14
- package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +1 -1
- package/dist/components/toggle-switch/types.d.ts +12 -10
- package/dist/components/tooltip/docs/llms.md +1 -1
- package/dist/components/tooltip/tooltip.svelte +5 -4
- package/dist/components/tooltip/types.d.ts +1 -1
- package/dist/components/top-nav/docs/llms.md +1 -1
- package/dist/components/top-nav/top-nav-item.svelte +2 -2
- package/dist/components/top-nav/top-nav.svelte +2 -2
- package/dist/components/top-nav/types.d.ts +2 -2
- package/dist/components/tree-view/docs/llms.md +11 -11
- package/dist/components/tree-view/tree-view-item-content.svelte +3 -3
- package/dist/components/tree-view/tree-view-item.svelte +13 -5
- package/dist/components/tree-view/tree-view.svelte +20 -5
- package/dist/components/tree-view/tree-view.svelte.d.ts +1 -1
- package/dist/components/tree-view/tree-view.svelte.js +31 -3
- package/dist/components/tree-view/types.d.ts +7 -3
- package/dist/index.d.ts +18 -0
- package/dist/index.js +20 -0
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +26 -5
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +2 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/native-field.svelte.d.ts +44 -0
- package/dist/internal/native-field.svelte.js +85 -0
- package/dist/internal/utils.d.ts +16 -2
- package/dist/internal/utils.js +25 -3
- package/dist/types/index.d.ts +3 -3
- package/package.json +50 -36
|
@@ -33,30 +33,33 @@ Use `hideDays`, `hideMonths`, or `hideYears` to hide individual selector columns
|
|
|
33
33
|
<DatePicker hideDays />
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
HTML attributes, including class, id and ARIA attributes, apply to the control element. Bind ref to access that control. Use wrapperAttributes and wrapperRef for the outer container.
|
|
37
|
+
|
|
36
38
|
## Component Props
|
|
37
39
|
|
|
38
40
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
39
41
|
<!-- props:DatePickerProps -->
|
|
40
42
|
|
|
41
|
-
| Name
|
|
42
|
-
|
|
|
43
|
-
| `value` _bindable_
|
|
44
|
-
| `format`
|
|
45
|
-
| `open` _bindable_
|
|
46
|
-
| `hideYears`
|
|
47
|
-
| `hideMonths`
|
|
48
|
-
| `hideDays`
|
|
49
|
-
| `minYear`
|
|
50
|
-
| `maxYear`
|
|
51
|
-
| `disabledDates`
|
|
52
|
-
| `disabledMonths`
|
|
53
|
-
| `disabledYears`
|
|
54
|
-
| `ref` _bindable_
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
| `
|
|
58
|
-
| `
|
|
59
|
-
| `popupLabel`
|
|
60
|
-
|
|
|
43
|
+
| Name | Type | Default | Description |
|
|
44
|
+
| -------------------------------------------- | ------------------------------------------------- | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| `value` _bindable_ | `string` | `''` | Selected date as `YYYY-MM-DD` (matches the underlying `<input type="date">`). |
|
|
46
|
+
| `format` | `'MM/dd/yyyy'` | `'dd/MM/yyyy'` | `'dd/MM/yyyy'` | The order the three columns are laid out in. |
|
|
47
|
+
| `open` _bindable_ | `boolean` | `false` | Controls the open state of the picker. |
|
|
48
|
+
| `hideYears` | `boolean` | `false` | Removes the year column. |
|
|
49
|
+
| `hideMonths` | `boolean` | `false` | Removes the month column. |
|
|
50
|
+
| `hideDays` | `boolean` | `false` | Removes the day column. |
|
|
51
|
+
| `minYear` | `number` | `Current - 100` | The first year offered by the year column. Unless `min` is given, the native input accepts no earlier date. |
|
|
52
|
+
| `maxYear` | `number` | `Current + 100` | The last year offered by the year column. Unless `max` is given, the native input accepts no later date. |
|
|
53
|
+
| `disabledDates` | `Date[]` | `[]` | Specific days (year-month-day) that cannot be selected. |
|
|
54
|
+
| `disabledMonths` | `Date[]` | `[]` | Specific months (by month + year) that cannot be selected. |
|
|
55
|
+
| `disabledYears` | `Date[]` | `[]` | Specific years (by year) that cannot be selected. |
|
|
56
|
+
| `ref` _bindable_ | `HTMLInputElement` | `null` | | The DOM reference of the native date input that holds the value. The other attributes of the picker are applied to it. |
|
|
57
|
+
| `buttonRef` _bindable_ | `HTMLButtonElement` | `null` | | The DOM reference of the button that opens the picker. |
|
|
58
|
+
| `buttonAttributes` | `HTMLButtonAttributes` | | The attributes to spread on the button that opens the picker. |
|
|
59
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the element wrapping the button and the native input. |
|
|
60
|
+
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
61
|
+
| `popupLabel` | `string` | `'Choose a date'` | The accessible name of the popup, which is announced as a dialog. |
|
|
62
|
+
| `columnLabels` | `{ month?: string; day?: string; year?: string }` | `{ month: 'Month', day: 'Day', year: 'Year' }` | The names of the month, day and year columns: shown on the trigger while there is no date, and given to the lists of the popup. |
|
|
63
|
+
| `NativeFieldAttributes<HTMLInputAttributes>` | | | |
|
|
61
64
|
|
|
62
65
|
<!-- /props:DatePickerProps -->
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HTMLAttributes, HTMLButtonAttributes, HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
import type { NativeFieldAttributes } from '../../internal/index.js';
|
|
2
3
|
/** @propsmith DatePickerProps */
|
|
3
4
|
export type DatePickerProps = {
|
|
4
5
|
/** Selected date as `YYYY-MM-DD` (matches the underlying `<input type="date">`).
|
|
@@ -27,11 +28,11 @@ export type DatePickerProps = {
|
|
|
27
28
|
* @default false
|
|
28
29
|
*/
|
|
29
30
|
hideDays?: boolean;
|
|
30
|
-
/** The first year offered by the year column.
|
|
31
|
+
/** The first year offered by the year column. Unless `min` is given, the native input accepts no earlier date.
|
|
31
32
|
* @default Current - 100
|
|
32
33
|
*/
|
|
33
34
|
minYear?: number;
|
|
34
|
-
/** The last year offered by the year column.
|
|
35
|
+
/** The last year offered by the year column. Unless `max` is given, the native input accepts no later date.
|
|
35
36
|
* @default Current + 100
|
|
36
37
|
*/
|
|
37
38
|
maxYear?: number;
|
|
@@ -47,28 +48,36 @@ export type DatePickerProps = {
|
|
|
47
48
|
* @default []
|
|
48
49
|
*/
|
|
49
50
|
disabledYears?: Date[];
|
|
50
|
-
/** The DOM reference of the
|
|
51
|
+
/** The DOM reference of the native date input that holds the value. The other attributes of the picker are applied to it.
|
|
51
52
|
* @bindable
|
|
52
53
|
*/
|
|
53
|
-
ref?:
|
|
54
|
-
/** The DOM reference of the
|
|
54
|
+
ref?: HTMLInputElement | null;
|
|
55
|
+
/** The DOM reference of the button that opens the picker.
|
|
55
56
|
* @bindable
|
|
56
57
|
*/
|
|
57
|
-
|
|
58
|
-
/** The attributes to spread on the
|
|
59
|
-
* @type
|
|
58
|
+
buttonRef?: HTMLButtonElement | null;
|
|
59
|
+
/** The attributes to spread on the button that opens the picker.
|
|
60
|
+
* @type HTMLButtonAttributes
|
|
60
61
|
*/
|
|
61
|
-
|
|
62
|
-
/** The DOM reference of the
|
|
62
|
+
buttonAttributes?: HTMLButtonAttributes;
|
|
63
|
+
/** The DOM reference of the element wrapping the button and the native input.
|
|
63
64
|
* @bindable
|
|
64
65
|
*/
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
66
|
+
wrapperRef?: HTMLDivElement | null;
|
|
67
|
+
/** The attributes to spread on the wrapper element.
|
|
68
|
+
* @type HTMLAttributes
|
|
68
69
|
*/
|
|
69
|
-
|
|
70
|
+
wrapperAttributes?: HTMLAttributes<HTMLDivElement>;
|
|
70
71
|
/** The accessible name of the popup, which is announced as a dialog.
|
|
71
72
|
* @default 'Choose a date'
|
|
72
73
|
*/
|
|
73
74
|
popupLabel?: string;
|
|
74
|
-
|
|
75
|
+
/** The names of the month, day and year columns: shown on the trigger while there is no date, and given to the lists of the popup.
|
|
76
|
+
* @default { month: 'Month', day: 'Day', year: 'Year' }
|
|
77
|
+
*/
|
|
78
|
+
columnLabels?: {
|
|
79
|
+
month?: string;
|
|
80
|
+
day?: string;
|
|
81
|
+
year?: string;
|
|
82
|
+
};
|
|
83
|
+
} & NativeFieldAttributes<HTMLInputAttributes>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { DialogActionsProps } from './types.js';
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
|
-
ref = $bindable(),
|
|
6
|
+
ref = $bindable(null),
|
|
7
7
|
position = 'end',
|
|
8
8
|
fluid,
|
|
9
9
|
class: classes,
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
</script>
|
|
21
21
|
|
|
22
22
|
<div
|
|
23
|
+
{...attributes}
|
|
23
24
|
class={['dialog-actions', `justify-${position}`, { fluid }, classes]}
|
|
24
25
|
bind:this={ref}
|
|
25
26
|
{...tabspotAttributes}
|
|
26
|
-
{...attributes}
|
|
27
27
|
>
|
|
28
28
|
{@render children?.()}
|
|
29
29
|
</div>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { DialogContentProps } from './types.js';
|
|
3
3
|
|
|
4
|
-
let { ref = $bindable(), class: classes, children, ...attributes }: DialogContentProps = $props();
|
|
4
|
+
let { ref = $bindable(null), class: classes, children, ...attributes }: DialogContentProps = $props();
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<div class={['dialog-content', classes]} bind:this={ref}
|
|
7
|
+
<div {...attributes} class={['dialog-content', classes]} bind:this={ref}>
|
|
8
8
|
{@render children?.()}
|
|
9
9
|
</div>
|
|
10
10
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { Button } from '../../index.js';
|
|
7
7
|
import DismissFilled from 'fluentui-icons-svelte/DismissFilled.svelte';
|
|
8
8
|
|
|
9
|
-
let { ref = $bindable(), class: classes, oncancel, children, ...attributes }: DialogSurfaceProps = $props();
|
|
9
|
+
let { ref = $bindable(null), class: classes, oncancel, children, ...attributes }: DialogSurfaceProps = $props();
|
|
10
10
|
|
|
11
11
|
const CONTEXT = getDialogContext();
|
|
12
12
|
|
|
@@ -18,6 +18,12 @@
|
|
|
18
18
|
|
|
19
19
|
const { closeDialog } = methods;
|
|
20
20
|
|
|
21
|
+
const duration = $derived(
|
|
22
|
+
typeof config.duration === 'number'
|
|
23
|
+
? `${Number.isFinite(config.duration) ? Math.max(0, config.duration) : 0}ms`
|
|
24
|
+
: `var(${config.duration.startsWith('--') ? config.duration : `--fs-${config.duration}-duration`}, 333ms)`
|
|
25
|
+
);
|
|
26
|
+
|
|
21
27
|
// runed reports an outside press 10ms after the pointer goes down. By then the press that opens the
|
|
22
28
|
// dialog has already opened it, and a press while it is closed has nothing to dismiss, so remember
|
|
23
29
|
// whether the dialog was open at the moment the pointer went down.
|
|
@@ -55,12 +61,13 @@
|
|
|
55
61
|
</script>
|
|
56
62
|
|
|
57
63
|
<dialog
|
|
64
|
+
{...attributes}
|
|
58
65
|
open={_state.open}
|
|
59
|
-
class={['fs-dialog', classes]}
|
|
60
|
-
|
|
66
|
+
class={['fs-dialog', `position-${config.position}`, `animation-${config.animation}`, classes]}
|
|
67
|
+
style:--fs-dialog-duration={duration}
|
|
68
|
+
aria-labelledby={_state.titleId ?? attributes['aria-labelledby']}
|
|
61
69
|
bind:this={ref}
|
|
62
70
|
oncancel={handleCancel}
|
|
63
|
-
{...attributes}
|
|
64
71
|
>
|
|
65
72
|
<div class="dialog-wrapper">
|
|
66
73
|
{#if config.type === 'non-modal'}
|
|
@@ -74,21 +81,93 @@
|
|
|
74
81
|
|
|
75
82
|
<style>
|
|
76
83
|
.fs-dialog {
|
|
84
|
+
--fs-dialog-effective-duration: var(--fs-dialog-duration);
|
|
85
|
+
--fs-dialog-enter-easing: var(--fs-fast-dismiss, cubic-bezier(0, 0, 0, 1));
|
|
86
|
+
--fs-dialog-exit-easing: var(--fs-soft-dismiss, cubic-bezier(1, 0, 1, 1));
|
|
87
|
+
--fs-dialog-hidden-transform: none;
|
|
88
|
+
opacity: 0;
|
|
89
|
+
transform: var(--fs-dialog-hidden-transform);
|
|
90
|
+
transition:
|
|
91
|
+
opacity var(--fs-dialog-effective-duration) var(--fs-dialog-exit-easing),
|
|
92
|
+
transform var(--fs-dialog-effective-duration) var(--fs-dialog-exit-easing),
|
|
93
|
+
display var(--fs-dialog-effective-duration) allow-discrete,
|
|
94
|
+
overlay var(--fs-dialog-effective-duration) allow-discrete;
|
|
95
|
+
&[open] {
|
|
96
|
+
opacity: 1;
|
|
97
|
+
transform: none;
|
|
98
|
+
transition-timing-function: var(--fs-dialog-enter-easing);
|
|
99
|
+
}
|
|
100
|
+
&.animation-zoom {
|
|
101
|
+
--fs-dialog-hidden-transform: scale(0.9);
|
|
102
|
+
--fs-dialog-enter-transform: scale(0.88);
|
|
103
|
+
}
|
|
104
|
+
&.animation-slide {
|
|
105
|
+
--fs-dialog-hidden-transform: translateY(16px);
|
|
106
|
+
&.position-top-start,
|
|
107
|
+
&.position-top-center,
|
|
108
|
+
&.position-top-end {
|
|
109
|
+
--fs-dialog-hidden-transform: translateY(-16px);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
&.animation-bounce {
|
|
113
|
+
--fs-dialog-hidden-transform: scale(0.96);
|
|
114
|
+
--fs-dialog-enter-easing: var(--fs-strong-invoke, cubic-bezier(0.13, 1.62, 0, 0.92));
|
|
115
|
+
/* Reverse of Fluent's strong-invoke curve: a small anticipation before dismissal. */
|
|
116
|
+
--fs-dialog-exit-easing: cubic-bezier(1, 0.08, 0.87, -0.62);
|
|
117
|
+
}
|
|
118
|
+
@starting-style {
|
|
119
|
+
&[open] {
|
|
120
|
+
opacity: 0;
|
|
121
|
+
transform: var(--fs-dialog-enter-transform, var(--fs-dialog-hidden-transform));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
77
124
|
position: fixed;
|
|
78
|
-
|
|
79
|
-
|
|
125
|
+
inset: 1rem;
|
|
126
|
+
margin: auto;
|
|
80
127
|
padding: 0;
|
|
81
|
-
|
|
128
|
+
box-sizing: border-box;
|
|
82
129
|
border: unset;
|
|
83
130
|
z-index: 1100;
|
|
84
131
|
width: 35vw;
|
|
85
|
-
min-width: 20rem;
|
|
132
|
+
min-width: min(20rem, calc(100vw - 2rem));
|
|
133
|
+
max-width: calc(100vw - 2rem);
|
|
134
|
+
height: fit-content;
|
|
135
|
+
max-height: calc(100dvh - 2rem);
|
|
86
136
|
overflow: visible;
|
|
87
137
|
background: var(--fs-solid-background-base);
|
|
88
138
|
border-radius: var(--fs-control-overlay-border-radius);
|
|
139
|
+
&.position-top-start,
|
|
140
|
+
&.position-top-center,
|
|
141
|
+
&.position-top-end {
|
|
142
|
+
margin-block-start: 0;
|
|
143
|
+
}
|
|
144
|
+
&.position-bottom-start,
|
|
145
|
+
&.position-bottom-center,
|
|
146
|
+
&.position-bottom-end {
|
|
147
|
+
margin-block-end: 0;
|
|
148
|
+
}
|
|
149
|
+
&.position-top-start,
|
|
150
|
+
&.position-middle-start,
|
|
151
|
+
&.position-bottom-start {
|
|
152
|
+
margin-inline-start: 0;
|
|
153
|
+
}
|
|
154
|
+
&.position-top-end,
|
|
155
|
+
&.position-middle-end,
|
|
156
|
+
&.position-bottom-end {
|
|
157
|
+
margin-inline-end: 0;
|
|
158
|
+
}
|
|
89
159
|
&::backdrop {
|
|
160
|
+
opacity: 0;
|
|
90
161
|
background-color: var(--fs-smoke-background-default);
|
|
91
162
|
backdrop-filter: blur(0.25rem);
|
|
163
|
+
transition:
|
|
164
|
+
opacity var(--fs-dialog-effective-duration) var(--fs-soft-dismiss, cubic-bezier(1, 0, 1, 1)),
|
|
165
|
+
display var(--fs-dialog-effective-duration) allow-discrete,
|
|
166
|
+
overlay var(--fs-dialog-effective-duration) allow-discrete;
|
|
167
|
+
}
|
|
168
|
+
&[open]::backdrop {
|
|
169
|
+
opacity: 1;
|
|
170
|
+
transition-timing-function: var(--fs-fast-dismiss, cubic-bezier(0, 0, 0, 1));
|
|
92
171
|
}
|
|
93
172
|
& .dialog-wrapper {
|
|
94
173
|
position: relative;
|
|
@@ -98,7 +177,7 @@
|
|
|
98
177
|
display: grid;
|
|
99
178
|
grid-template-rows: auto 1fr;
|
|
100
179
|
width: 100%;
|
|
101
|
-
max-height:
|
|
180
|
+
max-height: calc(100dvh - 2rem);
|
|
102
181
|
overflow: hidden;
|
|
103
182
|
background: var(--fs-layer-alt);
|
|
104
183
|
&::before {
|
|
@@ -121,4 +200,18 @@
|
|
|
121
200
|
}
|
|
122
201
|
}
|
|
123
202
|
}
|
|
203
|
+
/* Pseudo-elements need a separate starting-style rule rather than nested &. */
|
|
204
|
+
@starting-style {
|
|
205
|
+
.fs-dialog[open]::backdrop {
|
|
206
|
+
opacity: 0;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
:global(:root[data-fs-reduced-motion='true']) .fs-dialog {
|
|
210
|
+
--fs-dialog-effective-duration: 0ms;
|
|
211
|
+
}
|
|
212
|
+
@media (prefers-reduced-motion: reduce) {
|
|
213
|
+
:global(:root:not([data-fs-reduced-motion='false'])) .fs-dialog {
|
|
214
|
+
--fs-dialog-effective-duration: 0ms;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
124
217
|
</style>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
let {
|
|
11
11
|
as = 'h3' as T,
|
|
12
|
-
ref = $bindable(),
|
|
12
|
+
ref = $bindable(null),
|
|
13
13
|
id = FALLBACK_ID,
|
|
14
14
|
class: classes,
|
|
15
15
|
children,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
});
|
|
39
39
|
</script>
|
|
40
40
|
|
|
41
|
-
<svelte:element this={_as} {id} class={['dialog-title', classes]} bind:this={ref}
|
|
41
|
+
<svelte:element this={_as} {...attributes} {id} class={['dialog-title', classes]} bind:this={ref}>
|
|
42
42
|
{@render children?.()}
|
|
43
43
|
</svelte:element>
|
|
44
44
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { getDialogContext } from './dialog.svelte.js';
|
|
5
5
|
import type { DialogTriggerProps } from './types.js';
|
|
6
6
|
|
|
7
|
-
let { ref = $bindable(), class: classes, onclick, children, ...attributes }: DialogTriggerProps = $props();
|
|
7
|
+
let { ref = $bindable(null), class: classes, onclick, children, ...attributes }: DialogTriggerProps = $props();
|
|
8
8
|
|
|
9
9
|
const CONTEXT = getDialogContext();
|
|
10
10
|
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<Button
|
|
19
|
+
{...attributes}
|
|
19
20
|
bind:ref
|
|
20
21
|
class={['dialog-trigger', classes]}
|
|
21
22
|
onclick={(e: MouseEvent) => invokeHandlers(e, [], [onclick, methods.openDialog])}
|
|
22
|
-
{...attributes}
|
|
23
23
|
>
|
|
24
24
|
{#if children}
|
|
25
25
|
{@render children()}
|
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
import { setDialogContext } from './dialog.svelte.js';
|
|
3
3
|
import type { DialogContext, DialogProps } from './types.js';
|
|
4
4
|
|
|
5
|
-
let {
|
|
5
|
+
let {
|
|
6
|
+
type = 'modal',
|
|
7
|
+
position = 'middle-center',
|
|
8
|
+
animation = 'zoom',
|
|
9
|
+
duration = 'normal',
|
|
10
|
+
open = $bindable(null),
|
|
11
|
+
onOpenChange,
|
|
12
|
+
children
|
|
13
|
+
}: DialogProps = $props();
|
|
6
14
|
|
|
7
15
|
let dialogRef: HTMLDialogElement | undefined = $state();
|
|
8
16
|
|
|
@@ -12,6 +20,15 @@
|
|
|
12
20
|
config: {
|
|
13
21
|
get type() {
|
|
14
22
|
return type;
|
|
23
|
+
},
|
|
24
|
+
get position() {
|
|
25
|
+
return position;
|
|
26
|
+
},
|
|
27
|
+
get animation() {
|
|
28
|
+
return animation;
|
|
29
|
+
},
|
|
30
|
+
get duration() {
|
|
31
|
+
return duration;
|
|
15
32
|
}
|
|
16
33
|
},
|
|
17
34
|
state: {
|
|
@@ -34,19 +51,13 @@
|
|
|
34
51
|
events: null,
|
|
35
52
|
methods: {
|
|
36
53
|
openDialog: () => {
|
|
37
|
-
if (type !== 'non-modal')
|
|
38
|
-
|
|
39
|
-
} else {
|
|
40
|
-
open = true;
|
|
41
|
-
}
|
|
54
|
+
if (type !== 'non-modal') dialogRef?.showModal();
|
|
55
|
+
open = true;
|
|
42
56
|
onOpenChange?.(true);
|
|
43
57
|
},
|
|
44
58
|
closeDialog: () => {
|
|
45
|
-
if (type !== 'non-modal')
|
|
46
|
-
|
|
47
|
-
} else {
|
|
48
|
-
open = false;
|
|
49
|
-
}
|
|
59
|
+
if (type !== 'non-modal') dialogRef?.close();
|
|
60
|
+
open = false;
|
|
50
61
|
onOpenChange?.(false);
|
|
51
62
|
}
|
|
52
63
|
}
|
|
@@ -45,6 +45,40 @@ The Dialog is composed of several components that work together through a shared
|
|
|
45
45
|
|
|
46
46
|
## Examples
|
|
47
47
|
|
|
48
|
+
### Position
|
|
49
|
+
|
|
50
|
+
Set `position` on `Dialog` to combine `top`, `middle`, or `bottom` with `start`, `center`, or `end`, for example `top-end` or `bottom-start`. The default is `middle-center`.
|
|
51
|
+
|
|
52
|
+
Start and end follow the text direction, so `top-start` sits on the right in RTL. All positions keep a 1rem gap from viewport edges and work with modal, non-modal, and alert dialogs. Changing `position` moves an open dialog without closing it.
|
|
53
|
+
|
|
54
|
+
```svelte
|
|
55
|
+
<Dialog position="top-end">
|
|
56
|
+
<DialogTrigger>Open Dialog</DialogTrigger>
|
|
57
|
+
<DialogSurface>
|
|
58
|
+
<DialogTitle>Dialog Title</DialogTitle>
|
|
59
|
+
<DialogContent>Dialog body content.</DialogContent>
|
|
60
|
+
</DialogSurface>
|
|
61
|
+
</Dialog>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Entrance and Exit Motion
|
|
65
|
+
|
|
66
|
+
`animation` selects `fade`, `zoom`, `slide`, or `bounce` for both directions. The default is `zoom`. Zoom enters from 88% scale and exits to 90%; slide travels 16px, from above for top positions and below otherwise. Bounce uses a small scale overshoot with Fluent's strong-invoke curve.
|
|
67
|
+
|
|
68
|
+
`duration` defaults to `normal`. Theme names are `fast`, `normal`, `slow`, `slower`, `very-slow`, and `extra-slow`, matching `--fs-<name>-duration`. A CSS custom property name such as `--fs-fast-duration` is also accepted. Numbers are milliseconds; `0` disables motion.
|
|
69
|
+
|
|
70
|
+
```svelte
|
|
71
|
+
<Dialog animation="slide" duration={200} position="bottom-end">
|
|
72
|
+
<DialogTrigger>Open Dialog</DialogTrigger>
|
|
73
|
+
<DialogSurface>
|
|
74
|
+
<DialogTitle>Dialog Title</DialogTitle>
|
|
75
|
+
<DialogContent>Dialog body content.</DialogContent>
|
|
76
|
+
</DialogSurface>
|
|
77
|
+
</Dialog>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Motion is implemented with CSS `@starting-style` and discrete `display`/`overlay` transitions. Calling `closeDialog()` updates `open` and releases native modal focus immediately; CSS keeps the surface and backdrop painted until the exit ends. Browsers without these CSS features open and close immediately. The OS reduced-motion preference and FluentUISvelte's app preference disable motion, including numeric durations; an explicit app preference takes priority over the OS.
|
|
81
|
+
|
|
48
82
|
### With Actions
|
|
49
83
|
|
|
50
84
|
Add a `DialogActions` region to render action buttons in the dialog footer. Use `bind:this` on the `Dialog` to call `closeDialog()` programmatically.
|
|
@@ -83,12 +117,15 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
|
|
|
83
117
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
84
118
|
<!-- props:DialogProps -->
|
|
85
119
|
|
|
86
|
-
| Name | Type
|
|
87
|
-
| ----------------- |
|
|
88
|
-
| `type` | `'modal'` | `'non-modal'` | `'alert'`
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
120
|
+
| Name | Type | Default | Description |
|
|
121
|
+
| ----------------- | -------------------------------------------------------------------------- | ----------------- | ---------------------------------------------------------------------------------------------------- |
|
|
122
|
+
| `type` | `'modal'` | `'non-modal'` | `'alert'` | `'modal'` | How the dialog behaves once open. |
|
|
123
|
+
| `position` | [`DialogPosition`](https://fluentui-svelte.dev/docs/types/#dialogposition) | `'middle-center'` | Where the dialog sits in the viewport. Start and end follow the text direction. |
|
|
124
|
+
| `animation` | `'fade'` | `'zoom'` | `'slide'` | `'bounce'` | `'zoom'` | The entrance and exit animation. Bounce uses a subtle overshoot. |
|
|
125
|
+
| `duration` | [`DialogDuration`](https://fluentui-svelte.dev/docs/types/#dialogduration) | `'normal'` | Duration in milliseconds, a theme duration name, or a CSS custom property name. Use 0 for no motion. |
|
|
126
|
+
| `open` _bindable_ | `boolean` | `null` | | Controls the open state of the dialog. |
|
|
127
|
+
| `onOpenChange` | `(open: boolean) => void` | | Called whenever the dialog opens or closes. |
|
|
128
|
+
| `children` | `Snippet` | | The parts of the dialog: a trigger and a surface. |
|
|
92
129
|
|
|
93
130
|
<!-- /props:DialogProps -->
|
|
94
131
|
|
|
@@ -97,10 +134,10 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
|
|
|
97
134
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
98
135
|
<!-- props:DialogTriggerProps -->
|
|
99
136
|
|
|
100
|
-
| Name | Type
|
|
101
|
-
| ----------------------- |
|
|
102
|
-
| `ref` _bindable_ | `HTMLButtonElement` | | The DOM reference of the trigger element. |
|
|
103
|
-
| `ButtonProps<'button'>` |
|
|
137
|
+
| Name | Type | Default | Description |
|
|
138
|
+
| ----------------------- | --------------------------------- | ------- | ----------------------------------------- |
|
|
139
|
+
| `ref` _bindable_ | `HTMLButtonElement` | `null` | | The DOM reference of the trigger element. |
|
|
140
|
+
| `ButtonProps<'button'>` | | | |
|
|
104
141
|
|
|
105
142
|
<!-- /props:DialogTriggerProps -->
|
|
106
143
|
|
|
@@ -109,10 +146,10 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
|
|
|
109
146
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
110
147
|
<!-- props:DialogSurfaceProps -->
|
|
111
148
|
|
|
112
|
-
| Name | Type
|
|
113
|
-
| ----------------------------- |
|
|
114
|
-
| `ref` _bindable_ | `HTMLDialogElement` | | The DOM reference of the dialog element. |
|
|
115
|
-
| Element Attributes (`dialog`) |
|
|
149
|
+
| Name | Type | Default | Description |
|
|
150
|
+
| ----------------------------- | --------------------------------- | ------- | ---------------------------------------- |
|
|
151
|
+
| `ref` _bindable_ | `HTMLDialogElement` | `null` | | The DOM reference of the dialog element. |
|
|
152
|
+
| Element Attributes (`dialog`) | | | |
|
|
116
153
|
|
|
117
154
|
<!-- /props:DialogSurfaceProps -->
|
|
118
155
|
|
|
@@ -134,10 +171,10 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
|
|
|
134
171
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
135
172
|
<!-- props:DialogContentProps -->
|
|
136
173
|
|
|
137
|
-
| Name | Type
|
|
138
|
-
| -------------------------- |
|
|
139
|
-
| `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the content element. |
|
|
140
|
-
| Element Attributes (`div`) |
|
|
174
|
+
| Name | Type | Default | Description |
|
|
175
|
+
| -------------------------- | ------------------------------ | ------- | ----------------------------------------- |
|
|
176
|
+
| `ref` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the content element. |
|
|
177
|
+
| Element Attributes (`div`) | | | |
|
|
141
178
|
|
|
142
179
|
<!-- /props:DialogContentProps -->
|
|
143
180
|
|
|
@@ -148,7 +185,7 @@ Add a `DialogActions` region to render action buttons in the dialog footer. Use
|
|
|
148
185
|
|
|
149
186
|
| Name | Type | Default | Description |
|
|
150
187
|
| -------------------------- | ------------------------------------------ | ------- | ----------------------------------------------------------- |
|
|
151
|
-
| `ref` _bindable_ | `HTMLDivElement`
|
|
188
|
+
| `ref` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the actions element. |
|
|
152
189
|
| `fluid` | `boolean` | | Stretches every action to share the available width evenly. |
|
|
153
190
|
| `position` | `'start'` | `'center'` | `'end'` | `'end'` | Where the actions sit along the main axis. |
|
|
154
191
|
| Element Attributes (`div`) | | | |
|
|
@@ -4,6 +4,9 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
4
4
|
import type { ButtonProps } from '../button/types.ts';
|
|
5
5
|
import type { PolymorphicProps, XDirection } from '../../types/index.js';
|
|
6
6
|
export type DialogType = 'modal' | 'non-modal' | 'alert';
|
|
7
|
+
export type DialogAnimation = 'fade' | 'zoom' | 'slide' | 'bounce';
|
|
8
|
+
export type DialogDuration = number | 'fast' | 'normal' | 'slow' | 'slower' | 'very-slow' | 'extra-slow' | `--${string}`;
|
|
9
|
+
export type DialogPosition = 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-center' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
7
10
|
export type DialogTitleTag = 'div' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
8
11
|
/** @propsmith DialogProps */
|
|
9
12
|
export type DialogProps = {
|
|
@@ -17,10 +20,22 @@ export type DialogProps = {
|
|
|
17
20
|
* @default 'modal'
|
|
18
21
|
*/
|
|
19
22
|
type?: DialogType;
|
|
23
|
+
/** Where the dialog sits in the viewport. Start and end follow the text direction.
|
|
24
|
+
* @default 'middle-center'
|
|
25
|
+
*/
|
|
26
|
+
position?: DialogPosition;
|
|
27
|
+
/** The entrance and exit animation. Bounce uses a subtle overshoot.
|
|
28
|
+
* @default 'zoom'
|
|
29
|
+
*/
|
|
30
|
+
animation?: DialogAnimation;
|
|
31
|
+
/** Duration in milliseconds, a theme duration name, or a CSS custom property name. Use 0 for no motion.
|
|
32
|
+
* @default 'normal'
|
|
33
|
+
*/
|
|
34
|
+
duration?: DialogDuration;
|
|
20
35
|
/** Controls the open state of the dialog.
|
|
21
36
|
* @bindable
|
|
22
37
|
*/
|
|
23
|
-
open?: boolean;
|
|
38
|
+
open?: boolean | null;
|
|
24
39
|
/** Called whenever the dialog opens or closes. */
|
|
25
40
|
onOpenChange?: (open: boolean) => void;
|
|
26
41
|
/** The parts of the dialog: a trigger and a surface. */
|
|
@@ -31,28 +46,28 @@ export type DialogSurfaceProps = {
|
|
|
31
46
|
/** The DOM reference of the dialog element.
|
|
32
47
|
* @bindable
|
|
33
48
|
*/
|
|
34
|
-
ref?: HTMLDialogElement;
|
|
49
|
+
ref?: HTMLDialogElement | null;
|
|
35
50
|
} & HTMLAttributes<HTMLDialogElement>;
|
|
36
51
|
/** @propsmith DialogTriggerProps */
|
|
37
52
|
export type DialogTriggerProps = {
|
|
38
53
|
/** The DOM reference of the trigger element.
|
|
39
54
|
* @bindable
|
|
40
55
|
*/
|
|
41
|
-
ref?: HTMLButtonElement;
|
|
56
|
+
ref?: HTMLButtonElement | null;
|
|
42
57
|
} & ButtonProps<'button'>;
|
|
43
58
|
/** @propsmith DialogContentProps */
|
|
44
59
|
export type DialogContentProps = {
|
|
45
60
|
/** The DOM reference of the content element.
|
|
46
61
|
* @bindable
|
|
47
62
|
*/
|
|
48
|
-
ref?: HTMLDivElement;
|
|
63
|
+
ref?: HTMLDivElement | null;
|
|
49
64
|
} & HTMLAttributes<HTMLDivElement>;
|
|
50
65
|
/** @propsmith DialogActionsProps */
|
|
51
66
|
export type DialogActionsProps = {
|
|
52
67
|
/** The DOM reference of the actions element.
|
|
53
68
|
* @bindable
|
|
54
69
|
*/
|
|
55
|
-
ref?: HTMLDivElement;
|
|
70
|
+
ref?: HTMLDivElement | null;
|
|
56
71
|
/** Stretches every action to share the available width evenly. */
|
|
57
72
|
fluid?: boolean;
|
|
58
73
|
/** Where the actions sit along the main axis.
|
|
@@ -75,7 +90,7 @@ export type DialogTitleProps<T extends DialogTitleTag> = {
|
|
|
75
90
|
* @type HTMLDivElement | HTMLHeadingElement
|
|
76
91
|
* @bindable
|
|
77
92
|
*/
|
|
78
|
-
ref?: DialogTitleRefType[T];
|
|
93
|
+
ref?: DialogTitleRefType[T] | null;
|
|
79
94
|
/** The HTML element to render the title as.
|
|
80
95
|
* @type DialogTitleTag
|
|
81
96
|
* @default 'h3'
|
|
@@ -84,9 +99,12 @@ export type DialogTitleProps<T extends DialogTitleTag> = {
|
|
|
84
99
|
} & PolymorphicProps<T>;
|
|
85
100
|
export type DialogContext = FSContext<{
|
|
86
101
|
type: DialogType;
|
|
102
|
+
position: DialogPosition;
|
|
103
|
+
animation: DialogAnimation;
|
|
104
|
+
duration: DialogDuration;
|
|
87
105
|
}, {
|
|
88
106
|
dialogRef: HTMLDialogElement | undefined;
|
|
89
|
-
readonly open: boolean | undefined;
|
|
107
|
+
readonly open: boolean | null | undefined;
|
|
90
108
|
/** Set by `DialogTitle`, to allow the surface pointing `aria-labelledby` at it. */
|
|
91
109
|
titleId: string | undefined;
|
|
92
110
|
}, null, {
|