@rockshin/tao-ui 0.0.47 → 0.0.49

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 (144) hide show
  1. package/dist/components/affix/affix.js +20 -16
  2. package/dist/components/alert/alert.js +114 -99
  3. package/dist/components/app/app-modals.js +134 -96
  4. package/dist/components/app/app-notices.js +39 -23
  5. package/dist/components/auto-complete/auto-complete.js +21 -7
  6. package/dist/components/avatar/avatar.js +31 -11
  7. package/dist/components/badge/badge.css +1 -1
  8. package/dist/components/badge/badge.js +72 -257
  9. package/dist/components/border-beam/border-beam.js +21 -17
  10. package/dist/components/breadcrumb/breadcrumb.js +178 -159
  11. package/dist/components/button/button.js +61 -53
  12. package/dist/components/calendar/calendar.js +6 -4
  13. package/dist/components/card/card.js +24 -8
  14. package/dist/components/carousel/carousel.d.ts +1 -1
  15. package/dist/components/carousel/carousel.js +105 -68
  16. package/dist/components/cascader/cascader.js +54 -19
  17. package/dist/components/checkbox/checkbox.css +13 -2
  18. package/dist/components/checkbox/checkbox.d.ts +2 -0
  19. package/dist/components/checkbox/checkbox.js +320 -229
  20. package/dist/components/collapse/collapse-panels.d.ts +1 -1
  21. package/dist/components/collapse/collapse-panels.js +122 -113
  22. package/dist/components/collapse/collapse.js +98 -63
  23. package/dist/components/color-picker/color-picker.js +539 -441
  24. package/dist/components/color-picker/color.js +1 -1
  25. package/dist/components/context-menu/context-menu.d.ts +1 -1
  26. package/dist/components/context-menu/context-menu.js +108 -68
  27. package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
  28. package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
  29. package/dist/components/date-picker/calendar/month-grid.js +79 -37
  30. package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
  31. package/dist/components/date-picker/calendar/time-panel.js +94 -89
  32. package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
  33. package/dist/components/date-picker/calendar/year-grid.js +66 -35
  34. package/dist/components/date-picker/date-picker.css +24 -1
  35. package/dist/components/date-picker/date-picker.js +99 -53
  36. package/dist/components/date-picker/presets.d.ts +2 -1
  37. package/dist/components/date-picker/presets.js +27 -24
  38. package/dist/components/date-picker/range-picker.js +308 -153
  39. package/dist/components/descriptions/descriptions.js +7 -3
  40. package/dist/components/divider/divider.css +1 -1
  41. package/dist/components/divider/divider.js +1 -1
  42. package/dist/components/drawer/drawer.js +201 -369
  43. package/dist/components/dropdown/dropdown.d.ts +1 -1
  44. package/dist/components/dropdown/dropdown.js +183 -279
  45. package/dist/components/empty/empty.js +57 -78
  46. package/dist/components/float-button/float-button.d.ts +1 -0
  47. package/dist/components/float-button/float-button.js +47 -30
  48. package/dist/components/form/field-control.d.ts +4 -2
  49. package/dist/components/form/field-control.js +17 -9
  50. package/dist/components/form/form-context.d.ts +8 -2
  51. package/dist/components/form/form-context.js +2 -1
  52. package/dist/components/form/form-item.js +85 -63
  53. package/dist/components/form/form.css +3 -2
  54. package/dist/components/form/use-form.d.ts +2 -1
  55. package/dist/components/form/use-form.js +2 -1
  56. package/dist/components/form-field/form-field-view.d.ts +3 -1
  57. package/dist/components/form-field/form-field-view.js +194 -141
  58. package/dist/components/form-section/form-section.d.ts +1 -1
  59. package/dist/components/form-section/form-section.js +52 -45
  60. package/dist/components/image/image.js +585 -477
  61. package/dist/components/input/base-input.js +8 -9
  62. package/dist/components/input/input-shared.d.ts +5 -2
  63. package/dist/components/input/input-shared.js +42 -18
  64. package/dist/components/input/otp.js +236 -217
  65. package/dist/components/input/password.js +2 -1
  66. package/dist/components/input/search.js +8 -7
  67. package/dist/components/list/list-pagination.js +41 -36
  68. package/dist/components/list/list.js +141 -125
  69. package/dist/components/listy/listy.js +175 -106
  70. package/dist/components/masonry/masonry.js +108 -85
  71. package/dist/components/mentions/mentions.js +12 -3
  72. package/dist/components/menu/menu-render.d.ts +9 -3
  73. package/dist/components/menu/menu-render.js +99 -36
  74. package/dist/components/modal/confirm-dialog.js +10 -4
  75. package/dist/components/modal/confirm.js +3 -7
  76. package/dist/components/modal/index.js +9 -3
  77. package/dist/components/modal/modal.js +390 -365
  78. package/dist/components/pagination/pagination.js +105 -96
  79. package/dist/components/popconfirm/popconfirm.d.ts +1 -1
  80. package/dist/components/popconfirm/popconfirm.js +219 -168
  81. package/dist/components/popover/popover.js +330 -243
  82. package/dist/components/progress/progress.css +2 -2
  83. package/dist/components/progress/progress.js +232 -458
  84. package/dist/components/qr-code/qr-code.js +72 -66
  85. package/dist/components/radio/radio.css +15 -4
  86. package/dist/components/radio/radio.d.ts +2 -1
  87. package/dist/components/radio/radio.js +260 -198
  88. package/dist/components/rate/rate.js +173 -113
  89. package/dist/components/scroll-area/scroll-area.js +241 -211
  90. package/dist/components/segmented/segmented.js +73 -41
  91. package/dist/components/select/mobile-select.d.ts +2 -1
  92. package/dist/components/select/mobile-select.js +24 -13
  93. package/dist/components/select/select-searchable-list.d.ts +2 -1
  94. package/dist/components/select/select-searchable-list.js +2 -3
  95. package/dist/components/select/select.js +49 -25
  96. package/dist/components/select/use-select-selection.d.ts +1 -1
  97. package/dist/components/select/use-select-selection.js +7 -4
  98. package/dist/components/skeleton/skeleton.js +56 -48
  99. package/dist/components/slider/slider.js +87 -212
  100. package/dist/components/sonner/sonner.js +109 -93
  101. package/dist/components/spinner/spinner.js +147 -138
  102. package/dist/components/splitter/splitter.js +222 -159
  103. package/dist/components/statistic/statistic.js +7 -6
  104. package/dist/components/steps/steps.js +88 -81
  105. package/dist/components/steps/use-display-steps.js +1 -1
  106. package/dist/components/switch/switch.js +89 -89
  107. package/dist/components/table/table-filter.js +66 -56
  108. package/dist/components/table/table-icons.d.ts +2 -1
  109. package/dist/components/table/table-icons.js +11 -9
  110. package/dist/components/table/table-model.js +1 -1
  111. package/dist/components/table/table.js +107 -83
  112. package/dist/components/table/use-table-data.d.ts +6 -3
  113. package/dist/components/table/use-table-data.js +166 -130
  114. package/dist/components/tabs/tabs.css +1 -1
  115. package/dist/components/tabs/tabs.js +236 -179
  116. package/dist/components/tag/tag.d.ts +2 -2
  117. package/dist/components/tag/tag.js +111 -108
  118. package/dist/components/textarea/textarea.js +22 -17
  119. package/dist/components/time-picker/time-picker.js +5 -3
  120. package/dist/components/timeline/timeline.css +6 -1
  121. package/dist/components/timeline/timeline.js +21 -11
  122. package/dist/components/tooltip/tooltip.d.ts +2 -2
  123. package/dist/components/tooltip/tooltip.js +123 -233
  124. package/dist/components/tour/tour.css +4 -0
  125. package/dist/components/tour/tour.js +400 -331
  126. package/dist/components/transfer/transfer-list.js +29 -11
  127. package/dist/components/transfer/transfer-parts.js +1 -1
  128. package/dist/components/transfer/transfer-types.d.ts +1 -0
  129. package/dist/components/transfer/transfer.js +29 -14
  130. package/dist/components/tree/tree-keyboard.d.ts +1 -1
  131. package/dist/components/tree/tree-keyboard.js +5 -3
  132. package/dist/components/tree/tree.js +74 -59
  133. package/dist/components/tree-select/select-engine.d.ts +3 -2
  134. package/dist/components/tree-select/select-engine.js +18 -16
  135. package/dist/components/tree-select/tree-select.js +21 -5
  136. package/dist/components/upload/upload.css +8 -0
  137. package/dist/components/upload/upload.js +160 -72
  138. package/dist/components/watermark/watermark.js +36 -29
  139. package/dist/number-input/use-number-input.js +129 -90
  140. package/dist/number-input/validate.js +32 -5
  141. package/dist/provider/merge-locale.js +12 -9
  142. package/dist/provider/tao-provider.d.ts +3 -1
  143. package/dist/provider/tao-provider.js +123 -86
  144. package/package.json +1 -1
