@redis-ui/components 51.18.1 → 51.19.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.
@@ -1,9 +1,10 @@
1
1
  const require_Card_style = require("./Card.style.cjs");
2
2
  let react_jsx_runtime = require("react/jsx-runtime");
3
3
  //#region src/Card/Card.tsx
4
- var Card = ({ variant = "primary", border = true, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Card_style.Card, {
4
+ var Card = ({ variant = "primary", border = true, hoverEffect = "none", ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Card_style.Card, {
5
5
  $variant: variant,
6
6
  $border: border,
7
+ $hoverEffect: hoverEffect,
7
8
  ...props
8
9
  });
9
10
  //#endregion
@@ -1,3 +1,3 @@
1
1
  import { CardProps } from './Card.types';
2
- declare const Card: ({ variant, border, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
2
+ declare const Card: ({ variant, border, hoverEffect, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
3
3
  export default Card;
package/dist/Card/Card.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { Card as Card$1 } from "./Card.style.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/Card/Card.tsx
4
- var Card = ({ variant = "primary", border = true, ...props }) => /* @__PURE__ */ jsx(Card$1, {
4
+ var Card = ({ variant = "primary", border = true, hoverEffect = "none", ...props }) => /* @__PURE__ */ jsx(Card$1, {
5
5
  $variant: variant,
6
6
  $border: border,
7
+ $hoverEffect: hoverEffect,
7
8
  ...props
8
9
  });
9
10
  //#endregion
@@ -5,6 +5,57 @@ styled_components = require_runtime.__toESM(styled_components, 1);
5
5
  let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
6
6
  //#region src/Card/Card.style.ts
7
7
  var useCardTheme = () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.card;
8
+ var transition = (...props) => styled_components.css`
9
+ transition: ${props.map((prop) => `${prop} 200ms ease-in-out`).join(", ")};
10
+
11
+ @media (prefers-reduced-motion: reduce) {
12
+ transition: none;
13
+ }
14
+ `;
15
+ var hoverEffects = {
16
+ none: void 0,
17
+ sunset: styled_components.css`
18
+ position: relative;
19
+ isolation: isolate;
20
+
21
+ &::before {
22
+ content: '';
23
+ position: absolute;
24
+ inset: 0;
25
+ z-index: -1;
26
+ border-radius: inherit;
27
+ pointer-events: none;
28
+ background: radial-gradient(
29
+ 70% 90% at 78% 8%,
30
+ ${() => useCardTheme().hover?.sunsetColor},
31
+ transparent 70%
32
+ );
33
+ opacity: 0;
34
+ ${transition("opacity")};
35
+ }
36
+
37
+ &:hover::before {
38
+ opacity: 1;
39
+ }
40
+ `,
41
+ lift: styled_components.css`
42
+ cursor: pointer;
43
+ ${transition("border-color", "transform")};
44
+
45
+ &:hover {
46
+ border-color: ${() => useCardTheme().hover?.borderColor};
47
+ transform: translateY(-0.2rem);
48
+ }
49
+ `,
50
+ highlight: styled_components.css`
51
+ ${transition("background", "border-color")};
52
+
53
+ &:hover {
54
+ background: ${() => useCardTheme().hover?.bgColor};
55
+ border-color: ${() => useCardTheme().hover?.borderColor};
56
+ }
57
+ `
58
+ };
8
59
  var Card = styled_components.default.div.withConfig({
9
60
  displayName: "Cardstyle__Card",
10
61
  componentId: "RedisUI__sc-1r2rqs7-0"
@@ -15,7 +66,8 @@ var Card = styled_components.default.div.withConfig({
15
66
  ";background:",
16
67
  ";border:",
17
68
  ";border-radius:",
18
- ";box-shadow:none;"
19
- ], ({ width }) => require_css_utils.calcSize(width, useCardTheme().width), ({ height }) => require_css_utils.calcSize(height, useCardTheme().height), () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space200, ({ $variant }) => useCardTheme().variants[$variant].bgColor, ({ $border, $variant }) => $border ? `${(0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space010} solid ${useCardTheme().variants[$variant].borderColor}` : 0, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space100);
69
+ ";box-shadow:none;",
70
+ ";"
71
+ ], ({ width }) => require_css_utils.calcSize(width, useCardTheme().width), ({ height }) => require_css_utils.calcSize(height, useCardTheme().height), () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space200, ({ $variant }) => useCardTheme().variants[$variant].bgColor, ({ $border, $variant }) => $border ? `${(0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space010} solid ${useCardTheme().variants[$variant].borderColor}` : 0, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space100, ({ $hoverEffect }) => hoverEffects[$hoverEffect]);
20
72
  //#endregion
21
73
  exports.Card = Card;
@@ -1,7 +1,8 @@
1
- import type { CardVariant } from '@redis-ui/styles';
1
+ import type { CardHoverEffect, CardVariant } from '@redis-ui/styles';
2
2
  export declare const Card: import("styled-components").StyledComponent<"div", any, {
3
3
  width?: string | number;
4
4
  height?: string | number;
5
5
  $variant: CardVariant;
6
6
  $border: boolean;
7
+ $hoverEffect: CardHoverEffect;
7
8
  }, never>;
@@ -1,8 +1,59 @@
1
1
  import { calcSize } from "../Helpers/css.utils.js";
2
- import _styled from "styled-components";
2
+ import _styled, { css } from "styled-components";
3
3
  import { useTheme } from "@redis-ui/styles";
4
4
  //#region src/Card/Card.style.ts
5
5
  var useCardTheme = () => useTheme().components.card;
6
+ var transition = (...props) => css`
7
+ transition: ${props.map((prop) => `${prop} 200ms ease-in-out`).join(", ")};
8
+
9
+ @media (prefers-reduced-motion: reduce) {
10
+ transition: none;
11
+ }
12
+ `;
13
+ var hoverEffects = {
14
+ none: void 0,
15
+ sunset: css`
16
+ position: relative;
17
+ isolation: isolate;
18
+
19
+ &::before {
20
+ content: '';
21
+ position: absolute;
22
+ inset: 0;
23
+ z-index: -1;
24
+ border-radius: inherit;
25
+ pointer-events: none;
26
+ background: radial-gradient(
27
+ 70% 90% at 78% 8%,
28
+ ${() => useCardTheme().hover?.sunsetColor},
29
+ transparent 70%
30
+ );
31
+ opacity: 0;
32
+ ${transition("opacity")};
33
+ }
34
+
35
+ &:hover::before {
36
+ opacity: 1;
37
+ }
38
+ `,
39
+ lift: css`
40
+ cursor: pointer;
41
+ ${transition("border-color", "transform")};
42
+
43
+ &:hover {
44
+ border-color: ${() => useCardTheme().hover?.borderColor};
45
+ transform: translateY(-0.2rem);
46
+ }
47
+ `,
48
+ highlight: css`
49
+ ${transition("background", "border-color")};
50
+
51
+ &:hover {
52
+ background: ${() => useCardTheme().hover?.bgColor};
53
+ border-color: ${() => useCardTheme().hover?.borderColor};
54
+ }
55
+ `
56
+ };
6
57
  var Card = _styled.div.withConfig({
7
58
  displayName: "Cardstyle__Card",
8
59
  componentId: "RedisUI__sc-1r2rqs7-0"
@@ -13,7 +64,8 @@ var Card = _styled.div.withConfig({
13
64
  ";background:",
14
65
  ";border:",
15
66
  ";border-radius:",
16
- ";box-shadow:none;"
17
- ], ({ width }) => calcSize(width, useCardTheme().width), ({ height }) => calcSize(height, useCardTheme().height), () => useTheme().core.space.space200, ({ $variant }) => useCardTheme().variants[$variant].bgColor, ({ $border, $variant }) => $border ? `${useTheme().core.space.space010} solid ${useCardTheme().variants[$variant].borderColor}` : 0, () => useTheme().core.space.space100);
67
+ ";box-shadow:none;",
68
+ ";"
69
+ ], ({ width }) => calcSize(width, useCardTheme().width), ({ height }) => calcSize(height, useCardTheme().height), () => useTheme().core.space.space200, ({ $variant }) => useCardTheme().variants[$variant].bgColor, ({ $border, $variant }) => $border ? `${useTheme().core.space.space010} solid ${useCardTheme().variants[$variant].borderColor}` : 0, () => useTheme().core.space.space100, ({ $hoverEffect }) => hoverEffects[$hoverEffect]);
18
70
  //#endregion
19
71
  export { Card };
@@ -1,9 +1,10 @@
1
- import type { CardVariant } from '@redis-ui/styles';
2
- export { cardVariants } from '@redis-ui/styles';
3
- export type { CardVariant };
1
+ import type { CardHoverEffect, CardVariant } from '@redis-ui/styles';
2
+ export { cardHoverEffects, cardVariants } from '@redis-ui/styles';
3
+ export type { CardHoverEffect, CardVariant };
4
4
  export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
5
5
  width?: number | string;
6
6
  height?: number | string;
7
7
  variant?: CardVariant;
8
8
  border?: boolean;
9
+ hoverEffect?: CardHoverEffect;
9
10
  }
@@ -1,2 +1,2 @@
1
- import { cardVariants } from "@redis-ui/styles";
2
- export { cardVariants };
1
+ import { cardHoverEffects, cardVariants } from "@redis-ui/styles";
2
+ export { cardHoverEffects, cardVariants };
@@ -1,3 +1,3 @@
1
1
  export { default as Card } from './Card';
2
- export { cardVariants } from './Card.types';
3
- export type { CardProps, CardVariant } from './Card.types';
2
+ export { cardHoverEffects, cardVariants } from './Card.types';
3
+ export type { CardHoverEffect, CardProps, CardVariant } from './Card.types';
@@ -1,2 +1,2 @@
1
1
  export { default as Card } from './Card';
2
- export { cardVariants } from './Card.types';
2
+ export { cardHoverEffects, cardVariants } from './Card.types';
package/dist/index.cjs CHANGED
@@ -271,6 +271,12 @@ exports.bannerVariants = require_Banner_types.bannerVariants;
271
271
  exports.buttonSizes = require_Button_types.buttonSizes;
272
272
  exports.buttonVariants = require_Button_types.buttonVariants;
273
273
  exports.buttonWithIconVariants = require_ActionIconButton_types.buttonWithIconVariants;
274
+ Object.defineProperty(exports, "cardHoverEffects", {
275
+ enumerable: true,
276
+ get: function() {
277
+ return _redislabsdev_redis_ui_styles.cardHoverEffects;
278
+ }
279
+ });
274
280
  Object.defineProperty(exports, "cardVariants", {
275
281
  enumerable: true,
276
282
  get: function() {
package/dist/index.js CHANGED
@@ -65,7 +65,7 @@ import BoxSelectionGroup from "./BoxSelectionGroup/BoxSelectionGroup.js";
65
65
  import MultiBoxSelectionGroup from "./BoxSelectionGroup/MultiBoxSelectionGroup.js";
66
66
  import ButtonGroup from "./ButtonGroup/ButtonGroup.js";
67
67
  import Card from "./Card/Card.js";
68
- import { cardVariants } from "./Card/Card.types.js";
68
+ import { cardHoverEffects, cardVariants } from "./Card/Card.types.js";
69
69
  import Checkbox from "./Checkbox/Checkbox.js";
70
70
  import { ChipContainer } from "./Chip/components/Compose/Compose.style.js";
71
71
  import Chip from "./Chip/Chip.js";
@@ -117,4 +117,4 @@ import { ProgressBar } from "./ProgressBar/ProgressBar.js";
117
117
  import { ProfileIcon_style_exports } from "./ProfileIcon/ProfileIcon.style.js";
118
118
  import ProfileIcon from "./ProfileIcon/ProfileIcon.js";
119
119
  import Slider from "./Slider/Slider.js";
120
- export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, CodeBlock, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, Hero, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardVariants, childrenToString, codeBlockOverflows, codeBlockSizes, combineHandlers, copyToClipboardButtonVariants, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
120
+ export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, CodeBlock, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, Hero, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardHoverEffects, cardVariants, childrenToString, codeBlockOverflows, codeBlockSizes, combineHandlers, copyToClipboardButtonVariants, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redis-ui/components",
3
3
  "license": "UNLICENSED",
4
- "version": "51.18.1",
4
+ "version": "51.19.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "repository": "git@github.com:redislabsdev/redis-ui.git",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@redis-ui/icons": "^8.0.0 || ^9.0.0 || ^10.0.0",
33
- "@redis-ui/styles": "^21.25.0",
33
+ "@redis-ui/styles": "^21.26.0",
34
34
  "react": "^18.0.0 || ^19.0.0",
35
35
  "react-dom": "^18.0.0 || ^19.0.0",
36
36
  "styled-components": "^5.0.0"
@@ -1,6 +1,6 @@
1
1
  # Card
2
2
 
3
- A simple container card with configurable width, height, surface variant, and border. It renders as a flex column with default 1.6rem padding.
3
+ A simple container card with configurable width, height, surface variant, border, and hover effect. It renders as a flex column with default 1.6rem padding.
4
4
 
5
5
  ## Import
6
6
 
@@ -16,11 +16,16 @@ import { Card } from '@redis-ui/components';
16
16
  | height | `number \| string` | `fit-content` | Overrides the card height |
17
17
  | variant | `CardVariant` | `primary` | Controls the card surface color |
18
18
  | border | `boolean` | `true` | Shows a variant-matched border and keeps shadow disabled |
19
+ | hoverEffect | `CardHoverEffect` | `none` | Hover style that matches what the card does |
19
20
 
20
21
  The component also extends all native `React.HTMLAttributes<HTMLDivElement>` props.
21
22
 
22
23
  `CardVariant` is one of `primary`, `secondary`, `informative`, `success`, `notice`, `attention`, `danger`, or `upsell`.
23
24
 
25
+ `CardHoverEffect` is one of `none`, `sunset`, `lift`, or `highlight`.
26
+
27
+ Exported values and types: `cardVariants`, `cardHoverEffects`, `CardProps`, `CardVariant`, `CardHoverEffect`.
28
+
24
29
  ## Examples
25
30
 
26
31
  ### Basic usage
@@ -47,6 +52,28 @@ import { Card, cardVariants } from '@redis-ui/components';
47
52
  </>
48
53
  ```
49
54
 
55
+ ### Hover effects
56
+
57
+ > Pick the effect by what the card does.
58
+
59
+ ```tsx
60
+ import { Button, Card } from '@redis-ui/components';
61
+
62
+ <>
63
+ {/* Static card: a glow fades in, the card does not move */}
64
+ <Card hoverEffect="sunset">Content</Card>
65
+
66
+ {/* The whole card is the click target: the border darkens and the card lifts */}
67
+ <Card hoverEffect="lift" role="button" tabIndex={0} onClick={open}>Content</Card>
68
+
69
+ {/* The card holds a CTA: the surface and border change */}
70
+ <Card hoverEffect="highlight">
71
+ Content
72
+ <Button>Create</Button>
73
+ </Card>
74
+ </>
75
+ ```
76
+
50
77
  ## Notes
51
78
 
52
79
  - If `width` is not provided, the card defaults to `100%`.
@@ -55,3 +82,6 @@ import { Card, cardVariants } from '@redis-ui/components';
55
82
  - If `border` is not provided, the card renders with a variant-matched border and without shadow.
56
83
  - Use `border={false}` to render the card without border.
57
84
  - The component forwards standard `div` attributes through `React.HTMLAttributes<HTMLDivElement>`.
85
+ - If `hoverEffect` is not provided, the card has no hover style.
86
+ - Hover colors come from the theme and are tuned for the `primary` and `secondary` variants.
87
+ - `lift` only styles the card. Make it keyboard reachable with `role`, `tabIndex`, and key handlers, or render the action as a link or button inside.