@sia.soul/sia-react-ui 0.1.111 → 0.1.112

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.
@@ -60,7 +60,7 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
60
60
  /** 主体之外的补充内容或操作区。 */
61
61
  extra?: ReactNode;
62
62
  /**
63
- * 点击卡片非交互区域切换选中,支持 Enter 和空格键;选中时显示右上角三角勾选标记。
63
+ * 点击卡片非交互区域切换选中,支持 Enter 和空格键;选中时显示主题色浅背景及右上角三角勾选标记。
64
64
  * @defaultValue false
65
65
  */
66
66
  selectable?: boolean;
@@ -60,7 +60,7 @@ interface CardProps extends Omit<HTMLAttributes<HTMLElement>, "title"> {
60
60
  /** 主体之外的补充内容或操作区。 */
61
61
  extra?: ReactNode;
62
62
  /**
63
- * 点击卡片非交互区域切换选中,支持 Enter 和空格键;选中时显示右上角三角勾选标记。
63
+ * 点击卡片非交互区域切换选中,支持 Enter 和空格键;选中时显示主题色浅背景及右上角三角勾选标记。
64
64
  * @defaultValue false
65
65
  */
66
66
  selectable?: boolean;
package/dist/core.css CHANGED
@@ -2650,6 +2650,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
2650
2650
  cursor: default;
2651
2651
  }
2652
2652
  .sia-card.sia-card--selected {
2653
+ background: color-mix(in srgb, var(--sia-color-primary) 10%, var(--sia-color-surface));
2653
2654
  border-color: var(--sia-color-primary);
2654
2655
  box-shadow: inset 0 0 0 1px var(--sia-color-primary);
2655
2656
  }
@@ -5555,6 +5556,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
5555
5556
  cursor: not-allowed;
5556
5557
  opacity: .5;
5557
5558
  }
5559
+ .sia-sortable-list__handle--custom {
5560
+ justify-content: flex-start;
5561
+ padding: 0;
5562
+ font: inherit;
5563
+ color: inherit;
5564
+ background: transparent;
5565
+ text-align: start;
5566
+ }
5558
5567
  .sia-sortable-list__item.is-drop-before::before,
5559
5568
  .sia-sortable-list__item.is-drop-after::after {
5560
5569
  content: "";
package/dist/core.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-CUF63Lgw.cjs';
1
+ export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-CmVKw5q8.cjs';
2
2
  export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
3
3
  export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-Cf0xz1Tg.cjs';
4
4
  import 'react';
package/dist/core.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-Ce07FS2N.js';
1
+ export { d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, h as Card, i as CardAccent, j as CardProps, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, K as Icon, L as IconName, M as IconProps, N as IconVariant, U as Input, V as InputProps, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, at as TabItem, au as Tabs, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, T as TagStatus, aD as TagVariant, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b4 as UploadProps, b8 as UploadRequestOptions, bc as message } from './core-ypvUN1on.js';
2
2
  export { b as Button, B as ButtonProps, a as ButtonSize, c as ButtonVariant } from './Button-BiL3Wjsd.js';
3
3
  export { e as Modal, d as ModalActionResult, M as ModalOpenConfig, f as ModalProps, g as ModalType, a as OverlayApiHandle, h as Select, S as SelectOption, c as SelectProps, j as SelectValue } from './Select-BddM4uXC.js';
4
4
  import 'react';
package/dist/game.css CHANGED
@@ -2659,6 +2659,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
2659
2659
  cursor: default;
2660
2660
  }
2661
2661
  .sia-card.sia-card--selected {
2662
+ background: color-mix(in srgb, var(--sia-color-primary) 10%, var(--sia-color-surface));
2662
2663
  border-color: var(--sia-color-primary);
2663
2664
  box-shadow: inset 0 0 0 1px var(--sia-color-primary);
2664
2665
  }
@@ -5564,6 +5565,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
5564
5565
  cursor: not-allowed;
5565
5566
  opacity: .5;
5566
5567
  }
5568
+ .sia-sortable-list__handle--custom {
5569
+ justify-content: flex-start;
5570
+ padding: 0;
5571
+ font: inherit;
5572
+ color: inherit;
5573
+ background: transparent;
5574
+ text-align: start;
5575
+ }
5567
5576
  .sia-sortable-list__item.is-drop-before::before,
