@sia.soul/sia-react-ui 0.1.83 → 0.1.84

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.
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  Popover,
3
3
  Tooltip
4
- } from "./chunk-V4GGPMKS.js";
4
+ } from "./chunk-W3EKQOPR.js";
5
5
  import {
6
6
  Dropdown,
7
7
  Icon,
8
8
  useOverlayLifecycle
9
- } from "./chunk-CLBWJEID.js";
9
+ } from "./chunk-VNVDG4AC.js";
10
10
  import {
11
11
  Button,
12
12
  TextArea
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  FloatingScrollbarProvider,
3
3
  Select
4
- } from "./chunk-V4GGPMKS.js";
4
+ } from "./chunk-W3EKQOPR.js";
5
5
  import {
6
6
  Icon
7
- } from "./chunk-CLBWJEID.js";
7
+ } from "./chunk-VNVDG4AC.js";
8
8
  import {
9
9
  PopupPortal,
10
10
  useControlSize,
@@ -2,7 +2,7 @@ import {
2
2
  Dropdown,
3
3
  Icon,
4
4
  Input
5
- } from "./chunk-CLBWJEID.js";
5
+ } from "./chunk-VNVDG4AC.js";
6
6
  import {
7
7
  Button
8
8
  } from "./chunk-SJFT5OSX.js";
@@ -1051,7 +1051,7 @@ function Steps({ items, current = 0, initial = 0, direction = "horizontal", type
1051
1051
  ] }, index);
1052
1052
  }) });
1053
1053
  }
