@unicom-cloud/ui 0.8.107 → 0.8.108

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.
Files changed (137) hide show
  1. package/ColorPicker.js +15 -14
  2. package/Constant.js +4 -0
  3. package/Copy.js +4 -3
  4. package/Countdown.js +25 -0
  5. package/Grid.js +8 -10
  6. package/LiquidFill.js +4 -3
  7. package/List.js +7 -6
  8. package/Marquee.js +4 -3
  9. package/PageHeader.js +3 -2
  10. package/QrCode.js +4 -3
  11. package/RowCol.js +8 -0
  12. package/Segmented.js +14 -4
  13. package/Statistic.js +5 -4
  14. package/Tour.js +4 -3
  15. package/Transfer.js +4 -2
  16. package/anchor/Link.js +1 -1
  17. package/avatar/Group.js +1 -1
  18. package/button/index.js +52 -51
  19. package/calendar/Lunar.js +21 -21
  20. package/cascader/base/node.js +22 -20
  21. package/cascader/base/store.js +10 -10
  22. package/cascader/util.js +29 -27
  23. package/color-picker/Mode.js +8 -7
  24. package/color-picker/hooks/useColorPicker.js +56 -55
  25. package/color-picker/index.js +54 -53
  26. package/color-picker/utils.js +58 -57
  27. package/components/common/empty/index.js +2 -2
  28. package/components/common/flex/index.js +64 -55
  29. package/components/common/flex/interface.js +6 -6
  30. package/components/common/hooks/useInterval.js +6 -6
  31. package/components/common/space/index.js +53 -53
  32. package/components/common/utils/dayjs.js +75 -62
  33. package/components/common/utils/toArray.js +7 -5
  34. package/constant/index.js +4 -0
  35. package/copy/index.js +2 -1
  36. package/countdown/index.js +113 -0
  37. package/countdown/interface.js +1 -0
  38. package/countdown/util.js +29 -0
  39. package/descriptions/index.js +26 -26
  40. package/dropdown/Button.js +1 -1
  41. package/flex/index.js +30 -29
  42. package/form/FormItem.js +126 -122
  43. package/grid/Grid.js +40 -41
  44. package/grid/Item.js +37 -37
  45. package/grid/context.js +2 -3
  46. package/grid/index.js +6 -8
  47. package/hooks/useResponsiveState.js +54 -0
  48. package/index.js +614 -610
  49. package/input/InputElement.js +25 -24
  50. package/layout/Sider.js +1 -1
  51. package/liquid-fill/index.js +4 -3
  52. package/list/Item.js +21 -21
  53. package/list/index.js +53 -52
  54. package/marquee/index.js +20 -19
  55. package/marquee-/index.js +4 -3
  56. package/mentions/util.js +9 -8
  57. package/package.json +1 -1
  58. package/page-header/index.js +57 -56
  59. package/pagination/Pagination.js +89 -92
  60. package/qr-code/index.js +4 -3
  61. package/radio/Group.js +1 -1
  62. package/row-col/Col-.js +88 -0
  63. package/row-col/Col.js +159 -0
  64. package/row-col/Row.js +73 -0
  65. package/row-col/context.js +5 -0
  66. package/row-col/index.js +11 -0
  67. package/row-col/interface.js +1 -0
  68. package/segmented/index.js +257 -206
  69. package/select/Select.js +191 -191
  70. package/select/util.js +50 -50
  71. package/space/index.js +15 -13
  72. package/statistic/index.js +56 -55
  73. package/statistic/interface.js +4 -1
  74. package/style.css +1 -1
  75. package/table/hook/useColumns.js +27 -26
  76. package/table/hook/useStickyClassNames.js +9 -8
  77. package/table/hook/useThResizable.js +4 -3
  78. package/table/th-resizable/index.js +11 -10
  79. package/table/thead/index.js +18 -16
  80. package/timeline/Item.js +1 -1
  81. package/tour/index.js +4 -3
  82. package/transfer/index.js +93 -91
  83. package/trigger/index.js +66 -66
  84. package/types/common/flex/index.d.ts +3 -9
  85. package/types/common/flex/interface.d.ts +15 -4
  86. package/types/common/space/index.d.ts +3 -5
  87. package/types/common/space/interface.d.ts +2 -0
  88. package/types/common/utils/dayjs.d.ts +3 -1
  89. package/types/pc/button/interface.d.ts +2 -2
  90. package/types/pc/config-provider/interface.d.ts +16 -11
  91. package/types/pc/constant/index.d.ts +1 -0
  92. package/types/pc/countdown/interface.d.ts +65 -0
  93. package/types/pc/countdown/util.d.ts +7 -0
  94. package/types/pc/flex/index.d.ts +8 -6
  95. package/types/pc/flex/interface.d.ts +3 -10
  96. package/types/pc/form/FormItem.d.ts +1 -1
  97. package/types/pc/form/interface.d.ts +1 -1
  98. package/types/pc/grid/Grid.d.ts +1 -2
  99. package/types/pc/grid/Item.d.ts +1 -2
  100. package/types/pc/grid/context.d.ts +0 -5
  101. package/types/pc/grid/index.d.ts +4 -6
  102. package/types/pc/grid/interface.d.ts +7 -125
  103. package/types/pc/hooks/useResponsiveState.d.ts +3 -0
  104. package/types/pc/index.d.ts +7 -3
  105. package/types/pc/list/interface.d.ts +2 -1
  106. package/types/pc/pagination/PageOption.d.ts +0 -1
  107. package/types/pc/pagination/interface.d.ts +5 -6
  108. package/types/pc/{grid → row-col}/Col-.d.ts +1 -1
  109. package/types/pc/{grid → row-col}/Col.d.ts +1 -2
  110. package/types/pc/{grid → row-col}/Row.d.ts +1 -2
  111. package/types/pc/row-col/context.d.ts +6 -0
  112. package/types/pc/row-col/index.d.ts +7 -0
  113. package/types/pc/row-col/interface.d.ts +112 -0
  114. package/types/pc/segmented/index.d.ts +3 -7
  115. package/types/pc/segmented/interface.d.ts +38 -5
  116. package/types/pc/space/index.d.ts +5 -7
  117. package/types/pc/space/interface.d.ts +3 -10
  118. package/types/pc/statistic/index.d.ts +1 -1
  119. package/types/pc/statistic/interface.d.ts +1 -49
  120. package/types/pc/utils/names.d.ts +121 -113
  121. package/types/pc/utils/responsiveObserve.d.ts +8 -8
  122. package/typography/Ellipsis.js +5 -4
  123. package/typography/Operations.js +4 -3
  124. package/utils/dayjs.js +13 -11
  125. package/utils/index.js +244 -242
  126. package/utils/names.js +15 -10
  127. package/utils/responsiveObserve.js +43 -36
  128. package/version/index.js +1 -1
  129. package/grid/Col-.js +0 -86
  130. package/grid/Col.js +0 -169
  131. package/grid/Row.js +0 -96
  132. package/grid/hook/useResponsiveState.js +0 -35
  133. package/statistic/Countdown.js +0 -56
  134. package/statistic/util.js +0 -33
  135. package/types/pc/grid/hook/useResponsiveState.d.ts +0 -2
  136. package/types/pc/statistic/util.d.ts +0 -1
  137. /package/types/pc/{statistic/Countdown.d.ts → countdown/index.d.ts} +0 -0