5568
5577
  .sia-sortable-list__item.is-drop-after::after {
5569
5578
  content: "";
package/dist/index.cjs CHANGED
@@ -2127,7 +2127,7 @@ function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
2127
2127
  children
2128
2128
  ] }), document.body);
2129
2129
  }
2130
- function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false }) {
2130
+ function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false, handlePlacement = "before", handleContent }) {
2131
2131
  const [dragging, setDragging] = (0, import_react9.useState)(null);
2132
2132
  const [target, setTarget] = (0, import_react9.useState)(null);
2133
2133
  const clear = () => {
@@ -2149,60 +2149,63 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
2149
2149
  }, [disabled, dragging, items]);
2150
2150
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", onDragLeave: (event) => {
2151
2151
  if (!event.currentTarget.contains(event.relatedTarget)) setTarget(null);
2152
- }, children: items.map((key, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2153
- "div",
2154
- {
2155
- role: "listitem",
2156
- className: `sia-sortable-list__item${dragging === key ? " is-dragging" : ""}${target === index ? " is-drop-before" : ""}${target === items.length && index === items.length - 1 ? " is-drop-after" : ""}`,
2157
- onDragOver: (event) => {
2158
- if (disabled || dragging === null) return;
2159
- event.preventDefault();
2160
- event.dataTransfer.dropEffect = "move";
2161
- const rect = event.currentTarget.getBoundingClientRect();
2162
- setTarget(index + (direction === "horizontal" ? Number(event.clientX > rect.left + rect.width / 2) : Number(event.clientY > rect.top + rect.height / 2)));
2163
- },
2164
- onDrop: (event) => {
2165
- if (dragging === null || disabled) return;
2166
- event.preventDefault();
2167
- if (target !== null) move(dragging, target);
2168
- clear();
2169
- },
2170
- children: [
2171
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2172
- "button",
2173
- {
2174
- type: "button",
2175
- className: "sia-sortable-list__handle",
2176
- draggable: !disabled,
2177
- disabled,
2178
- "aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
2179
- title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
2180
- onDragStart: (event) => {
2181
- if (disabled) {
2182
- event.preventDefault();
2183
- return;
2184
- }
2185
- setDragging(key);
2186
- event.dataTransfer.effectAllowed = "move";
2187
- event.dataTransfer.setData("text/plain", String(key));
2188
- },
2189
- onDragEnd: clear,
2190
- onKeyDown: (event) => {
2191
- const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
2192
- const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
2193
- if (event.key === previous || event.key === next) {
2194
- event.preventDefault();
2195
- move(key, event.key === previous ? index - 1 : index + 2);
2196
- }
2197
- },
2198
- children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "menu", size: 16 })
2152
+ }, children: items.map((key, index) => {
2153
+ const handle = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2154
+ "button",
2155
+ {
2156
+ type: "button",
2157
+ className: `sia-sortable-list__handle${handlePlacement === "custom" ? " sia-sortable-list__handle--custom" : ""}`,
2158
+ draggable: !disabled,
2159
+ disabled,
2160
+ "aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
2161
+ title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
2162
+ onDragStart: (event) => {
2163
+ if (disabled) {
2164
+ event.preventDefault();
2165
+ return;
2199
2166
  }
2200
- ),
2201
- renderItem(key, index)
2202
- ]
2203
- },
2204
- key
2205
- )) });
2167
+ setDragging(key);
2168
+ event.dataTransfer.effectAllowed = "move";
2169
+ event.dataTransfer.setData("text/plain", String(key));
2170
+ },
2171
+ onDragEnd: clear,
2172
+ onKeyDown: (event) => {
2173
+ const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
2174
+ const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
2175
+ if (event.key === previous || event.key === next) {
2176
+ event.preventDefault();
2177
+ move(key, event.key === previous ? index - 1 : index + 2);
2178
+ }
2179
+ },
2180
+ children: handleContent ? handleContent(key, index) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: "menu", size: 16 })
2181
+ }
2182
+ );
2183
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2184
+ "div",
2185
+ {
2186
+ role: "listitem",
2187
+ className: `sia-sortable-list__item${dragging === key ? " is-dragging" : ""}${target === index ? " is-drop-before" : ""}${target === items.length && index === items.length - 1 ? " is-drop-after" : ""}`,
2188
+ onDragOver: (event) => {
2189
+ if (disabled || dragging === null) return;
2190
+ event.preventDefault();
2191
+ event.dataTransfer.dropEffect = "move";
2192
+ const rect = event.currentTarget.getBoundingClientRect();
2193
+ setTarget(index + (direction === "horizontal" ? Number(event.clientX > rect.left + rect.width / 2) : Number(event.clientY > rect.top + rect.height / 2)));
2194
+ },
2195
+ onDrop: (event) => {
2196
+ if (dragging === null || disabled) return;
2197
+ event.preventDefault();
2198
+ if (target !== null) move(dragging, target);
2199
+ clear();
2200
+ },
2201
+ children: [
2202
+ handlePlacement === "before" ? handle : null,
2203
+ renderItem(key, index, handle)
2204
+ ]
2205
+ },
2206
+ key
2207
+ );
2208
+ }) });
2206
2209
  }
