one-design-next 0.0.65 → 0.0.67

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.
@@ -6,6 +6,8 @@ export interface ApprovalSummaryItem {
6
6
  label: string;
7
7
  value: string;
8
8
  }
9
+ /** 有 summary 时底栏左侧提示的默认文案。 */
10
+ export declare const APPROVAL_DEFAULT_ACTIONS_HINT = "\u5982\u53C2\u6570\u6709\u8BEF\uFF0C\u53EF\u5728\u5BF9\u8BDD\u6846\u4E2D\u8865\u5145\u6216\u4FEE\u6539";
9
11
  export interface ApprovalSpec {
10
12
  /** 待授权动作说明(标题);14px / regular / black-12;原样展示,Host 自行决定是否带问号 */
11
13
  description: string;
@@ -24,6 +26,13 @@ export interface ApprovalSpec {
24
26
  * 未决:默认展开;锁态:默认折叠,右侧可展开回看。
25
27
  */
26
28
  summary?: ApprovalSummaryItem[];
29
+ /**
30
+ * 未决底栏左侧提示。
31
+ * - 省略:有 `summary` 时用 {@link APPROVAL_DEFAULT_ACTIONS_HINT},否则不展示
32
+ * - 空串:强制不展示
33
+ * - 其它字符串:原样展示
34
+ */
35
+ actionsHint?: string;
27
36
  }
28
37
  export interface ApprovalResolvePayload {
29
38
  decision: ApprovalDecision;
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import * as React from 'react';
3
2
  import clsx from 'clsx';
3
+ import * as React from 'react';
4
4
  import Button from "../button";
5
5
  import Icon from "../icon";
6
6
  import "./style";
@@ -11,6 +11,8 @@ import "./style";
11
11
 
12
12
  /** 参数摘要一行:Host 已格式化的 label → 展示文案(可含换行) */
13
13
 
14
+ /** 有 summary 时底栏左侧提示的默认文案。 */
15
+ export var APPROVAL_DEFAULT_ACTIONS_HINT = '如参数有误,可在对话框中补充或修改';
14
16
  function lockedTitle(description, decision, explicit) {
15
17
  if (explicit) return explicit;
16
18
  var base = description.trim().replace(/[\?\uFF1F]+$/, '');
@@ -87,6 +89,7 @@ export function Approval(_ref2) {
87
89
  var locked = !!resolved;
88
90
  var summary = (_spec$summary = spec.summary) !== null && _spec$summary !== void 0 ? _spec$summary : [];
89
91
  var hasSummary = summary.length > 0;
92
+ var actionsHint = spec.actionsHint !== undefined ? spec.actionsHint : hasSummary ? APPROVAL_DEFAULT_ACTIONS_HINT : '';
90
93
 
91
94
  /* 未决默认展开;锁态 / 挂载即已决议 → 默认折叠 */
92
95
  var _React$useState3 = React.useState(function () {
@@ -198,6 +201,10 @@ export function Approval(_ref2) {
198
201
  summary: summary
199
202
  }))))) : null), !resolved ? /*#__PURE__*/React.createElement("div", {
200
203
  "data-odn-approval-actions": true
204
+ }, actionsHint ? /*#__PURE__*/React.createElement("span", {
205
+ "data-odn-approval-actions-hint": true
206
+ }, actionsHint) : /*#__PURE__*/React.createElement("span", null), /*#__PURE__*/React.createElement("div", {
207
+ "data-odn-approval-actions-right": true
201
208
  }, spec.rejectLabel ? /*#__PURE__*/React.createElement(Button, {
202
209
  size: "small",
203
210
  intent: "normal",
@@ -210,7 +217,7 @@ export function Approval(_ref2) {
210
217
  onClick: function onClick() {
211
218
  return handleResolve('approve');
212
219
  }
213
- }, spec.actionLabel)) : null);
220
+ }, spec.actionLabel))) : null);
214
221
  }
215
222
  Approval.displayName = 'Approval';
216
223
  export default Approval;
@@ -227,11 +227,30 @@
227
227
  }
228
228
 
229
229
  [data-odn-approval-actions] {
230
+ display: flex;
231
+ align-items: center;
232
+ justify-content: space-between;
233
+ gap: 8px;
234
+ flex-shrink: 0;
235
+ }
236
+
237
+ [data-odn-approval-actions-hint] {
238
+ min-width: 0;
239
+ flex: 1;
240
+ margin: 0;
241
+ font-size: 12px;
242
+ font-weight: 400;
243
+ line-height: 1.5;
244
+ color: var(--odn-color-black-9);
245
+ }
246
+
247
+ [data-odn-approval-actions-right] {
230
248
  display: flex;
231
249
  align-items: center;
232
250
  justify-content: flex-end;
233
251
  gap: 8px;
234
252
  flex-shrink: 0;
253
+ margin-left: auto;
235
254
  }
236
255
 
