fluentui-svelte 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/app-surface/app-surface.svelte +96 -0
- package/dist/components/app-surface/app-surface.svelte.d.ts +22 -0
- package/dist/components/app-surface/docs/llms.md +73 -0
- package/dist/components/app-surface/types.d.ts +19 -0
- package/dist/components/app-surface/types.js +1 -0
- package/dist/components/app-window/app-window.d.ts +3 -0
- package/dist/components/app-window/app-window.js +3 -0
- package/dist/components/app-window/app-window.svelte +193 -0
- package/dist/components/app-window/app-window.svelte.d.ts +25 -0
- package/dist/components/app-window/docs/llms.md +119 -0
- package/dist/components/app-window/types.d.ts +66 -0
- package/dist/components/app-window/types.js +1 -0
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte +47 -31
- package/dist/components/auto-suggest-box/auto-suggest-box.svelte.d.ts +2 -2
- package/dist/components/auto-suggest-box/docs/llms.md +34 -33
- package/dist/components/auto-suggest-box/option.svelte +6 -4
- package/dist/components/auto-suggest-box/types.d.ts +13 -16
- package/dist/components/avatar/avatar.svelte +4 -3
- package/dist/components/avatar/docs/llms.md +1 -1
- package/dist/components/avatar/type.d.ts +1 -1
- package/dist/components/badge/badge-icon.svelte +2 -2
- package/dist/components/badge/badge.svelte +2 -2
- package/dist/components/badge/docs/llms.md +2 -2
- package/dist/components/badge/types.d.ts +2 -2
- package/dist/components/breadcrumb/breadcrumb-button.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-divider.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb-item.svelte +2 -2
- package/dist/components/breadcrumb/breadcrumb.svelte +10 -5
- package/dist/components/breadcrumb/docs/llms.md +11 -11
- package/dist/components/breadcrumb/types.d.ts +7 -7
- package/dist/components/button/button.svelte +2 -2
- package/dist/components/button/docs/llms.md +17 -17
- package/dist/components/button/split-button.svelte +7 -7
- package/dist/components/button/types.d.ts +5 -5
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte +98 -10
- package/dist/components/calendar-date-picker/calendar-date-picker.svelte.d.ts +1 -1
- package/dist/components/calendar-date-picker/docs/llms.md +19 -14
- package/dist/components/calendar-date-picker/types.d.ts +22 -8
- package/dist/components/calendar-view/calendar-view-days.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-grid.js +8 -3
- package/dist/components/calendar-view/calendar-view-item.svelte +10 -4
- package/dist/components/calendar-view/calendar-view-months.svelte +3 -2
- package/dist/components/calendar-view/calendar-view-years.svelte +3 -2
- package/dist/components/calendar-view/calendar-view.svelte +11 -4
- package/dist/components/calendar-view/calendar-view.svelte.js +5 -0
- package/dist/components/calendar-view/docs/llms.md +20 -19
- package/dist/components/calendar-view/types.d.ts +6 -1
- package/dist/components/card/card-footer.svelte +2 -2
- package/dist/components/card/card-header.svelte +5 -4
- package/dist/components/card/card-preview.svelte +13 -2
- package/dist/components/card/card.svelte +5 -5
- package/dist/components/card/docs/llms.md +22 -21
- package/dist/components/card/types.d.ts +8 -4
- package/dist/components/checkbox/checkbox.svelte +47 -26
- package/dist/components/checkbox/checkbox.svelte.d.ts +3 -24
- package/dist/components/checkbox/docs/llms.md +24 -23
- package/dist/components/checkbox/types.d.ts +10 -23
- package/dist/components/date-picker/date-picker.svelte +98 -27
- package/dist/components/date-picker/date-picker.svelte.d.ts +1 -1
- package/dist/components/date-picker/docs/llms.md +23 -20
- package/dist/components/date-picker/types.d.ts +24 -15
- package/dist/components/dialog/dialog-actions.svelte +17 -2
- package/dist/components/dialog/dialog-content.svelte +2 -2
- package/dist/components/dialog/dialog-content.svelte.d.ts +1 -1
- package/dist/components/dialog/dialog-surface.svelte +130 -8
- package/dist/components/dialog/dialog-title.svelte +23 -6
- package/dist/components/dialog/dialog-trigger.svelte +8 -2
- package/dist/components/dialog/dialog-trigger.svelte.d.ts +1 -1
- package/dist/components/dialog/dialog.svelte +22 -11
- package/dist/components/dialog/docs/llms.md +56 -19
- package/dist/components/dialog/types.d.ts +31 -9
- package/dist/components/dialog/utils.d.ts +2 -0
- package/dist/components/dialog/utils.js +1 -0
- package/dist/components/divider/divider.svelte +6 -4
- package/dist/components/divider/types.d.ts +1 -1
- package/dist/components/dropdown/docs/llms.md +30 -28
- package/dist/components/dropdown/dropdown-option.svelte +17 -5
- package/dist/components/dropdown/dropdown.svelte +182 -84
- package/dist/components/dropdown/dropdown.svelte.d.ts +1 -1
- package/dist/components/dropdown/types.d.ts +26 -20
- package/dist/components/dropdown-select/docs/llms.md +24 -22
- package/dist/components/dropdown-select/dropdown-select-option.svelte +2 -2
- package/dist/components/dropdown-select/dropdown-select.svelte +42 -7
- package/dist/components/dropdown-select/types.d.ts +4 -4
- package/dist/components/expander/docs/llms.md +3 -3
- package/dist/components/expander/expander.svelte +13 -8
- package/dist/components/expander/types.d.ts +5 -5
- package/dist/components/flyout/docs/llms.md +1 -1
- package/dist/components/flyout/flyout.svelte +17 -6
- package/dist/components/flyout/types.d.ts +1 -1
- package/dist/components/hyperlink/docs/llms.md +6 -6
- package/dist/components/hyperlink/hyperlink.svelte +13 -4
- package/dist/components/hyperlink/types.d.ts +1 -1
- package/dist/components/info-bar/docs/llms.md +11 -10
- package/dist/components/info-bar/info-bar.svelte +3 -2
- package/dist/components/info-bar/types.d.ts +4 -0
- package/dist/components/label/docs/llms.md +75 -22
- package/dist/components/label/label-context.d.ts +14 -0
- package/dist/components/label/label-context.js +10 -0
- package/dist/components/label/label.svelte +153 -30
- package/dist/components/label/label.svelte.d.ts +1 -1
- package/dist/components/label/types.d.ts +48 -4
- package/dist/components/list-view/docs/llms.md +103 -33
- package/dist/components/list-view/list-view-item-branch.svelte +257 -0
- package/dist/components/list-view/list-view-item-branch.svelte.d.ts +4 -0
- package/dist/components/list-view/list-view-item.svelte +164 -46
- package/dist/components/list-view/list-view-item.svelte.d.ts +5 -5
- package/dist/components/list-view/list-view.svelte +73 -25
- package/dist/components/list-view/types.d.ts +71 -8
- package/dist/components/list-view/utils.d.ts +10 -0
- package/dist/components/list-view/utils.js +17 -1
- package/dist/components/menu/docs/llms.md +98 -15
- package/dist/components/menu/menu-command-bar-item.svelte +61 -0
- package/dist/components/menu/menu-command-bar-item.svelte.d.ts +14 -0
- package/dist/components/menu/menu-command-bar.svelte +218 -0
- package/dist/components/menu/menu-command-bar.svelte.d.ts +21 -0
- package/dist/components/menu/menu-group.svelte +6 -3
- package/dist/components/menu/menu-item-checkbox.svelte +5 -4
- package/dist/components/menu/menu-item-radio.svelte +5 -4
- package/dist/components/menu/menu-item-switch.svelte +5 -4
- package/dist/components/menu/menu-item.svelte +5 -5
- package/dist/components/menu/menu-item.svelte.d.ts +2 -3
- package/dist/components/menu/menu-list.svelte +10 -1
- package/dist/components/menu/menu-popover.svelte +9 -5
- package/dist/components/menu/menu-trigger.svelte +2 -1
- package/dist/components/menu/menu.svelte.js +1 -0
- package/dist/components/menu/types.d.ts +62 -7
- package/dist/components/number-box/docs/llms.md +6 -4
- package/dist/components/number-box/number-box.svelte +35 -29
- package/dist/components/number-box/number-box.svelte.d.ts +1 -1
- package/dist/components/number-box/types.d.ts +1 -1
- package/dist/components/persona/docs/llms.md +29 -25
- package/dist/components/persona/persona.svelte +8 -6
- package/dist/components/persona/types.d.ts +4 -3
- package/dist/components/progress-bar/docs/llms.md +13 -13
- package/dist/components/progress-bar/progress-bar.svelte +6 -6
- package/dist/components/progress-bar/types.d.ts +4 -4
- package/dist/components/progress-ring/docs/llms.md +14 -14
- package/dist/components/progress-ring/progress-ring.svelte +5 -5
- package/dist/components/progress-ring/types.d.ts +3 -3
- package/dist/components/radio-button/docs/llms.md +11 -8
- package/dist/components/radio-button/radio-button.svelte +38 -12
- package/dist/components/radio-button/radio-button.svelte.d.ts +1 -1
- package/dist/components/radio-button/types.d.ts +11 -8
- package/dist/components/rating/docs/llms.md +111 -0
- package/dist/components/rating/rating.svelte +247 -0
- package/dist/components/rating/rating.svelte.d.ts +19 -0
- package/dist/components/rating/types.d.ts +44 -0
- package/dist/components/rating/types.js +1 -0
- package/dist/components/side-nav/docs/llms.md +110 -0
- package/dist/components/side-nav/side-nav-branch.svelte +43 -0
- package/dist/components/side-nav/side-nav-branch.svelte.d.ts +4 -0
- package/dist/components/side-nav/side-nav-item.svelte +75 -0
- package/dist/components/side-nav/side-nav-item.svelte.d.ts +25 -0
- package/dist/components/side-nav/side-nav-list.svelte +32 -0
- package/dist/components/side-nav/side-nav-list.svelte.d.ts +7 -0
- package/dist/components/side-nav/side-nav.d.ts +2 -0
- package/dist/components/side-nav/side-nav.js +2 -0
- package/dist/components/side-nav/side-nav.svelte +355 -0
- package/dist/components/side-nav/side-nav.svelte.d.ts +24 -0
- package/dist/components/side-nav/types.d.ts +149 -0
- package/dist/components/side-nav/types.js +1 -0
- package/dist/components/skeleton/docs/llms.md +1 -1
- package/dist/components/skeleton/skeleton.svelte +2 -2
- package/dist/components/skeleton/types.d.ts +1 -1
- package/dist/components/slider/docs/llms.md +31 -28
- package/dist/components/slider/slider.svelte +126 -61
- package/dist/components/slider/slider.svelte.d.ts +1 -3
- package/dist/components/slider/types.d.ts +21 -14
- package/dist/components/tab-view/docs/llms.md +7 -7
- package/dist/components/tab-view/tab-view-tab.svelte +16 -14
- package/dist/components/tab-view/tab-view.svelte +16 -9
- package/dist/components/tab-view/types.d.ts +6 -6
- package/dist/components/table/docs/llms.md +38 -33
- package/dist/components/table/table-body.svelte +2 -2
- package/dist/components/table/table-cell-actions.svelte +8 -2
- package/dist/components/table/table-cell-layout.svelte +2 -2
- package/dist/components/table/table-cell.svelte +2 -2
- package/dist/components/table/table-header-cell.svelte +2 -2
- package/dist/components/table/table-header.svelte +2 -2
- package/dist/components/table/table-row.svelte +2 -2
- package/dist/components/table/table-selection-cell.svelte +6 -6
- package/dist/components/table/table.svelte +2 -2
- package/dist/components/table/types.d.ts +11 -11
- package/dist/components/tag/docs/llms.md +383 -0
- package/dist/components/tag/tag-group.d.ts +2 -0
- package/dist/components/tag/tag-group.js +2 -0
- package/dist/components/tag/tag-group.svelte +117 -0
- package/dist/components/tag/tag-group.svelte.d.ts +20 -0
- package/dist/components/tag/tag.svelte +459 -0
- package/dist/components/tag/tag.svelte.d.ts +19 -0
- package/dist/components/tag/types.d.ts +137 -0
- package/dist/components/tag/types.js +1 -0
- package/dist/components/tag-picker/docs/llms.md +298 -0
- package/dist/components/tag-picker/option-group.svelte +51 -0
- package/dist/components/tag-picker/option-group.svelte.d.ts +4 -0
- package/dist/components/tag-picker/option.svelte +82 -0
- package/dist/components/tag-picker/option.svelte.d.ts +4 -0
- package/dist/components/tag-picker/tag-picker.d.ts +2 -0
- package/dist/components/tag-picker/tag-picker.js +2 -0
- package/dist/components/tag-picker/tag-picker.svelte +716 -0
- package/dist/components/tag-picker/tag-picker.svelte.d.ts +21 -0
- package/dist/components/tag-picker/types.d.ts +142 -0
- package/dist/components/tag-picker/types.js +1 -0
- package/dist/components/text-box/docs/llms.md +31 -4
- package/dist/components/text-box/text-box-button.svelte +3 -3
- package/dist/components/text-box/text-box-button.svelte.d.ts +1 -1
- package/dist/components/text-box/text-box.svelte +41 -14
- package/dist/components/text-box/types.d.ts +5 -5
- package/dist/components/textarea/docs/llms.md +4 -3
- package/dist/components/textarea/textarea.svelte +14 -6
- package/dist/components/textarea/types.d.ts +2 -4
- package/dist/components/time-picker/docs/llms.md +18 -15
- package/dist/components/time-picker/time-picker.svelte +133 -33
- package/dist/components/time-picker/time-picker.svelte.d.ts +1 -1
- package/dist/components/time-picker/types.d.ts +23 -13
- package/dist/components/title-bar/docs/llms.md +382 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte +215 -0
- package/dist/components/title-bar/title-bar-left-controls.svelte.d.ts +22 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte +190 -0
- package/dist/components/title-bar/title-bar-right-controls.svelte.d.ts +27 -0
- package/dist/components/title-bar/title-bar.d.ts +3 -0
- package/dist/components/title-bar/title-bar.js +4 -0
- package/dist/components/title-bar/title-bar.svelte +224 -0
- package/dist/components/title-bar/title-bar.svelte.d.ts +26 -0
- package/dist/components/title-bar/types.d.ts +165 -0
- package/dist/components/title-bar/types.js +1 -0
- package/dist/components/toggle-switch/docs/llms.md +11 -9
- package/dist/components/toggle-switch/toggle-switch.svelte +23 -14
- package/dist/components/toggle-switch/toggle-switch.svelte.d.ts +1 -1
- package/dist/components/toggle-switch/types.d.ts +12 -10
- package/dist/components/tooltip/docs/llms.md +1 -1
- package/dist/components/tooltip/tooltip.svelte +5 -4
- package/dist/components/tooltip/types.d.ts +1 -1
- package/dist/components/top-nav/docs/llms.md +1 -1
- package/dist/components/top-nav/top-nav-item.svelte +2 -2
- package/dist/components/top-nav/top-nav.svelte +2 -2
- package/dist/components/top-nav/types.d.ts +2 -2
- package/dist/components/tree-view/docs/llms.md +11 -11
- package/dist/components/tree-view/tree-view-item-content.svelte +3 -3
- package/dist/components/tree-view/tree-view-item.svelte +13 -5
- package/dist/components/tree-view/tree-view.svelte +20 -5
- package/dist/components/tree-view/tree-view.svelte.d.ts +1 -1
- package/dist/components/tree-view/tree-view.svelte.js +31 -3
- package/dist/components/tree-view/types.d.ts +7 -3
- package/dist/index.d.ts +25 -0
- package/dist/index.js +32 -0
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte +26 -5
- package/dist/internal/components/dynamic-carousel/dynamic-carousel.svelte.d.ts +2 -0
- package/dist/internal/constants.d.ts +0 -4
- package/dist/internal/constants.js +0 -4002
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +1 -0
- package/dist/internal/native-field.svelte.d.ts +44 -0
- package/dist/internal/native-field.svelte.js +85 -0
- package/dist/internal/utils.d.ts +16 -2
- package/dist/internal/utils.js +25 -3
- package/dist/types/index.d.ts +3 -3
- package/package.json +51 -37
|
@@ -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>;
|
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
import { getTabspotAttributes } from 'tabspot';
|
|
3
3
|
import type { DialogActionsProps } from './types.js';
|
|
4
4
|
|
|
5
|
-
let {
|
|
5
|
+
let {
|
|
6
|
+
ref = $bindable(null),
|
|
7
|
+
position = 'end',
|
|
8
|
+
fluid,
|
|
9
|
+
class: classes,
|
|
10
|
+
children,
|
|
11
|
+
...attributes
|
|
12
|
+
}: DialogActionsProps = $props();
|
|
6
13
|
|
|
7
14
|
// The bar is one tab stop holding a row of buttons: without the mover the root would
|
|
8
15
|
// take the tab stop and then offer no way to reach the rest of the buttons.
|
|
@@ -12,7 +19,12 @@
|
|
|
12
19
|
});
|
|
13
20
|
</script>
|
|
14
21
|
|
|
15
|
-
<div
|
|
22
|
+
<div
|
|
23
|
+
{...attributes}
|
|
24
|
+
class={['dialog-actions', `justify-${position}`, { fluid }, classes]}
|
|
25
|
+
bind:this={ref}
|
|
26
|
+
{...tabspotAttributes}
|
|
27
|
+
>
|
|
16
28
|
{@render children?.()}
|
|
17
29
|
</div>
|
|
18
30
|
|
|
@@ -33,5 +45,8 @@
|
|
|
33
45
|
&.justify-end {
|
|
34
46
|
justify-content: flex-end;
|
|
35
47
|
}
|
|
48
|
+
&.fluid > :global(*) {
|
|
49
|
+
flex: 1 1 0;
|
|
50
|
+
}
|
|
36
51
|
}
|
|
37
52
|
</style>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { DialogContentProps } from './types.js';
|
|
3
3
|
|
|
4
|
-
let { children }: DialogContentProps = $props();
|
|
4
|
+
let { ref = $bindable(null), class: classes, children, ...attributes }: DialogContentProps = $props();
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
<div class=
|
|
7
|
+
<div {...attributes} class={['dialog-content', classes]} bind:this={ref}>
|
|
8
8
|
{@render children?.()}
|
|
9
9
|
</div>
|
|
10
10
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DialogContentProps } from './types.ts';
|
|
2
|
-
declare const DialogContent: import("svelte").Component<DialogContentProps, {}, "">;
|
|
2
|
+
declare const DialogContent: import("svelte").Component<DialogContentProps, {}, "ref">;
|
|
3
3
|
type DialogContent = ReturnType<typeof DialogContent>;
|
|
4
4
|
export default DialogContent;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { onClickOutside } from 'runed';
|
|
3
|
+
import { on } from 'svelte/events';
|
|
3
4
|
import type { DialogSurfaceProps } from './types.js';
|
|
4
5
|
import { getDialogContext } from './dialog.svelte.js';
|
|
5
6
|
import { Button } from '../../index.js';
|
|
6
7
|
import DismissFilled from 'fluentui-icons-svelte/DismissFilled.svelte';
|
|
7
8
|
|
|
8
|
-
let { ref = $bindable(), children, ...attributes }: DialogSurfaceProps = $props();
|
|
9
|
+
let { ref = $bindable(null), class: classes, oncancel, children, ...attributes }: DialogSurfaceProps = $props();
|
|
9
10
|
|
|
10
11
|
const CONTEXT = getDialogContext();
|
|
11
12
|
|
|
@@ -17,22 +18,57 @@
|
|
|
17
18
|
|
|
18
19
|
const { closeDialog } = methods;
|
|
19
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
|
+
|
|
27
|
+
// runed reports an outside press 10ms after the pointer goes down. By then the press that opens the
|
|
28
|
+
// dialog has already opened it, and a press while it is closed has nothing to dismiss, so remember
|
|
29
|
+
// whether the dialog was open at the moment the pointer went down.
|
|
30
|
+
let openOnPointerDown = false;
|
|
31
|
+
|
|
32
|
+
$effect(() => {
|
|
33
|
+
const doc = ref?.ownerDocument;
|
|
34
|
+
if (!doc) return;
|
|
35
|
+
return on(doc, 'pointerdown', () => (openOnPointerDown = !!ref?.open), { capture: true });
|
|
36
|
+
});
|
|
37
|
+
|
|
20
38
|
// Registered unconditionally and guarded from inside, so switching `type` after mount is honored.
|
|
21
39
|
onClickOutside(
|
|
22
40
|
() => ref,
|
|
23
41
|
() => {
|
|
24
|
-
if (config.type === 'alert') return;
|
|
42
|
+
if (config.type === 'alert' || !openOnPointerDown) return;
|
|
25
43
|
closeDialog();
|
|
26
44
|
}
|
|
27
45
|
);
|
|
28
46
|
|
|
47
|
+
// Escape cancels a modal dialog natively. An alert has to be answered with one of its actions, and any
|
|
48
|
+
// other modal closes through `closeDialog` so `onOpenChange` hears about it. A consumer's `oncancel`
|
|
49
|
+
// can still veto it with `preventDefault`.
|
|
50
|
+
function handleCancel(e: Event & { currentTarget: EventTarget & HTMLDialogElement }) {
|
|
51
|
+
oncancel?.(e);
|
|
52
|
+
if (e.defaultPrevented) return;
|
|
53
|
+
e.preventDefault();
|
|
54
|
+
if (config.type !== 'alert') closeDialog();
|
|
55
|
+
}
|
|
56
|
+
|
|
29
57
|
$effect(() => {
|
|
30
58
|
if (!ref) return;
|
|
31
59
|
_state.dialogRef = ref;
|
|
32
60
|
});
|
|
33
61
|
</script>
|
|
34
62
|
|
|
35
|
-
<dialog
|
|
63
|
+
<dialog
|
|
64
|
+
{...attributes}
|
|
65
|
+
open={_state.open}
|
|
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']}
|
|
69
|
+
bind:this={ref}
|
|
70
|
+
oncancel={handleCancel}
|
|
71
|
+
>
|
|
36
72
|
<div class="dialog-wrapper">
|
|
37
73
|
{#if config.type === 'non-modal'}
|
|
38
74
|
<Button class="close-icon" appearance="subtle" onclick={() => methods.closeDialog()} aria-label="Close dialog">
|
|
@@ -45,21 +81,93 @@
|
|
|
45
81
|
|
|
46
82
|
<style>
|
|
47
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
|
+
}
|
|
48
124
|
position: fixed;
|
|
49
|
-
|
|
50
|
-
|
|
125
|
+
inset: 1rem;
|
|
126
|
+
margin: auto;
|
|
51
127
|
padding: 0;
|
|
52
|
-
|
|
128
|
+
box-sizing: border-box;
|
|
53
129
|
border: unset;
|
|
54
130
|
z-index: 1100;
|
|
55
131
|
width: 35vw;
|
|
56
|
-
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);
|
|
57
136
|
overflow: visible;
|
|
58
137
|
background: var(--fs-solid-background-base);
|
|
59
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
|
+
}
|
|
60
159
|
&::backdrop {
|
|
160
|
+
opacity: 0;
|
|
61
161
|
background-color: var(--fs-smoke-background-default);
|
|
62
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));
|
|
63
171
|
}
|
|
64
172
|
& .dialog-wrapper {
|
|
65
173
|
position: relative;
|
|
@@ -69,7 +177,7 @@
|
|
|
69
177
|
display: grid;
|
|
70
178
|
grid-template-rows: auto 1fr;
|
|
71
179
|
width: 100%;
|
|
72
|
-
max-height:
|
|
180
|
+
max-height: calc(100dvh - 2rem);
|
|
73
181
|
overflow: hidden;
|
|
74
182
|
background: var(--fs-layer-alt);
|
|
75
183
|
&::before {
|
|
@@ -92,4 +200,18 @@
|
|
|
92
200
|
}
|
|
93
201
|
}
|
|
94
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
|
+
}
|
|
95
217
|
</style>
|
|
@@ -1,19 +1,36 @@
|
|
|
1
1
|
<script lang="ts" generics="T extends DialogTitleTag">
|
|
2
2
|
import { PREFIX } from '../../internal/constants.js';
|
|
3
3
|
import { getDialogContext } from './dialog.svelte.js';
|
|
4
|
+
import { TITLE_TAG } from './utils.js';
|
|
4
5
|
import type { DialogTitleProps, DialogTitleTag } from './types.js';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
const _ID = $props.id();
|
|
8
|
+
const FALLBACK_ID = `${PREFIX}dialog-title-${_ID}`;
|
|
9
|
+
|
|
10
|
+
let {
|
|
11
|
+
as = 'h3' as T,
|
|
12
|
+
ref = $bindable(null),
|
|
13
|
+
id = FALLBACK_ID,
|
|
14
|
+
class: classes,
|
|
15
|
+
children,
|
|
16
|
+
...attributes
|
|
17
|
+
}: DialogTitleProps<T> = $props();
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The tag the invariant rules over. The markup renders it through here, so it is checked
|
|
21
|
+
* during SSR and on every prop update rather than only once on mount.
|
|
22
|
+
*/
|
|
23
|
+
const _as = $derived.by(() => {
|
|
24
|
+
if (!TITLE_TAG.includes(as)) throw new Error(`Invalid tag: ${as}. Must be one of ${TITLE_TAG.join(', ')}`);
|
|
25
|
+
return as;
|
|
26
|
+
});
|
|
10
27
|
|
|
11
28
|
const context = getDialogContext();
|
|
12
29
|
|
|
13
30
|
$effect.pre(() => {
|
|
14
31
|
if (!context) return;
|
|
15
32
|
|
|
16
|
-
context.state.titleId =
|
|
33
|
+
context.state.titleId = id ?? undefined;
|
|
17
34
|
|
|
18
35
|
return () => {
|
|
19
36
|
context.state.titleId = undefined;
|
|
@@ -21,7 +38,7 @@
|
|
|
21
38
|
});
|
|
22
39
|
</script>
|
|
23
40
|
|
|
24
|
-
<svelte:element this={
|
|
41
|
+
<svelte:element this={_as} {...attributes} {id} class={['dialog-title', classes]} bind:this={ref}>
|
|
25
42
|
{@render children?.()}
|
|
26
43
|
</svelte:element>
|
|
27
44
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Button } from '../../index.js';
|
|
3
|
+
import { invokeHandlers } from '../../internal/index.js';
|
|
3
4
|
import { getDialogContext } from './dialog.svelte.js';
|
|
4
5
|
import type { DialogTriggerProps } from './types.js';
|
|
5
6
|
|
|
6
|
-
let { children }: DialogTriggerProps = $props();
|
|
7
|
+
let { ref = $bindable(null), class: classes, onclick, children, ...attributes }: DialogTriggerProps = $props();
|
|
7
8
|
|
|
8
9
|
const CONTEXT = getDialogContext();
|
|
9
10
|
|
|
@@ -14,7 +15,12 @@
|
|
|
14
15
|
const { methods } = CONTEXT;
|
|
15
16
|
</script>
|
|
16
17
|
|
|
17
|
-
<Button
|
|
18
|
+
<Button
|
|
19
|
+
{...attributes}
|
|
20
|
+
bind:ref
|
|
21
|
+
class={['dialog-trigger', classes]}
|
|
22
|
+
onclick={(e: MouseEvent) => invokeHandlers(e, [], [onclick, methods.openDialog])}
|
|
23
|
+
>
|
|
18
24
|
{#if children}
|
|
19
25
|
{@render children()}
|
|
20
26
|
{:else}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { DialogTriggerProps } from './types.ts';
|
|
2
|
-
declare const DialogTrigger: import("svelte").Component<DialogTriggerProps, {}, "">;
|
|
2
|
+
declare const DialogTrigger: import("svelte").Component<DialogTriggerProps, {}, "ref">;
|
|
3
3
|
type DialogTrigger = ReturnType<typeof DialogTrigger>;
|
|
4
4
|
export default DialogTrigger;
|
|
@@ -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
|
}
|