@sia.soul/sia-react-ui 0.1.114 → 0.1.115

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.
@@ -1726,6 +1726,7 @@ function MenuLevel({
1726
1726
  function Menu({
1727
1727
  items,
1728
1728
  mode = "vertical",
1729
+ gridColumns = 2,
1729
1730
  theme = "light",
1730
1731
  selectedKeys,
1731
1732
  defaultSelectedKeys = [],
@@ -1741,6 +1742,7 @@ function Menu({
1741
1742
  onDeselect,
1742
1743
  onOpenChange,
1743
1744
  className = "",
1745
+ style,
1744
1746
  ...rest
1745
1747
  }) {
1746
1748
  const menuId = (0, import_react6.useId)();
@@ -1773,7 +1775,8 @@ function Menu({
1773
1775
  else onSelect?.({ ...info, selectedKeys: [...next] });
1774
1776
  if (mode !== "inline") setOpen([]);
1775
1777
  }
1776
- return /* @__PURE__ */ (0, import_jsx_runtime8.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_runtime8.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
1778
+ const gridStyle = mode === "grid" ? { "--sia-menu-grid-columns": gridColumns === "auto" ? "repeat(auto-fill, minmax(88px, 1fr))" : `repeat(${Number.isFinite(gridColumns) ? Math.max(1, Math.floor(Number(gridColumns))) : 2}, minmax(0, 1fr))` } : {};
1779
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), style: { ...gridStyle, ...style }, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
1777
1780
  }
1778
1781
 
1779
1782
  // src/components/Dropdown.tsx
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RichTextContent,
3
3
  RichTextEditor
4
- } from "./chunk-6CII5JCT.js";
5
- import "./chunk-IOVN3QL7.js";
4
+ } from "./chunk-MDU5EONC.js";
5
+ import "./chunk-SPIQSYWQ.js";
6
6
  import "./chunk-SCEHVGKV.js";
7
7
  import "./chunk-XY7CXJS6.js";
8
8
  import "./chunk-CZ2ITBRW.js";
@@ -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-Bx4B28Wh.js';
4
- import { S as SelectOption, j as SelectValue } from './Select-BddM4uXC.js';
4
+ import { S as SelectOption, j as SelectValue } from './Select-vjX7B63I.js';
5
5
 
6
6
  /** 日期选择附带的时间选择配置。 */
7
7
  type DatePickerShowTime = 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-Bx4B28Wh.cjs';
4
- import { S as SelectOption, j as SelectValue } from './Select-Cf0xz1Tg.cjs';
4
+ import { S as SelectOption, j as SelectValue } from './Select-BAFXKVZB.cjs';
5
5
 
6
6
  /** 日期选择附带的时间选择配置。 */
7
7
  type DatePickerShowTime = boolean | {
@@ -4196,8 +4196,15 @@ var Select = (0, import_react18.forwardRef)(function Select2({
4196
4196
  function clearSelection() {
4197
4197
  setCurrentValue(multiple ? [] : null);
4198
4198
  }
4199
+ function handleDropdownEscape(event) {
4200
+ if (event.key !== "Escape" || !open || popupMode !== "dropdown") return false;
4201
+ event.preventDefault();
4202
+ event.stopPropagation();
4203
+ closeDropdown();
4204
+ return true;
4205
+ }
4199
4206
  function handleInteractionKeyDown(event, fromSearch = false) {
4200
- if (popupMode === "modal" && open) return;
4207
+ if (handleDropdownEscape(event) || popupMode === "modal" && open) return;
4201
4208
  if (event.key === "ArrowDown" || event.key === "ArrowUp") {
4202
4209
  event.preventDefault();
4203
4210
  if (!open) openDropdown();
@@ -4302,7 +4309,7 @@ var Select = (0, import_react18.forwardRef)(function Select2({
4302
4309
  }
4303
4310
  ),
4304
4311
  allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className: "sia-select__clear", type: "button", "aria-label": "\u6E05\u7A7A\u9009\u62E9", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
4305
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: open && popupMode === "dropdown", style: { fontSize: dropdownFontSize }, className: `sia-select__dropdown${filteredOptions.length === 0 && !canSubmitInput ? " sia-select__dropdown--empty" : ""}`, children: [
4312
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(PopupPortal, { ref: popupRef, onKeyDown: handleDropdownEscape, anchorRef: rootRef, open: open && popupMode === "dropdown", style: { fontSize: dropdownFontSize }, className: `sia-select__dropdown${filteredOptions.length === 0 && !canSubmitInput ? " sia-select__dropdown--empty" : ""}`, children: [
4306
4313
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FloatingScrollbarProvider, { targetRef: listRef }),
4307
4314
  showSearch || allowInput ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("label", { className: "sia-select__search", children: [
4308
4315
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { name: "search", size: 15 }),
@@ -1,5 +1,5 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-Cm5o2xPp.cjs';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-CIiI0F5o.cjs';
2
2
  import 'react';
3
3
  import './shared-Bx4B28Wh.cjs';
4
- import './Select-Cf0xz1Tg.cjs';
4
+ import './Select-BAFXKVZB.cjs';
5
5
  import './Button-O_pNB3SQ.cjs';
@@ -1,5 +1,5 @@
1
- export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-yGDEA1RP.js';
1
+ export { S as SelectDateRange, i as SelectDateRangeProps, j as SelectDateRangeValue } from './select-date-range-C9jlUrCX.js';
2
2
  import 'react';
3
3
  import './shared-Bx4B28Wh.js';
4
- import './Select-BddM4uXC.js';
4
+ import './Select-vjX7B63I.js';
5
5
  import './Button-BiL3Wjsd.js';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  SelectDateRange
3
- } from "./chunk-NKENBSLP.js";
4
- import "./chunk-7KNHBJZX.js";
5
- import "./chunk-IOVN3QL7.js";
3
+ } from "./chunk-6XQ2LDGT.js";
4
+ import "./chunk-KPOK4HIQ.js";
5
+ import "./chunk-SPIQSYWQ.js";
6
6
  import "./chunk-SCEHVGKV.js";
7
7
  import "./chunk-XY7CXJS6.js";
8
8
  import "./chunk-CZ2ITBRW.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.114",
3
+ "version": "0.1.115",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",