musae 1.3.0 → 1.3.1-beta.2

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.
Files changed (79) hide show
  1. package/dist/__test__/table.test.d.ts +1 -0
  2. package/dist/components/search/search.cjs +3 -1
  3. package/dist/components/search/search.d.ts +1 -0
  4. package/dist/components/search/search.mjs +3 -1
  5. package/dist/components/sheet/sheet.cjs +13 -3
  6. package/dist/components/sheet/sheet.d.ts +1 -1
  7. package/dist/components/sheet/sheet.mjs +13 -3
  8. package/dist/components/side-sheet/__test__/index.test.d.ts +1 -0
  9. package/dist/components/side-sheet/context.cjs +15 -0
  10. package/dist/components/side-sheet/context.d.ts +11 -0
  11. package/dist/components/side-sheet/context.mjs +13 -0
  12. package/dist/components/side-sheet/index.d.ts +2 -0
  13. package/dist/components/side-sheet/side-sheet.cjs +140 -0
  14. package/dist/components/side-sheet/side-sheet.d.ts +16 -0
  15. package/dist/components/side-sheet/side-sheet.mjs +136 -0
  16. package/dist/components/side-sheet/styles.cjs +106 -0
  17. package/dist/components/side-sheet/styles.d.ts +83 -0
  18. package/dist/components/side-sheet/styles.mjs +104 -0
  19. package/dist/components/table/body.cjs +11 -20
  20. package/dist/components/table/body.mjs +12 -21
  21. package/dist/components/table/context.cjs +6 -1
  22. package/dist/components/table/context.d.ts +4 -0
  23. package/dist/components/table/context.mjs +6 -2
  24. package/dist/components/table/header/cell.cjs +7 -23
  25. package/dist/components/table/header/cell.mjs +7 -23
  26. package/dist/components/table/header/header.cjs +3 -31
  27. package/dist/components/table/header/header.mjs +4 -32
  28. package/dist/components/table/hooks.cjs +31 -9
  29. package/dist/components/table/hooks.d.ts +3 -2
  30. package/dist/components/table/hooks.mjs +31 -9
  31. package/dist/components/table/styles.cjs +99 -0
  32. package/dist/components/table/styles.d.ts +84 -0
  33. package/dist/components/table/styles.mjs +95 -0
  34. package/dist/components/table/table.cjs +49 -7
  35. package/dist/components/table/table.d.ts +1 -1
  36. package/dist/components/table/table.mjs +51 -9
  37. package/dist/components/theme/theme.cjs +31 -0
  38. package/dist/components/theme/theme.mjs +31 -1
  39. package/dist/components/theme/tokens.stylex.d.ts +7 -0
  40. package/dist/components/typography/body.cjs +31 -0
  41. package/dist/components/typography/body.d.ts +8 -0
  42. package/dist/components/typography/body.mjs +27 -0
  43. package/dist/components/typography/context.cjs +15 -0
  44. package/dist/components/typography/context.d.ts +11 -0
  45. package/dist/components/typography/context.mjs +13 -0
  46. package/dist/components/typography/display.cjs +31 -0
  47. package/dist/components/typography/display.d.ts +8 -0
  48. package/dist/components/typography/display.mjs +27 -0
  49. package/dist/components/typography/headline.cjs +31 -0
  50. package/dist/components/typography/headline.d.ts +8 -0
  51. package/dist/components/typography/headline.mjs +27 -0
  52. package/dist/components/typography/index.d.ts +2 -0
  53. package/dist/components/typography/label.cjs +31 -0
  54. package/dist/components/typography/label.d.ts +8 -0
  55. package/dist/components/typography/label.mjs +27 -0
  56. package/dist/components/typography/title.cjs +31 -0
  57. package/dist/components/typography/title.d.ts +8 -0
  58. package/dist/components/typography/title.mjs +27 -0
  59. package/dist/components/typography/typography.cjs +24 -0
  60. package/dist/components/typography/typography.d.ts +14 -0
  61. package/dist/components/typography/typography.mjs +15 -0
  62. package/dist/index.cjs +4 -2
  63. package/dist/index.d.ts +2 -1
  64. package/dist/index.mjs +2 -1
  65. package/dist/styles.css +54 -0
  66. package/dist/types/search.d.ts +6 -0
  67. package/dist/types/sheet.d.ts +6 -0
  68. package/dist/types/side-sheet.d.ts +90 -0
  69. package/dist/types/table.d.ts +17 -0
  70. package/dist/types/typography.d.ts +15 -0
  71. package/package.json +2 -2
  72. package/dist/components/drawer/context.cjs +0 -14
  73. package/dist/components/drawer/context.d.ts +0 -10
  74. package/dist/components/drawer/context.mjs +0 -12
  75. package/dist/components/drawer/drawer.cjs +0 -92
  76. package/dist/components/drawer/drawer.d.ts +0 -9
  77. package/dist/components/drawer/drawer.mjs +0 -88
  78. package/dist/components/drawer/index.d.ts +0 -2
  79. package/dist/types/drawer.d.ts +0 -74