@@ -0,0 +1,112 @@
1
+ import { CSSProperties, HTMLAttributes } from 'react';
2
+ import type { GridResponsiveBreakpoint } from '../grid/interface';
3
+ export type RowGutter = number | Partial<Record<GridResponsiveBreakpoint, number>>;
4
+ /**
5
+ * @title Row
6
+ */
7
+ export interface RowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className'> {
8
+ style?: CSSProperties;
9
+ className?: string | string[];
10
+ /**
11
+ * @zh
12
+ * 栅格间隔,单位是`px` 栅格间隔。可传入响应式对象写法 { xs: 4, sm: 6, md: 12},传入数组 [ 水平间距, 垂直间距 ] 来设置两个方向。
13
+ * @en
14
+ * Spacing between grids, could be a number or a object like { xs: 8, sm: 16, md: 24}.
15
+ * Or you can use array to make horizontal and vertical spacing work at the same time [horizontal, vertical]
16
+ * @defaultValue 0
17
+ */
18
+ gutter?: RowGutter | Array<RowGutter>;
19
+ /**
20
+ * @zh 开启这个选项 `<Row>` 和 `<Col>` 都会被当作 div 而不会附带任何 Grid 相关的类和样式
21
+ * @en If true, `<Row>` and `<Col>` will be treated as a div without any Grid related classes and styles
22
+ */
23
+ div?: boolean;
24
+ /**
25
+ * @zh 竖直对齐方式 ( `align-items` )
26
+ * @en Vertical alignment, same as css `align-items`
27
+ * @defaultValue start
28
+ */
29
+ align?: 'start' | 'center' | 'end' | 'stretch';
30
+ /**
31
+ * @zh 水平对齐方式 (`justify-content`)
32
+ * @en Horizontal alignment, same as css `justify-content`
33
+ * @defaultValue start
34
+ */
35
+ justify?: 'start' | 'center' | 'end' | 'space-around' | 'space-between';
36
+ }
37
+ /**
38
+ * @title 栅格布局列基础属性
39
+ * @title.en Grid Layout Base Properties
40
+ */
41
+ export interface ColLayout {
42
+ /**
43
+ * @zh 栅格占位格数
44
+ * @en Raster number of cells to occupy
45
+ * @defaultValue 24
46
+ */
47
+ span?: number;
48
+ /**
49
+ * @zh 栅格左侧的间隔格数,间隔内不可以有栅格
50
+ * @en The number of cells to offset Col from the left
51
+ */
52
+ offset?: number;
53
+ order?: number;
54
+ push?: number;
55
+ pull?: number;
56
+ }
57
+ /**
58
+ * @title 栅格响应式断点属性
59
+ * @title.en Grid Responsive Breakpoint Properties
60
+ */
61
+ export interface ColResponsive {
62
+ /**
63
+ * @zh < 576px 响应式栅格
64
+ * @en `screen < 576px`
65
+ */
66
+ xs?: number | ColLayout;
67
+ /**
68
+ * @zh >= 576px 响应式栅格
69
+ * @en `screen >= 576px`
70
+ */
71
+ sm?: number | ColLayout;
72
+ /**
73
+ * @zh >= 768px 响应式栅格
74
+ * @en `screen >= 768px`
75
+ */
76
+ md?: number | ColLayout;
77
+ /**
78
+ * @zh >= 992px 响应式栅格
79
+ * @en `screen >= 992px`
80
+ */
81
+ lg?: number | ColLayout;
82
+ /**
83
+ * @zh >= 1200px 响应式栅格
84
+ * @en `screen >= 1200px`
85
+ */
86
+ xl?: number | ColLayout;
87
+ /**
88
+ * @zh >= 1600px 响应式栅格
89
+ * @en `screen >= 1600px`
90
+ */
91
+ xxl?: number | ColLayout;
92
+ /**
93
+ * @zh >= 2000px 响应式栅格
94
+ * @en `screen >= 2000px`
95
+ */
96
+ xxxl?: number | ColLayout;
97
+ }
98
+ export interface ColProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'ref'>, ColLayout, ColResponsive {
99
+ style?: CSSProperties;
100
+ className?: string | string[];
101
+ /**
102
+ * @zh 自定义断点配置,ColResponsiveProps 合集
103
+ * @en Custom breakpoints configuration
104
+ */
105
+ breakpoints?: ColResponsive;
106
+ /**
107
+ * @zh 设置 flex 布局属性
108
+ * @en Set flex layout properties
109
+ */
110
+ flex?: ColFlexType;
111
+ }
112
+ export type ColFlexType = string | number | 'auto' | 'none';
@@ -1,8 +1,4 @@
1
- import type { SegmentedProps } from './interface';
2
- /**
3
- * Segmented 分段控制器组件
4
- *
5
- * 支持多种样式变体、方向、尺寸和交互模式
6
- */
7
- declare const Segmented: import("react").ForwardRefExoticComponent<SegmentedProps & import("react").RefAttributes<HTMLDivElement>>;
1
+ import React from 'react';
2
+ import type { SegmentedProps, SegmentedRef } from './interface';
3
+ declare const Segmented: React.ForwardRefExoticComponent<SegmentedProps & React.RefAttributes<SegmentedRef>>;
8
4
  export default Segmented;
