musae 1.2.0 → 1.3.0
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.
- package/dist/components/card/actions.cjs +31 -0
- package/dist/components/card/actions.d.ts +31 -0
- package/dist/components/card/actions.mjs +27 -0
- package/dist/components/card/body.cjs +30 -0
- package/dist/components/card/body.d.ts +18 -0
- package/dist/components/card/body.mjs +26 -0
- package/dist/components/card/card.cjs +76 -140
- package/dist/components/card/card.d.ts +23 -150
- package/dist/components/card/card.mjs +67 -135
- package/dist/components/card/content.cjs +33 -0
- package/dist/components/card/content.d.ts +33 -0
- package/dist/components/card/content.mjs +29 -0
- package/dist/components/card/context.cjs +14 -1
- package/dist/components/card/context.d.ts +15 -1
- package/dist/components/card/context.mjs +13 -2
- package/dist/components/card/header.cjs +79 -0
- package/dist/components/card/header.d.ts +58 -0
- package/dist/components/card/header.mjs +75 -0
- package/dist/components/card/headline.cjs +30 -0
- package/dist/components/card/headline.d.ts +18 -0
- package/dist/components/card/headline.mjs +26 -0
- package/dist/components/card/index.d.ts +1 -1
- package/dist/components/card/media.cjs +50 -0
- package/dist/components/card/media.d.ts +42 -0
- package/dist/components/card/media.mjs +46 -0
- package/dist/components/card/styles.cjs +133 -14
- package/dist/components/card/styles.d.ts +88 -28
- package/dist/components/card/styles.mjs +133 -14
- package/dist/components/card/subhead.cjs +30 -0
- package/dist/components/card/subhead.d.ts +18 -0
- package/dist/components/card/subhead.mjs +26 -0
- package/dist/components/card/title.cjs +30 -0
- package/dist/components/card/title.d.ts +18 -0
- package/dist/components/card/title.mjs +26 -0
- package/dist/components/theme/tokens.stylex.cjs +4 -1
- package/dist/components/theme/tokens.stylex.d.ts +9 -1
- package/dist/components/theme/tokens.stylex.mjs +4 -1
- package/dist/styles.css +68 -23
- package/dist/types/card.d.ts +39 -2
- package/package.json +1 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var className = require('@aiszlab/relax/class-name');
|
|
8
|
+
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
9
|
+
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
10
|
+
var context = require('./context.cjs');
|
|
11
|
+
var styles = require('./styles.cjs');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @zh 卡片操作区,通常包含按钮等交互元素(flex, justify-end, gap 8px)。
|
|
15
|
+
* @en Card actions area, typically containing buttons and other interactive
|
|
16
|
+
* elements (flex, justify-end, gap 8px).
|
|
17
|
+
*/
|
|
18
|
+
var CardActions = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
19
|
+
var className$1 = _ref.className,
|
|
20
|
+
style = _ref.style,
|
|
21
|
+
children = _ref.children;
|
|
22
|
+
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
23
|
+
var actionsStyled = stylex.props(styles.default.actions["default"]);
|
|
24
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
+
ref: ref,
|
|
26
|
+
className: className.stringify(classNames.actions, className$1, actionsStyled.className),
|
|
27
|
+
style: _objectSpread(_objectSpread({}, actionsStyled.style), style)
|
|
28
|
+
}, children);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
exports.default = CardActions;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ReactNode, CSSProperties } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* @zh 卡片操作区属性
|
|
5
|
+
* @en Card actions props
|
|
6
|
+
*/
|
|
7
|
+
interface CardActionsProps {
|
|
8
|
+
/**
|
|
9
|
+
* @zh 自定义类名
|
|
10
|
+
* @en Custom class name
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
/**
|
|
14
|
+
* @zh 自定义样式
|
|
15
|
+
* @en Custom style
|
|
16
|
+
*/
|
|
17
|
+
style?: CSSProperties;
|
|
18
|
+
/**
|
|
19
|
+
* @zh 操作按钮等
|
|
20
|
+
* @en Action buttons etc.
|
|
21
|
+
*/
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @zh 卡片操作区,通常包含按钮等交互元素(flex, justify-end, gap 8px)。
|
|
26
|
+
* @en Card actions area, typically containing buttons and other interactive
|
|
27
|
+
* elements (flex, justify-end, gap 8px).
|
|
28
|
+
*/
|
|
29
|
+
declare const CardActions: React.ForwardRefExoticComponent<CardActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
30
|
+
export default CardActions;
|
|
31
|
+
export type { CardActionsProps };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { stringify } from '@aiszlab/relax/class-name';
|
|
4
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
5
|
+
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
6
|
+
import { CLASS_NAMES } from './context.mjs';
|
|
7
|
+
import styles from './styles.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @zh 卡片操作区,通常包含按钮等交互元素(flex, justify-end, gap 8px)。
|
|
11
|
+
* @en Card actions area, typically containing buttons and other interactive
|
|
12
|
+
* elements (flex, justify-end, gap 8px).
|
|
13
|
+
*/
|
|
14
|
+
var CardActions = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
15
|
+
var className = _ref.className,
|
|
16
|
+
style = _ref.style,
|
|
17
|
+
children = _ref.children;
|
|
18
|
+
var classNames = useClassNames(CLASS_NAMES);
|
|
19
|
+
var actionsStyled = props(styles.actions["default"]);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
ref: ref,
|
|
22
|
+
className: stringify(classNames.actions, className, actionsStyled.className),
|
|
23
|
+
style: _objectSpread(_objectSpread({}, actionsStyled.style), style)
|
|
24
|
+
}, children);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { CardActions as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var className = require('@aiszlab/relax/class-name');
|
|
8
|
+
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
9
|
+
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
10
|
+
var context = require('./context.cjs');
|
|
11
|
+
var styles = require('./styles.cjs');
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @zh 卡片 Body 文本(14px body/medium)。
|
|
15
|
+
* @en Card body text (14px body/medium).
|
|
16
|
+
*/
|
|
17
|
+
var CardBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
18
|
+
var className$1 = _ref.className,
|
|
19
|
+
style = _ref.style,
|
|
20
|
+
children = _ref.children;
|
|
21
|
+
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
22
|
+
var bodyStyled = stylex.props(styles.default.body["default"]);
|
|
23
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
24
|
+
ref: ref,
|
|
25
|
+
className: className.stringify(classNames.body, className$1, bodyStyled.className),
|
|
26
|
+
style: _objectSpread(_objectSpread({}, bodyStyled.style), style)
|
|
27
|
+
}, children);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
exports.default = CardBody;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode, CSSProperties } from "react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* @zh 卡片 Body 文本(14px body/medium,on-surface-variant)
|
|
5
|
+
* @en Card body text (14px body/medium, on-surface-variant)
|
|
6
|
+
*/
|
|
7
|
+
interface CardBodyProps {
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @zh 卡片 Body 文本(14px body/medium)。
|
|
14
|
+
* @en Card body text (14px body/medium).
|
|
15
|
+
*/
|
|
16
|
+
declare const CardBody: React.ForwardRefExoticComponent<CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
17
|
+
export default CardBody;
|
|
18
|
+
export type { CardBodyProps };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { stringify } from '@aiszlab/relax/class-name';
|
|
4
|
+
import { props } from '../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.mjs';
|
|
5
|
+
import { useClassNames } from '../../hooks/use-class-names.mjs';
|
|
6
|
+
import { CLASS_NAMES } from './context.mjs';
|
|
7
|
+
import styles from './styles.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @zh 卡片 Body 文本(14px body/medium)。
|
|
11
|
+
* @en Card body text (14px body/medium).
|
|
12
|
+
*/
|
|
13
|
+
var CardBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
+
var className = _ref.className,
|
|
15
|
+
style = _ref.style,
|
|
16
|
+
children = _ref.children;
|
|
17
|
+
var classNames = useClassNames(CLASS_NAMES);
|
|
18
|
+
var bodyStyled = props(styles.body["default"]);
|
|
19
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
20
|
+
ref: ref,
|
|
21
|
+
className: stringify(classNames.body, className, bodyStyled.className),
|
|
22
|
+
style: _objectSpread(_objectSpread({}, bodyStyled.style), style)
|
|
23
|
+
}, children);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { CardBody as default };
|
|
@@ -3,26 +3,34 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _objectSpread = require('@babel/runtime/helpers/objectSpread2');
|
|
6
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
6
7
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var className = require('@aiszlab/relax/class-name');
|
|
9
10
|
var stylex = require('../../node_modules/.pnpm/@stylexjs_stylex@0.19.0/node_modules/@stylexjs/stylex/lib/es/stylex.cjs');
|
|
10
11
|
var tokens_stylex = require('../theme/tokens.stylex.cjs');
|
|
11
|
-
var hooks = require('../theme/hooks.cjs');
|
|
12
12
|
var useClassNames = require('../../hooks/use-class-names.cjs');
|
|
13
13
|
var useThemeColorVars = require('../../hooks/use-theme-color-vars.cjs');
|
|
14
14
|
var context = require('./context.cjs');
|
|
15
15
|
var styles = require('./styles.cjs');
|
|
16
|
+
var header = require('./header.cjs');
|
|
17
|
+
var media = require('./media.cjs');
|
|
18
|
+
var content = require('./content.cjs');
|
|
19
|
+
var headline = require('./headline.cjs');
|
|
20
|
+
var title = require('./title.cjs');
|
|
21
|
+
var subhead = require('./subhead.cjs');
|
|
22
|
+
var body = require('./body.cjs');
|
|
23
|
+
var actions = require('./actions.cjs');
|
|
16
24
|
|
|
17
|
-
var _excluded = ["children", "className", "style", "variant", "onClick", "disabled"]
|
|
18
|
-
_excluded2 = ["className", "style", "src", "alt", "children"];
|
|
25
|
+
var _excluded = ["children", "className", "style", "variant", "layout", "onClick", "disabled", "dragged", "draggable", "onDragStart", "onDragEnd"];
|
|
19
26
|
/**
|
|
20
|
-
* @zh
|
|
21
|
-
*
|
|
27
|
+
* @zh 卡片组件,用于在一个容器中展示内容和操作。卡片支持多种样式变体(描边、浮起、填充)
|
|
28
|
+
* 和布局变体(垂直堆叠、水平排布),并在悬停、聚焦、按下、拖拽时展示交互状态层与 elevation 变化。
|
|
22
29
|
*
|
|
23
30
|
* @en Card component for displaying content and actions in a single container.
|
|
24
|
-
* Cards support multiple style variants (outlined, elevated, filled) and
|
|
25
|
-
*
|
|
31
|
+
* Cards support multiple style variants (outlined, elevated, filled) and layout
|
|
32
|
+
* variants (stacked, horizontal), with state-based elevation and state-layer
|
|
33
|
+
* transitions on hover, focus, press, and drag.
|
|
26
34
|
*/
|
|
27
35
|
var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
28
36
|
var children = _ref.children,
|
|
@@ -30,156 +38,84 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
30
38
|
style = _ref.style,
|
|
31
39
|
_ref$variant = _ref.variant,
|
|
32
40
|
variant = _ref$variant === void 0 ? "outlined" : _ref$variant,
|
|
41
|
+
_ref$layout = _ref.layout,
|
|
42
|
+
layout = _ref$layout === void 0 ? "stacked" : _ref$layout,
|
|
33
43
|
onClick = _ref.onClick,
|
|
34
44
|
disabled = _ref.disabled,
|
|
45
|
+
draggedProp = _ref.dragged,
|
|
46
|
+
_ref$draggable = _ref.draggable,
|
|
47
|
+
draggable = _ref$draggable === void 0 ? false : _ref$draggable,
|
|
48
|
+
onDragStartProp = _ref.onDragStart,
|
|
49
|
+
onDragEndProp = _ref.onDragEnd,
|
|
35
50
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
36
|
-
hooks.useTheme();
|
|
37
51
|
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
38
|
-
var themeColorVars = useThemeColorVars.useThemeColorVars(["surface", "surface-container-low", "surface-container-highest", "outline-variant", "on-surface", ["on-surface", tokens_stylex.OPACITY.thin], ["on-surface", tokens_stylex.OPACITY.medium], ["on-surface", tokens_stylex.OPACITY.thick]]);
|
|
52
|
+
var themeColorVars = useThemeColorVars.useThemeColorVars(["surface", "surface-container-low", "surface-container-highest", "primary-container", "on-primary-container", "outline-variant", "on-surface", ["on-surface", tokens_stylex.OPACITY.thin], ["on-surface", tokens_stylex.OPACITY.medium], ["on-surface", tokens_stylex.OPACITY.thick]]);
|
|
53
|
+
// Auto-detect drag state via HTML5 events when `draggable` is true.
|
|
54
|
+
var _useState = React.useState(false),
|
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
56
|
+
autoDragged = _useState2[0],
|
|
57
|
+
setAutoDragged = _useState2[1];
|
|
58
|
+
var isDragged = draggedProp !== null && draggedProp !== void 0 ? draggedProp : autoDragged;
|
|
59
|
+
var handleDragStart = React.useCallback(function (event) {
|
|
60
|
+
if (draggable) setAutoDragged(true);
|
|
61
|
+
onDragStartProp === null || onDragStartProp === void 0 || onDragStartProp(event);
|
|
62
|
+
}, [draggable, onDragStartProp]);
|
|
63
|
+
var handleDragEnd = React.useCallback(function (event) {
|
|
64
|
+
if (draggable) setAutoDragged(false);
|
|
65
|
+
onDragEndProp === null || onDragEndProp === void 0 || onDragEndProp(event);
|
|
66
|
+
}, [draggable, onDragEndProp]);
|
|
39
67
|
var interactive = !!onClick && !disabled;
|
|
40
|
-
var
|
|
41
|
-
|
|
68
|
+
var handleClick = React.useCallback(function (event) {
|
|
69
|
+
if (disabled) return;
|
|
70
|
+
onClick === null || onClick === void 0 || onClick(event);
|
|
71
|
+
}, [disabled, onClick]);
|
|
72
|
+
var styled = stylex.props(styles.default.card["default"], styles.default.card[layout], styles.default.card[variant], interactive && styles.default.card.interactive, disabled && styles.default.card.disabled,
|
|
73
|
+
// state-based elevation (only meaningful when interactive or dragged)
|
|
74
|
+
interactive && variant === "outlined" && styles.default.elevationState.outlinedHover, isDragged && variant === "outlined" && styles.default.elevationState.outlinedDragged, interactive && variant === "elevated" && styles.default.elevationState.elevatedHover, isDragged && variant === "elevated" && styles.default.elevationState.elevatedDragged, isDragged && variant === "filled" && styles.default.elevationState.filledDragged,
|
|
75
|
+
// state layer
|
|
76
|
+
interactive && !isDragged && styles.default.stateLayer.hover, interactive && !isDragged && styles.default.stateLayer.focus, interactive && !isDragged && styles.default.stateLayer.press);
|
|
77
|
+
return /*#__PURE__*/React.createElement(context.CardContext.Provider, {
|
|
78
|
+
value: {
|
|
79
|
+
layout: layout,
|
|
80
|
+
disabled: disabled
|
|
81
|
+
}
|
|
82
|
+
}, /*#__PURE__*/React.createElement("div", _objectSpread({
|
|
42
83
|
ref: ref,
|
|
43
84
|
className: className.stringify(classNames.card, className$1, styled.className),
|
|
44
85
|
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, styled.style), style), themeColorVars), {}, {
|
|
45
86
|
"--color-state-layer-hover": "color-mix(in srgb, var(--color-on-surface) 8%, transparent)",
|
|
46
87
|
"--color-state-layer-focus": "color-mix(in srgb, var(--color-on-surface) 12%, transparent)",
|
|
47
88
|
"--color-state-layer-press": "color-mix(in srgb, var(--color-on-surface) 12%, transparent)"
|
|
89
|
+
}, isDragged && {
|
|
90
|
+
"--card-state-layer": "color-mix(in srgb, var(--color-on-surface) 16%, transparent)"
|
|
48
91
|
}),
|
|
49
|
-
onClick:
|
|
92
|
+
onClick: handleClick,
|
|
93
|
+
onDragStart: handleDragStart,
|
|
94
|
+
onDragEnd: handleDragEnd,
|
|
50
95
|
tabIndex: interactive ? 0 : undefined,
|
|
51
96
|
role: interactive ? "button" : undefined,
|
|
52
|
-
"aria-disabled": disabled
|
|
53
|
-
|
|
54
|
-
});
|
|
55
|
-
/**
|
|
56
|
-
* @zh 卡片头部,包含字母头像、标题、副标题和可选的操作区
|
|
57
|
-
* @en Card header with monogram, title, subhead, and optional action area
|
|
58
|
-
*/
|
|
59
|
-
var CardHeader = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
|
|
60
|
-
var className$1 = _ref2.className,
|
|
61
|
-
style = _ref2.style,
|
|
62
|
-
children = _ref2.children,
|
|
63
|
-
action = _ref2.action,
|
|
64
|
-
monogram = _ref2.monogram,
|
|
65
|
-
monogramText = _ref2.monogramText,
|
|
66
|
-
title = _ref2.title,
|
|
67
|
-
subhead = _ref2.subhead;
|
|
68
|
-
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
69
|
-
var headerStyled = stylex.props(styles.default.header["default"]);
|
|
70
|
-
var contentStyled = stylex.props(styles.default.headerContent["default"]);
|
|
71
|
-
var textStyled = stylex.props(styles.default.headerText["default"]);
|
|
72
|
-
var titleStyled = stylex.props(styles.default.headerTitle["default"]);
|
|
73
|
-
var subheadStyled = stylex.props(styles.default.headerSubhead["default"]);
|
|
74
|
-
if (children) {
|
|
75
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
76
|
-
ref: ref,
|
|
77
|
-
className: className.stringify(classNames.header, className$1, headerStyled.className),
|
|
78
|
-
style: _objectSpread(_objectSpread({}, headerStyled.style), style)
|
|
79
|
-
}, children);
|
|
80
|
-
}
|
|
81
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
82
|
-
ref: ref,
|
|
83
|
-
className: className.stringify(classNames.header, className$1, headerStyled.className),
|
|
84
|
-
style: _objectSpread(_objectSpread({}, headerStyled.style), style)
|
|
85
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
86
|
-
className: className.stringify(classNames.headerContent, contentStyled.className),
|
|
87
|
-
style: contentStyled.style
|
|
88
|
-
}, (monogram || monogramText) && (/*#__PURE__*/React.createElement("div", {
|
|
89
|
-
className: classNames.headerMonogram
|
|
90
|
-
}, monogram ? (/*#__PURE__*/React.createElement("img", {
|
|
91
|
-
alt: "",
|
|
92
|
-
src: monogram,
|
|
93
|
-
style: {
|
|
94
|
-
width: "100%",
|
|
95
|
-
height: "100%",
|
|
96
|
-
display: "block"
|
|
97
|
-
}
|
|
98
|
-
})) : monogramText)), /*#__PURE__*/React.createElement("div", {
|
|
99
|
-
className: className.stringify(classNames.headerText, textStyled.className),
|
|
100
|
-
style: textStyled.style
|
|
101
|
-
}, title && (/*#__PURE__*/React.createElement("div", {
|
|
102
|
-
className: className.stringify(classNames.headerTitle, titleStyled.className),
|
|
103
|
-
style: titleStyled.style
|
|
104
|
-
}, title)), subhead && (/*#__PURE__*/React.createElement("div", {
|
|
105
|
-
className: className.stringify(classNames.headerSubhead, subheadStyled.className),
|
|
106
|
-
style: subheadStyled.style
|
|
107
|
-
}, subhead)))), action && /*#__PURE__*/React.createElement("div", {
|
|
108
|
-
className: classNames.headerAction
|
|
109
|
-
}, action));
|
|
110
|
-
});
|
|
111
|
-
/**
|
|
112
|
-
* @zh 卡片媒体区,用于展示图片或自定义内容
|
|
113
|
-
* @en Card media area for displaying images or custom content
|
|
114
|
-
*/
|
|
115
|
-
var CardMedia = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
|
|
116
|
-
var className$1 = _ref3.className,
|
|
117
|
-
style = _ref3.style,
|
|
118
|
-
src = _ref3.src,
|
|
119
|
-
alt = _ref3.alt,
|
|
120
|
-
children = _ref3.children,
|
|
121
|
-
imgProps = _objectWithoutProperties(_ref3, _excluded2);
|
|
122
|
-
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
123
|
-
var mediaStyled = stylex.props(styles.default.media["default"]);
|
|
124
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
125
|
-
ref: ref,
|
|
126
|
-
className: className.stringify(classNames.media, className$1, mediaStyled.className),
|
|
127
|
-
style: _objectSpread(_objectSpread({}, mediaStyled.style), style)
|
|
128
|
-
}, children || src && (/*#__PURE__*/React.createElement("img", _objectSpread(_objectSpread({
|
|
129
|
-
alt: alt,
|
|
130
|
-
src: src
|
|
131
|
-
}, imgProps), {}, {
|
|
132
|
-
style: {
|
|
133
|
-
position: "absolute",
|
|
134
|
-
inset: 0,
|
|
135
|
-
width: "100%",
|
|
136
|
-
height: "100%",
|
|
137
|
-
objectFit: "cover"
|
|
138
|
-
}
|
|
139
|
-
}))));
|
|
140
|
-
});
|
|
141
|
-
/**
|
|
142
|
-
* @zh 卡片内容区,用于展示文本内容
|
|
143
|
-
* @en Card content area for displaying text content
|
|
144
|
-
*/
|
|
145
|
-
var CardContent = /*#__PURE__*/React.forwardRef(function (_ref4, ref) {
|
|
146
|
-
var className$1 = _ref4.className,
|
|
147
|
-
style = _ref4.style,
|
|
148
|
-
children = _ref4.children;
|
|
149
|
-
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
150
|
-
var contentStyled = stylex.props(styles.default.content["default"]);
|
|
151
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
152
|
-
ref: ref,
|
|
153
|
-
className: className.stringify(classNames.content, className$1, contentStyled.className),
|
|
154
|
-
style: _objectSpread(_objectSpread({}, contentStyled.style), style)
|
|
155
|
-
}, children);
|
|
156
|
-
});
|
|
157
|
-
/**
|
|
158
|
-
* @zh 卡片操作区,通常包含按钮等交互元素
|
|
159
|
-
* @en Card actions area, typically containing buttons and other interactive elements
|
|
160
|
-
*/
|
|
161
|
-
var CardActions = /*#__PURE__*/React.forwardRef(function (_ref5, ref) {
|
|
162
|
-
var className$1 = _ref5.className,
|
|
163
|
-
style = _ref5.style,
|
|
164
|
-
children = _ref5.children;
|
|
165
|
-
var classNames = useClassNames.useClassNames(context.CLASS_NAMES);
|
|
166
|
-
var actionsStyled = stylex.props(styles.default.actions["default"]);
|
|
167
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
168
|
-
ref: ref,
|
|
169
|
-
className: className.stringify(classNames.actions, className$1, actionsStyled.className),
|
|
170
|
-
style: _objectSpread(_objectSpread({}, actionsStyled.style), style)
|
|
171
|
-
}, children);
|
|
97
|
+
"aria-disabled": disabled,
|
|
98
|
+
draggable: draggable || undefined
|
|
99
|
+
}, props), children));
|
|
172
100
|
});
|
|
173
101
|
var _Card = Object.assign(Card, {
|
|
174
|
-
Header:
|
|
175
|
-
Media:
|
|
176
|
-
Content:
|
|
177
|
-
|
|
102
|
+
Header: header.default,
|
|
103
|
+
Media: media.default,
|
|
104
|
+
Content: content.default,
|
|
105
|
+
Headline: headline.default,
|
|
106
|
+
Title: title.default,
|
|
107
|
+
Subhead: subhead.default,
|
|
108
|
+
Body: body.default,
|
|
109
|
+
Actions: actions.default
|
|
178
110
|
});
|
|
179
111
|
|
|
112
|
+
exports.CardHeader = header.default;
|
|
113
|
+
exports.CardMedia = media.default;
|
|
114
|
+
exports.CardContent = content.default;
|
|
115
|
+
exports.CardHeadline = headline.default;
|
|
116
|
+
exports.CardTitle = title.default;
|
|
117
|
+
exports.CardSubhead = subhead.default;
|
|
118
|
+
exports.CardBody = body.default;
|
|
119
|
+
exports.CardActions = actions.default;
|
|
180
120
|
exports.Card = Card;
|
|
181
|
-
exports.CardActions = CardActions;
|
|
182
|
-
exports.CardContent = CardContent;
|
|
183
|
-
exports.CardHeader = CardHeader;
|
|
184
|
-
exports.CardMedia = CardMedia;
|
|
185
121
|
exports.default = _Card;
|
|
@@ -1,159 +1,32 @@
|
|
|
1
1
|
import type { CardProps } from "../../types/card";
|
|
2
|
-
import type { ReactNode, CSSProperties, ImgHTMLAttributes } from "react";
|
|
3
2
|
import React from "react";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* @zh 自定义样式
|
|
16
|
-
* @en Custom style
|
|
17
|
-
*/
|
|
18
|
-
style?: CSSProperties;
|
|
19
|
-
/**
|
|
20
|
-
* @zh 头部内容
|
|
21
|
-
* @en Header content
|
|
22
|
-
*/
|
|
23
|
-
children?: ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
* @zh 尾部操作区,例如图标按钮
|
|
26
|
-
* @en Trailing action area, e.g. icon button
|
|
27
|
-
*/
|
|
28
|
-
action?: ReactNode;
|
|
29
|
-
/**
|
|
30
|
-
* @zh 头像/字母缩写图片地址
|
|
31
|
-
* @en Monogram image source
|
|
32
|
-
*/
|
|
33
|
-
monogram?: string;
|
|
34
|
-
/**
|
|
35
|
-
* @zh 字母缩写文本
|
|
36
|
-
* @en Monogram text (e.g. initials)
|
|
37
|
-
*/
|
|
38
|
-
monogramText?: string;
|
|
39
|
-
/**
|
|
40
|
-
* @zh 标题
|
|
41
|
-
* @en Title
|
|
42
|
-
*/
|
|
43
|
-
title?: ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
* @zh 副标题
|
|
46
|
-
* @en Subhead
|
|
47
|
-
*/
|
|
48
|
-
subhead?: ReactNode;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @zh 卡片媒体区属性
|
|
52
|
-
* @en Card media props
|
|
53
|
-
*/
|
|
54
|
-
interface CardMediaProps extends ImgHTMLAttributes<HTMLImageElement> {
|
|
55
|
-
/**
|
|
56
|
-
* @zh 自定义类名
|
|
57
|
-
* @en Custom class name
|
|
58
|
-
*/
|
|
59
|
-
className?: string;
|
|
60
|
-
/**
|
|
61
|
-
* @zh 自定义样式
|
|
62
|
-
* @en Custom style
|
|
63
|
-
*/
|
|
64
|
-
style?: CSSProperties;
|
|
65
|
-
/**
|
|
66
|
-
* @zh 图片地址
|
|
67
|
-
* @en Image source
|
|
68
|
-
*/
|
|
69
|
-
src?: string;
|
|
70
|
-
/**
|
|
71
|
-
* @zh 图片替代文本
|
|
72
|
-
* @en Image alt text
|
|
73
|
-
*/
|
|
74
|
-
alt?: string;
|
|
75
|
-
/**
|
|
76
|
-
* @zh 自定义内容(覆盖默认图片渲染)
|
|
77
|
-
* @en Custom content (overrides default image)
|
|
78
|
-
*/
|
|
79
|
-
children?: ReactNode;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* @zh 卡片内容区属性
|
|
83
|
-
* @en Card content props
|
|
84
|
-
*/
|
|
85
|
-
interface CardContentProps {
|
|
86
|
-
/**
|
|
87
|
-
* @zh 自定义类名
|
|
88
|
-
* @en Custom class name
|
|
89
|
-
*/
|
|
90
|
-
className?: string;
|
|
91
|
-
/**
|
|
92
|
-
* @zh 自定义样式
|
|
93
|
-
* @en Custom style
|
|
94
|
-
*/
|
|
95
|
-
style?: CSSProperties;
|
|
96
|
-
/**
|
|
97
|
-
* @zh 内容
|
|
98
|
-
* @en Content
|
|
99
|
-
*/
|
|
100
|
-
children?: ReactNode;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* @zh 卡片操作区属性
|
|
104
|
-
* @en Card actions props
|
|
105
|
-
*/
|
|
106
|
-
interface CardActionsProps {
|
|
107
|
-
/**
|
|
108
|
-
* @zh 自定义类名
|
|
109
|
-
* @en Custom class name
|
|
110
|
-
*/
|
|
111
|
-
className?: string;
|
|
112
|
-
/**
|
|
113
|
-
* @zh 自定义样式
|
|
114
|
-
* @en Custom style
|
|
115
|
-
*/
|
|
116
|
-
style?: CSSProperties;
|
|
117
|
-
/**
|
|
118
|
-
* @zh 操作按钮等
|
|
119
|
-
* @en Action buttons etc.
|
|
120
|
-
*/
|
|
121
|
-
children?: ReactNode;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* @zh 卡片组件,用于在一个容器中展示内容和操作。卡片支持多种样式变体(描边、浮起、填充),
|
|
125
|
-
* 并在悬停、聚焦、按下时展示交互状态层。
|
|
3
|
+
import CardHeader from "./header";
|
|
4
|
+
import CardMedia from "./media";
|
|
5
|
+
import CardContent from "./content";
|
|
6
|
+
import CardHeadline from "./headline";
|
|
7
|
+
import CardTitle from "./title";
|
|
8
|
+
import CardSubhead from "./subhead";
|
|
9
|
+
import CardBody from "./body";
|
|
10
|
+
import CardActions from "./actions";
|
|
11
|
+
/**
|
|
12
|
+
* @zh 卡片组件,用于在一个容器中展示内容和操作。卡片支持多种样式变体(描边、浮起、填充)
|
|
13
|
+
* 和布局变体(垂直堆叠、水平排布),并在悬停、聚焦、按下、拖拽时展示交互状态层与 elevation 变化。
|
|
126
14
|
*
|
|
127
15
|
* @en Card component for displaying content and actions in a single container.
|
|
128
|
-
* Cards support multiple style variants (outlined, elevated, filled) and
|
|
129
|
-
*
|
|
16
|
+
* Cards support multiple style variants (outlined, elevated, filled) and layout
|
|
17
|
+
* variants (stacked, horizontal), with state-based elevation and state-layer
|
|
18
|
+
* transitions on hover, focus, press, and drag.
|
|
130
19
|
*/
|
|
131
20
|
declare const Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>>;
|
|
132
|
-
/**
|
|
133
|
-
* @zh 卡片头部,包含字母头像、标题、副标题和可选的操作区
|
|
134
|
-
* @en Card header with monogram, title, subhead, and optional action area
|
|
135
|
-
*/
|
|
136
|
-
declare const CardHeader: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
137
|
-
/**
|
|
138
|
-
* @zh 卡片媒体区,用于展示图片或自定义内容
|
|
139
|
-
* @en Card media area for displaying images or custom content
|
|
140
|
-
*/
|
|
141
|
-
declare const CardMedia: React.ForwardRefExoticComponent<CardMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
142
|
-
/**
|
|
143
|
-
* @zh 卡片内容区,用于展示文本内容
|
|
144
|
-
* @en Card content area for displaying text content
|
|
145
|
-
*/
|
|
146
|
-
declare const CardContent: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
147
|
-
/**
|
|
148
|
-
* @zh 卡片操作区,通常包含按钮等交互元素
|
|
149
|
-
* @en Card actions area, typically containing buttons and other interactive elements
|
|
150
|
-
*/
|
|
151
|
-
declare const CardActions: React.ForwardRefExoticComponent<CardActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
152
21
|
declare const _Card: React.ForwardRefExoticComponent<CardProps & React.RefAttributes<HTMLDivElement>> & {
|
|
153
|
-
Header: React.ForwardRefExoticComponent<CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
154
|
-
Media: React.ForwardRefExoticComponent<CardMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
155
|
-
Content: React.ForwardRefExoticComponent<CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
156
|
-
|
|
22
|
+
Header: React.ForwardRefExoticComponent<import("./header").CardHeaderProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
Media: React.ForwardRefExoticComponent<import("./media").CardMediaProps & React.RefAttributes<HTMLDivElement>>;
|
|
24
|
+
Content: React.ForwardRefExoticComponent<import("./content").CardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
Headline: React.ForwardRefExoticComponent<import("./headline").CardHeadlineProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
Title: React.ForwardRefExoticComponent<import("./title").CardTitleProps & React.RefAttributes<HTMLDivElement>>;
|
|
27
|
+
Subhead: React.ForwardRefExoticComponent<import("./subhead").CardSubheadProps & React.RefAttributes<HTMLDivElement>>;
|
|
28
|
+
Body: React.ForwardRefExoticComponent<import("./body").CardBodyProps & React.RefAttributes<HTMLDivElement>>;
|
|
29
|
+
Actions: React.ForwardRefExoticComponent<import("./actions").CardActionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
157
30
|
};
|
|
158
31
|
export default _Card;
|
|
159
|
-
export { Card, CardHeader, CardMedia, CardContent, CardActions };
|
|
32
|
+
export { Card, CardHeader, CardMedia, CardContent, CardHeadline, CardTitle, CardSubhead, CardBody, CardActions, };
|