@@ -72,4 +72,10 @@ export interface SheetProps extends ComponentProps {
72
72
  * @en Body content rendered below the header.
73
73
  */
74
74
  children?: ReactNode;
75
+ /**
76
+ * @zh 渲染在主体下方的底部内容。使用此插槽注入操作按钮栏或任意自定义底部。
77
+ * @en Content rendered below the body. Use this slot to inject an action bar
78
+ * or any custom footer.
79
+ */
80
+ footer?: ReactNode;
75
81
  }
@@ -0,0 +1,90 @@
1
+ import type { ReactNode } from "react";
2
+ import type { Closable } from "../hooks/use-closable";
3
+ import type { ComponentProps } from "./element";
4
+ /**
5
+ * @zh Side Sheet 类型。`standard` 内嵌在布局中展示(无遮罩层),`modal` 以带遮罩层的模态形式展示。
6
+ * @en Side sheet type. `standard` renders inline alongside layout content (no scrim);
7
+ * `modal` renders above content with a scrim.
8
+ */
9
+ export type SideSheetType = "standard" | "modal";
10
+ /**
11
+ * @zh Side Sheet 停靠方向。
12
+ * @en The edge the side sheet is anchored to.
13
+ */
14
+ export type SideSheetPlacement = "left" | "right" | "top" | "bottom";
15
+ /**
16
+ * @zh SideSheet 组件属性。
17
+ * @en Props for the SideSheet component.
18
+ */
19
+ export interface SideSheetProps extends ComponentProps {
20
+ /**
21
+ * @zh 是否打开。
22
+ * @en Whether the side sheet is open.
23
+ */
24
+ open: boolean;
25
+ /**
26
+ * @zh 类型。`standard` 与主内容并排展示,`modal` 覆盖在主内容之上并带有遮罩层。
27
+ * @en Type. `standard` sits alongside the main content;
28
+ * `modal` overlays the main content with a scrim.
29
+ * @default "modal"
30
+ */
31
+ type?: SideSheetType;
32
+ /**
33
+ * @zh 头部标题。
34
+ * @en Headline rendered in the header.
35
+ * @default void 0
36
+ */
37
+ title?: ReactNode;
38
+ /**
39
+ * @zh 返回回调。传入后头部展示返回按钮。
40
+ * @en Back handler. When provided, a back button is rendered in the header.
41
+ * @default void 0
42
+ */
43
+ onBack?: VoidFunction;
44
+ /**
45
+ * @zh 是否可关闭。控制关闭按钮的展示,以及是否可以通过点击遮罩层或按 Esc 键关闭(仅 `modal` 生效)。
46
+ * 传入 `Closable` 数组以启用特定的关闭触发器。
47
+ * @en Whether the side sheet is closable. Controls the close button, and whether it can be
48
+ * closed by clicking on the overlay or pressing the Esc key (`modal` only).
49
+ * Pass an array of `Closable` values to enable specific close triggers.
50
+ * @default true
51
+ */
52
+ closable?: boolean | Closable[];
53
+ /**
54
+ * @zh 确认回调。传入后头部展示确认按钮。
55
+ * @en Confirm handler. When provided, a confirm button is rendered in the header.
56
+ * @default void 0
57
+ */
58
+ onConfirm?: VoidFunction;
59
+ /**
60
+ * @zh 关闭回调。
61
+ * @en Called when the side sheet requests to close.
62
+ * @default void 0
63
+ */
64
+ onClose?: VoidFunction;
65
+ /**
66
+ * @zh 底部操作区内容。传入后在主体下方渲染分割线和操作按钮行。
67
+ * @en Footer actions. When provided, a divider and an actions row are rendered below the body.
68
+ * @default void 0
69
+ */
70
+ actions?: ReactNode;
71
+ /**
72
+ * @zh 面板宽度。接受数字(px)或任意 CSS 尺寸字符串。
73
+ * @en Panel width. Accepts a number (px) or any CSS dimension string.
74
+ * @default 400
75
+ */
76
+ size?: number | string;
77
+ /**
78
+ * @zh 停靠方向。`left` / `right` 水平滑入,`top` / `bottom` 垂直滑入。
79
+ * @en The edge the side sheet is anchored to.
80
+ * `left` / `right` slides horizontally, `top` / `bottom` slides vertically.
81
+ * @default "right"
82
+ */
83
+ placement?: SideSheetPlacement;
84
+ /**
85
+ * @zh 主体内容。
86
+ * @en Body content.
87
+ * @default void 0
88
+ */
89
+ children?: ReactNode;
90
+ }
@@ -85,6 +85,23 @@ export type TableProps<T> = ComponentProps & {
85
85
  * @default false
86
86
  */
87
87
  loading?: boolean;
88
+ /** Enable hierarchical rows. Records are read from their `children` property. @default false */
89
+ expandable?: boolean;
90
+ /** Stable identifiers of expanded rows (controlled). */
91
+ expandedKeys?: Key[];
92
+ /** Initially expanded row identifiers (uncontrolled). */
93
+ defaultExpandedKeys?: Key[];
94
+ /** Called whenever the expanded row identifiers change. */
95
+ onExpandedKeysChange?: (keys: Key[]) => void;
96
+ /**
97
+ * Stable row identifier. Hierarchical tables should always provide this rather than relying on
98
+ * TanStack Table's positional row ids.
99
+ */
100
+ rowKey?: DeepKeys<T> | ((record: T, index: number, parent?: T) => Key);
101
+ };
102
+ /** Recursive record shape used by the built-in hierarchical-row reader. */
103
+ export type ExpandableRecord<T> = T & {
104
+ children?: ExpandableRecord<T>[];
88
105
  };