@@ -1,11 +1,20 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { forwardRef, useId } from "react";
4
- import { useTaoConfig } from "../../provider/tao-provider.js";
3
+ import { forwardRef, useId, useMemo } from "react";
4
+ import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
5
+ import { mergeRefs } from "../../utils/refs.js";
5
6
  import { cx } from "../../utils/semantic.js";
6
7
  import { Tooltip } from "../tooltip/tooltip.js";
7
8
  import "./progress.css";
8
9
  const clamp = (percent = 0)=>Math.min(100, Math.max(0, percent || 0));
10
+ function formatPercent(percent, locale) {
11
+ const [digits, exponent = '0'] = String(percent).split('e');
12
+ const fractionDigits = (digits.split('.')[1]?.length ?? 0) - Number(exponent);
13
+ return new Intl.NumberFormat(locale ?? 'en-US', {
14
+ style: 'percent',
15
+ maximumFractionDigits: Math.min(20, Math.max(0, fractionDigits))
16
+ }).format(percent / 100);
17
+ }
9
18
  function gradientStops(gradient) {
10
19
  if ('from' in gradient && 'to' in gradient) return [
11
20
  {
@@ -56,20 +65,19 @@ function StatusIcon(t0) {
56
65
  return t2;
57
66
  }
58
67
  const progress_Progress = /*#__PURE__*/ forwardRef(function(props, ref) {
59
- const $ = c(105);
60
- const { prefixCls: t0, className, rootClassName, style, classNames, styles, type: t1, percent: t2, status, showInfo: t3, format, strokeWidth, strokeLinecap: t4, strokeColor, railColor, trailColor, success, width, gapDegree, gapPlacement, gapPosition, steps, percentPosition: t5, rounding: t6 } = props;
61
- const prefixCls = void 0 === t0 ? "tao-progress" : t0;
62
- const type = void 0 === t1 ? "line" : t1;
63
- const percent = void 0 === t2 ? 0 : t2;
64
- const showInfo = void 0 === t3 ? true : t3;
65
- const strokeLinecap = void 0 === t4 ? "round" : t4;
66
- const percentPosition = void 0 === t5 ? {} : t5;
67
- const rounding = void 0 === t6 ? Math.round : t6;
68
- const { size: contextSize } = useTaoConfig();
69
- const size = props.size ?? ("line" === type ? "small" === contextSize ? "small" : "medium" : width ?? ("small" === contextSize ? "small" : "medium"));
68
+ const { prefixCls = 'tao-progress', className, rootClassName, style, classNames, styles, type = 'line', percent = 0, status, showInfo = true, format, strokeWidth, strokeLinecap = 'round', strokeColor, railColor, trailColor, success, width, gapDegree, gapPlacement, gapPosition, steps, percentPosition = {}, rounding = Math.round } = props;
69
+ const { size: contextSize, locale } = useTaoConfig();
70
+ const [direction, directionRef] = useTaoDirection();
71
+ const logicalGap = 'line' !== type && ('start' === gapPlacement || 'end' === gapPlacement);
72
+ const rootRef = useMemo(()=>logicalGap ? mergeRefs(ref, directionRef) : ref, [
73
+ logicalGap,
74
+ ref,
75
+ directionRef
76
+ ]);
77
+ const size = props.size ?? ('line' === type ? 'small' === contextSize ? 'small' : 'medium' : width ?? ('small' === contextSize ? 'small' : 'medium'));
70
78
  const value = clamp(percent);
71
79
  const successValue = clamp(success?.percent);
72
- const resolvedStatus = status ?? ((success?.percent ?? percent) >= 100 ? "success" : "normal");
80
+ const resolvedStatus = status ?? ((success?.percent ?? percent) >= 100 ? 'success' : 'normal');
73
81
  const resolvedProps = {
74
82
  ...props,
75
83
  type,
@@ -78,490 +86,256 @@ const progress_Progress = /*#__PURE__*/ forwardRef(function(props, ref) {
78
86
  showInfo,
79
87
  percentPosition
80
88
  };
81
- const names = "function" == typeof classNames ? classNames({
89
+ const names = 'function' == typeof classNames ? classNames({
82
90
  props: resolvedProps
83
91
  }) : classNames;
84
- const slots = "function" == typeof styles ? styles({
92
+ const slots = 'function' == typeof styles ? styles({
85
93
  props: resolvedProps
86
94
  }) : styles;
87
95
  const color = Array.isArray(strokeColor) ? strokeColor[0] : strokeColor;
88
- const gradient = color && "object" == typeof color ? color : void 0;
96
+ const gradient = color && 'object' == typeof color ? color : void 0;
89
97
  const stops = gradient ? gradientStops(gradient) : [];
90
- const t7 = useId();
91
- let t8;
92
- if ($[0] !== t7) {
93
- let t9;
94
- if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
95
- t9 = /:/g;
96
- $[2] = t9;
97
- } else t9 = $[2];
98
- t8 = t7.replace(t9, "");
99
- $[0] = t7;
100
- $[1] = t8;
101
- } else t8 = $[1];
102
- const gradientId = `tao-progress-${t8}`;
103
- const trackColor = "string" == typeof color ? color : void 0;
98
+ const gradientId = `tao-progress-${useId().replace(/:/g, '')}`;
99
+ const trackColor = 'string' == typeof color ? color : void 0;
104
100
  const rail = railColor ?? trailColor;
105
- const infoPosition = percentPosition.type ?? "outer";
106
- const infoAlign = percentPosition.align ?? "end";
107
- const count = "number" == typeof steps ? steps : steps?.count;
108
- const radiusStyle = "round" === strokeLinecap ? void 0 : 0;
101
+ const infoPosition = percentPosition.type ?? 'outer';
102
+ const infoAlign = percentPosition.align ?? 'end';
103
+ const count = 'number' == typeof steps ? steps : steps?.count;
104
+ const roundSteps = 'line' === type ? rounding : Math.round;
105
+ const filledSteps = count ? roundSteps(count * value / 100) : 0;
106
+ const successSteps = count && successValue > 0 ? Math.min(filledSteps, roundSteps(count * successValue / 100)) : 0;
107
+ const radiusStyle = 'round' === strokeLinecap ? void 0 : 0;
109
108
  const info = showInfo ? /*#__PURE__*/ jsx("span", {
110
109
  "data-tao-progress-indicator": "",
111
110
  className: cx(`${prefixCls}-indicator`, names?.indicator),
112
111
  style: slots?.indicator,
113
- children: format ? format(value, successValue) : "inner" === infoPosition || "normal" === resolvedStatus || "active" === resolvedStatus ? `${value}%` : /*#__PURE__*/ jsx(StatusIcon, {
112
+ children: format ? format(value, successValue) : 'inner' === infoPosition || 'normal' === resolvedStatus || 'active' === resolvedStatus ? formatPercent(value, locale.numberLocale) : /*#__PURE__*/ jsx(StatusIcon, {
114
113
  status: resolvedStatus
115
114
  })
116
115
  }) : null;
117
116
  let content;
118
- if ("line" === type) {
119
- const isNumeric = "number" == typeof size;
120
- let t9;
121
- if ($[3] !== size) {
122
- t9 = Array.isArray(size) ? size : "object" == typeof size ? [
123
- size.width,
124
- size.height
125
- ] : void 0;
126
- $[3] = size;
127
- $[4] = t9;
128
- } else t9 = $[4];
129
- const dimensions = t9;
117
+ if ('line' === type) {
118
+ const isNumeric = 'number' == typeof size;
119
+ const dimensions = Array.isArray(size) ? size : 'object' == typeof size ? [
120
+ size.width,
121
+ size.height
122
+ ] : void 0;
130
123
  const lineWidth = isNumeric ? size : dimensions?.[0];
131
- const height = isNumeric ? size : dimensions?.[1] ?? strokeWidth ?? ("small" !== size || count ? 8 : 6);
124
+ const height = isNumeric ? size : dimensions?.[1] ?? strokeWidth ?? ('small' !== size || count ? 8 : 6);
132
125
  if (count) {
133
- const unitWidth = lineWidth ?? ("small" === size ? 2 : 14);
134
- const filled = rounding(count * value / 100);
135
- let t10;
136
- if ($[5] !== count) {
137
- t10 = Array.from({
138
- length: count
139
- }, _temp);
140
- $[5] = count;
141
- $[6] = t10;
142
- } else t10 = $[6];
143
- const stepNumbers = t10;
144
- const t11 = `${prefixCls}-body`;
145
- const t12 = names?.body;
146
- let t13;
147
- if ($[7] !== t11 || $[8] !== t12) {
148
- t13 = cx(t11, t12);
149
- $[7] = t11;
150
- $[8] = t12;
151
- $[9] = t13;
152
- } else t13 = $[9];
153
- const t14 = slots?.body;
154
- let t15;
155
- if ($[10] !== filled || $[11] !== height || $[12] !== names?.track || $[13] !== prefixCls || $[14] !== radiusStyle || $[15] !== rail || $[16] !== slots?.track || $[17] !== stepNumbers || $[18] !== strokeColor || $[19] !== trackColor || $[20] !== unitWidth) {
156
- t15 = stepNumbers.map((index_0)=>/*#__PURE__*/ jsx("span", {
157
- "data-tao-progress-step": "",
158
- "data-tao-active": index_0 < filled || void 0,
159
- className: cx(`${prefixCls}-steps-item`, names?.track),
126
+ const unitWidth = lineWidth ?? ('small' === size ? 2 : 14);
127
+ const stepNumbers = Array.from({
128
+ length: count
129
+ }, (_, index)=>index);
130
+ content = /*#__PURE__*/ jsxs("div", {
131
+ "data-tao-progress-body": "",
132
+ "data-tao-progress-steps": "",
133
+ className: cx(`${prefixCls}-body`, names?.body),
134
+ style: slots?.body,
135
+ children: [
136
+ stepNumbers.map((index_0)=>/*#__PURE__*/ jsx("span", {
137
+ "data-tao-progress-step": "",
138
+ "data-tao-active": index_0 < filledSteps || void 0,
139
+ "data-tao-success": index_0 < successSteps || void 0,
140
+ className: cx(`${prefixCls}-steps-item`, names?.track),
141
+ style: {
142
+ width: unitWidth,
143
+ height,
144
+ borderRadius: radiusStyle,
145
+ background: index_0 < successSteps ? success?.strokeColor : index_0 < filledSteps ? Array.isArray(strokeColor) ? strokeColor[index_0] : trackColor : rail,
146
+ ...slots?.track
147
+ }
148
+ }, `step-${index_0}`)),
149
+ info
150
+ ]
151
+ });
152
+ } else {
153
+ const background = gradient ? `linear-gradient(${gradient.direction ?? 'to right'}, ${stops.map((stop)=>`${stop.color} ${stop.offset}%`).join(', ')})` : trackColor;
154
+ content = /*#__PURE__*/ jsxs("div", {
155
+ "data-tao-progress-body": "",
156
+ className: cx(`${prefixCls}-body`, names?.body),
157
+ style: {
158
+ width: lineWidth ?? '100%',
159
+ ...slots?.body
160
+ },
161
+ children: [
162
+ /*#__PURE__*/ jsxs("div", {
163
+ "data-tao-progress-rail": "",
164
+ className: cx(`${prefixCls}-rail`, names?.rail),
160
165
  style: {
161
- width: unitWidth,
162
166
  height,
163
167
  borderRadius: radiusStyle,
164
- background: index_0 < filled ? Array.isArray(strokeColor) ? strokeColor[index_0] : trackColor : rail,
165
- ...slots?.track
166
- }
167
- }, `step-${index_0}`));
168
- $[10] = filled;
169
- $[11] = height;
170
- $[12] = names?.track;
171
- $[13] = prefixCls;
172
- $[14] = radiusStyle;
173
- $[15] = rail;
174
- $[16] = slots?.track;
175
- $[17] = stepNumbers;
176
- $[18] = strokeColor;
177
- $[19] = trackColor;
178
- $[20] = unitWidth;
179
- $[21] = t15;
180
- } else t15 = $[21];
181
- let t16;
182
- if ($[22] !== info || $[23] !== t13 || $[24] !== t14 || $[25] !== t15) {
183
- t16 = /*#__PURE__*/ jsxs("div", {
184
- "data-tao-progress-body": "",
185
- "data-tao-progress-steps": "",
186
- className: t13,
187
- style: t14,
188
- children: [
189
- t15,
190
- info
191
- ]
192
- });
193
- $[22] = info;
194
- $[23] = t13;
195
- $[24] = t14;
196
- $[25] = t15;
197
- $[26] = t16;
198
- } else t16 = $[26];
199
- content = t16;
200
- } else {
201
- const background = gradient ? `linear-gradient(${gradient.direction ?? "to right"}, ${stops.map(_temp2).join(", ")})` : trackColor;
202
- const t10 = `${prefixCls}-body`;
203
- const t11 = names?.body;
204
- let t12;
205
- if ($[27] !== t10 || $[28] !== t11) {
206
- t12 = cx(t10, t11);
207
- $[27] = t10;
208
- $[28] = t11;
209
- $[29] = t12;
210
- } else t12 = $[29];
211
- const t13 = lineWidth ?? "100%";
212
- const t14 = slots?.body;
213
- let t15;
214
- if ($[30] !== t13 || $[31] !== t14) {
215
- t15 = {
216
- width: t13,
217
- ...t14
218
- };
219
- $[30] = t13;
220
- $[31] = t14;
221
- $[32] = t15;
222
- } else t15 = $[32];
223
- const t16 = `${prefixCls}-rail`;
224
- const t17 = names?.rail;
225
- let t18;
226
- if ($[33] !== t16 || $[34] !== t17) {
227
- t18 = cx(t16, t17);
228
- $[33] = t16;
229
- $[34] = t17;
230
- $[35] = t18;
231
- } else t18 = $[35];
232
- const t19 = slots?.rail;
233
- let t20;
234
- if ($[36] !== height || $[37] !== radiusStyle || $[38] !== rail || $[39] !== t19) {
235
- t20 = {
236
- height,
237
- borderRadius: radiusStyle,
238
- background: rail,
239
- ...t19
240
- };
241
- $[36] = height;
242
- $[37] = radiusStyle;
243
- $[38] = rail;
244
- $[39] = t19;
245
- $[40] = t20;
246
- } else t20 = $[40];
247
- const t21 = `${prefixCls}-track`;
248
- const t22 = names?.track;
249
- let t23;
250
- if ($[41] !== t21 || $[42] !== t22) {
251
- t23 = cx(t21, t22);
252
- $[41] = t21;
253
- $[42] = t22;
254
- $[43] = t23;
255
- } else t23 = $[43];
256
- const t24 = `${value}%`;
257
- const t25 = slots?.track;
258
- let t26;
259
- if ($[44] !== background || $[45] !== radiusStyle || $[46] !== t24 || $[47] !== t25) {
260
- t26 = {
261
- width: t24,
262
- borderRadius: radiusStyle,
263
- background,
264
- ...t25
265
- };
266
- $[44] = background;
267
- $[45] = radiusStyle;
268
- $[46] = t24;
269
- $[47] = t25;
270
- $[48] = t26;
271
- } else t26 = $[48];
272
- let t27;
273
- if ($[49] !== t23 || $[50] !== t26) {
274
- t27 = /*#__PURE__*/ jsx("div", {
275
- "data-tao-progress-track": "",
276
- className: t23,
277
- style: t26
278
- });
279
- $[49] = t23;
280
- $[50] = t26;
281
- $[51] = t27;
282
- } else t27 = $[51];
283
- const t28 = success?.percent !== void 0 && /*#__PURE__*/ jsx("div", {
284
- "data-tao-progress-track": "",
285
- "data-tao-success": "",
286
- className: cx(`${prefixCls}-track`, `${prefixCls}-track-success`, names?.track),
287
- style: {
288
- width: `${successValue}%`,
289
- borderRadius: radiusStyle,
290
- background: success.strokeColor,
291
- ...slots?.track
292
- }
168
+ background: rail,
169
+ ...slots?.rail
170
+ },
171
+ children: [
172
+ /*#__PURE__*/ jsx("div", {
173
+ "data-tao-progress-track": "",
174
+ className: cx(`${prefixCls}-track`, names?.track),
175
+ style: {
176
+ width: `${value}%`,
177
+ borderRadius: radiusStyle,
178
+ background,
179
+ ...slots?.track
180
+ }
181
+ }),
182
+ success?.percent !== void 0 && /*#__PURE__*/ jsx("div", {
183
+ "data-tao-progress-track": "",
184
+ "data-tao-success": "",
185
+ className: cx(`${prefixCls}-track`, `${prefixCls}-track-success`, names?.track),
186
+ style: {
187
+ width: `${successValue}%`,
188
+ borderRadius: radiusStyle,
189
+ background: success.strokeColor,
190
+ ...slots?.track
191
+ }
192
+ }),
193
+ 'inner' === infoPosition && info
194
+ ]
195
+ }),
196
+ 'outer' === infoPosition && info
197
+ ]
293
198
  });
294
- const t29 = "inner" === infoPosition && info;
295
- let t30;
296
- if ($[52] !== t18 || $[53] !== t20 || $[54] !== t27 || $[55] !== t28 || $[56] !== t29) {
297
- t30 = /*#__PURE__*/ jsxs("div", {
298
- "data-tao-progress-rail": "",
299
- className: t18,
300
- style: t20,
301
- children: [
302
- t27,
303
- t28,
304
- t29
305
- ]
306
- });
307
- $[52] = t18;
308
- $[53] = t20;
309
- $[54] = t27;
310
- $[55] = t28;
311
- $[56] = t29;
312
- $[57] = t30;
313
- } else t30 = $[57];
314
- const t31 = "outer" === infoPosition && info;
315
- let t32;
316
- if ($[58] !== t12 || $[59] !== t15 || $[60] !== t30 || $[61] !== t31) {
317
- t32 = /*#__PURE__*/ jsxs("div", {
318
- "data-tao-progress-body": "",
319
- className: t12,
320
- style: t15,
321
- children: [
322
- t30,
323
- t31
324
- ]
325
- });
326
- $[58] = t12;
327
- $[59] = t15;
328
- $[60] = t30;
329
- $[61] = t31;
330
- $[62] = t32;
331
- } else t32 = $[62];
332
- content = t32;
333
199
  }
334
200
  } else {
335
- const diameter = "number" == typeof size ? size : Array.isArray(size) ? size[0] : "object" == typeof size ? size.width ?? size.height ?? 120 : "small" === size ? 60 : 120;
336
- const numericDiameter = "number" == typeof diameter ? diameter : 120;
337
- const thickness = strokeWidth ?? Math.max(300 / numericDiameter, 6);
201
+ const diameter = 'number' == typeof size ? size : Array.isArray(size) ? size[0] : 'object' == typeof size ? size.width ?? size.height ?? 120 : 'small' === size ? 60 : 120;
202
+ const numericDiameter = 'number' == typeof diameter ? diameter : 120;
203
+ const thickness = strokeWidth ?? Math.min(50, Math.max(300 / numericDiameter, 6));
338
204
  const radius = 50 - thickness / 2;
339
- const gap = Math.min(295, Math.max(0, gapDegree ?? ("dashboard" === type ? 75 : 0)));
340
- const placement = gapPlacement ?? gapPosition ?? "bottom";
341
- const center = "top" === placement ? 270 : "left" === placement || "start" === placement ? 180 : "right" === placement || "end" === placement ? 0 : 90;
205
+ const gap = Math.min(295, Math.max(0, gapDegree ?? ('dashboard' === type ? 75 : 0)));
206
+ const placement = gapPlacement ?? gapPosition ?? 'bottom';
207
+ const center = {
208
+ top: 270,
209
+ bottom: 90,
210
+ left: 180,
211
+ right: 0,
212
+ start: 'rtl' === direction ? 0 : 180,
213
+ end: 'rtl' === direction ? 180 : 0
214
+ }[placement];
342
215
  const start = gap ? center + gap / 2 : -90;
343
216
  const sweep = 360 - gap;
344
- let t9;
345
- if ($[63] !== radius || $[64] !== start || $[65] !== sweep) {
346
- t9 = arcPath(radius, start, sweep);
347
- $[63] = radius;
348
- $[64] = start;
349
- $[65] = sweep;
350
- $[66] = t9;
351
- } else t9 = $[66];
352
- const path = t9;
217
+ const path = arcPath(radius, start, sweep);
353
218
  const circleStroke = gradient ? `url(#${gradientId})` : trackColor;
354
219
  const stepNumbers_0 = Array.from({
355
220
  length: count ?? 0
356
- }, _temp3);
357
- const stepGap = "object" == typeof steps ? steps.gap : 2;
221
+ }, (__0, index_1)=>index_1);
222
+ const stepGap = 'object' == typeof steps ? steps.gap : 2;
358
223
  const gapAngle = 180 * stepGap / (Math.PI * radius);
359
- const filled_0 = count ? Math.round(count * clamp(value - successValue) / 100) : 0;
360
- const t10 = numericDiameter <= 20 || void 0;
361
- const t11 = `${prefixCls}-body`;
362
- const t12 = names?.body;
363
- let t13;
364
- if ($[67] !== t11 || $[68] !== t12) {
365
- t13 = cx(t11, t12);
366
- $[67] = t11;
367
- $[68] = t12;
368
- $[69] = t13;
369
- } else t13 = $[69];
370
- const t14 = 0.15 * numericDiameter + 6;
371
- const t15 = slots?.body;
372
- let t16;
373
- if ($[70] !== diameter || $[71] !== t14 || $[72] !== t15) {
374
- t16 = {
224
+ const circleContent = /*#__PURE__*/ jsxs("div", {
225
+ "data-tao-progress-body": "",
226
+ "data-tao-small-circle": numericDiameter <= 20 || void 0,
227
+ "data-tao-gap-placement": placement,
228
+ className: cx(`${prefixCls}-body`, names?.body),
229
+ style: {
375
230
  width: diameter,
376
231
  height: diameter,
377
- fontSize: t14,
378
- ...t15
379
- };
380
- $[70] = diameter;
381
- $[71] = t14;
382
- $[72] = t15;
383
- $[73] = t16;
384
- } else t16 = $[73];
385
- const t17 = gradient && /*#__PURE__*/ jsx("defs", {
386
- children: /*#__PURE__*/ jsx("linearGradient", {
387
- id: gradientId,
388
- x1: "0",
389
- y1: "0",
390
- x2: "1",
391
- y2: "0",
392
- children: stops.map(_temp4)
393
- })
394
- });
395
- const t18 = count ? stepNumbers_0.map((index_2)=>/*#__PURE__*/ jsx("path", {
396
- "data-tao-progress-step": "",
397
- "data-tao-active": index_2 < filled_0 || void 0,
398
- d: arcPath(radius, start + index_2 * sweep / count + gapAngle / 2, Math.max(0, sweep / count - gapAngle)),
399
- className: cx(`${prefixCls}-track`, names?.track),
400
- strokeWidth: thickness,
401
- strokeLinecap: "butt",
402
- style: {
403
- stroke: index_2 < filled_0 ? circleStroke : rail,
404
- ...slots?.track
405
- }
406
- }, `step-${index_2}`)) : /*#__PURE__*/ jsxs(Fragment, {
232
+ fontSize: 0.15 * numericDiameter + 6,
233
+ ...slots?.body
234
+ },
407
235
  children: [
408
- /*#__PURE__*/ jsx("path", {
409
- "data-tao-progress-rail": "",
410
- className: cx(`${prefixCls}-rail`, names?.rail),
411
- d: path,
412
- pathLength: "100",
413
- strokeWidth: thickness,
414
- strokeLinecap: strokeLinecap,
415
- style: {
416
- stroke: rail,
417
- ...slots?.rail
418
- }
419
- }),
420
- value > 0 && /*#__PURE__*/ jsx("path", {
421
- "data-tao-progress-track": "",
422
- className: cx(`${prefixCls}-track`, names?.track),
423
- d: path,
424
- pathLength: "100",
425
- strokeWidth: thickness,
426
- strokeLinecap: strokeLinecap,
427
- strokeDasharray: `${value} 100`,
428
- style: {
429
- stroke: circleStroke,
430
- ...slots?.track
431
- }
236
+ /*#__PURE__*/ jsxs("svg", {
237
+ "data-tao-progress-circle": "",
238
+ viewBox: "0 0 100 100",
239
+ fill: "none",
240
+ "aria-hidden": "true",
241
+ children: [
242
+ gradient && /*#__PURE__*/ jsx("defs", {
243
+ children: /*#__PURE__*/ jsx("linearGradient", {
244
+ id: gradientId,
245
+ x1: "0",
246
+ y1: "0",
247
+ x2: "1",
248
+ y2: "0",
249
+ children: stops.map((stop_0)=>/*#__PURE__*/ jsx("stop", {
250
+ offset: `${stop_0.offset}%`,
251
+ stopColor: stop_0.color
252
+ }, stop_0.offset))
253
+ })
254
+ }),
255
+ count ? stepNumbers_0.map((index_2)=>/*#__PURE__*/ jsx("path", {
256
+ "data-tao-progress-step": "",
257
+ "data-tao-active": index_2 < filledSteps || void 0,
258
+ "data-tao-success": index_2 < successSteps || void 0,
259
+ d: arcPath(radius, start + index_2 * sweep / count + gapAngle / 2, Math.max(0, sweep / count - gapAngle)),
260
+ className: cx(`${prefixCls}-track`, names?.track),
261
+ strokeWidth: thickness,
262
+ strokeLinecap: "butt",
263
+ style: {
264
+ stroke: index_2 < successSteps ? success?.strokeColor : index_2 < filledSteps ? Array.isArray(strokeColor) ? strokeColor[index_2] : circleStroke : rail,
265
+ ...slots?.track
266
+ }
267
+ }, `step-${index_2}`)) : /*#__PURE__*/ jsxs(Fragment, {
268
+ children: [
269
+ /*#__PURE__*/ jsx("path", {
270
+ "data-tao-progress-rail": "",
271
+ className: cx(`${prefixCls}-rail`, names?.rail),
272
+ d: path,
273
+ pathLength: "100",
274
+ strokeWidth: thickness,
275
+ strokeLinecap: strokeLinecap,
276
+ style: {
277
+ stroke: rail,
278
+ ...slots?.rail
279
+ }
280
+ }),
281
+ value > 0 && /*#__PURE__*/ jsx("path", {
282
+ "data-tao-progress-track": "",
283
+ className: cx(`${prefixCls}-track`, names?.track),
284
+ d: path,
285
+ pathLength: "100",
286
+ strokeWidth: thickness,
287
+ strokeLinecap: strokeLinecap,
288
+ strokeDasharray: `${value} 100`,
289
+ style: {
290
+ stroke: circleStroke,
291
+ ...slots?.track
292
+ }
293
+ }),
294
+ successValue > 0 && /*#__PURE__*/ jsx("path", {
295
+ "data-tao-progress-track": "",
296
+ "data-tao-success": "",
297
+ className: cx(`${prefixCls}-track`, names?.track),
298
+ d: path,
299
+ pathLength: "100",
300
+ strokeWidth: thickness,
301
+ strokeLinecap: strokeLinecap,
302
+ strokeDasharray: `${successValue} 100`,
303
+ style: {
304
+ stroke: success?.strokeColor,
305
+ ...slots?.track
306
+ }
307
+ })
308
+ ]
309
+ })
310
+ ]
432
311
  }),
433
- successValue > 0 && /*#__PURE__*/ jsx("path", {
434
- "data-tao-progress-track": "",
435
- "data-tao-success": "",
436
- className: cx(`${prefixCls}-track`, names?.track),
437
- d: path,
438
- pathLength: "100",
439
- strokeWidth: thickness,
440
- strokeLinecap: strokeLinecap,
441
- strokeDasharray: `${successValue} 100`,
442
- style: {
443
- stroke: success?.strokeColor,
444
- ...slots?.track
445
- }
446
- })
312
+ numericDiameter > 20 && info
447
313
  ]
448
314
  });
449
- let t19;
450
- if ($[74] !== t17 || $[75] !== t18) {
451
- t19 = /*#__PURE__*/ jsxs("svg", {
452
- "data-tao-progress-circle": "",
453
- viewBox: "0 0 100 100",
454
- fill: "none",
455
- "aria-hidden": "true",
456
- children: [
457
- t17,
458
- t18
459
- ]
460
- });
461
- $[74] = t17;
462
- $[75] = t18;
463
- $[76] = t19;
464
- } else t19 = $[76];
465
- const t20 = numericDiameter > 20 && info;
466
- let t21;
467
- if ($[77] !== placement || $[78] !== t10 || $[79] !== t13 || $[80] !== t16 || $[81] !== t19 || $[82] !== t20) {
468
- t21 = /*#__PURE__*/ jsxs("div", {
469
- "data-tao-progress-body": "",
470
- "data-tao-small-circle": t10,
471
- "data-tao-gap-placement": placement,
472
- className: t13,
473
- style: t16,
474
- children: [
475
- t19,
476
- t20
477
- ]
478
- });
479
- $[77] = placement;
480
- $[78] = t10;
481
- $[79] = t13;
482
- $[80] = t16;
483
- $[81] = t19;
484
- $[82] = t20;
485
- $[83] = t21;
486
- } else t21 = $[83];
487
- const circleContent = t21;
488
315
  content = numericDiameter <= 20 && showInfo ? /*#__PURE__*/ jsx(Tooltip, {
489
- title: format ? format(value, successValue) : `${value}%`,
316
+ title: format ? format(value, successValue) : formatPercent(value, locale.numberLocale),
490
317
  children: circleContent
491
318
  }) : circleContent;
492
319
  }
493
- const t9 = props["aria-label"];
494
- const t10 = props["aria-labelledby"];
495
- const t11 = `${prefixCls}-status-${resolvedStatus}`;
496
- const t12 = names?.root;
497
- let t13;
498
- if ($[84] !== className || $[85] !== prefixCls || $[86] !== rootClassName || $[87] !== t11 || $[88] !== t12) {
499
- t13 = cx(prefixCls, t11, t12, className, rootClassName);
500
- $[84] = className;
501
- $[85] = prefixCls;
502
- $[86] = rootClassName;
503
- $[87] = t11;
504
- $[88] = t12;
505
- $[89] = t13;
506
- } else t13 = $[89];
507
- const t14 = slots?.root;
508
- let t15;
509
- if ($[90] !== style || $[91] !== t14) {
510
- t15 = {
511
- ...t14,
320
+ return /*#__PURE__*/ jsx("div", {
321
+ ref: rootRef,
322
+ role: "progressbar",
323
+ "aria-valuenow": value,
324
+ "aria-valuemin": 0,
325
+ "aria-valuemax": 100,
326
+ "aria-label": props['aria-label'],
327
+ "aria-labelledby": props['aria-labelledby'],
328
+ "data-tao-progress": "",
329
+ "data-tao-type": type,
330
+ "data-tao-status": resolvedStatus,
331
+ "data-tao-info-position": infoPosition,
332
+ "data-tao-info-align": infoAlign,
333
+ className: cx(prefixCls, `${prefixCls}-status-${resolvedStatus}`, names?.root, className, rootClassName),
334
+ style: {
335
+ ...slots?.root,
512
336
  ...style
513
- };
514
- $[90] = style;
515
- $[91] = t14;
516
- $[92] = t15;
517
- } else t15 = $[92];
518
- let t16;
519
- if ($[93] !== content || $[94] !== infoAlign || $[95] !== infoPosition || $[96] !== ref || $[97] !== resolvedStatus || $[98] !== t10 || $[99] !== t13 || $[100] !== t15 || $[101] !== t9 || $[102] !== type || $[103] !== value) {
520
- t16 = /*#__PURE__*/ jsx("div", {
521
- ref: ref,
522
- role: "progressbar",
523
- "aria-valuenow": value,
524
- "aria-valuemin": 0,
525
- "aria-valuemax": 100,
526
- "aria-label": t9,
527
- "aria-labelledby": t10,
528
- "data-tao-progress": "",
529
- "data-tao-type": type,
530
- "data-tao-status": resolvedStatus,
531
- "data-tao-info-position": infoPosition,
532
- "data-tao-info-align": infoAlign,
533
- className: t13,
534
- style: t15,
535
- children: content
536
- });
537
- $[93] = content;
538
- $[94] = infoAlign;
539
- $[95] = infoPosition;
540
- $[96] = ref;
541
- $[97] = resolvedStatus;
542
- $[98] = t10;
543
- $[99] = t13;
544
- $[100] = t15;
545
- $[101] = t9;
546
- $[102] = type;
547
- $[103] = value;
548
- $[104] = t16;
549
- } else t16 = $[104];
550
- return t16;
337
+ },
338
+ children: content
339
+ });
551
340
  });
552
- function _temp(_, index) {
553
- return index;
554
- }
555
- function _temp2(stop) {
556
- return `${stop.color} ${stop.offset}%`;
557
- }
558
- function _temp3(__0, index_1) {
559
- return index_1;
560
- }
561
- function _temp4(stop_0) {
562
- return /*#__PURE__*/ jsx("stop", {
563
- offset: `${stop_0.offset}%`,
564
- stopColor: stop_0.color
565
- }, stop_0.offset);
566
- }
567
341
  export { progress_Progress as Progress };