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
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { TagPickerProps } from './types.ts';
|
|
2
|
+
/**
|
|
3
|
+
* A text field and a dropdown that give people a way to choose several options from a list, or to enter their own choice. Every choice is shown as a dismissible Tag in the control.
|
|
4
|
+
*
|
|
5
|
+
* - Usage:
|
|
6
|
+
* ```tsx
|
|
7
|
+
* <script>
|
|
8
|
+
* import { TagPicker, TagPickerOption } from 'fluentui-svelte';
|
|
9
|
+
*
|
|
10
|
+
* let selectedOptions = $state([]);
|
|
11
|
+
* </script>
|
|
12
|
+
*
|
|
13
|
+
* <TagPicker bind:selectedOptions name="fruits" inputAttributes={{ 'aria-label': 'Fruits' }}>
|
|
14
|
+
* <TagPickerOption value="Apple">Apple</TagPickerOption>
|
|
15
|
+
* <TagPickerOption value="Banana">Banana</TagPickerOption>
|
|
16
|
+
* </TagPicker>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare const TagPicker: import("svelte").Component<TagPickerProps, {}, "ref" | "value" | "open" | "wrapperRef" | "selectedOptions" | "inputRef">;
|
|
20
|
+
type TagPicker = ReturnType<typeof TagPicker>;
|
|
21
|
+
export default TagPicker;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes, HTMLInputAttributes, HTMLSelectAttributes, SVGAttributes } from 'svelte/elements';
|
|
3
|
+
import type { FSContext, NativeFieldAttributes } from '../../internal/index.js';
|
|
4
|
+
import type { ListViewItemProps } from '../list-view/types.ts';
|
|
5
|
+
import type { TagGroupProps } from '../tag/types.ts';
|
|
6
|
+
export type TagPickerSizes = 'medium' | 'large' | 'extra-large';
|
|
7
|
+
/** @propsmith TagPickerProps */
|
|
8
|
+
export type TagPickerProps = {
|
|
9
|
+
/** The DOM reference of the wrapper element.
|
|
10
|
+
* @bindable
|
|
11
|
+
*/
|
|
12
|
+
wrapperRef?: HTMLDivElement | null;
|
|
13
|
+
/** The DOM reference of the native multiple select that holds the selected options. The other attributes of the picker are applied to it.
|
|
14
|
+
* @bindable
|
|
15
|
+
*/
|
|
16
|
+
ref?: HTMLSelectElement | null;
|
|
17
|
+
/** The DOM reference of the text input.
|
|
18
|
+
* @bindable
|
|
19
|
+
*/
|
|
20
|
+
inputRef?: HTMLInputElement | null;
|
|
21
|
+
/** The attributes to spread on the text input.
|
|
22
|
+
* @type HTMLInputAttributes
|
|
23
|
+
*/
|
|
24
|
+
inputAttributes?: Omit<HTMLInputAttributes, 'value' | 'type' | 'role' | 'size' | 'disabled' | 'placeholder' | 'children'>;
|
|
25
|
+
/** The values of the chosen options, shown as tags in the control. A value no option has is shown as it is.
|
|
26
|
+
* @default []
|
|
27
|
+
* @bindable
|
|
28
|
+
*/
|
|
29
|
+
selectedOptions?: string[];
|
|
30
|
+
/** The text typed in the input. It filters the options, and is cleared when one is chosen.
|
|
31
|
+
* @default ''
|
|
32
|
+
* @bindable
|
|
33
|
+
*/
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Controls the open state of the option list.
|
|
36
|
+
* @default false
|
|
37
|
+
* @bindable
|
|
38
|
+
*/
|
|
39
|
+
open?: boolean;
|
|
40
|
+
/** Limits the picker to one tag: choosing an option replaces the current one and closes the list. */
|
|
41
|
+
single?: boolean;
|
|
42
|
+
/** Disables the user interaction: the input, the tags and the list. */
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** The size of the control. It also picks the size of the tags.
|
|
45
|
+
* @default 'medium'
|
|
46
|
+
*/
|
|
47
|
+
size?: TagPickerSizes;
|
|
48
|
+
/** The placeholder text of the input. */
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
/** The message shown in place of the list when there is no option left to choose.
|
|
51
|
+
* @default 'No options available'
|
|
52
|
+
*/
|
|
53
|
+
notFoundText?: string;
|
|
54
|
+
/** The dropdown arrow. Pass `null` to remove it.
|
|
55
|
+
* @default ChevronDownRegular
|
|
56
|
+
* @type Snippet | Component | null
|
|
57
|
+
*/
|
|
58
|
+
expandIcon?: Snippet<[SVGAttributes<SVGElement>]> | Component<SVGAttributes<SVGElement>> | null;
|
|
59
|
+
/** A button-like element rendered at the end of the control, before the dropdown arrow. */
|
|
60
|
+
secondaryAction?: Snippet;
|
|
61
|
+
/** Renders the tag of a chosen option, to give it media or custom text. Falls back to a plain tag.
|
|
62
|
+
* Render a `Tag` with the given `value`.
|
|
63
|
+
* @type Snippet<[{ value: string; text: string }]>
|
|
64
|
+
*/
|
|
65
|
+
tag?: Snippet<[{
|
|
66
|
+
value: string;
|
|
67
|
+
text: string;
|
|
68
|
+
}]>;
|
|
69
|
+
/** The props to spread on the group holding the tags. This is where its `aria-label` goes, `'Selected options'` by default.
|
|
70
|
+
* @type TagGroupProps
|
|
71
|
+
*/
|
|
72
|
+
tagGroupProps?: Omit<TagGroupProps, 'children' | 'size' | 'appearance' | 'disabled' | 'dismissible' | 'selectedValues' | 'onTagSelect' | 'onDismiss'>;
|
|
73
|
+
/** The attributes to spread on the wrapper element.
|
|
74
|
+
* @type HTMLAttributes
|
|
75
|
+
*/
|
|
76
|
+
wrapperAttributes?: HTMLAttributes<HTMLDivElement>;
|
|
77
|
+
/** Called when an option is chosen, or a tag is removed. */
|
|
78
|
+
onSelectionChange?: (e: Event, selectedOptions: string[]) => void;
|
|
79
|
+
/** Called when Enter is pressed with text in the input and no option under the cursor. This is
|
|
80
|
+
* where a free-form tag is added.
|
|
81
|
+
*/
|
|
82
|
+
querySubmitted?: (e: KeyboardEvent, query: string) => void;
|
|
83
|
+
/** The options. Leave it out to get a picker without a list. */
|
|
84
|
+
children?: Snippet;
|
|
85
|
+
} & NativeFieldAttributes<Omit<HTMLSelectAttributes, 'value' | 'multiple' | 'size' | 'disabled' | 'children'>>;
|
|
86
|
+
export type OptionType = {
|
|
87
|
+
id: string;
|
|
88
|
+
value: string;
|
|
89
|
+
disabled?: boolean;
|
|
90
|
+
};
|
|
91
|
+
/** What an option tells its tag, read live. */
|
|
92
|
+
export type OptionLabel = {
|
|
93
|
+
readonly value: string;
|
|
94
|
+
readonly text: string;
|
|
95
|
+
};
|
|
96
|
+
export type TagPickerContext = FSContext<null, {
|
|
97
|
+
readonly query: string;
|
|
98
|
+
readonly selectedOptions: string[];
|
|
99
|
+
readonly open: boolean;
|
|
100
|
+
}, null, {
|
|
101
|
+
/** Tells the tag of an option what to say. Every option calls it, on screen or not. Returns the call that withdraws the option. */
|
|
102
|
+
registerLabel: (option: OptionLabel) => () => void;
|
|
103
|
+
setOption: (option: OptionType) => void;
|
|
104
|
+
deleteOption: (id: string) => void;
|
|
105
|
+
chooseOption: (e: Event, id: string) => void;
|
|
106
|
+
}>;
|
|
107
|
+
/** @propsmith TagPickerOptionProps */
|
|
108
|
+
export type TagPickerOptionProps = {
|
|
109
|
+
/** The value added to `selectedOptions` when the option is chosen. */
|
|
110
|
+
value: string;
|
|
111
|
+
/** The text the option is filtered by, and the text of its tag. Falls back to `value`. */
|
|
112
|
+
text?: string;
|
|
113
|
+
/** The id of the option element, referenced by the input through `aria-activedescendant`.
|
|
114
|
+
* Falls back to a generated id.
|
|
115
|
+
*/
|
|
116
|
+
id?: string;
|
|
117
|
+
/** The DOM reference of the option element.
|
|
118
|
+
* @bindable
|
|
119
|
+
*/
|
|
120
|
+
ref?: HTMLLIElement | null;
|
|
121
|
+
/** Takes the option out of reach: it is shown, but the cursor steps over it. */
|
|
122
|
+
disabled?: boolean;
|
|
123
|
+
} & Omit<ListViewItemProps<'li'>, 'as' | 'value' | 'onAction' | 'checkmark'>;
|
|
124
|
+
/** @propsmith TagPickerOptionGroupProps */
|
|
125
|
+
export type TagPickerOptionGroupProps = {
|
|
126
|
+
/** The label of the group. */
|
|
127
|
+
label: string;
|
|
128
|
+
/** The DOM reference of the group element.
|
|
129
|
+
* @bindable
|
|
130
|
+
*/
|
|
131
|
+
ref?: HTMLUListElement | null;
|
|
132
|
+
/** The options of the group. */
|
|
133
|
+
children?: Snippet;
|
|
134
|
+
/** The attributes to spread on the wrapper element.
|
|
135
|
+
* @type HTMLAttributes
|
|
136
|
+
*/
|
|
137
|
+
wrapperAttributes?: HTMLAttributes<HTMLLIElement>;
|
|
138
|
+
/** The DOM reference of the wrapper element.
|
|
139
|
+
* @bindable
|
|
140
|
+
*/
|
|
141
|
+
wrapperRef?: HTMLLIElement | null;
|
|
142
|
+
} & Omit<HTMLAttributes<HTMLUListElement>, 'children'>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -29,6 +29,31 @@ The `type` prop specifies the type of input element. It can be set to various ty
|
|
|
29
29
|
<TextBox type="number" placeholder="Number" />
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
### Size
|
|
33
|
+
|
|
34
|
+
The `size` prop sets the height, the font size and the horizontal padding of the input. It can be set to `small`, `medium` or `large`. The default is `medium`.
|
|
35
|
+
|
|
36
|
+
```svelte
|
|
37
|
+
<TextBox size="small" placeholder="Small" />
|
|
38
|
+
<TextBox size="medium" placeholder="Medium" />
|
|
39
|
+
<TextBox size="large" placeholder="Large" />
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Content Before and After
|
|
43
|
+
|
|
44
|
+
`contentBefore` and `contentAfter` render content inside the wrapper, before and after the input. They accept a string, a snippet or a component such as an icon.
|
|
45
|
+
|
|
46
|
+
```svelte
|
|
47
|
+
<script>
|
|
48
|
+
import { MailRegular } from 'fluentui-icons-svelte';
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<TextBox contentBefore="https://" placeholder="Website" />
|
|
52
|
+
<TextBox contentAfter=".com" placeholder="Domain" />
|
|
53
|
+
<TextBox contentBefore="$" contentAfter=".00" type="number" placeholder="Price" />
|
|
54
|
+
<TextBox contentBefore={MailRegular} placeholder="Email" />
|
|
55
|
+
```
|
|
56
|
+
|
|
32
57
|
### Input Element
|
|
33
58
|
|
|
34
59
|
The `ref` prop allows you to bind a reference to the underlying HTML input element (`bind:ref`). This can be useful for direct DOM manipulations or accessing native input properties. The wrapper element can be bound via `wrapperRef`.
|
|
@@ -65,6 +90,8 @@ The `textChanged` event is triggered whenever the content of the text box change
|
|
|
65
90
|
|
|
66
91
|
The `onClear` event is triggered when the input is cleared, allowing you to handle any necessary actions when the user removes the input value.
|
|
67
92
|
|
|
93
|
+
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.
|
|
94
|
+
|
|
68
95
|
## Component Props
|
|
69
96
|
|
|
70
97
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
@@ -74,19 +101,19 @@ The `onClear` event is triggered when the input is cleared, allowing you to hand
|
|
|
74
101
|
| ------------------------------------ | ---------------------------------------------------------------------- | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
75
102
|
| `type` | [`TextBoxTypes`](https://fluentui-svelte.dev/docs/types/#textboxtypes) | `'text'` | The type of the input element. |
|
|
76
103
|
| `value` _bindable_ | `string` | `number` | | The current value of the input. |
|
|
77
|
-
| `wrapperRef` _bindable_ | `HTMLDivElement`
|
|
78
|
-
| `ref` _bindable_ | `HTMLInputElement`
|
|
104
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the wrapper element. |
|
|
105
|
+
| `ref` _bindable_ | `HTMLInputElement` | `null` | | The DOM reference of the input element. |
|
|
79
106
|
| `placeholder` | `string` | `'Fluent TextBox'` | The placeholder text for the input. |
|
|
80
107
|
| `hideActionButtons` | `boolean` | | Whether to hide the extra action buttons in the input. |
|
|
81
108
|
| `justify` | `boolean` | | Make the input fill the full width of the container. |
|
|
82
109
|
| `contentBefore` | `string` | `Snippet` | `Component` | | Content rendered before the input, inside the wrapper. |
|
|
83
110
|
| `contentAfter` | `string` | `Snippet` | `Component` | | Content rendered after the input, inside the wrapper. |
|
|
84
111
|
| `size` | `'small'` | `'medium'` | `'large'` | `'medium'` | The size of the input element. |
|
|
85
|
-
| `textChanged` | `(e:
|
|
112
|
+
| `textChanged` | `(e: Event & unknown, text: string) => void` | | Occurs when content changes in the text box. |
|
|
86
113
|
| `querySubmitted` | `(e: MouseEvent` | `KeyboardEvent, query: string) => void` | | The QuerySubmitted event occurs when: 1. The input type is 'search'. 2. While the focus is in the text box, press Enter or click the query icon. |
|
|
87
114
|
| `onClear` | `(e: MouseEvent) => void` | | Occurs when the clear button is clicked. |
|
|
88
115
|
| `children` | `Snippet` | | The children elements to render inside the input. |
|
|
89
|
-
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to
|
|
116
|
+
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
90
117
|
| `HTMLInputAttributes` without `size` | | | |
|
|
91
118
|
|
|
92
119
|
<!-- /props:TextBoxProps -->
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
4
4
|
|
|
5
5
|
let {
|
|
6
|
-
element = $bindable(),
|
|
6
|
+
element = $bindable(null),
|
|
7
7
|
type = 'button',
|
|
8
8
|
children,
|
|
9
9
|
...attributes
|
|
10
|
-
}: { element?: HTMLButtonElement; children: Snippet } & HTMLButtonAttributes = $props();
|
|
10
|
+
}: { element?: HTMLButtonElement | null; children: Snippet } & HTMLButtonAttributes = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<button {type} bind:this={element}
|
|
13
|
+
<button {...attributes} {type} bind:this={element}>
|
|
14
14
|
{@render children?.()}
|
|
15
15
|
</button>
|
|
16
16
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
3
|
type $$ComponentProps = {
|
|
4
|
-
element?: HTMLButtonElement;
|
|
4
|
+
element?: HTMLButtonElement | null;
|
|
5
5
|
children: Snippet;
|
|
6
6
|
} & HTMLButtonAttributes;
|
|
7
7
|
declare const TextBoxButton: import("svelte").Component<$$ComponentProps, {}, "element">;
|
|
@@ -1,33 +1,37 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { claimLabel } from '../label/label-context.js';
|
|
2
3
|
import DismissFilled from 'fluentui-icons-svelte/DismissFilled.svelte';
|
|
3
4
|
import SearchFilled from 'fluentui-icons-svelte/SearchFilled.svelte';
|
|
4
5
|
import EyeShowFilled from 'fluentui-icons-svelte/EyeShowFilled.svelte';
|
|
5
6
|
import EyeHideFilled from 'fluentui-icons-svelte/EyeHideFilled.svelte';
|
|
6
7
|
import { TextBoxButton } from '../../index.js';
|
|
7
|
-
import { RenderSoC } from '../../internal/index.js';
|
|
8
|
+
import { invokeHandlers, RenderSoC } from '../../internal/index.js';
|
|
8
9
|
import type { TextBoxProps } from './types.js';
|
|
9
10
|
|
|
10
11
|
const FALLBACK_ID = $props.id();
|
|
11
12
|
|
|
13
|
+
const labelContext = claimLabel(() => id);
|
|
14
|
+
|
|
12
15
|
let {
|
|
13
|
-
id = 'input-' + FALLBACK_ID,
|
|
16
|
+
id = labelContext?.fieldId ?? 'input-' + FALLBACK_ID,
|
|
14
17
|
readonly,
|
|
15
18
|
name = id,
|
|
16
19
|
hideActionButtons,
|
|
17
20
|
type = 'text',
|
|
18
|
-
class: classes,
|
|
19
21
|
wrapperAttributes,
|
|
20
|
-
wrapperRef = $bindable(),
|
|
21
|
-
value = $bindable(),
|
|
22
|
-
ref = $bindable(),
|
|
22
|
+
wrapperRef = $bindable(null),
|
|
23
|
+
value = $bindable(null),
|
|
24
|
+
ref = $bindable(null),
|
|
23
25
|
placeholder = 'Fluent TextBox',
|
|
24
26
|
size = 'medium',
|
|
25
27
|
contentBefore,
|
|
26
28
|
contentAfter,
|
|
27
29
|
querySubmitted,
|
|
28
30
|
textChanged,
|
|
29
|
-
|
|
31
|
+
onkeyup,
|
|
30
32
|
onClear,
|
|
33
|
+
onchange,
|
|
34
|
+
oninput,
|
|
31
35
|
children,
|
|
32
36
|
...attributes
|
|
33
37
|
}: TextBoxProps = $props();
|
|
@@ -57,12 +61,11 @@
|
|
|
57
61
|
}
|
|
58
62
|
};
|
|
59
63
|
|
|
60
|
-
const
|
|
64
|
+
const handleKeyUp = (e: KeyboardEvent & { currentTarget: EventTarget & HTMLInputElement }) => {
|
|
61
65
|
if (e.key === 'Escape') {
|
|
62
66
|
e.preventDefault();
|
|
63
67
|
(e.target as HTMLInputElement).blur();
|
|
64
68
|
}
|
|
65
|
-
onkeydown?.(e);
|
|
66
69
|
};
|
|
67
70
|
</script>
|
|
68
71
|
|
|
@@ -80,7 +83,11 @@ This is a implementation of Fluent UI TextBox component. The TextBox component i
|
|
|
80
83
|
<TextBox type="text" placeholder="Enter your name" />
|
|
81
84
|
```
|
|
82
85
|
-->
|
|
83
|
-
<div
|
|
86
|
+
<div
|
|
87
|
+
{...wrapperAttributes}
|
|
88
|
+
class={['fs-textbox', `text-box-size-${size}`, wrapperAttributes?.class]}
|
|
89
|
+
bind:this={wrapperRef}
|
|
90
|
+
>
|
|
84
91
|
{#if contentBefore}
|
|
85
92
|
<span class="content-before">
|
|
86
93
|
{#if typeof contentBefore === 'string'}
|
|
@@ -91,6 +98,7 @@ This is a implementation of Fluent UI TextBox component. The TextBox component i
|
|
|
91
98
|
</span>
|
|
92
99
|
{/if}
|
|
93
100
|
<input
|
|
101
|
+
{...attributes}
|
|
94
102
|
{type}
|
|
95
103
|
{id}
|
|
96
104
|
{name}
|
|
@@ -98,10 +106,9 @@ This is a implementation of Fluent UI TextBox component. The TextBox component i
|
|
|
98
106
|
{readonly}
|
|
99
107
|
bind:value
|
|
100
108
|
bind:this={ref}
|
|
101
|
-
onkeyup={
|
|
102
|
-
oninput={(e) =>
|
|
103
|
-
onchange={(e) =>
|
|
104
|
-
{...attributes}
|
|
109
|
+
onkeyup={(e) => invokeHandlers(e, [], [handleKeyUp, onkeyup])}
|
|
110
|
+
oninput={(e) => invokeHandlers(e, [], [(_e) => textChanged?.(_e, value), oninput])}
|
|
111
|
+
onchange={(e) => invokeHandlers(e, [], [(_e) => textChanged?.(_e, value), onchange])}
|
|
105
112
|
/>
|
|
106
113
|
{#if contentAfter}
|
|
107
114
|
<span class="content-after">
|
|
@@ -221,6 +228,11 @@ This is a implementation of Fluent UI TextBox component. The TextBox component i
|
|
|
221
228
|
left: -0.063rem;
|
|
222
229
|
background-color: var(--fs-accent-fill-default);
|
|
223
230
|
}
|
|
231
|
+
&:has(input:is(:user-invalid, [aria-invalid='true'])):after {
|
|
232
|
+
width: calc(100% + 0.125rem);
|
|
233
|
+
left: -0.063rem;
|
|
234
|
+
background-color: var(--fs-system-critical);
|
|
235
|
+
}
|
|
224
236
|
&:has(input:focus) {
|
|
225
237
|
background: var(--fs-control-fill-input-active);
|
|
226
238
|
& input::placeholder {
|
|
@@ -271,12 +283,14 @@ This is a implementation of Fluent UI TextBox component. The TextBox component i
|
|
|
271
283
|
visibility: hidden;
|
|
272
284
|
}
|
|
273
285
|
&.text-box-size-small {
|
|
286
|
+
--text-box-edge-padding: 0.5rem;
|
|
274
287
|
& :is(input, .content-after, .content-before) {
|
|
275
288
|
font-size: var(--fs-body2-font-size);
|
|
276
289
|
padding: 0.25rem;
|
|
277
290
|
}
|
|
278
291
|
}
|
|
279
292
|
&.text-box-size-medium {
|
|
293
|
+
--text-box-edge-padding: 0.6875rem;
|
|
280
294
|
font-size: var(--fs-body-font-size);
|
|
281
295
|
& :is(input, .content-after, .content-before) {
|
|
282
296
|
padding: 0.375rem;
|
|
@@ -284,6 +298,7 @@ This is a implementation of Fluent UI TextBox component. The TextBox component i
|
|
|
284
298
|
}
|
|
285
299
|
}
|
|
286
300
|
&.text-box-size-large {
|
|
301
|
+
--text-box-edge-padding: 0.9375rem;
|
|
287
302
|
& :is(input, .content-after, .content-before) {
|
|
288
303
|
padding: 0.625rem 0.625rem;
|
|
289
304
|
font-size: var(--fs-subtitle2-font-size);
|
|
@@ -295,5 +310,17 @@ This is a implementation of Fluent UI TextBox component. The TextBox component i
|
|
|
295
310
|
margin-right: 0.3125rem;
|
|
296
311
|
}
|
|
297
312
|
}
|
|
313
|
+
/* The outer horizontal edges of the control use the per-size edge padding. */
|
|
314
|
+
&:is(.text-box-size-small, .text-box-size-medium, .text-box-size-large) {
|
|
315
|
+
& input:not(.content-before + input) {
|
|
316
|
+
padding-left: var(--text-box-edge-padding);
|
|
317
|
+
}
|
|
318
|
+
& :is(input, .content-after):last-child {
|
|
319
|
+
padding-right: var(--text-box-edge-padding);
|
|
320
|
+
}
|
|
321
|
+
& .content-before {
|
|
322
|
+
padding-left: var(--text-box-edge-padding);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
298
325
|
}
|
|
299
326
|
</style>
|
|
@@ -12,15 +12,15 @@ export type TextBoxProps = {
|
|
|
12
12
|
* @type string | number
|
|
13
13
|
* @bindable
|
|
14
14
|
*/
|
|
15
|
-
value?: string | number;
|
|
15
|
+
value?: string | number | null;
|
|
16
16
|
/** The DOM reference of the wrapper element.
|
|
17
17
|
* @bindable
|
|
18
18
|
*/
|
|
19
|
-
wrapperRef?: HTMLDivElement;
|
|
19
|
+
wrapperRef?: HTMLDivElement | null;
|
|
20
20
|
/** The DOM reference of the input element.
|
|
21
21
|
* @bindable
|
|
22
22
|
*/
|
|
23
|
-
ref?: HTMLInputElement;
|
|
23
|
+
ref?: HTMLInputElement | null;
|
|
24
24
|
/** The placeholder text for the input.
|
|
25
25
|
* @default 'Fluent TextBox'
|
|
26
26
|
*/
|
|
@@ -42,7 +42,7 @@ export type TextBoxProps = {
|
|
|
42
42
|
*/
|
|
43
43
|
size?: Sizes;
|
|
44
44
|
/** Occurs when content changes in the text box. */
|
|
45
|
-
textChanged?: (e:
|
|
45
|
+
textChanged?: (e: Event & unknown, text: string) => void;
|
|
46
46
|
/** The QuerySubmitted event occurs when:
|
|
47
47
|
* 1. The input type is 'search'.
|
|
48
48
|
* 2. While the focus is in the text box, press Enter or click the query icon.
|
|
@@ -53,7 +53,7 @@ export type TextBoxProps = {
|
|
|
53
53
|
onClear?: (e: MouseEvent) => void;
|
|
54
54
|
/** The children elements to render inside the input. */
|
|
55
55
|
children?: Snippet;
|
|
56
|
-
/** The attributes to
|
|
56
|
+
/** The attributes to spread on the wrapper element.
|
|
57
57
|
* @type HTMLAttributes
|
|
58
58
|
*/
|
|
59
59
|
wrapperAttributes?: HTMLAttributes<HTMLDivElement>;
|
|
@@ -44,6 +44,8 @@ The `onChange` event is triggered whenever the content of the textarea changes.
|
|
|
44
44
|
<TextArea onChange={(e) => console.log(e)} placeholder="Type..." />
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
+
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.
|
|
48
|
+
|
|
47
49
|
## Component Props
|
|
48
50
|
|
|
49
51
|
<!-- DO NOT EDIT THIS SECTION (propsmith generated) -->
|
|
@@ -52,13 +54,12 @@ The `onChange` event is triggered whenever the content of the textarea changes.
|
|
|
52
54
|
| Name | Type | Default | Description |
|
|
53
55
|
| -------------------------------- | ------------------------------------------------------------------ | ------------ | ------------------------------------------------ |
|
|
54
56
|
| `value` _bindable_ | `string` | `''` | The current value of the textarea. |
|
|
55
|
-
| `ref` _bindable_ | `
|
|
57
|
+
| `ref` _bindable_ | `HTMLTextAreaElement` | `null` | | The DOM reference of the textarea element. |
|
|
56
58
|
| `placeholder` | `string` | | The placeholder text for the textarea. |
|
|
57
59
|
| `resize` | `'none'` | `'both'` | `'horizontal'` | `'vertical'` | `'vertical'` | Configures the resize behavior of the textarea. |
|
|
58
|
-
| `onChange` | `(e: Event) => void` | | Callback function for the change event. |
|
|
59
60
|
| `disabled` | `boolean` | `false` | Disables the user interaction. |
|
|
60
61
|
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
61
|
-
| `wrapperRef` _bindable_ | `HTMLDivElement`
|
|
62
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the wrapper element. |
|
|
62
63
|
| `SvelteHTMLElements['textarea']` | | | |
|
|
63
64
|
|
|
64
65
|
<!-- /props:TextAreaProps -->
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { claimLabel } from '../label/label-context.js';
|
|
2
3
|
import { PREFIX } from '../../internal/constants.js';
|
|
3
4
|
import { invokeHandlers } from '../../internal/index.js';
|
|
4
5
|
import type { TextAreaProps } from './types.js';
|
|
@@ -7,17 +8,19 @@
|
|
|
7
8
|
const COMPONENT_NAME = 'textarea';
|
|
8
9
|
const ID = `${PREFIX}${COMPONENT_NAME}-${FALLBACK_ID}`;
|
|
9
10
|
|
|
11
|
+
const labelContext = claimLabel(() => id);
|
|
12
|
+
|
|
10
13
|
let {
|
|
11
|
-
id = ID,
|
|
14
|
+
id = labelContext?.fieldId ?? ID,
|
|
12
15
|
name = id,
|
|
13
16
|
value = $bindable(''),
|
|
14
|
-
ref = $bindable(),
|
|
17
|
+
ref = $bindable(null),
|
|
15
18
|
resize = 'vertical',
|
|
16
19
|
style,
|
|
17
20
|
wrapperAttributes,
|
|
18
21
|
onchange,
|
|
19
22
|
disabled = false,
|
|
20
|
-
wrapperRef = $bindable(),
|
|
23
|
+
wrapperRef = $bindable(null),
|
|
21
24
|
...attributes
|
|
22
25
|
}: TextAreaProps = $props();
|
|
23
26
|
</script>
|
|
@@ -36,16 +39,16 @@
|
|
|
36
39
|
<TextArea resize="none" disabled />
|
|
37
40
|
```
|
|
38
41
|
-->
|
|
39
|
-
<div class=
|
|
42
|
+
<div {...wrapperAttributes} class={['fs-textarea', wrapperAttributes?.class]} bind:this={wrapperRef}>
|
|
40
43
|
<textarea
|
|
44
|
+
{...attributes}
|
|
41
45
|
{name}
|
|
42
46
|
{id}
|
|
43
47
|
{disabled}
|
|
44
48
|
onchange={(e) => invokeHandlers(e, [disabled], [onchange])}
|
|
45
49
|
style="resize: {resize}; {style}"
|
|
46
50
|
bind:this={ref}
|
|
47
|
-
bind:value
|
|
48
|
-
{...attributes}></textarea>
|
|
51
|
+
bind:value></textarea>
|
|
49
52
|
</div>
|
|
50
53
|
|
|
51
54
|
<style>
|
|
@@ -128,6 +131,11 @@
|
|
|
128
131
|
left: -0.063rem;
|
|
129
132
|
background: var(--fs-accent-fill-default);
|
|
130
133
|
}
|
|
134
|
+
&:has(textarea:is(:user-invalid, [aria-invalid='true'])):after {
|
|
135
|
+
width: calc(100% + 0.125rem);
|
|
136
|
+
left: -0.063rem;
|
|
137
|
+
background: var(--fs-system-critical);
|
|
138
|
+
}
|
|
131
139
|
&:has(textarea:focus) {
|
|
132
140
|
background: var(--fs-control-fill-input-active);
|
|
133
141
|
& textarea::placeholder {
|
|
@@ -9,15 +9,13 @@ export type TextAreaProps = {
|
|
|
9
9
|
/** The DOM reference of the textarea element.
|
|
10
10
|
* @bindable
|
|
11
11
|
*/
|
|
12
|
-
ref?:
|
|
12
|
+
ref?: HTMLTextAreaElement | null;
|
|
13
13
|
/** The placeholder text for the textarea. */
|
|
14
14
|
placeholder?: string;
|
|
15
15
|
/** Configures the resize behavior of the textarea.
|
|
16
16
|
* @default 'vertical'
|
|
17
17
|
*/
|
|
18
18
|
resize?: 'none' | 'both' | 'horizontal' | 'vertical';
|
|
19
|
-
/** Callback function for the change event. */
|
|
20
|
-
onChange?: (e: Event) => void;
|
|
21
19
|
/** Disables the user interaction.
|
|
22
20
|
* @default false
|
|
23
21
|
*/
|
|
@@ -29,5 +27,5 @@ export type TextAreaProps = {
|
|
|
29
27
|
/** The DOM reference of the wrapper element.
|
|
30
28
|
* @bindable
|
|
31
29
|
*/
|
|
32
|
-
wrapperRef?: HTMLDivElement;
|
|
30
|
+
wrapperRef?: HTMLDivElement | null;
|
|
33
31
|
} & SvelteHTMLElements['textarea'];
|
|
@@ -33,25 +33,28 @@ Use `hideHours`, `hideMinutes`, or `hideSeconds` to hide individual columns. By
|
|
|
33
33
|
<TimePicker format={24} hideSeconds />
|
|
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:TimePickerProps -->
|
|
40
42
|
|
|
41
|
-
| Name
|
|
42
|
-
|
|
|
43
|
-
| `value` _bindable_
|
|
44
|
-
| `format`
|
|
45
|
-
| `open` _bindable_
|
|
46
|
-
| `hideHours`
|
|
47
|
-
| `hideMinutes`
|
|
48
|
-
| `hideSeconds`
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
| `
|
|
52
|
-
| `
|
|
53
|
-
| `
|
|
54
|
-
| `popupLabel`
|
|
55
|
-
|
|
|
43
|
+
| Name | Type | Default | Description |
|
|
44
|
+
| -------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
45
|
+
| `value` _bindable_ | `string` | `''` | Selected time as 24h `HH:mm` or `HH:mm:ss` (matches `<input type="time">`). |
|
|
46
|
+
| `format` | `12` | `24` | `24` | Clock format: `24` (00-23) or `12` (01-12 with an AM/PM column). |
|
|
47
|
+
| `open` _bindable_ | `boolean` | `false` | Controls the open state of the picker. |
|
|
48
|
+
| `hideHours` | `boolean` | `false` | Removes the hour column. |
|
|
49
|
+
| `hideMinutes` | `boolean` | `false` | Removes the minute column. |
|
|
50
|
+
| `hideSeconds` | `boolean` | `false` | Removes the second column. |
|
|
51
|
+
| `ref` _bindable_ | `HTMLInputElement` | `null` | | The DOM reference of the native time input that holds the value. The other attributes of the picker are applied to it. |
|
|
52
|
+
| `buttonRef` _bindable_ | `HTMLButtonElement` | `null` | | The DOM reference of the button that opens the picker. |
|
|
53
|
+
| `buttonAttributes` | `HTMLButtonAttributes` | | The attributes to spread on the button that opens the picker. |
|
|
54
|
+
| `wrapperRef` _bindable_ | `HTMLDivElement` | `null` | | The DOM reference of the element wrapping the button and the native input. |
|
|
55
|
+
| `wrapperAttributes` | `HTMLAttributes` | | The attributes to spread on the wrapper element. |
|
|
56
|
+
| `popupLabel` | `string` | `'Choose a time'` | The accessible name of the popup, which is announced as a dialog. |
|
|
57
|
+
| `columnLabels` | `{ hour, minute, second, … (4 keys) }` | `{ hour: 'Hour', minute: 'Minute', second: 'Second', meridiem: 'AM/PM' }` | The names of the hour, minute, second and AM/PM columns: shown on the trigger while there is no time, and given to the lists of the popup. |
|
|
58
|
+
| `NativeFieldAttributes<HTMLInputAttributes>` | | | |
|
|
56
59
|
|
|
57
60
|
<!-- /props:TimePickerProps -->
|