@woodger/antd 0.1.1 → 0.1.2
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/affix/Affix.svelte +5 -2
- package/dist/alert/Alert.svelte +5 -2
- package/dist/anchor/Anchor.svelte +5 -2
- package/dist/auto-complete/AutoComplete.svelte +3 -2
- package/dist/avatar/Avatar.svelte +3 -2
- package/dist/avatar/AvatarGroup.svelte +3 -1
- package/dist/avatar/avatar.component.d.ts +7 -0
- package/dist/avatar/avatar.component.js +4 -0
- package/dist/badge/Badge.svelte +3 -2
- package/dist/badge/BadgeRibbon.svelte +3 -2
- package/dist/badge/badge.component.d.ts +7 -0
- package/dist/badge/badge.component.js +4 -0
- package/dist/border-beam/BorderBeam.svelte +5 -3
- package/dist/breadcrumb/Breadcrumb.svelte +5 -2
- package/dist/button/Button.svelte +7 -4
- package/dist/calendar/CalendarCore.svelte +3 -1
- package/dist/calendar/calendar.component.d.ts +7 -0
- package/dist/calendar/calendar.component.js +4 -0
- package/dist/card/Card.svelte +6 -3
- package/dist/card/card.component.d.ts +9 -0
- package/dist/card/card.component.js +5 -0
- package/dist/carousel/Carousel.svelte +6 -3
- package/dist/cascader/CascaderCore.svelte +8 -2
- package/dist/cascader/cascader.component.d.ts +11 -0
- package/dist/cascader/cascader.component.js +9 -0
- package/dist/cascader/cascader.types.d.ts +8 -0
- package/dist/checkbox/Checkbox.svelte +9 -4
- package/dist/checkbox/CheckboxGroup.svelte +6 -3
- package/dist/checkbox/checkbox-group.types.d.ts +2 -0
- package/dist/checkbox/checkbox.component.d.ts +7 -0
- package/dist/checkbox/checkbox.component.js +4 -0
- package/dist/collapse/Collapse.svelte +5 -2
- package/dist/collapse/collapse.engine.d.ts +1 -1
- package/dist/color-picker/ColorPicker.svelte +6 -3
- package/dist/color-picker/ColorPickerPresets.svelte +5 -3
- package/dist/component-refs.types.d.ts +45 -0
- package/dist/component-refs.types.js +1 -0
- package/dist/component.types.d.ts +13 -0
- package/dist/component.types.js +1 -0
- package/dist/config-provider/ConfigProvider.svelte +18 -6
- package/dist/config-provider/ConfigProvider.svelte.d.ts +2 -0
- package/dist/config-provider/config-context.d.ts +7 -0
- package/dist/config-provider/config-context.js +1 -0
- package/dist/config-provider/config-provider.component.d.ts +6 -0
- package/dist/config-provider/config-provider.component.js +10 -1
- package/dist/descriptions/Descriptions.svelte +6 -4
- package/dist/dialog/dialog-container.model.svelte.d.ts +1 -1
- package/dist/dialog/dialog-container.model.svelte.js +14 -2
- package/dist/dialog/dialog-focus.dom.d.ts +3 -1
- package/dist/dialog/dialog-focus.dom.js +8 -7
- package/dist/divider/Divider.svelte +5 -2
- package/dist/drawer/Drawer.svelte +3 -2
- package/dist/dropdown/Dropdown.svelte +9 -5
- package/dist/empty/Empty.svelte +5 -2
- package/dist/flex/Flex.svelte +5 -2
- package/dist/float-button/FloatButton.svelte +6 -3
- package/dist/float-button/FloatButtonGroup.svelte +6 -3
- package/dist/float-button/float-button.component.d.ts +9 -0
- package/dist/float-button/float-button.component.js +5 -0
- package/dist/form/Form.svelte +237 -42
- package/dist/form/Form.svelte.d.ts +4 -4
- package/dist/form/FormErrorList.svelte +19 -69
- package/dist/form/FormItem.svelte +271 -62
- package/dist/form/FormItem.svelte.d.ts +31 -5
- package/dist/form/FormItemControlBinding.svelte +68 -0
- package/dist/form/FormItemControlBinding.svelte.d.ts +10 -0
- package/dist/form/FormItemMessages.svelte +142 -0
- package/dist/form/FormItemMessages.svelte.d.ts +23 -0
- package/dist/form/FormList.svelte +49 -4
- package/dist/form/FormMessageMotion.svelte +133 -0
- package/dist/form/FormMessageMotion.svelte.d.ts +18 -0
- package/dist/form/FormProvider.svelte +9 -0
- package/dist/form/FormProvider.svelte.d.ts +4 -0
- package/dist/form/form-context.d.ts +24 -6
- package/dist/form/form-context.js +18 -0
- package/dist/form/form-control.engine.d.ts +2 -0
- package/dist/form/form-control.engine.js +13 -0
- package/dist/form/form-error-list-state.svelte.d.ts +21 -0
- package/dist/form/form-error-list-state.svelte.js +77 -0
- package/dist/form/form-error-list.engine.js +3 -1
- package/dist/form/form-error-list.types.d.ts +3 -2
- package/dist/form/form-field.dom.js +27 -4
- package/dist/form/form-internal.d.ts +32 -8
- package/dist/form/form-internal.js +2 -0
- package/dist/form/form-item-status.d.ts +2 -1
- package/dist/form/form-item-status.js +3 -1
- package/dist/form/form-list-context.d.ts +4 -0
- package/dist/form/form-list-context.js +3 -0
- package/dist/form/form-list.types.d.ts +5 -2
- package/dist/form/form-no-style.engine.d.ts +6 -5
- package/dist/form/form-provider-context.d.ts +13 -0
- package/dist/form/form-provider-context.js +74 -0
- package/dist/form/form-ref.engine.d.ts +5 -0
- package/dist/form/form-ref.engine.js +43 -0
- package/dist/form/form-store.engine.d.ts +3 -1
- package/dist/form/form-store.engine.js +25 -3
- package/dist/form/form-update.engine.d.ts +29 -0
- package/dist/form/form-update.engine.js +40 -0
- package/dist/form/form-watch.svelte.d.ts +25 -0
- package/dist/form/form-watch.svelte.js +56 -0
- package/dist/form/form.component.d.ts +28 -0
- package/dist/form/form.component.js +25 -0
- package/dist/form/form.model.svelte.d.ts +25 -3
- package/dist/form/form.model.svelte.js +728 -179
- package/dist/form/form.types.d.ts +117 -11
- package/dist/form/validation-message.engine.d.ts +17 -3
- package/dist/form/validation-message.engine.js +39 -2
- package/dist/form/validation-messages.types.d.ts +11 -0
- package/dist/form/validation-nested.engine.d.ts +5 -4
- package/dist/form/validation.engine.d.ts +8 -6
- package/dist/form/validation.engine.js +2 -2
- package/dist/grid/Col.svelte +4 -6
- package/dist/grid/Row.svelte +7 -4
- package/dist/grid/grid.svelte.d.ts +7 -0
- package/dist/grid/grid.svelte.js +30 -0
- package/dist/image/Image.svelte +147 -58
- package/dist/image/ImagePreview.svelte +280 -137
- package/dist/image/ImagePreview.svelte.d.ts +10 -2
- package/dist/image/ImagePreviewGroup.svelte +40 -7
- package/dist/image/ImagePreviewIcons.svelte +18 -0
- package/dist/image/ImagePreviewIcons.svelte.d.ts +29 -0
- package/dist/image/ImageProgress.svelte +84 -0
- package/dist/image/ImageProgress.svelte.d.ts +13 -0
- package/dist/image/image-group-context.d.ts +2 -1
- package/dist/image/image-prefix.engine.js +4 -0
- package/dist/image/image-preview-group.types.d.ts +8 -8
- package/dist/image/image-preview-motion.dom.d.ts +16 -0
- package/dist/image/image-preview-motion.dom.js +72 -0
- package/dist/image/image-semantic.engine.d.ts +39 -0
- package/dist/image/image-semantic.engine.js +61 -0
- package/dist/image/image.component.d.ts +7 -0
- package/dist/image/image.component.js +4 -0
- package/dist/image/image.types.d.ts +84 -11
- package/dist/index.d.ts +51 -41
- package/dist/index.js +24 -19
- package/dist/input/Input.svelte +6 -3
- package/dist/input/InputOTP.svelte +5 -2
- package/dist/input/InputPassword.svelte +5 -1
- package/dist/input/InputSearch.svelte +6 -3
- package/dist/input/TextArea.svelte +6 -3
- package/dist/input/input.component.d.ts +13 -0
- package/dist/input/input.component.js +12 -0
- package/dist/input-number/InputNumberControl.svelte +5 -2
- package/dist/layout/Layout.svelte +5 -2
- package/dist/layout/LayoutPart.svelte +7 -2
- package/dist/layout/LayoutSider.svelte +5 -2
- package/dist/layout/layout.component.d.ts +13 -0
- package/dist/layout/layout.component.js +7 -0
- package/dist/listy/Listy.svelte +3 -2
- package/dist/masonry/Masonry.svelte +5 -3
- package/dist/mentions/Mentions.svelte +3 -2
- package/dist/mentions/mentions.component.d.ts +7 -0
- package/dist/mentions/mentions.component.js +4 -0
- package/dist/menu/Menu.svelte +7 -2
- package/dist/message/MessageHolder.svelte +3 -1
- package/dist/modal/Modal.svelte +112 -14
- package/dist/modal/ModalFooterScope.svelte +15 -0
- package/dist/modal/ModalFooterScope.svelte.d.ts +7 -0
- package/dist/modal/modal-layout.engine.d.ts +1 -1
- package/dist/modal/modal-layout.engine.js +20 -3
- package/dist/modal/modal-motion.dom.d.ts +1 -0
- package/dist/modal/modal-motion.dom.js +21 -5
- package/dist/modal/modal-named-motion.dom.d.ts +1 -1
- package/dist/modal/modal-named-motion.dom.js +1 -2
- package/dist/modal/modal-semantic.engine.d.ts +1 -1
- package/dist/modal/modal.types.d.ts +3 -1
- package/dist/notification/NotificationHolder.svelte +3 -1
- package/dist/pagination/Pagination.svelte +3 -2
- package/dist/picker/DatePicker.svelte.d.ts +1 -1
- package/dist/picker/RangePickerCore.svelte +3 -1
- package/dist/picker/SinglePicker.svelte +3 -1
- package/dist/picker/picker-popup.model.svelte.d.ts +3 -1
- package/dist/picker/time-picker.component.d.ts +4 -1
- package/dist/picker/time-picker.component.js +3 -1
- package/dist/popconfirm/Popconfirm.svelte +6 -1
- package/dist/popconfirm/popconfirm.types.d.ts +2 -0
- package/dist/popover/Popover.svelte +31 -13
- package/dist/popover/popover.types.d.ts +2 -0
- package/dist/popup/popup-container.model.svelte.d.ts +4 -1
- package/dist/popup/popup-container.model.svelte.js +7 -2
- package/dist/popup/popup-geometry.dom.d.ts +8 -0
- package/dist/popup/popup-geometry.dom.js +29 -0
- package/dist/popup/popup.dom.d.ts +3 -0
- package/dist/popup/popup.dom.js +3 -1
- package/dist/progress/Progress.svelte +5 -2
- package/dist/progress/progress-circle.engine.d.ts +1 -1
- package/dist/qr-code/QRCode.svelte +5 -3
- package/dist/radio/Radio.svelte +9 -4
- package/dist/radio/RadioGroup.svelte +6 -3
- package/dist/radio/radio.component.d.ts +9 -0
- package/dist/radio/radio.component.js +5 -0
- package/dist/rate/Rate.svelte +3 -2
- package/dist/result/Result.svelte +5 -2
- package/dist/segmented/Segmented.svelte +5 -2
- package/dist/select/Select.svelte +3 -2
- package/dist/select/select-style.engine.d.ts +1 -1
- package/dist/skeleton/Skeleton.svelte +5 -2
- package/dist/skeleton/SkeletonElement.svelte +5 -2
- package/dist/slider/SliderRange.svelte +9 -41
- package/dist/slider/SliderSingle.svelte +35 -30
- package/dist/slider/SliderTooltip.svelte +224 -0
- package/dist/slider/SliderTooltip.svelte.d.ts +17 -0
- package/dist/space/Space.svelte +6 -3
- package/dist/space/SpaceAddon.svelte +6 -3
- package/dist/space/SpaceCompact.svelte +5 -2
- package/dist/space/space.component.d.ts +9 -0
- package/dist/space/space.component.js +5 -0
- package/dist/spin/Spin.svelte +5 -2
- package/dist/splitter/Splitter.svelte +6 -3
- package/dist/splitter/SplitterArrow.svelte.d.ts +1 -1
- package/dist/statistic/Statistic.svelte +5 -3
- package/dist/statistic/statistic.component.d.ts +7 -0
- package/dist/statistic/statistic.component.js +4 -0
- package/dist/steps/Steps.svelte +5 -2
- package/dist/styles.css +1 -0
- package/dist/styles.css.d.ts +1 -0
- package/dist/switch/Switch.svelte +5 -2
- package/dist/table/Table.svelte +3 -2
- package/dist/table/table-cell.engine.d.ts +6 -6
- package/dist/table/table.types.d.ts +2 -0
- package/dist/tabs/Tabs.svelte +6 -4
- package/dist/tag/CheckableTag.svelte +3 -1
- package/dist/tag/CheckableTagGroup.svelte +3 -1
- package/dist/tag/Tag.svelte +3 -1
- package/dist/tag/tag.component.d.ts +10 -0
- package/dist/tag/tag.component.js +5 -0
- package/dist/theme/theme-context.svelte.d.ts +2 -0
- package/dist/theme/theme-context.svelte.js +6 -1
- package/dist/timeline/Timeline.svelte +5 -2
- package/dist/tooltip/Tooltip.svelte +16 -7
- package/dist/tooltip/TooltipPopup.svelte +22 -6
- package/dist/tooltip/tooltip-popup.types.d.ts +6 -0
- package/dist/tooltip/tooltip.types.d.ts +16 -0
- package/dist/tour/Tour.svelte +3 -1
- package/dist/transfer/Transfer.svelte +3 -1
- package/dist/transfer/TransferCheckbox.svelte +3 -1
- package/dist/transfer/TransferPagination.svelte +3 -1
- package/dist/tree/Tree.svelte +3 -2
- package/dist/tree/tree.component.d.ts +10 -0
- package/dist/tree/tree.component.js +5 -0
- package/dist/tree-select/TreeSelectControl.svelte +5 -4
- package/dist/types.d.ts +2 -2
- package/dist/typography/TypographyEditable.svelte +5 -2
- package/dist/typography/TypographyElement.svelte +6 -3
- package/dist/typography/TypographyTooltip.svelte +19 -8
- package/dist/typography/typography.component.d.ts +13 -0
- package/dist/typography/typography.component.js +7 -0
- package/dist/upload/Upload.svelte +44 -4
- package/dist/upload/Upload.svelte.d.ts +1 -1
- package/dist/upload/UploadDragger.svelte +3 -2
- package/dist/upload/UploadDragger.svelte.d.ts +4 -4
- package/dist/upload/UploadList.svelte.d.ts +1 -1
- package/dist/upload/UploadListItem.svelte +52 -11
- package/dist/upload/upload.component.d.ts +9 -0
- package/dist/upload/upload.component.js +5 -0
- package/dist/upload/upload.engine.d.ts +8 -2
- package/dist/upload/upload.engine.js +80 -4
- package/dist/upload/upload.types.d.ts +2 -1
- package/dist/vendor/compute-scroll-into-view.d.ts +3 -1
- package/dist/vendor/compute-scroll-into-view.js +3 -2
- package/dist/vendor/dropdown-motion.css +105 -0
- package/dist/vendor/image-prefix.css.js +3 -3
- package/dist/vendor/image.css +16 -2
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/package.json +15 -4
|
@@ -3,7 +3,7 @@ import type { AriaAttributes, AriaRole, HTMLAttributes } from 'svelte/elements';
|
|
|
3
3
|
import type { ButtonElementProps, ButtonType } from '../button/button.types';
|
|
4
4
|
import type { DrawerFocusableConfig, DrawerMask, DrawerMaskConfig } from '../drawer/drawer.types';
|
|
5
5
|
import type { GridResponsive } from '../grid/grid.types';
|
|
6
|
-
import type { GetContainer } from '../types';
|
|
6
|
+
import type { GetContainer, Locale } from '../types';
|
|
7
7
|
export type ModalContent = string | number | boolean | null | Snippet;
|
|
8
8
|
export type ModalMask = DrawerMask;
|
|
9
9
|
export type ModalMaskConfig = DrawerMaskConfig;
|
|
@@ -11,6 +11,8 @@ export type ModalFocusableConfig = DrawerFocusableConfig;
|
|
|
11
11
|
export type ModalWidth = number | string | GridResponsive<number | string>;
|
|
12
12
|
export type ModalButtonProps = Omit<ButtonElementProps<string | undefined>, 'nativeElement'>;
|
|
13
13
|
export type ModalOkType = ButtonType | 'danger';
|
|
14
|
+
/** Complete set of Modal action labels in the Svelte locale dictionary. */
|
|
15
|
+
export type ModalLocale = Required<Pick<Locale, 'okText' | 'cancelText' | 'justOkText'>>;
|
|
14
16
|
export type ModalSemanticName = 'root' | 'wrapper' | 'mask' | 'container' | 'close' | 'header' | 'title' | 'body' | 'footer';
|
|
15
17
|
export type ModalSemanticSlots = Partial<Record<ModalSemanticName, string>>;
|
|
16
18
|
/** Map of classes or CSS-declarations and version with current props. */
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// One surface and one timer owner serve all placements. Changing the portal target recreates
|
|
3
3
|
// lists while retaining the outer instance and its queue.
|
|
4
4
|
import { untrack } from 'svelte';
|
|
5
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
5
6
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
6
7
|
import { getNotificationPrefixCss } from './notification-prefix.engine';
|
|
7
8
|
import NotificationList from './NotificationList.svelte';
|
|
@@ -29,7 +30,8 @@
|
|
|
29
30
|
let options = $derived({ ...runtime.options, ...overrides });
|
|
30
31
|
let componentPrefix = $derived(config.getPrefixCls('notification', options.prefixCls));
|
|
31
32
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
32
|
-
|
|
33
|
+
const runtimeStyles = useRuntimeStyles();
|
|
34
|
+
let prefixCss = $derived(runtimeStyles && getNotificationPrefixCss(componentPrefix, rootPrefix));
|
|
33
35
|
const componentTheme = useComponentTheme('Notification');
|
|
34
36
|
let anchor = $state<HTMLSpanElement>();
|
|
35
37
|
let surface = $state<HTMLDivElement>();
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { useConfig } from '../config-provider/config-context';
|
|
10
10
|
import { useVariant } from '../config-provider/variant.svelte';
|
|
11
11
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
12
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
12
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
13
13
|
import { provideFormField, useFormField } from '../form/form-context';
|
|
14
14
|
import { createBreakpoint } from '../grid/grid-breakpoint.model.svelte.js';
|
|
15
15
|
import { getGridMediaQueries } from '../grid/grid.engine';
|
|
@@ -73,7 +73,8 @@
|
|
|
73
73
|
const config = useConfig();
|
|
74
74
|
let prefixCls = $derived(config.getPrefixCls('pagination', customizePrefixCls));
|
|
75
75
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
76
|
-
|
|
76
|
+
const runtimeStyles = useRuntimeStyles();
|
|
77
|
+
let prefixCss = $derived(runtimeStyles && getPaginationPrefixCss(prefixCls, rootPrefix));
|
|
77
78
|
const variantContext = useVariant('input');
|
|
78
79
|
const componentTheme = useComponentTheme('Pagination');
|
|
79
80
|
const designToken = useDesignTokenContext();
|
|
@@ -16,7 +16,7 @@ declare function $$render<Multiple extends boolean, DateType extends object>():
|
|
|
16
16
|
}) => void) | undefined : ((value: DateType | null, dateString: string, info: {
|
|
17
17
|
source: "date" | "time";
|
|
18
18
|
}) => void) | undefined) | undefined;
|
|
19
|
-
} & Pick<DatePickerMultipleProps<DateType>, "order" | "
|
|
19
|
+
} & Pick<DatePickerMultipleProps<DateType>, "order" | "removeIcon" | "maxTagCount" | "tagRender"> & {
|
|
20
20
|
dateOperations: PickerDateOperations<DateType>;
|
|
21
21
|
defaultPicker?: DatePickerPicker;
|
|
22
22
|
};
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
import { datePickerEnUS } from './date-picker.locale';
|
|
24
24
|
import { useConfig } from '../config-provider/config-context';
|
|
25
25
|
import { getPickerPrefixCss } from './picker-prefix.engine';
|
|
26
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
26
27
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
27
28
|
import { useVariant } from '../config-provider/variant.svelte';
|
|
28
29
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
@@ -163,7 +164,8 @@
|
|
|
163
164
|
const config = useConfig();
|
|
164
165
|
let prefix = $derived(config.getPrefixCls('picker', prefixCls));
|
|
165
166
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
166
|
-
|
|
167
|
+
const runtimeStyles = useRuntimeStyles();
|
|
168
|
+
let prefixCss = $derived(runtimeStyles && getPickerPrefixCss(prefix, rootPrefix));
|
|
167
169
|
const variantContext = useVariant('rangePicker', () => ({
|
|
168
170
|
variant
|
|
169
171
|
}));
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { datePickerEnUS } from './date-picker.locale';
|
|
20
20
|
import { useConfig } from '../config-provider/config-context';
|
|
21
21
|
import { getPickerPrefixCss } from './picker-prefix.engine';
|
|
22
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
22
23
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
23
24
|
import { useVariant } from '../config-provider/variant.svelte';
|
|
24
25
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
@@ -152,7 +153,8 @@
|
|
|
152
153
|
const config = useConfig();
|
|
153
154
|
let prefix = $derived(config.getPrefixCls('picker', prefixCls));
|
|
154
155
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
155
|
-
|
|
156
|
+
const runtimeStyles = useRuntimeStyles();
|
|
157
|
+
let prefixCss = $derived(runtimeStyles && getPickerPrefixCss(prefix, rootPrefix));
|
|
156
158
|
const dateVariant = useVariant('datePicker', () => ({ variant }));
|
|
157
159
|
const timeVariant = useVariant('timePicker', () => time ?? {});
|
|
158
160
|
const componentTheme = useComponentTheme('DatePicker');
|
|
@@ -22,7 +22,9 @@ export declare function preservePickerPanelFocus(read: () => PickerPanelFocusOpt
|
|
|
22
22
|
};
|
|
23
23
|
/** rc-picker recreates the panel if the portal target changes. Changing the callback preserves it. */
|
|
24
24
|
export declare function createPickerPopup(getOptions: () => PickerPopupContainerOptions): {
|
|
25
|
-
portal: (node: HTMLElement) => (() => void) | undefined
|
|
25
|
+
portal: ((node: HTMLElement) => (() => void) | undefined) & {
|
|
26
|
+
getTarget: () => HTMLElement | ShadowRoot | undefined;
|
|
27
|
+
};
|
|
26
28
|
readonly target: HTMLElement | ShadowRoot | undefined;
|
|
27
29
|
};
|
|
28
30
|
/** When replacing the contents, leaves the focus in the panel until the old button is removed. */
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Component, ComponentConstructorOptions, SvelteComponent } from 'svelte';
|
|
2
2
|
import TimePickerControl from './TimePicker.svelte';
|
|
3
|
+
import TimeRangePicker from './time-range-picker.component';
|
|
3
4
|
import { type PickerDateOperations } from './picker-date-operations.engine';
|
|
4
5
|
import type { Dayjs } from 'dayjs';
|
|
5
6
|
import type { DatePickerMode } from './date-picker.types';
|
|
@@ -31,5 +32,7 @@ export interface GeneratedTimeSelection<DateType extends object> {
|
|
|
31
32
|
export type GeneratedTimePickerComponent<DateType extends object> = GeneratedTimeSelection<DateType> & TimePickerComponent<DateType>;
|
|
32
33
|
/** Ties the time adapter. The last overload preserves the usual ComponentProps. */
|
|
33
34
|
export declare function createTimePickerComponent<DateType extends object>(dateOperations: PickerDateOperations<DateType>, standaloneTime?: boolean): GeneratedTimePickerComponent<DateType>;
|
|
34
|
-
declare const TimePicker: TimePickerComponent<Dayjs
|
|
35
|
+
declare const TimePicker: TimePickerComponent<Dayjs> & {
|
|
36
|
+
RangePicker: typeof TimeRangePicker;
|
|
37
|
+
};
|
|
35
38
|
export default TimePicker;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import TimePickerControl from './TimePicker.svelte';
|
|
2
|
+
import TimeRangePicker from './time-range-picker.component';
|
|
2
3
|
import { pickerAdapterProps } from './picker-adapter-props.engine';
|
|
3
4
|
import { dayjsPickerDates } from './picker-date-operations.engine';
|
|
4
5
|
/** Ties the time adapter. The last overload preserves the usual ComponentProps. */
|
|
@@ -10,5 +11,6 @@ export function createTimePickerComponent(dateOperations, standaloneTime = false
|
|
|
10
11
|
// Svelte uses new signatures to check the template. Runtime calls as a function.
|
|
11
12
|
return render;
|
|
12
13
|
}
|
|
13
|
-
const
|
|
14
|
+
const TimePickerRoot = createTimePickerComponent(dayjsPickerDates, true);
|
|
15
|
+
const TimePicker = Object.assign(TimePickerRoot, { RangePicker: TimeRangePicker });
|
|
14
16
|
export default TimePicker;
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { getOverlaySemantics } from '../popup/overlay-semantic.engine';
|
|
12
12
|
import { getOverlayPrefixCss } from '../popup/overlay-prefix.engine';
|
|
13
13
|
import prefixTemplate from '../vendor/popconfirm-prefix.css.js';
|
|
14
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
14
15
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
15
16
|
import type { PopconfirmActionOptions, PopconfirmProps, PopconfirmSemanticProps } from './popconfirm.types';
|
|
16
17
|
import type { PopoverRef } from '../popover/popover.types';
|
|
@@ -65,7 +66,10 @@
|
|
|
65
66
|
|
|
66
67
|
const config = useConfig();
|
|
67
68
|
let prefix = $derived(config.getPrefixCls('popconfirm', prefixCls));
|
|
68
|
-
|
|
69
|
+
const runtimeStyles = useRuntimeStyles();
|
|
70
|
+
let prefixCss = $derived(
|
|
71
|
+
runtimeStyles && getOverlayPrefixCss('popconfirm', prefix, prefixTemplate)
|
|
72
|
+
);
|
|
69
73
|
let resolvedTrigger = $derived(trigger || config.popconfirm?.trigger || 'click');
|
|
70
74
|
let enterDelay = $derived(mouseEnterDelay ?? config.popconfirm?.mouseEnterDelay ?? 0.1);
|
|
71
75
|
let leaveDelay = $derived(mouseLeaveDelay ?? config.popconfirm?.mouseLeaveDelay ?? 0.1);
|
|
@@ -304,6 +308,7 @@
|
|
|
304
308
|
showAction={props.showAction} hideAction={props.hideAction}
|
|
305
309
|
motion={props.motion} afterOpenChange={props.afterOpenChange}
|
|
306
310
|
focusDelay={props.focusDelay} blurDelay={props.blurDelay}
|
|
311
|
+
alignPoint={props.alignPoint}
|
|
307
312
|
align={props.align} builtinPlacements={props.builtinPlacements} onPopupAlign={props.onPopupAlign}
|
|
308
313
|
id={props.id} forceRender={props.forceRender} fresh={props.fresh} zIndex={props.zIndex}
|
|
309
314
|
{destroyOnHidden}
|
|
@@ -87,6 +87,8 @@ export interface PopconfirmProps<OkHref extends string | undefined = undefined,
|
|
|
87
87
|
cancelButtonProps?: PopconfirmButtonProps<CancelHref>;
|
|
88
88
|
/** @defaultValue 'top' */
|
|
89
89
|
placement?: PopoverPlacement;
|
|
90
|
+
/** Forwards pointer alignment to the outer Popover. */
|
|
91
|
+
alignPoint?: TooltipProps['alignPoint'];
|
|
90
92
|
/** Forwarded to Popover as an override for the selected placements entry. */
|
|
91
93
|
align?: TooltipProps['align'];
|
|
92
94
|
/** Replaces the entire placements Popover map, including an empty object. */
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import NoCompactStyle from '../space/NoCompactStyle.svelte';
|
|
5
5
|
import { getAllContexts, onDestroy, onMount, untrack } from 'svelte';
|
|
6
6
|
import { useConfig } from '../config-provider/config-context';
|
|
7
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
7
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
8
8
|
import { provideZIndex, useZIndex } from '../popup/z-index-context.svelte';
|
|
9
9
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
10
10
|
import { getOverlaySemantics } from '../popup/overlay-semantic.engine';
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
import { serializeInlineStyleLayers } from '../style/inline-style.engine';
|
|
20
20
|
import { consumePopconfirmTheme } from './popover-theme-context';
|
|
21
21
|
import { connectPopup, getPopupActiveElement, type PopupConnection } from '../popup/popup.dom';
|
|
22
|
+
import {
|
|
23
|
+
getPopupEventPoint, watchPopupViewport, type PopupPoint
|
|
24
|
+
} from '../popup/popup-geometry.dom';
|
|
22
25
|
import { createPopupContainer } from '../popup/popup-container.model.svelte.js';
|
|
23
26
|
import { connectPopoverTrigger, focusPopover } from './popover.dom';
|
|
24
27
|
import { connectTooltipOpenClass } from '../tooltip/tooltip.dom';
|
|
@@ -82,7 +85,8 @@
|
|
|
82
85
|
|
|
83
86
|
const config = useConfig();
|
|
84
87
|
let prefix = $derived(config.getPrefixCls('popover', prefixCls));
|
|
85
|
-
|
|
88
|
+
const runtimeStyles = useRuntimeStyles();
|
|
89
|
+
let prefixCss = $derived(runtimeStyles && getOverlayPrefixCss('popover', prefix, prefixTemplate));
|
|
86
90
|
let resolvedOpenClassName = $derived(openClassName || `${prefix}-open`);
|
|
87
91
|
const designTokens = useDesignTokenContext();
|
|
88
92
|
const layer = useZIndex('container', () => zIndex);
|
|
@@ -101,6 +105,7 @@
|
|
|
101
105
|
let leaveDelay = $derived(mouseLeaveDelay ?? config.popover?.mouseLeaveDelay ?? 0.1);
|
|
102
106
|
let actionOverrides = $derived(props.showAction !== undefined || props.hideAction !== undefined);
|
|
103
107
|
let actions = $derived(getTooltipActions(resolvedTrigger, props.showAction, props.hideAction));
|
|
108
|
+
const clickToHide = $derived(actions.hide.has('click') || actions.hide.has('contextMenu'));
|
|
104
109
|
let sourceTouch = $derived(actionOverrides || Boolean(config.popover)
|
|
105
110
|
|| isPopconfirm && Boolean(config.popconfirm));
|
|
106
111
|
let sourceTrigger = $derived(Boolean(config.popover) || resolvedTrigger.length === 0
|
|
@@ -165,6 +170,7 @@
|
|
|
165
170
|
let popupHovered = false;
|
|
166
171
|
let popupFocused = false;
|
|
167
172
|
let clicked = false;
|
|
173
|
+
let anchorPoint = $state.raw<PopupPoint>();
|
|
168
174
|
let dismissed = false;
|
|
169
175
|
let touched = false;
|
|
170
176
|
let closing = false;
|
|
@@ -172,11 +178,12 @@
|
|
|
172
178
|
let resumeFocus: HTMLElement | undefined;
|
|
173
179
|
let active = true;
|
|
174
180
|
let mounted = $state(false);
|
|
181
|
+
const pointAlignment = $derived(Boolean(props.alignPoint && !grouped));
|
|
175
182
|
let explicitGeometry = $derived(Boolean(props.align || props.builtinPlacements));
|
|
176
|
-
let customPosition = $derived(explicitGeometry || Boolean(props.onPopupAlign));
|
|
183
|
+
let customPosition = $derived(pointAlignment || explicitGeometry || Boolean(props.onPopupAlign));
|
|
177
184
|
let sourceGeometry = $derived(typeof arrow === 'object'
|
|
178
185
|
|| Boolean(config.popover) || isPopconfirm && Boolean(config.popconfirm)
|
|
179
|
-
|| typeof autoAdjustOverflow === 'object' || explicitGeometry);
|
|
186
|
+
|| typeof autoAdjustOverflow === 'object' || explicitGeometry || pointAlignment);
|
|
180
187
|
let sourcePlacement = $derived(sourceGeometry || Boolean(props.onPopupAlign));
|
|
181
188
|
let positionPlacements = $derived.by(() => {
|
|
182
189
|
if (props.builtinPlacements) {
|
|
@@ -198,8 +205,8 @@
|
|
|
198
205
|
if (!customPosition) {
|
|
199
206
|
return shown ? actualPlacement : placement;
|
|
200
207
|
}
|
|
201
|
-
|
|
202
|
-
|
|
208
|
+
const align = actualPosition?.sourceAlign;
|
|
209
|
+
return align ? getPopupPlacement(positionPlacements, align, pointAlignment) : undefined;
|
|
203
210
|
});
|
|
204
211
|
let arrowPositionStyle = $derived(customPosition && actualPosition ? getPopupArrowStyle({
|
|
205
212
|
align: actualPosition.sourceAlign,
|
|
@@ -441,6 +448,12 @@
|
|
|
441
448
|
if (active) restoreTriggerFocus(surface, anchor);
|
|
442
449
|
}
|
|
443
450
|
|
|
451
|
+
$effect(() => {
|
|
452
|
+
if (pointAlignment && visible && clickToHide && anchor && popup) {
|
|
453
|
+
return watchPopupViewport(anchor, popup, () => dismiss('trigger'), portal.getTarget());
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
|
|
444
457
|
$effect(() => {
|
|
445
458
|
const surface = popup;
|
|
446
459
|
const source = anchor;
|
|
@@ -458,6 +471,8 @@
|
|
|
458
471
|
get placement() {
|
|
459
472
|
return placement;
|
|
460
473
|
},
|
|
474
|
+
get alignPoint() { return pointAlignment; },
|
|
475
|
+
get anchorPoint() { return pointAlignment ? anchorPoint : undefined; },
|
|
461
476
|
get autoAdjustOverflow() {
|
|
462
477
|
return autoAdjustOverflow;
|
|
463
478
|
},
|
|
@@ -602,8 +617,10 @@
|
|
|
602
617
|
|
|
603
618
|
hovered = true;
|
|
604
619
|
dismissed = false;
|
|
605
|
-
if (actions.show.has('hover'))
|
|
620
|
+
if (actions.show.has('hover')) {
|
|
621
|
+
anchorPoint = getPopupEventPoint(event);
|
|
606
622
|
request(true, getTooltipDelay(enterDelay));
|
|
623
|
+
}
|
|
607
624
|
}
|
|
608
625
|
|
|
609
626
|
function handleLeave() {
|
|
@@ -665,17 +682,16 @@
|
|
|
665
682
|
|
|
666
683
|
function handleClick(event: MouseEvent) {
|
|
667
684
|
const show = actions.show.has('click');
|
|
668
|
-
|
|
669
|
-
if (event.defaultPrevented && !actionOverrides || !show && !hide
|
|
685
|
+
if (event.defaultPrevented && !actionOverrides || !show && !clickToHide
|
|
670
686
|
|| anchor?.matches(':disabled, [aria-disabled="true"]')) {
|
|
671
687
|
return;
|
|
672
688
|
}
|
|
673
689
|
|
|
674
690
|
if (actionOverrides) {
|
|
675
|
-
if (visible &&
|
|
691
|
+
if (visible && clickToHide) {
|
|
676
692
|
dismiss('trigger');
|
|
677
693
|
}
|
|
678
|
-
else if (!visible && show) showByClick();
|
|
694
|
+
else if (!visible && show) showByClick(event);
|
|
679
695
|
if (sourceTouch) touched = false;
|
|
680
696
|
return;
|
|
681
697
|
}
|
|
@@ -683,11 +699,12 @@
|
|
|
683
699
|
if (clicked || visible && (sourceTrigger || !wanted())) {
|
|
684
700
|
dismiss('trigger');
|
|
685
701
|
}
|
|
686
|
-
else if (show) showByClick();
|
|
702
|
+
else if (show) showByClick(event);
|
|
687
703
|
if (sourceTouch) touched = false;
|
|
688
704
|
}
|
|
689
705
|
|
|
690
|
-
function showByClick() {
|
|
706
|
+
function showByClick(event?: MouseEvent) {
|
|
707
|
+
if (event) anchorPoint = getPopupEventPoint(event);
|
|
691
708
|
clicked = true;
|
|
692
709
|
dismissed = false;
|
|
693
710
|
focusOnShow = !sourceTrigger;
|
|
@@ -705,6 +722,7 @@
|
|
|
705
722
|
dismiss('trigger');
|
|
706
723
|
}
|
|
707
724
|
else {
|
|
725
|
+
anchorPoint = getPopupEventPoint(event);
|
|
708
726
|
clicked = true;
|
|
709
727
|
dismissed = false;
|
|
710
728
|
request(true);
|
|
@@ -86,6 +86,8 @@ export interface PopoverProps {
|
|
|
86
86
|
blurDelay?: number;
|
|
87
87
|
/** @defaultValue 'top' */
|
|
88
88
|
placement?: PopoverPlacement;
|
|
89
|
+
/** Positions a separate popup at the click, context menu, or pointer-entry coordinates. */
|
|
90
|
+
alignPoint?: TooltipProps['alignPoint'];
|
|
89
91
|
/** Superimposed on top of the selected placements entry; nested overflow is replaced in its entirety. */
|
|
90
92
|
align?: TooltipProps['align'];
|
|
91
93
|
/** Replaces the entire automatically prepared map, including an empty object. */
|
|
@@ -7,5 +7,8 @@ interface PopupContainerOptions {
|
|
|
7
7
|
preserveVariables?: readonly string[];
|
|
8
8
|
}
|
|
9
9
|
/** Callback identity doesn't change the portal until the function returns the same DOM-container. */
|
|
10
|
-
export declare function createPopupContainer(getOptions: () => PopupContainerOptions): (node: HTMLElement) => (() => void) | undefined
|
|
10
|
+
export declare function createPopupContainer(getOptions: () => PopupContainerOptions): ((node: HTMLElement) => (() => void) | undefined) & {
|
|
11
|
+
/** Reads the resolved target without invoking the caller's container getter again. */
|
|
12
|
+
getTarget: () => HTMLElement | ShadowRoot | undefined;
|
|
13
|
+
};
|
|
11
14
|
export {};
|
|
@@ -24,7 +24,8 @@ export function createPopupContainer(getOptions) {
|
|
|
24
24
|
if (current)
|
|
25
25
|
queueMicrotask(() => current.syncTheme());
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
/** Moves the surface to the current portal target and releases it when the target changes. */
|
|
28
|
+
function attach(node) {
|
|
28
29
|
const target = container;
|
|
29
30
|
if (!target) {
|
|
30
31
|
return;
|
|
@@ -65,5 +66,9 @@ export function createPopupContainer(getOptions) {
|
|
|
65
66
|
connection = undefined;
|
|
66
67
|
};
|
|
67
68
|
});
|
|
68
|
-
}
|
|
69
|
+
}
|
|
70
|
+
return Object.assign(attach, {
|
|
71
|
+
/** Reads the resolved target without invoking the caller's container getter again. */
|
|
72
|
+
getTarget: () => container
|
|
73
|
+
});
|
|
69
74
|
}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { PopupArea } from './popup-position.engine';
|
|
2
|
+
export interface PopupPoint {
|
|
3
|
+
readonly x: number;
|
|
4
|
+
readonly y: number;
|
|
5
|
+
}
|
|
6
|
+
/** Captures viewport coordinates. Clicks without pointer coordinates use the trigger element. */
|
|
7
|
+
export declare function getPopupEventPoint(event: MouseEvent): PopupPoint | undefined;
|
|
2
8
|
/** Finds ancestors who limit the visible area or report scrolling. */
|
|
3
9
|
export declare function getPopupScrollers(element: Element, from?: HTMLElement | null): HTMLElement[];
|
|
10
|
+
/** Watches the viewport and the scroll containers of both ends of an open popup. */
|
|
11
|
+
export declare function watchPopupViewport(anchor: Element, popup: Element, onChange: () => void, target?: HTMLElement | ShadowRoot): (() => void) | undefined;
|
|
4
12
|
/** Crosses the area with the internal boundaries of scroll containers. */
|
|
5
13
|
export declare function clipPopupArea(initial: PopupArea, scrollers: readonly HTMLElement[]): {
|
|
6
14
|
left: number;
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/** Captures viewport coordinates. Clicks without pointer coordinates use the trigger element. */
|
|
2
|
+
export function getPopupEventPoint(event) {
|
|
3
|
+
if (event.type === 'click' && event.detail === 0 && event.clientX === 0 && event.clientY === 0) {
|
|
4
|
+
return undefined;
|
|
5
|
+
}
|
|
6
|
+
return { x: event.clientX, y: event.clientY };
|
|
7
|
+
}
|
|
1
8
|
/** Finds ancestors who limit the visible area or report scrolling. */
|
|
2
9
|
export function getPopupScrollers(element, from = element.parentElement) {
|
|
3
10
|
// Rule 2: DOM-measurements begin after connecting the popup to the window.
|
|
@@ -13,6 +20,28 @@ export function getPopupScrollers(element, from = element.parentElement) {
|
|
|
13
20
|
}
|
|
14
21
|
return nodes;
|
|
15
22
|
}
|
|
23
|
+
/** Watches the viewport and the scroll containers of both ends of an open popup. */
|
|
24
|
+
export function watchPopupViewport(anchor, popup, onChange, target) {
|
|
25
|
+
const view = popup.ownerDocument.defaultView;
|
|
26
|
+
if (!view) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const from = target && 'host' in target ? null : target ?? popup.parentElement;
|
|
30
|
+
const anchorScrollers = getPopupScrollers(anchor);
|
|
31
|
+
const popupScrollers = getPopupScrollers(popup, from);
|
|
32
|
+
const scrollers = new Set([view, ...anchorScrollers, ...popupScrollers]);
|
|
33
|
+
for (const scroller of scrollers) {
|
|
34
|
+
scroller.addEventListener('scroll', onChange, { passive: true });
|
|
35
|
+
}
|
|
36
|
+
view.addEventListener('resize', onChange, { passive: true });
|
|
37
|
+
// The popup owner releases these subscriptions when the click surface closes.
|
|
38
|
+
return () => {
|
|
39
|
+
for (const scroller of scrollers) {
|
|
40
|
+
scroller.removeEventListener('scroll', onChange);
|
|
41
|
+
}
|
|
42
|
+
view.removeEventListener('resize', onChange);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
16
45
|
/** Reads the numerical size of CSSOM and frames 0 for auto. */
|
|
17
46
|
function pixels(value) {
|
|
18
47
|
return Number.parseFloat(value) || 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type TooltipPosition, type TooltipRect, type TooltipSourcePlacement } from '../tooltip/tooltip.engine';
|
|
2
2
|
import type { PopupSourceAlign } from './popup-position.engine';
|
|
3
|
+
import type { PopupPoint } from './popup-geometry.dom';
|
|
3
4
|
import type { AdjustOverflow, TooltipPlacement } from '../tooltip/tooltip.types';
|
|
4
5
|
/** Cleanup remains a called function; forceAlign uses the same position controller. */
|
|
5
6
|
export interface PopupConnection {
|
|
@@ -20,6 +21,8 @@ export declare function connectPopup(popup: HTMLElement, anchor: Element, option
|
|
|
20
21
|
builtinPlacements?: Readonly<Record<string, PopupSourceAlign>>;
|
|
21
22
|
/** For a virtual anchor, the placement name is determined by the point of the panel itself. */
|
|
22
23
|
alignPoint?: boolean;
|
|
24
|
+
/** Changes positioning while retaining the real anchor for visibility and focus. */
|
|
25
|
+
anchorPoint?: PopupPoint;
|
|
23
26
|
onAlign?: (position: TooltipPosition) => void;
|
|
24
27
|
onPlacement: (placement: TooltipPlacement, position: TooltipPosition) => void;
|
|
25
28
|
onDismiss: (reason: 'escape' | 'outside', outsideTarget?: Node) => void;
|
package/dist/popup/popup.dom.js
CHANGED
|
@@ -116,7 +116,9 @@ export function connectPopup(popup, anchor, options) {
|
|
|
116
116
|
stack.push(popup);
|
|
117
117
|
openPopups.set(document, stack);
|
|
118
118
|
const bounds = options.measurePopup?.() ?? popup.getBoundingClientRect();
|
|
119
|
-
const
|
|
119
|
+
const point = options.anchorPoint;
|
|
120
|
+
const positionRect = point
|
|
121
|
+
? DOMRect.fromRect(point) : options.getAnchorRect?.(rect, bounds) ?? rect;
|
|
120
122
|
const position = options.getPosition?.(positionRect, bounds, viewport) ?? getTooltipPosition(positionRect, bounds, viewport, options.placement, options.autoAdjustOverflow, options.align, typeof options.gap === 'function' ? options.gap() : options.gap, {
|
|
121
123
|
flips,
|
|
122
124
|
source: options.sourcePlacement,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import ProgressCircle from './ProgressCircle.svelte';
|
|
4
4
|
import { progressCircleIcons } from './progress-circle-icons';
|
|
5
5
|
import { statusIcons } from '../icon/status-icons';
|
|
6
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
6
7
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
7
8
|
import { useConfig } from '../config-provider/config-context';
|
|
8
9
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
@@ -65,7 +66,9 @@
|
|
|
65
66
|
} as const;
|
|
66
67
|
let host = $state<HTMLDivElement>();
|
|
67
68
|
let prefix = $derived(config.getPrefixCls('progress', prefixCls));
|
|
68
|
-
|
|
69
|
+
const runtimeStyles = useRuntimeStyles();
|
|
70
|
+
const hasCustomPrefix = $derived(prefix !== 'ant-progress');
|
|
71
|
+
let prefixCss = $derived(runtimeStyles && getProgressPrefixCss(prefix));
|
|
69
72
|
let size = $derived(providedSize ?? 'medium');
|
|
70
73
|
let value = $derived(normalizeProgressPercent(percent));
|
|
71
74
|
let successValue = $derived(progressSuccessPercent(success));
|
|
@@ -231,7 +234,7 @@
|
|
|
231
234
|
aria-valuemin="0" aria-valuemax="100" aria-valuenow={value} aria-valuetext={valueText}
|
|
232
235
|
dir={config.direction} data-ant-progress-root data-ant-progress-type={type}
|
|
233
236
|
data-ant-progress-steps={Boolean(steps) || undefined}
|
|
234
|
-
data-ant-progress-prefix={
|
|
237
|
+
data-ant-progress-prefix={hasCustomPrefix ? prefix : undefined}
|
|
235
238
|
data-ant-progress-direction={config.direction}
|
|
236
239
|
data-ant-progress-active={resolvedStatus === 'active' || undefined}
|
|
237
240
|
class={[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProgressGapPlacement, ProgressGradient, ProgressSuccess } from './progress.types';
|
|
2
2
|
type CircleGapPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
3
|
-
export declare function progressGapPosition(type: 'circle' | 'dashboard', direction: 'ltr' | 'rtl', placement?: ProgressGapPlacement): "top" | "
|
|
3
|
+
export declare function progressGapPosition(type: 'circle' | 'dashboard', direction: 'ltr' | 'rtl', placement?: ProgressGapPlacement): "top" | "right" | "bottom" | "left" | undefined;
|
|
4
4
|
export declare function progressCircleStyle(perimeter: number, available: number, offset: number, percent: number, rotation: number, gap: number, position: CircleGapPosition | undefined, color: string | ProgressGradient | undefined, cap: 'round' | 'butt' | 'square', strokeWidth: number, space?: number): {
|
|
5
5
|
stroke: string | undefined;
|
|
6
6
|
dashArray: string;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { untrack } from 'svelte';
|
|
3
3
|
import { useConfig } from '../config-provider/config-context';
|
|
4
4
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
5
|
-
import { useDesignTokenContext } from '../theme/theme-context.svelte';
|
|
5
|
+
import { useDesignTokenContext, useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
6
6
|
import { getQRCodePrefixCss } from './qrcode-prefix.engine';
|
|
7
7
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
8
8
|
import {
|
|
@@ -50,7 +50,9 @@
|
|
|
50
50
|
|
|
51
51
|
const config = useConfig();
|
|
52
52
|
let componentPrefix = $derived(config.getPrefixCls('qrcode', prefixCls));
|
|
53
|
-
|
|
53
|
+
const runtimeStyles = useRuntimeStyles();
|
|
54
|
+
const hasCustomPrefix = $derived(componentPrefix !== 'ant-qrcode');
|
|
55
|
+
let prefixCss = $derived(runtimeStyles && getQRCodePrefixCss(componentPrefix));
|
|
54
56
|
const componentTheme = useComponentTheme('QRCode');
|
|
55
57
|
const tokens = useDesignTokenContext();
|
|
56
58
|
let canvas = $state<HTMLCanvasElement>();
|
|
@@ -182,7 +184,7 @@
|
|
|
182
184
|
bind:this={nativeElement}
|
|
183
185
|
{...splitAttributes.root}
|
|
184
186
|
onclick={onclick ?? onClick}
|
|
185
|
-
data-ant-qrcode-prefix={
|
|
187
|
+
data-ant-qrcode-prefix={hasCustomPrefix ? componentPrefix : undefined}
|
|
186
188
|
class={[
|
|
187
189
|
componentPrefix, 'ant-qrcode-css-var',
|
|
188
190
|
componentTheme.className,
|
package/dist/radio/Radio.svelte
CHANGED
|
@@ -6,10 +6,12 @@
|
|
|
6
6
|
import { useComponentTheme } from '../theme/theme-component.svelte';
|
|
7
7
|
import { useWave } from '../wave/wave.svelte';
|
|
8
8
|
import { useForm, useFormField } from '../form/form-context';
|
|
9
|
+
import { useFormFeedback } from '../form/form-feedback-context';
|
|
9
10
|
import { useRadioGroup, useRadioOptionType } from './radio-context';
|
|
10
11
|
import { connectRadio, syncRadioPeers } from './radio.dom';
|
|
11
12
|
import { createCheckableClickLock } from '../checkable.dom';
|
|
12
13
|
import { getRadioPrefixCss } from './radio-prefix.engine';
|
|
14
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
13
15
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
14
16
|
import type { RadioChangeEvent, RadioProps } from './radio.types';
|
|
15
17
|
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
const wave = useWave('Radio', () => resolvedDisabled);
|
|
27
29
|
const form = useForm();
|
|
28
30
|
const field = useFormField(() => ref);
|
|
31
|
+
const formFeedback = useFormFeedback();
|
|
29
32
|
const group = useRadioGroup();
|
|
30
33
|
const optionType = useRadioOptionType();
|
|
31
34
|
const initialDefault = untrack(() => props.defaultChecked ?? false);
|
|
@@ -38,7 +41,9 @@
|
|
|
38
41
|
let radioPrefix = $derived(config.getPrefixCls('radio', props.prefixCls));
|
|
39
42
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
40
43
|
let prefix = $derived(`${radioPrefix}${button ? '-button' : ''}`);
|
|
41
|
-
|
|
44
|
+
const runtimeStyles = useRuntimeStyles();
|
|
45
|
+
const hasCustomPrefix = $derived(radioPrefix !== 'ant-radio' || rootPrefix !== 'ant');
|
|
46
|
+
let prefixCss = $derived(runtimeStyles && getRadioPrefixCss(radioPrefix, rootPrefix));
|
|
42
47
|
let resolvedChecked = $derived(group ? group.value === value : checked ?? initialDefault);
|
|
43
48
|
let resolvedDefault = $derived(group ? group.defaultValue === value : initialDefault);
|
|
44
49
|
let resolvedDisabled = $derived(
|
|
@@ -222,7 +227,7 @@
|
|
|
222
227
|
resolvedDisabled && `${prefix}-wrapper-disabled`,
|
|
223
228
|
config.direction === 'rtl' && `${prefix}-wrapper-rtl`,
|
|
224
229
|
group?.block && `${prefix}-wrapper-block`,
|
|
225
|
-
|
|
230
|
+
formFeedback.isFormItemInput && `${prefix}-wrapper-in-form-item`,
|
|
226
231
|
config.radio?.class,
|
|
227
232
|
props.class,
|
|
228
233
|
props.rootClassName,
|
|
@@ -231,8 +236,8 @@
|
|
|
231
236
|
]} style={rootStyle} title={props.title} {@attach wave}
|
|
232
237
|
data-ant-radio-wrapper={!button || undefined}
|
|
233
238
|
data-ant-radio-button-wrapper={button || undefined}
|
|
234
|
-
data-ant-radio-prefix={
|
|
235
|
-
data-ant-radio-global={
|
|
239
|
+
data-ant-radio-prefix={hasCustomPrefix ? radioPrefix : undefined}
|
|
240
|
+
data-ant-radio-global={hasCustomPrefix ? rootPrefix : undefined}
|
|
236
241
|
onclick={clickLock.label}
|
|
237
242
|
onmouseenter={event => props.onMouseEnter?.(event)}
|
|
238
243
|
onmouseleave={event => props.onMouseLeave?.(event)}>
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { getRadioOptions } from './radio.engine';
|
|
9
9
|
import { spaceOrientation } from '../space/space.engine';
|
|
10
10
|
import { getRadioPrefixCss } from './radio-prefix.engine';
|
|
11
|
+
import { useRuntimeStyles } from '../theme/theme-context.svelte';
|
|
11
12
|
import ThemeScopeStyle from '../theme/ThemeScopeStyle.svelte';
|
|
12
13
|
import type { RadioChangeEvent, RadioGroupProps, RadioValue } from './radio.types';
|
|
13
14
|
|
|
@@ -49,7 +50,9 @@
|
|
|
49
50
|
const field = useFormField(() => nativeElement);
|
|
50
51
|
let prefixCls = $derived(config.getPrefixCls('radio', customizePrefixCls));
|
|
51
52
|
let rootPrefix = $derived(config.getPrefixCls());
|
|
52
|
-
|
|
53
|
+
const runtimeStyles = useRuntimeStyles();
|
|
54
|
+
const hasCustomPrefix = $derived(prefixCls !== 'ant-radio' || rootPrefix !== 'ant');
|
|
55
|
+
let prefixCss = $derived(runtimeStyles && getRadioPrefixCss(prefixCls, rootPrefix));
|
|
53
56
|
const generatedId = $props.id();
|
|
54
57
|
const initialDefault = untrack(() => defaultValue);
|
|
55
58
|
const resets = new Set<ReturnType<typeof setTimeout>>();
|
|
@@ -218,8 +221,8 @@
|
|
|
218
221
|
data-ant-radio-group
|
|
219
222
|
data-ant-radio-block={block || undefined}
|
|
220
223
|
data-ant-radio-vertical={resolvedOrientation === 'vertical' || undefined}
|
|
221
|
-
data-ant-radio-prefix={
|
|
222
|
-
data-ant-radio-global={
|
|
224
|
+
data-ant-radio-prefix={hasCustomPrefix ? prefixCls : undefined}
|
|
225
|
+
data-ant-radio-global={hasCustomPrefix ? rootPrefix : undefined}
|
|
223
226
|
disabled={resolvedDisabled}
|
|
224
227
|
aria-label={attributes['aria-label']
|
|
225
228
|
?? (attributes['aria-labelledby']
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import RadioRoot from './Radio.svelte';
|
|
2
|
+
import Button from './RadioButton.svelte';
|
|
3
|
+
import Group from './RadioGroup.svelte';
|
|
4
|
+
declare const Radio: typeof RadioRoot & {
|
|
5
|
+
Button: typeof Button;
|
|
6
|
+
Group: typeof Group;
|
|
7
|
+
};
|
|
8
|
+
type Radio = RadioRoot;
|
|
9
|
+
export default Radio;
|