1054
- function Segmented({ options, value, defaultValue, size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
1054
+ function Segmented({ options, value, defaultValue, variant = "default", size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
1055
1055
  const size = useControlSize(sizeProp);
1056
1056
  const normalized = useMemo(() => options.map((option) => typeof option === "object" ? option : { label: option, value: option }), [options]);
1057
1057
  const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? normalized[0]?.value, onChange: (next) => next !== void 0 && onChange?.(next) });
@@ -1064,7 +1064,7 @@ function Segmented({ options, value, defaultValue, size: sizeProp, block = false
1064
1064
  const next = event.key === "ArrowRight" || event.key === "ArrowDown" ? enabled[(index + 1) % enabled.length] : enabled[(index - 1 + enabled.length) % enabled.length];
1065
1065
  if (next) setCurrent(next.value);
1066
1066
  }
1067
- return /* @__PURE__ */ jsx3("div", { className: `sia-segmented sia-segmented--${size}${block ? " sia-segmented--block" : ""}${vertical ? " sia-segmented--vertical" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", onKeyDown: keyboard, ...withTitleTooltip(props), children: normalized.map((option) => /* @__PURE__ */ createElement("button", { type: "button", role: "radio", "aria-checked": option.value === current, ...withTitleTooltip({ title: option.title }), className: option.value === current ? "is-selected" : "", disabled: disabled || option.disabled, key: option.value, onClick: () => setCurrent(option.value) }, option.icon, /* @__PURE__ */ jsx3("span", { children: option.label ?? option.value }))) });
1067
+ return /* @__PURE__ */ jsx3("div", { className: `sia-segmented sia-segmented--${size}${variant === "zigzag" && !vertical && normalized.length === 2 ? " sia-segmented--zigzag" : ""}${block ? " sia-segmented--block" : ""}${vertical ? " sia-segmented--vertical" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", onKeyDown: keyboard, ...withTitleTooltip(props), children: normalized.map((option) => /* @__PURE__ */ createElement("button", { type: "button", role: "radio", "aria-checked": option.value === current, ...withTitleTooltip({ title: option.title }), className: option.value === current ? "is-selected" : "", disabled: disabled || option.disabled, key: option.value, onClick: () => setCurrent(option.value) }, option.icon, /* @__PURE__ */ jsx3("span", { children: option.label ?? option.value }))) });
1068
1068
  }
1069
1069
 
1070
1070
  // src/components/Dropdown.tsx
@@ -3,7 +3,7 @@ import {
3
3
  Icon,
4
4
  Input,
5
5
  Modal
6
- } from "./chunk-CLBWJEID.js";
6
+ } from "./chunk-VNVDG4AC.js";
7
7
  import {
8
8
  Button
9
9
  } from "./chunk-SJFT5OSX.js";
@@ -661,6 +661,12 @@ type SegmentedOption = SegmentedValue | {
661
661
  };
662
662
  /** 分段选择的属性配置。 */
663
663
  interface SegmentedProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
664
+ /**
665
+ * default 为圆角分段样式;slash 为横向闪电折线分隔样式,选中项使用主题色高亮。
666
+ * 仅支持两个横向选项;vertical=true 或选项数量不为 2 时回退为 default 样式。
667
+ * @defaultValue "default"
668
+ */
669
+ variant?: "default" | "zigzag";
664
670
  /** 可供用户选择的候选项列表。 */
665
671
  options: readonly SegmentedOption[];
666
672
  /** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
@@ -688,7 +694,7 @@ interface SegmentedProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultVa
688
694
  onChange?: (value: SegmentedValue) => void;
689
695
  }
690
696
  /** 分段选择组件。 */
691
- declare function Segmented({ options, value, defaultValue, size: sizeProp, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
697
+ declare function Segmented({ options, value, defaultValue, variant, size: sizeProp, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
692
698
 
693
699
  /** Tab的项目定义。 */
694
700
  interface TabItem {
@@ -661,6 +661,12 @@ type SegmentedOption = SegmentedValue | {
661
661
  };
662
662
  /** 分段选择的属性配置。 */
663
663
  interface SegmentedProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
664
+ /**
665
+ * default 为圆角分段样式;slash 为横向闪电折线分隔样式,选中项使用主题色高亮。
666
+ * 仅支持两个横向选项;vertical=true 或选项数量不为 2 时回退为 default 样式。
667
+ * @defaultValue "default"
668
+ */
669
+ variant?: "default" | "zigzag";
664
670
  /** 可供用户选择的候选项列表。 */
665
671
  options: readonly SegmentedOption[];
666
672
  /** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
@@ -688,7 +694,7 @@ interface SegmentedProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultVa
688
694
  onChange?: (value: SegmentedValue) => void;
689
695
  }
690
696
  /** 分段选择组件。 */
691
- declare function Segmented({ options, value, defaultValue, size: sizeProp, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
697
+ declare function Segmented({ options, value, defaultValue, variant, size: sizeProp, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
692
698
 
693
699
  /** Tab的项目定义。 */
694
700
  interface TabItem {
package/dist/core.cjs CHANGED
@@ -1408,7 +1408,7 @@ function Menu({
1408
1408
  }
1409
1409
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
1410
1410
  }
1411
- function Segmented({ options, value, defaultValue, size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
1411
+ function Segmented({ options, value, defaultValue, variant = "default", size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
1412
1412
  const size = useControlSize(sizeProp);
1413
1413
  const normalized = (0, import_react5.useMemo)(() => options.map((option) => typeof option === "object" ? option : { label: option, value: option }), [options]);
1414
1414
  const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? normalized[0]?.value, onChange: (next) => next !== void 0 && onChange?.(next) });
@@ -1421,7 +1421,7 @@ function Segmented({ options, value, defaultValue, size: sizeProp, block = false
1421
1421
  const next = event.key === "ArrowRight" || event.key === "ArrowDown" ? enabled[(index + 1) % enabled.length] : enabled[(index - 1 + enabled.length) % enabled.length];
1422
1422
  if (next) setCurrent(next.value);
1423
1423
  }
1424
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `sia-segmented sia-segmented--${size}${block ? " sia-segmented--block" : ""}${vertical ? " sia-segmented--vertical" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", onKeyDown: keyboard, ...withTitleTooltip(props), children: normalized.map((option) => /* @__PURE__ */ (0, import_react6.createElement)("button", { type: "button", role: "radio", "aria-checked": option.value === current, ...withTitleTooltip({ title: option.title }), className: option.value === current ? "is-selected" : "", disabled: disabled || option.disabled, key: option.value, onClick: () => setCurrent(option.value) }, option.icon, /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: option.label ?? option.value }))) });
1424
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: `sia-segmented sia-segmented--${size}${variant === "zigzag" && !vertical && normalized.length === 2 ? " sia-segmented--zigzag" : ""}${block ? " sia-segmented--block" : ""}${vertical ? " sia-segmented--vertical" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", onKeyDown: keyboard, ...withTitleTooltip(props), children: normalized.map((option) => /* @__PURE__ */ (0, import_react6.createElement)("button", { type: "button", role: "radio", "aria-checked": option.value === current, ...withTitleTooltip({ title: option.title }), className: option.value === current ? "is-selected" : "", disabled: disabled || option.disabled, key: option.value, onClick: () => setCurrent(option.value) }, option.icon, /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: option.label ?? option.value }))) });
1425
1425
  }
1426
1426
 
1427
1427
  // src/components/Dropdown.tsx
package/dist/core.css CHANGED
@@ -5055,6 +5055,69 @@ fieldset:disabled .sia-input-number__floating-placeholder {
5055
5055
  gap: var(--sia-query-field-gap, 8px);
5056
5056
  padding-top: 8px;
5057
5057
  }
5058
+ .sia-query-settings {
5059
+ display: grid;
5060
+ gap: 12px;
5061
+ }
5062
+ .sia-query-settings__trigger.sia-button {
5063
+ padding-inline: 6px;
5064
+ }
5065
+ .sia-query-settings__hint {
5066
+ margin: 0;
5067
+ color: var(--sia-color-text-secondary);
5068
+ }
5069
+ .sia-query-settings__list {
5070
+ display: grid;
5071
+ gap: 6px;
5072
+ max-height: 360px;
5073
+ overflow-y: auto;
5074
+ }
5075
+ .sia-query-settings__item {
5076
+ position: relative;
5077
+ display: flex;
5078
+ align-items: center;
5079
+ gap: 8px;
5080
+ min-height: 42px;
5081
+ padding: 8px;
5082
+ background: var(--sia-color-surface);
5083
+ border: 1px solid var(--sia-color-border);
5084
+ border-radius: var(--sia-radius);
5085
+ touch-action: none;
5086
+ cursor: grab;
5087
+ }
5088
+ .sia-query-settings__item.is-disabled {
5089
+ cursor: default;
5090
+ }
5091
+ .sia-query-settings__name {
5092
+ flex: 1;
5093
+ min-width: 0;
5094
+ overflow-wrap: anywhere;
5095
+ }
5096
+ .sia-query-settings__list.is-sorting .sia-query-settings__item {
5097
+ transition: transform 180ms ease;
5098
+ user-select: none;
5099
+ }
5100
+ .sia-query-settings__list.is-sorting .sia-query-settings__item.is-dragging {
5101
+ z-index: 2;
5102
+ transition: none;
5103
+ cursor: grabbing;
5104
+ border-color: var(--sia-color-primary);
5105
+ background: var(--sia-color-primary-light);
5106
+ box-shadow: 0 4px 10px -3px rgb(0 0 0 / 25%);
5107
+ }
5108
+ @media (prefers-reduced-motion: reduce) {
5109
+ .sia-query-settings__list.is-sorting .sia-query-settings__item {
5110
+ transition: none;
5111
+ }
5112
+ }
5113
+ .sia-query-settings__item > .sia-checkbox {
5114
+ min-width: 0;
5115
+ overflow-wrap: anywhere;
5116
+ }
5117
+ .sia-query-settings__order {
5118
+ display: flex;
5119
+ flex-shrink: 0;
5120
+ }
5058
5121
  .sia-query-form__field {
5059
5122
  --sia-query-item-width: var(--sia-query-field-width, 220px);
5060
5123
  flex: 0 1 var(--sia-query-item-width);
@@ -10539,6 +10602,60 @@ button.sia-treemap__tile:focus-visible,
10539
10602
  .sia-time-panel button {
10540
10603
  font: inherit;
10541
10604
  }
10605
+ .sia-segmented.sia-segmented--zigzag {
10606
+ gap: 0;
10607
+ padding: 0;
10608
+ overflow: hidden;
10609
+ background: var(--sia-color-surface);
10610
+ border: 1px solid var(--sia-color-border);
10611
+ border-radius: 999px;
10612
+ }
10613
+ .sia-segmented--zigzag:not(.sia-segmented--block) {
10614
+ width: max-content;
10615
+ }
10616
+ .sia-segmented--zigzag button {
10617
+ position: relative;
10618
+ isolation: isolate;
10619
+ padding-inline: 20px;
10620
+ border-radius: 0;
10621
+ }
10622
+ .sia-segmented--zigzag button::before {
10623
+ position: absolute;
10624
+ z-index: -1;
10625
+ inset: 0;
10626
+ content: "";
10627
+ background: var(--sia-color-surface);
10628
+ transition: background 140ms ease;
10629
+ pointer-events: none;
10630
+ }
10631
+ .sia-segmented--zigzag button:first-child::before {
10632
+ right: -6px;
10633
+ clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 42%, calc(100% - 2px) 42%, calc(100% - 12px) 100%, 0 100%);
10634
+ }
10635
+ .sia-segmented--zigzag button:last-child::before {
10636
+ left: -6px;
10637
+ clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%, 10px 42%, 2px 42%);
10638
+ }
10639
+ .sia-segmented--zigzag button:hover:not(:disabled)::before {
10640
+ background: var(--sia-color-control-hover);
10641
+ }
10642
+ .sia-segmented--zigzag button.is-selected {
10643
+ z-index: 1;
10644
+ color: #fff;
10645
+ background: transparent;
10646
+ box-shadow: none;
10647
+ }
10648
+ .sia-segmented--zigzag button.is-selected::before,
10649
+ .sia-segmented--zigzag button.is-selected:hover:not(:disabled)::before {
10650
+ background: var(--sia-color-primary);
10651
+ }
10652
+ .sia-segmented--zigzag button.is-selected:hover:not(:disabled) {
10653
+ color: #fff;
10654
+ }
10655
+ .sia-segmented--zigzag button:focus-visible {
10656
+ outline: 2px solid var(--sia-color-primary);
10657
+ outline-offset: -2px;
10658
+ }
10542
10659
 
10543
10660
  /* src/title-tooltip.css */
10544
10661
  body > .sia-title-tooltip[data-sia-popup-layer] {
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 Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-DOEG2EHr.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 Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-BT21wlHN.cjs';
2
2
  export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-Bv2AmXRD.cjs';
3
3
  import 'react';
4
4
  import './shared-Bx4B28Wh.cjs';
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 Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-BjXlrCQ3.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 Segmented, ah as SegmentedOption, ai as SegmentedProps, aj as SegmentedValue, aq as TabItem, ar as Tabs, at as TabsOrientation, au as TabsPosition, av as TabsProps, aw as TabsType, ax as Tag, ay as TagProps, az as TagSize, T as TagStatus, aA as TagVariant, aE as Toolbar, aF as ToolbarItem, aG as ToolbarProps, aR as Typography, aS as TypographyLinkProps, aT as TypographyProps, aU as TypographyTitleProps, aV as TypographyType, aW as Upload, aX as UploadChangeInfo, aY as UploadDraggerProps, aZ as UploadFile, a_ as UploadFileStatus, b1 as UploadProps, b5 as UploadRequestOptions, b9 as message } from './core-OI4ySo2K.js';
2
2
  export { f as Button, B as ButtonProps, e as ButtonSize, g as ButtonVariant, h as Modal, d as ModalActionResult, M as ModalOpenConfig, i as ModalProps, j as ModalType, a as OverlayApiHandle, k as Select, S as SelectOption, c as SelectProps, m as SelectValue } from './Select-Cc1owuvN.js';
3
3
  import 'react';
4
4
  import './shared-Bx4B28Wh.js';
package/dist/core.js CHANGED
@@ -10,16 +10,16 @@ import {
10
10
  Typography,
11
11
  Upload,
12
12
  message
13
- } from "./chunk-BCOFQJ76.js";
13
+ } from "./chunk-2ETLCXNS.js";
14
14
  import {
15
15
  Select
16
- } from "./chunk-V4GGPMKS.js";
16
+ } from "./chunk-W3EKQOPR.js";
17
17
  import {
18
18
  Icon,
19
19
  Input,
20
20
  Modal,
21
21
  Segmented
22
- } from "./chunk-CLBWJEID.js";
22
+ } from "./chunk-VNVDG4AC.js";
23
23
  import {
24
24
  Button
25
25
  } from "./chunk-SJFT5OSX.js";