2207
2210
 
2208
2211
  // src/components/Toolbar.tsx
package/dist/index.css CHANGED
@@ -2650,6 +2650,7 @@ fieldset:disabled .sia-input-number__floating-placeholder {
2650
2650
  cursor: default;
2651
2651
  }
2652
2652
  .sia-card.sia-card--selected {
2653
+ background: color-mix(in srgb, var(--sia-color-primary) 10%, var(--sia-color-surface));
2653
2654
  border-color: var(--sia-color-primary);
2654
2655
  box-shadow: inset 0 0 0 1px var(--sia-color-primary);
2655
2656
  }
@@ -5555,6 +5556,14 @@ fieldset:disabled .sia-input-number__floating-placeholder {
5555
5556
  cursor: not-allowed;
5556
5557
  opacity: .5;
5557
5558
  }
5559
+ .sia-sortable-list__handle--custom {
5560
+ justify-content: flex-start;
5561
+ padding: 0;
5562
+ font: inherit;
5563
+ color: inherit;
5564
+ background: transparent;
5565
+ text-align: start;
5566
+ }
5558
5567
  .sia-sortable-list__item.is-drop-before::before,
5559
5568
  .sia-sortable-list__item.is-drop-after::after {
5560
5569
  content: "";
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
3
- import { T as TagStatus, B as BadgeProps } from './core-CUF63Lgw.cjs';
4
- export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-CUF63Lgw.cjs';
3
+ import { T as TagStatus, B as BadgeProps } from './core-CmVKw5q8.cjs';
4
+ export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-CmVKw5q8.cjs';
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.cjs';
6
6
  import { B as ButtonProps, a as ButtonSize } from './Button-O_pNB3SQ.cjs';
7
7
  export { b as Button, c as ButtonVariant } from './Button-O_pNB3SQ.cjs';
@@ -78,8 +78,12 @@ type SortableKey = string | number;
78
78
  interface SortableListProps {
79
79
  /** 按当前顺序排列的唯一稳定标识,不允许重复。 */
80
80
  items: readonly SortableKey[];
81
- /** 根据标识渲染条目内容;拖动仅由框架手柄发起,内容输入控件保持原生操作。 */
82
- renderItem: (key: SortableKey, index: number) => ReactNode;
81
+ /** 根据标识渲染条目内容;第三个参数为框架手柄,handlePlacement="custom" 时须将其放入标题等位置;拖动和键盘排序仅由该手柄发起。 */
82
+ renderItem: (key: SortableKey, index: number, handle: ReactNode) => ReactNode;
83
+ /** 手柄位置;before 在条目前独占一行,custom 由 renderItem 放置框架提供的手柄。@defaultValue "before" */
84
+ handlePlacement?: "before" | "custom";
85
+ /** 手柄的内容,接收稳定标识和当前位置;未指定时显示拖动图标,可返回卡片标题文字。 */
86
+ handleContent?: (key: SortableKey, index: number) => ReactNode;
83
87
  /** 拖放或手柄方向键完成移动时返回新顺序;无变化、取消、禁用时不触发。 */
84
88
  onOrderChange: (items: SortableKey[]) => void;
85
89
  /** 排列方向;横向内容超出时在列表内滚动。@defaultValue "horizontal" */
@@ -88,7 +92,7 @@ interface SortableListProps {
88
92
  disabled?: boolean;
89
93
  }
90
94
  /** 拖放与键盘共用受控顺序,输入控件无需参与拖动事件。 */
91
- declare function SortableList({ items, renderItem, onOrderChange, direction, disabled }: SortableListProps): react.JSX.Element;
95
+ declare function SortableList({ items, renderItem, onOrderChange, direction, disabled, handlePlacement, handleContent }: SortableListProps): react.JSX.Element;
92
96
 
93
97
  /** 警告提示的状态类型。 */
94
98
  type AlertStatus = "info" | "success" | "warning" | "error";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { HTMLAttributes, ReactNode, CSSProperties, ElementType, FormHTMLAttributes, InputHTMLAttributes, ChangeEvent, TextareaHTMLAttributes, MouseEvent, Key, PointerEvent, Ref, ReactElement, ButtonHTMLAttributes, RefObject } from 'react';
3
- import { T as TagStatus, B as BadgeProps } from './core-Ce07FS2N.js';
4
- export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-Ce07FS2N.js';
3
+ import { T as TagStatus, B as BadgeProps } from './core-ypvUN1on.js';
4
+ export { a as Badge, b as BadgeRibbonProps, c as BadgeStatus, d as Breadcrumb, e as BreadcrumbItem, f as BreadcrumbProps, C as Calendar, g as CalendarProps, h as Card, i as CardAccent, j as CardProps, k as Carousel, l as CarouselProps, m as CarouselRef, n as Collapse, o as CollapseItem, p as CollapseKey, q as CollapseProps, D as Dropdown, r as DropdownButtonProps, s as DropdownMenuProps, t as DropdownOpenSource, u as DropdownPlacement, v as DropdownProps, w as DropdownTrigger, F as FILLED_ICON_NAMES, x as FilledIconName, y as FloatButton, z as FloatButtonBackTopProps, A as FloatButtonGroupProps, E as FloatButtonProps, G as FloatButtonShape, H as FloatingPlacement, I as FloatingTrigger, J as ICON_NAMES, K as Icon, L as IconName, M as IconProps, N as IconVariant, O as Image, P as ImagePreview, Q as ImagePreviewConfig, R as ImagePreviewProps, S as ImageProps, U as Input, V as InputProps, W as Menu, X as MenuClickInfo, Y as MenuItem, Z as MenuMode, _ as MenuProps, $ as MenuTheme, a0 as MessageConfig, a1 as MessageHandle, a2 as MessageKey, a3 as MessageType, a4 as NotificationConfig, a5 as NotificationPlacement, a6 as NotificationType, a7 as Popconfirm, a8 as PopconfirmProps, a9 as Popover, aa as PopoverProps, ab as Progress, ac as ProgressProps, ad as ProgressStatus, ae as Rate, af as RateProps, ag as Result, ah as ResultProps, ai as ResultStatus, aj as Segmented, ak as SegmentedOption, al as SegmentedProps, am as SegmentedValue, an as Spin, ao as SpinProps, ap as StepItem, aq as StepStatus, ar as Steps, as as StepsProps, at as TabItem, au as Tabs, av as TabsContextMenuClickInfo, aw as TabsOrientation, ax as TabsPosition, ay as TabsProps, az as TabsType, aA as Tag, aB as TagProps, aC as TagSize, aD as TagVariant, aE as Timeline, aF as TimelineItem, aG as TimelineProps, aH as Toolbar, aI as ToolbarItem, aJ as ToolbarProps, aK as Tooltip, aL as TooltipProps, aM as Tour, aN as TourProps, aO as TourStep, aP as Tree, aQ as TreeDropPosition, aR as TreeKey, aS as TreeNode, aT as TreeProps, aU as Typography, aV as TypographyLinkProps, aW as TypographyProps, aX as TypographyTitleProps, aY as TypographyType, aZ as Upload, a_ as UploadChangeInfo, a$ as UploadDraggerProps, b0 as UploadFile, b1 as UploadFileStatus, b2 as UploadHttpRequest, b3 as UploadItemActions, b4 as UploadProps, b5 as UploadRef, b6 as UploadRejectInfo, b7 as UploadRequestHandle, b8 as UploadRequestOptions, b9 as Watermark, ba as WatermarkFont, bb as WatermarkProps, bc as message, bd as notification } from './core-ypvUN1on.js';
5
5
  import { C as ControlSize, I as InputPlaceholderMode, a as ControlStatus } from './shared-Bx4B28Wh.js';
6
6
  import { B as ButtonProps, a as ButtonSize } from './Button-BiL3Wjsd.js';
7
7
  export { b as Button, c as ButtonVariant } from './Button-BiL3Wjsd.js';
@@ -78,8 +78,12 @@ type SortableKey = string | number;
78
78
  interface SortableListProps {
79
79
  /** 按当前顺序排列的唯一稳定标识,不允许重复。 */
80
80
  items: readonly SortableKey[];
81
- /** 根据标识渲染条目内容;拖动仅由框架手柄发起,内容输入控件保持原生操作。 */
82
- renderItem: (key: SortableKey, index: number) => ReactNode;
81
+ /** 根据标识渲染条目内容;第三个参数为框架手柄,handlePlacement="custom" 时须将其放入标题等位置;拖动和键盘排序仅由该手柄发起。 */
82
+ renderItem: (key: SortableKey, index: number, handle: ReactNode) => ReactNode;
83
+ /** 手柄位置;before 在条目前独占一行,custom 由 renderItem 放置框架提供的手柄。@defaultValue "before" */
84
+ handlePlacement?: "before" | "custom";
85
+ /** 手柄的内容,接收稳定标识和当前位置;未指定时显示拖动图标,可返回卡片标题文字。 */
86
+ handleContent?: (key: SortableKey, index: number) => ReactNode;
83
87
  /** 拖放或手柄方向键完成移动时返回新顺序;无变化、取消、禁用时不触发。 */
84
88
  onOrderChange: (items: SortableKey[]) => void;
85
89
  /** 排列方向;横向内容超出时在列表内滚动。@defaultValue "horizontal" */
@@ -88,7 +92,7 @@ interface SortableListProps {
88
92
  disabled?: boolean;
89
93
  }
90
94
  /** 拖放与键盘共用受控顺序,输入控件无需参与拖动事件。 */
91
- declare function SortableList({ items, renderItem, onOrderChange, direction, disabled }: SortableListProps): react.JSX.Element;
95
+ declare function SortableList({ items, renderItem, onOrderChange, direction, disabled, handlePlacement, handleContent }: SortableListProps): react.JSX.Element;
92
96
 
93
97
  /** 警告提示的状态类型。 */
94
98
  type AlertStatus = "info" | "success" | "warning" | "error";
package/dist/index.js CHANGED
@@ -209,7 +209,7 @@ function FloatingPanel({ open, title, children, placement = "bottomRight" }) {
209
209
  children
210
210
  ] }), document.body);
