fluentui-svelte 0.2.0 → 0.3.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/auto-suggest-box/auto-suggest-box.svelte +68 -56
- package/dist/components/auto-suggest-box/docs/llms.md +46 -14
- package/dist/components/auto-suggest-box/option.svelte +2 -1
- package/dist/components/avatar/docs/llms.md +20 -14
- package/dist/components/badge/docs/llms.md +29 -16
- package/dist/components/button/button.svelte +11 -5
- package/dist/components/button/docs/llms.md +33 -24
- package/dist/components/calendar-date-picker/docs/llms.md +17 -7
- package/dist/components/calendar-view/calendar-view-header.svelte +2 -2
- package/dist/components/calendar-view/calendar-view-header.svelte.d.ts +2 -17
- package/dist/components/calendar-view/calendar-view-months.svelte +1 -1
- package/dist/components/calendar-view/calendar-view-years.svelte +1 -1
- package/dist/components/calendar-view/calendar-view.svelte +66 -52
- package/dist/components/calendar-view/docs/llms.md +42 -30
- package/dist/components/card/docs/llms.md +54 -34
- package/dist/components/checkbox/docs/llms.md +18 -12
- package/dist/components/date-picker/docs/llms.md +25 -15
- package/dist/components/dialog/dialog-surface.svelte +8 -8
- package/dist/components/dialog/dialog.svelte +41 -39
- package/dist/components/dialog/docs/llms.md +59 -34
- package/dist/components/divider/docs/llms.md +14 -9
- package/dist/components/dropdown/docs/llms.md +34 -15
- package/dist/components/dropdown/dropdown.svelte +4 -2
- package/dist/components/dropdown-select/docs/llms.md +28 -14
- package/dist/components/expander/docs/llms.md +19 -12
- package/dist/components/flyout/docs/llms.md +17 -11
- package/dist/components/hyperlink/docs/llms.md +11 -7
- package/dist/components/info-bar/docs/llms.md +15 -9
- package/dist/components/label/docs/llms.md +15 -11
- package/dist/components/list-view/docs/llms.md +34 -24
- package/dist/components/list-view/list-view-item.svelte +10 -4
- package/dist/components/list-view/list-view.svelte +68 -63
- package/dist/components/menu/context-menu-trigger.svelte +45 -40
- package/dist/components/menu/docs/llms.md +63 -34
- package/dist/components/menu/menu-item-checkbox.svelte +3 -1
- package/dist/components/menu/menu-item-radio.svelte +3 -1
- package/dist/components/menu/menu-item-switch.svelte +3 -1
- package/dist/components/menu/menu-item.svelte +5 -1
- package/dist/components/menu/menu-popover.svelte +21 -10
- package/dist/components/menu/menu-trigger.svelte +22 -9
- package/dist/components/menu/menu.svelte +98 -87
- package/dist/components/number-box/docs/llms.md +10 -6
- package/dist/components/persona/docs/llms.md +19 -14
- package/dist/components/progress-bar/docs/llms.md +18 -10
- package/dist/components/progress-ring/docs/llms.md +19 -12
- package/dist/components/radio-button/docs/llms.md +13 -8
- package/dist/components/skeleton/docs/llms.md +13 -8
- package/dist/components/slider/docs/llms.md +33 -21
- package/dist/components/slider/slider.svelte +13 -11
- package/dist/components/table/docs/llms.md +531 -0
- package/dist/components/table/table-body.svelte +31 -0
- package/dist/components/table/table-body.svelte.d.ts +25 -0
- package/dist/components/table/table-cell-actions.svelte +48 -0
- package/dist/components/table/table-cell-actions.svelte.d.ts +17 -0
- package/dist/components/table/table-cell-layout.svelte +88 -0
- package/dist/components/table/table-cell-layout.svelte.d.ts +14 -0
- package/dist/components/table/table-cell.svelte +74 -0
- package/dist/components/table/table-cell.svelte.d.ts +25 -0
- package/dist/components/table/table-header-cell.svelte +257 -0
- package/dist/components/table/table-header-cell.svelte.d.ts +25 -0
- package/dist/components/table/table-header.svelte +28 -0
- package/dist/components/table/table-header.svelte.d.ts +25 -0
- package/dist/components/table/table-row.svelte +57 -0
- package/dist/components/table/table-row.svelte.d.ts +25 -0
- package/dist/components/table/table-selection-cell.svelte +89 -0
- package/dist/components/table/table-selection-cell.svelte.d.ts +25 -0
- package/dist/components/table/table.svelte +189 -0
- package/dist/components/table/table.svelte.d.ts +49 -0
- package/dist/components/table/table.svelte.js +138 -0
- package/dist/components/table/types.d.ts +287 -0
- package/dist/components/table/types.js +1 -0
- package/dist/components/text-box/docs/llms.md +23 -17
- package/dist/components/textarea/docs/llms.md +16 -7
- package/dist/components/time-picker/docs/llms.md +20 -10
- package/dist/components/toggle-switch/docs/llms.md +13 -9
- package/dist/components/tooltip/docs/llms.md +24 -10
- package/dist/components/tree-view/docs/llms.md +53 -35
- package/dist/components/tree-view/tree-view-item-content.svelte +1 -1
- package/dist/components/tree-view/tree-view-item.svelte +3 -3
- package/dist/components/tree-view/tree-view.svelte +89 -93
- package/dist/index.d.ts +9 -0
- package/dist/index.js +11 -0
- package/dist/providers/fluentui-svelte/fluentui-svelte.svelte +15 -15
- package/package.json +1 -1
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
import { getReducedMotion } from '../../providers/fluentui-svelte/fluentui-svelte.js';
|
|
32
32
|
import type {
|
|
33
33
|
AnimationDirection,
|
|
34
|
+
CalendarViewContext,
|
|
34
35
|
CalendarViewProps,
|
|
35
|
-
CalendarViewState,
|
|
36
36
|
DateComparisonPrecision,
|
|
37
37
|
View
|
|
38
38
|
} from './types.js';
|
|
@@ -197,59 +197,70 @@
|
|
|
197
197
|
updateView(e, 'months', year);
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
const
|
|
201
|
-
get value() {
|
|
202
|
-
return value;
|
|
203
|
-
},
|
|
204
|
-
set value(v) {
|
|
205
|
-
value = v;
|
|
206
|
-
},
|
|
207
|
-
get range() {
|
|
208
|
-
return range;
|
|
209
|
-
},
|
|
210
|
-
set range(v) {
|
|
211
|
-
range = v;
|
|
212
|
-
},
|
|
213
|
-
get view() {
|
|
214
|
-
return view;
|
|
215
|
-
},
|
|
216
|
-
set view(v) {
|
|
217
|
-
view = v;
|
|
218
|
-
},
|
|
219
|
-
get page() {
|
|
220
|
-
return page;
|
|
221
|
-
},
|
|
222
|
-
set page(v) {
|
|
223
|
-
page = v;
|
|
224
|
-
},
|
|
225
|
-
get viewAnimationDirection() {
|
|
226
|
-
return viewAnimationDirection;
|
|
227
|
-
},
|
|
228
|
-
set viewAnimationDirection(v) {
|
|
229
|
-
viewAnimationDirection = v;
|
|
230
|
-
},
|
|
231
|
-
get pageAnimationDirection() {
|
|
232
|
-
return pageAnimationDirection;
|
|
233
|
-
},
|
|
234
|
-
set pageAnimationDirection(v) {
|
|
235
|
-
pageAnimationDirection = v;
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// svelte-ignore state_referenced_locally
|
|
240
|
-
setCalendarViewContext({
|
|
200
|
+
const context: CalendarViewContext = $state({
|
|
241
201
|
config: {
|
|
242
|
-
minDate
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
202
|
+
get minDate() {
|
|
203
|
+
return minDate;
|
|
204
|
+
},
|
|
205
|
+
get maxDate() {
|
|
206
|
+
return maxDate;
|
|
207
|
+
},
|
|
208
|
+
get locale() {
|
|
209
|
+
return locale;
|
|
210
|
+
},
|
|
211
|
+
get weekStart() {
|
|
212
|
+
return weekStart;
|
|
213
|
+
},
|
|
214
|
+
get blackoutDates() {
|
|
215
|
+
return blackoutDates;
|
|
216
|
+
},
|
|
217
|
+
get selectionMode() {
|
|
218
|
+
return selectionMode;
|
|
219
|
+
},
|
|
220
|
+
get blackoutBreaksRange() {
|
|
221
|
+
return blackoutBreaksRange;
|
|
222
|
+
},
|
|
223
|
+
get headers() {
|
|
224
|
+
return headers;
|
|
225
|
+
}
|
|
250
226
|
},
|
|
251
|
-
|
|
252
|
-
|
|
227
|
+
state: {
|
|
228
|
+
get value() {
|
|
229
|
+
return value;
|
|
230
|
+
},
|
|
231
|
+
set value(v) {
|
|
232
|
+
value = v;
|
|
233
|
+
},
|
|
234
|
+
get range() {
|
|
235
|
+
return range;
|
|
236
|
+
},
|
|
237
|
+
set range(v) {
|
|
238
|
+
range = v;
|
|
239
|
+
},
|
|
240
|
+
get view() {
|
|
241
|
+
return view;
|
|
242
|
+
},
|
|
243
|
+
set view(v) {
|
|
244
|
+
view = v;
|
|
245
|
+
},
|
|
246
|
+
get page() {
|
|
247
|
+
return page;
|
|
248
|
+
},
|
|
249
|
+
set page(v) {
|
|
250
|
+
page = v;
|
|
251
|
+
},
|
|
252
|
+
get viewAnimationDirection() {
|
|
253
|
+
return viewAnimationDirection;
|
|
254
|
+
},
|
|
255
|
+
set viewAnimationDirection(v) {
|
|
256
|
+
viewAnimationDirection = v;
|
|
257
|
+
},
|
|
258
|
+
get pageAnimationDirection() {
|
|
259
|
+
return pageAnimationDirection;
|
|
260
|
+
},
|
|
261
|
+
set pageAnimationDirection(v) {
|
|
262
|
+
pageAnimationDirection = v;
|
|
263
|
+
}
|
|
253
264
|
},
|
|
254
265
|
events: {
|
|
255
266
|
onChange: (e, value) => onChange?.(e, value),
|
|
@@ -264,6 +275,9 @@
|
|
|
264
275
|
clearSelection
|
|
265
276
|
}
|
|
266
277
|
});
|
|
278
|
+
|
|
279
|
+
setCalendarViewContext(context);
|
|
280
|
+
|
|
267
281
|
$effect.pre(() => {
|
|
268
282
|
pageAnimationDuration = getCSSDuration('--fs-normal-duration') || 333;
|
|
269
283
|
|
|
@@ -82,40 +82,52 @@ changing it from the header button leaves focus on the button.
|
|
|
82
82
|
|
|
83
83
|
## CalendarView Props
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
|
89
|
-
|
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
98
|
-
| `
|
|
99
|
-
| `
|
|
100
|
-
| `
|
|
101
|
-
| `
|
|
102
|
-
| `
|
|
85
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
86
|
+
<!-- props:CalendarViewProps -->
|
|
87
|
+
|
|
88
|
+
| Name | Type | Default | Description |
|
|
89
|
+
| -------------------------- | ------------------------------------------------------------------- | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
90
|
+
| `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the calendar element. |
|
|
91
|
+
| `value` _bindable_ | `Date` | `Date[]` | `null` | `null` | The selected date, or an array of dates when `selectionMode` is `'multiple'`. Unused by `'range'`. |
|
|
92
|
+
| `selectionMode` | `'single'` | `'multiple'` | `'range'` | `'single'` | How many dates the grid hands out, and in what shape. |
|
|
93
|
+
| `range` _bindable_ | `{ start: Date` | `null; end: Date` | `null; }` | `{ start: null, end: null }` | The picked range. Only read and written when `selectionMode` is `'range'`, and `end` stays `null` until the range is closed. |
|
|
94
|
+
| `blackoutBreaksRange` | `boolean` | `false` | Stop a range from spanning a blacked-out date. |
|
|
95
|
+
| `blackoutDates` | `Date[]` | | Dates that are rendered but cannot be selected. |
|
|
96
|
+
| `headers` | `boolean` | | Labels the first cell of a month or a year with its name. |
|
|
97
|
+
| `minDate` | `Date` | | The earliest selectable date. |
|
|
98
|
+
| `maxDate` | `Date` | | The latest selectable date. |
|
|
99
|
+
| `view` | `'days'` | `'months'` | `'years'` | `'days'` | The calendar page the view opens on. |
|
|
100
|
+
| `locale` | `string` | `'en-US'` | The locale used to format weekday and month names. |
|
|
101
|
+
| `weekStart` | `number` | `1` | The first day of the week, where 0 is Sunday. |
|
|
102
|
+
| `floating` | `CalendarViewFloating` | | Renders the calendar as a popup anchored to a reference element instead of inline. |
|
|
103
|
+
| `onChange` | `(event: Event, value: Date` | `Date[]` | `null) => void` | | Called whenever the selection changes. Not called in `'range'` mode. |
|
|
104
|
+
| `onRangeChange` | `(event: Event, range: CalendarDateRange) => void` | | Fired on every step of a range, including the one that leaves `end` null. |
|
|
105
|
+
| `onViewChange` | `(event: Event, view: View) => void` | | Called whenever the active calendar page changes. |
|
|
106
|
+
| Element Attributes (`div`) | | | |
|
|
107
|
+
|
|
108
|
+
<!-- /props:CalendarViewProps -->
|
|
103
109
|
|
|
104
110
|
All `div` HTML attributes are forwarded to the root element.
|
|
105
111
|
|
|
106
112
|
## CalendarViewItem Props
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
114
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
115
|
+
<!-- props:CalendarViewItemProps -->
|
|
116
|
+
|
|
117
|
+
| Name | Type | Default | Description |
|
|
118
|
+
| -------------------------- | ------------------------------------------- | ------- | ------------------------------------------------------------------------------------------ |
|
|
119
|
+
| `selected` | `boolean` | | Renders the cell as the selected one. |
|
|
120
|
+
| `disabled` | `boolean` | | Disables the user interaction. |
|
|
121
|
+
| `current` | `boolean` | | Marks the cell as the current date. |
|
|
122
|
+
| `outOfRange` | `boolean` | | Renders the cell as belonging to a neighbouring page. |
|
|
123
|
+
| `blackout` | `boolean` | | Renders the cell as blacked out, so it reads as unavailable rather than disabled. |
|
|
124
|
+
| `rangePosition` | `'start'` | `'between'` | `'end'` | | Set on the days a range covers, which paints the band behind them. |
|
|
125
|
+
| `header` | `string` | | A small label rendered above the cell content. |
|
|
126
|
+
| `variant` | `'day'` | `'monthYear'` | `'day'` | Which shape the cell takes: a circle for a day, a rounded rectangle for a month or a year. |
|
|
127
|
+
| `children` | `Snippet` | | The content of the cell. |
|
|
128
|
+
| `buttonAttributes` | `HTMLButtonAttributes` | | The attributes to spread on the inner button element. |
|
|
129
|
+
| Element Attributes (`div`) | | | |
|
|
130
|
+
|
|
131
|
+
<!-- /props:CalendarViewItemProps -->
|
|
120
132
|
|
|
121
133
|
All `div` HTML attributes are forwarded to the cell element.
|
|
@@ -149,19 +149,24 @@ The footer renders the actions of the card at the bottom, spread across the avai
|
|
|
149
149
|
|
|
150
150
|
## Component Props
|
|
151
151
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
|
|
|
152
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
153
|
+
<!-- props:CardProps -->
|
|
154
|
+
|
|
155
|
+
| Name | Type | Default | Description |
|
|
156
|
+
| --------------------- | ---------------------------------------------------------- | -------------- | --------------------------------------------------------------------------------------- |
|
|
157
|
+
| `ref` _bindable_ | `CardElementDOMType[Tag]` | | The DOM reference of the card element. |
|
|
158
|
+
| `as` | `'div'` | `'article'` | `'section'` | `'a'` | `'div'` | The DOM element to render. |
|
|
159
|
+
| `orientation` | `'horizontal'` | `'vertical'` | `'horizontal'` | The axis the card lays its parts out on. |
|
|
160
|
+
| `selectable` | `boolean` | `false` | Lets the user select the card by clicking anywhere on it. |
|
|
161
|
+
| `showFloatingAction` | `boolean` | `false` | Floats the selection checkbox over the top right corner of the card. |
|
|
162
|
+
| `id` | `string` | | The id of the card element. Falls back to a generated one. |
|
|
163
|
+
| `selected` _bindable_ | `boolean` | `false` | Whether the card is selected. Only available on selectable cards. |
|
|
164
|
+
| `disabled` | `boolean` | `false` | Disables the user interaction. |
|
|
165
|
+
| `appearance` | `'filled'` | `'outlined'` | `'subtle'` | `'filled'` | A card can have its background and borders styled for greater emphasis or to be subtle. |
|
|
166
|
+
| `onSelectionChange` | `(id: string, selected: boolean) => void` | | Called with the id of the card whenever its selection changes. |
|
|
167
|
+
| HTML Attributes | | | |
|
|
168
|
+
|
|
169
|
+
<!-- /props:CardProps -->
|
|
165
170
|
|
|
166
171
|
## CardPreview
|
|
167
172
|
|
|
@@ -169,13 +174,18 @@ The media shown at one edge of the card, with an optional logo overlaid on it.
|
|
|
169
174
|
|
|
170
175
|
### Component Props
|
|
171
176
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
|
176
|
-
|
|
|
177
|
-
| `
|
|
178
|
-
|
|
|
177
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
178
|
+
<!-- props:CardPreviewProps -->
|
|
179
|
+
|
|
180
|
+
| Name | Type | Default | Description |
|
|
181
|
+
| --------------------------------------------------- | ---------------- | ------- | --------------------------------------------------------------------------------------- |
|
|
182
|
+
| `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the preview element. |
|
|
183
|
+
| `logoSrc` | `string` | | The URL of the logo overlaid on the bottom left corner of the preview. |
|
|
184
|
+
| `logoAlt` | `string` | `''` | The alternative text of the logo. Empty by default, which marks the logo as decorative. |
|
|
185
|
+
| `children` | `Snippet` | | The media to preview, usually an image. |
|
|
186
|
+
| `HTMLAttributes<HTMLDivElement>` without `children` | | | |
|
|
187
|
+
|
|
188
|
+
<!-- /props:CardPreviewProps -->
|
|
179
189
|
|
|
180
190
|
## CardHeader
|
|
181
191
|
|
|
@@ -183,15 +193,20 @@ The title of the card, with an optional image, description and action.
|
|
|
183
193
|
|
|
184
194
|
### Component Props
|
|
185
195
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
|
190
|
-
|
|
|
191
|
-
| `
|
|
192
|
-
| `
|
|
193
|
-
| `
|
|
194
|
-
|
|
|
196
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
197
|
+
<!-- props:CardHeaderProps -->
|
|
198
|
+
|
|
199
|
+
| Name | Type | Default | Description |
|
|
200
|
+
| ------------------------------------------------------------ | -------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
|
|
201
|
+
| `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the header element. |
|
|
202
|
+
| `title` | `Snippet` | `Component` | `string` | | The title of the card. A snippet or a component receives the id the floating checkbox is labelled by. |
|
|
203
|
+
| `image` | `Snippet` | `Component` | `string` | | The image rendered before the title. A string is used as the `src` of an `<img>`. |
|
|
204
|
+
| `imageAlt` | `string` | `''` | The alternative text of a string image. Empty by default, which marks the image as decorative. |
|
|
205
|
+
| `description` | `Snippet` | `Component` | `string` | | A second line of text below the title. |
|
|
206
|
+
| `action` | `Snippet` | `Component` | | The action rendered at the end of the header. Not available on selectable cards. |
|
|
207
|
+
| `HTMLAttributes<HTMLDivElement>` without `children`, `title` | | | |
|
|
208
|
+
|
|
209
|
+
<!-- /props:CardHeaderProps -->
|
|
195
210
|
|
|
196
211
|
## CardFooter
|
|
197
212
|
|
|
@@ -199,8 +214,13 @@ The actions shown at the bottom of the card.
|
|
|
199
214
|
|
|
200
215
|
### Component Props
|
|
201
216
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
|
206
|
-
|
|
|
217
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
218
|
+
<!-- props:CardFooterProps -->
|
|
219
|
+
|
|
220
|
+
| Name | Type | Default | Description |
|
|
221
|
+
| --------------------------------------------------- | ---------------------------- | ------- | -------------------------------------------------------------------------- |
|
|
222
|
+
| `ref` _bindable_ | `HTMLDivElement` | | The DOM reference of the footer element. |
|
|
223
|
+
| `action` | `Snippet` | `Component` | | The actions rendered inside the footer. Not available on selectable cards. |
|
|
224
|
+
| `HTMLAttributes<HTMLDivElement>` without `children` | | | |
|
|
225
|
+
|
|
226
|
+
<!-- /props:CardFooterProps -->
|
|
@@ -64,15 +64,21 @@ The `value` prop sets the value of the checkbox input. It is useful when the che
|
|
|
64
64
|
|
|
65
65
|
## Checkbox Props
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `wrapperAttributes`
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
|
|
|
67
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
68
|
+
<!-- props:CheckboxProps -->
|
|
69
|
+
|
|
70
|
+
| Name | Type | Default | Description |
|
|
71
|
+
| ----------------------------------------------- | ------------------------------------------ | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `ref` _bindable_ | `HTMLInputElement` | | The DOM reference of the checkbox element. |
|
|
73
|
+
| `wrapperAs` | `'div'` | `'label'` | `'label'` | The DOM element used to wrap the checkbox. `label` associates the children with the input; switch to `div` when the field is wrapped in a `<Label>` of its own. |
|
|
74
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `HTMLLabelElement` | | The DOM reference of the checkbox wrapper element. |
|
|
75
|
+
| `wrapperAttributes` | `PolymorphicProps` | | The attributes to spread on the wrapper element. |
|
|
76
|
+
| `indeterminate` _bindable_ | `boolean` | | Renders the checkbox in its mixed state, neither checked nor unchecked. |
|
|
77
|
+
| `name` | `string` | `null` | `id` | The name submitted with the form. Falls back to the id of the checkbox. |
|
|
78
|
+
| `group` | `string` | `null` | | The value of the group of checkboxes this input belongs to. |
|
|
79
|
+
| `checked` _bindable_ | `boolean` | | Whether the checkbox is checked. |
|
|
80
|
+
| `disabled` | `boolean` | | Disables the user interaction. |
|
|
81
|
+
| `children` | `Snippet` | | The content of the label. Only rendered when wrapperAs is set to label. |
|
|
82
|
+
| `HTMLInputAttributes` without `on:`, `children` | | | |
|
|
83
|
+
|
|
84
|
+
<!-- /props:CheckboxProps -->
|
|
@@ -35,18 +35,28 @@ Use `hideDays`, `hideMonths`, or `hideYears` to hide individual selector columns
|
|
|
35
35
|
|
|
36
36
|
## Component Props
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
| `
|
|
44
|
-
| `
|
|
45
|
-
| `
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
38
|
+
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
39
|
+
<!-- props:DatePickerProps -->
|
|
40
|
+
|
|
41
|
+
| Name | Type | Default | Description |
|
|
42
|
+
| ----------------------------- | ------------------------------------ | ----------------- | --------------------------------------------------------------------------------------------------- |
|
|
43
|
+
| `value` _bindable_ | `string` | `''` | Selected date as `YYYY-MM-DD` (matches the underlying `<input type="date">`). |
|
|
44
|
+
| `format` | `'MM/dd/yyyy'` | `'dd/MM/yyyy'` | `'dd/MM/yyyy'` | The order the three columns are laid out in. |
|
|
45
|
+
| `open` _bindable_ | `boolean` | `false` | Controls the open state of the picker. |
|
|
46
|
+
| `hideYears` | `boolean` | `false` | Removes the year column. |
|
|
47
|
+
| `hideMonths` | `boolean` | `false` | Removes the month column. |
|
|
48
|
+
| `hideDays` | `boolean` | `false` | Removes the day column. |
|
|
49
|
+
| `minYear` | `number` | `Current - 100` | The first year offered by the year column. |
|
|
50
|
+
| `maxYear` | `number` | `Current + 100` | The last year offered by the year column. |
|
|
51
|
+
| `disabledDates` | `Date[]` | `[]` | Specific days (year-month-day) that cannot be selected. |
|
|
52
|
+
| `disabledMonths` | `Date[]` | `[]` | Specific months (by month + year) that cannot be selected. |
|
|
53
|
+
| `disabledYears` | `Date[]` | `[]` | Specific years (by year) that cannot be selected. |
|
|
54
|
+
| `ref` _bindable_ | `HTMLButtonElement` | | The DOM reference of the trigger button. |
|
|
55
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | | The DOM reference of the element wrapping the trigger and its input. |
|
|
56
|
+
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
57
|
+
| `inputElement` _bindable_ | `HTMLInputElement` | | The DOM reference of the underlying input element. |
|
|
58
|
+
| `inputProps` | `HTMLInputAttributes` | | HTML attributes for the underlying input element. Give it a `name` to submit the value with a form. |
|
|
59
|
+
| `popupLabel` | `string` | `'Choose a date'` | The accessible name of the popup, which is announced as a dialog. |
|
|
60
|
+
| Element Attributes (`button`) | | | |
|
|
61
|
+
|
|
62
|
+
<!-- /props:DatePickerProps -->
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
|
|
18
18
|
const { closeDialog } = methods;
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
// Registered unconditionally and guarded from inside, so switching `type` after mount is honored.
|
|
21
|
+
onClickOutside(
|
|
22
|
+
() => ref,
|
|
23
|
+
() => {
|
|
24
|
+
if (config.type === 'alert') return;
|
|
25
|
+
closeDialog();
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
28
|
|
|
29
29
|
$effect(() => {
|
|
30
30
|
if (!ref) return;
|
|
@@ -8,57 +8,59 @@
|
|
|
8
8
|
|
|
9
9
|
let titleId: string | undefined = $state();
|
|
10
10
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
get open() {
|
|
17
|
-
return open;
|
|
18
|
-
},
|
|
19
|
-
get dialogRef() {
|
|
20
|
-
return dialogRef;
|
|
21
|
-
},
|
|
22
|
-
set dialogRef(v) {
|
|
23
|
-
dialogRef = v;
|
|
24
|
-
},
|
|
25
|
-
get titleId() {
|
|
26
|
-
return titleId;
|
|
11
|
+
const context: DialogContext = $state({
|
|
12
|
+
config: {
|
|
13
|
+
get type() {
|
|
14
|
+
return type;
|
|
15
|
+
}
|
|
27
16
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
dialogRef
|
|
37
|
-
}
|
|
38
|
-
|
|
17
|
+
state: {
|
|
18
|
+
get open() {
|
|
19
|
+
return open;
|
|
20
|
+
},
|
|
21
|
+
get dialogRef() {
|
|
22
|
+
return dialogRef;
|
|
23
|
+
},
|
|
24
|
+
set dialogRef(v) {
|
|
25
|
+
dialogRef = v;
|
|
26
|
+
},
|
|
27
|
+
get titleId() {
|
|
28
|
+
return titleId;
|
|
29
|
+
},
|
|
30
|
+
set titleId(v) {
|
|
31
|
+
titleId = v;
|
|
39
32
|
}
|
|
40
|
-
onOpenChange?.(true);
|
|
41
33
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
events: null,
|
|
35
|
+
methods: {
|
|
36
|
+
openDialog: () => {
|
|
37
|
+
if (type !== 'non-modal') {
|
|
38
|
+
dialogRef?.showModal();
|
|
39
|
+
} else {
|
|
40
|
+
open = true;
|
|
41
|
+
}
|
|
42
|
+
onOpenChange?.(true);
|
|
43
|
+
},
|
|
44
|
+
closeDialog: () => {
|
|
45
|
+
if (type !== 'non-modal') {
|
|
46
|
+
dialogRef?.close();
|
|
47
|
+
} else {
|
|
48
|
+
open = false;
|
|
49
|
+
}
|
|
50
|
+
onOpenChange?.(false);
|
|
47
51
|
}
|
|
48
|
-
onOpenChange?.(false);
|
|
49
52
|
}
|
|
50
53
|
});
|
|
51
54
|
|
|
55
|
+
setDialogContext(context);
|
|
56
|
+
|
|
52
57
|
export function openDialog() {
|
|
53
|
-
methods.openDialog();
|
|
58
|
+
context.methods.openDialog();
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
export function closeDialog() {
|
|
57
|
-
methods.closeDialog();
|
|
62
|
+
context.methods.closeDialog();
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
// svelte-ignore state_referenced_locally
|
|
61
|
-
setDialogContext({ config, state: _state, events: null, methods });
|
|
62
64
|
</script>
|
|
63
65
|
|
|
64
66
|
{@render children?.()}
|