@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
|
@@ -23,45 +23,61 @@ export interface FeedbackContentSnippetProps {
|
|
|
23
23
|
content: Snippet;
|
|
24
24
|
}
|
|
25
25
|
export interface FeedbackOwnProps {
|
|
26
|
+
/** Display mode: popup is a non-modal panel at the bottom without a mask (SideSheet); modal is a modal dialog (Modal). Attributes Feedback does not declare go to the SideSheet or Modal of the current mode. */
|
|
26
27
|
mode?: FeedbackMode;
|
|
28
|
+
/** Type of the feedback content. For custom, the content goes in the children. */
|
|
27
29
|
type?: FeedbackType;
|
|
28
30
|
/** Forwarded to the Modal or SideSheet of the current mode. */
|
|
29
31
|
classNames?: Partial<Record<FeedbackPart, ClassValue>>;
|
|
32
|
+
/** Inline styles of the inner parts, keyed like classNames; every value is a style string. Passed to the Modal or SideSheet of the current mode. */
|
|
30
33
|
styles?: Partial<Record<FeedbackPart, string>>;
|
|
31
34
|
/** Bindable. The cancel paths (cancel button, close button, Escape, and for a modal the mask click) write `false`; the ok button never closes. */
|
|
32
35
|
visible?: boolean;
|
|
33
36
|
/** Plain text or a snippet. A string is declared here so `title="x"` is not a native tooltip. */
|
|
34
37
|
title?: string | Snippet;
|
|
38
|
+
/** Props of the multi-line input for the text and emoji types; its onChange is called as usual and does not replace the built-in handling. */
|
|
35
39
|
textAreaProps?: FeedbackTextAreaProps;
|
|
40
|
+
/** Props of the radio group for the radio type, written as the props of RadioGroup. The group has no accessible name by default; name it with aria-label. */
|
|
36
41
|
radioGroupProps?: FeedbackRadioGroupProps;
|
|
42
|
+
/** Props of the checkbox group for the checkbox type, written as the props of CheckboxGroup. The group has no accessible name by default; name it with aria-label. */
|
|
37
43
|
checkboxGroupProps?: FeedbackCheckboxGroupProps;
|
|
38
44
|
/** With `okButtonProps.disabled` unset, the ok button is disabled until something is chosen. */
|
|
39
45
|
okButtonProps?: FeedbackButtonProps;
|
|
46
|
+
/** Props of the cancel button. It is loading when either the built-in pending state or your loading says so. onclick runs before the built-in handling, which still runs. */
|
|
40
47
|
cancelButtonProps?: FeedbackButtonProps;
|
|
41
48
|
/** A returned Promise keeps the ok button loading until it settles and clears the value once it fulfills. */
|
|
42
49
|
onOk?: (event: MouseEvent) => unknown;
|
|
43
50
|
/** Cancel button, close button, Escape and (modal) mask click. `visible` becomes false once it returns, or once a returned Promise fulfills. */
|
|
44
51
|
onCancel?: (event: MouseEvent | KeyboardEvent) => unknown;
|
|
52
|
+
/** Called when the feedback content changes, with the current value: a string for text, `{ emoji, text }` for emoji (text is the reason filled in after choosing the bad face), the value of the chosen option for radio, and an array of chosen values for checkbox. */
|
|
45
53
|
onValueChange?: (value: FeedbackValue) => void;
|
|
54
|
+
/** Called after the panel has fully closed, in both modes. */
|
|
46
55
|
afterClose?: () => void;
|
|
47
56
|
/** Popup only. */
|
|
48
57
|
afterVisibleChange?: (visible: boolean) => void;
|
|
58
|
+
/** Feedback content for type custom. */
|
|
49
59
|
children?: Snippet;
|
|
50
60
|
/** Wraps or replaces the built-in content, whatever the type. */
|
|
51
61
|
content?: Snippet<[FeedbackContentSnippetProps]>;
|
|
52
62
|
/** A snippet replaces the default buttons; null renders no footer area. */
|
|
53
63
|
footer?: Snippet | null;
|
|
64
|
+
/** Icon inside the close button. */
|
|
54
65
|
closeIcon?: Snippet;
|
|
55
66
|
/** Modal only. A snippet replaces the default header; null renders no header. */
|
|
56
67
|
header?: Snippet | null;
|
|
68
|
+
/** Modal mode only: icon before the title. */
|
|
57
69
|
icon?: Snippet;
|
|
58
70
|
/** Modal only. `modal` is the role="dialog" element; place it with `{@render modal()}`. */
|
|
59
71
|
modal?: Snippet<[{
|
|
60
72
|
modal: Snippet;
|
|
61
73
|
}]>;
|
|
74
|
+
/** Snippet for the label of each item in radioGroupProps.options, with `{ option, index }` as its argument. */
|
|
62
75
|
radioLabel?: Snippet<[FeedbackRadioSnippetProps]>;
|
|
76
|
+
/** Snippet for the extra text of each item in radioGroupProps.options, with `{ option, index }` as its argument. */
|
|
63
77
|
radioExtra?: Snippet<[FeedbackRadioSnippetProps]>;
|
|
78
|
+
/** Snippet for the label of each item in checkboxGroupProps.options, with `{ option, index }` as its argument. */
|
|
64
79
|
checkboxLabel?: Snippet<[FeedbackCheckboxSnippetProps]>;
|
|
80
|
+
/** Snippet for the extra text of each item in checkboxGroupProps.options, with `{ option, index }` as its argument. */
|
|
65
81
|
checkboxExtra?: Snippet<[FeedbackCheckboxSnippetProps]>;
|
|
66
82
|
}
|
|
67
83
|
export interface FeedbackModalProps extends Omit<FeedbackOwnProps, 'mode'>, Omit<ModalProps, keyof FeedbackOwnProps> {
|
|
@@ -8,16 +8,25 @@ export type FloatButtonSize = ArrayElement<typeof strings.SIZE>;
|
|
|
8
8
|
/** Badge props; a count that is not text or a number is the `badgeCount` snippet. Listeners reach the badge's root. */
|
|
9
9
|
export type FloatButtonBadge = Omit<BadgeProps, 'children'>;
|
|
10
10
|
export interface FloatButtonProps extends Omit<HTMLButtonAttributes, 'children' | 'type' | 'form' | 'formaction' | 'formenctype' | 'formmethod' | 'formnovalidate' | 'formtarget'> {
|
|
11
|
+
/** Badge props, same as Badge without children. class, style, onclick, onmouseenter and onmouseleave reach the Badge root element. */
|
|
11
12
|
badge?: FloatButtonBadge;
|
|
13
|
+
/** Colorful float button. */
|
|
12
14
|
colorful?: boolean;
|
|
15
|
+
/** Disabled state. */
|
|
13
16
|
disabled?: boolean;
|
|
14
17
|
/** Renders a link instead of a button; a disabled link drops it */
|
|
15
18
|
href?: string;
|
|
19
|
+
/** Relationship to the link target. Only takes effect with href. */
|
|
16
20
|
rel?: string;
|
|
21
|
+
/** Shape: round or square. */
|
|
17
22
|
shape?: FloatButtonShape;
|
|
23
|
+
/** Size: default, small or large. */
|
|
18
24
|
size?: FloatButtonSize;
|
|
25
|
+
/** Where to display the linked URL. Only takes effect with href. */
|
|
19
26
|
target?: string;
|
|
27
|
+
/** Snippet for custom badge content, in place of badge.count. */
|
|
20
28
|
badgeCount?: Snippet;
|
|
29
|
+
/** Snippet for the button icon. */
|
|
21
30
|
icon?: Snippet;
|
|
22
31
|
}
|
|
23
32
|
export interface FloatButtonGroupItem extends Pick<FloatButtonProps, 'badge' | 'colorful' | 'disabled' | 'href' | 'rel' | 'shape' | 'size' | 'target'> {
|
|
@@ -41,11 +50,16 @@ export interface FloatButtonGroupItemSnippetArgs {
|
|
|
41
50
|
index: number;
|
|
42
51
|
}
|
|
43
52
|
export interface FloatButtonGroupProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
53
|
+
/** Disables every item. */
|
|
44
54
|
disabled?: boolean;
|
|
55
|
+
/** List of items. */
|
|
45
56
|
items: FloatButtonGroupItem[];
|
|
46
57
|
/** Called with the clicked item's `value`, which is optional; not called for clicks outside an item */
|
|
47
58
|
onClick?: (value: string | undefined, event: MouseEvent) => void;
|
|
59
|
+
/** Snippet for custom badge content of an item, with the argument `{ item, index }`. */
|
|
48
60
|
badgeCount?: Snippet<[FloatButtonGroupItemSnippetArgs]>;
|
|
61
|
+
/** Snippet for custom content of an item, with the argument `{ item, index }`. Defaults to item.content. */
|
|
49
62
|
content?: Snippet<[FloatButtonGroupItemSnippetArgs]>;
|
|
63
|
+
/** Snippet for the icon of an item, with the argument `{ item, index }`. */
|
|
50
64
|
icon?: Snippet<[FloatButtonGroupItemSnippetArgs]>;
|
|
51
65
|
}
|
|
@@ -17,15 +17,21 @@ export type ScrollOptions = ScrollIntoViewOptions;
|
|
|
17
17
|
export interface LabelProps extends Omit<HTMLLabelAttributes, 'children'> {
|
|
18
18
|
/** Content of the label; the `children` snippet takes precedence */
|
|
19
19
|
text?: string | number;
|
|
20
|
+
/** Alignment of the Label text. */
|
|
20
21
|
align?: string;
|
|
22
|
+
/** Whether it has the disabled style. */
|
|
21
23
|
disabled?: boolean;
|
|
22
24
|
/** Whether to display the required * symbol; hidden while `optional` is true */
|
|
23
25
|
required?: boolean;
|
|
26
|
+
/** Whether the optional text of the locale follows the text. The required * is then hidden. */
|
|
24
27
|
optional?: boolean;
|
|
28
|
+
/** The id of the labeled control, written to the for attribute of the label. */
|
|
25
29
|
name?: string;
|
|
26
30
|
/** Width of the label; a number is in px */
|
|
27
31
|
width?: number | string;
|
|
32
|
+
/** Label content, which takes precedence over text. */
|
|
28
33
|
children?: Snippet;
|
|
34
|
+
/** Content that follows the label text. */
|
|
29
35
|
extra?: Snippet;
|
|
30
36
|
/** Shown in a Tooltip by a help button beside the label, which is not part of the field's name */
|
|
31
37
|
tooltip?: Snippet | string | number;
|
|
@@ -53,20 +59,33 @@ export type FormProps<Values extends Record<string, any> = any, Output = Values>
|
|
|
53
59
|
export interface AllFormProps<Values extends Record<string, any> = any, Output = Values> extends Omit<HTMLFormAttributes, 'children' | 'onchange'> {
|
|
54
60
|
/** Initial values of the fields, copied once when the Form is created; may leave out any part of the values */
|
|
55
61
|
initValues?: DeepPartial<Values>;
|
|
62
|
+
/** Direction the fields are laid out in, vertical or horizontal. */
|
|
56
63
|
layout?: 'horizontal' | 'vertical';
|
|
64
|
+
/** Label position applied to every field; inset is only supported by some fields, the others lay out as top. The same prop on a field takes precedence. */
|
|
57
65
|
labelPosition?: 'top' | 'left' | 'inset';
|
|
66
|
+
/** Label width applied to every field; a number is in px. */
|
|
58
67
|
labelWidth?: number | string;
|
|
68
|
+
/** Label text alignment applied to every field. The same prop on a field takes precedence. */
|
|
59
69
|
labelAlign?: 'left' | 'right';
|
|
70
|
+
/** Label grid layout applied to every field, with the span, offset and other props of Col; set it together with wrapperCol. */
|
|
60
71
|
labelCol?: ColProps;
|
|
72
|
+
/** Control grid layout applied to every field, with the span, offset and other props of Col; set it together with labelCol. */
|
|
61
73
|
wrapperCol?: ColProps;
|
|
74
|
+
/** Position of extraText applied to every field: middle puts it between the Label and the control, bottom after the control. The same prop on a field takes precedence. */
|
|
62
75
|
extraTextPosition?: 'middle' | 'bottom';
|
|
63
76
|
/** Keep the key in the form values when a field value becomes undefined */
|
|
64
77
|
allowEmpty?: boolean;
|
|
78
|
+
/** Whether to scroll to the failing field when submit or formApi.validate fails; an object is passed on as options of scroll-into-view-if-needed. */
|
|
65
79
|
autoScrollToError?: boolean | ScrollOptions;
|
|
80
|
+
/** Whether the icon of the status shows before the validation message. */
|
|
66
81
|
showValidateIcon?: boolean;
|
|
82
|
+
/** The disabled applied to every field; the disabled of a field takes precedence. */
|
|
67
83
|
disabled?: boolean;
|
|
84
|
+
/** Whether validation with rules stops at the first failing rule. The same prop on a field takes precedence. */
|
|
68
85
|
stopValidateWithError?: boolean;
|
|
86
|
+
/** When fields validate: change, blur, mount, custom or an array of them. The same prop on a field takes precedence. */
|
|
69
87
|
trigger?: FieldValidateTriggerType;
|
|
88
|
+
/** Whether the submit and reset events stop bubbling, to keep a nested Form from triggering the outer Form. */
|
|
70
89
|
stopPropagation?: {
|
|
71
90
|
submit?: boolean;
|
|
72
91
|
reset?: boolean;
|
|
@@ -79,20 +98,27 @@ export interface AllFormProps<Values extends Record<string, any> = any, Output =
|
|
|
79
98
|
schemaDebounce?: number;
|
|
80
99
|
/** Whether an unmounted field or ArrayField keeps its value, error and touched state; a field's own `keepState` wins */
|
|
81
100
|
keepState?: boolean;
|
|
101
|
+
/** The formApi returned by useForm, to control the form from outside the Form. */
|
|
82
102
|
form?: FormApi<Values, Output>;
|
|
83
103
|
/** Also written to `x-form-id`; generated when missing */
|
|
84
104
|
id?: string;
|
|
105
|
+
/** Called after the submit button or formApi.submitForm and a passing validation, with the values and the submit event. With `schema`, the values are the schema's output. */
|
|
85
106
|
onSubmit?: (values: Output, e?: SubmitEvent) => void;
|
|
86
107
|
/** `errors` is the error tree of the failed fields, or what the Form validator threw */
|
|
87
108
|
onSubmitFail?: (errors: Partial<AllErrors<Values>> | unknown, values: Partial<Values>, e?: SubmitEvent) => void;
|
|
109
|
+
/** Called when the reset button or formApi.reset resets the form. */
|
|
88
110
|
onReset?: () => void;
|
|
111
|
+
/** Called when the form state updates, including field mount, unmount, value change, blur, and changes of validation status and errors, with the formState. */
|
|
89
112
|
onChange?: (formState: FormState<Values>) => void;
|
|
113
|
+
/** Called when a field value changes, with all values and the changed field values. */
|
|
90
114
|
onValueChange?: (values: Values, changedValues: Partial<Values>) => void;
|
|
115
|
+
/** Called when the validation state updates, with all errors and the changed field errors. A batch such as validate, submit or reset calls it once, and silent validation does not call it. */
|
|
91
116
|
onErrorChange?: (errors: AllErrors<Values>, changedError?: Partial<Record<FieldPath<Values>, FieldError>>) => void;
|
|
92
117
|
/** scrollToField or focusField found nothing rendered at `field`: expand the collapsed container that holds it */
|
|
93
118
|
onRevealField?: (field: FieldPath<Values>) => void;
|
|
94
119
|
/** Called once when the Form mounts, to save the formApi reference */
|
|
95
120
|
getFormApi?: (formApi: FormApi<Values, Output>) => void;
|
|
121
|
+
/** Content of the form, with `{ formState, formApi, values }`, for reading only; change the form through formApi. */
|
|
96
122
|
children?: Snippet<[FormRenderProps<Values, Output>]>;
|
|
97
123
|
}
|
|
98
124
|
/** What a field reads; callers pass `rules` or `validator`, not both (`FieldProps` applies ExclusiveFieldValidation) */
|
|
@@ -205,50 +231,71 @@ export interface ArrayFieldSnippetProps {
|
|
|
205
231
|
onMove: (from: number, to: number) => void;
|
|
206
232
|
}
|
|
207
233
|
export interface ArrayFieldProps {
|
|
234
|
+
/** Path of the array in formState.values, required. For row fields such as a[0].name and a[1].name, pass a. */
|
|
208
235
|
field: string;
|
|
236
|
+
/** Initial value of the array, which must be an array; it takes precedence over the initValues of the Form. */
|
|
209
237
|
initValue?: unknown[];
|
|
210
238
|
/** Keeps the rows in the form values while the ArrayField is unmounted; unset follows the Form */
|
|
211
239
|
keepState?: boolean;
|
|
240
|
+
/** Content of the rows, with `{ arrayFields, onAdd, onAddWithInitValue, onMove }`. `onMove(from, to)` moves a row with its values, errors and touched state, clamping indexes out of range. */
|
|
212
241
|
children?: Snippet<[ArrayFieldSnippetProps]>;
|
|
213
242
|
}
|
|
214
243
|
export interface ErrorMessageProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
215
244
|
/** The messages, joined with commas; `['']` fails without a text, and hides the help text too */
|
|
216
245
|
error?: FieldError;
|
|
246
|
+
/** Whether the icon of validateStatus shows. */
|
|
217
247
|
showValidateIcon?: boolean;
|
|
248
|
+
/** Validation status of the message: default, error, warning or success. */
|
|
218
249
|
validateStatus?: ValidateStatus;
|
|
250
|
+
/** Whether it sits in an InputGroup; with true and showValidateIcon true, the error icon shows whatever validateStatus is. */
|
|
219
251
|
isInInputGroup?: boolean;
|
|
220
252
|
/** The id of the error text, the target of the control's aria-errormessage */
|
|
221
253
|
errorMessageId?: string;
|
|
222
254
|
/** The id of the help text, the target of the control's aria-describedby */
|
|
223
255
|
helpTextId?: string;
|
|
256
|
+
/** Help text, shown when there is no error, in the same block as the error. */
|
|
224
257
|
helpText?: Snippet;
|
|
258
|
+
/** Custom rendering of the error, with `{ error }`. */
|
|
225
259
|
errorContent?: Snippet<[{
|
|
226
260
|
error: FieldError;
|
|
227
261
|
}]>;
|
|
228
262
|
}
|
|
229
263
|
export interface SectionProps extends Omit<HTMLFieldsetAttributes, 'children'> {
|
|
264
|
+
/** Title of the section; without content the title element is not rendered. */
|
|
230
265
|
text?: Snippet;
|
|
231
266
|
/** Shown below the title and describes the fieldset */
|
|
232
267
|
extraText?: Snippet;
|
|
268
|
+
/** The fields in the section. */
|
|
233
269
|
children?: Snippet;
|
|
234
270
|
}
|
|
235
271
|
export interface SlotProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
272
|
+
/** The Label text, or a Label configuration such as text, align, width, required, optional and id; the `fieldLabel` snippet takes precedence. */
|
|
236
273
|
label?: string | number | FieldLabel;
|
|
274
|
+
/** Position of the Label, taken from the Form by default: top or left. */
|
|
237
275
|
labelPosition?: 'top' | 'left';
|
|
276
|
+
/** Whether to leave out the Label; with both labelCol and wrapperCol set on the Form, the Label column stays. */
|
|
238
277
|
noLabel?: boolean;
|
|
278
|
+
/** The error, a string array, rendered after the content; omitted when not given. */
|
|
239
279
|
error?: FieldError;
|
|
280
|
+
/** The custom content to place. */
|
|
240
281
|
children?: Snippet;
|
|
282
|
+
/** Label content, which takes precedence over the text in the label prop. */
|
|
241
283
|
fieldLabel?: Snippet;
|
|
284
|
+
/** Content that follows the Label text. */
|
|
242
285
|
labelExtra?: Snippet;
|
|
286
|
+
/** Custom rendering of the error, with `{ error }`. */
|
|
243
287
|
errorContent?: Snippet<[{
|
|
244
288
|
error: FieldError;
|
|
245
289
|
}]>;
|
|
246
290
|
}
|
|
247
291
|
export interface InputGroupProps extends Omit<BaseInputGroupProps, 'label'> {
|
|
292
|
+
/** The Label of the whole Group: a string is the text, an object is a Label configuration whose id is the id of the Label; the `fieldLabel` snippet takes precedence. */
|
|
248
293
|
label?: string | number | (FieldLabel & {
|
|
249
294
|
id?: string;
|
|
250
295
|
});
|
|
296
|
+
/** Position of extraText: middle puts it between the Label and the Group, bottom after the Group. */
|
|
251
297
|
extraTextPosition?: 'bottom' | 'middle';
|
|
298
|
+
/** Extra hint, always shown, referred to by the aria-describedby of every control in the group. */
|
|
252
299
|
extraText?: Snippet;
|
|
253
300
|
}
|
|
254
301
|
interface SchemaNodeContext {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cssClasses } from '@fibrae/semi-foundation/components/form/constants';
|
|
3
3
|
import { toCssLength } from '@fibrae/semi-foundation/utils';
|
|
4
4
|
import '@fibrae/semi-foundation/components/form/form.css';
|
|
5
|
-
import {
|
|
5
|
+
import { IconHelpCircleStroked } from '@fibrae/semi-icons-svelte';
|
|
6
6
|
import useLocale from '../locale/use-locale.svelte.js';
|
|
7
7
|
import type { TooltipTriggerProps } from '../tooltip/interface.js';
|
|
8
8
|
import Tooltip from '../tooltip/tooltip.svelte';
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
{#snippet tooltipButton(triggerProps: Partial<TooltipTriggerProps>)}
|
|
37
37
|
<button {...triggerProps} aria-label={locale().locale.labelTooltip} class={`${prefix}-tooltip`} type="button">
|
|
38
|
-
<
|
|
38
|
+
<IconHelpCircleStroked size="inherit" />
|
|
39
39
|
</button>
|
|
40
40
|
{/snippet}
|
|
41
41
|
|
|
@@ -4,21 +4,34 @@ import type { Gutter } from '@fibrae/semi-foundation/components/grid/gutter';
|
|
|
4
4
|
import type { ColSize } from '@fibrae/semi-foundation/components/grid/utils';
|
|
5
5
|
export type { Breakpoint, ColSize, Gutter };
|
|
6
6
|
export interface RowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'align'> {
|
|
7
|
+
/** Vertical alignment of the children: top, middle or bottom. */
|
|
7
8
|
align?: 'top' | 'middle' | 'bottom';
|
|
9
|
+
/** Horizontal arrangement of the children: start, end, center, space-around or space-between. */
|
|
8
10
|
justify?: 'start' | 'end' | 'center' | 'space-around' | 'space-between';
|
|
9
11
|
/** A pair is [horizontal, vertical] */
|
|
10
12
|
gutter?: Gutter | [Gutter, Gutter];
|
|
11
13
|
}
|
|
12
14
|
export interface ColProps extends HTMLAttributes<HTMLDivElement> {
|
|
15
|
+
/** Number of columns the cell spans. 0 behaves like display: none. */
|
|
13
16
|
span?: number;
|
|
17
|
+
/** Column order. */
|
|
14
18
|
order?: number;
|
|
19
|
+
/** Number of columns to offset from the start side. No column can sit inside the offset. */
|
|
15
20
|
offset?: number;
|
|
21
|
+
/** Number of columns to move toward the end side. */
|
|
16
22
|
push?: number;
|
|
23
|
+
/** Number of columns to move toward the start side. */
|
|
17
24
|
pull?: number;
|
|
25
|
+
/** Base-layer responsive grid. It applies at every screen width, as a column count or an object. */
|
|
18
26
|
xs?: number | ColSize;
|
|
27
|
+
/** Responsive grid for screens ≥576px, as a column count or an object. */
|
|
19
28
|
sm?: number | ColSize;
|
|
29
|
+
/** Responsive grid for screens ≥768px, as a column count or an object. */
|
|
20
30
|
md?: number | ColSize;
|
|
31
|
+
/** Responsive grid for screens ≥992px, as a column count or an object. */
|
|
21
32
|
lg?: number | ColSize;
|
|
33
|
+
/** Responsive grid for screens ≥1200px, as a column count or an object. */
|
|
22
34
|
xl?: number | ColSize;
|
|
35
|
+
/** Responsive grid for screens ≥1600px, as a column count or an object. */
|
|
23
36
|
xxl?: number | ColSize;
|
|
24
37
|
}
|
|
@@ -10,11 +10,18 @@ export interface ComplexSearchWord {
|
|
|
10
10
|
export type SearchWord = string | ComplexSearchWord | undefined;
|
|
11
11
|
export type SearchWords = SearchWord[];
|
|
12
12
|
export interface HighlightProps {
|
|
13
|
+
/** Whether to escape regular expression characters in searchWords. */
|
|
13
14
|
autoEscape?: boolean;
|
|
15
|
+
/** Whether matching is case sensitive. */
|
|
14
16
|
caseSensitive?: boolean;
|
|
17
|
+
/** Source text. */
|
|
15
18
|
sourceString?: string;
|
|
19
|
+
/** Text to highlight: a string, a string array, or an array of objects with text, class and style. */
|
|
16
20
|
searchWords?: string | SearchWords;
|
|
21
|
+
/** Class names of the highlight tag, keyed by highlight; values take anything class takes (string, array or object) and merge with the built-in classes. The class of a `searchWords` item is appended after them. */
|
|
17
22
|
classNames?: Partial<Record<HighlightPart, ClassValue>>;
|
|
23
|
+
/** Style string of the highlight tag, keyed by highlight. The style of a `searchWords` item is applied after it. */
|
|
18
24
|
styles?: Partial<Record<HighlightPart, string>>;
|
|
25
|
+
/** Tag name of the highlight element. */
|
|
19
26
|
component?: string;
|
|
20
27
|
}
|
|
@@ -2,9 +2,12 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
2
2
|
export interface HotKeysProps extends HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/** Keys that must be pressed together: any number of modifiers and exactly one other key */
|
|
4
4
|
hotKeys: KeyboardEvent['key'][];
|
|
5
|
+
/** Key labels to show. Defaults to hotKeys. */
|
|
5
6
|
content?: string[];
|
|
7
|
+
/** Whether the default behavior of the key combination is prevented. */
|
|
6
8
|
preventDefault?: boolean;
|
|
7
9
|
/** Element that listens for keydown; defaults to document.body */
|
|
8
10
|
getListenerTarget?: () => HTMLElement | null | undefined;
|
|
11
|
+
/** Called when the full key combination is pressed, with the native KeyboardEvent. */
|
|
9
12
|
onHotKey?: (event: KeyboardEvent) => void;
|
|
10
13
|
}
|
|
@@ -14,44 +14,83 @@ export interface PreviewOptions {
|
|
|
14
14
|
previewTitle?: string;
|
|
15
15
|
/** One per entry of `src`; the title of the shown image wins over `previewTitle` */
|
|
16
16
|
titles?: (string | undefined)[];
|
|
17
|
+
/** Alternative texts of the preview images, one per entry of src. */
|
|
17
18
|
alts?: (string | undefined)[];
|
|
19
|
+
/** Whether clicking the mask closes the preview. */
|
|
18
20
|
maskClosable?: boolean;
|
|
21
|
+
/** Whether to show the close button. */
|
|
19
22
|
closable?: boolean;
|
|
23
|
+
/** Whether Esc closes the preview. */
|
|
20
24
|
closeOnEsc?: boolean;
|
|
25
|
+
/** Whether switching loops around. */
|
|
21
26
|
infinite?: boolean;
|
|
27
|
+
/** Whether to show tooltips on the bottom controls. */
|
|
22
28
|
showTooltip?: boolean;
|
|
29
|
+
/** Whether to preload neighboring images. */
|
|
23
30
|
preLoad?: boolean;
|
|
31
|
+
/** How many images ahead and behind to preload. */
|
|
24
32
|
preLoadGap?: number;
|
|
33
|
+
/** Idle time in milliseconds before the preview controls hide. */
|
|
25
34
|
viewerVisibleDelay?: number;
|
|
35
|
+
/** Zoom change per step. */
|
|
26
36
|
zoomStep?: number;
|
|
37
|
+
/** Maximum zoom factor. */
|
|
27
38
|
maxZoom?: number;
|
|
39
|
+
/** Minimum zoom factor. */
|
|
28
40
|
minZoom?: number;
|
|
41
|
+
/** z-index of the preview layer. */
|
|
29
42
|
zIndex?: number;
|
|
43
|
+
/** Whether to disable download. */
|
|
30
44
|
disableDownload?: boolean;
|
|
45
|
+
/** Initial zoom factor of an image, applied once when it first opens or is switched to, clamped by minZoom and maxZoom. */
|
|
31
46
|
initialZoom?: number;
|
|
47
|
+
/** The crossorigin attribute passed to the preview img element. */
|
|
32
48
|
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
49
|
+
/** Class names of the inner parts, keyed by `preview` (the preview layer, the `role="dialog"` element); merged with the built-in classes. */
|
|
33
50
|
classNames?: Partial<Record<ImagePreviewPart, ClassValue>>;
|
|
51
|
+
/** Style strings of the inner parts, keyed like classNames. */
|
|
34
52
|
styles?: Partial<Record<ImagePreviewPart, string>>;
|
|
53
|
+
/** Tip of the previous button. */
|
|
35
54
|
prevTip?: string;
|
|
55
|
+
/** Tip of the next button. */
|
|
36
56
|
nextTip?: string;
|
|
57
|
+
/** Tip of the zoom-in button. */
|
|
37
58
|
zoomInTip?: string;
|
|
59
|
+
/** Tip of the zoom-out button. */
|
|
38
60
|
zoomOutTip?: string;
|
|
61
|
+
/** Tip of the rotate button. */
|
|
39
62
|
rotateTip?: string;
|
|
63
|
+
/** Tip of the download button. */
|
|
40
64
|
downloadTip?: string;
|
|
65
|
+
/** Tip of the fit-to-page button. */
|
|
41
66
|
adaptiveTip?: string;
|
|
67
|
+
/** Tip of the original-size button. */
|
|
42
68
|
originTip?: string;
|
|
69
|
+
/** Parent DOM the preview renders into. A container other than document.body makes the preview non-modal; a custom container needs position: relative. */
|
|
43
70
|
getPopupContainer?: () => HTMLElement;
|
|
71
|
+
/** Sets the download file name of an image. */
|
|
44
72
|
setDownloadName?: (src: string) => string;
|
|
73
|
+
/** Called when visibility changes. */
|
|
45
74
|
onVisibleChange?: (visible: boolean) => void;
|
|
75
|
+
/** Called when the image switches. */
|
|
46
76
|
onChange?: (index: number) => void;
|
|
77
|
+
/** Called when closed with the close button or Esc; closing by the mask triggers onVisibleChange only. */
|
|
47
78
|
onClose?: () => void;
|
|
79
|
+
/** Called when the image zooms in. */
|
|
48
80
|
onZoomIn?: (zoom: number) => void;
|
|
81
|
+
/** Called when the image zooms out. */
|
|
49
82
|
onZoomOut?: (zoom: number) => void;
|
|
83
|
+
/** Called when switching to the previous image. */
|
|
50
84
|
onPrev?: (index: number) => void;
|
|
85
|
+
/** Called when switching to the next image. */
|
|
51
86
|
onNext?: (index: number) => void;
|
|
87
|
+
/** Called when switching between original size and fit-to-page. */
|
|
52
88
|
onRatioChange?: (type: RatioType) => void;
|
|
89
|
+
/** Called when the image rotates counterclockwise. */
|
|
53
90
|
onRotateLeft?: (angle: number) => void;
|
|
91
|
+
/** Called when an image is downloaded. */
|
|
54
92
|
onDownload?: (src: string, index: number) => void;
|
|
93
|
+
/** Called when a download fails. */
|
|
55
94
|
onDownloadError?: (src: string) => void;
|
|
56
95
|
}
|
|
57
96
|
export type ImagePreviewProps = PreviewOptions;
|
|
@@ -92,10 +131,15 @@ export interface ImagePreviewIconSnippetProps {
|
|
|
92
131
|
}
|
|
93
132
|
/** Custom nodes of the preview; on Image they apply to its own preview only, not inside a group */
|
|
94
133
|
export interface PreviewSnippets {
|
|
134
|
+
/** Replaces the content of the title section at the top of the preview; when there is a title, the dialog is named by the text the snippet renders. It applies to this Image's own preview only and has no effect inside an ImagePreview. */
|
|
95
135
|
title?: Snippet<[ImagePreviewTitleSnippetProps]>;
|
|
136
|
+
/** Custom bottom menu of the preview. It applies to this Image's own preview only and has no effect inside an ImagePreview. */
|
|
96
137
|
previewMenu?: Snippet<[MenuProps]>;
|
|
138
|
+
/** Custom previous icon. It applies to this Image's own preview only and has no effect inside an ImagePreview. */
|
|
97
139
|
leftIcon?: Snippet<[ImagePreviewIconSnippetProps]>;
|
|
140
|
+
/** Custom next icon. It applies to this Image's own preview only and has no effect inside an ImagePreview. */
|
|
98
141
|
rightIcon?: Snippet<[ImagePreviewIconSnippetProps]>;
|
|
142
|
+
/** Custom close icon. It applies to this Image's own preview only and has no effect inside an ImagePreview. */
|
|
99
143
|
closeIcon?: Snippet;
|
|
100
144
|
}
|
|
101
145
|
type NativeKeys = 'children' | 'title' | 'onchange';
|
|
@@ -108,25 +152,40 @@ export interface PreviewProps extends Omit<HTMLAttributes<HTMLDivElement>, Nativ
|
|
|
108
152
|
visible?: boolean;
|
|
109
153
|
/** Bindable; leave it out for an uncontrolled preview. `bind:currentIndex={get, set}` makes it fully controlled */
|
|
110
154
|
currentIndex?: number;
|
|
155
|
+
/** Whether to lazy-load the images of the group. */
|
|
111
156
|
lazyLoad?: boolean;
|
|
157
|
+
/** The rootMargin of the lazy-load observer, relative to the viewport; scrolling ancestors still clip. */
|
|
112
158
|
lazyLoadMargin?: string;
|
|
159
|
+
/** Snippet for the Image components to preview. */
|
|
113
160
|
children?: Snippet;
|
|
114
161
|
}
|
|
115
162
|
type ImgNativeKeys = 'src' | 'width' | 'height' | 'alt' | 'crossorigin' | 'onload' | 'onerror' | 'children' | 'title' | 'placeholder';
|
|
116
163
|
/** `class` and `style` go on the thumbnail element; the other attributes land on the img */
|
|
117
164
|
export interface ImageProps extends Omit<HTMLImgAttributes, ImgNativeKeys>, PreviewSnippets {
|
|
165
|
+
/** Image source URL. */
|
|
118
166
|
src?: string;
|
|
167
|
+
/** Display width of the image; a number is in px. */
|
|
119
168
|
width?: string | number;
|
|
169
|
+
/** Display height of the image; a number is in px. */
|
|
120
170
|
height?: string | number;
|
|
171
|
+
/** Image description, also the accessible name of a previewable thumbnail. */
|
|
121
172
|
alt?: string;
|
|
173
|
+
/** The crossorigin attribute passed to the native img element. */
|
|
122
174
|
crossOrigin?: 'anonymous' | 'use-credentials';
|
|
123
175
|
/** A string is the src of the image shown when loading fails; a snippet renders instead of it */
|
|
124
176
|
fallback?: string | Snippet;
|
|
177
|
+
/** Snippet for the placeholder content shown until the image has loaded. */
|
|
125
178
|
placeholder?: Snippet;
|
|
179
|
+
/** Preview options; false disables preview. The object carries data and callbacks only; use the Image snippets for custom content. */
|
|
126
180
|
preview?: boolean | ImagePreviewProps;
|
|
181
|
+
/** Class names of the inner parts, keyed by `img` (the inner img element); merged with the built-in classes. */
|
|
127
182
|
classNames?: Partial<Record<ImagePart, ClassValue>>;
|
|
183
|
+
/** Style strings of the inner parts, keyed like classNames. */
|
|
128
184
|
styles?: Partial<Record<ImagePart, string>>;
|
|
185
|
+
/** Sets the download file name of the image. */
|
|
129
186
|
setDownloadName?: (src: string) => string;
|
|
187
|
+
/** Called when the image has loaded. */
|
|
130
188
|
onLoad?: (event: Event) => void;
|
|
189
|
+
/** Called when the image fails to load. */
|
|
131
190
|
onError?: (event: Event) => void;
|
|
132
191
|
}
|