211
211
  }
212
- function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false }) {
212
+ function SortableList({ items, renderItem, onOrderChange, direction = "horizontal", disabled = false, handlePlacement = "before", handleContent }) {
213
213
  const [dragging, setDragging] = useState2(null);
214
214
  const [target, setTarget] = useState2(null);
215
215
  const clear = () => {
@@ -231,60 +231,63 @@ function SortableList({ items, renderItem, onOrderChange, direction = "horizonta
231
231
  }, [disabled, dragging, items]);
232
232
  return /* @__PURE__ */ jsx2("div", { className: `sia-sortable-list sia-sortable-list--${direction}`, role: "list", onDragLeave: (event) => {
233
233
  if (!event.currentTarget.contains(event.relatedTarget)) setTarget(null);
234
- }, children: items.map((key, index) => /* @__PURE__ */ jsxs2(
235
- "div",
236
- {
237
- role: "listitem",
238
- className: `sia-sortable-list__item${dragging === key ? " is-dragging" : ""}${target === index ? " is-drop-before" : ""}${target === items.length && index === items.length - 1 ? " is-drop-after" : ""}`,
239
- onDragOver: (event) => {
240
- if (disabled || dragging === null) return;
241
- event.preventDefault();
242
- event.dataTransfer.dropEffect = "move";
243
- const rect = event.currentTarget.getBoundingClientRect();
244
- setTarget(index + (direction === "horizontal" ? Number(event.clientX > rect.left + rect.width / 2) : Number(event.clientY > rect.top + rect.height / 2)));
245
- },
246
- onDrop: (event) => {
247
- if (dragging === null || disabled) return;
248
- event.preventDefault();
249
- if (target !== null) move(dragging, target);
250
- clear();
251
- },
252
- children: [
253
- /* @__PURE__ */ jsx2(
254
- "button",
255
- {
256
- type: "button",
257
- className: "sia-sortable-list__handle",
258
- draggable: !disabled,
259
- disabled,
260
- "aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
261
- title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
262
- onDragStart: (event) => {
263
- if (disabled) {
264
- event.preventDefault();
265
- return;
266
- }
267
- setDragging(key);
268
- event.dataTransfer.effectAllowed = "move";
269
- event.dataTransfer.setData("text/plain", String(key));
270
- },
271
- onDragEnd: clear,
272
- onKeyDown: (event) => {
273
- const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
274
- const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
275
- if (event.key === previous || event.key === next) {
276
- event.preventDefault();
277
- move(key, event.key === previous ? index - 1 : index + 2);
278
- }
279
- },
280
- children: /* @__PURE__ */ jsx2(Icon, { name: "menu", size: 16 })
234
+ }, children: items.map((key, index) => {
235
+ const handle = /* @__PURE__ */ jsx2(
236
+ "button",
237
+ {
238
+ type: "button",
239
+ className: `sia-sortable-list__handle${handlePlacement === "custom" ? " sia-sortable-list__handle--custom" : ""}`,
240
+ draggable: !disabled,
241
+ disabled,
242
+ "aria-label": `\u8C03\u6574\u7B2C ${index + 1} \u9879\u987A\u5E8F`,
243
+ title: "\u62D6\u52A8\u6392\u5E8F\uFF0C\u6216\u4F7F\u7528\u65B9\u5411\u952E\u79FB\u52A8",
244
+ onDragStart: (event) => {
245
+ if (disabled) {
246
+ event.preventDefault();
247
+ return;
281
248
  }
282
- ),
283
- renderItem(key, index)
284
- ]
285
- },
286
- key
287
- )) });
249
+ setDragging(key);
250
+ event.dataTransfer.effectAllowed = "move";
251
+ event.dataTransfer.setData("text/plain", String(key));
252
+ },
253
+ onDragEnd: clear,
254
+ onKeyDown: (event) => {
255
+ const previous = direction === "horizontal" ? "ArrowLeft" : "ArrowUp";
256
+ const next = direction === "horizontal" ? "ArrowRight" : "ArrowDown";
257
+ if (event.key === previous || event.key === next) {
258
+ event.preventDefault();
259
+ move(key, event.key === previous ? index - 1 : index + 2);
260
+ }
261
+ },
262
+ children: handleContent ? handleContent(key, index) : /* @__PURE__ */ jsx2(Icon, { name: "menu", size: 16 })
263
+ }
264
+ );
265
+ return /* @__PURE__ */ jsxs2(
266
+ "div",
267
+ {
268
+ role: "listitem",
269
+ className: `sia-sortable-list__item${dragging === key ? " is-dragging" : ""}${target === index ? " is-drop-before" : ""}${target === items.length && index === items.length - 1 ? " is-drop-after" : ""}`,
270
+ onDragOver: (event) => {
271
+ if (disabled || dragging === null) return;
272
+ event.preventDefault();
273
+ event.dataTransfer.dropEffect = "move";
274
+ const rect = event.currentTarget.getBoundingClientRect();
275
+ setTarget(index + (direction === "horizontal" ? Number(event.clientX > rect.left + rect.width / 2) : Number(event.clientY > rect.top + rect.height / 2)));
276
+ },
277
+ onDrop: (event) => {
278
+ if (dragging === null || disabled) return;
279
+ event.preventDefault();
280
+ if (target !== null) move(dragging, target);
281
+ clear();
282
+ },
283
+ children: [
284
+ handlePlacement === "before" ? handle : null,
285
+ renderItem(key, index, handle)
286
+ ]
287
+ },
288
+ key
289
+ );
290
+ }) });
288
291
  }
289
292
 
290
293
  // src/components/Alert.tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.111",
3
+ "version": "0.1.112",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",