89
106
  /**
90
107
  * @author murukal
@@ -0,0 +1,15 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ComponentProps } from "./element";
3
+ export interface TypographyProps extends ComponentProps {
4
+ /**
5
+ * @zh 字体尺寸等级
6
+ * @en Font size level
7
+ * @default "medium"
8
+ */
9
+ size?: "large" | "medium" | "small";
10
+ /**
11
+ * @zh 文本内容
12
+ * @en Text content
13
+ */
14
+ children?: ReactNode;
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "musae",
3
- "version": "1.3.0",
3
+ "version": "1.3.1-beta.2",
4
4
  "description": "musae-ui",
5
5
  "author": "tutu@fantufantu.com",
6
6
  "license": "MIT",
@@ -135,7 +135,7 @@
135
135
  "dev": "rollup -c -w --environment NODE_ENV:development",
136
136
  "build": "z rm dist && rollup -c --environment NODE_ENV:production",
137
137
  "authors": "zx scripts/contributors.mjs",
138
- "storybook": "pnpm run build && storybook dev -p 6006",
138
+ "storybook": "pnpm run build && storybook dev",
139
139
  "build-storybook": "storybook build",
140
140
  "lint": "eslint ."
141
141
  }
@@ -1,14 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * @zh Drawer 的 class 名称
5
- * @en class names for Drawer
6
- */
7
- var CLASS_NAMES = {
8
- drawer: "drawer",
9
- header: "drawer__header",
10
- body: "drawer__body",
11
- actions: "drawer__actions"
12
- };
13
-
14
- exports.CLASS_NAMES = CLASS_NAMES;
@@ -1,10 +0,0 @@
1
- /**
2
- * @zh Drawer 的 class 名称
3
- * @en class names for Drawer
4
- */
5
- export declare const CLASS_NAMES: {
6
- readonly drawer: "drawer";
7
- readonly header: "drawer__header";
8
- readonly body: "drawer__body";
9
- readonly actions: "drawer__actions";
10
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * @zh Drawer 的 class 名称
3
- * @en class names for Drawer
4
- */
5
- var CLASS_NAMES = {
6
- drawer: "drawer",
7
- header: "drawer__header",
8
- body: "drawer__body",
9
- actions: "drawer__actions"
10
- };
11
-
12
- export { CLASS_NAMES };
@@ -1,92 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
6
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
7
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
8
- var React = require('react');
9
- var sheet = require('../sheet/sheet.cjs');
10
- var button = require('../button/button.cjs');
11
- var space = require('../space/space.cjs');
12
- var useLocale = require('../../locale/use-locale.cjs');
13
- var useClosable = require('../../hooks/use-closable.cjs');
14
- var useClassNames = require('../../hooks/use-class-names.cjs');
15
- var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
16
- var className = require('@aiszlab/relax/class-name');
17
- var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
18
- var theme = require('../theme/theme.cjs');
19
- var context = require('./context.cjs');
20
-
21
- var _excluded = ["open", "size", "closable", "placement"];
22
- /**
23
- * @zh Drawer 专用样式:包含关闭按钮、标题和确认按钮的头部栏,以及面板背景。
24
- * @en Drawer-specific styles: header bar with closer, title, confirm button, and panel background.
25
- */
26
- var styles = {
27
- header: {
28
- k1xSpc: "musaex-78zum5",
29
- kg3NbH: "musaex-1v4gb6w",
30
- k8WAf4: "musaex-1aur8i7",
31
- kGNEyG: "musaex-6s0dn4",
32
- kOIVth: "musaex-wcf3z5",
33
- kt9PQ7: "musaex-d1xpcx",
34
- kfdmCh: "musaex-1q0q8m5",
35
- kL6WhQ: "musaex-quqrak",
36
- $$css: true
37
- }
38
- };
39
- /**
40
- * @zh Drawer 组件。从屏幕任意边缘滑入的模态面板。基于共享的 Sheet 基础组件构建。
41
- * @en Drawer component. A modal panel that slides in from any screen edge.
42
- * Built on the shared Sheet base component.
43
- */
44
- var Drawer = function Drawer(_ref) {
45
- var open = _ref.open,
46
- _ref$size = _ref.size,
47
- size = _ref$size === void 0 ? 400 : _ref$size,
48
- _ref$closable = _ref.closable,
49
- closable = _ref$closable === void 0 ? true : _ref$closable,
50
- _ref$placement = _ref.placement,
51
- placement = _ref$placement === void 0 ? "right" : _ref$placement,
52
- props = _objectWithoutProperties(_ref, _excluded);
53
- var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
54
- var _useLocale = useLocale.useLocale("drawer"),
55
- _useLocale2 = _slicedToArray(_useLocale, 1),
56
- locale = _useLocale2[0];
57
- var themeColorVars = useThemeColorVars.useThemeColorVars(["outline-variant"]);
58
- var _useClosable = useClosable.useClosable({
59
- closable: closable,
60
- onClose: props.onClose
61
- }),
62
- closer = _useClosable.closer;
63
- var styled = {
64
- header: stylex.props(theme.$body.large, styles.header),
65
- actions: {
66
- className: "musaex-vc5jky"
67
- },
68
- panel: {
69
- className: "musaex-1q2mt7c"
70
- }
71
- };
72
- return /*#__PURE__*/React.createElement(sheet.default, {
73
- visible: open,
74
- placement: placement,
75
- size: size,
76
- closable: closable,
77
- onClose: props.onClose,
78
- className: classNames.drawer,
79
- header: /*#__PURE__*/React.createElement("div", {
80
- className: className.stringify(classNames.header, styled.header.className),
81
- style: _objectSpread(_objectSpread({}, styled.header.style), themeColorVars)
82
- }, closer, props.title, props.onConfirm && (/*#__PURE__*/React.createElement(space.default, {
83
- className: styled.actions.className,
84
- style: styled.actions.style
85
- }, /*#__PURE__*/React.createElement(button.Button, {
86
- onClick: props.onConfirm
87
- }, locale.confirm)))),
88
- panelClassName: styled.panel.className
89
- }, props.children);
90
- };
91
-
92
- exports.default = Drawer;
@@ -1,9 +0,0 @@
1
- import React from "react";
2
- import type { DrawerProps } from "../../types/drawer";
3
- /**
4
- * @zh Drawer 组件。从屏幕任意边缘滑入的模态面板。基于共享的 Sheet 基础组件构建。
5
- * @en Drawer component. A modal panel that slides in from any screen edge.
6
- * Built on the shared Sheet base component.
7
- */
8
- declare const Drawer: ({ open, size, closable, placement, ...props }: DrawerProps) => React.JSX.Element;
9
- export default Drawer;
@@ -1,88 +0,0 @@
1
- import _objectSpread from '@babel/runtime/helpers/objectSpread2';
2
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
3
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
- import React from 'react';
5
- import Sheet from '../sheet/sheet.mjs';
6
- import { Button } from '../button/button.mjs';
7
- import Space from '../space/space.mjs';
8
- import { useLocale } from '../../locale/use-locale.mjs';
9
- import { useClosable } from '../../hooks/use-closable.mjs';
10
- import { useClassNames } from '../../hooks/use-class-names.mjs';
11
- import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
12
- import { stringify } from '@aiszlab/relax/class-name';
13
- import { useThemeColorVars } from '../../hooks/use-theme-color-vars.mjs';
14
- import { $body } from '../theme/theme.mjs';
15
- import { CLASS_NAMES } from './context.mjs';
16
-
17
- var _excluded = ["open", "size", "closable", "placement"];
18
- /**
19
- * @zh Drawer 专用样式:包含关闭按钮、标题和确认按钮的头部栏,以及面板背景。
20
- * @en Drawer-specific styles: header bar with closer, title, confirm button, and panel background.
21
- */
22
- var styles = {
23
- header: {
24
- k1xSpc: "musaex-78zum5",
25
- kg3NbH: "musaex-1v4gb6w",
26
- k8WAf4: "musaex-1aur8i7",
27
- kGNEyG: "musaex-6s0dn4",
28
- kOIVth: "musaex-wcf3z5",
29
- kt9PQ7: "musaex-d1xpcx",
30
- kfdmCh: "musaex-1q0q8m5",
31
- kL6WhQ: "musaex-quqrak",
32
- $$css: true
33
- }
34
- };
35
- /**
36
- * @zh Drawer 组件。从屏幕任意边缘滑入的模态面板。基于共享的 Sheet 基础组件构建。
37
- * @en Drawer component. A modal panel that slides in from any screen edge.
38
- * Built on the shared Sheet base component.
39
- */
40
- var Drawer = function Drawer(_ref) {
41
- var open = _ref.open,
42
- _ref$size = _ref.size,
43
- size = _ref$size === void 0 ? 400 : _ref$size,
44
- _ref$closable = _ref.closable,
45
- closable = _ref$closable === void 0 ? true : _ref$closable,
46
- _ref$placement = _ref.placement,
47
- placement = _ref$placement === void 0 ? "right" : _ref$placement,
48
- props$1 = _objectWithoutProperties(_ref, _excluded);
49
- var classNames = useClassNames(CLASS_NAMES);
50
- var _useLocale = useLocale("drawer"),
51
- _useLocale2 = _slicedToArray(_useLocale, 1),
52
- locale = _useLocale2[0];
53
- var themeColorVars = useThemeColorVars(["outline-variant"]);
54
- var _useClosable = useClosable({
55
- closable: closable,
56
- onClose: props$1.onClose
57
- }),
58
- closer = _useClosable.closer;
59
- var styled = {
60
- header: props($body.large, styles.header),
61
- actions: {
62
- className: "musaex-vc5jky"
63
- },
64
- panel: {
65
- className: "musaex-1q2mt7c"
66
- }
67
- };
68
- return /*#__PURE__*/React.createElement(Sheet, {
69
- visible: open,
70
- placement: placement,
71
- size: size,
72
- closable: closable,
73
- onClose: props$1.onClose,
74
- className: classNames.drawer,
75
- header: /*#__PURE__*/React.createElement("div", {
76
- className: stringify(classNames.header, styled.header.className),
77
- style: _objectSpread(_objectSpread({}, styled.header.style), themeColorVars)
78
- }, closer, props$1.title, props$1.onConfirm && (/*#__PURE__*/React.createElement(Space, {
79
- className: styled.actions.className,
80
- style: styled.actions.style
81
- }, /*#__PURE__*/React.createElement(Button, {
82
- onClick: props$1.onConfirm
83
- }, locale.confirm)))),
84
- panelClassName: styled.panel.className
85
- }, props$1.children);
86
- };
87
-
88
- export { Drawer as default };
@@ -1,2 +0,0 @@
1
- import Drawer from "./drawer";
2
- export { Drawer };
@@ -1,74 +0,0 @@
1
- import type { ReactNode } from "react";
2
- import type { Closable } from "../hooks/use-closable";
3
- import type { ComponentProps } from "./element";
4
- export type Placement = "right" | "left" | "top" | "bottom";
5
- /**
6
- * @description
7
- * drawer props
8
- */
9
- export type DrawerProps = Pick<ComponentProps, "className"> & {
10
- /**
11
- * @description
12
- * children
13
- * @default void 0
14
- */
15
- children?: ReactNode;
16
- /**
17
- * @description
18
- * is open
19
- * @requires
20
- */
21
- open: boolean;
22
- /**
23
- * @description
24
- * title
25
- * @default void 0
26
- */
27
- title?: ReactNode;
28
- /**
29
- * @description
30
- * placement
31
- * @default "right"
32
- */
33
- placement?: Placement;
34
- /**
35
- * @description
36
- * Whether the drawer can be closed by clicking on the overlay or pressing the Esc key.
37
- * @default true
38
- */
39
- closable?: boolean | Closable[];
40
- /**
41
- * @description
42
- * size
43
- * horizontal drawer, size prop mean width
44
- * vertical drawer, size prop mean height
45
- *
46
- * @default 400
47
- */
48
- size?: number;
49
- /**
50
- * @description
51
- * close handler
52
- * @default void 0
53
- */
54
- onClose?: VoidFunction;
55
- /**
56
- * @description
57
- * on confirm handler
58
- */
59
- onConfirm?: VoidFunction;
60
- };
61
- /**
62
- * @description
63
- * popup
64
- */
65
- export type PopupProps = DrawerProps & {
66
- size: number;
67
- closable: boolean | Closable[];
68
- placement: Placement;
69
- /**
70
- * @description
71
- * callback will be toggled after close animation end
72
- */
73
- onClosed?: () => void;
74
- };