@fibrae/semi-foundation 0.2.0 → 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/anchor/foundation.d.ts +0 -3
- package/dist/anchor/foundation.js +0 -1
- package/dist/audio-player/foundation.d.ts +0 -3
- package/dist/audio-player/foundation.js +0 -1
- package/dist/auto-complete/foundation.d.ts +0 -2
- package/dist/auto-complete/foundation.js +0 -1
- package/dist/avatar/foundation.d.ts +0 -1
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +0 -3
- package/dist/backtop/foundation.js +0 -1
- package/dist/base/auto-close-foundation.d.ts +0 -1
- package/dist/base/foundation.d.ts +0 -1
- package/dist/base/list-store.d.ts +0 -1
- package/dist/calendar/event-util.d.ts +0 -10
- package/dist/calendar/event-util.js +0 -10
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +1 -5
- package/dist/calendar/month-foundation.d.ts +0 -1
- package/dist/calendar/month-foundation.js +0 -1
- package/dist/carousel/foundation.d.ts +0 -2
- package/dist/cascader/foundation.d.ts +2 -6
- package/dist/cascader/foundation.js +2 -11
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +1 -5
- package/dist/checkbox/checkbox-foundation.js +0 -2
- package/dist/checkbox/checkbox-group-foundation.d.ts +0 -1
- package/dist/code-highlight/index.d.ts +0 -1
- package/dist/color-picker/color-picker.scss +0 -2
- package/dist/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +0 -1
- package/dist/cropper/foundation.js +0 -1
- package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
- package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
- package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
- package/dist/date-picker/_utils/parser.d.ts +0 -3
- package/dist/date-picker/_utils/parser.js +0 -7
- package/dist/date-picker/_utils/picker-type.d.ts +0 -2
- package/dist/date-picker/_utils/picker-type.js +0 -2
- package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
- package/dist/date-picker/_utils/to-callback-args.js +0 -1
- package/dist/date-picker/date-picker.scss +0 -3
- package/dist/date-picker/foundation.d.ts +3 -22
- package/dist/date-picker/foundation.js +1 -24
- package/dist/date-picker/input-foundation.d.ts +1 -7
- package/dist/date-picker/input-foundation.js +0 -2
- package/dist/date-picker/month-foundation.d.ts +0 -3
- package/dist/date-picker/month-foundation.js +0 -2
- package/dist/date-picker/months-grid-foundation.d.ts +1 -10
- package/dist/date-picker/months-grid-foundation.js +1 -10
- package/dist/drag-move/foundation.d.ts +0 -1
- package/dist/dropdown/foundation.d.ts +0 -2
- package/dist/dropdown/menu-foundation.d.ts +0 -1
- package/dist/feedback/foundation.d.ts +0 -1
- package/dist/feedback/variables.scss +1 -5
- package/dist/float-button/float-button.css +0 -1
- package/dist/float-button/float-button.scss +0 -2
- package/dist/form/form.scss +0 -12
- package/dist/form/foundation.js +0 -15
- package/dist/form/interface.d.ts +2 -15
- package/dist/form/utils.d.ts +0 -8
- package/dist/form/utils.js +0 -7
- package/dist/form/variables.scss +1 -4
- package/dist/grid/variables.scss +0 -10
- package/dist/highlight/foundation.d.ts +0 -2
- package/dist/highlight/foundation.js +0 -2
- package/dist/hot-keys/foundation.d.ts +0 -1
- package/dist/image/image-foundation.d.ts +0 -2
- package/dist/image/preview-footer-foundation.d.ts +0 -1
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-image-foundation.d.ts +0 -1
- package/dist/image/preview-inner-foundation.d.ts +0 -1
- package/dist/input/foundation.d.ts +0 -1
- package/dist/input/text-entry-foundation.d.ts +0 -2
- package/dist/input/text-entry-foundation.js +0 -1
- package/dist/input/textarea-foundation.d.ts +0 -1
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +0 -5
- package/dist/input-number/foundation.js +0 -5
- package/dist/json-viewer/foundation.d.ts +0 -2
- package/dist/json-viewer/foundation.js +0 -1
- package/dist/locale/interface.d.ts +0 -3
- package/dist/markdown-render/foundation.d.ts +1 -6
- package/dist/markdown-render/foundation.js +1 -5
- package/dist/navigation/foundation.d.ts +0 -7
- package/dist/navigation/foundation.js +0 -6
- package/dist/navigation/sub-nav-foundation.d.ts +0 -1
- package/dist/notification/notification-list-foundation.d.ts +0 -1
- package/dist/notification/notification-list-foundation.js +0 -1
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +0 -2
- package/dist/overflow-list/foundation.js +0 -1
- package/dist/pagination/foundation.d.ts +0 -2
- package/dist/pincode/foundation.d.ts +1 -4
- package/dist/pincode/foundation.js +1 -4
- package/dist/popconfirm/popconfirm-foundation.d.ts +0 -2
- package/dist/progress/generates.d.ts +1 -4
- package/dist/progress/generates.js +1 -4
- package/dist/progress/utils.d.ts +1 -1
- package/dist/progress/utils.js +1 -1
- package/dist/radio/radio-foundation.d.ts +0 -4
- package/dist/radio/radio-foundation.js +0 -1
- package/dist/radio/radio-group-foundation.d.ts +0 -1
- package/dist/rating/foundation.d.ts +0 -5
- package/dist/rating/foundation.js +0 -3
- package/dist/resizable/group/index.d.ts +0 -4
- package/dist/resizable/group/index.js +0 -4
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +1 -5
- package/dist/resizable/single/index.js +1 -4
- package/dist/scroll-list/item-foundation.d.ts +0 -2
- package/dist/scroll-list/item-foundation.js +0 -1
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +0 -1
- package/dist/select/option-foundation.d.ts +2 -3
- package/dist/select/option-foundation.js +0 -1
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +1 -6
- package/dist/side-sheet/side-sheet-foundation.js +1 -5
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +1 -12
- package/dist/slider/foundation.js +1 -13
- package/dist/slider/variables.scss +1 -5
- package/dist/spin/foundation.d.ts +0 -2
- package/dist/spin/foundation.js +0 -1
- package/dist/spin/variables.scss +1 -3
- package/dist/switch/foundation.d.ts +0 -1
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +12 -21
- package/dist/table/foundation.js +51 -15
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +0 -8
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +0 -9
- package/dist/tabs/foundation.js +0 -4
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +0 -2
- package/dist/tag-input/foundation.js +0 -1
- package/dist/tag-input/tag-input.scss +0 -1
- package/dist/tag-input/utils/tag-focus.d.ts +0 -1
- package/dist/tag-input/utils/tag-focus.js +0 -1
- package/dist/time-picker/combox-foundation.d.ts +3 -11
- package/dist/time-picker/combox-foundation.js +3 -10
- package/dist/time-picker/foundation.d.ts +0 -10
- package/dist/time-picker/foundation.js +0 -9
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- package/dist/tooltip/adjust-position.d.ts +1 -2
- package/dist/tooltip/constants.d.ts +0 -3
- package/dist/tooltip/constants.js +0 -3
- package/dist/tooltip/foundation.d.ts +0 -3
- package/dist/tooltip/foundation.js +0 -2
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +0 -4
- package/dist/transfer/foundation.js +0 -1
- package/dist/tree/foundation.d.ts +0 -2
- package/dist/tree/foundation.js +0 -1
- package/dist/tree/shared.d.ts +1 -3
- package/dist/tree/shared.js +0 -2
- package/dist/tree/tree-util.d.ts +0 -5
- package/dist/tree/tree-util.js +0 -5
- package/dist/tree-select/foundation.d.ts +0 -2
- package/dist/tree-select/foundation.js +0 -3
- package/dist/typography/ellipsis.d.ts +1 -3
- package/dist/typography/ellipsis.js +0 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +0 -6
- package/dist/upload/foundation.js +1 -11
- package/dist/upload/utils.d.ts +0 -5
- package/dist/upload/utils.js +0 -5
- package/dist/user-guide/foundation.d.ts +0 -2
- package/dist/utils/a11y.d.ts +1 -5
- package/dist/utils/a11y.js +1 -4
- package/dist/utils/array.d.ts +0 -6
- package/dist/utils/array.js +0 -6
- package/dist/utils/date-fns-extra.js +1 -5
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/dom.js +0 -1
- package/dist/utils/escape-html.js +0 -3
- package/dist/utils/field-sizing.d.ts +0 -2
- package/dist/utils/field-sizing.js +0 -2
- package/dist/utils/focus-handle.d.ts +0 -1
- package/dist/utils/focus-handle.js +0 -1
- package/dist/utils/focus-scope.d.ts +0 -1
- package/dist/utils/focus-scope.js +0 -1
- package/dist/utils/scroll-lock.d.ts +3 -4
- package/dist/utils/scroll-lock.js +3 -4
- package/dist/utils/tween.d.ts +0 -1
- package/dist/utils/tween.js +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/uuid.js +0 -1
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -1
- package/dist/video-player/progress-foundation.d.ts +0 -1
- package/dist/video-player/progress-foundation.js +0 -1
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
package/dist/form/utils.d.ts
CHANGED
|
@@ -5,13 +5,6 @@ export declare function isRequired(rules?: any[] | Record<string, any>): boolean
|
|
|
5
5
|
export declare function isValid(errors: any): boolean;
|
|
6
6
|
/** One stable key per ArrayField row: rows that already have a key keep it, new rows get a fresh one */
|
|
7
7
|
export declare function generateKeys(value: unknown, oldKeys?: string[]): string[];
|
|
8
|
-
/**
|
|
9
|
-
* trigger transform rule
|
|
10
|
-
1. If the user has set fieldProps, follow the user's fieldProps
|
|
11
|
-
2. If the user does not set fieldProps, follow formProps
|
|
12
|
-
3. If there is no formProps, follow the change
|
|
13
|
-
4. If it is an array, follow the array, if it is not an array (pure string), convert it to a string array
|
|
14
|
-
*/
|
|
15
8
|
export declare function transformTrigger(fieldTrigger: FieldValidateTriggerType, formTrigger: FieldValidateTriggerType): Array<BasicTriggerType>;
|
|
16
9
|
export declare function transformDefaultBooleanAPI(fieldProp: boolean, formProp: boolean, defaultVal?: boolean): boolean;
|
|
17
10
|
export declare function nextUpdateKey(): number;
|
|
@@ -20,7 +13,6 @@ export declare function nextUpdateKey(): number;
|
|
|
20
13
|
* after setValues a row field keeps the form value and falls back to initValue only when the form has none.
|
|
21
14
|
*/
|
|
22
15
|
export declare function resolveFieldInitValue(initValue: unknown, valueInForm: unknown, shouldUseInitValue: boolean): unknown;
|
|
23
|
-
/** The props a field falls back to its Form for when it does not set them itself */
|
|
24
16
|
export interface FieldConfig {
|
|
25
17
|
labelPosition?: string;
|
|
26
18
|
labelWidth?: number | string;
|
package/dist/form/utils.js
CHANGED
|
@@ -32,13 +32,6 @@ function generateKeys(value, oldKeys = []) {
|
|
|
32
32
|
}
|
|
33
33
|
return value.map((_, i) => oldKeys[i] ?? createId());
|
|
34
34
|
}
|
|
35
|
-
/**
|
|
36
|
-
* trigger transform rule
|
|
37
|
-
1. If the user has set fieldProps, follow the user's fieldProps
|
|
38
|
-
2. If the user does not set fieldProps, follow formProps
|
|
39
|
-
3. If there is no formProps, follow the change
|
|
40
|
-
4. If it is an array, follow the array, if it is not an array (pure string), convert it to a string array
|
|
41
|
-
*/
|
|
42
35
|
function transformTrigger(fieldTrigger, formTrigger) {
|
|
43
36
|
let result = [];
|
|
44
37
|
let finalResult = [];
|
package/dist/form/variables.scss
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
@use 'semi:theme' as *;
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
$spacing-form_field_horizontal-paddingRight: $spacing-base; // 水平布局表单项右侧内边距
|
|
4
4
|
$spacing-form_field_group_horizontal-paddingRight: $spacing-base; // 水平布局表单组标题右侧内边距
|
|
5
5
|
$spacing-form_field_vertical-paddingTop: $spacing-base-tight; // 表单项顶部内边距(垂直布局)
|
|
@@ -7,7 +7,6 @@ $spacing-form_field_vertical-paddingBottom: $spacing-base-tight; // 表单项底
|
|
|
7
7
|
$spacing-form_field_group_vertical-paddingTop: $spacing-base-tight; // 垂直布局表单组顶部内边距
|
|
8
8
|
$spacing-form_field_group_vertical-paddingBottom: $spacing-base-tight; // 垂直布局表单组底部内边距
|
|
9
9
|
|
|
10
|
-
// form label
|
|
11
10
|
$spacing-form_label-paddingRight: $spacing-base; // 表单项标签右侧边距(水平布局)
|
|
12
11
|
$spacing-form_label-paddingTop: ($height-control-default - 20px) * 0.5; // 表单项标签顶部内边距(水平布局)
|
|
13
12
|
$spacing-form_label-marginBottom: $spacing-extra-tight; // 表单项标签底部外边距
|
|
@@ -36,13 +35,11 @@ $color-form_label_extra-text-default: var(--semi-color-tertiary); // 表单项
|
|
|
36
35
|
$color-form_requiredMark-text-default: var(--semi-color-danger); // 必填标记颜色
|
|
37
36
|
$font-form_requiredMark-fontWeight: $font-weight-bold; // 表单必填标识字重
|
|
38
37
|
|
|
39
|
-
// form errormessage
|
|
40
38
|
$color-form_message_error-text-default: var(--semi-color-danger); // 错误提示颜色
|
|
41
39
|
$color-form_alertIcon-icon-default: var(--semi-color-warning); // 警告图标颜色
|
|
42
40
|
$spacing-form_statusIcon-marginRight: $spacing-extra-tight; // 表单校验状态图标右侧外边距
|
|
43
41
|
$spacing-form_message-marginTop: $spacing-extra-tight; // 表单错误信息、辅助文字顶部外边距
|
|
44
42
|
|
|
45
|
-
// form section
|
|
46
43
|
$color-form_section-text-default: var(--semi-color-text-0); // 表单分组标题文字颜色
|
|
47
44
|
$color-form_section-border-default: var(--semi-color-border); // 表单分组标题底部描边颜色
|
|
48
45
|
$width-form_section-border: $border-thickness-control; // 表单分组标题底部描边宽度
|
package/dist/grid/variables.scss
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
@use 'semi:theme' as *;
|
|
2
|
-
// Media queries breakpoints
|
|
3
|
-
// Extra small screen / phone
|
|
4
2
|
|
|
5
|
-
// Small screen / tablet
|
|
6
3
|
$width-grid_screen-sm: 576px; // 小尺寸设备 - 平板
|
|
7
4
|
$width-grid_screen-sm-min: $width-grid_screen-sm;
|
|
8
5
|
|
|
9
|
-
// Medium screen / desktop
|
|
10
6
|
$width-grid_screen-md: 768px; // 中尺寸设备 - 水平平板
|
|
11
7
|
$width-grid_screen-md-min: $width-grid_screen-md;
|
|
12
8
|
|
|
13
|
-
// Large screen / wide desktop
|
|
14
9
|
$width-grid_screen-lg: 992px; // 大尺寸设备 - 小尺寸桌面端
|
|
15
10
|
$width-grid_screen-lg-min: $width-grid_screen-lg;
|
|
16
11
|
|
|
17
|
-
// Extra large screen / full hd
|
|
18
12
|
$width-grid_screen-xl: 1200px; // 超大尺寸设备 - 桌面端
|
|
19
13
|
$width-grid_screen-xl-min: $width-grid_screen-xl;
|
|
20
14
|
|
|
21
|
-
// Extra extra large screen / large desktop
|
|
22
15
|
$width-grid_screen-xxl: 1600px; // 超大尺寸设备 - 桌面端 HD
|
|
23
16
|
$width-grid_screen-xxl-min: $width-grid_screen-xxl;
|
|
24
17
|
|
|
25
|
-
// provide a maximum
|
|
26
|
-
|
|
27
|
-
// Grid system
|
|
28
18
|
$width-grid_columns: 24; // 栅格宽度
|
|
29
19
|
$width-grid_gutter: 0; // 槽宽度
|
|
@@ -50,8 +50,6 @@ export type SearchWords = SearchWord[];
|
|
|
50
50
|
{ start: 7, end: 13, highlight: true },
|
|
51
51
|
{ start: 13, end: 17, highlight: false },
|
|
52
52
|
]
|
|
53
|
-
|
|
54
|
-
* @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean })
|
|
55
53
|
*/
|
|
56
54
|
export declare function findAll({ autoEscape, caseSensitive, searchWords, sourceString }: Omit<ChunkQuery, 'searchWords'> & {
|
|
57
55
|
searchWords: string | SearchWords;
|
|
@@ -93,8 +93,6 @@ findAll ['do', 'dollar'], 'aaa do dollar aaa'
|
|
|
93
93
|
{ start: 7, end: 13, highlight: true },
|
|
94
94
|
{ start: 13, end: 17, highlight: false },
|
|
95
95
|
]
|
|
96
|
-
|
|
97
|
-
* @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean })
|
|
98
96
|
*/
|
|
99
97
|
function findAll({ autoEscape = true, caseSensitive = false, searchWords, sourceString }) {
|
|
100
98
|
return fillInChunks({
|
|
@@ -2,7 +2,6 @@ import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
|
|
|
2
2
|
export interface HotKeysAdapter<P extends HotKeysBaseProps = HotKeysBaseProps, S extends object = object> extends DefaultAdapter<P, S> {
|
|
3
3
|
notifyHotKey: (e: KeyboardEvent) => void;
|
|
4
4
|
}
|
|
5
|
-
/** The props the foundation reads with getProps */
|
|
6
5
|
export interface HotKeysBaseProps {
|
|
7
6
|
hotKeys: KeyboardEvent['key'][];
|
|
8
7
|
preventDefault?: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
|
|
2
2
|
export type ImageLoadStatus = 'loading' | 'success' | 'error';
|
|
3
|
-
/** The props the foundation reads */
|
|
4
3
|
export interface ImageBaseProps {
|
|
5
4
|
preview?: boolean | {
|
|
6
5
|
visible?: boolean;
|
|
@@ -9,7 +8,6 @@ export interface ImageBaseProps {
|
|
|
9
8
|
export interface ImageBaseState {}
|
|
10
9
|
export interface ImageAdapter<P extends ImageBaseProps = ImageBaseProps, S extends ImageBaseState = ImageBaseState> extends DefaultAdapter<P, S> {
|
|
11
10
|
getIsInGroup: () => boolean;
|
|
12
|
-
/** Opens the group preview at this image */
|
|
13
11
|
openGroupPreview: () => void;
|
|
14
12
|
setLoadStatus: (status: ImageLoadStatus) => void;
|
|
15
13
|
setPreviewVisible: (visible: boolean) => void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
|
|
2
2
|
import { RatioType, RotateDirection } from "./preview-inner-foundation.js";
|
|
3
3
|
import { ThrottledFunction } from "es-toolkit";
|
|
4
|
-
/** The props the foundation reads */
|
|
5
4
|
export interface PreviewFooterBaseProps {
|
|
6
5
|
zoom?: number;
|
|
7
6
|
step?: number;
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
|
|
2
|
-
/** An Image registered with its group */
|
|
3
2
|
export interface PreviewGroupImage {
|
|
4
3
|
/** The thumbnail element: the group lists its images in document order */
|
|
5
4
|
node: Element;
|
|
6
|
-
/** The thumbnail src */
|
|
7
5
|
src: string;
|
|
8
6
|
/** The srcs the image adds to the group preview; undefined when the image does not open the group preview */
|
|
9
7
|
previewSrc?: string | string[];
|
|
10
8
|
title?: unknown;
|
|
11
9
|
alt?: string;
|
|
12
10
|
}
|
|
13
|
-
/** The props the foundation reads */
|
|
14
11
|
export interface PreviewBaseProps {
|
|
15
12
|
src?: string | string[];
|
|
16
13
|
visible?: boolean;
|
|
@@ -32,7 +32,6 @@ export interface PreviewInnerAdapter<P extends PreviewInnerBaseProps = PreviewIn
|
|
|
32
32
|
isEventInPreview: (e: KeyboardEvent) => boolean;
|
|
33
33
|
setRatio: (ratio: RatioType) => void;
|
|
34
34
|
}
|
|
35
|
-
/** The props the foundation reads with getProp */
|
|
36
35
|
export interface PreviewInnerBaseProps {
|
|
37
36
|
closeOnEsc?: boolean;
|
|
38
37
|
src?: string | string[];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isComposing } from "../utils/key-code.js";
|
|
2
2
|
import TextEntryFoundation, { TextEntryAdapter, TextEntryBaseProps, TextEntryBaseState } from "./text-entry-foundation.js";
|
|
3
|
-
/** The props the foundation reads with getProps */
|
|
4
3
|
export interface InputBaseProps extends TextEntryBaseProps {
|
|
5
4
|
disabled?: boolean;
|
|
6
5
|
autoFocus?: boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
|
|
2
|
-
/** The props the shared text entry logic reads with getProps */
|
|
3
2
|
export interface TextEntryBaseProps {
|
|
4
3
|
value?: string | number;
|
|
5
4
|
composition?: boolean;
|
|
@@ -30,7 +29,6 @@ export interface TextEntryAdapter<P extends TextEntryBaseProps, S extends TextEn
|
|
|
30
29
|
*/
|
|
31
30
|
export default class TextEntryFoundation<A extends TextEntryAdapter<P, S, CE>, P extends TextEntryBaseProps, S extends TextEntryBaseState, CE = unknown> extends BaseFoundation<A, P, S> {
|
|
32
31
|
#private;
|
|
33
|
-
/** Whether an IME composition started since the element last took the focus */
|
|
34
32
|
protected get composedSinceFocus(): boolean;
|
|
35
33
|
protected getNextValue(value: string): string;
|
|
36
34
|
protected changeValue(value: string, e: unknown): void;
|
|
@@ -8,7 +8,6 @@ import truncateValue from "./util/truncate-value.js";
|
|
|
8
8
|
var TextEntryFoundation = class TextEntryFoundation extends BaseFoundation {
|
|
9
9
|
#compositionEnter = false;
|
|
10
10
|
#composedSinceFocus = false;
|
|
11
|
-
/** Whether an IME composition started since the element last took the focus */
|
|
12
11
|
get composedSinceFocus() {
|
|
13
12
|
return this.#composedSinceFocus;
|
|
14
13
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isComposing } from "../utils/key-code.js";
|
|
2
2
|
import TextEntryFoundation, { TextEntryAdapter, TextEntryBaseProps, TextEntryBaseState } from "./text-entry-foundation.js";
|
|
3
|
-
/** The props the foundation reads with getProps */
|
|
4
3
|
export interface TextAreaBaseProps extends TextEntryBaseProps {
|
|
5
4
|
value?: string;
|
|
6
5
|
disabled?: boolean;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Records the text after the caret, so the caret can follow it when a change reformats the value */
|
|
2
1
|
export declare function recordCaretTail(input: HTMLInputElement | null): string | undefined;
|
|
3
2
|
/** Puts the caret in front of the longest suffix of the recorded tail that still ends the value */
|
|
4
3
|
export declare function restoreCaretTail(input: HTMLInputElement | null, tail?: string): void;
|
|
@@ -4,7 +4,6 @@ export interface ScientificNotationConfig {
|
|
|
4
4
|
/** Number of digits threshold to trigger scientific notation display */
|
|
5
5
|
threshold?: number;
|
|
6
6
|
}
|
|
7
|
-
/** The props the foundation reads with getProps */
|
|
8
7
|
export interface InputNumberBaseProps {
|
|
9
8
|
value?: number | string;
|
|
10
9
|
defaultValue?: number | string;
|
|
@@ -50,7 +49,6 @@ export interface InputNumberAdapter<P extends InputNumberBaseProps = InputNumber
|
|
|
50
49
|
notifyUpClick: (value: string, e: any) => void;
|
|
51
50
|
notifyDownClick: (value: string, e: any) => void;
|
|
52
51
|
notifyKeyDown: (e: KE) => void;
|
|
53
|
-
/** The native input */
|
|
54
52
|
getInput: () => HTMLInputElement | null;
|
|
55
53
|
}
|
|
56
54
|
export interface BaseInputNumberState {
|
|
@@ -74,9 +72,6 @@ export default class InputNumberFoundation<P extends InputNumberBaseProps = Inpu
|
|
|
74
72
|
protected doParse(value: string | number, needCheckPrec?: boolean, needAdjustPrec?: boolean, needAdjustMaxMin?: boolean): number;
|
|
75
73
|
protected afterParser(value: string | number): string;
|
|
76
74
|
protected toNumber(value: number | string, needAdjustPrec?: boolean): number;
|
|
77
|
-
/**
|
|
78
|
-
* True for a number within [min, max] whose decimal length is at most `precision` (when `needCheckPrec`).
|
|
79
|
-
*/
|
|
80
75
|
protected isValidNumber(num: number, needCheckPrec?: boolean): boolean;
|
|
81
76
|
/** ARIA takes a plain decimal, so 1.2e-7 is written out in full; an empty or infinite number has none */
|
|
82
77
|
static getAriaValueNow(number?: number | null): string | undefined;
|
|
@@ -22,7 +22,6 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
22
22
|
#recordCaret() {
|
|
23
23
|
this.#caretTail = recordCaretTail(this.adapter.getInput());
|
|
24
24
|
}
|
|
25
|
-
/** Puts the caret back in front of the text that followed it before the last change */
|
|
26
25
|
#restoreCaret() {
|
|
27
26
|
restoreCaretTail(this.adapter.getInput(), this.#caretTail);
|
|
28
27
|
}
|
|
@@ -34,7 +33,6 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
34
33
|
const { currency } = this.getProps();
|
|
35
34
|
return typeof currency === "string" ? currency : this.getProp("defaultCurrency");
|
|
36
35
|
}
|
|
37
|
-
/** Commits the formatted text a step produced */
|
|
38
36
|
#commitStep(v = "", event = null, updateCb = null) {
|
|
39
37
|
const parsed = this.doParse(v, false);
|
|
40
38
|
const isValidNumber = !isNaN(parsed);
|
|
@@ -335,9 +333,6 @@ var InputNumberFoundation = class InputNumberFoundation extends BaseFoundation {
|
|
|
335
333
|
}
|
|
336
334
|
return Number(value);
|
|
337
335
|
}
|
|
338
|
-
/**
|
|
339
|
-
* True for a number within [min, max] whose decimal length is at most `precision` (when `needCheckPrec`).
|
|
340
|
-
*/
|
|
341
336
|
isValidNumber(num, needCheckPrec = true) {
|
|
342
337
|
if (typeof num === "number" && !isNaN(num)) {
|
|
343
338
|
const { min, max, precision } = this.getProps();
|
|
@@ -6,7 +6,6 @@ export interface SearchOptions {
|
|
|
6
6
|
wholeWord: boolean;
|
|
7
7
|
regex: boolean;
|
|
8
8
|
}
|
|
9
|
-
/** The props the foundation reads with getProps */
|
|
10
9
|
export interface JsonViewerBaseProps {
|
|
11
10
|
value: string;
|
|
12
11
|
options?: JsonViewerOptions;
|
|
@@ -33,7 +32,6 @@ export default class JsonViewerFoundation<P extends JsonViewerBaseProps = JsonVi
|
|
|
33
32
|
nextSearch: (step?: number) => void;
|
|
34
33
|
replace: (replaceText: string) => void;
|
|
35
34
|
replaceAll: (replaceText: string) => void;
|
|
36
|
-
/** Toggles one search option, then searches again with the input text and the new options */
|
|
37
35
|
toggleSearchOption: (key: keyof SearchOptions) => void;
|
|
38
36
|
toggleSearchBar: () => void;
|
|
39
37
|
/** `null` when nothing was searched (or the bar was closed), `undefined` while there is no editor */
|
|
@@ -106,7 +106,6 @@ var JsonViewerFoundation = class extends BaseFoundation {
|
|
|
106
106
|
if (this.getProps().options?.readOnly) return;
|
|
107
107
|
this.jsonViewer?.getSearchWidget().replaceAll(replaceText);
|
|
108
108
|
};
|
|
109
|
-
/** Toggles one search option, then searches again with the input text and the new options */
|
|
110
109
|
toggleSearchOption = (key) => {
|
|
111
110
|
this.adapter.toggleSearchOption(key);
|
|
112
111
|
this.search(this.#lastSearch?.text ?? "");
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Locale as Locale$1 } from "date-fns";
|
|
2
|
-
/** Keys of `Locale` that hold a component's strings */
|
|
3
2
|
export type LocaleComponentName = Exclude<keyof Locale, 'code' | 'dateFnsLocale' | 'currency'>;
|
|
4
3
|
export interface LocaleResult<T> {
|
|
5
|
-
/** `locale[componentName]`: the component's own strings */
|
|
6
4
|
locale: T;
|
|
7
5
|
localeCode: string;
|
|
8
|
-
/** For formatting dates in the locale's language, e.g. `format(date, 'EEEE', { locale: dateFnsLocale })` */
|
|
9
6
|
dateFnsLocale: Locale$1;
|
|
10
7
|
currency: string;
|
|
11
8
|
}
|
|
@@ -10,7 +10,6 @@ export interface MarkdownRenderAdapter<P extends MarkdownRenderBaseProps = Markd
|
|
|
10
10
|
* which breaks type checking of published declarations. The values are framework components this package cannot name.
|
|
11
11
|
*/
|
|
12
12
|
export type MarkdownComponents = Record<string, any>;
|
|
13
|
-
/** Renders the compiled source with the given element renderers */
|
|
14
13
|
export type MarkdownContent = (props: {
|
|
15
14
|
components?: MarkdownComponents;
|
|
16
15
|
}) => any;
|
|
@@ -28,7 +27,6 @@ export interface MarkdownRenderBaseState {
|
|
|
28
27
|
}
|
|
29
28
|
export default class MarkdownRenderFoundation<P extends MarkdownRenderBaseProps = MarkdownRenderBaseProps, S extends MarkdownRenderBaseState = MarkdownRenderBaseState> extends BaseFoundation<MarkdownRenderAdapter<P, S>, P, S> {
|
|
30
29
|
#private;
|
|
31
|
-
/** Returns a function that renders the source with its `components` prop */
|
|
32
30
|
protected evaluate(raw: string): Promise<MarkdownContent>;
|
|
33
31
|
/**
|
|
34
32
|
* Compiles `md` synchronously for the first render, so server output and hydration start with the content.
|
|
@@ -42,9 +40,6 @@ export default class MarkdownRenderFoundation<P extends MarkdownRenderBaseProps
|
|
|
42
40
|
/** Plugin lists match when each entry, or each item of a `[plugin, options]` entry, is the same reference */
|
|
43
41
|
static isSamePluginList(a?: PluggableList, b?: PluggableList): boolean;
|
|
44
42
|
destroy(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Compiles the current source and stores the result as `renderContent`. A failed compile keeps the last
|
|
47
|
-
* content and goes to `notifyCompileError`.
|
|
48
|
-
*/
|
|
43
|
+
/** A failed compile keeps the last content and goes to `notifyCompileError` */
|
|
49
44
|
updateContent: () => Promise<void>;
|
|
50
45
|
}
|
|
@@ -25,7 +25,6 @@ var MarkdownRenderFoundation = class MarkdownRenderFoundation extends BaseFounda
|
|
|
25
25
|
ignoreInvalidStyle: true
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
/** Returns a function that renders the source with its `components` prop */
|
|
29
28
|
async evaluate(raw) {
|
|
30
29
|
const props = {
|
|
31
30
|
format: this.getProp("format"),
|
|
@@ -84,10 +83,7 @@ var MarkdownRenderFoundation = class MarkdownRenderFoundation extends BaseFounda
|
|
|
84
83
|
destroy() {
|
|
85
84
|
this.#requestId++;
|
|
86
85
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Compiles the current source and stores the result as `renderContent`. A failed compile keeps the last
|
|
89
|
-
* content and goes to `notifyCompileError`.
|
|
90
|
-
*/
|
|
86
|
+
/** A failed compile keeps the last content and goes to `notifyCompileError` */
|
|
91
87
|
updateContent = async () => {
|
|
92
88
|
const requestId = ++this.#requestId;
|
|
93
89
|
try {
|
|
@@ -25,7 +25,6 @@ export interface NavigationAdapter<P extends NavigationBaseProps = NavigationBas
|
|
|
25
25
|
updateSelectedKeys(keys: ItemKey[]): void;
|
|
26
26
|
updateOpenKeys(keys: ItemKey[]): void;
|
|
27
27
|
}
|
|
28
|
-
/** The props the foundation reads */
|
|
29
28
|
export interface NavigationBaseProps {
|
|
30
29
|
items?: (string | NavItemInput)[];
|
|
31
30
|
children?: unknown;
|
|
@@ -42,9 +41,6 @@ export default class NavigationFoundation<P extends NavigationBaseProps = Naviga
|
|
|
42
41
|
static getZeroParentKeys(itemKeysMap?: ItemKey2ParentKeysMap, ...itemKeys: ItemKey[]): any[];
|
|
43
42
|
static buildItemKeysMap(items?: NavItemType[], keysMap?: {}, parentKeys?: (string | number)[], keyPropName?: string): {};
|
|
44
43
|
static formatItems(items?: (string | NavItemInput)[]): NavItemType[];
|
|
45
|
-
/**
|
|
46
|
-
* Formatted items and the itemKey -> parent keys map
|
|
47
|
-
*/
|
|
48
44
|
static getFormattedItems({ items }: NavigationBaseProps, children?: NavItemType[]): {
|
|
49
45
|
itemKeysMap: ItemKey2ParentKeysMap;
|
|
50
46
|
formattedItems: NavItemType[];
|
|
@@ -65,9 +61,6 @@ export default class NavigationFoundation<P extends NavigationBaseProps = Naviga
|
|
|
65
61
|
* openKeys is copied into state
|
|
66
62
|
*/
|
|
67
63
|
handlePropsUpdate: (prevProps: NavigationBaseProps) => void;
|
|
68
|
-
/**
|
|
69
|
-
* Selects keys together with their top level parents
|
|
70
|
-
*/
|
|
71
64
|
updateSelectedKeys: (keys: ItemKey[]) => void;
|
|
72
65
|
addOpenKey: (itemKey: ItemKey) => void;
|
|
73
66
|
removeOpenKey: (itemKey: ItemKey) => void;
|
|
@@ -50,9 +50,6 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
|
|
|
50
50
|
} : rest;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Formatted items and the itemKey -> parent keys map
|
|
55
|
-
*/
|
|
56
53
|
static getFormattedItems({ items }, children = []) {
|
|
57
54
|
const formattedItems = NavigationFoundation.formatItems(items);
|
|
58
55
|
const willHandleItems = Array.isArray(items) && items.length ? formattedItems : children;
|
|
@@ -132,9 +129,6 @@ var NavigationFoundation = class NavigationFoundation extends BaseFoundation {
|
|
|
132
129
|
if (props.openKeys && !isEqual(prevProps.openKeys, props.openKeys)) this.adapter.updateOpenKeys(props.openKeys);
|
|
133
130
|
else if (prevProps.openKeys !== void 0 && props.openKeys === void 0) this.adapter.updateOpenKeys(NavigationFoundation.getWillOpenKeys(props, [], this.#getItemKeysMap()));
|
|
134
131
|
};
|
|
135
|
-
/**
|
|
136
|
-
* Selects keys together with their top level parents
|
|
137
|
-
*/
|
|
138
132
|
updateSelectedKeys = (keys) => {
|
|
139
133
|
const parentKeys = NavigationFoundation.getZeroParentKeys(this.#getItemKeysMap(), ...keys);
|
|
140
134
|
this.adapter.updateSelectedKeys(Array.from(new Set(keys.concat(parentKeys))));
|
|
@@ -15,7 +15,6 @@ export interface SubNavAdapter<P extends SubNavBaseProps = SubNavBaseProps, S ex
|
|
|
15
15
|
notifyGlobalOnClick(data: OnClickData): void;
|
|
16
16
|
getIsOpen(): boolean;
|
|
17
17
|
}
|
|
18
|
-
/** The props the foundation reads */
|
|
19
18
|
export interface SubNavBaseProps {
|
|
20
19
|
itemKey?: string | number;
|
|
21
20
|
disabled?: boolean;
|
|
@@ -46,7 +46,6 @@ export default class NotificationListStore {
|
|
|
46
46
|
};
|
|
47
47
|
subscribe: (listener: () => void) => () => void;
|
|
48
48
|
getSnapshot: () => NotificationListState;
|
|
49
|
-
/** Shows a notice, or updates the shown one with the same id */
|
|
50
49
|
add: (notice: NoticeInstance) => void;
|
|
51
50
|
remove: (id: string) => void;
|
|
52
51
|
finishLeave: (id: string) => void;
|
|
@@ -17,7 +17,6 @@ var NotificationListStore = class {
|
|
|
17
17
|
defaults = { ...builtInDefaults };
|
|
18
18
|
subscribe = (listener) => this.#items.subscribe(listener);
|
|
19
19
|
getSnapshot = () => this.#items.getSnapshot();
|
|
20
|
-
/** Shows a notice, or updates the shown one with the same id */
|
|
21
20
|
add = (notice) => {
|
|
22
21
|
this.#items.add(notice);
|
|
23
22
|
};
|
|
@@ -16,7 +16,6 @@ $color-notification_info_light-bg: var(--semi-color-info-light-default); // 彩
|
|
|
16
16
|
$color-notification_info_light-border: var(--semi-color-info); // 彩色通知信息描边色
|
|
17
17
|
$color-notification_danger_light-bg: var(--semi-color-danger-light-default); // 彩色通知危险背景色
|
|
18
18
|
$color-notification_danger_light-border: var(--semi-color-danger); // 彩色通知危险描边色
|
|
19
|
-
// keep equal to bg-0
|
|
20
19
|
$color-notification_ambient-bg: var(--semi-color-bg-0); // 透明背景色叠加层(与bg0保持一致不建议修改)
|
|
21
20
|
|
|
22
21
|
$width-notification_notice: auto; // 通知宽度
|
|
@@ -32,7 +32,6 @@ export interface VisibleLayout {
|
|
|
32
32
|
step: 1 | -1;
|
|
33
33
|
fromStart: boolean;
|
|
34
34
|
}
|
|
35
|
-
/** The props the foundation reads */
|
|
36
35
|
export interface OverflowListBaseProps {
|
|
37
36
|
collapseFrom?: 'start' | 'end';
|
|
38
37
|
items?: Array<Record<string, any>>;
|
|
@@ -68,7 +67,6 @@ export default class OverflowListFoundation<P extends OverflowListBaseProps = Ov
|
|
|
68
67
|
* object to one position.
|
|
69
68
|
*/
|
|
70
69
|
static getVisibleLayout({ items, visible }: Pick<OverflowListView, 'items' | 'visible'>, fromStart: boolean, reversed: boolean): VisibleLayout;
|
|
71
|
-
/** The view a change of items or style starts from; the measurement then settles it */
|
|
72
70
|
static resetView({ items, style, renderMode, collapseFrom, itemKey }: OverflowListBaseProps, view: OverflowListView, containerWidth: number): OverflowListView;
|
|
73
71
|
/** Returns whether the list must be measured again: an item changed width, or every visible item has reported */
|
|
74
72
|
recordItemSize: (key: ItemKey, width: number, maxCount: number) => boolean;
|
|
@@ -67,7 +67,6 @@ var OverflowListFoundation = class OverflowListFoundation extends BaseFoundation
|
|
|
67
67
|
fromStart
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
/** The view a change of items or style starts from; the measurement then settles it */
|
|
71
70
|
static resetView({ items, style, renderMode, collapseFrom, itemKey }, view, containerWidth) {
|
|
72
71
|
const keys = OverflowListFoundation.getItemKeys(items, itemKey);
|
|
73
72
|
const next = {
|
|
@@ -19,13 +19,11 @@ export interface AdapterPageList {
|
|
|
19
19
|
restLeftRange: PageRange;
|
|
20
20
|
restRightRange: PageRange;
|
|
21
21
|
}
|
|
22
|
-
/** The props the foundation reads */
|
|
23
22
|
export interface PaginationBaseProps {
|
|
24
23
|
currentPage?: number;
|
|
25
24
|
preventPageChangeOnPageSizeChange?: boolean;
|
|
26
25
|
total?: number;
|
|
27
26
|
}
|
|
28
|
-
/** The state the foundation reads */
|
|
29
27
|
export interface PaginationBaseState {
|
|
30
28
|
currentPage: number;
|
|
31
29
|
pageSize: number;
|
|
@@ -30,10 +30,7 @@ export default class PinCodeFoundation<P extends PinCodeBaseProps = PinCodeBaseP
|
|
|
30
30
|
validateValue(value?: string): boolean;
|
|
31
31
|
updateValueList: (newValueList: PinCodeBaseState["valueList"]) => Promise<void>;
|
|
32
32
|
handlePaste: (e: ClipboardEvent, startInputIndex: number) => Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
|
|
35
|
-
* virtual keyboard's delete).
|
|
36
|
-
*/
|
|
33
|
+
/** Also covers a cell emptied without Backspace or Delete (cut, a virtual keyboard's delete). */
|
|
37
34
|
removeCell(index: number): void;
|
|
38
35
|
handleKeyDownOnSingleInput: (e: KeyboardEvent, index: number) => void;
|
|
39
36
|
}
|
|
@@ -55,10 +55,7 @@ var PinCodeFoundation = class PinCodeFoundation extends BaseFoundation {
|
|
|
55
55
|
else break;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
/**
|
|
59
|
-
* Removes the character and closes the gap. Also covers a cell emptied without Backspace or Delete (cut, a
|
|
60
|
-
* virtual keyboard's delete).
|
|
61
|
-
*/
|
|
58
|
+
/** Also covers a cell emptied without Backspace or Delete (cut, a virtual keyboard's delete). */
|
|
62
59
|
removeCell(index) {
|
|
63
60
|
const valueList = this.getState("valueList").toSpliced(index, 1);
|
|
64
61
|
this.updateValueList(valueList);
|
|
@@ -14,13 +14,11 @@ interface FooterButtonProps {
|
|
|
14
14
|
autoFocus?: boolean;
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
}
|
|
17
|
-
/** The props the foundation reads */
|
|
18
17
|
export interface PopconfirmBaseProps {
|
|
19
18
|
cancelButtonProps?: FooterButtonProps;
|
|
20
19
|
okButtonProps?: FooterButtonProps;
|
|
21
20
|
visible?: boolean;
|
|
22
21
|
}
|
|
23
|
-
/** The state the foundation reads */
|
|
24
22
|
export interface PopconfirmBaseState {
|
|
25
23
|
visible: boolean;
|
|
26
24
|
cancelLoading: boolean;
|
|
@@ -3,9 +3,6 @@ type StrokeSet = {
|
|
|
3
3
|
color: string;
|
|
4
4
|
};
|
|
5
5
|
export type StrokeArr = Array<StrokeSet>;
|
|
6
|
-
/**
|
|
7
|
-
* Picks the stroke color for `percent` from the color stops in `s`. The result is a CSS color expression
|
|
8
|
-
* (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render.
|
|
9
|
-
*/
|
|
6
|
+
/** The result is a CSS color expression (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render. */
|
|
10
7
|
export declare function generateColor(s: StrokeArr, percent: number, gradient: boolean): string | undefined;
|
|
11
8
|
export {};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { strings } from "./constants.js";
|
|
2
2
|
// src/progress/generates.ts
|
|
3
3
|
const PALETTE_TOKEN = /^(?:(black|white)|(amber|blue|cyan|green|grey|indigo|light-blue|light-green|lime|orange|pink|purple|red|teal|violet|yellow)(?:-(\d))?)$/;
|
|
4
|
-
/**
|
|
5
|
-
* Picks the stroke color for `percent` from the color stops in `s`. The result is a CSS color expression
|
|
6
|
-
* (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render.
|
|
7
|
-
*/
|
|
4
|
+
/** The result is a CSS color expression (`var(--semi-...)` or `color-mix()`), so theme switches apply without a re-render. */
|
|
8
5
|
function generateColor(s, percent, gradient) {
|
|
9
6
|
if (s.length === 0) return void 0;
|
|
10
7
|
const sorted = s.toSorted((a, b) => a.percent - b.percent);
|
package/dist/progress/utils.d.ts
CHANGED
|
@@ -14,5 +14,5 @@ export interface PercentAnimation {
|
|
|
14
14
|
/** Cancels the running tween; call on unmount */
|
|
15
15
|
stop: () => void;
|
|
16
16
|
}
|
|
17
|
-
/**
|
|
17
|
+
/** A new update or `stop` cancels the running tween */
|
|
18
18
|
export declare function createPercentAnimation(setShown: (value: number) => void): PercentAnimation;
|
package/dist/progress/utils.js
CHANGED
|
@@ -16,7 +16,7 @@ function calcCircleGeometry(diameter, strokeWidth, percent, indeterminate) {
|
|
|
16
16
|
strokeDashoffset: indeterminate ? 0 : (1 - percent / 100) * circumference
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
19
|
+
/** A new update or `stop` cancels the running tween */
|
|
20
20
|
function createPercentAnimation(setShown) {
|
|
21
21
|
let cancel;
|
|
22
22
|
const stop = () => {
|
|
@@ -8,7 +8,6 @@ export interface RadioChangeEvent {
|
|
|
8
8
|
stopPropagation: () => void;
|
|
9
9
|
preventDefault: () => void;
|
|
10
10
|
}
|
|
11
|
-
/** What a radio reads from the enclosing RadioGroup */
|
|
12
11
|
export interface RadioGroupView {
|
|
13
12
|
value?: unknown;
|
|
14
13
|
disabled?: boolean;
|
|
@@ -24,7 +23,6 @@ export interface RadioContextView {
|
|
|
24
23
|
mode?: string;
|
|
25
24
|
radioGroup?: RadioGroupView;
|
|
26
25
|
}
|
|
27
|
-
/** The props the foundation reads with getProps */
|
|
28
26
|
export interface RadioBaseProps {
|
|
29
27
|
checked?: boolean;
|
|
30
28
|
defaultChecked?: boolean;
|
|
@@ -55,7 +53,6 @@ export interface RadioView {
|
|
|
55
53
|
buttonSize?: string;
|
|
56
54
|
prefixCls?: string;
|
|
57
55
|
}
|
|
58
|
-
/** The part of the native event the foundation forwards */
|
|
59
56
|
interface RadioSourceEvent {
|
|
60
57
|
stopPropagation: () => void;
|
|
61
58
|
preventDefault: () => void;
|
|
@@ -63,7 +60,6 @@ interface RadioSourceEvent {
|
|
|
63
60
|
export default class RadioFoundation<P extends RadioBaseProps = RadioBaseProps, S extends RadioBaseState = RadioBaseState> extends BaseFoundation<RadioAdapter<P, S>, P, S> {
|
|
64
61
|
#private;
|
|
65
62
|
static getInitialState(props: Pick<RadioBaseProps, 'checked' | 'defaultChecked'>): RadioBaseState;
|
|
66
|
-
/** How the radio looks and behaves, from its own props or, inside a group, from the group */
|
|
67
63
|
static deriveView(props: RadioBaseProps, state: RadioBaseState, context?: RadioContextView | null): RadioView;
|
|
68
64
|
init(): void;
|
|
69
65
|
destroy(): void;
|
|
@@ -21,7 +21,6 @@ var RadioFoundation = class RadioFoundation extends BaseFoundation {
|
|
|
21
21
|
static getInitialState(props) {
|
|
22
22
|
return { checked: typeof props.checked === "boolean" ? props.checked : Boolean(props.defaultChecked) };
|
|
23
23
|
}
|
|
24
|
-
/** How the radio looks and behaves, from its own props or, inside a group, from the group */
|
|
25
24
|
static deriveView(props, state, context) {
|
|
26
25
|
const group = context?.radioGroup;
|
|
27
26
|
if (group) return {
|