@@ -1,10 +1,28 @@
1
1
  import { CSSProperties, ReactNode } from 'react';
2
+ export type Value = string | number | undefined;
3
+ export type SegmentedRef = {
4
+ dom: HTMLDivElement | null;
5
+ };
6
+ export interface SizeVariables {
7
+ root: {
8
+ padding: string;
9
+ fontSize: string;
10
+ };
11
+ option: {
12
+ size: string;
13
+ padding: string;
14
+ };
15
+ }
2
16
  /**
3
17
  * 分段控制器选项类型
4
18
  */
5
19
  export interface SegmentedOption {
20
+ /** 自定义样式 */
21
+ style?: CSSProperties;
22
+ /** 自定义类名 */
23
+ className?: string | string[];
6
24
  /** 选项值 */
7
- value: string;
25
+ value: Value;
8
26
  /** 显示文本,不设置则只显示图标 */
9
27
  label?: ReactNode;
10
28
  /** 是否禁用 */
@@ -26,22 +44,26 @@ export interface SegmentedProps {
26
44
  * 分段控制器选项
27
45
  * @description 可以是字符串数组或 SegmentedOption 对象数组
28
46
  */
29
- options: (SegmentedOption | string)[];
47
+ options: (SegmentedOption | Value)[];
30
48
  /**
31
49
  * 默认选中的值
32
50
  * @description 非受控模式下使用
33
51
  */
34
- defaultValue?: string;
52
+ defaultValue?: Value;
35
53
  /**
36
54
  * 当前选中的值
37
55
  * @description 受控模式下使用
38
56
  */
39
- value?: string;
57
+ value?: Value;
40
58
  /**
41
59
  * 尺寸
42
60
  * @defaultValue 'medium'
43
61
  */
44
62
  size?: 'mini' | 'small' | 'medium' | 'large';
63
+ /**
64
+ * 间距
65
+ */
66
+ gap?: number | string;
45
67
  /**
46
68
  * 样式类型
47
69
  * @defaultValue 'default'
@@ -86,9 +108,20 @@ export interface SegmentedProps {
86
108
  * @defaultValue false
87
109
  */
88
110
  immediateTrigger?: boolean;
111
+ /**
112
+ * 是否允许通过键盘快捷键切换方向
113
+ * @default true
114
+ */
115
+ keyboardSwitch?: boolean;
116
+ /**
117
+ * @zh 是否显示分割线
118
+ * @default false
119
+ */
120
+ split?: boolean;
89
121
  /**
90
122
  * 变化时的回调函数
91
123
  * @param value - 当前选中的值
124
+ * @param option - 当前选中的选项对象,当值为 undefined 时为 undefined
92
125
  */
93
- onChange?: (value: string) => void;
126
+ onChange?: (value: Value, option: SegmentedOption | undefined) => void;
94
127
  }
@@ -1,9 +1,7 @@
1
- import React from 'react';
2
- import { SpaceProps } from './interface';
3
- declare const SpaceVertical: React.ForwardRefExoticComponent<SpaceProps & React.RefAttributes<HTMLDivElement>>;
4
- interface SpaceInterface extends React.ForwardRefExoticComponent<SpaceProps & React.RefAttributes<HTMLDivElement>> {
5
- Vertical: typeof SpaceVertical;
6
- }
7
- declare const Space: SpaceInterface;
1
+ import type { SpaceProps, SpaceVerticalProps } from './interface';
2
+ declare const SpaceVertical: import("react").ForwardRefExoticComponent<SpaceVerticalProps & import("react").RefAttributes<HTMLDivElement>>;
3
+ declare const Space: import("react").ForwardRefExoticComponent<SpaceProps & import("react").RefAttributes<HTMLDivElement>> & {
4
+ Vertical: import("react").ForwardRefExoticComponent<SpaceVerticalProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ };
8
6
  export { SpaceVertical };
9
7
  export default Space;
@@ -1,16 +1,9 @@
1
- import { CSSProperties } from 'react';
2
- import { SpaceProps as CommonSpaceProps, SpaceGap } from '../../common/space/interface';
1
+ import { SpaceProps as CommonSpaceProps, SpaceVerticalProps as CommonSpaceVerticalProps, SpaceGap } from '../../common/space/interface';
3
2
  export type { SpaceGap };
4
3
  /**
5
4
  * @title Space
6
5
  */
7
6
  export interface SpaceProps extends CommonSpaceProps {
8
- /**
9
- * 自定义类名
10
- */
11
- className?: string;
12
- /**
13
- * 自定义样式
14
- */
15
- style?: CSSProperties;
7
+ }
8
+ export interface SpaceVerticalProps extends CommonSpaceVerticalProps {
16
9
  }
@@ -1,4 +1,4 @@
1
- import Countdown from './Countdown';
1
+ import Countdown from '../countdown';
2
2
  import { StatisticProps } from './interface';
3
3
  declare const ForwardRefStatistic: import("react").ForwardRefExoticComponent<StatisticProps & import("react").RefAttributes<unknown>>;
4
4
  declare const StatisticComponent: typeof ForwardRefStatistic & {
@@ -1,5 +1,6 @@
1
1
  import { Dayjs } from 'dayjs';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
+ export declare const PREFIX_CLASS_STATISTIC = "statistic";
3
4
  /**
4
5
  * @title Statistic
5
6
  */
@@ -84,52 +85,3 @@ export interface StatisticProps {
84
85
  */
85
86
  loading?: boolean;
86
87
  }
87
- /**
88
- * @title Statistic.Countdown
89
- */
90
- export interface CountdownProps {
91
- style?: CSSProperties;
92
- className?: string | string[];
93
- /**
94
- * @zh 数值的样式
95
- * @en The css style of statistic's value
96
- */
97
- styleValue?: CSSProperties;
98
- /**
99
- * @zh 数值的标题
100
- * @en The title element
101
- */
102
- title?: string | ReactNode;
103
- /**
104
- * @zh 倒计时的时间
105
- * @en To set value
106
- */
107
- value?: number | string | Date | Dayjs;
108
- /**
109
- * @zh [dayjs](https://github.com/iamkun/dayjs)'s format
110
- * @en [dayjs](https://github.com/iamkun/dayjs)'s format
111
- * @defaultValue HH:mm:ss
112
- */
113
- format?: string;
114
- /**
115
- * @zh 自定义 render 函数。`valueDiff` 表示两个时间的时间差,`formattedDiff` 表示格式化后的时间差,
116
- * @en Custom render function, the input parameter is the result formatted by `dayjs`
117
- */
118
- renderFormat?: (valueDiff: number, formattedDiff: string) => ReactNode;
119
- /**
120
- * @zh 倒计时完成后触发的回调
121
- * @en Callback at the end of the countdown
122
- */
123
- onFinish?: () => void;
124
- /**
125
- * @zh 是否开始倒计时,默认为 `true`,可以通过设置该值控制倒计时的时机
126
- * @en Whether to start the countdown
127
- * @defaultValue true
128
- */
129
- start?: boolean;
130
- /**
131
- * @zh 用于修正初始化时间显示不正确
132
- * @en The current time. Used to correct the initialization time
133
- */
134
- now?: number | string | Date | Dayjs;
135
- }