@heroui/card 2.2.9 → 2.2.11
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/LICENSE +1 -1
- package/README.md +2 -2
- package/package.json +15 -15
- package/dist/card-body.d.ts +0 -6
- package/dist/card-body.js +0 -53
- package/dist/card-body.mjs +0 -8
- package/dist/card-context.d.ts +0 -13
- package/dist/card-context.js +0 -38
- package/dist/card-context.mjs +0 -9
- package/dist/card-footer.d.ts +0 -8
- package/dist/card-footer.js +0 -53
- package/dist/card-footer.mjs +0 -8
- package/dist/card-header.d.ts +0 -6
- package/dist/card-header.js +0 -53
- package/dist/card-header.mjs +0 -8
- package/dist/card.d.ts +0 -14
- package/dist/card.js +0 -206
- package/dist/card.mjs +0 -9
- package/dist/chunk-5PILOUBS.mjs +0 -34
- package/dist/chunk-D5XJWRAV.mjs +0 -25
- package/dist/chunk-LGSBTEIA.mjs +0 -25
- package/dist/chunk-LYDQFOTE.mjs +0 -152
- package/dist/chunk-TE6SZS6W.mjs +0 -25
- package/dist/chunk-XHGGCEVJ.mjs +0 -14
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -271
- package/dist/index.mjs +0 -29
- package/dist/use-card.d.ts +0 -80
- package/dist/use-card.js +0 -175
- package/dist/use-card.mjs +0 -7
package/dist/chunk-LGSBTEIA.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
useCardContext
|
|
4
|
-
} from "./chunk-XHGGCEVJ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/card-body.tsx
|
|
7
|
-
import { forwardRef } from "@heroui/system";
|
|
8
|
-
import { useDOMRef } from "@heroui/react-utils";
|
|
9
|
-
import { clsx } from "@heroui/shared-utils";
|
|
10
|
-
import { jsx } from "react/jsx-runtime";
|
|
11
|
-
var CardBody = forwardRef((props, ref) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const { as, className, children, ...otherProps } = props;
|
|
14
|
-
const Component = as || "div";
|
|
15
|
-
const domRef = useDOMRef(ref);
|
|
16
|
-
const { slots, classNames } = useCardContext();
|
|
17
|
-
const bodyStyles = clsx(classNames == null ? void 0 : classNames.body, className);
|
|
18
|
-
return /* @__PURE__ */ jsx(Component, { ref: domRef, className: (_a = slots.body) == null ? void 0 : _a.call(slots, { class: bodyStyles }), ...otherProps, children });
|
|
19
|
-
});
|
|
20
|
-
CardBody.displayName = "HeroUI.CardBody";
|
|
21
|
-
var card_body_default = CardBody;
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
card_body_default
|
|
25
|
-
};
|
package/dist/chunk-LYDQFOTE.mjs
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/use-card.ts
|
|
4
|
-
import { card } from "@heroui/theme";
|
|
5
|
-
import { useCallback, useMemo } from "react";
|
|
6
|
-
import { chain, mergeProps } from "@react-aria/utils";
|
|
7
|
-
import { useFocusRing } from "@react-aria/focus";
|
|
8
|
-
import { useHover } from "@react-aria/interactions";
|
|
9
|
-
import { useAriaButton } from "@heroui/use-aria-button";
|
|
10
|
-
import { mapPropsVariants, useProviderContext } from "@heroui/system";
|
|
11
|
-
import { clsx, dataAttr, objectToDeps } from "@heroui/shared-utils";
|
|
12
|
-
import { filterDOMProps } from "@heroui/react-utils";
|
|
13
|
-
import { useDOMRef } from "@heroui/react-utils";
|
|
14
|
-
import { useRipple } from "@heroui/ripple";
|
|
15
|
-
function useCard(originalProps) {
|
|
16
|
-
var _a, _b, _c, _d;
|
|
17
|
-
const globalContext = useProviderContext();
|
|
18
|
-
const [props, variantProps] = mapPropsVariants(originalProps, card.variantKeys);
|
|
19
|
-
const {
|
|
20
|
-
ref,
|
|
21
|
-
as,
|
|
22
|
-
children,
|
|
23
|
-
onClick,
|
|
24
|
-
onPress,
|
|
25
|
-
autoFocus,
|
|
26
|
-
className,
|
|
27
|
-
classNames,
|
|
28
|
-
allowTextSelectionOnPress = true,
|
|
29
|
-
...otherProps
|
|
30
|
-
} = props;
|
|
31
|
-
const domRef = useDOMRef(ref);
|
|
32
|
-
const Component = as || (originalProps.isPressable ? "button" : "div");
|
|
33
|
-
const shouldFilterDOMProps = typeof Component === "string";
|
|
34
|
-
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
|
|
35
|
-
const disableRipple = (_d = (_c = originalProps.disableRipple) != null ? _c : globalContext == null ? void 0 : globalContext.disableRipple) != null ? _d : false;
|
|
36
|
-
const baseStyles = clsx(classNames == null ? void 0 : classNames.base, className);
|
|
37
|
-
const { onClear: onClearRipple, onPress: onRipplePressHandler, ripples } = useRipple();
|
|
38
|
-
const handlePress = useCallback(
|
|
39
|
-
(e) => {
|
|
40
|
-
if (disableRipple || disableAnimation)
|
|
41
|
-
return;
|
|
42
|
-
domRef.current && onRipplePressHandler(e);
|
|
43
|
-
},
|
|
44
|
-
[disableRipple, disableAnimation, domRef, onRipplePressHandler]
|
|
45
|
-
);
|
|
46
|
-
const { buttonProps, isPressed } = useAriaButton(
|
|
47
|
-
{
|
|
48
|
-
onPress: chain(onPress, handlePress),
|
|
49
|
-
elementType: as,
|
|
50
|
-
isDisabled: !originalProps.isPressable,
|
|
51
|
-
onClick,
|
|
52
|
-
allowTextSelectionOnPress,
|
|
53
|
-
...otherProps
|
|
54
|
-
},
|
|
55
|
-
domRef
|
|
56
|
-
);
|
|
57
|
-
const { hoverProps, isHovered } = useHover({
|
|
58
|
-
isDisabled: !originalProps.isHoverable,
|
|
59
|
-
...otherProps
|
|
60
|
-
});
|
|
61
|
-
const { isFocusVisible, isFocused, focusProps } = useFocusRing({
|
|
62
|
-
autoFocus
|
|
63
|
-
});
|
|
64
|
-
const slots = useMemo(
|
|
65
|
-
() => card({
|
|
66
|
-
...variantProps,
|
|
67
|
-
disableAnimation
|
|
68
|
-
}),
|
|
69
|
-
[objectToDeps(variantProps), disableAnimation]
|
|
70
|
-
);
|
|
71
|
-
const context = useMemo(
|
|
72
|
-
() => ({
|
|
73
|
-
slots,
|
|
74
|
-
classNames,
|
|
75
|
-
disableAnimation,
|
|
76
|
-
isDisabled: originalProps.isDisabled,
|
|
77
|
-
isFooterBlurred: originalProps.isFooterBlurred,
|
|
78
|
-
fullWidth: originalProps.fullWidth
|
|
79
|
-
}),
|
|
80
|
-
[
|
|
81
|
-
slots,
|
|
82
|
-
classNames,
|
|
83
|
-
originalProps.isDisabled,
|
|
84
|
-
originalProps.isFooterBlurred,
|
|
85
|
-
disableAnimation,
|
|
86
|
-
originalProps.fullWidth
|
|
87
|
-
]
|
|
88
|
-
);
|
|
89
|
-
const getCardProps = useCallback(
|
|
90
|
-
(props2 = {}) => {
|
|
91
|
-
return {
|
|
92
|
-
ref: domRef,
|
|
93
|
-
className: slots.base({ class: baseStyles }),
|
|
94
|
-
tabIndex: originalProps.isPressable ? 0 : -1,
|
|
95
|
-
"data-hover": dataAttr(isHovered),
|
|
96
|
-
"data-pressed": dataAttr(isPressed),
|
|
97
|
-
"data-focus": dataAttr(isFocused),
|
|
98
|
-
"data-focus-visible": dataAttr(isFocusVisible),
|
|
99
|
-
"data-disabled": dataAttr(originalProps.isDisabled),
|
|
100
|
-
...mergeProps(
|
|
101
|
-
originalProps.isPressable ? { ...buttonProps, ...focusProps, role: "button" } : {},
|
|
102
|
-
originalProps.isHoverable ? hoverProps : {},
|
|
103
|
-
filterDOMProps(otherProps, {
|
|
104
|
-
enabled: shouldFilterDOMProps
|
|
105
|
-
}),
|
|
106
|
-
filterDOMProps(props2)
|
|
107
|
-
)
|
|
108
|
-
};
|
|
109
|
-
},
|
|
110
|
-
[
|
|
111
|
-
domRef,
|
|
112
|
-
slots,
|
|
113
|
-
baseStyles,
|
|
114
|
-
shouldFilterDOMProps,
|
|
115
|
-
originalProps.isPressable,
|
|
116
|
-
originalProps.isHoverable,
|
|
117
|
-
originalProps.isDisabled,
|
|
118
|
-
isHovered,
|
|
119
|
-
isPressed,
|
|
120
|
-
isFocusVisible,
|
|
121
|
-
buttonProps,
|
|
122
|
-
focusProps,
|
|
123
|
-
hoverProps,
|
|
124
|
-
otherProps
|
|
125
|
-
]
|
|
126
|
-
);
|
|
127
|
-
const getRippleProps = useCallback(
|
|
128
|
-
() => ({ ripples, onClear: onClearRipple }),
|
|
129
|
-
[ripples, onClearRipple]
|
|
130
|
-
);
|
|
131
|
-
return {
|
|
132
|
-
context,
|
|
133
|
-
domRef,
|
|
134
|
-
Component,
|
|
135
|
-
classNames,
|
|
136
|
-
children,
|
|
137
|
-
isHovered,
|
|
138
|
-
isPressed,
|
|
139
|
-
disableAnimation,
|
|
140
|
-
isPressable: originalProps.isPressable,
|
|
141
|
-
isHoverable: originalProps.isHoverable,
|
|
142
|
-
disableRipple,
|
|
143
|
-
handlePress,
|
|
144
|
-
isFocusVisible,
|
|
145
|
-
getCardProps,
|
|
146
|
-
getRippleProps
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export {
|
|
151
|
-
useCard
|
|
152
|
-
};
|
package/dist/chunk-TE6SZS6W.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
useCardContext
|
|
4
|
-
} from "./chunk-XHGGCEVJ.mjs";
|
|
5
|
-
|
|
6
|
-
// src/card-footer.tsx
|
|
7
|
-
import { forwardRef } from "@heroui/system";
|
|
8
|
-
import { useDOMRef } from "@heroui/react-utils";
|
|
9
|
-
import { clsx } from "@heroui/shared-utils";
|
|
10
|
-
import { jsx } from "react/jsx-runtime";
|
|
11
|
-
var CardFooter = forwardRef((props, ref) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const { as, className, children, ...otherProps } = props;
|
|
14
|
-
const Component = as || "div";
|
|
15
|
-
const domRef = useDOMRef(ref);
|
|
16
|
-
const { slots, classNames } = useCardContext();
|
|
17
|
-
const footerStyles = clsx(classNames == null ? void 0 : classNames.footer, className);
|
|
18
|
-
return /* @__PURE__ */ jsx(Component, { ref: domRef, className: (_a = slots.footer) == null ? void 0 : _a.call(slots, { class: footerStyles }), ...otherProps, children });
|
|
19
|
-
});
|
|
20
|
-
CardFooter.displayName = "HeroUI.CardFooter";
|
|
21
|
-
var card_footer_default = CardFooter;
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
card_footer_default
|
|
25
|
-
};
|
package/dist/chunk-XHGGCEVJ.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
// src/card-context.ts
|
|
4
|
-
import { createContext } from "@heroui/react-utils";
|
|
5
|
-
var [CardProvider, useCardContext] = createContext({
|
|
6
|
-
name: "CardContext",
|
|
7
|
-
strict: true,
|
|
8
|
-
errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
CardProvider,
|
|
13
|
-
useCardContext
|
|
14
|
-
};
|
package/dist/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export { default as Card, CardProps } from './card.js';
|
|
2
|
-
export { default as CardFooter, CardFooterProps } from './card-footer.js';
|
|
3
|
-
export { useCard } from './use-card.js';
|
|
4
|
-
export { CardProvider, useCardContext } from './card-context.js';
|
|
5
|
-
export { default as CardHeader } from './card-header.js';
|
|
6
|
-
export { default as CardBody } from './card-body.js';
|
|
7
|
-
import '@heroui/system';
|
|
8
|
-
import 'react';
|
|
9
|
-
import '@react-types/shared';
|
|
10
|
-
import '@heroui/theme';
|
|
11
|
-
import '@heroui/ripple';
|
|
12
|
-
import '@react-aria/interactions';
|
|
13
|
-
import '@heroui/react-utils';
|
package/dist/index.js
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// src/index.ts
|
|
22
|
-
var src_exports = {};
|
|
23
|
-
__export(src_exports, {
|
|
24
|
-
Card: () => card_default,
|
|
25
|
-
CardBody: () => card_body_default,
|
|
26
|
-
CardFooter: () => card_footer_default,
|
|
27
|
-
CardHeader: () => card_header_default,
|
|
28
|
-
CardProvider: () => CardProvider,
|
|
29
|
-
useCard: () => useCard,
|
|
30
|
-
useCardContext: () => useCardContext
|
|
31
|
-
});
|
|
32
|
-
module.exports = __toCommonJS(src_exports);
|
|
33
|
-
|
|
34
|
-
// src/use-card.ts
|
|
35
|
-
var import_theme = require("@heroui/theme");
|
|
36
|
-
var import_react = require("react");
|
|
37
|
-
var import_utils = require("@react-aria/utils");
|
|
38
|
-
var import_focus = require("@react-aria/focus");
|
|
39
|
-
var import_interactions = require("@react-aria/interactions");
|
|
40
|
-
var import_use_aria_button = require("@heroui/use-aria-button");
|
|
41
|
-
var import_system = require("@heroui/system");
|
|
42
|
-
var import_shared_utils = require("@heroui/shared-utils");
|
|
43
|
-
var import_react_utils = require("@heroui/react-utils");
|
|
44
|
-
var import_react_utils2 = require("@heroui/react-utils");
|
|
45
|
-
var import_ripple = require("@heroui/ripple");
|
|
46
|
-
function useCard(originalProps) {
|
|
47
|
-
var _a, _b, _c, _d;
|
|
48
|
-
const globalContext = (0, import_system.useProviderContext)();
|
|
49
|
-
const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.card.variantKeys);
|
|
50
|
-
const {
|
|
51
|
-
ref,
|
|
52
|
-
as,
|
|
53
|
-
children,
|
|
54
|
-
onClick,
|
|
55
|
-
onPress,
|
|
56
|
-
autoFocus,
|
|
57
|
-
className,
|
|
58
|
-
classNames,
|
|
59
|
-
allowTextSelectionOnPress = true,
|
|
60
|
-
...otherProps
|
|
61
|
-
} = props;
|
|
62
|
-
const domRef = (0, import_react_utils2.useDOMRef)(ref);
|
|
63
|
-
const Component = as || (originalProps.isPressable ? "button" : "div");
|
|
64
|
-
const shouldFilterDOMProps = typeof Component === "string";
|
|
65
|
-
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
|
|
66
|
-
const disableRipple = (_d = (_c = originalProps.disableRipple) != null ? _c : globalContext == null ? void 0 : globalContext.disableRipple) != null ? _d : false;
|
|
67
|
-
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
|
|
68
|
-
const { onClear: onClearRipple, onPress: onRipplePressHandler, ripples } = (0, import_ripple.useRipple)();
|
|
69
|
-
const handlePress = (0, import_react.useCallback)(
|
|
70
|
-
(e) => {
|
|
71
|
-
if (disableRipple || disableAnimation)
|
|
72
|
-
return;
|
|
73
|
-
domRef.current && onRipplePressHandler(e);
|
|
74
|
-
},
|
|
75
|
-
[disableRipple, disableAnimation, domRef, onRipplePressHandler]
|
|
76
|
-
);
|
|
77
|
-
const { buttonProps, isPressed } = (0, import_use_aria_button.useAriaButton)(
|
|
78
|
-
{
|
|
79
|
-
onPress: (0, import_utils.chain)(onPress, handlePress),
|
|
80
|
-
elementType: as,
|
|
81
|
-
isDisabled: !originalProps.isPressable,
|
|
82
|
-
onClick,
|
|
83
|
-
allowTextSelectionOnPress,
|
|
84
|
-
...otherProps
|
|
85
|
-
},
|
|
86
|
-
domRef
|
|
87
|
-
);
|
|
88
|
-
const { hoverProps, isHovered } = (0, import_interactions.useHover)({
|
|
89
|
-
isDisabled: !originalProps.isHoverable,
|
|
90
|
-
...otherProps
|
|
91
|
-
});
|
|
92
|
-
const { isFocusVisible, isFocused, focusProps } = (0, import_focus.useFocusRing)({
|
|
93
|
-
autoFocus
|
|
94
|
-
});
|
|
95
|
-
const slots = (0, import_react.useMemo)(
|
|
96
|
-
() => (0, import_theme.card)({
|
|
97
|
-
...variantProps,
|
|
98
|
-
disableAnimation
|
|
99
|
-
}),
|
|
100
|
-
[(0, import_shared_utils.objectToDeps)(variantProps), disableAnimation]
|
|
101
|
-
);
|
|
102
|
-
const context = (0, import_react.useMemo)(
|
|
103
|
-
() => ({
|
|
104
|
-
slots,
|
|
105
|
-
classNames,
|
|
106
|
-
disableAnimation,
|
|
107
|
-
isDisabled: originalProps.isDisabled,
|
|
108
|
-
isFooterBlurred: originalProps.isFooterBlurred,
|
|
109
|
-
fullWidth: originalProps.fullWidth
|
|
110
|
-
}),
|
|
111
|
-
[
|
|
112
|
-
slots,
|
|
113
|
-
classNames,
|
|
114
|
-
originalProps.isDisabled,
|
|
115
|
-
originalProps.isFooterBlurred,
|
|
116
|
-
disableAnimation,
|
|
117
|
-
originalProps.fullWidth
|
|
118
|
-
]
|
|
119
|
-
);
|
|
120
|
-
const getCardProps = (0, import_react.useCallback)(
|
|
121
|
-
(props2 = {}) => {
|
|
122
|
-
return {
|
|
123
|
-
ref: domRef,
|
|
124
|
-
className: slots.base({ class: baseStyles }),
|
|
125
|
-
tabIndex: originalProps.isPressable ? 0 : -1,
|
|
126
|
-
"data-hover": (0, import_shared_utils.dataAttr)(isHovered),
|
|
127
|
-
"data-pressed": (0, import_shared_utils.dataAttr)(isPressed),
|
|
128
|
-
"data-focus": (0, import_shared_utils.dataAttr)(isFocused),
|
|
129
|
-
"data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
|
|
130
|
-
"data-disabled": (0, import_shared_utils.dataAttr)(originalProps.isDisabled),
|
|
131
|
-
...(0, import_utils.mergeProps)(
|
|
132
|
-
originalProps.isPressable ? { ...buttonProps, ...focusProps, role: "button" } : {},
|
|
133
|
-
originalProps.isHoverable ? hoverProps : {},
|
|
134
|
-
(0, import_react_utils.filterDOMProps)(otherProps, {
|
|
135
|
-
enabled: shouldFilterDOMProps
|
|
136
|
-
}),
|
|
137
|
-
(0, import_react_utils.filterDOMProps)(props2)
|
|
138
|
-
)
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
[
|
|
142
|
-
domRef,
|
|
143
|
-
slots,
|
|
144
|
-
baseStyles,
|
|
145
|
-
shouldFilterDOMProps,
|
|
146
|
-
originalProps.isPressable,
|
|
147
|
-
originalProps.isHoverable,
|
|
148
|
-
originalProps.isDisabled,
|
|
149
|
-
isHovered,
|
|
150
|
-
isPressed,
|
|
151
|
-
isFocusVisible,
|
|
152
|
-
buttonProps,
|
|
153
|
-
focusProps,
|
|
154
|
-
hoverProps,
|
|
155
|
-
otherProps
|
|
156
|
-
]
|
|
157
|
-
);
|
|
158
|
-
const getRippleProps = (0, import_react.useCallback)(
|
|
159
|
-
() => ({ ripples, onClear: onClearRipple }),
|
|
160
|
-
[ripples, onClearRipple]
|
|
161
|
-
);
|
|
162
|
-
return {
|
|
163
|
-
context,
|
|
164
|
-
domRef,
|
|
165
|
-
Component,
|
|
166
|
-
classNames,
|
|
167
|
-
children,
|
|
168
|
-
isHovered,
|
|
169
|
-
isPressed,
|
|
170
|
-
disableAnimation,
|
|
171
|
-
isPressable: originalProps.isPressable,
|
|
172
|
-
isHoverable: originalProps.isHoverable,
|
|
173
|
-
disableRipple,
|
|
174
|
-
handlePress,
|
|
175
|
-
isFocusVisible,
|
|
176
|
-
getCardProps,
|
|
177
|
-
getRippleProps
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
// src/card-context.ts
|
|
182
|
-
var import_react_utils3 = require("@heroui/react-utils");
|
|
183
|
-
var [CardProvider, useCardContext] = (0, import_react_utils3.createContext)({
|
|
184
|
-
name: "CardContext",
|
|
185
|
-
strict: true,
|
|
186
|
-
errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
// src/card.tsx
|
|
190
|
-
var import_system2 = require("@heroui/system");
|
|
191
|
-
var import_ripple2 = require("@heroui/ripple");
|
|
192
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
193
|
-
var Card = (0, import_system2.forwardRef)((props, ref) => {
|
|
194
|
-
const {
|
|
195
|
-
children,
|
|
196
|
-
context,
|
|
197
|
-
Component,
|
|
198
|
-
isPressable,
|
|
199
|
-
disableAnimation,
|
|
200
|
-
disableRipple,
|
|
201
|
-
getCardProps,
|
|
202
|
-
getRippleProps
|
|
203
|
-
} = useCard({ ...props, ref });
|
|
204
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Component, { ...getCardProps(), children: [
|
|
205
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardProvider, { value: context, children }),
|
|
206
|
-
isPressable && !disableAnimation && !disableRipple && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ripple2.Ripple, { ...getRippleProps() })
|
|
207
|
-
] });
|
|
208
|
-
});
|
|
209
|
-
Card.displayName = "HeroUI.Card";
|
|
210
|
-
var card_default = Card;
|
|
211
|
-
|
|
212
|
-
// src/card-header.tsx
|
|
213
|
-
var import_system3 = require("@heroui/system");
|
|
214
|
-
var import_react_utils4 = require("@heroui/react-utils");
|
|
215
|
-
var import_shared_utils2 = require("@heroui/shared-utils");
|
|
216
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
217
|
-
var CardHeader = (0, import_system3.forwardRef)((props, ref) => {
|
|
218
|
-
var _a;
|
|
219
|
-
const { as, className, children, ...otherProps } = props;
|
|
220
|
-
const Component = as || "div";
|
|
221
|
-
const domRef = (0, import_react_utils4.useDOMRef)(ref);
|
|
222
|
-
const { slots, classNames } = useCardContext();
|
|
223
|
-
const headerStyles = (0, import_shared_utils2.clsx)(classNames == null ? void 0 : classNames.header, className);
|
|
224
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { ref: domRef, className: (_a = slots.header) == null ? void 0 : _a.call(slots, { class: headerStyles }), ...otherProps, children });
|
|
225
|
-
});
|
|
226
|
-
CardHeader.displayName = "HeroUI.CardHeader";
|
|
227
|
-
var card_header_default = CardHeader;
|
|
228
|
-
|
|
229
|
-
// src/card-body.tsx
|
|
230
|
-
var import_system4 = require("@heroui/system");
|
|
231
|
-
var import_react_utils5 = require("@heroui/react-utils");
|
|
232
|
-
var import_shared_utils3 = require("@heroui/shared-utils");
|
|
233
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
234
|
-
var CardBody = (0, import_system4.forwardRef)((props, ref) => {
|
|
235
|
-
var _a;
|
|
236
|
-
const { as, className, children, ...otherProps } = props;
|
|
237
|
-
const Component = as || "div";
|
|
238
|
-
const domRef = (0, import_react_utils5.useDOMRef)(ref);
|
|
239
|
-
const { slots, classNames } = useCardContext();
|
|
240
|
-
const bodyStyles = (0, import_shared_utils3.clsx)(classNames == null ? void 0 : classNames.body, className);
|
|
241
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ref: domRef, className: (_a = slots.body) == null ? void 0 : _a.call(slots, { class: bodyStyles }), ...otherProps, children });
|
|
242
|
-
});
|
|
243
|
-
CardBody.displayName = "HeroUI.CardBody";
|
|
244
|
-
var card_body_default = CardBody;
|
|
245
|
-
|
|
246
|
-
// src/card-footer.tsx
|
|
247
|
-
var import_system5 = require("@heroui/system");
|
|
248
|
-
var import_react_utils6 = require("@heroui/react-utils");
|
|
249
|
-
var import_shared_utils4 = require("@heroui/shared-utils");
|
|
250
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
251
|
-
var CardFooter = (0, import_system5.forwardRef)((props, ref) => {
|
|
252
|
-
var _a;
|
|
253
|
-
const { as, className, children, ...otherProps } = props;
|
|
254
|
-
const Component = as || "div";
|
|
255
|
-
const domRef = (0, import_react_utils6.useDOMRef)(ref);
|
|
256
|
-
const { slots, classNames } = useCardContext();
|
|
257
|
-
const footerStyles = (0, import_shared_utils4.clsx)(classNames == null ? void 0 : classNames.footer, className);
|
|
258
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ref: domRef, className: (_a = slots.footer) == null ? void 0 : _a.call(slots, { class: footerStyles }), ...otherProps, children });
|
|
259
|
-
});
|
|
260
|
-
CardFooter.displayName = "HeroUI.CardFooter";
|
|
261
|
-
var card_footer_default = CardFooter;
|
|
262
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
263
|
-
0 && (module.exports = {
|
|
264
|
-
Card,
|
|
265
|
-
CardBody,
|
|
266
|
-
CardFooter,
|
|
267
|
-
CardHeader,
|
|
268
|
-
CardProvider,
|
|
269
|
-
useCard,
|
|
270
|
-
useCardContext
|
|
271
|
-
});
|
package/dist/index.mjs
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
card_body_default
|
|
4
|
-
} from "./chunk-LGSBTEIA.mjs";
|
|
5
|
-
import {
|
|
6
|
-
card_footer_default
|
|
7
|
-
} from "./chunk-TE6SZS6W.mjs";
|
|
8
|
-
import {
|
|
9
|
-
card_header_default
|
|
10
|
-
} from "./chunk-D5XJWRAV.mjs";
|
|
11
|
-
import {
|
|
12
|
-
card_default
|
|
13
|
-
} from "./chunk-5PILOUBS.mjs";
|
|
14
|
-
import {
|
|
15
|
-
CardProvider,
|
|
16
|
-
useCardContext
|
|
17
|
-
} from "./chunk-XHGGCEVJ.mjs";
|
|
18
|
-
import {
|
|
19
|
-
useCard
|
|
20
|
-
} from "./chunk-LYDQFOTE.mjs";
|
|
21
|
-
export {
|
|
22
|
-
card_default as Card,
|
|
23
|
-
card_body_default as CardBody,
|
|
24
|
-
card_footer_default as CardFooter,
|
|
25
|
-
card_header_default as CardHeader,
|
|
26
|
-
CardProvider,
|
|
27
|
-
useCard,
|
|
28
|
-
useCardContext
|
|
29
|
-
};
|
package/dist/use-card.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import * as _heroui_system from '@heroui/system';
|
|
2
|
-
import { HTMLHeroUIProps, PropGetter } from '@heroui/system';
|
|
3
|
-
import * as react from 'react';
|
|
4
|
-
import { ReactNode, MouseEventHandler } from 'react';
|
|
5
|
-
import { PressEvents, FocusableProps } from '@react-types/shared';
|
|
6
|
-
import { SlotsToClasses, CardSlots, CardVariantProps, CardReturnType } from '@heroui/theme';
|
|
7
|
-
import { RippleProps } from '@heroui/ripple';
|
|
8
|
-
import { PressEvent } from '@react-aria/interactions';
|
|
9
|
-
import { ReactRef } from '@heroui/react-utils';
|
|
10
|
-
|
|
11
|
-
interface Props extends Omit<HTMLHeroUIProps<"div">, "onClick"> {
|
|
12
|
-
/**
|
|
13
|
-
* Ref to the DOM node.
|
|
14
|
-
*/
|
|
15
|
-
ref?: ReactRef<HTMLDivElement | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Usually the Card parts, `CardHeader`, `CardBody` and `CardFooter`.
|
|
18
|
-
*/
|
|
19
|
-
children?: ReactNode | ReactNode[];
|
|
20
|
-
/**
|
|
21
|
-
* Whether the card should show a ripple animation on press, this prop is ignored if `disableAnimation` is true or `isPressable` is false.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disableRipple?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Whether the card should allow text selection on press. (only for pressable cards)
|
|
27
|
-
* @default true
|
|
28
|
-
*/
|
|
29
|
-
allowTextSelectionOnPress?: boolean;
|
|
30
|
-
/**
|
|
31
|
-
* The native button click event handler.
|
|
32
|
-
* use `onPress` instead.
|
|
33
|
-
* @deprecated
|
|
34
|
-
*/
|
|
35
|
-
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
36
|
-
/**
|
|
37
|
-
* Classname or List of classes to change the classNames of the element.
|
|
38
|
-
* if `className` is passed, it will be added to the base slot.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* <Card classNames={{
|
|
43
|
-
* base:"base-classes",
|
|
44
|
-
* header: "dot-classes",
|
|
45
|
-
* body: "content-classes",
|
|
46
|
-
* footer: "avatar-classes",
|
|
47
|
-
* }} />
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
classNames?: SlotsToClasses<CardSlots>;
|
|
51
|
-
}
|
|
52
|
-
type UseCardProps = Props & PressEvents & FocusableProps & CardVariantProps;
|
|
53
|
-
type ContextType = {
|
|
54
|
-
slots: CardReturnType;
|
|
55
|
-
classNames?: SlotsToClasses<CardSlots>;
|
|
56
|
-
isDisabled?: CardVariantProps["isDisabled"];
|
|
57
|
-
isFooterBlurred?: CardVariantProps["isFooterBlurred"];
|
|
58
|
-
disableAnimation?: CardVariantProps["disableAnimation"];
|
|
59
|
-
fullWidth?: CardVariantProps["fullWidth"];
|
|
60
|
-
};
|
|
61
|
-
declare function useCard(originalProps: UseCardProps): {
|
|
62
|
-
context: ContextType;
|
|
63
|
-
domRef: react.RefObject<HTMLDivElement>;
|
|
64
|
-
Component: _heroui_system.As<any>;
|
|
65
|
-
classNames: SlotsToClasses<"base" | "body" | "footer" | "header"> | undefined;
|
|
66
|
-
children: ReactNode | ReactNode[];
|
|
67
|
-
isHovered: boolean;
|
|
68
|
-
isPressed: boolean;
|
|
69
|
-
disableAnimation: boolean;
|
|
70
|
-
isPressable: boolean | undefined;
|
|
71
|
-
isHoverable: boolean | undefined;
|
|
72
|
-
disableRipple: boolean;
|
|
73
|
-
handlePress: (e: PressEvent) => void;
|
|
74
|
-
isFocusVisible: boolean;
|
|
75
|
-
getCardProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
|
|
76
|
-
getRippleProps: () => RippleProps;
|
|
77
|
-
};
|
|
78
|
-
type UseCardReturn = ReturnType<typeof useCard>;
|
|
79
|
-
|
|
80
|
-
export { ContextType, Props, UseCardProps, UseCardReturn, useCard };
|