@fibrae/semi-ui-svelte 0.9.0 → 0.10.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/README.md +8 -4
- package/README.zh-CN.md +8 -4
- package/dist/components/anchor/interface.d.ts +14 -0
- package/dist/components/audio-player/interface.d.ts +5 -0
- package/dist/components/auto-complete/interface.d.ts +29 -0
- package/dist/components/avatar/interface.d.ts +24 -0
- package/dist/components/backtop/interface.d.ts +2 -0
- package/dist/components/badge/interface.d.ts +7 -0
- package/dist/components/banner/interface.d.ts +7 -0
- package/dist/components/breadcrumb/interface.d.ts +10 -0
- package/dist/components/button/interface.d.ts +18 -0
- package/dist/components/calendar/interface.d.ts +16 -0
- package/dist/components/card/interface.d.ts +18 -0
- package/dist/components/carousel/interface.d.ts +16 -0
- package/dist/components/cascader/cascader.svelte +1 -0
- package/dist/components/cascader/interface.d.ts +57 -0
- package/dist/components/checkbox/interface.d.ts +19 -0
- package/dist/components/code-highlight/interface.d.ts +3 -0
- package/dist/components/collapse/interface.d.ts +16 -0
- package/dist/components/collapsible/interface.d.ts +10 -0
- package/dist/components/color-picker/interface.d.ts +10 -0
- package/dist/components/config-provider/interface.d.ts +7 -0
- package/dist/components/cropper/interface.d.ts +11 -0
- package/dist/components/date-picker/interface.d.ts +47 -0
- package/dist/components/descriptions/interface.d.ts +6 -0
- package/dist/components/divider/interface.d.ts +4 -0
- package/dist/components/dropdown/interface.d.ts +8 -0
- package/dist/components/empty/interface.d.ts +7 -0
- package/dist/components/feedback/interface.d.ts +16 -0
- package/dist/components/float-button/interface.d.ts +14 -0
- package/dist/components/form/interface.d.ts +47 -0
- package/dist/components/form/label.svelte +2 -2
- package/dist/components/grid/interface.d.ts +13 -0
- package/dist/components/highlight/interface.d.ts +7 -0
- package/dist/components/hot-keys/interface.d.ts +3 -0
- package/dist/components/image/interface.d.ts +59 -0
- package/dist/components/input/interface.d.ts +67 -0
- package/dist/components/input-number/interface.d.ts +24 -0
- package/dist/components/json-viewer/interface.d.ts +7 -0
- package/dist/components/layout/interface.d.ts +3 -0
- package/dist/components/list/interface.d.ts +18 -0
- package/dist/components/locale/interface.d.ts +4 -0
- package/dist/components/lottie/interface.d.ts +2 -0
- package/dist/components/markdown-render/interface.d.ts +5 -0
- package/dist/components/modal/interface.d.ts +29 -0
- package/dist/components/navigation/interface.d.ts +47 -0
- package/dist/components/overflow-list/interface.d.ts +11 -0
- package/dist/components/pagination/interface.d.ts +12 -0
- package/dist/components/pincode/interface.d.ts +8 -0
- package/dist/components/popconfirm/interface.d.ts +12 -0
- package/dist/components/popover/interface.d.ts +30 -0
- package/dist/components/progress/interface.d.ts +13 -0
- package/dist/components/radio/interface.d.ts +22 -0
- package/dist/components/rating/interface.d.ts +12 -0
- package/dist/components/resizable/interface.d.ts +30 -0
- package/dist/components/scroll-list/interface.d.ts +6 -0
- package/dist/components/select/interface.d.ts +63 -0
- package/dist/components/side-sheet/interface.d.ts +19 -0
- package/dist/components/skeleton/interface.d.ts +7 -0
- package/dist/components/slider/interface.d.ts +23 -0
- package/dist/components/space/interface.d.ts +4 -0
- package/dist/components/spin/interface.d.ts +7 -0
- package/dist/components/steps/interface.d.ts +9 -0
- package/dist/components/switch/interface.d.ts +7 -0
- package/dist/components/table/interface.d.ts +48 -0
- package/dist/components/tabs/interface.d.ts +29 -0
- package/dist/components/tag/interface.d.ts +22 -0
- package/dist/components/tag-input/interface.d.ts +29 -0
- package/dist/components/time-picker/interface.d.ts +31 -0
- package/dist/components/timeline/interface.d.ts +5 -0
- package/dist/components/tooltip/interface.d.ts +20 -0
- package/dist/components/tooltip/tooltip.svelte +3 -0
- package/dist/components/transfer/interface.d.ts +18 -0
- package/dist/components/tree/interface.d.ts +45 -0
- package/dist/components/tree-select/interface.d.ts +55 -0
- package/dist/components/typography/interface.d.ts +33 -0
- package/dist/components/upload/interface.d.ts +64 -0
- package/dist/components/user-guide/interface.d.ts +15 -0
- package/dist/components/video-player/interface.d.ts +22 -0
- package/dist/styles.css +1 -1
- package/docs/advanced/dark-mode.md +288 -0
- package/docs/basic/button.md +605 -0
- package/docs/basic/divider.md +103 -0
- package/docs/basic/float-button.md +246 -0
- package/docs/basic/grid.md +427 -0
- package/docs/basic/layout.md +459 -0
- package/docs/basic/resizable.md +584 -0
- package/docs/basic/space.md +163 -0
- package/docs/basic/tokens.md +425 -0
- package/docs/basic/typography.md +615 -0
- package/docs/changes-from-semi.md +105 -0
- package/docs/ecosystem/tailwind.md +210 -0
- package/docs/experience/accessibility.md +82 -0
- package/docs/experience/content-guidelines.md +819 -0
- package/docs/experience/internationalization.md +7 -0
- package/docs/feedback/banner.md +198 -0
- package/docs/feedback/feedback.md +294 -0
- package/docs/feedback/notification.md +401 -0
- package/docs/feedback/popconfirm.md +243 -0
- package/docs/feedback/progress.md +389 -0
- package/docs/feedback/skeleton.md +388 -0
- package/docs/feedback/spin.md +172 -0
- package/docs/feedback/toast.md +393 -0
- package/docs/input/auto-complete.md +399 -0
- package/docs/input/cascader.md +1558 -0
- package/docs/input/checkbox.md +408 -0
- package/docs/input/color-picker.md +175 -0
- package/docs/input/date-picker.md +942 -0
- package/docs/input/form.md +2550 -0
- package/docs/input/input-number.md +451 -0
- package/docs/input/input.md +640 -0
- package/docs/input/pincode.md +191 -0
- package/docs/input/radio.md +337 -0
- package/docs/input/rating.md +214 -0
- package/docs/input/select.md +1230 -0
- package/docs/input/slider.md +347 -0
- package/docs/input/switch.md +206 -0
- package/docs/input/tag-input.md +465 -0
- package/docs/input/time-picker.md +358 -0
- package/docs/input/transfer.md +1061 -0
- package/docs/input/tree-select.md +1300 -0
- package/docs/input/upload.md +1811 -0
- package/docs/llms.txt +147 -0
- package/docs/navigation/anchor.md +377 -0
- package/docs/navigation/backtop.md +100 -0
- package/docs/navigation/breadcrumb.md +284 -0
- package/docs/navigation/navigation.md +851 -0
- package/docs/navigation/pagination.md +217 -0
- package/docs/navigation/steps.md +315 -0
- package/docs/navigation/tabs.md +754 -0
- package/docs/navigation/tree.md +1956 -0
- package/docs/other/config-provider.md +599 -0
- package/docs/other/locale.md +353 -0
- package/docs/plus/audio-player.md +155 -0
- package/docs/plus/code-highlight.md +150 -0
- package/docs/plus/drag-move.md +214 -0
- package/docs/plus/hot-keys.md +174 -0
- package/docs/plus/json-viewer.md +392 -0
- package/docs/plus/lottie.md +176 -0
- package/docs/plus/markdown-render.md +240 -0
- package/docs/plus/video-player.md +325 -0
- package/docs/show/avatar.md +475 -0
- package/docs/show/badge.md +276 -0
- package/docs/show/calendar.md +352 -0
- package/docs/show/card.md +485 -0
- package/docs/show/carousel.md +592 -0
- package/docs/show/collapse.md +289 -0
- package/docs/show/collapsible.md +216 -0
- package/docs/show/cropper.md +285 -0
- package/docs/show/descriptions.md +325 -0
- package/docs/show/dropdown.md +466 -0
- package/docs/show/empty.md +225 -0
- package/docs/show/highlight.md +144 -0
- package/docs/show/image.md +433 -0
- package/docs/show/list.md +927 -0
- package/docs/show/modal.md +517 -0
- package/docs/show/overflow-list.md +272 -0
- package/docs/show/popover.md +534 -0
- package/docs/show/scroll-list.md +156 -0
- package/docs/show/side-sheet.md +274 -0
- package/docs/show/table.md +5437 -0
- package/docs/show/tag.md +428 -0
- package/docs/show/timeline.md +277 -0
- package/docs/show/tooltip.md +442 -0
- package/docs/show/user-guide.md +419 -0
- package/docs/start/getting-started.md +234 -0
- package/docs/start/introduction.md +57 -0
- package/docs/start/overview.md +21 -0
- package/package.json +5 -4
|
@@ -82,63 +82,107 @@ type NativeKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onselect
|
|
|
82
82
|
export interface CascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, NativeKeys> {
|
|
83
83
|
/** Bindable; leave it out for an uncontrolled Cascader. `bind:value={get, set}` makes it fully controlled */
|
|
84
84
|
value?: CascaderValue;
|
|
85
|
+
/** Whether several paths can be selected. It has no global default. */
|
|
85
86
|
multiple?: boolean;
|
|
87
|
+
/** Node data. The label is text only, use the label snippet for node content. Changes made in place to $state data are noticed, and a new array with equal content keeps the expanded and selected state. */
|
|
86
88
|
treeData?: CascaderData[];
|
|
89
|
+
/** Custom field names for value, label, children, disabled and isLeaf in a node. */
|
|
87
90
|
keyMaps?: CascaderKeyMapProps;
|
|
91
|
+
/** Whether a non-leaf node can be selected in single mode. */
|
|
88
92
|
changeOnSelect?: boolean;
|
|
89
93
|
/** Not followed when it changes after mount */
|
|
90
94
|
autoMergeValue?: boolean;
|
|
95
|
+
/** In multiple mode, the value and the tags shown only include leaf nodes. Changes after mount are not followed. */
|
|
91
96
|
leafOnly?: boolean;
|
|
97
|
+
/** In multiple mode, how the checked states of the nodes relate: related links parents and children, unRelated keeps them independent. */
|
|
92
98
|
checkRelation?: 'related' | 'unRelated';
|
|
99
|
+
/** Whether to disable strictly. A disabled node then does not change when its parent or children are checked or unchecked. */
|
|
93
100
|
disableStrictly?: boolean;
|
|
101
|
+
/** In multiple mode, the most paths that can be selected; exceeding it calls onExceed. */
|
|
94
102
|
max?: number;
|
|
103
|
+
/** In multiple mode, the most tags shown; the rest appear as +N. */
|
|
95
104
|
maxTagCount?: number;
|
|
105
|
+
/** Whether hovering +N shows the remaining tags in a Popover once maxTagCount is exceeded. */
|
|
96
106
|
showRestTagsPopover?: boolean;
|
|
107
|
+
/** Configuration of the Popover of the remaining tags, such as position and trigger. See Popover. */
|
|
97
108
|
restTagsPopoverProps?: Omit<PopoverProps, 'children' | 'child' | 'content'>;
|
|
109
|
+
/** In multiple mode, whether clicking the option of a leaf node checks it. */
|
|
98
110
|
enableLeafClick?: boolean;
|
|
111
|
+
/** In multiple mode, clicking any node selects it. Often used with showNext set to hover: hovering expands the submenu and clicking selects the node. */
|
|
99
112
|
clickToSelect?: boolean;
|
|
113
|
+
/** When the submenu expands: on click or on hover. */
|
|
100
114
|
showNext?: 'click' | 'hover';
|
|
101
115
|
/** Loads the children of the last node; a node without `isLeaf` shows the expand arrow while it is set */
|
|
102
116
|
loadData?: (selectOptions: CascaderData[]) => Promise<void>;
|
|
117
|
+
/** Whether search is on. True matches the input against the field named by treeNodeFilterProp, case-insensitively; a custom match function can be given instead. */
|
|
103
118
|
filterTreeNode?: boolean | ((inputValue: string, treeNodeString: string, data?: CascaderData) => boolean);
|
|
119
|
+
/** Sorts the filtered results; it receives the two result paths (the node arrays from the root to the matched node) and the input. */
|
|
104
120
|
filterSorter?: (first: CascaderData[], second: CascaderData[], inputValue: string) => number;
|
|
121
|
+
/** Whether the search results only show the paths of leaf nodes. */
|
|
105
122
|
filterLeafOnly?: boolean;
|
|
123
|
+
/** The node field matched against the search input, label by default. */
|
|
106
124
|
treeNodeFilterProp?: string;
|
|
125
|
+
/** Whether to search remotely. Input is then not filtered locally and only calls onSearch, and the caller updates treeData asynchronously. */
|
|
107
126
|
remote?: boolean;
|
|
127
|
+
/** The node field shown in the trigger and the tags, label by default. */
|
|
108
128
|
displayProp?: string;
|
|
129
|
+
/** The separator of a path in the search results and in the trigger in single mode. */
|
|
109
130
|
separator?: string;
|
|
110
131
|
/** `onChange` and `value` carry the nodes of each path instead of their values */
|
|
111
132
|
onChangeWithObject?: boolean;
|
|
133
|
+
/** Placeholder of the select box. */
|
|
112
134
|
placeholder?: string;
|
|
135
|
+
/** Placeholder of the search input; placeholder is used when it is not given. */
|
|
113
136
|
searchPlaceholder?: string;
|
|
137
|
+
/** Where the search input is: trigger puts it in the trigger, custom leaves it to the caller. */
|
|
114
138
|
searchPosition?: 'trigger' | 'custom';
|
|
139
|
+
/** Whether the Cascader is disabled. A disabled Cascader cannot be reached with Tab. */
|
|
115
140
|
disabled?: boolean;
|
|
141
|
+
/** Size of the select box. */
|
|
116
142
|
size?: CascaderSize;
|
|
143
|
+
/** Whether to use the borderless style. */
|
|
117
144
|
borderless?: boolean;
|
|
145
|
+
/** Validation status of the trigger; it only affects the style. */
|
|
118
146
|
validateStatus?: ValidateStatus;
|
|
147
|
+
/** The id of the insetLabel content, used to name the combobox; the component generates one when the insetLabel snippet is used and this is not given. */
|
|
119
148
|
insetLabelId?: string;
|
|
149
|
+
/** Whether to show the clear button. */
|
|
120
150
|
showClear?: boolean;
|
|
121
151
|
/** Opens the dropdown on mount; Cascader has no controlled open state */
|
|
122
152
|
defaultOpen?: boolean;
|
|
153
|
+
/** Whether the dropdown animates. */
|
|
123
154
|
motion?: boolean;
|
|
155
|
+
/** Whether the dropdown flips its direction when an edge covers it. */
|
|
124
156
|
autoAdjustOverflow?: boolean;
|
|
157
|
+
/** Direction of the dropdown, bottomLeft by default and bottomRight in RTL. */
|
|
125
158
|
position?: Position;
|
|
159
|
+
/** Whether clicks on the dropdown stop bubbling. */
|
|
126
160
|
stopPropagation?: boolean | string;
|
|
161
|
+
/** Class names of the inner parts, keyed by dropdown; values take anything class takes (string, array or object) and merge with the built-in classes. */
|
|
127
162
|
classNames?: Partial<Record<CascaderPart, ClassValue>>;
|
|
163
|
+
/** Style strings of the inner parts, keyed like classNames. */
|
|
128
164
|
styles?: Partial<Record<CascaderPart, string>>;
|
|
165
|
+
/** Whether focusing inside the component stops the browser scrolling the document to show the focused element. */
|
|
129
166
|
preventScroll?: boolean;
|
|
167
|
+
/** Virtual list configuration of the search results, made of height, width and itemSize, for large result sets; height defaults to 180, the same as the dropdown height. */
|
|
130
168
|
virtualizeInSearch?: CascaderVirtualize;
|
|
169
|
+
/** Called when the selection changes. In single mode the selected path, in multiple mode an array of the selected paths; node data with onChangeWithObject. */
|
|
131
170
|
onChange?: (value: CascaderChangeValue) => void;
|
|
132
171
|
/** In multiple mode a single checked node gives its value, more give an array */
|
|
133
172
|
onSelect?: (value: string | number | Array<string | number>) => void;
|
|
173
|
+
/** Called when the search input changes, with the text. */
|
|
134
174
|
onSearch?: (value: string) => void;
|
|
135
175
|
/** Focus entering the trigger or the dropdown from outside passes the `focusin` event; moving within them does not report again. A click or key that reopens after a pick closed it reports it too */
|
|
136
176
|
onFocus?: (event: MouseEvent | KeyboardEvent | FocusEvent) => void;
|
|
137
177
|
/** Once per focus: the mousedown outside, the click or key that picks and closes, or the `focusout` that leaves the trigger and the dropdown */
|
|
138
178
|
onBlur?: (event?: MouseEvent | KeyboardEvent | FocusEvent) => void;
|
|
179
|
+
/** Called when the dropdown opens or closes, with whether it is open. */
|
|
139
180
|
onDropdownVisibleChange?: (visible: boolean) => void;
|
|
181
|
+
/** Called when the clear button clears the selection. */
|
|
140
182
|
onClear?: () => void;
|
|
183
|
+
/** Called in multiple mode when the selection goes past max, with the Entity array of the checked nodes. */
|
|
141
184
|
onExceed?: (checkedItem: CascaderEntity[]) => void;
|
|
185
|
+
/** Called when a node has loaded, with the set of loaded keys and the node data. */
|
|
142
186
|
onLoad?: (newLoadedKeys: Set<string>, data: CascaderData) => void;
|
|
143
187
|
/** Scrolling a column of the tree; the search results do not report it */
|
|
144
188
|
onListScroll?: (event: Event, panel: CascaderScrollPanelProps) => void;
|
|
@@ -149,20 +193,33 @@ export interface CascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, Nati
|
|
|
149
193
|
* options still take the key
|
|
150
194
|
*/
|
|
151
195
|
onKeyDown?: (event: KeyboardEvent) => void;
|
|
196
|
+
/** Content of an option in the columns, with `{ item }`; the search results, the selection and the tags still show the text of the node. */
|
|
152
197
|
label?: Snippet<[CascaderLabelSnippetProps]>;
|
|
198
|
+
/** The selected path shown in single mode, with `{ labels, path }`: `labels` holds the displayProp of each node and `path` the nodes, or the raw values when the value is not in treeData. Empty content shows the placeholder. */
|
|
153
199
|
display?: Snippet<[CascaderDisplaySnippetProps]>;
|
|
200
|
+
/** Replaces each tag in multiple mode, with `{ entity, index, disabled, onClose }`; `onClose` unchecks the node. */
|
|
154
201
|
tag?: Snippet<[CascaderTagSnippetProps]>;
|
|
202
|
+
/** Replaces a row of the search results, with `{ props, inputValue, disabled, data, checkStatus, selected, onCheck }`; spread `props` on the root element of the row. */
|
|
155
203
|
filterItem?: Snippet<[CascaderFilterItemSnippetProps]>;
|
|
204
|
+
/** Replaces the content of the trigger, with `{ value, inputValue, placeholder, disabled, onSearch, onClear, onRemove }`. */
|
|
156
205
|
trigger?: Snippet<[CascaderTriggerSnippetProps]>;
|
|
206
|
+
/** Custom expand icon; empty content keeps the default icon. */
|
|
157
207
|
expandIcon?: Snippet;
|
|
158
208
|
/** `null` hides the arrow */
|
|
159
209
|
arrowIcon?: Snippet | null;
|
|
210
|
+
/** Custom icon of the clear button, effective when showClear is true; empty content keeps the default icon. */
|
|
160
211
|
clearIcon?: Snippet;
|
|
212
|
+
/** Content shown when there is no data to pick or the search has no result. The default text from the locale shows when it is not given, and null hides the empty state. */
|
|
161
213
|
emptyContent?: Snippet | null;
|
|
214
|
+
/** Prefix content. */
|
|
162
215
|
prefix?: Snippet;
|
|
216
|
+
/** Suffix content. */
|
|
163
217
|
suffix?: Snippet;
|
|
218
|
+
/** A label inside the select box; it is not rendered when prefix is also given. */
|
|
164
219
|
insetLabel?: Snippet;
|
|
220
|
+
/** Extra content at the top of the dropdown. */
|
|
165
221
|
topSlot?: Snippet;
|
|
222
|
+
/** Extra content at the bottom of the dropdown. */
|
|
166
223
|
bottomSlot?: Snippet;
|
|
167
224
|
}
|
|
168
225
|
export {};
|
|
@@ -16,15 +16,25 @@ export type CheckboxEvent = {
|
|
|
16
16
|
nativeEvent: MouseEvent;
|
|
17
17
|
};
|
|
18
18
|
export interface CheckboxProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'onchange'>, Pick<HTMLInputAttributes, 'name' | 'autofocus'> {
|
|
19
|
+
/** Whether the checkbox is checked; bind it with `bind:checked`. Ignored inside a CheckboxGroup. `bind:checked={get, set}` makes it fully controlled; a plain `checked` is the initial value, a click overrides it inside the component, and a new value from the parent wins again. */
|
|
19
20
|
checked?: boolean;
|
|
21
|
+
/** The value this checkbox stands for in a CheckboxGroup. Without it the checkbox is not part of the group. */
|
|
20
22
|
value?: CheckboxValue;
|
|
23
|
+
/** Whether the checkbox is disabled. */
|
|
21
24
|
disabled?: boolean;
|
|
25
|
+
/** Indeterminate state. It only affects the appearance and the native input's indeterminate flag, never the checked value. */
|
|
22
26
|
indeterminate?: boolean;
|
|
27
|
+
/** Style type: default, card or pureCard. Inside a CheckboxGroup the group's type applies. */
|
|
23
28
|
type?: CheckboxType;
|
|
29
|
+
/** Id of the addon node, which aria-labelledby points to. Generated when omitted. */
|
|
24
30
|
addonId?: string;
|
|
31
|
+
/** Id of the extra node, which aria-describedby points to. Generated when omitted. */
|
|
25
32
|
extraId?: string;
|
|
33
|
+
/** Whether focusing prevents the browser from scrolling the element into view; applies to the focus method. */
|
|
26
34
|
preventScroll?: boolean;
|
|
35
|
+
/** Called when the checked state changes. The event's `target` is `{ checked, value, name, disabled }`. */
|
|
27
36
|
onChange?: (event: CheckboxEvent) => void;
|
|
37
|
+
/** Snippet of the supplementary text, which aria-describedby points to. */
|
|
28
38
|
extra?: Snippet;
|
|
29
39
|
}
|
|
30
40
|
export interface CheckboxOptionItem {
|
|
@@ -40,15 +50,24 @@ export interface CheckboxGroupOptionSnippetProps {
|
|
|
40
50
|
index: number;
|
|
41
51
|
}
|
|
42
52
|
export interface CheckboxGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onchange' | 'onblur'> {
|
|
53
|
+
/** Selected values, matched against each Checkbox's value; bind it with `bind:value`. `bind:value={get, set}` makes it fully controlled; a plain `value` is the initial value. */
|
|
43
54
|
value?: CheckboxValue[];
|
|
55
|
+
/** Whether the whole group is disabled. */
|
|
44
56
|
disabled?: boolean;
|
|
57
|
+
/** The name of every native input in the group. A unique value is generated per group when omitted. */
|
|
45
58
|
name?: string;
|
|
59
|
+
/** Declares the options as data. Each item is a string or `{ label, value, disabled, extra, class, style }`, where `style` is a string. */
|
|
46
60
|
options?: Array<string | CheckboxOptionItem>;
|
|
61
|
+
/** Layout direction inside the group: horizontal or vertical. */
|
|
47
62
|
direction?: CheckboxDirection;
|
|
63
|
+
/** Style type of every Checkbox in the group: default, card or pureCard. */
|
|
48
64
|
type?: CheckboxType;
|
|
65
|
+
/** Called when the selected values change, with the new array of values. */
|
|
49
66
|
onChange?: (value: CheckboxValue[]) => void;
|
|
50
67
|
/** Fires when focus leaves the whole group, not between its boxes */
|
|
51
68
|
onBlur?: (event: FocusEvent) => void;
|
|
69
|
+
/** Snippet for the label of each item in options, with the parameter `{ option, index }`. */
|
|
52
70
|
label?: Snippet<[CheckboxGroupOptionSnippetProps]>;
|
|
71
|
+
/** Snippet for the extra text of each item in options, with the parameter `{ option, index }`. */
|
|
53
72
|
extra?: Snippet<[CheckboxGroupOptionSnippetProps]>;
|
|
54
73
|
}
|
|
@@ -4,9 +4,12 @@ export type { CodeHighlightRegistration, CodeHighlightThemes, LanguageInput, The
|
|
|
4
4
|
export interface CodeHighlightProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
/** Treated as an empty string when undefined */
|
|
6
6
|
code?: string;
|
|
7
|
+
/** Language, which must be registered or passed through languages. */
|
|
7
8
|
language: string;
|
|
9
|
+
/** Whether to show line numbers. */
|
|
8
10
|
lineNumber?: boolean;
|
|
9
11
|
/** Grammars this block needs beyond the registered ones, loaded once into the shared highlighter. Declare it at module level: a new array on every render highlights again */
|
|
10
12
|
languages?: LanguageInput[];
|
|
13
|
+
/** Replaces the Shiki themes of this block for light and dark mode. */
|
|
11
14
|
themes?: CodeHighlightThemes;
|
|
12
15
|
}
|
|
@@ -3,24 +3,40 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
3
3
|
export interface CollapseProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onchange'> {
|
|
4
4
|
/** `null` and `''` are controlled "nothing open" values. */
|
|
5
5
|
activeKey?: string | string[] | null;
|
|
6
|
+
/** Accordion mode. */
|
|
6
7
|
accordion?: boolean;
|
|
8
|
+
/** Clicking anywhere in the header row toggles the panel; when false only the toggle button and the arrow respond. */
|
|
7
9
|
clickHeaderToExpand?: boolean;
|
|
10
|
+
/** Position of the expand icon: left or right. */
|
|
8
11
|
expandIconPosition?: 'left' | 'right';
|
|
12
|
+
/** Whether to keep the DOM tree of hidden panels; destroyed by default. When omitted it reads the global default of Collapse, then that of Collapsible. */
|
|
9
13
|
keepDOM?: boolean;
|
|
14
|
+
/** Whether to enable the animation; enabled by default. When omitted it reads the global default of Collapse, then that of Collapsible. */
|
|
10
15
|
motion?: boolean;
|
|
16
|
+
/** Used with keepDOM; when true, panel content is not rendered until the panel is first expanded. */
|
|
11
17
|
lazyRender?: boolean;
|
|
12
18
|
/** A keyboard toggle is also a click, because the header is a native button. */
|
|
13
19
|
onChange?: (activeKey: string[], event: MouseEvent) => void;
|
|
20
|
+
/** Snippet for the icon shown while a panel is collapsed, IconChevronDown by default. */
|
|
14
21
|
expandIcon?: Snippet;
|
|
22
|
+
/** Snippet for the icon shown while a panel is expanded, IconChevronUp by default. */
|
|
15
23
|
collapseIcon?: Snippet;
|
|
24
|
+
/** Snippet for the CollapsePanel panels. */
|
|
16
25
|
children?: Snippet;
|
|
17
26
|
}
|
|
18
27
|
export interface CollapsePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
28
|
+
/** Required and unique, matched against activeKey. */
|
|
19
29
|
itemKey: string;
|
|
30
|
+
/** Whether to show the arrow icon. */
|
|
20
31
|
showArrow?: boolean;
|
|
32
|
+
/** Whether the panel is disabled. */
|
|
21
33
|
disabled?: boolean;
|
|
34
|
+
/** Called when the expand or collapse animation ends. */
|
|
22
35
|
onMotionEnd?: () => void;
|
|
36
|
+
/** Snippet for the panel header content, rendered inside the toggle button; must not contain interactive elements. */
|
|
23
37
|
header?: Snippet;
|
|
38
|
+
/** Snippet for the auxiliary content on the right of the panel header, outside the toggle button; may hold controls. */
|
|
24
39
|
extra?: Snippet;
|
|
40
|
+
/** Snippet for the panel content; a panel counts as having content only when children is given. */
|
|
25
41
|
children?: Snippet;
|
|
26
42
|
}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
export interface CollapsibleProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** Whether the content area is expanded. */
|
|
4
5
|
isOpen?: boolean;
|
|
6
|
+
/** Animation duration in milliseconds. */
|
|
5
7
|
duration?: number;
|
|
8
|
+
/** Whether to enable the animation. */
|
|
6
9
|
motion?: boolean;
|
|
10
|
+
/** Whether to keep the DOM tree of the hidden content; it is destroyed by default. */
|
|
7
11
|
keepDOM?: boolean;
|
|
12
|
+
/** Used with keepDOM; when true, the content is not rendered on mount but after the first expansion. */
|
|
8
13
|
lazyRender?: boolean;
|
|
14
|
+
/** Height in pixels when collapsed. */
|
|
9
15
|
collapseHeight?: number;
|
|
16
|
+
/** Whether the collapsed height follows the content when it is shorter than collapseHeight. */
|
|
10
17
|
collapseHeightAdaptive?: boolean;
|
|
18
|
+
/** Whether to fade in and out. */
|
|
11
19
|
fade?: boolean;
|
|
12
20
|
/** Set on the inner content element, so a trigger's `aria-controls` can point at it. */
|
|
13
21
|
id?: string;
|
|
22
|
+
/** Called when the expand or collapse animation ends. */
|
|
14
23
|
onMotionEnd?: () => void;
|
|
24
|
+
/** Snippet for the content to expand or collapse. */
|
|
15
25
|
children?: Snippet;
|
|
16
26
|
}
|
|
@@ -10,17 +10,27 @@ export interface ColorPickerProps extends Omit<HTMLAttributes<HTMLDivElement>, '
|
|
|
10
10
|
* `null` is a controlled empty value: shows the default color and only reports changes
|
|
11
11
|
*/
|
|
12
12
|
value?: ColorValue | null;
|
|
13
|
+
/** Whether to enable transparency selection. */
|
|
13
14
|
alpha?: boolean;
|
|
15
|
+
/** Whether to enable the eyedropper color picker. */
|
|
14
16
|
eyeDropper?: boolean;
|
|
17
|
+
/** Color format used by default for manual input: `rgba`, `hex` or `hsva`. */
|
|
15
18
|
defaultFormat?: ColorFormat;
|
|
19
|
+
/** Width in pixels; 280 when not set. */
|
|
16
20
|
width?: number;
|
|
21
|
+
/** Height in pixels; 280 when not set. */
|
|
17
22
|
height?: number;
|
|
23
|
+
/** Whether to render inside a Popover; the trigger is `children`. Defaults to false. */
|
|
18
24
|
usePopover?: boolean;
|
|
25
|
+
/** Props passed to the Popover when usePopover is on, such as `trigger`, `aria-label` and `aria-labelledby`. The popup opens on click with role `dialog` by default and takes its name from the locale; `aria-label` or `aria-labelledby` takes precedence. */
|
|
19
26
|
popoverProps?: PopoverProps;
|
|
27
|
+
/** Called with a ColorValue, holding hsva, hex and rgba, when the user picks a color. */
|
|
20
28
|
onChange?: (value: ColorValue) => void;
|
|
21
29
|
/** The popover trigger when `usePopover`, a swatch of the current color by default; not rendered otherwise */
|
|
22
30
|
children?: Snippet;
|
|
31
|
+
/** Snippet that renders extra elements at the top. */
|
|
23
32
|
topSlot?: Snippet;
|
|
33
|
+
/** Snippet that renders extra elements at the bottom. */
|
|
24
34
|
bottomSlot?: Snippet;
|
|
25
35
|
}
|
|
26
36
|
export interface ColorChooseAreaProps {
|
|
@@ -3,17 +3,24 @@ import type { Locale as DateFnsLocale } from 'date-fns';
|
|
|
3
3
|
import type { ResponsiveConfig } from '@fibrae/semi-foundation/components/config-provider/responsive-types';
|
|
4
4
|
import type { LocaleInput } from '@fibrae/semi-foundation/locale';
|
|
5
5
|
export interface ContextValue extends ResponsiveConfig {
|
|
6
|
+
/** Text direction: ltr or rtl. Inherited from the outer ConfigProvider when omitted, and ltr at the outermost level. */
|
|
6
7
|
direction?: 'ltr' | 'rtl';
|
|
8
|
+
/** Time zone for time components: a number (hour offset from UTC), a GMT±HH:MM string or an IANA identifier. Numbers and GMT strings are fixed offsets all year. Inherited from the outer ConfigProvider when omitted. */
|
|
7
9
|
timeZone?: string | number;
|
|
10
|
+
/** Locale configuration, which takes precedence over LocaleProvider. Inherited from the outer ConfigProvider when omitted; when no ConfigProvider sets it, LocaleProvider decides, and zh_CN is used without either. Pass null to clear the outer locale. Takes the built-in zh_CN or en_US, or a custom pack with at least code, whose missing text and currency fall back to en_US. */
|
|
8
11
|
locale?: LocaleInput | null;
|
|
9
12
|
/** date-fns locale of DatePicker, TimePicker and Calendar; omitted: looked up by the locale code (zh-CN, en-US), else enUS */
|
|
10
13
|
dateFnsLocale?: DateFnsLocale;
|
|
14
|
+
/** Function returning the popup container. It only affects Modal, SideSheet and ImagePreview, which still render through a Portal; the container needs position: relative. Inherited from the outer ConfigProvider when omitted, and document.body at the outermost level. */
|
|
11
15
|
getPopupContainer?: () => HTMLElement;
|
|
16
|
+
/** Whether to observe responsive breakpoints. When off, no matchMedia listener is registered; when on, listeners are registered on the first subscription and removed when none remain. Inherited from the outer ConfigProvider when omitted, and false at the outermost level. */
|
|
12
17
|
responsiveObserve?: boolean;
|
|
13
18
|
}
|
|
14
19
|
export interface ConfigProviderProps extends Omit<ContextValue, 'onBreakpoint' | 'screens'> {
|
|
20
|
+
/** Content affected by the configuration. When an explicitly passed direction differs from the outer one, including at the outermost level, the content is wrapped in a div carrying the dir attribute. */
|
|
15
21
|
children?: Snippet;
|
|
16
22
|
}
|
|
17
23
|
export interface ConfigConsumerProps {
|
|
24
|
+
/** Snippet receiving the effective configuration (ContextValue). Inside a ConfigProvider it also holds screens and onBreakpoint; without a ConfigProvider it is an empty object. */
|
|
18
25
|
children: Snippet<[config: ContextValue]>;
|
|
19
26
|
}
|
|
@@ -2,10 +2,13 @@ import type { ClassValue, HTMLAttributes, HTMLImgAttributes } from 'svelte/eleme
|
|
|
2
2
|
import type { CropperPart } from '@fibrae/semi-foundation/components/cropper/constants';
|
|
3
3
|
export type CropperShape = 'rect' | 'round' | 'roundRect';
|
|
4
4
|
export interface CropperProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** Address of the image to crop. */
|
|
5
6
|
src?: string;
|
|
6
7
|
/** Passed to the image; `src`, the layout style and the order of `onload` are owned by the cropper */
|
|
7
8
|
imgProps?: HTMLImgAttributes;
|
|
9
|
+
/** Shape of the crop box. */
|
|
8
10
|
shape?: CropperShape;
|
|
11
|
+
/** Fixed aspect ratio of the crop box. When it changes after loading, the box is laid out again at the new ratio. */
|
|
9
12
|
aspectRatio?: number;
|
|
10
13
|
/** The initial width-to-height ratio of the cropping box, default is 1 */
|
|
11
14
|
defaultAspectRatio?: number;
|
|
@@ -13,14 +16,22 @@ export interface CropperProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
13
16
|
zoom?: number;
|
|
14
17
|
/** Image rotation angle; one-way, the cropper never changes it */
|
|
15
18
|
rotate?: number;
|
|
19
|
+
/** Whether to show the resize handles on the corners of the crop box. */
|
|
16
20
|
showResizeBox?: boolean;
|
|
21
|
+
/** Class names of the inner parts, keyed by `cropperBox` (the crop box); merged with the built-in classes. */
|
|
17
22
|
classNames?: Partial<Record<CropperPart, ClassValue>>;
|
|
23
|
+
/** Style strings of the inner parts, keyed like classNames; `cropperBox` is merged with the size and offset the component computes, and the size and offset win. */
|
|
18
24
|
styles?: Partial<Record<CropperPart, string>>;
|
|
25
|
+
/** Fill color of the parts of the result that are not the image. */
|
|
19
26
|
fill?: string;
|
|
27
|
+
/** Maximum zoom factor. */
|
|
20
28
|
maxZoom?: number;
|
|
29
|
+
/** Minimum zoom factor. */
|
|
21
30
|
minZoom?: number;
|
|
31
|
+
/** Zoom change per wheel step. */
|
|
22
32
|
zoomStep?: number;
|
|
23
33
|
/** The element the cropped area is mirrored into; it is a host DOM handle, so it stays a function */
|
|
24
34
|
preview?: () => HTMLElement | null | undefined;
|
|
35
|
+
/** Called by wheel zooming, with the new zoom. */
|
|
25
36
|
onZoomChange?: (zoom: number) => void;
|
|
26
37
|
}
|
|
@@ -44,57 +44,89 @@ type NativeRootKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onfo
|
|
|
44
44
|
interface DatePickerCommonProps extends Omit<HTMLAttributes<HTMLDivElement>, NativeRootKeys> {
|
|
45
45
|
/** Bindable. `null` is a controlled empty value; only `undefined` leaves the picker uncontrolled */
|
|
46
46
|
value?: DatePickerValueType | null;
|
|
47
|
+
/** Whether the panel is open, two-way bindable with bind:open. A plain value is the initial state. While bound, open() and close() do not change the visibility; the bound value wins. */
|
|
47
48
|
open?: boolean;
|
|
49
|
+
/** Format of the text in the input; the default depends on type. A format without time tokens turns dateTime into date and dateTimeRange into dateRange. */
|
|
48
50
|
format?: string;
|
|
49
51
|
/** The month the panel shows while there is no value */
|
|
50
52
|
defaultPickerValue?: DatePickerValueType;
|
|
53
|
+
/** The number of dates multiple allows; unlimited when omitted. */
|
|
51
54
|
max?: number;
|
|
52
55
|
/** Only for dateTime and dateTimeRange */
|
|
53
56
|
needConfirm?: boolean;
|
|
57
|
+
/** Whether the picker is disabled. */
|
|
54
58
|
disabled?: boolean;
|
|
59
|
+
/** Returns true to disable a date. The second argument carries rangeStart, rangeEnd and rangeInputFocus. When type is year, it is called with January 1 of each year, and returning true disables that year. */
|
|
55
60
|
disabledDate?: DatePickerDisabledDateType;
|
|
61
|
+
/** Returns disabledHours, disabledMinutes and disabledSeconds for the current date and panel position. */
|
|
56
62
|
disabledTime?: DatePickerDisabledTimeType;
|
|
63
|
+
/** Whether the time selection is disabled; for dateTime and dateTimeRange only. */
|
|
57
64
|
disabledTimePicker?: boolean;
|
|
65
|
+
/** Hides the times that are disabled. */
|
|
58
66
|
hideDisabledOptions?: boolean;
|
|
67
|
+
/** For dateRange, the start date of a range chosen with one click. */
|
|
59
68
|
startDateOffset?: DatePickerDateOffsetType;
|
|
69
|
+
/** For dateRange, the end date of a range chosen with one click. */
|
|
60
70
|
endDateOffset?: DatePickerDateOffsetType;
|
|
61
71
|
/** Defaults to the locale's placeholder of `type` */
|
|
62
72
|
placeholder?: string | string[];
|
|
63
73
|
/** Separates the range in the input text and parses it; the `rangeSeparatorNode` snippet only changes how it is shown */
|
|
64
74
|
rangeSeparator?: string;
|
|
75
|
+
/** Size of the input: small, default or large. */
|
|
65
76
|
size?: InputSize;
|
|
77
|
+
/** Size of the panel: default or compact. */
|
|
66
78
|
density?: DatePickerDensity;
|
|
79
|
+
/** Removes the border of the input. */
|
|
67
80
|
borderless?: boolean;
|
|
81
|
+
/** Whether the clear button is shown. */
|
|
68
82
|
showClear?: boolean;
|
|
83
|
+
/** Whether the input is read-only. */
|
|
69
84
|
inputReadOnly?: boolean;
|
|
85
|
+
/** Moves the inputs into the panel; pass an object to set the placeholders of the inputs. */
|
|
70
86
|
insetInput?: boolean | DatePickerInsetInputProps;
|
|
87
|
+
/** The id of the inset label element. */
|
|
71
88
|
insetLabelId?: string;
|
|
89
|
+
/** Validation status: default, error or warning. Only affects the style. */
|
|
72
90
|
validateStatus?: ValidateStatus;
|
|
73
91
|
/** Focuses the input on mount, which opens the panel */
|
|
74
92
|
autofocus?: boolean;
|
|
93
|
+
/** Whether focusing the input prevents the browser from scrolling to it. */
|
|
75
94
|
preventScroll?: boolean;
|
|
95
|
+
/** The first day of the week: 0 is Sunday, 1 is Monday, and so on. */
|
|
76
96
|
weekStartsOn?: WeekStartNumber;
|
|
97
|
+
/** First year of the year wheel. Defaults to 100 years before this year. */
|
|
77
98
|
startYear?: number;
|
|
99
|
+
/** Last year of the year wheel, which must be after the start year. Defaults to 100 years after this year. */
|
|
78
100
|
endYear?: number;
|
|
101
|
+
/** Switches the selected date automatically when the year or month is changed with the arrow buttons or the dropdown. Only for the date type. */
|
|
79
102
|
autoSwitchDate?: boolean;
|
|
103
|
+
/** Switches both panels of a range together. */
|
|
80
104
|
syncSwitchMonth?: boolean;
|
|
81
105
|
/** A function item, and a function `start` or `end`, is called when the presets render or are clicked */
|
|
82
106
|
presets?: DatePickerPresetsType;
|
|
107
|
+
/** Position of the presets: left, right, top or bottom. */
|
|
83
108
|
presetPosition?: DatePickerPresetPosition;
|
|
109
|
+
/** Options for the time panel: use12Hours, hourStep, minuteStep, secondStep, defaultIsAM and scrollItemProps. The panel owns the format, the value and the disabled times. */
|
|
84
110
|
timePickerOpts?: DatePickerTimePickerOpts;
|
|
111
|
+
/** Options for the year and month columns: cycled, mode, motion and transform. The panel owns the list and the selection. */
|
|
85
112
|
yearAndMonthOpts?: DatePickerYearAndMonthOpts;
|
|
86
113
|
/** Falls back to ConfigProvider's timeZone */
|
|
87
114
|
timeZone?: string | number;
|
|
115
|
+
/** Whether the panel animates when it opens. */
|
|
88
116
|
motion?: boolean;
|
|
117
|
+
/** Whether the panel adjusts its direction when it is clipped. */
|
|
89
118
|
autoAdjustOverflow?: boolean;
|
|
90
119
|
/** Defaults to leftTopOver with `insetInput`, else bottomLeft (bottomRight in RTL) */
|
|
91
120
|
position?: Position;
|
|
92
121
|
/** Defaults to 1 for an `insetInput` panel over the trigger, else the Popover spacing */
|
|
93
122
|
spacing?: number;
|
|
123
|
+
/** Whether click events on the panel stop propagating. */
|
|
94
124
|
stopPropagation?: boolean | string;
|
|
95
125
|
/** `dropdown` is the panel; `input` is the Input's root element (each of the two inputs of a range) */
|
|
96
126
|
classNames?: Partial<Record<DatePickerPart, ClassValue>>;
|
|
127
|
+
/** Style strings of the inner parts, keyed like classNames. */
|
|
97
128
|
styles?: Partial<Record<DatePickerPart, string>>;
|
|
129
|
+
/** Called when the panel opens or closes. */
|
|
98
130
|
onOpenChange?: (open: boolean) => void;
|
|
99
131
|
/**
|
|
100
132
|
* focusin of an input, or the click or key press on the trigger that focused the range start; `rangeType` is set
|
|
@@ -103,23 +135,37 @@ interface DatePickerCommonProps extends Omit<HTMLAttributes<HTMLDivElement>, Nat
|
|
|
103
135
|
onFocus?: (event: FocusEvent | MouseEvent | KeyboardEvent, rangeType?: DatePickerRangeInput) => void;
|
|
104
136
|
/** Fires when the panel closes: with the mousedown outside that closed it, otherwise without an event */
|
|
105
137
|
onBlur?: (event?: MouseEvent) => void;
|
|
138
|
+
/** Called when the clear button is clicked. */
|
|
106
139
|
onClear?: (event: MouseEvent) => void;
|
|
140
|
+
/** Called when the selection is cancelled, with the last confirmed value. Only with needConfirm. */
|
|
107
141
|
onCancel?: (date: Date | Date[], dateString: string | string[]) => void;
|
|
142
|
+
/** Called when the selection is confirmed, with the selected value. Only with needConfirm. */
|
|
108
143
|
onConfirm?: (date: Date | Date[], dateString: string | string[]) => void;
|
|
144
|
+
/** Called when the year or month of the panel changes. */
|
|
109
145
|
onPanelChange?: (date: Date | Date[], dateString: string | string[]) => void;
|
|
146
|
+
/** Called when a preset button is clicked; the second argument is the native MouseEvent. */
|
|
110
147
|
onPresetClick?: (item: DatePickerPresetType, event: MouseEvent) => void;
|
|
148
|
+
/** Called when the panel is open and the user presses outside the panel and the trigger, with the native mousedown event. */
|
|
111
149
|
onClickOutSide?: (event: MouseEvent) => void;
|
|
112
150
|
/** Replaces the inputs; with no focusable element of its own, its wrapper is the button that opens the panel */
|
|
113
151
|
trigger?: Snippet<[DatePickerTriggerRenderProps]>;
|
|
152
|
+
/** Content of a day cell, with dayNumber and fullDate (yyyy-MM-dd). */
|
|
114
153
|
date?: Snippet<[DatePickerDateSnippetProps]>;
|
|
115
154
|
/** The whole day cell, which then keeps only its base and active classes */
|
|
116
155
|
fullDate?: Snippet<[DatePickerFullDateSnippetProps]>;
|
|
156
|
+
/** Extra area at the top of the panel. */
|
|
117
157
|
topSlot?: Snippet;
|
|
158
|
+
/** Extra area at the bottom of the panel. */
|
|
118
159
|
bottomSlot?: Snippet;
|
|
160
|
+
/** Extra area at the left of the panel. */
|
|
119
161
|
leftSlot?: Snippet;
|
|
162
|
+
/** Extra area at the right of the panel. */
|
|
120
163
|
rightSlot?: Snippet;
|
|
164
|
+
/** Prefix of the input. */
|
|
121
165
|
prefix?: Snippet;
|
|
166
|
+
/** Inset label of the input. */
|
|
122
167
|
insetLabel?: Snippet;
|
|
168
|
+
/** Custom clear icon, used when showClear is true. */
|
|
123
169
|
clearIcon?: Snippet;
|
|
124
170
|
/** How the separator between the range inputs is shown; `rangeSeparator` is the string prop that parses the text */
|
|
125
171
|
rangeSeparatorNode?: Snippet;
|
|
@@ -129,6 +175,7 @@ export type DatePickerProps<T extends DatePickerType = DatePickerType, M extends
|
|
|
129
175
|
type?: T;
|
|
130
176
|
/** Only for the date type */
|
|
131
177
|
multiple?: M;
|
|
178
|
+
/** Called when the value changes, with the date and the date string; both are arrays for range and multiple. When cleared, a single value is undefined and range and multiple are []. A range type calls it only after both dates are chosen. */
|
|
132
179
|
onChange?: T extends 'dateRange' | 'dateTimeRange' | 'monthRange' ? (date: Date[], dateString: string[]) => void : T extends 'date' ? M extends true ? (date: Date[], dateString: string[]) => void : (date: Date | undefined, dateString: string | undefined) => void : (date: Date | undefined, dateString: string | undefined) => void;
|
|
133
180
|
};
|
|
134
181
|
/** What `trigger` receives; `onChange` sets the input text as typing would, `onEnterPress` commits it */
|
|
@@ -18,11 +18,17 @@ export interface DescriptionsSnippetArgs {
|
|
|
18
18
|
index: number;
|
|
19
19
|
}
|
|
20
20
|
export interface DescriptionsProps extends HTMLAttributes<HTMLDivElement> {
|
|
21
|
+
/** Alignment: center, justify, left or plain; ignored when row is true. */
|
|
21
22
|
align?: DescriptionsAlign;
|
|
23
|
+
/** Whether to display key and value in two rows. */
|
|
22
24
|
row?: boolean;
|
|
25
|
+
/** Size in two-row mode: small, medium or large. */
|
|
23
26
|
size?: DescriptionsSize;
|
|
27
|
+
/** Data to display, each item a `DescriptionsData`. */
|
|
24
28
|
data?: DescriptionsData[];
|
|
29
|
+
/** Layout mode: vertical or horizontal. */
|
|
25
30
|
layout?: DescriptionsLayout;
|
|
31
|
+
/** Total number of columns per row in the horizontal layout. */
|
|
26
32
|
column?: number;
|
|
27
33
|
/** Key of each data item; defaults to `item.key` */
|
|
28
34
|
itemKey?: Snippet<[DescriptionsSnippetArgs]>;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
export interface DividerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'align'> {
|
|
3
|
+
/** Alignment of the content: left, center or right. */
|
|
3
4
|
align?: 'left' | 'right' | 'center';
|
|
5
|
+
/** Margin above and below the divider, or left and right when vertical. A number is in pixels. */
|
|
4
6
|
margin?: number | string;
|
|
7
|
+
/** Whether the line is dashed. */
|
|
5
8
|
dashed?: boolean;
|
|
9
|
+
/** Direction of the divider: horizontal or vertical. */
|
|
6
10
|
layout?: 'horizontal' | 'vertical';
|
|
7
11
|
}
|
|
@@ -21,6 +21,7 @@ export interface DropdownMenuIconArgs {
|
|
|
21
21
|
* wraps a special trigger only in its own span, and Dropdown always renders the trigger itself. No element props: F11.
|
|
22
22
|
*/
|
|
23
23
|
export interface DropdownProps extends Omit<TooltipProps, 'showArrow' | 'arrowPointAtCenter' | 'disableArrowKeyDown' | 'arrow' | 'child' | 'children' | 'classNames' | 'content' | 'styles' | 'wrapWhenSpecial'> {
|
|
24
|
+
/** The trigger, wrapped in a span that takes the trigger attributes and responds to the keyboard. */
|
|
24
25
|
children?: Snippet;
|
|
25
26
|
/** Renders the trigger element itself, which takes `props`; use it for a button, a link or a parent `DropdownItem` */
|
|
26
27
|
child?: Snippet<[{
|
|
@@ -32,6 +33,7 @@ export interface DropdownProps extends Omit<TooltipProps, 'showArrow' | 'arrowPo
|
|
|
32
33
|
menuIcon?: Snippet<[DropdownMenuIconArgs]>;
|
|
33
34
|
/** `content` is the menu container `.semi-dropdown`, as `style` is; `class` goes on the popup `.semi-dropdown-wrapper` */
|
|
34
35
|
classNames?: Partial<Record<DropdownPart, ClassValue>>;
|
|
36
|
+
/** Configures the menu from data, see DropdownMenuItem below. content wins when it is provided. */
|
|
35
37
|
menu?: DropdownMenuItem[];
|
|
36
38
|
/**
|
|
37
39
|
* How the items of this menu are selected (a submenu takes its own Dropdown's value); `active` marks the selected
|
|
@@ -41,7 +43,9 @@ export interface DropdownProps extends Omit<TooltipProps, 'showArrow' | 'arrowPo
|
|
|
41
43
|
* - unset: menuitemcheckbox with aria-checked when showTick is on, otherwise menuitem without aria-checked.
|
|
42
44
|
*/
|
|
43
45
|
selectionMode?: DropdownSelectionMode;
|
|
46
|
+
/** Whether an active DropdownItem shows a tick on its leading side. It applies to the menu of this Dropdown only; nested submenus do not inherit it. */
|
|
44
47
|
showTick?: boolean;
|
|
48
|
+
/** Inline style strings of the inner parts, keyed like `classNames`; `content` is applied after `style`. */
|
|
45
49
|
styles?: Partial<Record<DropdownPart, string>>;
|
|
46
50
|
}
|
|
47
51
|
export interface DropdownHandle {
|
|
@@ -52,11 +56,15 @@ export interface DropdownHandle {
|
|
|
52
56
|
export interface DropdownMenuProps extends HTMLAttributes<HTMLUListElement> {
|
|
53
57
|
}
|
|
54
58
|
export interface DropdownItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
59
|
+
/** Whether the item is active: bolder text and a deeper color, plus a tick on its leading side when the Dropdown has showTick. */
|
|
55
60
|
active?: boolean;
|
|
61
|
+
/** Whether the item is disabled. */
|
|
56
62
|
disabled?: boolean;
|
|
57
63
|
/** Takes effect only outside a Dropdown; inside one, the Dropdown's showTick applies. */
|
|
58
64
|
showTick?: boolean;
|
|
65
|
+
/** Text color type: primary, secondary, tertiary, warning or danger. */
|
|
59
66
|
type?: 'primary' | 'secondary' | 'tertiary' | 'warning' | 'danger';
|
|
67
|
+
/** Icon of the item. The icon container is always rendered and is empty when the snippet outputs nothing. */
|
|
60
68
|
icon?: Snippet;
|
|
61
69
|
}
|
|
62
70
|
export interface DropdownTitleProps extends HTMLAttributes<HTMLLIElement> {
|
|
@@ -8,13 +8,20 @@ export interface EmptySvgNode {
|
|
|
8
8
|
/** Image URL, sprite symbol, or a snippet for any other content */
|
|
9
9
|
export type EmptyImage = string | EmptySvgNode | Snippet;
|
|
10
10
|
export interface EmptyProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
11
|
+
/** Layout mode: vertical or horizontal. */
|
|
11
12
|
layout?: EmptyLayout;
|
|
13
|
+
/** Class names of the inner parts, keyed by image; values take anything class takes (string, array or object) and merge with the built-in classes. */
|
|
12
14
|
classNames?: Partial<Record<EmptyPart, ClassValue>>;
|
|
15
|
+
/** Style strings of the inner parts, keyed like classNames. */
|
|
13
16
|
styles?: Partial<Record<EmptyPart, string>>;
|
|
17
|
+
/** Title, a string or a snippet. */
|
|
14
18
|
title?: string | Snippet;
|
|
19
|
+
/** Placeholder image: an image URL, an in-page SVG sprite symbol as `{ id }`, or a snippet for any other content. An empty string counts as no image. */
|
|
15
20
|
image?: EmptyImage;
|
|
16
21
|
/** Shown instead of `image` while the page is in dark mode */
|
|
17
22
|
darkModeImage?: EmptyImage;
|
|
23
|
+
/** Description content. */
|
|
18
24
|
description?: Snippet;
|
|
25
|
+
/** Actions below the description. */
|
|
19
26
|
children?: Snippet;
|
|
20
27
|
}
|