237
256
  [data-odn-approval][data-has-summary] [data-odn-approval-actions] {
@@ -13,5 +13,9 @@ export interface AutoHeightProps extends React.HTMLAttributes<HTMLDivElement> {
13
13
  }
14
14
  /**
15
15
  * 只动画「题面内容」的高度与透明度;卡面描边应由外层稳定承载,勿把整卡塞进来做 opacity。
16
+ *
17
+ * Drawer / keepMounted 注意:关闭时父级可能暂时量到 0 高。若此时把
18
+ * `readyRef` 钉死或把 outer 压成 0,重开后不再测量就会「只剩底栏」。
19
+ * 因此:未就绪时忽略 0 高;已就绪时忽略「从正高塌到 0」;重现正高时再同步。
16
20
  */
17
21
  export declare function AutoHeight({ children, anchor, contentKey, style, ...props }: AutoHeightProps): React.JSX.Element;
@@ -20,6 +20,10 @@ var HEIGHT_EPS = 0.5;
20
20
  var EASING = 'ease-in-out';
21
21
  /**
22
22
  * 只动画「题面内容」的高度与透明度;卡面描边应由外层稳定承载,勿把整卡塞进来做 opacity。
23
+ *
24
+ * Drawer / keepMounted 注意:关闭时父级可能暂时量到 0 高。若此时把
25
+ * `readyRef` 钉死或把 outer 压成 0,重开后不再测量就会「只剩底栏」。
26
+ * 因此:未就绪时忽略 0 高;已就绪时忽略「从正高塌到 0」;重现正高时再同步。
23
27
  */
24
28
  export function AutoHeight(_ref) {
25
29
  var children = _ref.children,
@@ -58,6 +62,11 @@ export function AutoHeight(_ref) {
58
62
  outer.style.transition = "height ".concat(HEIGHT_MS, "ms ").concat(EASING);
59
63
  outer.style.height = "".concat(target, "px");
60
64
  };
65
+
66
+ /** 父级隐藏 / 尚未布局时常见 0 高,不能当作有效题面高度。 */
67
+ var isCollapsedMeasure = function isCollapsedMeasure(h) {
68
+ return h < HEIGHT_EPS;
69
+ };
61
70
  useLayoutEffect(function () {
62
71
  var outer = outerRef.current;
63
72
  var current = currentRef.current;
@@ -67,16 +76,20 @@ export function AutoHeight(_ref) {
67
76
  };
68
77
  var onTransitionEnd = function onTransitionEnd(e) {
69
78
  if (e.target !== outer || e.propertyName !== 'height') return;
70
- if (outgoing != null) return;
79
+ if (outgoing !== null && outgoing !== undefined) return;
71
80
  animatingRef.current = false;
72
- finishHeight(outer, measure());
81
+ var h = measure();
82
+ if (!isCollapsedMeasure(h)) finishHeight(outer, h);
73
83
  };
74
84
  outer.addEventListener('transitionend', onTransitionEnd);
75
85
  if (!readyRef.current) {
76
86
  var h = measure();
77
- outer.style.height = "".concat(h, "px");
78
- heightRef.current = h;
79
- readyRef.current = true;
87
+ /* 抽屉刚挂载时常量到 0:先不 ready,等 ResizeObserver 拿到正高 */
88
+ if (!isCollapsedMeasure(h)) {
89
+ outer.style.height = "".concat(h, "px");
90
+ heightRef.current = h;
91
+ readyRef.current = true;
92
+ }
80
93
  prevKeyRef.current = contentKey;
81
94
  prevChildrenRef.current = children;
82
95
  return function () {
@@ -95,12 +108,20 @@ export function AutoHeight(_ref) {
95
108
  };
96
109
  }
97
110
  prevChildrenRef.current = children;
98
- if (outgoing != null || animatingRef.current) {
111
+ if (outgoing !== null && outgoing !== undefined || animatingRef.current) {
112
+ return function () {
113
+ return outer.removeEventListener('transitionend', onTransitionEnd);
114
+ };
115
+ }
116
+ var target = measure();
117
+ if (isCollapsedMeasure(target) && heightRef.current >= HEIGHT_EPS) {
99
118
  return function () {
100
119
  return outer.removeEventListener('transitionend', onTransitionEnd);
101
120
  };
102
121
  }
103
- runHeightOnly(outer, heightRef.current, measure());
122
+ if (!isCollapsedMeasure(target)) {
123
+ runHeightOnly(outer, heightRef.current, target);
124
+ }
104
125
  return function () {
105
126
  return outer.removeEventListener('transitionend', onTransitionEnd);
106
127
  };
@@ -111,7 +132,7 @@ export function AutoHeight(_ref) {
111
132
  * 有高度差时高度整段同步;等高只做显隐。旧层用不透明底盖住下层。
112
133
  */
113
134
  useLayoutEffect(function () {
114
- if (outgoing == null) return;
135
+ if (outgoing === null || outgoing === undefined) return;
115
136
  var outer = outerRef.current;
116
137
  var current = currentRef.current;
117
138
  var outEl = outgoingRef.current;
@@ -129,7 +150,7 @@ export function AutoHeight(_ref) {
129
150
  outEl.style.opacity = '1';
130
151
  }
131
152
  void outer.offsetHeight;
132
- if (heightChanged) {
153
+ if (heightChanged && !isCollapsedMeasure(target)) {
133
154
  outer.style.transition = "height ".concat(HEIGHT_MS, "ms ").concat(EASING);
134
155
  outer.style.height = "".concat(target, "px");
135
156
  }
@@ -147,7 +168,8 @@ export function AutoHeight(_ref) {
147
168
  var doneTimer = window.setTimeout(function () {
148
169
  setOutgoing(null);
149
170
  animatingRef.current = false;
150
- finishHeight(outer, current.getBoundingClientRect().height);
171
+ var h = current.getBoundingClientRect().height;
172
+ if (!isCollapsedMeasure(h)) finishHeight(outer, h);
151
173
  current.style.transition = '';
152
174
  current.style.opacity = '1';
153
175
  if (outEl) {
@@ -167,15 +189,27 @@ export function AutoHeight(_ref) {
167
189
  if (!current || !outer || typeof ResizeObserver === 'undefined') return;
168
190
  var onTransitionEnd = function onTransitionEnd(e) {
169
191
  if (e.target !== outer || e.propertyName !== 'height') return;
170
- if (outgoing != null) return;
192
+ if (outgoing !== null && outgoing !== undefined) return;
171
193
  animatingRef.current = false;
172
- finishHeight(outer, current.getBoundingClientRect().height);
194
+ var h = current.getBoundingClientRect().height;
195
+ if (!isCollapsedMeasure(h)) finishHeight(outer, h);
173
196
  };
174
197
  outer.addEventListener('transitionend', onTransitionEnd);
175
198
  var ro = new ResizeObserver(function () {
176
- if (animatingRef.current || outgoing != null) return;
177
- if (!readyRef.current) return;
199
+ if (animatingRef.current || outgoing !== null && outgoing !== undefined) return;
178
200
  var target = current.getBoundingClientRect().height;
201
+ if (!readyRef.current) {
202
+ if (isCollapsedMeasure(target)) return;
203
+ finishHeight(outer, target);
204
+ readyRef.current = true;
205
+ return;
206
+ }
207
+
208
+ /* 父级隐藏时勿把已测好的正高塌成 0 */
209
+ if (isCollapsedMeasure(target) && heightRef.current >= HEIGHT_EPS) {
210
+ return;
211
+ }
212
+ if (isCollapsedMeasure(target)) return;
179
213
  var start = heightRef.current;
180
214
  if (Math.abs(start - target) < HEIGHT_EPS) return;
181
215
  runHeightOnly(outer, start, target);
@@ -199,7 +233,7 @@ export function AutoHeight(_ref) {
199
233
  justifyContent: anchor === 'bottom' ? 'flex-end' : 'flex-start',
200
234
  background: 'transparent'
201
235
  }, style)
202
- }, props), outgoing != null ? /*#__PURE__*/React.createElement("div", {
236
+ }, props), outgoing !== null && outgoing !== undefined ? /*#__PURE__*/React.createElement("div", {
203
237
  ref: outgoingRef,
204
238
  "data-odn-clarify-auto-height-outgoing": true,
205
239
  "aria-hidden": true,
@@ -12,7 +12,7 @@ export interface ClarifyDockQuestion {
12
12
  input: ClarifyInput;
13
13
  /**
14
14
  * 是否允许跳过;默认 true。
15
- * 跳过后由 AI 按默认继续,UI 不展示具体默认值。
15
+ * 跳过后由 Agent 推断执行,UI 不展示具体推断值。
16
16
  */
17
17
  skippable?: boolean;
18
18
  }
@@ -40,7 +40,7 @@ export interface ClarifyDockResolvePayload {
40
40
  items: ClarifyDockAnswerItem[];
41
41
  }
42
42
  /** 锁态 / 回看提示:跳过题统一文案(不展示 AI 默认选项)。 */
43
- export declare const CLARIFY_DOCK_SKIPPED_LABEL = "\u5DF2\u8DF3\u8FC7\uFF0C\u6309\u9ED8\u8BA4\u9009\u9879\u7EE7\u7EED";
43
+ export declare const CLARIFY_DOCK_SKIPPED_LABEL = "\u5DF2\u8DF3\u8FC7\uFF0C\u6309 Agent \u63A8\u65AD\u6267\u884C";
44
44
  /** data[key] 哨兵:表示本题跳过,默认由模型侧决定。 */
45
45
  export declare const CLARIFY_DOCK_SKIPPED_VALUE = "__skipped__";
46
46
  /** Host 消息最小形状——hook 只认 assistant + clarify-dock instance。 */
@@ -46,7 +46,7 @@ export { parseClarifyBoundDate, toISODate } from "./types";
46
46
  /** 整卷提交:自然语言摘要 + 结构化 data + 锁态小票行。 */
47
47
 
48
48
  /** 锁态 / 回看提示:跳过题统一文案(不展示 AI 默认选项)。 */
49
- export var CLARIFY_DOCK_SKIPPED_LABEL = '已跳过,按默认选项继续';
49
+ export var CLARIFY_DOCK_SKIPPED_LABEL = '已跳过,按 Agent 推断执行';
50
50
 
51
51
  /** data[key] 哨兵:表示本题跳过,默认由模型侧决定。 */
52
52
  export var CLARIFY_DOCK_SKIPPED_VALUE = '__skipped__';
@@ -525,11 +525,9 @@ export function ClarifyDockPanel(_ref2) {
525
525
  "data-odn-clarify-dock-q-row": true
526
526
  }, /*#__PURE__*/React.createElement("div", {
527
527
  "data-odn-clarify-dock-q": true
528
- }, question.label), input.kind === 'options' ? /*#__PURE__*/React.createElement("span", {
528
+ }, question.label, input.kind === 'options-multi' ? /*#__PURE__*/React.createElement("span", {
529
529
  "data-odn-clarify-dock-q-hint": true
530
- }, "\u5355\u9009") : input.kind === 'options-multi' ? /*#__PURE__*/React.createElement("span", {
531
- "data-odn-clarify-dock-q-hint": true
532
- }, "\u53EF\u591A\u9009") : null), /*#__PURE__*/React.createElement("div", {
530
+ }, "\uFF08\u53EF\u591A\u9009\uFF09") : null)), /*#__PURE__*/React.createElement("div", {
533
531
  "data-odn-clarify-dock-input-shell": true,
534
532
  "data-skipped": isSkipped ? '' : undefined
535
533
  }, /*#__PURE__*/React.createElement("div", {
@@ -85,13 +85,10 @@ div[data-odn-clarify-dock] [data-odn-clarify-dock-body] {
85
85
  [data-odn-clarify-dock-q-row] {
86
86
  display: flex;
87
87
  align-items: baseline;
88
- justify-content: space-between;
89
- gap: 12px;
90
88
  min-width: 0;
91
89
  }
92
90
 
93
91
  [data-odn-clarify-dock] [data-odn-clarify-dock-q] {
94
- flex: 1;
95
92
  min-width: 0;
96
93
  font-size: 14px;
97
94
  font-weight: 400;
@@ -100,11 +97,13 @@ div[data-odn-clarify-dock] [data-odn-clarify-dock-body] {
100
97
  margin: 0;
101
98
  }
102
99
 
100
+ /* 多选题干后缀(与题干同字号、同色);负 margin 收紧与问号间的全角留白 */
103
101
  [data-odn-clarify-dock-q-hint] {
104
- flex-shrink: 0;
105
- font-size: 12px;
106
- line-height: 1.5;
107
- color: var(--odn-color-black-8);
102
+ font-size: inherit;
103
+ line-height: inherit;
104
+ font-weight: inherit;
105
+ color: var(--odn-color-black-12);
106
+ margin-left: -0.6em;
108
107
  }
109
108
 
110
109
  /* ---------- 底栏 · 对齐 approval-actions(含顶部分割线) ---------- */
@@ -543,6 +542,21 @@ div[data-odn-clarify-dock] [data-odn-clarify-dock-body] {
543
542
  flex: 0 0 auto;
544
543
  }
545
544
 
545
+ /*
546
+ * 日期触发器收到与选项同级(13px / 高 32px)。
547
+ * 只改 container 内 input,弹层在 portal 外不受影响。
548
+ */
549
+ div[data-odn-clarify-dock] [data-odn-date-picker-container] {
550
+ width: 100%;
551
+ }
552
+
553
+ div[data-odn-clarify-dock] [data-odn-date-picker-input] {
554
+ height: 32px;
555
+ padding: 4px 32px 4px 10px;
556
+ font-size: 13px;
557
+ line-height: 1.5;
558
+ }
559
+
546
560
  /* ---------- 跳过态:任意录入形态共用蒙层 +「重新回答」 ---------- */
547
561
  [data-odn-clarify-dock-input-shell] {
548
562
  position: relative;
package/dist/index.d.ts CHANGED
@@ -1,85 +1,83 @@
1
1
  import './style';
2
- export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './collapse';
2
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger, } from './collapse';
3
3
  export { iconNames } from './icon';
4
4
  export type { IconName } from './icon';
5
- export { MessageReact16, Message, type MessageProps, type MessageIntent, type odnMessageState } from './message';
5
+ export { Message, MessageReact16, type MessageIntent, type MessageProps, type odnMessageState, } from './message';
6
6
  export { ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalRoot, ModalTitle, ModalTrigger, } from './modal-base';
7
- export { type PopoverProps } from "./pop-base";
8
- export { MONTHS, convertDateToString, convertDateRangeToString, convertQuarterToString, convertMonthToString, convertYearToString, isDayAfter, isDayBefore, isSameDay, isSameMonth, isLegalDateString, isLegalDateRangeString, isLegalWeekString, isLegalQuarterString, isLegalMonthString, isLegalYearString, parseWeekStringToRange, parseQuarterStringToRange, parseMonthStringToRange, parseYearStringToRange, getDefaultMaxDate, getDefaultMinDate, getStartOfWeek, getEndOfWeek, getStartOfQuarter, getEndOfQuarter } from './_util/date';
9
- export { isLegalTimeString, isTimeAfter, isTimeBefore, isTimeEqual, timeToSeconds, secondsToTime } from './_util/time';
7
+ export { type PopoverProps } from './pop-base';
8
+ export { MONTHS, convertDateRangeToString, convertDateToString, convertMonthToString, convertQuarterToString, convertYearToString, getDefaultMaxDate, getDefaultMinDate, getEndOfQuarter, getEndOfWeek, getStartOfQuarter, getStartOfWeek, isDayAfter, isDayBefore, isLegalDateRangeString, isLegalDateString, isLegalMonthString, isLegalQuarterString, isLegalWeekString, isLegalYearString, isSameDay, isSameMonth, parseMonthStringToRange, parseQuarterStringToRange, parseWeekStringToRange, parseYearStringToRange, } from './_util/date';
9
+ export { isLegalTimeString, isTimeAfter, isTimeBefore, isTimeEqual, secondsToTime, timeToSeconds, } from './_util/time';
10
10
  export { default as Alert, type AlertProps, type AlertRef } from './alert';
11
- export { default as AutoComplete, type AutoCompleteProps } from './auto-complete';
11
+ export { default as AutoComplete, type AutoCompleteProps, } from './auto-complete';
12
12
  export { default as Avatar, type AvatarProps } from './avatar';
13
13
  export { default as Button, type ButtonProps } from './button';
14
14
  export { default as Calendar, type CalendarProps } from './calendar';
15
+ export { default as Card, type CardElevation, type CardHeaderProps, type CardHeaderSize, type CardProps, } from './card';
15
16
  export { default as Cascader, type CascaderProps } from './cascader';
16
- export { default as Card, type CardProps, type CardElevation, type CardHeaderProps, type CardHeaderSize } from './card';
17
17
  export { default as Chart, type ChartProps } from './chart';
18
- export { default as Checkbox, type CheckboxGroupProps, type CheckboxProps } from './checkbox';
19
- export { default as Collapse, type CollapseProps, type CollapseItem } from './collapse';
18
+ export { default as Checkbox, type CheckboxGroupProps, type CheckboxProps, } from './checkbox';
19
+ export { default as Collapse, type CollapseItem, type CollapseProps, } from './collapse';
20
20
  export { default as ColorPicker, type ColorPickerProps } from './color-picker';
21
- export { default as ConfigProvider, type ConfigConsumerProps, type ConfigProviderProps } from './config-provider';
21
+ export { default as ConfigProvider, type ConfigConsumerProps, type ConfigProviderProps, } from './config-provider';
22
22
  export { default as DatePicker, type DatePickerProps } from './date-picker';
23
- export { default as DateRangePicker, type DatePickerRangeProps } from './date-range-picker';
23
+ export { default as DateRangePicker, type DatePickerRangeProps, } from './date-range-picker';
24
24
  export { default as Dialog, type DialogProps } from './dialog';
25
25
  export { default as Drawer, type DrawerProps } from './drawer';
26
26
  export { default as Dropdown, type DropdownNormalProps, type DropdownProps, } from './dropdown';
27
- export { default as EllipsisText, type EllipsisTextProps } from './ellipsis-text';
28
- export { default as Empty, type EmptyProps, type EmptyType, type EmptySize } from './empty';
29
- export { default as Form, type FormProps, type FormItemProps } from './form';
30
- export { default as HoverFill, type HoverFillProps, type HoverFillState } from './hover-fill';
27
+ export { default as EllipsisText, type EllipsisTextProps, } from './ellipsis-text';
28
+ export { default as Empty, type EmptyProps, type EmptySize, type EmptyType, } from './empty';
29
+ export { default as Form, type FormItemProps, type FormProps } from './form';
30
+ export { default as HoverFill, type HoverFillProps, type HoverFillState, } from './hover-fill';
31
31
  export { default as Icon, type IconProps } from './icon';
32
32
  export { default as Image, type ImageProps } from './image';
33
33
  export { default as Input, type InputProps, type InputRef } from './input';
34
34
  export { default as InputNumber } from './input-number';
35
- export { default as InputOtp, type InputOtpProps, type InputOtpRef } from './input-otp';
35
+ export { default as InputOtp, type InputOtpProps, type InputOtpRef, } from './input-otp';
36
+ export { HuxuanLayout, MpLayout, RuyiLayout, type HuxuanActionItem, type HuxuanLayoutProps, type HuxuanNavChild, type HuxuanNavItem, type MpLayoutProps, type MpMenuItem, type MpSubTab, type MpTabItem, type RuyiLayoutProps, type RuyiMenuItem, } from './layout';
36
37
  export { default as Link, type LinkProps } from './link';
37
38
  export { default as Loading, type LoadingProps } from './loading';
38
- export { default as NumberFlow, type NumberFlowProps, type Format } from './number-flow';
39
+ export { default as NumberFlow, type Format, type NumberFlowProps, } from './number-flow';
39
40
  export { default as Pagination, type PaginationProps } from './pagination';
40
41
  export { default as Popover } from './popover';
41
- export { default as Radio, type RadioProps, type RadioGroupProps } from './radio';
42
- export { RuyiLayout, type RuyiLayoutProps, type RuyiMenuItem } from './layout';
43
- export { MpLayout, type MpLayoutProps, type MpMenuItem, type MpTabItem, type MpSubTab } from './layout';
44
- export { HuxuanLayout, type HuxuanLayoutProps, type HuxuanNavItem, type HuxuanNavChild, type HuxuanActionItem } from './layout';
45
- export { default as ScrollArea, type ScrollAreaProps, type ScrollAreaRef } from './scroll-area';
42
+ export { default as Radio, type RadioGroupProps, type RadioProps, } from './radio';
43
+ export { default as ScrollArea, type ScrollAreaProps, type ScrollAreaRef, } from './scroll-area';
46
44
  export { default as Select, type SelectProps, type TokenPasteResult, type TokenValidationItem, } from './select';
47
45
  export { default as Slider, type SliderProps } from './slider';
48
46
  export { default as Switch, type SwitchProps } from './switch';
47
+ export { default as Table, type ColumnType, type RowSelectionType, type TableProps, type TableRowExpansion, type TableRowSelection, type TableSortOrder, } from './table';
49
48
  export { default as Tabs } from './tabs';
49
+ export { default as TextSwap, type TextSwapFlipProps, type TextSwapProps, } from './text-swap';
50
50
  export { default as TimePicker, type TimePickerProps } from './time-picker';
51
- export { default as Table, type TableProps, type ColumnType, type TableSortOrder, type RowSelectionType, type TableRowSelection, type TableRowExpansion } from './table';
52
- export { default as TextSwap, type TextSwapProps, type TextSwapFlipProps } from './text-swap';
53
51
  export { default as Tooltip } from './tooltip';
54
- export { default as TreeSelect, type TreeSelectProps, type TreeNodeData } from './tree-select';
52
+ export { default as TreeSelect, type TreeNodeData, type TreeSelectProps, } from './tree-select';
55
53
  export { default as VirtualList, type VirtualListProps } from './virtual-list';
56
54
  export { default as ActionBar, type ActionBarProps } from './action-bar';
57
- export { default as AgentStep, type AgentStepProps, type AgentStepGroupProps } from './agent-step';
55
+ export { default as AgentStep, type AgentStepGroupProps, type AgentStepProps, } from './agent-step';
58
56
  export { default as AgentThink, type AgentThinkProps } from './agent-think';
59
- export { default as Approval, type ApprovalProps, type ApprovalSpec, type ApprovalDecision, type ApprovalResolvePayload, type ApprovalSummaryItem, } from './approval';
60
- export { ClarifyDockPanel, ClarifyDockTrigger, useClarifyDockState, clarifyDockLayoutId, CLARIFY_DOCK_MAX_OPTIONS, CLARIFY_DOCK_SKIPPED_LABEL, CLARIFY_DOCK_SKIPPED_VALUE, parseClarifyBoundDate, toISODate, type ClarifyDockPanelProps, type ClarifyDockTriggerProps, type ClarifyDockSpec, type ClarifyDockQuestion, type ClarifyDockAnswerItem, type ClarifyDockResolvePayload, type ClarifyDockMessageState, type ClarifyDockState, type ClarifyDockHostMessage, type ClarifyInput, type ClarifyOption, } from './clarify-dock';
57
+ export { APPROVAL_DEFAULT_ACTIONS_HINT, default as Approval, type ApprovalDecision, type ApprovalProps, type ApprovalResolvePayload, type ApprovalSpec, type ApprovalSummaryItem, } from './approval';
61
58
  export { default as Artifact, type ArtifactProps } from './artifact';
62
59
  export { default as Attachments, type AttachmentsProps } from './attachments';
60
+ export { default as ChatItem, formatRelativeTime, type ChatItemProps, } from './chat-item';
61
+ export { default as ChatList, matchChatListFilterTime, matchChatListFilterType, type ChatListFilterTime, type ChatListFilterType, type ChatListItem, type ChatListProps, } from './chat-list';
62
+ export { CLARIFY_DOCK_MAX_OPTIONS, CLARIFY_DOCK_SKIPPED_LABEL, CLARIFY_DOCK_SKIPPED_VALUE, ClarifyDockPanel, ClarifyDockTrigger, clarifyDockLayoutId, parseClarifyBoundDate, toISODate, useClarifyDockState, type ClarifyDockAnswerItem, type ClarifyDockHostMessage, type ClarifyDockMessageState, type ClarifyDockPanelProps, type ClarifyDockQuestion, type ClarifyDockResolvePayload, type ClarifyDockSpec, type ClarifyDockState, type ClarifyDockTriggerProps, type ClarifyInput, type ClarifyOption, } from './clarify-dock';
63
63
  export { default as CodeBlock, type CodeBlockProps } from './code-block';
64
- export { default as Composer, type ComposerProps, type ComposerRef, type ComposerToolConfig, type ComposerTool } from './composer';
65
- export { default as Invocation, InvocationParamPopover, type InvocationProps, type InvocationParamPopoverProps, } from './invocation';
64
+ export { default as Composer, type ComposerProps, type ComposerRef, type ComposerTool, type ComposerToolConfig, } from './composer';
66
65
  export { type ComposerParamPanelContext } from './composer/param-panel';
67
- export { default as Mention, type MentionProps } from './mention';
68
- export { default as ChatItem, formatRelativeTime, type ChatItemProps, } from './chat-item';
69
- export { default as ChatList, matchChatListFilterTime, matchChatListFilterType, type ChatListProps, type ChatListItem, type ChatListFilterTime, type ChatListFilterType, } from './chat-list';
70
- export { default as SkillSlot, type SkillSlotHandle, type SkillSlotProps } from './skill-slot';
71
66
  export { default as ErrorBlock, type ErrorBlockProps } from './error-block';
72
67
  export { default as Fab, type FabProps } from './fab';
73
- export { default as MessageImage, type MessageImageProps, type MessageImageItem } from './message-image';
74
- export { default as PreviewPanel, type PreviewPanelProps, type PreviewPanelActionTooltips } from './preview-panel';
68
+ export { default as Invocation, InvocationParamPopover, type InvocationParamPopoverProps, type InvocationProps, } from './invocation';
69
+ export { default as Mention, type MentionProps } from './mention';
70
+ export { default as MessageImage, type MessageImageItem, type MessageImageProps, } from './message-image';
71
+ export { default as PreviewPanel, type PreviewPanelActionTooltips, type PreviewPanelProps, } from './preview-panel';
72
+ export { default as Provenance, type ProvenanceProps, type ProvenanceType, } from './provenance';
73
+ export { default as SkillSlot, type SkillSlotHandle, type SkillSlotProps, } from './skill-slot';
75
74
  export { default as Sources, type SourcesProps } from './sources';
76
- export { default as Provenance, type ProvenanceProps, type ProvenanceType } from './provenance';
77
- export { default as StreamText, type StreamTextProps, type TypographyOverrides } from './stream-text';
78
75
  export { default as StreamPulse, type StreamPulseProps } from './stream-pulse';
76
+ export { default as StreamText, type StreamTextProps, type TypographyOverrides, } from './stream-text';
79
77
  export { default as Suggestions, type SuggestionsProps } from './suggestions';
80
78
  export { default as UserBubble, type UserBubbleProps } from './user-bubble';
81
79
  export { default as Welcome, type WelcomeProps } from './welcome';
82
- export type { ToolCall, ToolStatus, Source, Attachment, PreviewTarget, PreviewTab, SendMeta, ComposerSegment, ComposerTextSegment, ComposerInvocationSegment, ComposerMentionSegment, TextData, InvocationData, MentionData, InlineRefState, SkillItem, SkillGroup, AgentEvent, Conversation, MessageSnapshot, ChatMessage } from './_genui-types';
83
80
  export { ComposerSegmentType } from './_genui-types';
84
- export type { InterruptIntent, InterruptStatus, InterruptBase, } from './_interrupt-types';
85
- export { rawValueToSegments, segmentsToReadableText, segmentsHasContent, isTextSegment, isInvocationSegment, isMentionSegment, type SegmentsToReadableTextOptions, } from './composer/segments';
81
+ export type { AgentEvent, Attachment, ChatMessage, ComposerInvocationSegment, ComposerMentionSegment, ComposerSegment, ComposerTextSegment, Conversation, InlineRefState, InvocationData, MentionData, MessageSnapshot, PreviewTab, PreviewTarget, SendMeta, SkillGroup, SkillItem, Source, TextData, ToolCall, ToolStatus, } from './_genui-types';
82
+ export type { InterruptBase, InterruptIntent, InterruptStatus, } from './_interrupt-types';
83
+ export { isInvocationSegment, isMentionSegment, isTextSegment, rawValueToSegments, segmentsHasContent, segmentsToReadableText, type SegmentsToReadableTextOptions, } from './composer/segments';
package/dist/index.js CHANGED
@@ -7,17 +7,17 @@ if (!React.useInsertionEffect) {
7
7
  import "./style";
8
8
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapse";
9
9
  export { iconNames } from "./icon";
10
- export { MessageReact16, Message } from "./message";
10
+ export { Message, MessageReact16 } from "./message";
11
11
  export { ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalOverlay, ModalPortal, ModalRoot, ModalTitle, ModalTrigger } from "./modal-base";
12
- export { MONTHS, convertDateToString, convertDateRangeToString, convertQuarterToString, convertMonthToString, convertYearToString, isDayAfter, isDayBefore, isSameDay, isSameMonth, isLegalDateString, isLegalDateRangeString, isLegalWeekString, isLegalQuarterString, isLegalMonthString, isLegalYearString, parseWeekStringToRange, parseQuarterStringToRange, parseMonthStringToRange, parseYearStringToRange, getDefaultMaxDate, getDefaultMinDate, getStartOfWeek, getEndOfWeek, getStartOfQuarter, getEndOfQuarter } from "./_util/date";
13
- export { isLegalTimeString, isTimeAfter, isTimeBefore, isTimeEqual, timeToSeconds, secondsToTime } from "./_util/time";
12
+ export { MONTHS, convertDateRangeToString, convertDateToString, convertMonthToString, convertQuarterToString, convertYearToString, getDefaultMaxDate, getDefaultMinDate, getEndOfQuarter, getEndOfWeek, getStartOfQuarter, getStartOfWeek, isDayAfter, isDayBefore, isLegalDateRangeString, isLegalDateString, isLegalMonthString, isLegalQuarterString, isLegalWeekString, isLegalYearString, isSameDay, isSameMonth, parseMonthStringToRange, parseQuarterStringToRange, parseWeekStringToRange, parseYearStringToRange } from "./_util/date";
13
+ export { isLegalTimeString, isTimeAfter, isTimeBefore, isTimeEqual, secondsToTime, timeToSeconds } from "./_util/time";
14
14
  export { default as Alert } from "./alert";
15
15
  export { default as AutoComplete } from "./auto-complete";
16
16
  export { default as Avatar } from "./avatar";
17
17
  export { default as Button } from "./button";
18
18
  export { default as Calendar } from "./calendar";
19
- export { default as Cascader } from "./cascader";
20
19
  export { default as Card } from "./card";
20
+ export { default as Cascader } from "./cascader";
21
21
  export { default as Chart } from "./chart";
22
22
  export { default as Checkbox } from "./checkbox";
23
23
  export { default as Collapse } from "./collapse";
@@ -37,23 +37,21 @@ export { default as Image } from "./image";
37
37
  export { default as Input } from "./input";
38
38
  export { default as InputNumber } from "./input-number";
39
39
  export { default as InputOtp } from "./input-otp";
40
+ export { HuxuanLayout, MpLayout, RuyiLayout } from "./layout";
40
41
  export { default as Link } from "./link";
41
42
  export { default as Loading } from "./loading";
42
43
  export { default as NumberFlow } from "./number-flow";
43
44
  export { default as Pagination } from "./pagination";
44
45
  export { default as Popover } from "./popover";
45
46
  export { default as Radio } from "./radio";
46
- export { RuyiLayout } from "./layout";
47
- export { MpLayout } from "./layout";
48
- export { HuxuanLayout } from "./layout";
49
47
  export { default as ScrollArea } from "./scroll-area";
50
48
  export { default as Select } from "./select";
51
49
  export { default as Slider } from "./slider";
52
50
  export { default as Switch } from "./switch";
53
- export { default as Tabs } from "./tabs";
54
- export { default as TimePicker } from "./time-picker";
55
51
  export { default as Table } from "./table";
52
+ export { default as Tabs } from "./tabs";
56
53
  export { default as TextSwap } from "./text-swap";
54
+ export { default as TimePicker } from "./time-picker";
57
55
  export { default as Tooltip } from "./tooltip";
58
56
  export { default as TreeSelect } from "./tree-select";
59
57
  export { default as VirtualList } from "./virtual-list";
@@ -62,30 +60,29 @@ export { default as VirtualList } from "./virtual-list";
62
60
  export { default as ActionBar } from "./action-bar";
63
61
  export { default as AgentStep } from "./agent-step";
64
62
  export { default as AgentThink } from "./agent-think";
65
- export { default as Approval } from "./approval";
66
- export { ClarifyDockPanel, ClarifyDockTrigger, useClarifyDockState, clarifyDockLayoutId, CLARIFY_DOCK_MAX_OPTIONS, CLARIFY_DOCK_SKIPPED_LABEL, CLARIFY_DOCK_SKIPPED_VALUE, parseClarifyBoundDate, toISODate } from "./clarify-dock";
63
+ export { APPROVAL_DEFAULT_ACTIONS_HINT, default as Approval } from "./approval";
67
64
  export { default as Artifact } from "./artifact";
68
65
  export { default as Attachments } from "./attachments";
69
- export { default as CodeBlock } from "./code-block";
70
- export { default as Composer } from "./composer";
71
- export { default as Invocation, InvocationParamPopover } from "./invocation";
72
- export { default as Mention } from "./mention";
73
66
  export { default as ChatItem, formatRelativeTime } from "./chat-item";
74
67
  export { default as ChatList, matchChatListFilterTime, matchChatListFilterType } from "./chat-list";
75
- export { default as SkillSlot } from "./skill-slot";
68
+ export { CLARIFY_DOCK_MAX_OPTIONS, CLARIFY_DOCK_SKIPPED_LABEL, CLARIFY_DOCK_SKIPPED_VALUE, ClarifyDockPanel, ClarifyDockTrigger, clarifyDockLayoutId, parseClarifyBoundDate, toISODate, useClarifyDockState } from "./clarify-dock";
69
+ export { default as CodeBlock } from "./code-block";
70
+ export { default as Composer } from "./composer";
76
71
  export { default as ErrorBlock } from "./error-block";
77
72
  export { default as Fab } from "./fab";
73
+ export { default as Invocation, InvocationParamPopover } from "./invocation";
74
+ export { default as Mention } from "./mention";
78
75
  export { default as MessageImage } from "./message-image";
79
76
  export { default as PreviewPanel } from "./preview-panel";
80
- export { default as Sources } from "./sources";
81
77
  export { default as Provenance } from "./provenance";
82
- export { default as StreamText } from "./stream-text";
78
+ export { default as SkillSlot } from "./skill-slot";
79
+ export { default as Sources } from "./sources";
83
80
  export { default as StreamPulse } from "./stream-pulse";
81
+ export { default as StreamText } from "./stream-text";
84
82
  export { default as Suggestions } from "./suggestions";
85
83
  export { default as UserBubble } from "./user-bubble";
86
84
  export { default as Welcome } from "./welcome";
87
85
 
88
86
  // GenUI shared modules
89
-
90
87
  export { ComposerSegmentType } from "./_genui-types";
91
- export { rawValueToSegments, segmentsToReadableText, segmentsHasContent, isTextSegment, isInvocationSegment, isMentionSegment } from "./composer/segments";
88
+ export { isInvocationSegment, isMentionSegment, isTextSegment, rawValueToSegments, segmentsHasContent, segmentsToReadableText } from "./composer/segments";
@@ -14,7 +14,7 @@ import Icon from "../icon";
14
14
  import Popover from "../popover";
15
15
  import SelectFeedback from "./SelectFeedback";
16
16
  import "./style";
17
- import { formatTokenPasteFeedback, readClipboardText, resolveTokenPaste, splitByTokenSeparators, toRawValueList } from "./tokenUtils";
17
+ import { countValidValues, formatTokenPasteFeedback, readClipboardText, resolveTokenPaste, splitByTokenSeparators, toRawValueList } from "./tokenUtils";
18
18
  import useIcons from "./useIcons";
19
19
  var InternalSelect = function InternalSelect(props, ref) {
20
20
  var className = props.className,
@@ -332,7 +332,7 @@ var InternalSelect = function InternalSelect(props, ref) {
332
332
  var suffixIconFinal = typeof _suffixIcon === 'function' ? _suffixIcon(suffixIconProps) : _suffixIcon;
333
333
  return /*#__PURE__*/React.createElement(React.Fragment, null, !!maxCount && mode === 'multiple' && Array.isArray(value) && /*#__PURE__*/React.createElement("span", {
334
334
  className: "odn-select-max-count"
335
- }, value.length, " / ", maxCount), suffixIconFinal);
335
+ }, countValidValues(toRawValueList(value), invalidValues), " /", ' ', maxCount), suffixIconFinal);
336
336
  },
337
337
  menuItemSelectedIcon: mode === 'multiple' ? function (iconProps) {
338
338
  var optionDisabled = iconProps.disabled,
@@ -5,6 +5,13 @@ html {
5
5
  --odn-select-border-radius-sm: 4px;
6
6
  --odn-select-internal_fixed_item_margin: 2px;
7
7
  --odn-select-multiple-item-height: 22px;
8
+ --odn-select-multiple-selector-max-height: calc(
9
+ 8px + 5 *
10
+ (
11
+ var(--odn-select-multiple-item-height) +
12
+ var(--odn-select-internal_fixed_item_margin) * 4
13
+ )
14
+ );
8
15
  --odn-select-multiple-item-bg: var(--odn-color-black-1);
9
16
  --odn-select-multiple-item-border-color: var(--odn-color-border);
10
17
  --odn-select-popup-padding-block: 8px;
@@ -567,6 +574,11 @@ html {
567
574
  display: inline-flex;
568
575
  }
569
576
 
577
+ .odn-select-multiple .odn-select-selection-overflow-item > span {
578
+ max-width: 100%;
579
+ min-width: 0;
580
+ }
581
+
570
582
  .odn-select-multiple .odn-select-selection-overflow .odn-select-selection-item {
571
583
  display: flex;
572
584
  align-self: center;
@@ -625,12 +637,35 @@ html {
625
637
 
626
638
  .odn-select-multiple .odn-select-selector {
627
639
  display: flex;
628
- align-items: center;
640
+ align-items: flex-start;
629
641
  width: 100%;
630
- height: 100%;
631
642
  padding-inline: 12px;
632
643
  padding-block: 4px;
633
644
  border-radius: var(--odn-select-border-radius);
645
+ max-height: var(--odn-select-multiple-selector-max-height);
646
+ overflow-x: hidden;
647
+ overflow-y: auto;
648
+ }
649
+ .odn-select-multiple .odn-select-selector::-webkit-scrollbar {
650
+ width: 14px;
651
+ height: 14px;
652
+ }
653
+ .odn-select-multiple .odn-select-selector::-webkit-scrollbar-thumb {
654
+ min-width: 14px;
655
+ min-height: 14px;
656
+ background-color: rgba(0, 0, 0, 0.1);
657
+ background-clip: content-box;
658
+ border: 4px solid transparent;
659
+ border-radius: 14px;
660
+ }
661
+ .odn-select-multiple .odn-select-selector::-webkit-scrollbar-track {
662
+ background-color: rgba(0, 0, 0, 0);
663
+ }
664
+ .odn-select-multiple .odn-select-selector::-webkit-scrollbar-thumb:hover {
665
+ background-color: rgba(0, 0, 0, 0.2);
666
+ }
667
+ .odn-select-multiple .odn-select-selector::-webkit-scrollbar-thumb:active {
668
+ background-color: rgba(0, 0, 0, 0.3);
634
669
  }
635
670
 
636
671
  .odn-select-disabled.odn-select-multiple .odn-select-selector {
@@ -801,12 +836,35 @@ html {
801
836
 
802
837
  .odn-select-multiple.odn-select-sm .odn-select-selector {
803
838
  display: flex;
804
- align-items: center;
839
+ align-items: flex-start;
805
840
  width: 100%;
806
- height: 100%;
807
841
  padding-inline: 12px;
808
842
  padding-block: max(max(var(--odn-padding-xxs) - 1px, 0px) - var(--odn-select-internal_fixed_item_margin), 0px);
809
843
  border-radius: var(--odn-select-border-radius-sm);
844
+ max-height: var(--odn-select-multiple-selector-max-height);
845
+ overflow-x: hidden;
846
+ overflow-y: auto;
847
+ }
848
+ .odn-select-multiple.odn-select-sm .odn-select-selector::-webkit-scrollbar {
849
+ width: 14px;
850
+ height: 14px;
851
+ }
852
+ .odn-select-multiple.odn-select-sm .odn-select-selector::-webkit-scrollbar-thumb {
853
+ min-width: 14px;
854
+ min-height: 14px;
855
+ background-color: rgba(0, 0, 0, 0.1);
856
+ background-clip: content-box;
857
+ border: 4px solid transparent;
858
+ border-radius: 14px;
859
+ }
860
+ .odn-select-multiple.odn-select-sm .odn-select-selector::-webkit-scrollbar-track {
861
+ background-color: rgba(0, 0, 0, 0);
862
+ }
863
+ .odn-select-multiple.odn-select-sm .odn-select-selector::-webkit-scrollbar-thumb:hover {
864
+ background-color: rgba(0, 0, 0, 0.2);
865
+ }
866
+ .odn-select-multiple.odn-select-sm .odn-select-selector::-webkit-scrollbar-thumb:active {
867
+ background-color: rgba(0, 0, 0, 0.3);
810
868
  }
811
869
 
812
870
  .odn-select-disabled.odn-select-multiple.odn-select-sm .odn-select-selector {
@@ -983,12 +1041,35 @@ html {
983
1041
 
984
1042
  .odn-select-multiple.odn-select-lg .odn-select-selector {
985
1043
  display: flex;
986
- align-items: center;
1044
+ align-items: flex-start;
987
1045
  width: 100%;
988
- height: 100%;
989
1046
  padding-inline: 12px;
990
1047
  padding-block: max(max(var(--odn-padding-xxs) - 1px, 0px) - var(--odn-select-internal_fixed_item_margin), 0px);
991
1048
  border-radius: var(--odn-select-border-radius-lg);
1049
+ max-height: var(--odn-select-multiple-selector-max-height);
1050
+ overflow-x: hidden;
1051
+ overflow-y: auto;
1052
+ }
1053
+ .odn-select-multiple.odn-select-lg .odn-select-selector::-webkit-scrollbar {
1054
+ width: 14px;
1055
+ height: 14px;
1056
+ }
1057
+ .odn-select-multiple.odn-select-lg .odn-select-selector::-webkit-scrollbar-thumb {
1058
+ min-width: 14px;
1059
+ min-height: 14px;
1060
+ background-color: rgba(0, 0, 0, 0.1);
1061
+ background-clip: content-box;
1062
+ border: 4px solid transparent;
1063
+ border-radius: 14px;
1064
+ }
1065
+ .odn-select-multiple.odn-select-lg .odn-select-selector::-webkit-scrollbar-track {
1066
+ background-color: rgba(0, 0, 0, 0);
1067
+ }
1068
+ .odn-select-multiple.odn-select-lg .odn-select-selector::-webkit-scrollbar-thumb:hover {
1069
+ background-color: rgba(0, 0, 0, 0.2);
1070
+ }
1071
+ .odn-select-multiple.odn-select-lg .odn-select-selector::-webkit-scrollbar-thumb:active {
1072
+ background-color: rgba(0, 0, 0, 0.3);
992
1073
  }
993
1074
 
994
1075
  .odn-select-disabled.odn-select-multiple.odn-select-lg .odn-select-selector {
@@ -1795,6 +1876,7 @@ html {
1795
1876
  }
1796
1877
 
1797
1878
  .odn-select-selection-overflow-item-rest > span {
1879
+ max-width: 100%;
1798
1880
  min-width: 0;
1799
1881
  }
1800
1882
 
@@ -23,6 +23,8 @@ export declare function readClipboardText(clipboardData: DataTransfer | null): s
23
23
  export declare function splitByTokenSeparators(text: string, separators: string[]): string[] | null;
24
24
  export declare function flattenSelectOptions(options?: DefaultOptionType[]): DefaultOptionType[];
25
25
  export declare function matchOptionByToken(token: string, options: DefaultOptionType[]): DefaultOptionType | null;
26
+ /** 有效选中数:不含 invalid chip(未匹配保留项) */
27
+ export declare function countValidValues(values: RawValue[], invalid: RawValue[]): number;
26
28
  export declare function toRawValueList(value: unknown): RawValue[];
27
29
  export declare function resolveTokenPaste(params: {
28
30
  tokens: string[];
@@ -63,6 +63,17 @@ export function matchOptionByToken(token, options) {
63
63
  return String(value).toLowerCase() === normalized || String(label !== null && label !== void 0 ? label : '').toLowerCase() === normalized;
64
64
  })) !== null && _flat$find !== void 0 ? _flat$find : null;
65
65
  }
66
+
67
+ /** 有效选中数:不含 invalid chip(未匹配保留项) */
68
+ export function countValidValues(values, invalid) {
69
+ if (!invalid.length) {
70
+ return values.length;
71
+ }
72
+ var invalidSet = new Set(invalid.map(String));
73
+ return values.filter(function (v) {
74
+ return !invalidSet.has(String(v));
75
+ }).length;
76
+ }
66
77
  export function toRawValueList(value) {
67
78
  if (value === undefined || value === null || value === '') {
68
79
  return [];
@@ -136,23 +147,23 @@ function _resolveTokenPaste() {
136
147
  while (1) switch (_context.prev = _context.next) {
137
148
  case 0:
138
149
  item = _step.value;
139
- if (!(typeof maxCount === 'number' && nextValue.length >= maxCount)) {
140
- _context.next = 3;
141
- break;
142
- }
143
- return _context.abrupt("return", 0);
144
- case 3:
145
150
  if (!item.valid) {
146
151
  _context.next = 13;
147
152
  break;
148
153
  }
154
+ if (!(typeof maxCount === 'number' && countValidValues(nextValue, nextInvalid) >= maxCount)) {
155
+ _context.next = 4;
156
+ break;
157
+ }
158
+ return _context.abrupt("return", 0);
159
+ case 4:
149
160
  _value = (_item$value = item.value) !== null && _item$value !== void 0 ? _item$value : item.token;
150
161
  if (!hasValue(_value)) {
151
162
  _context.next = 8;
152
163
  break;
153
164
  }
154
165
  duplicated.push(item.token);
155
- return _context.abrupt("return", 1);
166
+ return _context.abrupt("return", 0);
156
167
  case 8:
157
168
  nextValue.push(_value);
158
169
  added.push(_value);
@@ -163,7 +174,7 @@ function _resolveTokenPaste() {
163
174
  if (idx >= 0) {
164
175
  nextInvalid.splice(idx, 1);
165
176
  }
166
- return _context.abrupt("return", 1);
177
+ return _context.abrupt("return", 0);
167
178
  case 13:
168
179
  // 未匹配
169
180
  invalid.push(item.token);
@@ -171,7 +182,7 @@ function _resolveTokenPaste() {
171
182
  _context.next = 16;
172
183
  break;
173
184
  }
174
- return _context.abrupt("return", 1);
185
+ return _context.abrupt("return", 0);
175
186
  case 16:
176
187
  value = (_item$value2 = item.value) !== null && _item$value2 !== void 0 ? _item$value2 : item.token;
177
188
  if (!hasValue(value)) {
@@ -179,7 +190,7 @@ function _resolveTokenPaste() {
179
190
  break;
180
191
  }
181
192
  duplicated.push(item.token);
182
- return _context.abrupt("return", 1);
193
+ return _context.abrupt("return", 0);
183
194
  case 20:
184
195
  nextValue.push(value);
185
196
  added.push(value);
@@ -197,7 +208,7 @@ function _resolveTokenPaste() {
197
208
  _iterator.s();
198
209
  case 19:
199
210
  if ((_step = _iterator.n()).done) {
200
- _context2.next = 28;
211
+ _context2.next = 26;
201
212
  break;
202
213
  }
203
214
  return _context2.delegateYield(_loop(), "t1", 21);
@@ -207,28 +218,22 @@ function _resolveTokenPaste() {
207
218
  _context2.next = 24;
208
219
  break;
209
220
  }
210
- return _context2.abrupt("break", 28);
221
+ return _context2.abrupt("continue", 24);
211
222
  case 24:
212
- if (!(_ret === 1)) {
213
- _context2.next = 26;
214
- break;
215
- }
216
- return _context2.abrupt("continue", 26);
217
- case 26:
218
223
  _context2.next = 19;
219
224
  break;
220
- case 28:
221
- _context2.next = 33;
225
+ case 26:
226
+ _context2.next = 31;
222
227
  break;
223
- case 30:
224
- _context2.prev = 30;
228
+ case 28:
229
+ _context2.prev = 28;
225
230
  _context2.t2 = _context2["catch"](16);
226
231
  _iterator.e(_context2.t2);
227
- case 33:
228
- _context2.prev = 33;
232
+ case 31:
233
+ _context2.prev = 31;
229
234
  _iterator.f();
230
- return _context2.finish(33);
231
- case 36:
235
+ return _context2.finish(31);
236
+ case 34:
232
237
  return _context2.abrupt("return", {
233
238
  added: added,
234
239
  duplicated: duplicated,
@@ -236,11 +241,11 @@ function _resolveTokenPaste() {
236
241
  nextValue: nextValue,
237
242
  nextInvalid: nextInvalid
238
243
  });
239
- case 37:
244
+ case 35:
240
245
  case "end":
241
246
  return _context2.stop();
242
247
  }
243
- }, _callee, null, [[16, 30, 33, 36]]);
248
+ }, _callee, null, [[16, 28, 31, 34]]);
244
249
  }));
245
250
  return _resolveTokenPaste.apply(this, arguments);
246
251
  }
@@ -243,12 +243,14 @@ a[disabled] {
243
243
  pointer-events: none;
244
244
  }
245
245
 
246
- [data-scrollbar-custom]::-webkit-scrollbar {
246
+ [data-scrollbar-custom]::-webkit-scrollbar,
247
+ .scrollbar-custom::-webkit-scrollbar {
247
248
  width: 14px;
248
249
  height: 14px;
249
250
  }
250
251
 
251
- [data-scrollbar-custom]::-webkit-scrollbar-thumb {
252
+ [data-scrollbar-custom]::-webkit-scrollbar-thumb,
253
+ .scrollbar-custom::-webkit-scrollbar-thumb {
252
254
  min-width: 14px;
253
255
  min-height: 14px;
254
256
  background-color: rgba(0, 0, 0, 10%);
@@ -257,15 +259,18 @@ a[disabled] {
257
259
  border-radius: 14px;
258
260
  }
259
261
 
260
- [data-scrollbar-custom]::-webkit-scrollbar-track {
262
+ [data-scrollbar-custom]::-webkit-scrollbar-track,
263
+ .scrollbar-custom::-webkit-scrollbar-track {
261
264
  background-color: rgba(0, 0, 0, 0%);
262
265
  }
263
266
 
264
- [data-scrollbar-custom]::-webkit-scrollbar-thumb:hover {
267
+ [data-scrollbar-custom]::-webkit-scrollbar-thumb:hover,
268
+ .scrollbar-custom::-webkit-scrollbar-thumb:hover {
265
269
  background-color: rgba(0, 0, 0, 20%);
266
270
  }
267
271
 
268
- [data-scrollbar-custom]::-webkit-scrollbar-thumb:active {
272
+ [data-scrollbar-custom]::-webkit-scrollbar-thumb:active,
273
+ .scrollbar-custom::-webkit-scrollbar-thumb:active {
269
274
  background-color: rgba(0, 0, 0, 30%);
270
275
  }
271
276
 
@@ -40,6 +40,7 @@ var TooltipGroup = function TooltipGroup(props) {
40
40
  children: child.props.children
41
41
  };
42
42
  }
43
+ return undefined;
43
44
  }).filter(Boolean);
44
45
  var _useState = useState(false),
45
46
  _useState2 = _slicedToArray(_useState, 2),
@@ -52,6 +53,14 @@ var TooltipGroup = function TooltipGroup(props) {
52
53
  var lastHoverIndex = useRef(hoverIndex);
53
54
  var hoverTimer = useRef(0);
54
55
  var tagRef = useRef(null);
56
+ var _useState5 = useState(0),
57
+ _useState6 = _slicedToArray(_useState5, 2),
58
+ offsetX = _useState6[0],
59
+ setOffsetX = _useState6[1];
60
+ var _useState7 = useState(0),
61
+ _useState8 = _slicedToArray(_useState7, 2),
62
+ offsetY = _useState8[0],
63
+ setOffsetY = _useState8[1];
55
64
  var handleMouseEnter = function handleMouseEnter(e, index) {
56
65
  clearTimeout(hoverTimer.current);
57
66
  var currentTarget = e.currentTarget;
@@ -95,20 +104,12 @@ var TooltipGroup = function TooltipGroup(props) {
95
104
  setOffsetY(offsetY);
96
105
  }, visible ? 0 : mouseEnterDelay * 1000);
97
106
  };
98
- var handleMouseLeave = function handleMouseLeave(e, index) {
107
+ var handleMouseLeave = function handleMouseLeave() {
99
108
  clearTimeout(hoverTimer.current);
100
109
  hoverTimer.current = window.setTimeout(function () {
101
110
  setVisible(false);
102
111
  }, 200);
103
112
  };
104
- var _useState5 = useState(0),
105
- _useState6 = _slicedToArray(_useState5, 2),
106
- offsetX = _useState6[0],
107
- setOffsetX = _useState6[1];
108
- var _useState7 = useState(0),
109
- _useState8 = _slicedToArray(_useState7, 2),
110
- offsetY = _useState8[0],
111
- setOffsetY = _useState8[1];
112
113
  useEffect(function () {
113
114
  if (lastHoverIndex.current !== hoverIndex) {
114
115
  lastHoverIndex.current = hoverIndex;
@@ -138,29 +139,29 @@ var TooltipGroup = function TooltipGroup(props) {
138
139
  popupStyle: _objectSpread(_objectSpread({}, popupStyle), {}, {
139
140
  transform: "translate(".concat(offsetX, "px, ").concat(offsetY, "px) scale(").concat(visible ? 1 : 0.8, ")")
140
141
  })
141
- }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tag, _objectSpread({
142
- ref: tagRef,
143
- children: tooltipInfos.map(function (info, index) {
144
- if ( /*#__PURE__*/React.isValidElement(info.children)) {
145
- var _ref2 = info.children.props,
146
- _onMouseEnter = _ref2.onMouseEnter,
147
- _onMouseLeave = _ref2.onMouseLeave,
148
- rest = _objectWithoutProperties(_ref2, _excluded2);
149
- return /*#__PURE__*/React.cloneElement(info.children, _objectSpread(_objectSpread({
150
- key: index
151
- }, rest), {}, {
152
- onMouseEnter: function onMouseEnter(e) {
153
- handleMouseEnter(e, index);
154
- _onMouseEnter === null || _onMouseEnter === void 0 || _onMouseEnter(e);
155
- },
156
- onMouseLeave: function onMouseLeave(e) {
157
- handleMouseLeave(e, index);
158
- _onMouseLeave === null || _onMouseLeave === void 0 || _onMouseLeave(e);
159
- }
160
- }));
161
- }
162
- })
163
- }, otherProps))));
142
+ }, /*#__PURE__*/React.createElement(Tag, _objectSpread({
143
+ ref: tagRef
144
+ }, otherProps), tooltipInfos.map(function (info, index) {
145
+ if ( /*#__PURE__*/React.isValidElement(info.children)) {
146
+ var _ref2 = info.children.props,
147
+ _onMouseEnter = _ref2.onMouseEnter,
148
+ _onMouseLeave = _ref2.onMouseLeave,
149
+ rest = _objectWithoutProperties(_ref2, _excluded2);
150
+ return /*#__PURE__*/React.cloneElement(info.children, _objectSpread(_objectSpread({
151
+ key: index
152
+ }, rest), {}, {
153
+ onMouseEnter: function onMouseEnter(e) {
154
+ handleMouseEnter(e, index);
155
+ _onMouseEnter === null || _onMouseEnter === void 0 || _onMouseEnter(e);
156
+ },
157
+ onMouseLeave: function onMouseLeave(e) {
158
+ handleMouseLeave();
159
+ _onMouseLeave === null || _onMouseLeave === void 0 || _onMouseLeave(e);
160
+ }
161
+ }));
162
+ }
163
+ return null;
164
+ })));
164
165
  };
165
166
  Tooltip.Group = TooltipGroup;
166
167
  Tooltip.displayName = 'Tooltip';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "one-design-next",
3
- "version": "0.0.65",
3
+ "version": "0.0.67",
4
4
  "description": "One Design Next from TAD@tencent.com",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -56,10 +56,6 @@
56
56
  "*.{md,json}": [
57
57
  "prettier --write --no-error-on-unmatched-pattern"
58
58
  ],
59
- "{components,test}/**/*.{css,scss}": [
60
- "stylelint --fix",
61
- "prettier --write"
62
- ],
63
59
  "{components,test}/**/*.{js,jsx}": [
64
60
  "eslint --fix",
65
61
  "prettier --write"