@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/use-card.js
DELETED
|
@@ -1,175 +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/use-card.ts
|
|
22
|
-
var use_card_exports = {};
|
|
23
|
-
__export(use_card_exports, {
|
|
24
|
-
useCard: () => useCard
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(use_card_exports);
|
|
27
|
-
var import_theme = require("@heroui/theme");
|
|
28
|
-
var import_react = require("react");
|
|
29
|
-
var import_utils = require("@react-aria/utils");
|
|
30
|
-
var import_focus = require("@react-aria/focus");
|
|
31
|
-
var import_interactions = require("@react-aria/interactions");
|
|
32
|
-
var import_use_aria_button = require("@heroui/use-aria-button");
|
|
33
|
-
var import_system = require("@heroui/system");
|
|
34
|
-
var import_shared_utils = require("@heroui/shared-utils");
|
|
35
|
-
var import_react_utils = require("@heroui/react-utils");
|
|
36
|
-
var import_react_utils2 = require("@heroui/react-utils");
|
|
37
|
-
var import_ripple = require("@heroui/ripple");
|
|
38
|
-
function useCard(originalProps) {
|
|
39
|
-
var _a, _b, _c, _d;
|
|
40
|
-
const globalContext = (0, import_system.useProviderContext)();
|
|
41
|
-
const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.card.variantKeys);
|
|
42
|
-
const {
|
|
43
|
-
ref,
|
|
44
|
-
as,
|
|
45
|
-
children,
|
|
46
|
-
onClick,
|
|
47
|
-
onPress,
|
|
48
|
-
autoFocus,
|
|
49
|
-
className,
|
|
50
|
-
classNames,
|
|
51
|
-
allowTextSelectionOnPress = true,
|
|
52
|
-
...otherProps
|
|
53
|
-
} = props;
|
|
54
|
-
const domRef = (0, import_react_utils2.useDOMRef)(ref);
|
|
55
|
-
const Component = as || (originalProps.isPressable ? "button" : "div");
|
|
56
|
-
const shouldFilterDOMProps = typeof Component === "string";
|
|
57
|
-
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
|
|
58
|
-
const disableRipple = (_d = (_c = originalProps.disableRipple) != null ? _c : globalContext == null ? void 0 : globalContext.disableRipple) != null ? _d : false;
|
|
59
|
-
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
|
|
60
|
-
const { onClear: onClearRipple, onPress: onRipplePressHandler, ripples } = (0, import_ripple.useRipple)();
|
|
61
|
-
const handlePress = (0, import_react.useCallback)(
|
|
62
|
-
(e) => {
|
|
63
|
-
if (disableRipple || disableAnimation)
|
|
64
|
-
return;
|
|
65
|
-
domRef.current && onRipplePressHandler(e);
|
|
66
|
-
},
|
|
67
|
-
[disableRipple, disableAnimation, domRef, onRipplePressHandler]
|
|
68
|
-
);
|
|
69
|
-
const { buttonProps, isPressed } = (0, import_use_aria_button.useAriaButton)(
|
|
70
|
-
{
|
|
71
|
-
onPress: (0, import_utils.chain)(onPress, handlePress),
|
|
72
|
-
elementType: as,
|
|
73
|
-
isDisabled: !originalProps.isPressable,
|
|
74
|
-
onClick,
|
|
75
|
-
allowTextSelectionOnPress,
|
|
76
|
-
...otherProps
|
|
77
|
-
},
|
|
78
|
-
domRef
|
|
79
|
-
);
|
|
80
|
-
const { hoverProps, isHovered } = (0, import_interactions.useHover)({
|
|
81
|
-
isDisabled: !originalProps.isHoverable,
|
|
82
|
-
...otherProps
|
|
83
|
-
});
|
|
84
|
-
const { isFocusVisible, isFocused, focusProps } = (0, import_focus.useFocusRing)({
|
|
85
|
-
autoFocus
|
|
86
|
-
});
|
|
87
|
-
const slots = (0, import_react.useMemo)(
|
|
88
|
-
() => (0, import_theme.card)({
|
|
89
|
-
...variantProps,
|
|
90
|
-
disableAnimation
|
|
91
|
-
}),
|
|
92
|
-
[(0, import_shared_utils.objectToDeps)(variantProps), disableAnimation]
|
|
93
|
-
);
|
|
94
|
-
const context = (0, import_react.useMemo)(
|
|
95
|
-
() => ({
|
|
96
|
-
slots,
|
|
97
|
-
classNames,
|
|
98
|
-
disableAnimation,
|
|
99
|
-
isDisabled: originalProps.isDisabled,
|
|
100
|
-
isFooterBlurred: originalProps.isFooterBlurred,
|
|
101
|
-
fullWidth: originalProps.fullWidth
|
|
102
|
-
}),
|
|
103
|
-
[
|
|
104
|
-
slots,
|
|
105
|
-
classNames,
|
|
106
|
-
originalProps.isDisabled,
|
|
107
|
-
originalProps.isFooterBlurred,
|
|
108
|
-
disableAnimation,
|
|
109
|
-
originalProps.fullWidth
|
|
110
|
-
]
|
|
111
|
-
);
|
|
112
|
-
const getCardProps = (0, import_react.useCallback)(
|
|
113
|
-
(props2 = {}) => {
|
|
114
|
-
return {
|
|
115
|
-
ref: domRef,
|
|
116
|
-
className: slots.base({ class: baseStyles }),
|
|
117
|
-
tabIndex: originalProps.isPressable ? 0 : -1,
|
|
118
|
-
"data-hover": (0, import_shared_utils.dataAttr)(isHovered),
|
|
119
|
-
"data-pressed": (0, import_shared_utils.dataAttr)(isPressed),
|
|
120
|
-
"data-focus": (0, import_shared_utils.dataAttr)(isFocused),
|
|
121
|
-
"data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
|
|
122
|
-
"data-disabled": (0, import_shared_utils.dataAttr)(originalProps.isDisabled),
|
|
123
|
-
...(0, import_utils.mergeProps)(
|
|
124
|
-
originalProps.isPressable ? { ...buttonProps, ...focusProps, role: "button" } : {},
|
|
125
|
-
originalProps.isHoverable ? hoverProps : {},
|
|
126
|
-
(0, import_react_utils.filterDOMProps)(otherProps, {
|
|
127
|
-
enabled: shouldFilterDOMProps
|
|
128
|
-
}),
|
|
129
|
-
(0, import_react_utils.filterDOMProps)(props2)
|
|
130
|
-
)
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
[
|
|
134
|
-
domRef,
|
|
135
|
-
slots,
|
|
136
|
-
baseStyles,
|
|
137
|
-
shouldFilterDOMProps,
|
|
138
|
-
originalProps.isPressable,
|
|
139
|
-
originalProps.isHoverable,
|
|
140
|
-
originalProps.isDisabled,
|
|
141
|
-
isHovered,
|
|
142
|
-
isPressed,
|
|
143
|
-
isFocusVisible,
|
|
144
|
-
buttonProps,
|
|
145
|
-
focusProps,
|
|
146
|
-
hoverProps,
|
|
147
|
-
otherProps
|
|
148
|
-
]
|
|
149
|
-
);
|
|
150
|
-
const getRippleProps = (0, import_react.useCallback)(
|
|
151
|
-
() => ({ ripples, onClear: onClearRipple }),
|
|
152
|
-
[ripples, onClearRipple]
|
|
153
|
-
);
|
|
154
|
-
return {
|
|
155
|
-
context,
|
|
156
|
-
domRef,
|
|
157
|
-
Component,
|
|
158
|
-
classNames,
|
|
159
|
-
children,
|
|
160
|
-
isHovered,
|
|
161
|
-
isPressed,
|
|
162
|
-
disableAnimation,
|
|
163
|
-
isPressable: originalProps.isPressable,
|
|
164
|
-
isHoverable: originalProps.isHoverable,
|
|
165
|
-
disableRipple,
|
|
166
|
-
handlePress,
|
|
167
|
-
isFocusVisible,
|
|
168
|
-
getCardProps,
|
|
169
|
-
getRippleProps
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
173
|
-
0 && (module.exports = {
|
|
174
|
-
useCard
|
|
175
|
-
});
|