@sia.soul/sia-react-ui 0.1.17 → 0.1.20

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.
@@ -1112,7 +1112,8 @@ function MenuEntry({
1112
1112
  item,
1113
1113
  level,
1114
1114
  parents,
1115
- props
1115
+ props,
1116
+ reserveIcon
1116
1117
  }) {
1117
1118
  const anchorRef = (0, import_react5.useRef)(null);
1118
1119
  const closeTimerRef = (0, import_react5.useRef)(void 0);
@@ -1161,7 +1162,7 @@ function MenuEntry({
1161
1162
  "aria-expanded": hasChildren ? isOpen : void 0,
1162
1163
  onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
1163
1164
  children: [
1164
- item.icon ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sia-menu__icon", children: item.icon }) : null,
1165
+ reserveIcon ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sia-menu__icon", "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
1165
1166
  !collapsed ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sia-menu__label", children: item.label }) : null,
1166
1167
  !collapsed && item.extra ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "sia-menu__extra", children: item.extra }) : null,
1167
1168
  !collapsed && hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
@@ -1185,19 +1186,23 @@ function MenuEntry({
1185
1186
  }
1186
1187
  );
1187
1188
  }
1189
+ function hasMenuIcon(items) {
1190
+ return items.some((item) => item.type === "group" ? hasMenuIcon(item.children ?? []) : item.type !== "divider" && Boolean(item.icon));
1191
+ }
1188
1192
  function MenuLevel({
1189
1193
  items,
1190
1194
  level,
1191
1195
  parents,
1192
- props
1196
+ props,
1197
+ reserveIcon = hasMenuIcon(items)
1193
1198
  }) {
1194
1199
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: items.map((item, index) => {
1195
1200
  if (item.type === "divider") return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { className: "sia-menu__divider", role: "separator" }, item.key || `divider-${index}`);
1196
1201
  if (item.type === "group") return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { className: "sia-menu__group", children: [
1197
1202
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "sia-menu__group-title", children: item.label }),
1198
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { role: "group", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [...parents, item.key], props }) })
1203
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { role: "group", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [...parents, item.key], props, reserveIcon }) })
1199
1204
  ] }, item.key);
1200
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MenuEntry, { item, level, parents, props }, item.key);
1205
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(MenuEntry, { item, level, parents, props, reserveIcon }, item.key);
1201
1206
  }) });
1202
1207
  }
1203
1208
  function Menu({
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RichTextContent,
3
3
  RichTextEditor
4
- } from "./chunk-MUTJVDM6.js";
5
- import "./chunk-ALWHRV4L.js";
4
+ } from "./chunk-I3EF5SF2.js";
5
+ import "./chunk-SUMXP2SF.js";
6
6
  import "./chunk-TZGUBGA4.js";
7
7
  import "./chunk-3VJ4CZDQ.js";
8
8
  export {
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
3
3
  import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-DAYZvZVu.cjs';
4
- import { c as SelectOption, e as SelectValue } from './Select-CVvF4mcy.cjs';
4
+ import { S as SelectOption, e as SelectValue } from './Select-Da9CLN0X.cjs';
5
5
 
6
6
  type DatePickerShowTime = boolean | {
7
7
  showSecond?: boolean;
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { InputHTMLAttributes, ReactNode, HTMLAttributes, CSSProperties } from 'react';
3
3
  import { I as InputPlaceholderMode, C as ControlSize, a as ControlStatus } from './shared-DAYZvZVu.js';
4
- import { c as SelectOption, e as SelectValue } from './Select-Ce2Irbpt.js';
4
+ import { S as SelectOption, e as SelectValue } from './Select-Cz3hzQl_.js';
5
5
 
6
6
  type DatePickerShowTime = boolean | {
7
7
  showSecond?: boolean;
@@ -1947,6 +1947,7 @@ var ModalRoot = (0, import_react8.forwardRef)(function Modal({
1947
1947
  title,
1948
1948
  children,
1949
1949
  footer,
1950
+ footerExtra,
1950
1951
  type = "default",
1951
1952
  okText = "\u786E\u5B9A",
1952
1953
  cancelText = "\u53D6\u6D88",
@@ -2071,7 +2072,10 @@ var ModalRoot = (0, import_react8.forwardRef)(function Modal({
2071
2072
  closable ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "button", className: "sia-modal__close", "aria-label": "\u5173\u95ED\u5BF9\u8BDD\u6846", onClick: requestClose, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon, { name: "close", size: 17 }) }) : null
2072
2073
  ] }),
2073
2074
  children !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-modal__body", children }) : null,
2074
- footer !== null ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "sia-modal__footer", children: footer ?? defaultFooter }) : null
2075
+ footer !== null ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "sia-modal__footer", children: [
2076
+ footer === void 0 && footerExtra != null ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { style: { marginRight: "auto" }, children: footerExtra }) : null,
2077
+ footer ?? defaultFooter
2078
+ ] }) : null
2075
2079
  ]
2076
2080
  }
2077
2081
  )
@@ -2523,6 +2527,7 @@ function SelectionPanel({
2523
2527
  value,
2524
2528
  onChange,
2525
2529
  multiple = false,
2530
+ allowDeselect = false,
2526
2531
  disabled = false,
2527
2532
  loading = false,
2528
2533
  showSearch = true,
@@ -2588,7 +2593,7 @@ function SelectionPanel({
2588
2593
  function toggle(option) {
2589
2594
  if (disabled || loading || option.disabled || option.optionType === "divider") return;
2590
2595
  setActive(option.value);
2591
- onChange(multiple ? selected.has(option.value) ? value.filter((item) => item !== option.value) : [...value, option.value] : [option.value]);
2596
+ onChange(multiple ? selected.has(option.value) ? value.filter((item) => item !== option.value) : [...value, option.value] : allowDeselect && selected.has(option.value) ? [] : [option.value]);
2592
2597
  }
2593
2598
  function batch(operation) {
2594
2599
  if (disabled || loading) return;
@@ -3524,6 +3529,7 @@ var Select = (0, import_react16.forwardRef)(function Select2({
3524
3529
  value: modalValues,
3525
3530
  onChange: setModalValues,
3526
3531
  multiple,
3532
+ allowDeselect: allowClear,
3527
3533
  selectedOnly,
3528
3534
  showValue,
3529
3535
  showSearch: false,
@@ -1,4 +1,4 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-shDQ5uJA.cjs';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-4tEYkA5O.cjs';
2
2
  import 'react';
3
3
  import './shared-DAYZvZVu.cjs';
4
- import './Select-CVvF4mcy.cjs';
4
+ import './Select-Da9CLN0X.cjs';
@@ -1,4 +1,4 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-Bdb-hi9c.js';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-D-ynrB5k.js';
2
2
  import 'react';
3
3
  import './shared-DAYZvZVu.js';
4
- import './Select-Ce2Irbpt.js';
4
+ import './Select-Cz3hzQl_.js';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-G47MREYI.js";
4
- import "./chunk-VXSG4EAO.js";
5
- import "./chunk-ALWHRV4L.js";
3
+ } from "./chunk-LO3BUBWU.js";
4
+ import "./chunk-4HB6GC24.js";
5
+ import "./chunk-SUMXP2SF.js";
6
6
  import "./chunk-TZGUBGA4.js";
7
7
  import "./chunk-3VJ4CZDQ.js";
8
8
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.17",
3
+ "version": "0.1.20",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",