@fibrae/semi-ui-svelte 0.1.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_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-content.svelte +4 -4
- package/dist/feedback/feedback.svelte +0 -1
- package/dist/feedback/interface.d.ts +4 -12
- 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 +9 -5
- package/dist/form/field-inner.svelte.d.ts +3 -1
- package/dist/form/field.svelte +9 -2
- package/dist/form/field.svelte.d.ts +6 -2
- package/dist/form/form-auto-complete.svelte +7 -1
- package/dist/form/form-auto-complete.svelte.d.ts +3 -1
- package/dist/form/form-cascader.svelte +7 -1
- package/dist/form/form-cascader.svelte.d.ts +3 -1
- package/dist/form/form-checkbox-group.svelte +7 -1
- package/dist/form/form-checkbox-group.svelte.d.ts +3 -1
- package/dist/form/form-checkbox.svelte +7 -1
- package/dist/form/form-checkbox.svelte.d.ts +3 -1
- package/dist/form/form-date-picker.svelte +7 -1
- package/dist/form/form-date-picker.svelte.d.ts +3 -1
- package/dist/form/form-input-number.svelte +7 -1
- package/dist/form/form-input-number.svelte.d.ts +3 -1
- package/dist/form/form-input.svelte +7 -1
- package/dist/form/form-input.svelte.d.ts +3 -1
- package/dist/form/form-pin-code.svelte +7 -1
- package/dist/form/form-pin-code.svelte.d.ts +3 -1
- package/dist/form/form-radio-group.svelte +7 -1
- package/dist/form/form-radio-group.svelte.d.ts +3 -1
- package/dist/form/form-radio.svelte +7 -1
- package/dist/form/form-radio.svelte.d.ts +3 -1
- package/dist/form/form-rating.svelte +7 -1
- package/dist/form/form-rating.svelte.d.ts +3 -1
- package/dist/form/form-select.svelte +7 -1
- package/dist/form/form-select.svelte.d.ts +3 -1
- package/dist/form/form-slider.svelte +7 -1
- package/dist/form/form-slider.svelte.d.ts +3 -1
- package/dist/form/form-switch.svelte +7 -1
- package/dist/form/form-switch.svelte.d.ts +3 -1
- package/dist/form/form-tag-input.svelte +7 -1
- package/dist/form/form-tag-input.svelte.d.ts +3 -1
- package/dist/form/form-text-area.svelte +7 -1
- package/dist/form/form-text-area.svelte.d.ts +3 -1
- package/dist/form/form-time-picker.svelte +7 -1
- package/dist/form/form-time-picker.svelte.d.ts +3 -1
- package/dist/form/form-transfer.svelte +7 -1
- package/dist/form/form-transfer.svelte.d.ts +3 -1
- package/dist/form/form-tree-select.svelte +7 -1
- package/dist/form/form-tree-select.svelte.d.ts +3 -1
- package/dist/form/form-upload.svelte +7 -1
- package/dist/form/form-upload.svelte.d.ts +3 -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/icon-button/icon-button.svelte +6 -2
- 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/input-group.svelte +8 -2
- 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 +2 -2
- 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 +4 -5
- 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 +2 -2
- 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 +30 -14
- 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 +14 -11
- 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 +2 -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 +3 -3
- 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 +5 -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 +3 -3
|
@@ -2,7 +2,6 @@ import { onMount } from 'svelte';
|
|
|
2
2
|
import { startOfDay } from 'date-fns';
|
|
3
3
|
import { getCurrDate } from '@fibrae/semi-foundation/calendar/event-util';
|
|
4
4
|
import CalendarFoundation from '@fibrae/semi-foundation/calendar/foundation';
|
|
5
|
-
/** The timestamp of today's local midnight; used while the first frame has no `today` */
|
|
6
5
|
export const snapshotToday = () => startOfDay(getCurrDate()).getTime();
|
|
7
6
|
/**
|
|
8
7
|
* The timestamp of today's local midnight, kept current while mounted. `null` until mounted so the server render and
|
package/dist/card/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import CardBase from './card.svelte';
|
|
2
2
|
import CardMetaPart from './meta.svelte';
|
|
3
|
-
// Svelte components are functions, so the part attaches to the component itself
|
|
4
3
|
export const Card = Object.assign(CardBase, { Meta: CardMetaPart });
|
|
5
4
|
export { default as CardGroup } from './card-group.svelte';
|
|
6
5
|
export { default as CardMeta } from './meta.svelte';
|
package/dist/card/interface.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ import type { SpaceProps } from '../space/interface.js';
|
|
|
4
4
|
export type Shadows = 'hover' | 'always';
|
|
5
5
|
export type CardGroupType = 'grid';
|
|
6
6
|
export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
7
|
-
/** Content area inline style */
|
|
8
7
|
bodyStyle?: string;
|
|
9
8
|
bordered?: boolean;
|
|
10
9
|
footerLine?: boolean;
|
|
@@ -16,10 +15,8 @@ export interface CardProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title'>
|
|
|
16
15
|
/** A string renders as a 6th-level title with a single-line ellipsis tooltip; a snippet renders as it is */
|
|
17
16
|
title?: string | Snippet;
|
|
18
17
|
headerExtraContent?: Snippet;
|
|
19
|
-
/** Replaces the title and headerExtraContent */
|
|
20
18
|
header?: Snippet;
|
|
21
19
|
cover?: Snippet;
|
|
22
|
-
/** One snippet per action */
|
|
23
20
|
actions?: Snippet[];
|
|
24
21
|
footer?: Snippet;
|
|
25
22
|
children?: Snippet;
|
|
@@ -51,8 +51,6 @@
|
|
|
51
51
|
|
|
52
52
|
// Used to find the indicator tab to focus, from the root: slides may contain tabs or nested carousels
|
|
53
53
|
let root: HTMLElement | undefined;
|
|
54
|
-
|
|
55
|
-
// the roving tabindex moves with the current slide, so focus follows it after a key changed it
|
|
56
54
|
let focusPending = false;
|
|
57
55
|
|
|
58
56
|
// Slides that arrive after mount (data still loading) start the configured autoplay, as mounting with them would
|
|
@@ -62,7 +60,6 @@
|
|
|
62
60
|
let leftNamed = $state(false);
|
|
63
61
|
let rightNamed = $state(false);
|
|
64
62
|
|
|
65
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
66
63
|
const foundationProps: CarouselBaseProps = {
|
|
67
64
|
get activeIndex() {
|
|
68
65
|
return activeIndex;
|
|
@@ -84,7 +81,6 @@
|
|
|
84
81
|
},
|
|
85
82
|
(base) => ({
|
|
86
83
|
notifyChange: (next, preIndex) => {
|
|
87
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
88
84
|
activeIndex = next;
|
|
89
85
|
onChange?.(next, preIndex);
|
|
90
86
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
3
|
import type { CarouselAutoPlay } from '@fibrae/semi-foundation/carousel/foundation';
|
|
4
|
-
/** Data for one arrow button; `onclick` and `class` merge with the built-in handler and classes */
|
|
5
4
|
export interface ArrowButton {
|
|
6
5
|
props?: HTMLButtonAttributes;
|
|
7
6
|
}
|
|
@@ -34,9 +33,7 @@ export interface CarouselProps<T = unknown> extends Omit<HTMLAttributes<HTMLDivE
|
|
|
34
33
|
onChange?: (activeIndex: number, preIndex: number) => void;
|
|
35
34
|
/** The content of one slide; the carousel wraps it in the element that carries the slide's classes, role and `inert` */
|
|
36
35
|
slide: Snippet<[CarouselSlideContext<T>]>;
|
|
37
|
-
/** Replaces the icon of the previous arrow */
|
|
38
36
|
leftArrow?: Snippet;
|
|
39
|
-
/** Replaces the icon of the next arrow */
|
|
40
37
|
rightArrow?: Snippet;
|
|
41
38
|
}
|
|
42
39
|
export interface CarouselState {
|
|
@@ -141,7 +141,6 @@
|
|
|
141
141
|
const selectionTextId = `${uid}-selection`;
|
|
142
142
|
const cls = cssClasses.PREFIX;
|
|
143
143
|
|
|
144
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
145
144
|
const foundationProps: BasicCascaderProps = {
|
|
146
145
|
get autoMergeValue() {
|
|
147
146
|
return autoMergeValue;
|
|
@@ -226,7 +225,6 @@
|
|
|
226
225
|
if (searchInput) {
|
|
227
226
|
searchInput.focus({ preventScroll });
|
|
228
227
|
} else if (tagInput) {
|
|
229
|
-
// TagInput reads preventScroll from its own prop
|
|
230
228
|
tagInput.focus();
|
|
231
229
|
} else {
|
|
232
230
|
triggerEl?.focus({ preventScroll });
|
|
@@ -238,7 +236,6 @@
|
|
|
238
236
|
},
|
|
239
237
|
updateStates: (next) => base.setState(next as BasicCascaderInnerData),
|
|
240
238
|
notifyChange: (next) => {
|
|
241
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
242
239
|
value = next as CascaderValue;
|
|
243
240
|
onChange?.(next as CascaderChangeValue);
|
|
244
241
|
},
|
|
@@ -279,7 +276,6 @@
|
|
|
279
276
|
})
|
|
280
277
|
);
|
|
281
278
|
|
|
282
|
-
// controlled values and the multiple-mode tree are derived here, so they reach the DOM in the render that receives them
|
|
283
279
|
const view: BasicCascaderInnerData = $derived(multiple ? { ...states(), ...CascaderFoundation.deriveMultipleState(foundationProps, states()) } : states());
|
|
284
280
|
const renderData = $derived(CascaderFoundation.getRenderData(foundationProps, view));
|
|
285
281
|
const isEmpty = $derived(!renderData.length);
|
|
@@ -342,7 +338,6 @@
|
|
|
342
338
|
|
|
343
339
|
const triggerSnippetProps: CascaderTriggerSnippetProps = $derived.by(() => {
|
|
344
340
|
const { keyEntities, checkedKeys, resolvedCheckedKeys, selectedKeys } = view;
|
|
345
|
-
// the trigger gets positions; mergeType decides which checked set they come from, whatever checkRelation is
|
|
346
341
|
const keys = mergeType === strings.NONE_MERGE_TYPE ? checkedKeys : resolvedCheckedKeys;
|
|
347
342
|
return {
|
|
348
343
|
value: multiple ? new Set([...keys].map((key) => keyEntities[key]?.pos)) : keyEntities[[...selectedKeys][0]]?.pos,
|
|
@@ -692,7 +687,6 @@
|
|
|
692
687
|
{/snippet}
|
|
693
688
|
|
|
694
689
|
{#snippet triggerNode({ props }: { props: TooltipTriggerProps })}
|
|
695
|
-
<!-- the combobox is the Tab stop -->
|
|
696
690
|
<div
|
|
697
691
|
bind:this={triggerEl}
|
|
698
692
|
{...props}
|
|
@@ -10,12 +10,10 @@ import type { Position } from '../tooltip/index.js';
|
|
|
10
10
|
export type CascaderKeyMapProps = KeyMapProps;
|
|
11
11
|
export type CascaderSize = Size;
|
|
12
12
|
export type CascaderVirtualize = Virtualize;
|
|
13
|
-
/** A node of `treeData`; markup for its label goes in the `label` snippet */
|
|
14
13
|
export interface CascaderData extends BasicCascaderData {
|
|
15
14
|
label: string | number;
|
|
16
15
|
children?: CascaderData[];
|
|
17
16
|
}
|
|
18
|
-
/** A node of `treeData` with its place in the tree */
|
|
19
17
|
export interface CascaderEntity extends BasicEntity {
|
|
20
18
|
children?: CascaderEntity[];
|
|
21
19
|
data: CascaderData;
|
|
@@ -24,7 +22,6 @@ export interface CascaderEntity extends BasicEntity {
|
|
|
24
22
|
export interface CascaderScrollPanelProps extends BasicScrollPanelProps {
|
|
25
23
|
activeNode: CascaderData;
|
|
26
24
|
}
|
|
27
|
-
/** The basic type of the value of Cascader */
|
|
28
25
|
export type CascaderSimpleValue = string | number | CascaderData;
|
|
29
26
|
/** A single-mode value is one node or its path; a multiple-mode value may also be a list of paths */
|
|
30
27
|
export type CascaderValue = CascaderSimpleValue | CascaderSimpleValue[] | CascaderSimpleValue[][];
|
|
@@ -34,7 +31,6 @@ export interface CascaderLabelSnippetProps {
|
|
|
34
31
|
item: CascaderData;
|
|
35
32
|
}
|
|
36
33
|
export interface CascaderDisplaySnippetProps {
|
|
37
|
-
/** The `displayProp` of each node on the selected path */
|
|
38
34
|
labels: Array<string | number>;
|
|
39
35
|
/**
|
|
40
36
|
* The nodes on the selected path; a value not found in `treeData` gives its raw values instead, as `onChange`
|
|
@@ -49,44 +45,36 @@ export interface CascaderTagSnippetProps {
|
|
|
49
45
|
/** Unchecks the node; a given event has its default prevented, so a Tag wired to it does not hide itself */
|
|
50
46
|
onClose: (event?: TagCloseEvent) => void;
|
|
51
47
|
}
|
|
52
|
-
/** What a custom search result row spreads on its element: the combobox's aria-activedescendant points at the id */
|
|
53
48
|
export interface CascaderFilterItemDomProps {
|
|
54
49
|
id: string;
|
|
55
50
|
role: 'option';
|
|
56
51
|
'aria-selected': boolean;
|
|
57
52
|
'aria-disabled'?: true;
|
|
58
53
|
class: ClassValue;
|
|
59
|
-
/** Only in virtual results: the row's position */
|
|
60
54
|
style?: string;
|
|
61
55
|
onclick: (event: MouseEvent) => void;
|
|
62
56
|
}
|
|
63
57
|
export interface CascaderFilterItemSnippetProps {
|
|
64
|
-
/** Spread it on the row's element: `<li {...props}>` */
|
|
65
58
|
props: CascaderFilterItemDomProps;
|
|
66
59
|
inputValue: string;
|
|
67
60
|
disabled: boolean;
|
|
68
|
-
/** The nodes of the path */
|
|
69
61
|
data: CascaderData[];
|
|
70
62
|
checkStatus: {
|
|
71
63
|
checked: boolean;
|
|
72
64
|
halfChecked: boolean;
|
|
73
65
|
};
|
|
74
66
|
selected: boolean;
|
|
75
|
-
/** For the `onChange` of a Checkbox in the row */
|
|
76
67
|
onCheck: (event: CheckboxEvent) => void;
|
|
77
68
|
}
|
|
78
69
|
export interface CascaderTriggerSnippetProps {
|
|
79
70
|
/** The position in treeData (such as `0-0-1`) of the selected node, or in multiple mode of each checked node */
|
|
80
71
|
value: string | Set<string> | undefined;
|
|
81
|
-
/** The search keyword; the selected path's text while closed in single mode */
|
|
82
72
|
inputValue: string;
|
|
83
73
|
placeholder?: string;
|
|
84
74
|
disabled: boolean;
|
|
85
|
-
/** Updates the search keyword */
|
|
86
75
|
onSearch: (inputValue: string) => void;
|
|
87
76
|
/** Pass the click event when bound to a control inside the trigger, so the click does not open the dropdown */
|
|
88
77
|
onClear: (event?: MouseEvent) => void;
|
|
89
|
-
/** Unchecks the node at a position of `value` */
|
|
90
78
|
onRemove: (pos: string) => void;
|
|
91
79
|
}
|
|
92
80
|
type NativeKeys = 'children' | 'prefix' | 'placeholder' | 'onchange' | 'onselect' | 'onfocus' | 'onblur' | 'onkeydown';
|
|
@@ -112,7 +100,6 @@ export interface CascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, Nati
|
|
|
112
100
|
/** Loads the children of the last node; a node without `isLeaf` shows the expand arrow while it is set */
|
|
113
101
|
loadData?: (selectOptions: CascaderData[]) => Promise<void>;
|
|
114
102
|
filterTreeNode?: boolean | ((inputValue: string, treeNodeString: string, data?: CascaderData) => boolean);
|
|
115
|
-
/** `first` and `second` are the two result paths, from the root to the matched node */
|
|
116
103
|
filterSorter?: (first: CascaderData[], second: CascaderData[], inputValue: string) => number;
|
|
117
104
|
filterLeafOnly?: boolean;
|
|
118
105
|
treeNodeFilterProp?: string;
|
|
@@ -161,21 +148,15 @@ export interface CascaderProps extends Omit<HTMLAttributes<HTMLDivElement>, Nati
|
|
|
161
148
|
* options still take the key
|
|
162
149
|
*/
|
|
163
150
|
onKeyDown?: (event: KeyboardEvent) => void;
|
|
164
|
-
/** Content of an option of the tree; the search results, the selection and the tags show the label text */
|
|
165
151
|
label?: Snippet<[CascaderLabelSnippetProps]>;
|
|
166
|
-
/** The selection in single mode */
|
|
167
152
|
display?: Snippet<[CascaderDisplaySnippetProps]>;
|
|
168
|
-
/** Replaces each tag in multiple mode */
|
|
169
153
|
tag?: Snippet<[CascaderTagSnippetProps]>;
|
|
170
|
-
/** Replaces a row of the search results */
|
|
171
154
|
filterItem?: Snippet<[CascaderFilterItemSnippetProps]>;
|
|
172
|
-
/** Replaces the trigger content */
|
|
173
155
|
trigger?: Snippet<[CascaderTriggerSnippetProps]>;
|
|
174
156
|
expandIcon?: Snippet;
|
|
175
157
|
/** `null` hides the arrow */
|
|
176
158
|
arrowIcon?: Snippet | null;
|
|
177
159
|
clearIcon?: Snippet;
|
|
178
|
-
/** `null` hides the empty state */
|
|
179
160
|
emptyContent?: Snippet | null;
|
|
180
161
|
prefix?: Snippet;
|
|
181
162
|
suffix?: Snippet;
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
import { Spin } from '../spin/index.js';
|
|
12
12
|
import type { CascaderData, CascaderEntity, CascaderFilterItemSnippetProps, CascaderLabelSnippetProps, CascaderVirtualize } from './interface.js';
|
|
13
13
|
|
|
14
|
-
/** The tree or the search results of a Cascader; not a public component */
|
|
15
14
|
interface SearchData extends BasicData {
|
|
16
15
|
data: CascaderData;
|
|
17
16
|
pathData?: CascaderData[];
|
|
@@ -25,7 +24,6 @@
|
|
|
25
24
|
checkedKeys: Set<string>;
|
|
26
25
|
halfCheckedKeys: Set<string>;
|
|
27
26
|
showNext: 'click' | 'hover';
|
|
28
|
-
/** The search results, a listbox, rather than the tree */
|
|
29
27
|
searchable: boolean;
|
|
30
28
|
keyword: string;
|
|
31
29
|
/** A node without isLeaf is a branch while loadData is set */
|
|
@@ -36,10 +34,8 @@
|
|
|
36
34
|
virtualize?: CascaderVirtualize;
|
|
37
35
|
/** Id of the tree, or of the listbox of search results; the combobox's aria-controls points at it */
|
|
38
36
|
id: string;
|
|
39
|
-
/** The popup's name, the same as the combobox's */
|
|
40
37
|
ariaLabel?: string;
|
|
41
38
|
ariaLabelledby?: string;
|
|
42
|
-
/** The option the arrow keys are on, pointed at by the combobox's aria-activedescendant */
|
|
43
39
|
keyboardKey: string | null;
|
|
44
40
|
optionId: (key: string) => string;
|
|
45
41
|
label?: Snippet<[CascaderLabelSnippetProps]>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import { type BasicData } from '@fibrae/semi-foundation/cascader/foundation';
|
|
3
3
|
import type { CascaderData, CascaderEntity, CascaderFilterItemSnippetProps, CascaderLabelSnippetProps, CascaderVirtualize } from './interface.js';
|
|
4
|
-
/** The tree or the search results of a Cascader; not a public component */
|
|
5
4
|
interface SearchData extends BasicData {
|
|
6
5
|
data: CascaderData;
|
|
7
6
|
pathData?: CascaderData[];
|
|
@@ -14,7 +13,6 @@ interface ItemProps {
|
|
|
14
13
|
checkedKeys: Set<string>;
|
|
15
14
|
halfCheckedKeys: Set<string>;
|
|
16
15
|
showNext: 'click' | 'hover';
|
|
17
|
-
/** The search results, a listbox, rather than the tree */
|
|
18
16
|
searchable: boolean;
|
|
19
17
|
keyword: string;
|
|
20
18
|
/** A node without isLeaf is a branch while loadData is set */
|
|
@@ -25,10 +23,8 @@ interface ItemProps {
|
|
|
25
23
|
virtualize?: CascaderVirtualize;
|
|
26
24
|
/** Id of the tree, or of the listbox of search results; the combobox's aria-controls points at it */
|
|
27
25
|
id: string;
|
|
28
|
-
/** The popup's name, the same as the combobox's */
|
|
29
26
|
ariaLabel?: string;
|
|
30
27
|
ariaLabelledby?: string;
|
|
31
|
-
/** The option the arrow keys are on, pointed at by the combobox's aria-activedescendant */
|
|
32
28
|
keyboardKey: string | null;
|
|
33
29
|
optionId: (key: string) => string;
|
|
34
30
|
label?: Snippet<[CascaderLabelSnippetProps]>;
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
...rest
|
|
34
34
|
}: CheckboxGroupProps = $props();
|
|
35
35
|
|
|
36
|
-
// One name per group, so form submission never mixes groups.
|
|
37
36
|
const uid = $props.id();
|
|
38
37
|
|
|
39
38
|
// role="group" supports none of these. aria-invalid and aria-errormessage go to each checkbox (the role supports
|
|
@@ -41,7 +40,6 @@
|
|
|
41
40
|
// Tooltip injects the rest for a dialog trigger, and tabindex would add a stray Tab stop.
|
|
42
41
|
const DROPPED_ATTRS = new Set(['aria-invalid', 'aria-errormessage', 'aria-required', 'aria-expanded', 'aria-haspopup', 'aria-controls', 'tabindex', 'tabIndex']);
|
|
43
42
|
|
|
44
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
45
43
|
const foundationProps: CheckboxGroupBaseProps = {
|
|
46
44
|
get value() {
|
|
47
45
|
return value;
|
|
@@ -55,7 +53,6 @@
|
|
|
55
53
|
(base) => ({
|
|
56
54
|
updateGroupValue: (next) => base.setState({ value: next }),
|
|
57
55
|
notifyChange: (next) => {
|
|
58
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
59
56
|
value = next;
|
|
60
57
|
onChange?.(next);
|
|
61
58
|
},
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
let input = $state<HTMLInputElement>();
|
|
44
44
|
let root = $state<HTMLSpanElement>();
|
|
45
45
|
|
|
46
|
-
// $bindable needs destructuring, so the foundation reads the props through getters
|
|
47
46
|
const foundationProps: BaseCheckboxProps = {
|
|
48
47
|
get checked() {
|
|
49
48
|
return checked;
|
|
@@ -63,7 +62,6 @@
|
|
|
63
62
|
(base) => ({
|
|
64
63
|
setChecked: (next) => base.setState({ checked: next }),
|
|
65
64
|
notifyChange: (event) => {
|
|
66
|
-
// the bindable prop is the source of truth: bound, the write reaches the parent; unbound, it overrides locally
|
|
67
65
|
checked = event.target.checked;
|
|
68
66
|
onChange?.(event as CheckboxEvent);
|
|
69
67
|
},
|
|
@@ -107,8 +105,6 @@
|
|
|
107
105
|
const labelledby = $derived(joinIds(rest['aria-labelledby'], children ? addonDomId : undefined));
|
|
108
106
|
const tooltip = $derived(bindTrigger());
|
|
109
107
|
const describedby = $derived(joinIds(rest['aria-describedby'], extra ? extraDomId : undefined, tooltip?.['aria-describedby']));
|
|
110
|
-
|
|
111
|
-
// aria-*, id, tabindex, autofocus and focus listeners name and focus the input, the only focus target
|
|
112
108
|
const attrs = $derived(splitControlAttrs(rest, isNativeInputKey));
|
|
113
109
|
|
|
114
110
|
// The root is a span rather than a label so that text clicks and box clicks share this one handler (gitlab #364).
|
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;
|