@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
package/dist/checkbox/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import CheckboxGroupPart from './checkbox-group.svelte';
|
|
2
2
|
import CheckboxBase from './checkbox.svelte';
|
|
3
|
-
// Svelte components are functions, so the part attaches to the component itself
|
|
4
3
|
export const Checkbox = Object.assign(CheckboxBase, { Group: CheckboxGroupPart });
|
|
5
4
|
export { default as CheckboxGroup } from './checkbox-group.svelte';
|
|
@@ -17,7 +17,6 @@ export type CheckboxEvent = {
|
|
|
17
17
|
};
|
|
18
18
|
export interface CheckboxProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'onchange'>, Pick<HTMLInputAttributes, 'name' | 'autofocus'> {
|
|
19
19
|
checked?: boolean;
|
|
20
|
-
/** Identifies the checkbox inside a CheckboxGroup; a checkbox without it works on its own. */
|
|
21
20
|
value?: CheckboxValue;
|
|
22
21
|
disabled?: boolean;
|
|
23
22
|
indeterminate?: boolean;
|
|
@@ -8,6 +8,5 @@ export interface CodeHighlightProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
8
8
|
lineNumber?: boolean;
|
|
9
9
|
/** 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
10
|
languages?: LanguageInput[];
|
|
11
|
-
/** Overrides the registered themes for this block */
|
|
12
11
|
themes?: CodeHighlightThemes;
|
|
13
12
|
}
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
...rest
|
|
31
31
|
}: CollapseProps = $props();
|
|
32
32
|
|
|
33
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
34
33
|
const foundationProps: FoundationProps = {
|
|
35
34
|
get activeKey() {
|
|
36
35
|
return activeKey;
|
|
@@ -46,7 +45,6 @@
|
|
|
46
45
|
(view) => CollapseFoundation.getInitialState(view),
|
|
47
46
|
(base) => ({
|
|
48
47
|
notifyChange: (next, event) => {
|
|
49
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
50
48
|
activeKey = next;
|
|
51
49
|
onChange?.(next, event);
|
|
52
50
|
},
|
package/dist/collapse/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import CollapseBase from './collapse.svelte';
|
|
2
2
|
import CollapsePanelPart from './panel.svelte';
|
|
3
|
-
// Svelte components are functions, so the part attaches to the component itself
|
|
4
3
|
export const Collapse = Object.assign(CollapseBase, { Panel: CollapsePanelPart });
|
|
5
4
|
export { default as CollapsePanel } from './panel.svelte';
|
|
@@ -20,9 +20,7 @@ export interface CollapsePanelProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
20
20
|
showArrow?: boolean;
|
|
21
21
|
disabled?: boolean;
|
|
22
22
|
onMotionEnd?: () => void;
|
|
23
|
-
/** Inside the toggle button, so only phrasing content. */
|
|
24
23
|
header?: Snippet;
|
|
25
|
-
/** Outside the toggle button, so it may hold its own controls. */
|
|
26
24
|
extra?: Snippet;
|
|
27
25
|
children?: Snippet;
|
|
28
26
|
}
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
// everOpened: whether the panel has been open since its body appeared; it resets with the body, as Collapsible's own latch does
|
|
40
39
|
$effect.pre(() => {
|
|
41
40
|
const next = CollapseFoundation.isEverOpened({ hasBody, active, everOpened });
|
|
42
41
|
if (next !== everOpened) {
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
|
|
31
31
|
let root = $state<HTMLDivElement>();
|
|
32
32
|
|
|
33
|
-
// the foundation reads the props through getters, so it always sees the current values
|
|
34
33
|
const foundationProps: CollapsibleBaseProps = {
|
|
35
34
|
get isOpen() {
|
|
36
35
|
return isOpen;
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
},
|
|
59
58
|
};
|
|
60
59
|
|
|
61
|
-
// derived once up front, so an adapter write never starts from an underived view
|
|
62
60
|
let view = $state.raw(CollapsibleFoundation.deriveView(foundationProps, CollapsibleFoundation.getInitialView(foundationProps)));
|
|
63
61
|
|
|
64
62
|
const { foundation } = useFoundation<Foundation, Adapter, CollapsibleBaseProps, object>(
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
foundation.handleInputValueChange(text);
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
// the same path as the alpha slider, so hue and the other channels are kept as they are
|
|
47
46
|
const handleAlphaChange = (percent: number) => {
|
|
48
47
|
props.foundation.handleAlphaChangeByHandle({ a: Number((percent / 100).toFixed(2)) });
|
|
49
48
|
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { HTMLAttributes, HTMLImgAttributes } from 'svelte/elements';
|
|
2
2
|
export type CropperShape = 'rect' | 'round' | 'roundRect';
|
|
3
3
|
export interface CropperProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
-
/** The address of the image that needs to be cropped */
|
|
5
4
|
src?: string;
|
|
6
5
|
/** Passed to the image; `src`, the layout style and the order of `onload` are owned by the cropper */
|
|
7
6
|
imgProps?: HTMLImgAttributes;
|
|
8
|
-
/** The shape to crop, defaults to rectangle */
|
|
9
7
|
shape?: CropperShape;
|
|
10
|
-
/** Controlled crop ratio */
|
|
11
8
|
aspectRatio?: number;
|
|
12
9
|
/** The initial width-to-height ratio of the cropping box, default is 1 */
|
|
13
10
|
defaultAspectRatio?: number;
|
|
@@ -15,17 +12,14 @@ export interface CropperProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
15
12
|
zoom?: number;
|
|
16
13
|
/** Image rotation angle; one-way, the cropper never changes it */
|
|
17
14
|
rotate?: number;
|
|
18
|
-
/** Show crop box resizing handles */
|
|
19
15
|
showResizeBox?: boolean;
|
|
20
16
|
cropperBoxStyle?: string;
|
|
21
17
|
cropperBoxCls?: string;
|
|
22
|
-
/** The fill color of the non-picture parts in the cut result */
|
|
23
18
|
fill?: string;
|
|
24
19
|
maxZoom?: number;
|
|
25
20
|
minZoom?: number;
|
|
26
21
|
zoomStep?: number;
|
|
27
22
|
/** The element the cropped area is mirrored into; it is a host DOM handle, so it stays a function */
|
|
28
23
|
preview?: () => HTMLElement | null | undefined;
|
|
29
|
-
/** Called by wheel zooming */
|
|
30
24
|
onZoomChange?: (zoom: number) => void;
|
|
31
25
|
}
|
|
@@ -52,8 +52,6 @@
|
|
|
52
52
|
});
|
|
53
53
|
|
|
54
54
|
const allowRangeClear = $derived(DateInputFoundation.getRangeClearVisible({ ...rangeParts, showClear: props.showClear ?? true, disabled: props.disabled, showClearIgnoreDisabled: props.showClearIgnoreDisabled }));
|
|
55
|
-
|
|
56
|
-
// a missing insetInputValue makes the foundation format `value` instead
|
|
57
55
|
const insetValue = $derived(DateInputFoundation.getInsetInputValue(props, { value, insetInputValue: props.insetInputValue as InsetInputValue }));
|
|
58
56
|
|
|
59
57
|
const insetPlaceholders = $derived.by(() => {
|
|
@@ -127,12 +125,10 @@
|
|
|
127
125
|
}
|
|
128
126
|
});
|
|
129
127
|
|
|
130
|
-
/** The single input of the trigger */
|
|
131
128
|
export function getSingle() {
|
|
132
129
|
return single ?? null;
|
|
133
130
|
}
|
|
134
131
|
|
|
135
|
-
/** The start input of a range trigger, or the first inset date input */
|
|
136
132
|
export function getRangeStart() {
|
|
137
133
|
return (props.insetInput ? insetStart : rangeStartInput) ?? null;
|
|
138
134
|
}
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
presetPosition = defaults('presetPosition', 'bottom'),
|
|
70
70
|
timePickerOpts = defaults('timePickerOpts'),
|
|
71
71
|
yearAndMonthOpts = defaults('yearAndMonthOpts'),
|
|
72
|
-
// read below: ConfigProvider's timeZone comes before the global default
|
|
73
72
|
timeZone,
|
|
74
73
|
motion = defaults('motion', true),
|
|
75
74
|
autoAdjustOverflow = defaults('autoAdjustOverflow', true),
|
|
@@ -140,8 +139,6 @@
|
|
|
140
139
|
const shownPlaceholder = $derived(placeholder || (locale().locale.placeholder as Record<string, string | string[] | undefined>)[type] || '');
|
|
141
140
|
const hasPresets = $derived(Boolean(presets?.length));
|
|
142
141
|
const isTriggerButton = $derived(Boolean(trigger) && !customTriggerFocusable);
|
|
143
|
-
|
|
144
|
-
// A range with a custom trigger has no range inputs
|
|
145
142
|
const hasRangeInputs = $derived(isRangeType(type) && !trigger);
|
|
146
143
|
const attrs = $derived(splitControlAttrs(rest, (key) => controlKeys.includes(key)));
|
|
147
144
|
const rootRole = $derived((rest.role as string | undefined) ?? (hasRangeInputs || rest['aria-label'] ? 'group' : undefined));
|
|
@@ -205,7 +202,6 @@
|
|
|
205
202
|
get autoFocus() {
|
|
206
203
|
return autofocus;
|
|
207
204
|
},
|
|
208
|
-
// the foundation tells a custom trigger by a function here
|
|
209
205
|
get triggerRender() {
|
|
210
206
|
return trigger ? customTrigger : undefined;
|
|
211
207
|
},
|
|
@@ -459,14 +455,12 @@
|
|
|
459
455
|
}
|
|
460
456
|
});
|
|
461
457
|
|
|
462
|
-
/** Opens the panel; a bound `open` decides through its setter */
|
|
463
458
|
export function open() {
|
|
464
459
|
foundation.open();
|
|
465
460
|
// once a user action wrote `open`, the prop (not the foundation state) decides whether the panel shows
|
|
466
461
|
openProp = true;
|
|
467
462
|
}
|
|
468
463
|
|
|
469
|
-
/** Closes the panel; a bound `open` decides through its setter */
|
|
470
464
|
export function close() {
|
|
471
465
|
foundation.close();
|
|
472
466
|
openProp = false;
|
|
@@ -517,7 +511,6 @@
|
|
|
517
511
|
{#if topSlot}
|
|
518
512
|
<div class={`${prefixCls}-topSlot`} x-semi-prop="topSlot">{@render topSlot()}</div>
|
|
519
513
|
{/if}
|
|
520
|
-
<!-- monthRange does not support presetPosition -->
|
|
521
514
|
{#if presetPosition === 'top' && type !== 'monthRange'}
|
|
522
515
|
{@render quickControls()}
|
|
523
516
|
{/if}
|
|
@@ -26,6 +26,5 @@
|
|
|
26
26
|
</script>
|
|
27
27
|
|
|
28
28
|
{#if kind === 'date' || type.includes('Time')}
|
|
29
|
-
<!-- Fully controlled: the picker owns the text -->
|
|
30
29
|
<Input aria-label={ariaLabel} bind:this={input} bind:value={() => insetInputValue[panel][field], () => {}} {disabled} onChange={handleChange} {onFocus} {placeholder} showClear={false} />
|
|
31
30
|
{/if}
|
|
@@ -26,7 +26,6 @@ export type DatePickerType = Type;
|
|
|
26
26
|
export type DatePickerTimePickerOpts = Partial<Pick<ComboboxProps, 'use12Hours' | 'hourStep' | 'minuteStep' | 'secondStep' | 'defaultIsAM' | 'scrollItemProps'>>;
|
|
27
27
|
/** The year and month column options a caller may set; the panel owns the list and the selection */
|
|
28
28
|
export type DatePickerYearAndMonthOpts = Partial<Pick<ScrollItemProps, 'cycled' | 'mode' | 'motion' | 'transform'>>;
|
|
29
|
-
/** The methods a `bind:this` reference to DatePicker exposes */
|
|
30
29
|
export interface DatePickerHandle {
|
|
31
30
|
open: () => void;
|
|
32
31
|
close: () => void;
|
|
@@ -36,7 +35,6 @@ export interface DatePickerHandle {
|
|
|
36
35
|
}
|
|
37
36
|
export interface DatePickerDateSnippetProps {
|
|
38
37
|
dayNumber: number;
|
|
39
|
-
/** yyyy-MM-dd */
|
|
40
38
|
fullDate: string;
|
|
41
39
|
}
|
|
42
40
|
export interface DatePickerFullDateSnippetProps extends DatePickerDateSnippetProps {
|
|
@@ -46,7 +44,6 @@ type NativeRootKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onfo
|
|
|
46
44
|
export interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, NativeRootKeys> {
|
|
47
45
|
/** Bindable. `null` is a controlled empty value; only `undefined` leaves the picker uncontrolled */
|
|
48
46
|
value?: DatePickerValueType | null;
|
|
49
|
-
/** Bindable */
|
|
50
47
|
open?: boolean;
|
|
51
48
|
/** A format without time tokens turns dateTime into date and dateTimeRange into dateRange */
|
|
52
49
|
type?: DatePickerType;
|
|
@@ -74,9 +71,7 @@ export interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, Na
|
|
|
74
71
|
borderless?: boolean;
|
|
75
72
|
showClear?: boolean;
|
|
76
73
|
inputReadOnly?: boolean;
|
|
77
|
-
/** Style of the Input's root element */
|
|
78
74
|
inputStyle?: string;
|
|
79
|
-
/** Moves the inputs into the panel */
|
|
80
75
|
insetInput?: boolean | DatePickerInsetInputProps;
|
|
81
76
|
insetLabelId?: string;
|
|
82
77
|
validateStatus?: ValidateStatus;
|
|
@@ -122,7 +117,6 @@ export interface DatePickerProps extends Omit<HTMLAttributes<HTMLDivElement>, Na
|
|
|
122
117
|
onClickOutSide?: (event: MouseEvent) => void;
|
|
123
118
|
/** Replaces the inputs; with no focusable element of its own, its wrapper is the button that opens the panel */
|
|
124
119
|
trigger?: Snippet<[DatePickerTriggerRenderProps]>;
|
|
125
|
-
/** The content of a day cell */
|
|
126
120
|
date?: Snippet<[DatePickerDateSnippetProps]>;
|
|
127
121
|
/** The whole day cell, which then keeps only its base and active classes */
|
|
128
122
|
fullDate?: Snippet<[DatePickerFullDateSnippetProps]>;
|
|
@@ -151,7 +145,6 @@ export interface DatePickerTriggerRenderProps {
|
|
|
151
145
|
format?: string;
|
|
152
146
|
multiple: boolean;
|
|
153
147
|
autofocus: boolean;
|
|
154
|
-
/** The declared props, without snippets, callbacks and undeclared attributes */
|
|
155
148
|
componentProps: Omit<DatePickerProps, keyof HTMLAttributes<HTMLDivElement> | `on${string}` | 'trigger' | 'date' | 'fullDate' | 'topSlot' | 'bottomSlot' | 'leftSlot' | 'rightSlot' | 'prefix' | 'insetLabel' | 'clearIcon' | 'rangeSeparatorNode'>;
|
|
156
149
|
onChange: (inputValue: string) => void;
|
|
157
150
|
onEnterPress: (inputValue: string) => void;
|
|
@@ -10,7 +10,6 @@ import type { Locale } from '@fibrae/semi-foundation/locale/interface';
|
|
|
10
10
|
import type { InputSize, ValidateStatus } from '../input/index.js';
|
|
11
11
|
import type { DatePickerDateSnippetProps, DatePickerDensity, DatePickerFullDateSnippetProps, DatePickerInsetInputProps, DatePickerPresetPosition, DatePickerPresetsType, DatePickerTimePickerOpts, DatePickerValueType, DatePickerYearAndMonthOpts } from './interface.js';
|
|
12
12
|
export type DatePickerLocale = Locale['DatePicker'];
|
|
13
|
-
/** What DatePicker focuses: an Input of the trigger, or an inset input of the panel */
|
|
14
13
|
export interface DatePickerFocusTarget {
|
|
15
14
|
focus: (options?: FocusOptions) => void;
|
|
16
15
|
blur: () => void;
|
|
@@ -26,10 +25,8 @@ export interface NavigationProps {
|
|
|
26
25
|
locale: DatePickerLocale;
|
|
27
26
|
monthText?: string;
|
|
28
27
|
density?: DatePickerDensity;
|
|
29
|
-
/** Whether the two panels switch together (syncSwitchMonth) */
|
|
30
28
|
shouldBimonthSwitch?: boolean;
|
|
31
29
|
panelType?: PanelType;
|
|
32
|
-
/** id of the month button, which names the month grid */
|
|
33
30
|
titleId?: string;
|
|
34
31
|
onPrevYear: () => void;
|
|
35
32
|
onPrevMonth: () => void;
|
|
@@ -62,7 +59,6 @@ export interface MonthProps {
|
|
|
62
59
|
hoverDay: string;
|
|
63
60
|
rangeInputFocus: string | boolean;
|
|
64
61
|
focusRecords: FocusRecords;
|
|
65
|
-
/** id of the element naming the grid */
|
|
66
62
|
labelledby?: string;
|
|
67
63
|
date?: Snippet<[DatePickerDateSnippetProps]>;
|
|
68
64
|
fullDate?: Snippet<[DatePickerFullDateSnippetProps]>;
|
|
@@ -123,7 +119,6 @@ export interface MonthsGridProps {
|
|
|
123
119
|
focusRecords?: FocusRecords;
|
|
124
120
|
insetInput: boolean | DatePickerInsetInputProps;
|
|
125
121
|
presetPosition?: DatePickerPresetPosition;
|
|
126
|
-
/** Whether `quickControls` renders presets, which sets the panel's x-preset-position */
|
|
127
122
|
hasPresets?: boolean;
|
|
128
123
|
selectedValue?: (Date | null)[];
|
|
129
124
|
defaultPickerValue?: DatePickerValueType;
|
|
@@ -135,7 +130,6 @@ export interface MonthsGridProps {
|
|
|
135
130
|
quickControls?: Snippet;
|
|
136
131
|
date?: Snippet<[DatePickerDateSnippetProps]>;
|
|
137
132
|
fullDate?: Snippet<[DatePickerFullDateSnippetProps]>;
|
|
138
|
-
/** Whether the range input other than the given one has been focused since the panel opened */
|
|
139
133
|
hasOtherRangeInputBeenFocused?: (currentRangeInput: RangeInput) => boolean;
|
|
140
134
|
onChange: (value: Date[], options?: {
|
|
141
135
|
closePanel?: boolean;
|
|
@@ -180,7 +174,6 @@ export interface DateInputProps {
|
|
|
180
174
|
insetInputValue?: InsetInputValue | null;
|
|
181
175
|
defaultPickerValue?: DatePickerValueType;
|
|
182
176
|
density?: DatePickerDensity;
|
|
183
|
-
/** Attributes of the native input(s): the field state, the combobox role and the popup state */
|
|
184
177
|
controlAttrs?: Record<string, unknown>;
|
|
185
178
|
prefix?: Snippet;
|
|
186
179
|
insetLabel?: Snippet;
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
return [cssClasses.DAY, MonthFoundation.getDayClasses(statusOf(day), day.fullDate === activeDate)];
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
// a range keeps its value in rangeStart and rangeEnd, not in `selected`
|
|
66
65
|
const isSelected = (day: MonthDayInfo) => {
|
|
67
66
|
const status = statusOf(day);
|
|
68
67
|
return Boolean(status.isSelected || status.isSelectedStart || status.isSelectedEnd);
|
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|
|
|
21
21
|
const titleId = $props.id();
|
|
22
22
|
let panelHeight = 0;
|
|
23
|
-
|
|
24
|
-
// The values the effects below last saw, to act on changes only
|
|
25
23
|
let syncedPickerValue: { value: MonthsGridProps['defaultPickerValue'] } | undefined;
|
|
26
24
|
let previousCount: number | undefined;
|
|
27
25
|
let panelSize = $state.raw<PanelSize>({ left: { minWidth: '', minHeight: '' }, right: { minWidth: '', minHeight: '' } });
|
|
@@ -59,8 +57,6 @@
|
|
|
59
57
|
const panelTypes = $derived<PanelType[]>(isRange ? [PANEL_TYPE_LEFT, PANEL_TYPE_RIGHT] : [PANEL_TYPE_LEFT]);
|
|
60
58
|
const dateFormat = $derived(MonthsGridFoundation.getValidDateFormat(props));
|
|
61
59
|
const hasTime = $derived(props.type.includes('Time'));
|
|
62
|
-
|
|
63
|
-
// Both panels show year or time lists in a range, which then share a minHeight
|
|
64
60
|
const scrollListCount = $derived(isRange ? Number(isYearOrTime(states().monthLeft)) + Number(isYearOrTime(states().monthRight)) : 0);
|
|
65
61
|
|
|
66
62
|
const detailOf = (panelType: PanelType) => {
|
|
@@ -116,7 +112,6 @@
|
|
|
116
112
|
}
|
|
117
113
|
};
|
|
118
114
|
|
|
119
|
-
// Panels share a minHeight only while both show scroll lists, so only the cached height is updated here
|
|
120
115
|
const handleWeeksRowNumChange = () => {
|
|
121
116
|
if (isRange && !(isYearOrTime(states().monthLeft) && isYearOrTime(states().monthRight))) {
|
|
122
117
|
panelHeight = scrollListHeight();
|
|
@@ -172,7 +167,6 @@
|
|
|
172
167
|
untrack(() => void syncScrollLists(previous, count));
|
|
173
168
|
});
|
|
174
169
|
|
|
175
|
-
// The panel size follows the views each panel shows, measured once the DOM shows them
|
|
176
170
|
$effect(() => {
|
|
177
171
|
void states().monthLeft;
|
|
178
172
|
void states().monthRight;
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
const iconSize = $derived(density === 'compact' ? 'default' : 'large');
|
|
12
12
|
const buttonSize = $derived(density === 'compact' ? 'small' : 'default');
|
|
13
13
|
|
|
14
|
-
// `visibility: hidden` keeps the icons in position
|
|
15
14
|
const hidden = (side: string) => {
|
|
16
15
|
return shouldBimonthSwitch && panelType === side ? 'visibility: hidden' : undefined;
|
|
17
16
|
};
|
|
@@ -3,7 +3,6 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
3
3
|
export type DescriptionsAlign = 'center' | 'justify' | 'left' | 'plain';
|
|
4
4
|
export type DescriptionsLayout = 'horizontal' | 'vertical';
|
|
5
5
|
export type DescriptionsSize = 'small' | 'medium' | 'large';
|
|
6
|
-
/** An item of `data`; nodes for its key and value come from the `itemKey` and `value` snippets */
|
|
7
6
|
export interface DescriptionsData {
|
|
8
7
|
key?: string | number;
|
|
9
8
|
value?: string | number;
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
// A snippet cannot be inspected, so passing children is what makes a horizontal divider carry text
|
|
14
14
|
const withText = $derived(Boolean(children) && layout === 'horizontal');
|
|
15
15
|
|
|
16
|
-
// The user's style goes last so it can override the margin
|
|
17
16
|
const style = $derived.by(() => {
|
|
18
17
|
const length = toCssLength(margin);
|
|
19
18
|
const sides = length === undefined ? [] : layout === 'vertical' ? [`margin-left: ${length}`, `margin-right: ${length}`] : [`margin-top: ${length}`, `margin-bottom: ${length}`];
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
export interface DividerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'align'> {
|
|
3
|
-
/** The position of title inside divider */
|
|
4
3
|
align?: 'left' | 'right' | 'center';
|
|
5
|
-
/** Space between divider and surroundings */
|
|
6
4
|
margin?: number | string;
|
|
7
|
-
/** Whether line is dashed */
|
|
8
5
|
dashed?: boolean;
|
|
9
|
-
/** The direction type of divider */
|
|
10
6
|
layout?: 'horizontal' | 'vertical';
|
|
11
7
|
}
|
|
@@ -10,7 +10,6 @@ export default function dragMove(options = {}) {
|
|
|
10
10
|
return (element) => {
|
|
11
11
|
const { handler, onMouseDown, onMouseMove, onMouseUp, onTouchStart, onTouchMove, onTouchEnd, onTouchCancel, ...rest } = options;
|
|
12
12
|
const props = { ...rest, handler: typeof handler === 'object' ? () => handler : handler };
|
|
13
|
-
// the foundation reads neither state nor context
|
|
14
13
|
const adapter = {
|
|
15
14
|
getContext: () => undefined,
|
|
16
15
|
getContexts: () => ({}),
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export interface DragMoveOptions {
|
|
2
|
-
/** The element that starts a drag, or a function returning it; defaults to the dragged element itself */
|
|
3
2
|
handler?: HTMLElement | (() => HTMLElement | null);
|
|
4
3
|
/** The element that bounds the movement; it needs a positioned layout */
|
|
5
4
|
constrainer?: 'parent' | (() => HTMLElement | null);
|
|
6
|
-
/** Whether pressing on a native input or textarea starts a drag */
|
|
7
5
|
allowInputDrag?: boolean;
|
|
8
6
|
/** Called when a pointer goes down: return `false` to not drag */
|
|
9
7
|
allowMove?: (e: PointerEvent, element: HTMLElement) => boolean;
|
|
10
|
-
/** Takes the new position instead of the element's top and left */
|
|
11
8
|
customMove?: (element: HTMLElement, top: number, left: number) => void;
|
|
12
9
|
/** `relative` keeps the element's place in the layout */
|
|
13
10
|
positionStrategy?: 'absolute' | 'relative';
|
|
@@ -2,24 +2,18 @@ import { SvelteMap } from 'svelte/reactivity';
|
|
|
2
2
|
import type { DropdownMenuContext, DropdownSelectionMode } from '@fibrae/semi-foundation/dropdown/menu-foundation';
|
|
3
3
|
import type { Trigger } from '../tooltip/index.js';
|
|
4
4
|
export interface DropdownContextView {
|
|
5
|
-
/** How many menus enclose this point: 1 inside a top-level menu */
|
|
6
5
|
readonly menuDepth: number;
|
|
7
6
|
readonly showTick: boolean;
|
|
8
7
|
readonly selectionMode?: DropdownSelectionMode;
|
|
9
8
|
readonly trigger: Trigger;
|
|
10
9
|
}
|
|
11
|
-
/** What a Dropdown provides to its popup content; its trigger reads the context of the menu around the Dropdown */
|
|
12
10
|
export interface DropdownContext {
|
|
13
|
-
/** Getters over the Dropdown's props, so readers stay reactive */
|
|
14
11
|
readonly view: DropdownContextView;
|
|
15
|
-
/** Closes the popup that renders the menu, without moving focus */
|
|
16
12
|
close: () => void;
|
|
17
|
-
/** Closes that popup and the popups of every enclosing menu */
|
|
18
13
|
closeAll: () => void;
|
|
19
14
|
getPopupId: () => string;
|
|
20
15
|
}
|
|
21
16
|
export declare const getDropdownContext: (caller?: string) => DropdownContext | undefined, setDropdownContext: (value: DropdownContext | undefined) => DropdownContext | undefined;
|
|
22
|
-
/** The foundation context; outside any menu the depth is 0 */
|
|
23
17
|
export declare function menuContext(context?: DropdownContext, direction?: 'ltr' | 'rtl'): DropdownMenuContext;
|
|
24
18
|
/**
|
|
25
19
|
* Each Dropdown.Item's li -> whether it is disabled. A snippet cannot read its child's props, so a Dropdown finds out
|
package/dist/dropdown/context.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { SvelteMap } from 'svelte/reactivity';
|
|
2
2
|
import { createContext } from '../_base/create-context.js';
|
|
3
3
|
export const [getDropdownContext, setDropdownContext] = createContext('Dropdown', { optional: true });
|
|
4
|
-
/** The foundation context; outside any menu the depth is 0 */
|
|
5
4
|
export function menuContext(context, direction) {
|
|
6
5
|
return {
|
|
7
6
|
...context?.view,
|
|
@@ -75,8 +75,6 @@
|
|
|
75
75
|
const config = getConfigContext();
|
|
76
76
|
|
|
77
77
|
let tooltip = $state<Tooltip>();
|
|
78
|
-
|
|
79
|
-
// the trigger element: the span below, or the element the `child` snippet spread the trigger props on
|
|
80
78
|
let triggerElement = $state.raw<HTMLElement | null>(null);
|
|
81
79
|
let popupElement = $state<HTMLDivElement>();
|
|
82
80
|
let textOnly = $state(false);
|
|
@@ -100,7 +98,6 @@
|
|
|
100
98
|
() => ({ popVisible: false }),
|
|
101
99
|
(base) => ({
|
|
102
100
|
setPopVisible: (popVisible) => base.setState({ popVisible }),
|
|
103
|
-
// Tooltip has already written the bindable `visible`
|
|
104
101
|
notifyVisibleChange: (next) => onVisibleChange?.(next),
|
|
105
102
|
getPopup: () => popupElement?.closest<HTMLElement>('[popover]') ?? null,
|
|
106
103
|
hidePopup: () => tooltip?.hide(),
|
|
@@ -124,7 +121,6 @@
|
|
|
124
121
|
return ownRole ? canRoleCarryPopupState(ownRole) : element.matches('button, a[href]');
|
|
125
122
|
});
|
|
126
123
|
|
|
127
|
-
// a disabled parent item opens no submenu
|
|
128
124
|
const disabledItem = $derived(triggerElement ? Boolean(menuItems.get(triggerElement)?.()) : false);
|
|
129
125
|
|
|
130
126
|
const tooltipProps: TooltipProps = $derived({
|
|
@@ -185,7 +181,6 @@
|
|
|
185
181
|
getPopupId: () => tooltip?.getPopupId() ?? '',
|
|
186
182
|
};
|
|
187
183
|
|
|
188
|
-
// Moves focus into the menu when Tooltip gives the popup its initial focus.
|
|
189
184
|
const focusTarget = { focus: foundation.handleOpened };
|
|
190
185
|
|
|
191
186
|
// The trigger's own onkeydown goes first: a trigger that clicks itself on Enter (Tag, Avatar) calls preventDefault,
|
|
@@ -218,7 +213,6 @@
|
|
|
218
213
|
return {
|
|
219
214
|
...tooltipTrigger,
|
|
220
215
|
class: popVisible ? `${prefixCls}-showing` : undefined,
|
|
221
|
-
// undefined also drops a value the trigger set itself
|
|
222
216
|
'aria-haspopup': menuButton ? 'menu' : undefined,
|
|
223
217
|
'aria-expanded': menuButton ? popVisible : undefined,
|
|
224
218
|
[triggerKey]: attachTrigger,
|
|
@@ -246,7 +240,6 @@
|
|
|
246
240
|
tooltip?.focusTrigger();
|
|
247
241
|
}
|
|
248
242
|
|
|
249
|
-
/** Repositions the open popup at once; it already follows scrolling, resizing and trigger moves */
|
|
250
243
|
export function rePosition() {
|
|
251
244
|
tooltip?.rePosition();
|
|
252
245
|
}
|
|
@@ -7,7 +7,6 @@ import type { TooltipProps, TooltipTriggerProps } from '../tooltip/index.js';
|
|
|
7
7
|
* caller (`class={[props.class, 'own']}`), and the attachment under a symbol key must survive the spread.
|
|
8
8
|
*/
|
|
9
9
|
export type DropdownTriggerProps = Omit<TooltipTriggerProps, 'aria-haspopup' | 'aria-expanded' | 'aria-controls'> & {
|
|
10
|
-
/** `semi-dropdown-showing` while the menu is open */
|
|
11
10
|
class?: string;
|
|
12
11
|
'aria-haspopup'?: 'menu';
|
|
13
12
|
'aria-expanded'?: boolean;
|
|
@@ -21,7 +20,6 @@ export interface DropdownMenuIconArgs {
|
|
|
21
20
|
* wraps a special trigger only in its own span, and Dropdown always renders the trigger itself. No element props: F11.
|
|
22
21
|
*/
|
|
23
22
|
export interface DropdownProps extends Omit<TooltipProps, 'showArrow' | 'arrowPointAtCenter' | 'disableArrowKeyDown' | 'arrow' | 'child' | 'children' | 'content' | 'wrapWhenSpecial'> {
|
|
24
|
-
/** Wrapped in a span, which takes the trigger attributes */
|
|
25
23
|
children?: Snippet;
|
|
26
24
|
/** Renders the trigger element itself, which takes `props`; use it for a button, a link or a parent `DropdownItem` */
|
|
27
25
|
child?: Snippet<[{
|
|
@@ -45,7 +43,6 @@ export interface DropdownProps extends Omit<TooltipProps, 'showArrow' | 'arrowPo
|
|
|
45
43
|
showTick?: boolean;
|
|
46
44
|
}
|
|
47
45
|
export interface DropdownHandle {
|
|
48
|
-
/** Focuses the trigger (a non-custom trigger only) */
|
|
49
46
|
focusTrigger: () => void;
|
|
50
47
|
/** Repositions the open popup at once; it already follows scrolling, resizing and trigger moves, a move a frame late */
|
|
51
48
|
rePosition: () => void;
|
|
@@ -58,7 +55,6 @@ export interface DropdownItemProps extends HTMLAttributes<HTMLLIElement> {
|
|
|
58
55
|
/** Takes effect only outside a Dropdown; inside one, the Dropdown's showTick applies. */
|
|
59
56
|
showTick?: boolean;
|
|
60
57
|
type?: 'primary' | 'secondary' | 'tertiary' | 'warning' | 'danger';
|
|
61
|
-
/** The icon container is rendered even when the snippet outputs nothing */
|
|
62
58
|
icon?: Snippet;
|
|
63
59
|
}
|
|
64
60
|
export interface DropdownTitleProps extends HTMLAttributes<HTMLLIElement> {
|
package/dist/empty/empty.svelte
CHANGED
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
const sprite = $derived(typeof shown === 'object' && shown ? shown.id : undefined);
|
|
21
21
|
const hasImage = $derived(Boolean(shownSnippet || src || sprite));
|
|
22
22
|
|
|
23
|
-
// Only an Empty with a darkModeImage has anything to switch, so only it observes
|
|
24
23
|
$effect(() => {
|
|
25
24
|
if (!darkModeImage) return;
|
|
26
25
|
const sync = () => {
|
|
@@ -2,7 +2,6 @@ import type { Snippet } from 'svelte';
|
|
|
2
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
3
|
import type { strings } from '@fibrae/semi-foundation/empty/constants';
|
|
4
4
|
export type EmptyLayout = (typeof strings.LAYOUT)[number];
|
|
5
|
-
/** The id of an SVG sprite symbol on the page, drawn with `<use>` */
|
|
6
5
|
export interface EmptySvgNode {
|
|
7
6
|
id: string;
|
|
8
7
|
}
|
|
@@ -10,13 +9,11 @@ export interface EmptySvgNode {
|
|
|
10
9
|
export type EmptyImage = string | EmptySvgNode | Snippet;
|
|
11
10
|
export interface EmptyProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
12
11
|
layout?: EmptyLayout;
|
|
13
|
-
/** Inline style of the image box */
|
|
14
12
|
imageStyle?: string;
|
|
15
13
|
title?: string | Snippet;
|
|
16
14
|
image?: EmptyImage;
|
|
17
15
|
/** Shown instead of `image` while the page is in dark mode */
|
|
18
16
|
darkModeImage?: EmptyImage;
|
|
19
17
|
description?: Snippet;
|
|
20
|
-
/** Actions below the description */
|
|
21
18
|
children?: Snippet;
|
|
22
19
|
}
|