@fibrae/semi-ui-svelte 0.2.0 → 0.3.1
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/LICENSE +0 -62
- package/README.md +40 -38
- package/README.zh-CN.md +91 -0
- package/dist/_base/create-context.js +0 -1
- package/dist/_base/css-animation.js +0 -1
- package/dist/_base/group-role.d.ts +0 -1
- package/dist/_base/group-role.js +0 -1
- package/dist/_base/slot-kind.d.ts +0 -1
- package/dist/_base/slot-kind.js +0 -1
- package/dist/_base/teleport.d.ts +0 -2
- package/dist/_base/teleport.js +0 -2
- package/dist/_base/use-click-outside.svelte.d.ts +2 -2
- package/dist/_base/use-click-outside.svelte.js +2 -2
- package/dist/_base/use-foundation.svelte.js +2 -5
- package/dist/_base/virtual-list.svelte +2 -3
- package/dist/_base/virtual-list.svelte.d.ts +0 -1
- package/dist/_sortable/interface.d.ts +0 -1
- package/dist/anchor/interface.d.ts +0 -3
- package/dist/anchor/link-item.svelte +0 -1
- package/dist/anchor/links.d.ts +0 -1
- package/dist/anchor/links.js +0 -1
- package/dist/audio-player/audio-player.svelte +0 -2
- package/dist/audio-player/audio-slider.svelte +0 -3
- package/dist/auto-complete/auto-complete.svelte +0 -5
- package/dist/auto-complete/interface.d.ts +0 -9
- package/dist/avatar/avatar-group-more.svelte +0 -1
- package/dist/avatar/avatar.svelte +0 -4
- package/dist/avatar/context.d.ts +0 -1
- package/dist/avatar/interface.d.ts +0 -4
- package/dist/backtop/backtop.svelte +0 -2
- package/dist/backtop/interface.d.ts +0 -1
- package/dist/badge/interface.d.ts +0 -1
- package/dist/banner/banner.svelte +1 -1
- package/dist/banner/interface.d.ts +1 -3
- package/dist/breadcrumb/breadcrumb-item.svelte +0 -1
- package/dist/breadcrumb/breadcrumb.svelte +0 -1
- package/dist/breadcrumb/interface.d.ts +0 -7
- package/dist/calendar/calendar.svelte +0 -1
- package/dist/calendar/day-calendar.svelte +0 -3
- package/dist/calendar/interface.d.ts +0 -8
- package/dist/calendar/month-calendar.svelte +0 -4
- package/dist/calendar/time-grid.svelte +0 -2
- package/dist/calendar/time-grid.svelte.d.ts +0 -1
- package/dist/calendar/use-today.svelte.d.ts +0 -1
- package/dist/calendar/use-today.svelte.js +0 -1
- package/dist/card/index.js +0 -1
- package/dist/card/interface.d.ts +0 -3
- package/dist/carousel/carousel.svelte +0 -4
- package/dist/carousel/interface.d.ts +0 -3
- package/dist/cascader/cascader.svelte +0 -6
- package/dist/cascader/interface.d.ts +0 -19
- package/dist/cascader/item.svelte +0 -4
- package/dist/cascader/item.svelte.d.ts +0 -4
- package/dist/checkbox/checkbox-group.svelte +0 -3
- package/dist/checkbox/checkbox.svelte +0 -4
- package/dist/checkbox/index.js +0 -1
- package/dist/checkbox/interface.d.ts +0 -1
- package/dist/code-highlight/interface.d.ts +0 -1
- package/dist/collapse/collapse.svelte +0 -2
- package/dist/collapse/index.js +0 -1
- package/dist/collapse/interface.d.ts +0 -2
- package/dist/collapse/panel.svelte +0 -1
- package/dist/collapsible/collapsible.svelte +0 -2
- package/dist/color-picker/alpha-slider.svelte +0 -1
- package/dist/color-picker/color-choose-area.svelte +0 -1
- package/dist/color-picker/color-slider.svelte +0 -1
- package/dist/color-picker/data-part.svelte +0 -1
- package/dist/cropper/cropper.svelte +0 -1
- package/dist/cropper/interface.d.ts +0 -6
- package/dist/date-picker/date-input.svelte +0 -4
- package/dist/date-picker/date-picker.svelte +0 -7
- package/dist/date-picker/inset-input.svelte +0 -1
- package/dist/date-picker/interface.d.ts +0 -7
- package/dist/date-picker/internal.d.ts +0 -7
- package/dist/date-picker/month.svelte +0 -1
- package/dist/date-picker/months-grid.svelte +0 -6
- package/dist/date-picker/navigation.svelte +0 -1
- package/dist/descriptions/interface.d.ts +0 -1
- package/dist/divider/divider.svelte +0 -1
- package/dist/divider/interface.d.ts +0 -4
- package/dist/drag-move/drag-move.js +0 -1
- package/dist/drag-move/interface.d.ts +0 -3
- package/dist/dropdown/context.d.ts +0 -6
- package/dist/dropdown/context.js +0 -1
- package/dist/dropdown/dropdown-item.svelte +0 -1
- package/dist/dropdown/dropdown.svelte +0 -7
- package/dist/dropdown/interface.d.ts +0 -4
- package/dist/empty/empty.svelte +0 -1
- package/dist/empty/interface.d.ts +0 -3
- package/dist/feedback/feedback.svelte +0 -1
- package/dist/feedback/interface.d.ts +0 -8
- package/dist/float-button/float-button-action.svelte +0 -2
- package/dist/float-button/interface.d.ts +0 -2
- package/dist/form/array-field.svelte +0 -2
- package/dist/form/context.d.ts +0 -2
- package/dist/form/error-message.svelte +0 -1
- package/dist/form/field-grid.svelte +0 -2
- package/dist/form/field-grid.svelte.d.ts +0 -2
- package/dist/form/field-inner.svelte +0 -2
- package/dist/form/field.svelte +0 -1
- package/dist/form/form.svelte +0 -1
- package/dist/form/hooks.d.ts +1 -2
- package/dist/form/hooks.js +1 -2
- package/dist/form/interface.d.ts +0 -7
- package/dist/form/utils.d.ts +0 -1
- package/dist/form/utils.js +0 -2
- package/dist/highlight/interface.d.ts +0 -1
- package/dist/hot-keys/interface.d.ts +0 -1
- package/dist/image/context.d.ts +0 -1
- package/dist/image/footer.d.ts +0 -1
- package/dist/image/interface.d.ts +0 -8
- package/dist/image/preview-image.svelte +0 -3
- package/dist/image/preview-image.svelte.d.ts +0 -1
- package/dist/image/preview-inner.svelte +0 -3
- package/dist/image/preview-inner.svelte.d.ts +0 -1
- package/dist/input/context.d.ts +0 -1
- package/dist/input/interface.d.ts +0 -3
- package/dist/input/textarea.svelte +0 -3
- package/dist/input-number/input-number.svelte +0 -2
- package/dist/input-number/interface.d.ts +0 -1
- package/dist/json-viewer/interface.d.ts +0 -4
- package/dist/json-viewer/json-viewer.svelte +0 -3
- package/dist/layout/interface.d.ts +0 -2
- package/dist/list/interface.d.ts +0 -2
- package/dist/lottie/interface.d.ts +1 -1
- package/dist/markdown-render/code-text.js +0 -1
- package/dist/markdown-render/components/code.svelte +0 -1
- package/dist/markdown-render/components/heading.svelte +0 -1
- package/dist/markdown-render/components/p.svelte +0 -1
- package/dist/markdown-render/components/table.svelte +0 -1
- package/dist/markdown-render/components/tree.d.ts +0 -4
- package/dist/markdown-render/components/tree.js +0 -2
- package/dist/markdown-render/interface.d.ts +0 -1
- package/dist/markdown-render/markdown-children.svelte +0 -2
- package/dist/markdown-render/markdown-render.svelte +0 -1
- package/dist/markdown-render/runtime.js +0 -1
- package/dist/modal/confirm-modal.svelte +0 -1
- package/dist/modal/confirm.svelte.d.ts +0 -1
- package/dist/modal/confirm.svelte.js +0 -1
- package/dist/modal/index.js +0 -1
- package/dist/modal/interface.d.ts +0 -6
- package/dist/modal/modal-content.svelte +0 -4
- package/dist/modal/modal.svelte +0 -1
- package/dist/modal/use-show-hide.svelte.d.ts +0 -2
- package/dist/modal/use-show-hide.svelte.js +0 -4
- package/dist/navigation/context.d.ts +0 -2
- package/dist/navigation/index.js +0 -1
- package/dist/navigation/interface.d.ts +1 -17
- package/dist/navigation/item-shell.svelte +0 -4
- package/dist/navigation/item-shell.svelte.d.ts +0 -3
- package/dist/navigation/nav-footer.svelte +0 -2
- package/dist/navigation/nav-items.svelte +0 -1
- package/dist/navigation/nav.svelte +0 -1
- package/dist/navigation/sub-nav.svelte +0 -5
- package/dist/navigation/wrapper-outlet.svelte +0 -1
- package/dist/notification/context.d.ts +0 -3
- package/dist/notification/interface.d.ts +0 -5
- package/dist/notification/notice-list.svelte +0 -2
- package/dist/notification/notice-list.svelte.d.ts +0 -1
- package/dist/notification/notice.svelte +0 -2
- package/dist/notification/notification-list.svelte +0 -1
- package/dist/notification/static-api.js +0 -1
- package/dist/overflow-list/interface.d.ts +0 -2
- package/dist/overflow-list/overflow-list.svelte +0 -2
- package/dist/pagination/interface.d.ts +0 -1
- package/dist/pagination/pagination.svelte +0 -2
- package/dist/pagination/step-button.svelte +0 -3
- package/dist/pagination/step-button.svelte.d.ts +0 -1
- package/dist/pincode/interface.d.ts +0 -1
- package/dist/pincode/pincode.svelte +0 -3
- package/dist/popconfirm/interface.d.ts +0 -1
- package/dist/popconfirm/popconfirm.svelte +0 -2
- package/dist/popover/interface.d.ts +0 -1
- package/dist/popover/popover.svelte +0 -1
- package/dist/radio/index.js +0 -1
- package/dist/radio/radio-group.svelte +0 -1
- package/dist/radio/radio.svelte +0 -1
- package/dist/rating/interface.d.ts +0 -2
- package/dist/rating/item.svelte +0 -1
- package/dist/rating/rating.svelte +0 -7
- package/dist/resizable/interface.d.ts +0 -2
- package/dist/resizable/resizable.svelte +0 -1
- package/dist/resizable/resize-group.svelte +0 -1
- package/dist/resizable/resize-handler.svelte +0 -1
- package/dist/resize-observer/observe-resize.d.ts +1 -5
- package/dist/resize-observer/observe-resize.js +1 -5
- package/dist/scroll-list/index.js +0 -1
- package/dist/scroll-list/interface.d.ts +0 -2
- package/dist/scroll-list/scroll-item.svelte +0 -2
- package/dist/select/interface.d.ts +0 -14
- package/dist/select/option.svelte +0 -5
- package/dist/select/option.svelte.d.ts +0 -5
- package/dist/select/select.svelte +0 -14
- package/dist/side-sheet/interface.d.ts +0 -1
- package/dist/side-sheet/side-sheet.svelte +0 -9
- package/dist/skeleton/index.js +0 -1
- package/dist/skeleton/interface.d.ts +0 -2
- package/dist/skeleton/skeleton-item.svelte +0 -1
- package/dist/slider/interface.d.ts +0 -5
- package/dist/slider/slider.svelte +0 -7
- package/dist/space/interface.d.ts +0 -1
- package/dist/space/space.svelte +0 -1
- package/dist/steps/context.d.ts +0 -1
- package/dist/steps/interface.d.ts +0 -2
- package/dist/steps/step.svelte +0 -3
- package/dist/switch/switch.svelte +0 -2
- package/dist/table/body/base-row.svelte +0 -4
- package/dist/table/body/base-row.svelte.d.ts +0 -4
- package/dist/table/body/body.svelte +0 -7
- package/dist/table/body/body.svelte.d.ts +0 -5
- package/dist/table/body/expanded-row.svelte +0 -1
- package/dist/table/body/expanded-row.svelte.d.ts +0 -1
- package/dist/table/body/section-row.svelte +0 -2
- package/dist/table/body/section-row.svelte.d.ts +0 -2
- package/dist/table/column-filter-menu.svelte +0 -3
- package/dist/table/column-filter-menu.svelte.d.ts +0 -3
- package/dist/table/column-filter.svelte +0 -2
- package/dist/table/column-filter.svelte.d.ts +0 -2
- package/dist/table/column-selection.svelte +1 -2
- package/dist/table/column-selection.svelte.d.ts +0 -1
- package/dist/table/column-sorter.svelte +1 -6
- package/dist/table/column-sorter.svelte.d.ts +1 -6
- package/dist/table/context.d.ts +0 -10
- package/dist/table/context.js +0 -1
- package/dist/table/custom-expand-icon.svelte +0 -2
- package/dist/table/custom-expand-icon.svelte.d.ts +0 -2
- package/dist/table/head-table.svelte +0 -1
- package/dist/table/head-table.svelte.d.ts +0 -1
- package/dist/table/interface.d.ts +2 -21
- package/dist/table/table-cell.svelte +0 -7
- package/dist/table/table-cell.svelte.d.ts +0 -7
- package/dist/table/table-header-row.svelte +0 -2
- package/dist/table/table-header-row.svelte.d.ts +0 -2
- package/dist/table/table-pagination.svelte +0 -2
- package/dist/table/table-pagination.svelte.d.ts +0 -2
- package/dist/table/table.svelte +0 -5
- package/dist/table/utils.d.ts +1 -13
- package/dist/table/utils.js +1 -11
- package/dist/tabs/index.js +0 -1
- package/dist/tabs/interface.d.ts +0 -13
- package/dist/tabs/tab-bar.svelte +0 -3
- package/dist/tabs/tab-bar.svelte.d.ts +0 -1
- package/dist/tabs/tab-pane.svelte +0 -2
- package/dist/tabs/tabs.svelte +0 -1
- package/dist/tag-input/interface.d.ts +0 -5
- package/dist/tag-input/tag-input.svelte +0 -3
- package/dist/tag-input/tag-item.svelte +0 -1
- package/dist/tag-input/tag-item.svelte.d.ts +0 -1
- package/dist/time-picker/combobox.svelte +0 -1
- package/dist/time-picker/interface.d.ts +0 -9
- package/dist/time-picker/time-picker.svelte +0 -2
- package/dist/timeline/interface.d.ts +0 -4
- package/dist/timeline/timeline.svelte +0 -1
- package/dist/toast/context.d.ts +0 -2
- package/dist/toast/interface.d.ts +0 -2
- package/dist/toast/static-api.js +0 -1
- package/dist/toast/toast.svelte +0 -1
- package/dist/toast/use-toast.js +0 -1
- package/dist/tooltip/context.d.ts +0 -2
- package/dist/tooltip/interface.d.ts +0 -2
- package/dist/tooltip/tooltip.svelte +0 -5
- package/dist/transfer/interface.d.ts +1 -8
- package/dist/transfer/transfer-selected-item.svelte +0 -1
- package/dist/transfer/transfer-selected-item.svelte.d.ts +0 -1
- package/dist/transfer/transfer.svelte +0 -1
- package/dist/tree/auto-sizer.svelte +0 -1
- package/dist/tree/context.d.ts +0 -1
- package/dist/tree/interface.d.ts +0 -9
- package/dist/tree/node-collapsible.svelte +0 -1
- package/dist/tree/node-list.svelte +0 -4
- package/dist/tree/tree-node.svelte +0 -1
- package/dist/tree/tree.svelte +0 -3
- package/dist/tree/use-tree-keyboard.svelte.d.ts +1 -8
- package/dist/tree/use-tree-keyboard.svelte.js +1 -6
- package/dist/tree-select/interface.d.ts +0 -11
- package/dist/tree-select/tree-select.svelte +0 -2
- package/dist/typography/base.svelte +0 -2
- package/dist/typography/index.js +0 -1
- package/dist/typography/interface.d.ts +0 -1
- package/dist/typography/internal.d.ts +0 -2
- package/dist/upload/file-card.svelte +0 -1
- package/dist/upload/index.js +0 -1
- package/dist/upload/interface.d.ts +0 -4
- package/dist/upload/upload.svelte +0 -1
- package/dist/user-guide/interface.d.ts +0 -1
- package/dist/user-guide/user-guide.svelte +0 -1
- package/dist/video-player/video-progress.svelte +0 -2
- package/package.json +4 -4
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
interface StepButtonProps {
|
|
9
9
|
kind: 'prev' | 'next';
|
|
10
|
-
/** The locale name, kept unless the content is a lone text */
|
|
11
10
|
label: string;
|
|
12
11
|
disabled: boolean;
|
|
13
12
|
text?: string | Snippet;
|
|
@@ -19,8 +18,6 @@
|
|
|
19
18
|
let contentKind = $state<SlotKind>();
|
|
20
19
|
|
|
21
20
|
const prefix = cssClasses.PREFIX;
|
|
22
|
-
|
|
23
|
-
// A string names the button from the first frame; a snippet only after its rendered content is known
|
|
24
21
|
const namedByContent = $derived(typeof text === 'string' ? text !== '' : text !== undefined && contentKind === 'text');
|
|
25
22
|
|
|
26
23
|
// A snippet exposes nothing to read before it renders, so a lone text names the button from the second frame on;
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
const locale = useLocale('PinCode');
|
|
22
22
|
|
|
23
|
-
// each cell stores its own handle by index
|
|
24
23
|
let inputs = $state<(ReturnType<typeof Input> | undefined)[]>([]);
|
|
25
24
|
|
|
26
25
|
// The inputs are the focus targets, so their description and state go to each one; on the root a Tooltip's
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
// injected by Form: not DOM attributes, and no single cell carries the code's name
|
|
31
30
|
const dropped = new Set(['name', 'insetLabel', 'insetLabelId']);
|
|
32
31
|
|
|
33
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
34
32
|
const foundationProps: PinCodeBaseProps = {
|
|
35
33
|
get value() {
|
|
36
34
|
return value;
|
|
@@ -107,7 +105,6 @@
|
|
|
107
105
|
(next) => foundation.updateValueList(Array.from(next || ''))
|
|
108
106
|
);
|
|
109
107
|
|
|
110
|
-
/** Focuses the input at `index` (0-based) with the caret after its character */
|
|
111
108
|
export function focus(index: number) {
|
|
112
109
|
inputs[index]?.focus();
|
|
113
110
|
inputs[index]?.setSelectionRange(1, 1);
|
|
@@ -16,7 +16,6 @@ export interface PopconfirmProps extends Omit<PopoverProps, 'content'> {
|
|
|
16
16
|
okText?: string;
|
|
17
17
|
okType?: ButtonType;
|
|
18
18
|
showCloseIcon?: boolean;
|
|
19
|
-
/** Names the dialog; a string or a snippet */
|
|
20
19
|
title?: string | Snippet;
|
|
21
20
|
content?: Snippet<[RenderContentProps]>;
|
|
22
21
|
/** Replaces the warning icon; `null` shows no icon */
|
|
@@ -103,7 +103,6 @@
|
|
|
103
103
|
// A disabled Popconfirm renders the trigger alone; a spread of no props leaves the user's element as written
|
|
104
104
|
const noTriggerProps = {} as TooltipTriggerProps;
|
|
105
105
|
|
|
106
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
107
106
|
const foundationProps: PopconfirmBaseProps = {
|
|
108
107
|
get cancelButtonProps() {
|
|
109
108
|
return cancelButtonProps;
|
|
@@ -230,7 +229,6 @@
|
|
|
230
229
|
if (popoverVisible) foundation.handlePopupOpen();
|
|
231
230
|
});
|
|
232
231
|
|
|
233
|
-
/** Focuses the trigger (only with returnFocusOnClose and a non-custom trigger) */
|
|
234
232
|
export function focusTrigger() {
|
|
235
233
|
popover?.focusTrigger();
|
|
236
234
|
}
|
|
@@ -21,7 +21,6 @@ export interface PopoverProps {
|
|
|
21
21
|
* A combobox passes presentation because it points at the inner listbox itself
|
|
22
22
|
*/
|
|
23
23
|
role?: string;
|
|
24
|
-
/** On the popup */
|
|
25
24
|
class?: string;
|
|
26
25
|
/** On the popup; its `background-color` and `border-color` also color the arrow */
|
|
27
26
|
style?: string;
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
const popupSpacing = $derived(getPopoverSpacing(spacing, showArrow));
|
|
57
57
|
const stop = $derived(stopPropagation === undefined ? undefined : Boolean(stopPropagation));
|
|
58
58
|
|
|
59
|
-
/** Focuses the trigger (only with returnFocusOnClose and a non-custom trigger) */
|
|
60
59
|
export function focusTrigger() {
|
|
61
60
|
tooltip?.focusTrigger();
|
|
62
61
|
}
|
package/dist/radio/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import RadioGroupPart from './radio-group.svelte';
|
|
2
2
|
import RadioBase from './radio.svelte';
|
|
3
|
-
// Svelte components are functions, so the part attaches to the component itself
|
|
4
3
|
export const Radio = Object.assign(RadioBase, { Group: RadioGroupPart });
|
|
5
4
|
export { default as RadioGroup } from './radio-group.svelte';
|
package/dist/radio/radio.svelte
CHANGED
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
// make an uncontrolled radio read as controlled; a `checked` equal to the echo counts as uncontrolled instead.
|
|
47
47
|
let echoed: boolean | undefined;
|
|
48
48
|
|
|
49
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
50
49
|
const foundationProps: RadioBaseProps = {
|
|
51
50
|
get checked() {
|
|
52
51
|
return checked === echoed ? undefined : checked;
|
|
@@ -34,7 +34,6 @@ export interface RatingItemProps {
|
|
|
34
34
|
disabled: boolean;
|
|
35
35
|
count: number;
|
|
36
36
|
size: number | 'small' | 'default';
|
|
37
|
-
/** A custom unit used as is; otherwise the locale names it */
|
|
38
37
|
unit?: string;
|
|
39
38
|
preventScroll?: boolean;
|
|
40
39
|
/** No radio stands for the value: this star's first radio is the Tab stop */
|
|
@@ -42,7 +41,6 @@ export interface RatingItemProps {
|
|
|
42
41
|
character?: string | Snippet;
|
|
43
42
|
/** From a wrapping Tooltip: the description reaches the radios, the Tab stop is dropped */
|
|
44
43
|
trigger?: TooltipTriggerProps;
|
|
45
|
-
/** The pointer moved over the star: a preview of its value */
|
|
46
44
|
onPreview: (event: MouseEvent) => void;
|
|
47
45
|
onPick: (event: MouseEvent) => void;
|
|
48
46
|
/** Enter or Space on a radio, or a click without a pointer (assistive technology): the value that radio stands for */
|
package/dist/rating/item.svelte
CHANGED
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
/** Focuses the radio of this star that stands for `starValue`: the first half for a half value */
|
|
75
74
|
export function starFocus(starValue: number) {
|
|
76
75
|
const radio = RatingFoundation.isFirstRadio(starValue, index, allowHalf) ? first : second;
|
|
77
76
|
radio?.focus({ preventScroll });
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
import RatingItem from './item.svelte';
|
|
15
15
|
|
|
16
16
|
type ClickEvent = MouseEvent | KeyboardEvent;
|
|
17
|
-
|
|
18
|
-
// the DOM typings give relatedTarget as an EventTarget, but a focus event's is a Node or null
|
|
19
17
|
type ListFocusEvent = FocusEvent & RatingFocusEvent;
|
|
20
18
|
type Foundation = RatingFoundation<RatingBaseProps, RatingState, ClickEvent, ListFocusEvent, KeyboardEvent>;
|
|
21
19
|
type Adapter = RatingAdapter<RatingBaseProps, RatingState, ClickEvent, ListFocusEvent, KeyboardEvent>;
|
|
@@ -54,12 +52,10 @@
|
|
|
54
52
|
// roving Tab stop. A radiogroup has no control to carry a name.
|
|
55
53
|
const DROPPED_ATTRS = new Set(['tabindex', 'name']);
|
|
56
54
|
|
|
57
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
58
55
|
const foundationProps: RatingBaseProps = {
|
|
59
56
|
get value() {
|
|
60
57
|
return value;
|
|
61
58
|
},
|
|
62
|
-
// an unset value starts empty, and a value that goes back to undefined returns to it
|
|
63
59
|
defaultValue: 0,
|
|
64
60
|
get count() {
|
|
65
61
|
return count;
|
|
@@ -87,7 +83,6 @@
|
|
|
87
83
|
(view) => RatingFoundation.getInitialState(view),
|
|
88
84
|
(base) => ({
|
|
89
85
|
focusStar: (starValue) => {
|
|
90
|
-
// a value between radios has no radio to focus: Tab's landing radio stands in, as for focus()
|
|
91
86
|
if (!RatingFoundation.isRadioValue(starValue, count, allowHalf)) {
|
|
92
87
|
focusTabStop();
|
|
93
88
|
return;
|
|
@@ -100,7 +95,6 @@
|
|
|
100
95
|
notifyHoverChange: (hoverValue) => onHoverChange?.(hoverValue),
|
|
101
96
|
setValue: (next) => base.setState({ value: next }),
|
|
102
97
|
notifyChange: (next) => {
|
|
103
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
104
98
|
value = next;
|
|
105
99
|
onChange?.(next);
|
|
106
100
|
},
|
|
@@ -176,7 +170,6 @@
|
|
|
176
170
|
}
|
|
177
171
|
);
|
|
178
172
|
|
|
179
|
-
/** Focuses the radio that Tab would reach */
|
|
180
173
|
export function focus() {
|
|
181
174
|
if (!disabled) {
|
|
182
175
|
focusTabStop();
|
|
@@ -39,7 +39,6 @@ export interface ResizableProps extends Omit<HTMLAttributes<HTMLDivElement>, 'on
|
|
|
39
39
|
onChange?: ResizeCallback;
|
|
40
40
|
onResizeEnd?: ResizeCallback;
|
|
41
41
|
children?: Snippet;
|
|
42
|
-
/** Content of each enabled handle */
|
|
43
42
|
handle?: Snippet<[ResizableHandleSnippetProps]>;
|
|
44
43
|
}
|
|
45
44
|
export interface ResizeGroupProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -58,6 +57,5 @@ export interface ResizeItemProps extends Omit<HTMLAttributes<HTMLDivElement>, 'o
|
|
|
58
57
|
children?: Snippet;
|
|
59
58
|
}
|
|
60
59
|
export interface ResizeHandlerProps extends HTMLAttributes<HTMLDivElement> {
|
|
61
|
-
/** Replaces the default grip icon */
|
|
62
60
|
children?: Snippet;
|
|
63
61
|
}
|
|
@@ -114,7 +114,6 @@
|
|
|
114
114
|
const observer = new ResizeObserver(() => {
|
|
115
115
|
// a group first mounted inside display:none measures 0: lay out again once it becomes measurable
|
|
116
116
|
foundation.handleGroupResize();
|
|
117
|
-
// a container change without a window resize can leave px limits violated
|
|
118
117
|
foundation.ensureConstraint();
|
|
119
118
|
});
|
|
120
119
|
observer.observe(node);
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
|
|
20
20
|
const handlePointerdown = (e: PointerEvent & { currentTarget: HTMLDivElement }) => {
|
|
21
21
|
if (isSecondaryPress(e)) return;
|
|
22
|
-
// capturing keeps the moves and the release on the handler wherever the pointer goes
|
|
23
22
|
e.currentTarget.setPointerCapture(e.pointerId);
|
|
24
23
|
group.notifyResizeStart(e.currentTarget, e);
|
|
25
24
|
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import type { Attachment } from 'svelte/attachments';
|
|
2
|
-
/**
|
|
3
|
-
* Reports the size changes of the element it is attached to (`<div {@attach observeResize(onResize)}>`). An attachment
|
|
4
|
-
* rather than a component or a target-getter hook: Svelte hands it the element and runs the cleanup on removal, so no
|
|
5
|
-
* `bind:this` state is needed. `onResize` is called with the first size too, as the browser reports it on `observe()`.
|
|
6
|
-
*/
|
|
2
|
+
/** `onResize` is called with the first size too, as the browser reports it on `observe()`. */
|
|
7
3
|
export default function observeResize(onResize: (entries: ResizeObserverEntry[]) => void): Attachment<Element>;
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reports the size changes of the element it is attached to (`<div {@attach observeResize(onResize)}>`). An attachment
|
|
3
|
-
* rather than a component or a target-getter hook: Svelte hands it the element and runs the cleanup on removal, so no
|
|
4
|
-
* `bind:this` state is needed. `onResize` is called with the first size too, as the browser reports it on `observe()`.
|
|
5
|
-
*/
|
|
1
|
+
/** `onResize` is called with the first size too, as the browser reports it on `observe()`. */
|
|
6
2
|
export default function observeResize(onResize) {
|
|
7
3
|
return (element) => {
|
|
8
4
|
const observer = new ResizeObserver(onResize);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ScrollItemPart from './scroll-item.svelte';
|
|
2
2
|
import ScrollListBase from './scroll-list.svelte';
|
|
3
|
-
// Svelte components are functions, so the parts attach to the component itself
|
|
4
3
|
export const ScrollList = Object.assign(ScrollListBase, { Item: ScrollItemPart });
|
|
5
4
|
export { default as ScrollItem } from './scroll-item.svelte';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { Item } from '@fibrae/semi-foundation/scroll-list/item-foundation';
|
|
4
|
-
/** An entry of a column: `text` (or `value`) is shown, `transform` formats the selected one */
|
|
5
4
|
export type ScrollListItem = Item;
|
|
6
5
|
export interface ScrollListProps extends HTMLAttributes<HTMLDivElement> {
|
|
7
6
|
bodyHeight?: number | string;
|
|
@@ -23,7 +22,6 @@ export interface ScrollItemProps<T extends ScrollListItem = ScrollListItem> exte
|
|
|
23
22
|
type?: string | number;
|
|
24
23
|
onSelect?: (data: ScrollItemSelectData<T>) => void;
|
|
25
24
|
}
|
|
26
|
-
/** The selected item with the column's `type` and the item's index in `list` */
|
|
27
25
|
export type ScrollItemSelectData<T extends ScrollListItem = ScrollListItem> = T & {
|
|
28
26
|
type?: string | number;
|
|
29
27
|
index: number;
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
const current = $derived(selectedIndex ?? defaults('selectedIndex', 0));
|
|
31
31
|
const isWheel = $derived(mode === 'wheel');
|
|
32
32
|
|
|
33
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
34
33
|
const foundationProps: ScrollItemBaseProps<T> = {
|
|
35
34
|
get cycled() {
|
|
36
35
|
return cycled;
|
|
@@ -101,7 +100,6 @@
|
|
|
101
100
|
return [...copies(states().prependCount, 'pre').toReversed().flat(), ...items(''), ...copies(states().appendCount, 'app').flat()];
|
|
102
101
|
});
|
|
103
102
|
|
|
104
|
-
// Focus stays on the listbox and the selected option is its active descendant
|
|
105
103
|
const optionId = (index: number) => {
|
|
106
104
|
return `${uid}-option-${index}`;
|
|
107
105
|
};
|
|
@@ -6,11 +6,9 @@ import type { PopoverProps } from '../popover/index.js';
|
|
|
6
6
|
import type { TagCloseEvent } from '../tag/index.js';
|
|
7
7
|
import type { Position } from '../tooltip/index.js';
|
|
8
8
|
export type BasicSelectValue = string | number | Record<string, any>;
|
|
9
|
-
/** A single value, an array of them in multiple mode, or option records with `onChangeWithObject` */
|
|
10
9
|
export type SelectValue = BasicSelectValue | BasicSelectValue[] | undefined;
|
|
11
10
|
export type SelectSize = Size;
|
|
12
11
|
export interface SelectVirtualize {
|
|
13
|
-
/** The height of every option row in pixels */
|
|
14
12
|
itemSize: number;
|
|
15
13
|
height?: number;
|
|
16
14
|
width?: string | number;
|
|
@@ -20,7 +18,6 @@ export interface SelectOptionGroup {
|
|
|
20
18
|
key: string | number;
|
|
21
19
|
label?: string | number;
|
|
22
20
|
}
|
|
23
|
-
/** An `optionList` entry, and the option record the callbacks report; any other field rides along */
|
|
24
21
|
export interface SelectOptionProps {
|
|
25
22
|
value?: string | number;
|
|
26
23
|
label?: string | number;
|
|
@@ -34,7 +31,6 @@ export interface SelectOptionProps {
|
|
|
34
31
|
style?: string;
|
|
35
32
|
[key: string]: any;
|
|
36
33
|
}
|
|
37
|
-
/** The search input's extra props; `class` and `style` land on the Input wrapper */
|
|
38
34
|
export type SelectInputProps = Omit<InputProps, 'value'>;
|
|
39
35
|
export interface SelectOptionItemSnippetProps {
|
|
40
36
|
/** Put it on the role="option" element: the combobox's aria-activedescendant points at it */
|
|
@@ -60,7 +56,6 @@ export interface SelectGroupLabelSnippetProps {
|
|
|
60
56
|
export interface SelectCreateItemSnippetProps {
|
|
61
57
|
inputValue: string;
|
|
62
58
|
focus: boolean;
|
|
63
|
-
/** The virtual list's row position */
|
|
64
59
|
style?: string;
|
|
65
60
|
}
|
|
66
61
|
export interface SelectSelectedItemSnippetProps {
|
|
@@ -75,7 +70,6 @@ export interface SelectTriggerSnippetProps {
|
|
|
75
70
|
inputValue: string;
|
|
76
71
|
placeholder?: string;
|
|
77
72
|
disabled: boolean;
|
|
78
|
-
/** Updates the search keyword */
|
|
79
73
|
onSearch: (inputValue: string) => void;
|
|
80
74
|
/** Pass the click event when bound to a control inside the trigger, so the click does not open the list */
|
|
81
75
|
onClear: (event?: MouseEvent) => void;
|
|
@@ -96,7 +90,6 @@ export interface SelectProps extends Omit<HTMLAttributes<HTMLDivElement>, Native
|
|
|
96
90
|
defaultOpen?: boolean;
|
|
97
91
|
clickToHide?: boolean;
|
|
98
92
|
defaultActiveFirstOption?: boolean;
|
|
99
|
-
/** `onChange` and `value` carry option records instead of values */
|
|
100
93
|
onChangeWithObject?: boolean;
|
|
101
94
|
max?: number;
|
|
102
95
|
maxTagCount?: number;
|
|
@@ -141,7 +134,6 @@ export interface SelectProps extends Omit<HTMLAttributes<HTMLDivElement>, Native
|
|
|
141
134
|
onExceed?: (option: SelectOptionProps) => void;
|
|
142
135
|
onCreate?: (option: SelectOptionProps) => void;
|
|
143
136
|
onClear?: () => void;
|
|
144
|
-
/** Once when the focus enters the Select */
|
|
145
137
|
onFocus?: (event: FocusEvent) => void;
|
|
146
138
|
/** Once when the focus leaves the Select; a press outside the open dropdown passes its mousedown event */
|
|
147
139
|
onBlur?: (event: FocusEvent | MouseEvent) => void;
|
|
@@ -157,19 +149,13 @@ export interface SelectProps extends Omit<HTMLAttributes<HTMLDivElement>, Native
|
|
|
157
149
|
innerTopSlot?: Snippet;
|
|
158
150
|
outerBottomSlot?: Snippet;
|
|
159
151
|
innerBottomSlot?: Snippet;
|
|
160
|
-
/** Replaces a whole option row */
|
|
161
152
|
optionItem?: Snippet<[SelectOptionItemSnippetProps]>;
|
|
162
153
|
/** Replaces the text of each option row; the row, its tick and its keyboard behavior stay. Search keywords are not highlighted */
|
|
163
154
|
optionLabel?: Snippet<[SelectOptionLabelSnippetProps]>;
|
|
164
|
-
/** Replaces the title of each group; the title text defaults to `group.label` */
|
|
165
155
|
groupLabel?: Snippet<[SelectGroupLabelSnippetProps]>;
|
|
166
|
-
/** Content of the row that creates an option from the keyword */
|
|
167
156
|
createItem?: Snippet<[SelectCreateItemSnippetProps]>;
|
|
168
|
-
/** The selected content in single mode, the content of each tag in multiple mode */
|
|
169
157
|
selectedItem?: Snippet<[SelectSelectedItemSnippetProps]>;
|
|
170
|
-
/** Replaces each tag in multiple mode */
|
|
171
158
|
tag?: Snippet<[SelectSelectedItemSnippetProps]>;
|
|
172
|
-
/** Replaces the trigger content */
|
|
173
159
|
trigger?: Snippet<[SelectTriggerSnippetProps]>;
|
|
174
160
|
}
|
|
175
161
|
export {};
|
|
@@ -14,21 +14,16 @@
|
|
|
14
14
|
label?: string | number;
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
showTick?: boolean;
|
|
17
|
-
/** The row stands for the empty state; children hold its content */
|
|
18
17
|
empty?: boolean;
|
|
19
18
|
selected?: boolean;
|
|
20
|
-
/** Highlighted by the keyboard or the pointer */
|
|
21
19
|
focused?: boolean;
|
|
22
20
|
/** The row aria-activedescendant points at; AutoComplete marks it aria-selected */
|
|
23
21
|
current?: boolean;
|
|
24
|
-
/** Highlighted in a plain-text label */
|
|
25
22
|
inputValue?: string;
|
|
26
23
|
prefixCls?: string;
|
|
27
24
|
class?: ClassValue;
|
|
28
25
|
style?: string;
|
|
29
|
-
/** The option's data-* fields */
|
|
30
26
|
dataAttrs?: Record<string, unknown>;
|
|
31
|
-
/** Replaces the label text */
|
|
32
27
|
children?: Snippet;
|
|
33
28
|
onSelect?: (event: MouseEvent) => void;
|
|
34
29
|
onMouseEnter?: (event: MouseEvent) => void;
|
|
@@ -9,21 +9,16 @@ interface OptionRowProps {
|
|
|
9
9
|
label?: string | number;
|
|
10
10
|
disabled?: boolean;
|
|
11
11
|
showTick?: boolean;
|
|
12
|
-
/** The row stands for the empty state; children hold its content */
|
|
13
12
|
empty?: boolean;
|
|
14
13
|
selected?: boolean;
|
|
15
|
-
/** Highlighted by the keyboard or the pointer */
|
|
16
14
|
focused?: boolean;
|
|
17
15
|
/** The row aria-activedescendant points at; AutoComplete marks it aria-selected */
|
|
18
16
|
current?: boolean;
|
|
19
|
-
/** Highlighted in a plain-text label */
|
|
20
17
|
inputValue?: string;
|
|
21
18
|
prefixCls?: string;
|
|
22
19
|
class?: ClassValue;
|
|
23
20
|
style?: string;
|
|
24
|
-
/** The option's data-* fields */
|
|
25
21
|
dataAttrs?: Record<string, unknown>;
|
|
26
|
-
/** Replaces the label text */
|
|
27
22
|
children?: Snippet;
|
|
28
23
|
onSelect?: (event: MouseEvent) => void;
|
|
29
24
|
onMouseEnter?: (event: MouseEvent) => void;
|
|
@@ -89,7 +89,6 @@
|
|
|
89
89
|
stopPropagation = defaults('stopPropagation', true),
|
|
90
90
|
virtualize = defaults('virtualize'),
|
|
91
91
|
preventScroll = defaults('preventScroll'),
|
|
92
|
-
// a global id would repeat on every instance, and aria-controls and aria-activedescendant would point elsewhere
|
|
93
92
|
id,
|
|
94
93
|
onChange,
|
|
95
94
|
onDropdownVisibleChange,
|
|
@@ -145,11 +144,8 @@
|
|
|
145
144
|
const disabled = $derived(disabledProp ?? group?.disabled ?? defaults('disabled') ?? false);
|
|
146
145
|
const size = $derived(sizeProp ?? group?.size ?? defaults('size', 'default'));
|
|
147
146
|
const cls = cssClasses.PREFIX;
|
|
148
|
-
|
|
149
|
-
// the foundation filters by the group label and the list renders runs of one group through the record's group
|
|
150
147
|
const collectedOptions: OptionRecord[] = $derived((optionList ?? []).map((item, index) => toOptionRecord(item, index, item.group)));
|
|
151
148
|
|
|
152
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
153
149
|
const foundationProps: FoundationProps = {
|
|
154
150
|
get allowCreate() {
|
|
155
151
|
return allowCreate;
|
|
@@ -232,7 +228,6 @@
|
|
|
232
228
|
updateSelection: (selections) => base.setState({ selections }),
|
|
233
229
|
getSelections: () => new Map(base.getState('selections')),
|
|
234
230
|
notifyChange: (next) => {
|
|
235
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
236
231
|
value = next as SelectValue;
|
|
237
232
|
onChange?.(next as SelectValue);
|
|
238
233
|
},
|
|
@@ -240,7 +235,6 @@
|
|
|
240
235
|
notifyDropdownVisibleChange: (visible) => onDropdownVisibleChange?.(visible),
|
|
241
236
|
notifySearch: (inputValue, event) => onSearch?.(inputValue, event),
|
|
242
237
|
notifyCreate: (option) => onCreate?.(option as SelectOptionProps),
|
|
243
|
-
// mouseenter and mouseleave reach the root as native listeners through the rest props
|
|
244
238
|
notifyMouseEnter: () => undefined,
|
|
245
239
|
notifyMouseLeave: () => undefined,
|
|
246
240
|
notifyFocus: (event) => onFocus?.(event),
|
|
@@ -280,7 +274,6 @@
|
|
|
280
274
|
const selectedItems = $derived([...states().selections.values()] as SelectOptionProps[]);
|
|
281
275
|
const optionRuns = $derived(getOptionRuns(visibleOptions));
|
|
282
276
|
|
|
283
|
-
// while loading the list shows a spinner instead of the options
|
|
284
277
|
const activeDescendant = $derived.by(() => {
|
|
285
278
|
const { isOpen, focusIndex } = states();
|
|
286
279
|
return isOpen && !loading && focusIndex !== -1 && focusIndex < visibleOptions.length ? optionId(focusIndex) : undefined;
|
|
@@ -345,12 +338,10 @@
|
|
|
345
338
|
return `${selectId}-option-${index}`;
|
|
346
339
|
};
|
|
347
340
|
|
|
348
|
-
// the record's index, not the visible index: a row that filtering moves up keeps its node
|
|
349
341
|
const rowKey = ({ data, childKey, index }: OptionRecord) => {
|
|
350
342
|
return String(data.key ?? childKey ?? `${data.label}${data.value}${index}`);
|
|
351
343
|
};
|
|
352
344
|
|
|
353
|
-
// a group needs a title for its accessible name, so a group without a label renders its options bare
|
|
354
345
|
const hasTitle = (group?: SelectOptionGroup): group is SelectOptionGroup => {
|
|
355
346
|
return Boolean(group && (group.label || group.label === 0));
|
|
356
347
|
};
|
|
@@ -372,7 +363,6 @@
|
|
|
372
363
|
foundation.handleClearClick(event);
|
|
373
364
|
};
|
|
374
365
|
|
|
375
|
-
// the option as kept in state, the same object Enter selects
|
|
376
366
|
const handleSelect = (option: OptionRecord, index: number, event: MouseEvent) => {
|
|
377
367
|
foundation.onSelect(option as BaseOptionRecord, index, event);
|
|
378
368
|
};
|
|
@@ -487,7 +477,6 @@
|
|
|
487
477
|
const removeTag = (option: SelectOptionProps, event?: TagCloseEvent) => {
|
|
488
478
|
// keeps the Tag from hiding itself in controlled mode
|
|
489
479
|
event?.preventDefault();
|
|
490
|
-
// as with the clear button, a tag going while it has the focus hands the focus to the combobox
|
|
491
480
|
const target = event?.currentTarget instanceof Element ? event.currentTarget.closest(`.${tagCssClasses.PREFIX}`) : null;
|
|
492
481
|
if (target && target === FocusTrapHandle.getActiveElement(target)) {
|
|
493
482
|
foundation.focus(undefined, false);
|
|
@@ -546,7 +535,6 @@
|
|
|
546
535
|
foundation.clearInput();
|
|
547
536
|
}
|
|
548
537
|
|
|
549
|
-
/** Selects every shown, enabled option (multiple only) */
|
|
550
538
|
export function selectAll() {
|
|
551
539
|
foundation.selectAll();
|
|
552
540
|
}
|
|
@@ -555,7 +543,6 @@
|
|
|
555
543
|
foundation.clearSelected();
|
|
556
544
|
}
|
|
557
545
|
|
|
558
|
-
/** Searches as if `keyword` were typed into the search input */
|
|
559
546
|
export function search(keyword: string, event?: Event) {
|
|
560
547
|
foundation.handleInputChange(keyword, event);
|
|
561
548
|
}
|
|
@@ -860,7 +847,6 @@
|
|
|
860
847
|
class={[`${cls}-dropdown-input`, multiple ? `${cls}-dropdown-input-multiple` : `${cls}-dropdown-input-single`, inputProps?.class]}
|
|
861
848
|
onKeyDown={(event) => {
|
|
862
849
|
inputProps?.onKeyDown?.(event);
|
|
863
|
-
// the popup is not a DOM descendant of the trigger, so the key does not bubble to it
|
|
864
850
|
foundation.handleKeyDown(event);
|
|
865
851
|
}}
|
|
866
852
|
/>
|
|
@@ -62,11 +62,7 @@
|
|
|
62
62
|
const uid = $props.id();
|
|
63
63
|
let rootEl = $state.raw<HTMLDivElement | null>(null);
|
|
64
64
|
let dialogEl = $state.raw<HTMLDivElement | null>(null);
|
|
65
|
-
|
|
66
|
-
// True until the first show, and again once a leave animation has ended; the sheet stays mounted while it is false
|
|
67
65
|
let displayNone = $state(true);
|
|
68
|
-
|
|
69
|
-
// The animation the mask and the dialog play; each run ends with the dialog's animationend
|
|
70
66
|
let animating = $state<'show' | 'hide'>();
|
|
71
67
|
let started = false;
|
|
72
68
|
let shown = false;
|
|
@@ -84,7 +80,6 @@
|
|
|
84
80
|
const maskAnimation = $derived(animating ? `${prefix}-animation-mask_${animating}` : undefined);
|
|
85
81
|
const dialogAnimation = $derived(animating ? `${prefix}-animation-content_${animating}_${placement}` : undefined);
|
|
86
82
|
|
|
87
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
88
83
|
const foundationProps: SideSheetBaseProps = {
|
|
89
84
|
get closeOnEsc() {
|
|
90
85
|
return closeOnEsc;
|
|
@@ -109,7 +104,6 @@
|
|
|
109
104
|
disabledBodyScroll: () => (isModal() ? scroll.hold(lockBodyScroll) : scroll.release()),
|
|
110
105
|
enabledBodyScroll: () => scroll.release(),
|
|
111
106
|
notifyCancel: (event) => {
|
|
112
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
113
107
|
visible = false;
|
|
114
108
|
onCancel?.(event);
|
|
115
109
|
},
|
|
@@ -203,7 +197,6 @@
|
|
|
203
197
|
});
|
|
204
198
|
});
|
|
205
199
|
|
|
206
|
-
// The sheet takes the layer, scroll lock and focus once its content is in the document
|
|
207
200
|
$effect(() => {
|
|
208
201
|
const element = dialogEl;
|
|
209
202
|
if (!visible || !element || !rootEl) {
|
|
@@ -226,7 +219,6 @@
|
|
|
226
219
|
|
|
227
220
|
onMount(() => {
|
|
228
221
|
shown = !hidden;
|
|
229
|
-
// Unmounting while shown or leaving counts as hiding
|
|
230
222
|
return () => {
|
|
231
223
|
if (shown) {
|
|
232
224
|
foundation.onVisibleChange(false);
|
|
@@ -234,7 +226,6 @@
|
|
|
234
226
|
};
|
|
235
227
|
});
|
|
236
228
|
|
|
237
|
-
/** The outer `.semi-sidesheet` element inside the portal; null while nothing is rendered */
|
|
238
229
|
export function getRoot() {
|
|
239
230
|
return rootEl;
|
|
240
231
|
}
|
package/dist/skeleton/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import ImagePart from './image.svelte';
|
|
|
4
4
|
import ParagraphPart from './paragraph.svelte';
|
|
5
5
|
import SkeletonBase from './skeleton.svelte';
|
|
6
6
|
import TitlePart from './title.svelte';
|
|
7
|
-
// Svelte components are functions, so the parts attach to the component itself
|
|
8
7
|
export const Skeleton = Object.assign(SkeletonBase, { Avatar: AvatarPart, Title: TitlePart, Button: ButtonPart, Paragraph: ParagraphPart, Image: ImagePart });
|
|
9
8
|
export { default as SkeletonAvatar } from './avatar.svelte';
|
|
10
9
|
export { default as SkeletonButton } from './button.svelte';
|
|
@@ -3,9 +3,7 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
3
3
|
export interface SkeletonProps extends Omit<HTMLAttributes<HTMLDivElement>, 'placeholder'> {
|
|
4
4
|
active?: boolean;
|
|
5
5
|
loading?: boolean;
|
|
6
|
-
/** Shown while `loading` is true */
|
|
7
6
|
placeholder?: Snippet;
|
|
8
|
-
/** Shown once `loading` is false */
|
|
9
7
|
children?: Snippet;
|
|
10
8
|
}
|
|
11
9
|
export interface SkeletonBasicProps extends HTMLAttributes<HTMLDivElement> {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import '@fibrae/semi-foundation/skeleton/skeleton.css';
|
|
4
4
|
import type { SkeletonAvatarProps } from './interface.js';
|
|
5
5
|
|
|
6
|
-
// The shared block behind Avatar, Image, Title and Button, which differ only in their default type
|
|
7
6
|
let { prefixCls = cssClasses.PREFIX, type, size = 'medium', shape = 'circle', ...rest }: SkeletonAvatarProps & { type: string } = $props();
|
|
8
7
|
|
|
9
8
|
const base = $derived(`${prefixCls}-${type}`);
|
|
@@ -7,7 +7,6 @@ export interface SliderMarkSnippetProps {
|
|
|
7
7
|
label: string | number;
|
|
8
8
|
}
|
|
9
9
|
export interface SliderTipSnippetProps {
|
|
10
|
-
/** The handle's value after `tipFormatter` */
|
|
11
10
|
value: string | number;
|
|
12
11
|
handle: 'min' | 'max';
|
|
13
12
|
}
|
|
@@ -17,7 +16,6 @@ export interface SliderProps extends Omit<HTMLAttributes<HTMLDivElement>, Native
|
|
|
17
16
|
value?: number | number[];
|
|
18
17
|
disabled?: boolean;
|
|
19
18
|
included?: boolean;
|
|
20
|
-
/** Mark labels by value; node labels go through the `mark` snippet */
|
|
21
19
|
marks?: Record<number, string | number>;
|
|
22
20
|
max?: number;
|
|
23
21
|
min?: number;
|
|
@@ -33,7 +31,6 @@ export interface SliderProps extends Omit<HTMLAttributes<HTMLDivElement>, Native
|
|
|
33
31
|
vertical?: boolean;
|
|
34
32
|
verticalReverse?: boolean;
|
|
35
33
|
railStyle?: string;
|
|
36
|
-
/** One dot for a single handle, one per handle for a range */
|
|
37
34
|
handleDot?: HandleDot | HandleDot[];
|
|
38
35
|
/** Names the first handle's input, so a `<label for>` focuses the slider */
|
|
39
36
|
id?: string;
|
|
@@ -47,8 +44,6 @@ export interface SliderProps extends Omit<HTMLAttributes<HTMLDivElement>, Native
|
|
|
47
44
|
onBlur?: (event: FocusEvent) => void;
|
|
48
45
|
/** On the handle inputs, before the slider's own handling, so `preventDefault()` keeps a value key from moving the handle */
|
|
49
46
|
onKeyDown?: (event: KeyboardEvent) => void;
|
|
50
|
-
/** A mark's label next to the mark and, with `tooltipOnMark`, in its tooltip */
|
|
51
47
|
mark?: Snippet<[SliderMarkSnippetProps]>;
|
|
52
|
-
/** A handle's tooltip content */
|
|
53
48
|
tip?: Snippet<[SliderTipSnippetProps]>;
|
|
54
49
|
}
|