@redis-ui/components 50.0.2 → 51.1.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.
Files changed (42) hide show
  1. package/dist/Gauge/Gauge.cjs +48 -0
  2. package/dist/Gauge/Gauge.d.ts +2 -0
  3. package/dist/Gauge/Gauge.js +48 -0
  4. package/dist/Gauge/Gauge.style.cjs +55 -0
  5. package/dist/Gauge/Gauge.style.d.ts +17 -0
  6. package/dist/Gauge/Gauge.style.js +49 -0
  7. package/dist/Gauge/Gauge.types.d.ts +15 -0
  8. package/dist/Gauge/Gauge.types.js +1 -0
  9. package/dist/Gauge/index.d.ts +2 -0
  10. package/dist/Gauge/index.js +1 -0
  11. package/dist/Layouts/FlexGroup/FlexGroup.style.cjs +1 -1
  12. package/dist/Layouts/FlexGroup/FlexGroup.style.d.ts +2 -2
  13. package/dist/Layouts/FlexGroup/FlexGroup.style.js +1 -1
  14. package/dist/Layouts/FlexGroup/FlexGroup.types.d.ts +8 -4
  15. package/dist/Layouts/FlexItem/FlexItem.cjs +14 -2
  16. package/dist/Layouts/FlexItem/FlexItem.d.ts +1 -1
  17. package/dist/Layouts/FlexItem/FlexItem.js +14 -2
  18. package/dist/Layouts/FlexItem/FlexItem.style.cjs +32 -4
  19. package/dist/Layouts/FlexItem/FlexItem.style.d.ts +20 -1
  20. package/dist/Layouts/FlexItem/FlexItem.style.js +32 -5
  21. package/dist/Layouts/FlexItem/FlexItem.types.d.ts +4 -8
  22. package/dist/Layouts/Grid/Grid.cjs +23 -0
  23. package/dist/Layouts/Grid/Grid.d.ts +2 -0
  24. package/dist/Layouts/Grid/Grid.js +23 -0
  25. package/dist/Layouts/Grid/Grid.style.cjs +36 -0
  26. package/dist/Layouts/Grid/Grid.style.d.ts +19 -0
  27. package/dist/Layouts/Grid/Grid.style.js +34 -0
  28. package/dist/Layouts/Grid/Grid.types.d.ts +38 -0
  29. package/dist/Layouts/Grid/Grid.types.js +1 -0
  30. package/dist/Layouts/index.d.ts +3 -0
  31. package/dist/Layouts/index.js +3 -0
  32. package/dist/Layouts/layout.types.d.ts +43 -0
  33. package/dist/Layouts/layout.types.js +1 -0
  34. package/dist/index.cjs +4 -0
  35. package/dist/index.d.ts +1 -0
  36. package/dist/index.js +3 -1
  37. package/package.json +2 -2
  38. package/skills/redis-ui-components/SKILL.md +3 -1
  39. package/skills/redis-ui-components/references/FlexGroup.md +7 -2
  40. package/skills/redis-ui-components/references/FlexItem.md +22 -3
  41. package/skills/redis-ui-components/references/Gauge.md +91 -0
  42. package/skills/redis-ui-components/references/Grid.md +105 -0
@@ -0,0 +1,48 @@
1
+ const require_Gauge_style = require("./Gauge.style.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ let react = require("react");
4
+ //#region src/Gauge/Gauge.tsx
5
+ var RADIUS = 40;
6
+ var CIRCUMFERENCE = 2 * Math.PI * RADIUS;
7
+ var TRACK_LENGTH = CIRCUMFERENCE * .75;
8
+ var START_ROTATION = 135;
9
+ var Gauge = ({ value, maxValue = 100, variant = "success", size = "M", label, ...restProps }) => {
10
+ const percentage = (0, react.useMemo)(() => maxValue > 0 ? Number(Math.min(100, Math.max(0, value / maxValue * 100)).toFixed(1)) : 0, [value, maxValue]);
11
+ const arcLength = TRACK_LENGTH * percentage / 100;
12
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Gauge_style.Gauge, {
13
+ $size: size,
14
+ ...restProps,
15
+ role: "meter",
16
+ "aria-valuenow": percentage,
17
+ "aria-valuemin": 0,
18
+ "aria-valuemax": 100,
19
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_Gauge_style.Svg, {
20
+ viewBox: "0 0 100 100",
21
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Gauge_style.Track, {
22
+ $variant: variant,
23
+ $size: size,
24
+ cx: "50",
25
+ cy: "50",
26
+ r: RADIUS,
27
+ strokeDasharray: `${TRACK_LENGTH} ${CIRCUMFERENCE}`,
28
+ transform: `rotate(${START_ROTATION} 50 50)`
29
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Gauge_style.Arc, {
30
+ $variant: variant,
31
+ $size: size,
32
+ cx: "50",
33
+ cy: "50",
34
+ r: RADIUS,
35
+ strokeDasharray: `${arcLength} ${CIRCUMFERENCE}`,
36
+ transform: `rotate(${START_ROTATION} 50 50)`
37
+ })]
38
+ }), label != null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Gauge_style.Label, {
39
+ $variant: variant,
40
+ $size: size,
41
+ component: "span",
42
+ variant: "semiBold",
43
+ children: label
44
+ })]
45
+ });
46
+ };
47
+ //#endregion
48
+ exports.Gauge = Gauge;
@@ -0,0 +1,2 @@
1
+ import { GaugeProps } from './Gauge.types';
2
+ export declare const Gauge: ({ value, maxValue, variant, size, label, ...restProps }: GaugeProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { Arc, Gauge as Gauge$1, Label, Svg, Track } from "./Gauge.style.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useMemo } from "react";
4
+ //#region src/Gauge/Gauge.tsx
5
+ var RADIUS = 40;
6
+ var CIRCUMFERENCE = 2 * Math.PI * RADIUS;
7
+ var TRACK_LENGTH = CIRCUMFERENCE * .75;
8
+ var START_ROTATION = 135;
9
+ var Gauge = ({ value, maxValue = 100, variant = "success", size = "M", label, ...restProps }) => {
10
+ const percentage = useMemo(() => maxValue > 0 ? Number(Math.min(100, Math.max(0, value / maxValue * 100)).toFixed(1)) : 0, [value, maxValue]);
11
+ const arcLength = TRACK_LENGTH * percentage / 100;
12
+ return /* @__PURE__ */ jsxs(Gauge$1, {
13
+ $size: size,
14
+ ...restProps,
15
+ role: "meter",
16
+ "aria-valuenow": percentage,
17
+ "aria-valuemin": 0,
18
+ "aria-valuemax": 100,
19
+ children: [/* @__PURE__ */ jsxs(Svg, {
20
+ viewBox: "0 0 100 100",
21
+ children: [/* @__PURE__ */ jsx(Track, {
22
+ $variant: variant,
23
+ $size: size,
24
+ cx: "50",
25
+ cy: "50",
26
+ r: RADIUS,
27
+ strokeDasharray: `${TRACK_LENGTH} ${CIRCUMFERENCE}`,
28
+ transform: `rotate(${START_ROTATION} 50 50)`
29
+ }), /* @__PURE__ */ jsx(Arc, {
30
+ $variant: variant,
31
+ $size: size,
32
+ cx: "50",
33
+ cy: "50",
34
+ r: RADIUS,
35
+ strokeDasharray: `${arcLength} ${CIRCUMFERENCE}`,
36
+ transform: `rotate(${START_ROTATION} 50 50)`
37
+ })]
38
+ }), label != null && /* @__PURE__ */ jsx(Label, {
39
+ $variant: variant,
40
+ $size: size,
41
+ component: "span",
42
+ variant: "semiBold",
43
+ children: label
44
+ })]
45
+ });
46
+ };
47
+ //#endregion
48
+ export { Gauge };
@@ -0,0 +1,55 @@
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_Typography = require("../Typography/Typography.cjs");
3
+ let styled_components = require("styled-components");
4
+ styled_components = require_runtime.__toESM(styled_components, 1);
5
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
6
+ //#region src/Gauge/Gauge.style.ts
7
+ var RING_CENTERLINE_INSET_PERCENTAGE = 10;
8
+ var Gauge = styled_components.default.div.withConfig({
9
+ displayName: "Gaugestyle__Gauge",
10
+ componentId: "RedisUI__sc-165b3be-0"
11
+ })([
12
+ "position:relative;display:inline-flex;width:",
13
+ ";height:",
14
+ ";"
15
+ ], ({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].diameter, ({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].diameter);
16
+ var Svg = styled_components.default.svg.withConfig({
17
+ displayName: "Gaugestyle__Svg",
18
+ componentId: "RedisUI__sc-165b3be-1"
19
+ })(["width:100%;height:100%;"]);
20
+ var ring = styled_components.css`
21
+ fill: none;
22
+ stroke-linecap: round;
23
+ stroke-width: ${({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].strokeWidth};
24
+ `;
25
+ var Track = styled_components.default.circle.withConfig({
26
+ displayName: "Gaugestyle__Track",
27
+ componentId: "RedisUI__sc-165b3be-2"
28
+ })([
29
+ "",
30
+ ";stroke:",
31
+ ";"
32
+ ], ring, ({ $variant }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.variant[$variant].trackColor);
33
+ var Arc = styled_components.default.circle.withConfig({
34
+ displayName: "Gaugestyle__Arc",
35
+ componentId: "RedisUI__sc-165b3be-3"
36
+ })([
37
+ "",
38
+ ";stroke:",
39
+ ";transition:stroke-dasharray 660ms cubic-bezier(0.65,0,0.35,1);@media (prefers-reduced-motion:reduce){transition:none;}"
40
+ ], ring, ({ $variant }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.variant[$variant].arcColor);
41
+ var Label = (0, styled_components.default)(require_Typography.default.Body).withConfig({
42
+ displayName: "Gaugestyle__Label",
43
+ componentId: "RedisUI__sc-165b3be-4"
44
+ })([
45
+ "position:absolute;inset:0 ",
46
+ "%;display:flex;align-items:center;justify-content:center;overflow:hidden;color:",
47
+ ";font-size:",
48
+ ";"
49
+ ], ({ $size }) => RING_CENTERLINE_INSET_PERCENTAGE + Number((0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].strokeWidth) / 2, ({ $variant }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.variant[$variant].textColor, ({ $size }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.gauge.size[$size].fontSize);
50
+ //#endregion
51
+ exports.Arc = Arc;
52
+ exports.Gauge = Gauge;
53
+ exports.Label = Label;
54
+ exports.Svg = Svg;
55
+ exports.Track = Track;
@@ -0,0 +1,17 @@
1
+ import { GaugeSize, GaugeVariant } from './Gauge.types';
2
+ export declare const Gauge: import("styled-components").StyledComponent<"div", any, {
3
+ $size: GaugeSize;
4
+ }, never>;
5
+ export declare const Svg: import("styled-components").StyledComponent<"svg", any, {}, never>;
6
+ export declare const Track: import("styled-components").StyledComponent<"circle", any, {
7
+ $variant: GaugeVariant;
8
+ $size: GaugeSize;
9
+ }, never>;
10
+ export declare const Arc: import("styled-components").StyledComponent<"circle", any, {
11
+ $variant: GaugeVariant;
12
+ $size: GaugeSize;
13
+ }, never>;
14
+ export declare const Label: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").TypographyBodyProps & import("react").RefAttributes<HTMLElement>>, any, {
15
+ $variant: GaugeVariant;
16
+ $size: GaugeSize;
17
+ }, never>;
@@ -0,0 +1,49 @@
1
+ import Typography from "../Typography/Typography.js";
2
+ import _styled, { css } from "styled-components";
3
+ import { useTheme } from "@redis-ui/styles";
4
+ //#region src/Gauge/Gauge.style.ts
5
+ var RING_CENTERLINE_INSET_PERCENTAGE = 10;
6
+ var Gauge = _styled.div.withConfig({
7
+ displayName: "Gaugestyle__Gauge",
8
+ componentId: "RedisUI__sc-165b3be-0"
9
+ })([
10
+ "position:relative;display:inline-flex;width:",
11
+ ";height:",
12
+ ";"
13
+ ], ({ $size }) => useTheme().components.gauge.size[$size].diameter, ({ $size }) => useTheme().components.gauge.size[$size].diameter);
14
+ var Svg = _styled.svg.withConfig({
15
+ displayName: "Gaugestyle__Svg",
16
+ componentId: "RedisUI__sc-165b3be-1"
17
+ })(["width:100%;height:100%;"]);
18
+ var ring = css`
19
+ fill: none;
20
+ stroke-linecap: round;
21
+ stroke-width: ${({ $size }) => useTheme().components.gauge.size[$size].strokeWidth};
22
+ `;
23
+ var Track = _styled.circle.withConfig({
24
+ displayName: "Gaugestyle__Track",
25
+ componentId: "RedisUI__sc-165b3be-2"
26
+ })([
27
+ "",
28
+ ";stroke:",
29
+ ";"
30
+ ], ring, ({ $variant }) => useTheme().components.gauge.variant[$variant].trackColor);
31
+ var Arc = _styled.circle.withConfig({
32
+ displayName: "Gaugestyle__Arc",
33
+ componentId: "RedisUI__sc-165b3be-3"
34
+ })([
35
+ "",
36
+ ";stroke:",
37
+ ";transition:stroke-dasharray 660ms cubic-bezier(0.65,0,0.35,1);@media (prefers-reduced-motion:reduce){transition:none;}"
38
+ ], ring, ({ $variant }) => useTheme().components.gauge.variant[$variant].arcColor);
39
+ var Label = _styled(Typography.Body).withConfig({
40
+ displayName: "Gaugestyle__Label",
41
+ componentId: "RedisUI__sc-165b3be-4"
42
+ })([
43
+ "position:absolute;inset:0 ",
44
+ "%;display:flex;align-items:center;justify-content:center;overflow:hidden;color:",
45
+ ";font-size:",
46
+ ";"
47
+ ], ({ $size }) => RING_CENTERLINE_INSET_PERCENTAGE + Number(useTheme().components.gauge.size[$size].strokeWidth) / 2, ({ $variant }) => useTheme().components.gauge.variant[$variant].textColor, ({ $size }) => useTheme().components.gauge.size[$size].fontSize);
48
+ //#endregion
49
+ export { Arc, Gauge, Label, Svg, Track };
@@ -0,0 +1,15 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export type GaugeVariant = 'success' | 'attention' | 'danger';
3
+ export type GaugeSize = 'S' | 'M' | 'L';
4
+ export interface GaugeProps extends HTMLAttributes<HTMLDivElement> {
5
+ /** Arc fill magnitude; clamped to [0, maxValue]. */
6
+ value: number;
7
+ /** Upper bound used to compute the fill percentage. Default 100. */
8
+ maxValue?: number;
9
+ /** Semantic color state. Default 'success'. */
10
+ variant?: GaugeVariant;
11
+ /** Default 'M'. */
12
+ size?: GaugeSize;
13
+ /** Freeform content rendered in the center of the gauge, e.g. "<2ms". */
14
+ label?: ReactNode;
15
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { Gauge } from './Gauge';
2
+ export type { GaugeProps, GaugeVariant, GaugeSize } from './Gauge.types';
@@ -0,0 +1 @@
1
+ export { Gauge } from './Gauge';
@@ -14,6 +14,6 @@ var FlexGroup = (0, styled_components.default)(require_FlexItem.FlexItem).withCo
14
14
  ";flex-direction:",
15
15
  ";gap:",
16
16
  ";"
17
- ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts.flexGroup.gap[$gap] ?? $gap);
17
+ ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts.gap[$gap] ?? $gap);
18
18
  //#endregion
19
19
  exports.FlexGroup = FlexGroup;
@@ -1,6 +1,6 @@
1
- import { FlexAlign } from '../FlexItem/FlexItem.types';
1
+ import { FlexAlign } from '../layout.types';
2
2
  import { FlexDirection, FlexGroupGapSize, FlexJustify } from './FlexGroup.types';
3
- export declare const FlexGroup: import("styled-components").StyledComponent<({ flex, selfAlign, component, ...restProps }: import("..").FlexItemProps) => import("react/jsx-runtime").JSX.Element, any, {
3
+ export declare const FlexGroup: import("styled-components").StyledComponent<({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }: import("..").FlexItemProps) => import("react/jsx-runtime").JSX.Element, any, {
4
4
  $gap: FlexGroupGapSize;
5
5
  $align: FlexAlign;
6
6
  $justify?: FlexJustify;
@@ -12,6 +12,6 @@ var FlexGroup = _styled(FlexItem).withConfig({
12
12
  ";flex-direction:",
13
13
  ";gap:",
14
14
  ";"
15
- ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => useTheme().components.layouts.flexGroup.gap[$gap] ?? $gap);
15
+ ], ({ $wrap }) => $wrap ? "wrap" : "nowrap", ({ $align }) => $align, ({ $justify }) => $justify, (props) => props["data-flex-direction"], ({ $gap }) => useTheme().components.layouts.gap[$gap] ?? $gap);
16
16
  //#endregion
17
17
  export { FlexGroup };
@@ -1,9 +1,13 @@
1
- import { AnyOtherString } from '../../Helpers';
2
- import { FlexAlign, OwnFlexItemProps, RestFlexItemProps } from '../FlexItem/FlexItem.types';
1
+ import { AnyOtherString, ComposeElementProps } from '../../Helpers';
2
+ import { BoxProps, FlexAlign, FlexFlex } from '../layout.types';
3
3
  export type FlexGroupGapSize = 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL' | 'XXL' | AnyOtherString;
4
4
  export type FlexDirection = 'column' | 'row' | 'column-reverse' | 'row-reverse';
5
5
  export type FlexJustify = 'start' | 'end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
6
- export type OwnFlexGroupProps = OwnFlexItemProps & {
6
+ export type OwnFlexGroupProps = BoxProps & {
7
+ /** Flex grow/shrink/basis value (when this group is itself a flex child) */
8
+ flex?: FlexFlex;
9
+ /** Align self in the parent flex/grid container along its cross axis */
10
+ selfAlign?: FlexAlign;
7
11
  /** Gap size between items. Supports predefined T-Shirt sizes and free text for applying values from theme */
8
12
  gap?: FlexGroupGapSize;
9
13
  /** Flex direction */
@@ -15,5 +19,5 @@ export type OwnFlexGroupProps = OwnFlexItemProps & {
15
19
  /** Whether items should wrap to new lines */
16
20
  wrap?: boolean;
17
21
  };
18
- export type RestFlexGroupProps = RestFlexItemProps;
22
+ export type RestFlexGroupProps = ComposeElementProps;
19
23
  export type FlexGroupProps = OwnFlexGroupProps & RestFlexGroupProps;
@@ -1,11 +1,23 @@
1
1
  const require_FlexItem_style = require("./FlexItem.style.cjs");
2
2
  let react_jsx_runtime = require("react/jsx-runtime");
3
3
  //#region src/Layouts/FlexItem/FlexItem.tsx
4
- var FlexItem = ({ flex, selfAlign, component, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FlexItem_style.FlexItem, {
4
+ var FlexItem = ({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FlexItem_style.FlexItem, {
5
5
  ...restProps,
6
6
  $flex: flex,
7
7
  $selfAlign: selfAlign,
8
- as: component
8
+ as: component,
9
+ $padding: padding,
10
+ $paddingInline: paddingInline,
11
+ $paddingBlock: paddingBlock,
12
+ $margin: margin,
13
+ $marginInline: marginInline,
14
+ $marginBlock: marginBlock,
15
+ $width: width,
16
+ $minWidth: minWidth,
17
+ $maxWidth: maxWidth,
18
+ $height: height,
19
+ $minHeight: minHeight,
20
+ $maxHeight: maxHeight
9
21
  });
10
22
  //#endregion
11
23
  exports.FlexItem = FlexItem;
@@ -1,2 +1,2 @@
1
1
  import { FlexItemProps } from './FlexItem.types';
2
- export declare const FlexItem: ({ flex, selfAlign, component, ...restProps }: FlexItemProps) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const FlexItem: ({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }: FlexItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,23 @@
1
1
  import { FlexItem as FlexItem$1 } from "./FlexItem.style.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  //#region src/Layouts/FlexItem/FlexItem.tsx
4
- var FlexItem = ({ flex, selfAlign, component, ...restProps }) => /* @__PURE__ */ jsx(FlexItem$1, {
4
+ var FlexItem = ({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }) => /* @__PURE__ */ jsx(FlexItem$1, {
5
5
  ...restProps,
6
6
  $flex: flex,
7
7
  $selfAlign: selfAlign,
8
- as: component
8
+ as: component,
9
+ $padding: padding,
10
+ $paddingInline: paddingInline,
11
+ $paddingBlock: paddingBlock,
12
+ $margin: margin,
13
+ $marginInline: marginInline,
14
+ $marginBlock: marginBlock,
15
+ $width: width,
16
+ $minWidth: minWidth,
17
+ $maxWidth: maxWidth,
18
+ $height: height,
19
+ $minHeight: minHeight,
20
+ $maxHeight: maxHeight
9
21
  });
10
22
  //#endregion
11
23
  export { FlexItem };
@@ -1,14 +1,42 @@
1
1
  const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
2
  let styled_components = require("styled-components");
3
3
  styled_components = require_runtime.__toESM(styled_components, 1);
4
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
4
5
  //#region src/Layouts/FlexItem/FlexItem.style.ts
6
+ /**
7
+ * Resolves a spacing prop value against the given theme spacing scale:
8
+ * predefined T-Shirt sizes map to the scale (`gap`/`padding`/`margin` each
9
+ * have their own); any other string (`'auto'`, `'0'`, `'1.6rem'`,
10
+ * `'1.6rem 2.4rem'`, ...) is returned verbatim as CSS.
11
+ */
12
+ var resolveSpacing = (scale, value) => value == null ? void 0 : scale[value] ?? value;
13
+ /** Emits a CSS declaration only when the value is set, so unused props add no CSS. */
14
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
5
15
  var FlexItem = styled_components.default.div.withConfig({
6
16
  displayName: "FlexItemstyle__FlexItem",
7
17
  componentId: "RedisUI__sc-sfog54-0"
8
18
  })([
9
- "flex:",
10
- ";align-self:",
11
- ";"
12
- ], ({ $flex }) => $flex, ({ $selfAlign }) => $selfAlign);
19
+ "",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ " ",
25
+ " ",
26
+ " ",
27
+ " ",
28
+ ""
29
+ ], ({ $flex }) => decl("flex", $flex), ({ $selfAlign }) => decl("align-self", $selfAlign), (props) => {
30
+ const { padding, margin } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts;
31
+ return [
32
+ decl("padding", resolveSpacing(padding, props.$padding)),
33
+ decl("padding-inline", resolveSpacing(padding, props.$paddingInline)),
34
+ decl("padding-block", resolveSpacing(padding, props.$paddingBlock)),
35
+ decl("margin", resolveSpacing(margin, props.$margin)),
36
+ decl("margin-inline", resolveSpacing(margin, props.$marginInline)),
37
+ decl("margin-block", resolveSpacing(margin, props.$marginBlock))
38
+ ].join("");
39
+ }, ({ $width }) => decl("width", $width), ({ $minWidth }) => decl("min-width", $minWidth), ({ $maxWidth }) => decl("max-width", $maxWidth), ({ $height }) => decl("height", $height), ({ $minHeight }) => decl("min-height", $minHeight), ({ $maxHeight }) => decl("max-height", $maxHeight));
13
40
  //#endregion
14
41
  exports.FlexItem = FlexItem;
42
+ exports.resolveSpacing = resolveSpacing;
@@ -1,5 +1,24 @@
1
- import { FlexAlign, FlexFlex } from './FlexItem.types';
1
+ import { FlexAlign, FlexFlex } from '../layout.types';
2
+ /**
3
+ * Resolves a spacing prop value against the given theme spacing scale:
4
+ * predefined T-Shirt sizes map to the scale (`gap`/`padding`/`margin` each
5
+ * have their own); any other string (`'auto'`, `'0'`, `'1.6rem'`,
6
+ * `'1.6rem 2.4rem'`, ...) is returned verbatim as CSS.
7
+ */
8
+ export declare const resolveSpacing: (scale: Record<string, string>, value?: string) => string | undefined;
2
9
  export declare const FlexItem: import("styled-components").StyledComponent<"div", any, {
3
10
  $selfAlign?: FlexAlign;
4
11
  $flex?: FlexFlex;
12
+ $padding?: string;
13
+ $paddingInline?: string;
14
+ $paddingBlock?: string;
15
+ $margin?: string;
16
+ $marginInline?: string;
17
+ $marginBlock?: string;
18
+ $width?: string;
19
+ $minWidth?: string;
20
+ $maxWidth?: string;
21
+ $height?: string;
22
+ $minHeight?: string;
23
+ $maxHeight?: string;
5
24
  }, never>;
@@ -1,12 +1,39 @@
1
1
  import _styled from "styled-components";
2
+ import { useTheme } from "@redis-ui/styles";
2
3
  //#region src/Layouts/FlexItem/FlexItem.style.ts
4
+ /**
5
+ * Resolves a spacing prop value against the given theme spacing scale:
6
+ * predefined T-Shirt sizes map to the scale (`gap`/`padding`/`margin` each
7
+ * have their own); any other string (`'auto'`, `'0'`, `'1.6rem'`,
8
+ * `'1.6rem 2.4rem'`, ...) is returned verbatim as CSS.
9
+ */
10
+ var resolveSpacing = (scale, value) => value == null ? void 0 : scale[value] ?? value;
11
+ /** Emits a CSS declaration only when the value is set, so unused props add no CSS. */
12
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
3
13
  var FlexItem = _styled.div.withConfig({
4
14
  displayName: "FlexItemstyle__FlexItem",
5
15
  componentId: "RedisUI__sc-sfog54-0"
6
16
  })([
7
- "flex:",
8
- ";align-self:",
9
- ";"
10
- ], ({ $flex }) => $flex, ({ $selfAlign }) => $selfAlign);
17
+ "",
18
+ " ",
19
+ " ",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ " ",
25
+ " ",
26
+ ""
27
+ ], ({ $flex }) => decl("flex", $flex), ({ $selfAlign }) => decl("align-self", $selfAlign), (props) => {
28
+ const { padding, margin } = useTheme().components.layouts;
29
+ return [
30
+ decl("padding", resolveSpacing(padding, props.$padding)),
31
+ decl("padding-inline", resolveSpacing(padding, props.$paddingInline)),
32
+ decl("padding-block", resolveSpacing(padding, props.$paddingBlock)),
33
+ decl("margin", resolveSpacing(margin, props.$margin)),
34
+ decl("margin-inline", resolveSpacing(margin, props.$marginInline)),
35
+ decl("margin-block", resolveSpacing(margin, props.$marginBlock))
36
+ ].join("");
37
+ }, ({ $width }) => decl("width", $width), ({ $minWidth }) => decl("min-width", $minWidth), ({ $maxWidth }) => decl("max-width", $maxWidth), ({ $height }) => decl("height", $height), ({ $minHeight }) => decl("min-height", $minHeight), ({ $maxHeight }) => decl("max-height", $maxHeight));
11
38
  //#endregion
12
- export { FlexItem };
39
+ export { FlexItem, resolveSpacing };
@@ -1,14 +1,10 @@
1
- import { ComponentType } from 'react';
2
- import { AnyOtherString, ComposeElementProps } from '../../Helpers';
3
- export type FlexAlign = 'start' | 'end' | 'center' | 'stretch';
4
- export type FlexFlex = 'auto' | 'none' | AnyOtherString;
5
- export type OwnFlexItemProps = {
1
+ import { ComposeElementProps } from '../../Helpers';
2
+ import { BoxProps, FlexAlign, FlexFlex } from '../layout.types';
3
+ export type OwnFlexItemProps = BoxProps & {
6
4
  /** Flex grow/shrink/basis value */
7
5
  flex?: FlexFlex;
8
- /** Align self in parent flex container along the cross axis of the parent flex */
6
+ /** Align self in the parent flex/grid container along its cross axis */
9
7
  selfAlign?: FlexAlign;
10
- /** Use different component with Flex styling, default is `div` */
11
- component?: string | ComponentType;
12
8
  };
13
9
  export type RestFlexItemProps = ComposeElementProps;
14
10
  export type FlexItemProps = OwnFlexItemProps & RestFlexItemProps;
@@ -0,0 +1,23 @@
1
+ const require_Grid_style = require("./Grid.style.cjs");
2
+ let react_jsx_runtime = require("react/jsx-runtime");
3
+ //#region src/Layouts/Grid/Grid.tsx
4
+ var Grid = ({ columns, rows, areas, gap = "S", columnGap, rowGap, align, justify, autoFlow, autoRows, autoColumns, inline, gridColumn, gridRow, gridArea, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Grid_style.Grid, {
5
+ ...restProps,
6
+ $columns: columns,
7
+ $rows: rows,
8
+ $areas: areas,
9
+ $gap: gap,
10
+ $columnGap: columnGap,
11
+ $rowGap: rowGap,
12
+ $align: align,
13
+ $justify: justify,
14
+ $autoFlow: autoFlow,
15
+ $autoRows: autoRows,
16
+ $autoColumns: autoColumns,
17
+ $inline: inline,
18
+ $gridColumn: gridColumn,
19
+ $gridRow: gridRow,
20
+ $gridArea: gridArea
21
+ });
22
+ //#endregion
23
+ exports.Grid = Grid;
@@ -0,0 +1,2 @@
1
+ import { GridProps } from './Grid.types';
2
+ export declare const Grid: ({ columns, rows, areas, gap, columnGap, rowGap, align, justify, autoFlow, autoRows, autoColumns, inline, gridColumn, gridRow, gridArea, ...restProps }: GridProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { Grid as Grid$1 } from "./Grid.style.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/Layouts/Grid/Grid.tsx
4
+ var Grid = ({ columns, rows, areas, gap = "S", columnGap, rowGap, align, justify, autoFlow, autoRows, autoColumns, inline, gridColumn, gridRow, gridArea, ...restProps }) => /* @__PURE__ */ jsx(Grid$1, {
5
+ ...restProps,
6
+ $columns: columns,
7
+ $rows: rows,
8
+ $areas: areas,
9
+ $gap: gap,
10
+ $columnGap: columnGap,
11
+ $rowGap: rowGap,
12
+ $align: align,
13
+ $justify: justify,
14
+ $autoFlow: autoFlow,
15
+ $autoRows: autoRows,
16
+ $autoColumns: autoColumns,
17
+ $inline: inline,
18
+ $gridColumn: gridColumn,
19
+ $gridRow: gridRow,
20
+ $gridArea: gridArea
21
+ });
22
+ //#endregion
23
+ export { Grid };
@@ -0,0 +1,36 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ const require_FlexItem_style = require("../FlexItem/FlexItem.style.cjs");
3
+ const require_FlexItem = require("../FlexItem/FlexItem.cjs");
4
+ let styled_components = require("styled-components");
5
+ styled_components = require_runtime.__toESM(styled_components, 1);
6
+ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
7
+ //#region src/Layouts/Grid/Grid.style.ts
8
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
9
+ var Grid = (0, styled_components.default)(require_FlexItem.FlexItem).withConfig({
10
+ displayName: "Gridstyle__Grid",
11
+ componentId: "RedisUI__sc-g580qm-0"
12
+ })([
13
+ "display:",
14
+ ";",
15
+ " ",
16
+ " ",
17
+ " ",
18
+ " ",
19
+ " ",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ " ",
25
+ " ",
26
+ ""
27
+ ], ({ $inline }) => $inline ? "inline-grid" : "grid", ({ $columns }) => decl("grid-template-columns", $columns), ({ $rows }) => decl("grid-template-rows", $rows), ({ $areas }) => decl("grid-template-areas", $areas), ({ $autoFlow }) => decl("grid-auto-flow", $autoFlow), ({ $autoRows }) => decl("grid-auto-rows", $autoRows), ({ $autoColumns }) => decl("grid-auto-columns", $autoColumns), ({ $align }) => decl("align-items", $align), ({ $justify }) => decl("justify-items", $justify), ({ $gridColumn }) => decl("grid-column", $gridColumn), ({ $gridRow }) => decl("grid-row", $gridRow), ({ $gridArea }) => decl("grid-area", $gridArea), (props) => {
28
+ const gap = (0, _redislabsdev_redis_ui_styles.useTheme)().components.layouts.gap;
29
+ return [
30
+ decl("gap", require_FlexItem_style.resolveSpacing(gap, props.$gap)),
31
+ decl("column-gap", require_FlexItem_style.resolveSpacing(gap, props.$columnGap)),
32
+ decl("row-gap", require_FlexItem_style.resolveSpacing(gap, props.$rowGap))
33
+ ].join("");
34
+ });
35
+ //#endregion
36
+ exports.Grid = Grid;
@@ -0,0 +1,19 @@
1
+ import { FlexAlign, SpacingSize } from '../layout.types';
2
+ import { GridAutoFlow, GridJustifyItems } from './Grid.types';
3
+ export declare const Grid: import("styled-components").StyledComponent<({ flex, selfAlign, component, padding, paddingInline, paddingBlock, margin, marginInline, marginBlock, width, minWidth, maxWidth, height, minHeight, maxHeight, ...restProps }: import("..").FlexItemProps) => import("react/jsx-runtime").JSX.Element, any, {
4
+ $columns?: string;
5
+ $rows?: string;
6
+ $areas?: string;
7
+ $gap?: SpacingSize;
8
+ $columnGap?: SpacingSize;
9
+ $rowGap?: SpacingSize;
10
+ $align?: FlexAlign;
11
+ $justify?: GridJustifyItems;
12
+ $autoFlow?: GridAutoFlow;
13
+ $autoRows?: string;
14
+ $autoColumns?: string;
15
+ $inline?: boolean;
16
+ $gridColumn?: string;
17
+ $gridRow?: string;
18
+ $gridArea?: string;
19
+ }, never>;
@@ -0,0 +1,34 @@
1
+ import { resolveSpacing } from "../FlexItem/FlexItem.style.js";
2
+ import { FlexItem } from "../FlexItem/FlexItem.js";
3
+ import _styled from "styled-components";
4
+ import { useTheme } from "@redis-ui/styles";
5
+ //#region src/Layouts/Grid/Grid.style.ts
6
+ var decl = (property, value) => value == null || value === "" ? "" : `${property}: ${value};`;
7
+ var Grid = _styled(FlexItem).withConfig({
8
+ displayName: "Gridstyle__Grid",
9
+ componentId: "RedisUI__sc-g580qm-0"
10
+ })([
11
+ "display:",
12
+ ";",
13
+ " ",
14
+ " ",
15
+ " ",
16
+ " ",
17
+ " ",
18
+ " ",
19
+ " ",
20
+ " ",
21
+ " ",
22
+ " ",
23
+ " ",
24
+ ""
25
+ ], ({ $inline }) => $inline ? "inline-grid" : "grid", ({ $columns }) => decl("grid-template-columns", $columns), ({ $rows }) => decl("grid-template-rows", $rows), ({ $areas }) => decl("grid-template-areas", $areas), ({ $autoFlow }) => decl("grid-auto-flow", $autoFlow), ({ $autoRows }) => decl("grid-auto-rows", $autoRows), ({ $autoColumns }) => decl("grid-auto-columns", $autoColumns), ({ $align }) => decl("align-items", $align), ({ $justify }) => decl("justify-items", $justify), ({ $gridColumn }) => decl("grid-column", $gridColumn), ({ $gridRow }) => decl("grid-row", $gridRow), ({ $gridArea }) => decl("grid-area", $gridArea), (props) => {
26
+ const gap = useTheme().components.layouts.gap;
27
+ return [
28
+ decl("gap", resolveSpacing(gap, props.$gap)),
29
+ decl("column-gap", resolveSpacing(gap, props.$columnGap)),
30
+ decl("row-gap", resolveSpacing(gap, props.$rowGap))
31
+ ].join("");
32
+ });
33
+ //#endregion
34
+ export { Grid };
@@ -0,0 +1,38 @@
1
+ import { AnyOtherString, ComposeElementProps } from '../../Helpers';
2
+ import { BoxProps, FlexAlign, SpacingSize } from '../layout.types';
3
+ export type GridJustifyItems = 'start' | 'end' | 'center' | 'stretch';
4
+ export type GridAutoFlow = 'row' | 'column' | 'row dense' | 'column dense' | AnyOtherString;
5
+ export type OwnGridProps = BoxProps & {
6
+ /** grid-template-columns, e.g. `'1fr 1fr'`, `'2fr 1fr'`, `'repeat(3, minmax(0, 1fr))'` */
7
+ columns?: string;
8
+ /** grid-template-rows */
9
+ rows?: string;
10
+ /** grid-template-areas */
11
+ areas?: string;
12
+ /** Gap between cells. Predefined T-Shirt sizes map to the theme scale, or free CSS value. */
13
+ gap?: SpacingSize;
14
+ /** Column gap. Overrides `gap` on the inline axis. */
15
+ columnGap?: SpacingSize;
16
+ /** Row gap. Overrides `gap` on the block axis. */
17
+ rowGap?: SpacingSize;
18
+ /** align-items — aligns cell content along the block (column) axis */
19
+ align?: FlexAlign;
20
+ /** justify-items — aligns cell content along the inline (row) axis */
21
+ justify?: GridJustifyItems;
22
+ /** grid-auto-flow */
23
+ autoFlow?: GridAutoFlow;
24
+ /** grid-auto-rows */
25
+ autoRows?: string;
26
+ /** grid-auto-columns */
27
+ autoColumns?: string;
28
+ /** Use `inline-grid` instead of `grid` */
29
+ inline?: boolean;
30
+ /** grid-column placement, for when this Grid is itself a child of another Grid (e.g. `'1 / 3'`, `'span 2'`). */
31
+ gridColumn?: AnyOtherString;
32
+ /** grid-row placement, for when this Grid is itself a child of another Grid. */
33
+ gridRow?: AnyOtherString;
34
+ /** grid-area placement, for when this Grid is itself a child of another Grid. */
35
+ gridArea?: AnyOtherString;
36
+ };
37
+ export type RestGridProps = ComposeElementProps;
38
+ export type GridProps = OwnGridProps & RestGridProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,7 +1,10 @@
1
+ export * from './layout.types';
1
2
  export * from './FlexItem/FlexItem';
2
3
  export * from './FlexItem/FlexItem.types';
3
4
  export * from './FlexGroup/FlexGroup';
4
5
  export * from './FlexGroup/FlexGroup.types';
6
+ export * from './Grid/Grid';
7
+ export * from './Grid/Grid.types';
5
8
  export * from './FlexSplit/FlexSplit';
6
9
  export * from './FlexSplit/FlexSplit.types';
7
10
  export * from './FlexDivider/FlexDivider';
@@ -1,7 +1,10 @@
1
+ export * from './layout.types';
1
2
  export * from './FlexItem/FlexItem';
2
3
  export * from './FlexItem/FlexItem.types';
3
4
  export * from './FlexGroup/FlexGroup';
4
5
  export * from './FlexGroup/FlexGroup.types';
6
+ export * from './Grid/Grid';
7
+ export * from './Grid/Grid.types';
5
8
  export * from './FlexSplit/FlexSplit';
6
9
  export * from './FlexSplit/FlexSplit.types';
7
10
  export * from './FlexDivider/FlexDivider';
@@ -0,0 +1,43 @@
1
+ import { ComponentType } from 'react';
2
+ import { AnyOtherString } from '../Helpers';
3
+ export type FlexAlign = 'start' | 'end' | 'center' | 'stretch' | 'baseline';
4
+ export type FlexFlex = 'auto' | 'none' | AnyOtherString;
5
+ /**
6
+ * Spacing value. Predefined T-Shirt sizes map to the theme spacing scale; any other string is
7
+ * applied verbatim as CSS, so `'auto'`, `'0'`, `'1.6rem'` or `'1.6rem 2.4rem'` are all valid.
8
+ */
9
+ export type SpacingSize = 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL' | 'XXL' | AnyOtherString;
10
+ /** Sizing value, applied verbatim as a CSS dimension, e.g. `'100%'`, `'22rem'`, `'0'`. */
11
+ export type SizingValue = AnyOtherString;
12
+ /**
13
+ * Box-model props relevant to any layout box. Intentionally holds ONLY universal box concerns
14
+ * (element/spacing/sizing) — no flex- or grid-specific props — so no layout mode leaks into another.
15
+ */
16
+ export type BoxProps = {
17
+ /** Use a different element/component with layout styling, default is `div`. */
18
+ component?: string | ComponentType;
19
+ /** Padding on all sides. */
20
+ padding?: SpacingSize;
21
+ /** Inline (left/right) padding. */
22
+ paddingInline?: SpacingSize;
23
+ /** Block (top/bottom) padding. */
24
+ paddingBlock?: SpacingSize;
25
+ /** Margin on all sides. */
26
+ margin?: SpacingSize;
27
+ /** Inline (left/right) margin. */
28
+ marginInline?: SpacingSize;
29
+ /** Block (top/bottom) margin. */
30
+ marginBlock?: SpacingSize;
31
+ /** Width, e.g. `'100%'`, `'22rem'`. */
32
+ width?: SizingValue;
33
+ /** Min width, e.g. `'0'`. */
34
+ minWidth?: SizingValue;
35
+ /** Max width. */
36
+ maxWidth?: SizingValue;
37
+ /** Height, e.g. `'100%'`. */
38
+ height?: SizingValue;
39
+ /** Min height. */
40
+ minHeight?: SizingValue;
41
+ /** Max height. */
42
+ maxHeight?: SizingValue;
43
+ };
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.cjs CHANGED
@@ -73,12 +73,14 @@ const require_CountryFlag = require("./CountryFlag/CountryFlag.cjs");
73
73
  const require_Drawer = require("./Drawer/Drawer.cjs");
74
74
  const require_TreeView = require("./TreeView/TreeView.cjs");
75
75
  const require_Filters = require("./Filters/Filters.cjs");
76
+ const require_Gauge = require("./Gauge/Gauge.cjs");
76
77
  const require_HighlightedIcon_style = require("./HighlightedIcon/HighlightedIcon.style.cjs");
77
78
  const require_HighlightedIcon = require("./HighlightedIcon/HighlightedIcon.cjs");
78
79
  const require_KeyValueList = require("./KeyValueList/KeyValueList.cjs");
79
80
  const require_useKeyValueList = require("./KeyValueList/hooks/useKeyValueList.cjs");
80
81
  const require_FlexItem = require("./Layouts/FlexItem/FlexItem.cjs");
81
82
  const require_FlexGroup = require("./Layouts/FlexGroup/FlexGroup.cjs");
83
+ const require_Grid = require("./Layouts/Grid/Grid.cjs");
82
84
  const require_FlexSplit = require("./Layouts/FlexSplit/FlexSplit.cjs");
83
85
  const require_FlexDivider = require("./Layouts/FlexDivider/FlexDivider.cjs");
84
86
  const require_Tabs = require("./Tabs/Tabs.cjs");
@@ -179,6 +181,8 @@ exports.FlexGroup = require_FlexGroup.FlexGroup;
179
181
  exports.FlexItem = require_FlexItem.FlexItem;
180
182
  exports.FlexSplit = require_FlexSplit.FlexSplit;
181
183
  exports.FormField = require_FormField.default;
184
+ exports.Gauge = require_Gauge.Gauge;
185
+ exports.Grid = require_Grid.Grid;
182
186
  exports.HighlightedIcon = require_HighlightedIcon.default;
183
187
  Object.defineProperty(exports, "HighlightedIconStyles", {
184
188
  enumerable: true,
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from './ChipList';
14
14
  export * from './CountryFlag';
15
15
  export * from './Drawer';
16
16
  export * from './Filters';
17
+ export * from './Gauge';
17
18
  export * from './Helpers';
18
19
  export * from './HighlightedIcon';
19
20
  export * from './Inputs';
package/dist/index.js CHANGED
@@ -73,12 +73,14 @@ import CountryFlag from "./CountryFlag/CountryFlag.js";
73
73
  import Drawer from "./Drawer/Drawer.js";
74
74
  import TreeView from "./TreeView/TreeView.js";
75
75
  import Filters from "./Filters/Filters.js";
76
+ import { Gauge } from "./Gauge/Gauge.js";
76
77
  import { HighlightedIcon_style_exports } from "./HighlightedIcon/HighlightedIcon.style.js";
77
78
  import HighlightedIcon from "./HighlightedIcon/HighlightedIcon.js";
78
79
  import { KeyValueList } from "./KeyValueList/KeyValueList.js";
79
80
  import { useKeyValueList } from "./KeyValueList/hooks/useKeyValueList.js";
80
81
  import { FlexItem } from "./Layouts/FlexItem/FlexItem.js";
81
82
  import { FlexGroup } from "./Layouts/FlexGroup/FlexGroup.js";
83
+ import { Grid } from "./Layouts/Grid/Grid.js";
82
84
  import { FlexSplit } from "./Layouts/FlexSplit/FlexSplit.js";
83
85
  import { FlexDivider } from "./Layouts/FlexDivider/FlexDivider.js";
84
86
  import Tabs from "./Tabs/Tabs.js";
@@ -111,4 +113,4 @@ import { ProgressBar } from "./ProgressBar/ProgressBar.js";
111
113
  import { ProfileIcon_style_exports } from "./ProfileIcon/ProfileIcon.style.js";
112
114
  import ProfileIcon from "./ProfileIcon/ProfileIcon.js";
113
115
  import Slider from "./Slider/Slider.js";
114
- 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, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, 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, combineHandlers, 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 };
116
+ 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, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, 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, combineHandlers, 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": "50.0.2",
4
+ "version": "51.1.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": "^20.0.0",
33
+ "@redis-ui/styles": "^21.0.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"
@@ -31,7 +31,7 @@ import { RedisLogoDarkMinIcon } from '@redis-ui/icons/multicolor';
31
31
 
32
32
  - **Composition**: Many components support a `Compose` pattern for advanced customization (e.g., `Select.Compose`, `Section.Compose`). Check the component reference for compose examples.
33
33
  - **Compound Components**: Some components use `Object.assign` to attach sub-components (e.g., `Button.Icon`, `Modal.Content`, `Tabs.TabBar`). These sub-components share internal React context with their parent, so they must be rendered inside it.
34
- - **Layouts**: Use `FlexGroup` and `FlexItem` for flex layouts instead of raw `div` with inline styles. `FlexGroup` supports `gap`, `direction`, `align`, `justify`, and `wrap` props. See the Layout references.
34
+ - **Layouts**: Use `FlexGroup` and `FlexItem` for flex layouts instead of raw `div` with inline styles. `FlexGroup` supports `gap`, `direction`, `align`, `justify`, and `wrap` props. For 2-D layouts (tracks that line up across both axes) use `Grid`. All layout boxes share `padding`/`margin`/sizing props via `BoxProps`. See the Layout references.
35
35
  - **Typography**: Use `Typography.Heading`, `Typography.Body`, and `Typography.Code` for all text rendering instead of raw `<span>`, `<p>`, or `<h1>`–`<h6>` elements. See the [Typography](./references/Typography.md) reference.
36
36
  - **Theming**: Components use `styled-components` and access theme via `useTheme()` from `@redis-ui/styles`.
37
37
  - **ForwardRef**: Most components support `ref` forwarding.
@@ -77,6 +77,7 @@ Always check the relevant component reference before using a component. The refe
77
77
 
78
78
  - [FlexGroup](./references/FlexGroup.md)
79
79
  - [FlexItem](./references/FlexItem.md)
80
+ - [Grid](./references/Grid.md)
80
81
  - [FlexDivider](./references/FlexDivider.md)
81
82
  - [FlexSplit](./references/FlexSplit.md)
82
83
  - [Card](./references/Card.md)
@@ -110,6 +111,7 @@ Always check the relevant component reference before using a component. The refe
110
111
  - [Link](./references/Link.md)
111
112
  - [Loader](./references/Loader.md)
112
113
  - [ProgressBar](./references/ProgressBar.md)
114
+ - [Gauge](./references/Gauge.md)
113
115
  - [Typography](./references/Typography.md)
114
116
  - [MoreInfoIcon](./references/MoreInfoIcon.md)
115
117
  - [HighlightedIcon](./references/HighlightedIcon.md)
@@ -12,13 +12,16 @@ import { FlexGroup } from '@redis-ui/components';
12
12
  |------|------|---------|-------------|
13
13
  | gap | `'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL' \| string` | `'S'` | Gap size between items. Supports predefined T-Shirt sizes and free text for applying values from theme |
14
14
  | direction | `'column' \| 'row' \| 'column-reverse' \| 'row-reverse'` | `'row'` | Flex direction |
15
- | align | `'start' \| 'end' \| 'center' \| 'stretch'` | `'center'` (row) / `'stretch'` (column) | Align items along the cross axis |
15
+ | align | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | `'center'` (row) / `'stretch'` (column) | Align items along the cross axis |
16
16
  | justify | `'start' \| 'end' \| 'center' \| 'space-between' \| 'space-around' \| 'space-evenly'` | - | Justify content along the main axis |
17
17
  | wrap | `boolean` | - | Whether items should wrap to new lines |
18
18
  | flex | `'auto' \| 'none' \| string` | - | Flex grow/shrink/basis value (inherited from FlexItem) |
19
- | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch'` | - | Align self in parent flex container along the cross axis (inherited from FlexItem) |
19
+ | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | - | Align self in parent flex/grid container along the cross axis (inherited from FlexItem) |
20
20
  | component | `string \| ComponentType` | `'div'` | Use a different component with Flex styling (inherited from FlexItem) |
21
21
 
22
+ ### Box props (shared `BoxProps`, inherited from FlexItem)
23
+ Spacing props (`padding`, `paddingInline`, `paddingBlock`, `margin`, `marginInline`, `marginBlock`) accept T-Shirt sizes (`'XXS'`–`'XXL'`) that map to the theme spacing scale, or any raw CSS string (e.g. `'0'`, `'1.6rem'`, `'1.6rem 2.4rem'`). Sizing props (`width`, `minWidth`, `maxWidth`, `height`, `minHeight`, `maxHeight`) accept any CSS dimension string (e.g. `'100%'`, `'22rem'`). See the [FlexItem](./FlexItem.md) reference for the full box-prop table.
24
+
22
25
  The component also extends all native HTML element props via `ComposeElementProps`.
23
26
 
24
27
  ## Examples
@@ -145,5 +148,7 @@ import { CopyIcon, MenuIcon, MarketplaceIcon } from '@redis-ui/icons';
145
148
  - `FlexGroup` extends `FlexItem` internally, so it can be used both as a flex container and as a flex child within a parent `FlexGroup`.
146
149
  - The default `align` value is context-aware: it defaults to `'center'` for row directions and `'stretch'` for column directions.
147
150
  - The `gap` prop accepts T-Shirt sizes (`XXS` through `XXL`) which map to theme-defined spacing values. You can also pass arbitrary CSS values or theme token strings.
151
+ - `FlexGroup` inherits the shared box props (`padding*`, `margin*`, `width`/`height` sizing) from `FlexItem`, so prefer `padding="M"` over inline `style` for theme-consistent spacing.
152
+ - `align` and `selfAlign` accept `'baseline'` (maps to CSS `baseline`) in addition to `start`/`end`/`center`/`stretch`.
148
153
  - Use `FlexGroup` together with `FlexItem`, `FlexSplit`, and `FlexDivider` to compose complex layouts. `FlexSplit` pushes subsequent items to the end, and `FlexDivider` adds visual separators.
149
154
  - The `flex` prop (inherited from `FlexItem`) is useful for controlling how a `FlexGroup` sizes within a parent flex container (e.g., `flex="1"` for equal distribution, `flex="none"` for intrinsic sizing).
@@ -1,6 +1,6 @@
1
1
  # FlexItem
2
2
 
3
- A flex item wrapper component that controls individual item behavior within a flex container. It supports custom flex grow/shrink/basis values, self-alignment, and rendering as a different HTML element or component.
3
+ A flex item wrapper component that controls individual item behavior within a flex container. It supports custom flex grow/shrink/basis values, self-alignment, box-model props (padding/margin/sizing), and rendering as a different HTML element or component.
4
4
 
5
5
  ## Import
6
6
  ```tsx
@@ -11,10 +11,28 @@ import { FlexItem } from '@redis-ui/components';
11
11
  | Prop | Type | Default | Description |
12
12
  |------|------|---------|-------------|
13
13
  | flex | `'auto' \| 'none' \| string` | - | Flex grow/shrink/basis value |
14
- | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch'` | - | Align self in parent flex container along the cross axis of the parent flex |
14
+ | selfAlign | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | - | Align self in parent flex/grid container along the cross axis (maps to CSS `align-self`) |
15
15
  | component | `string \| ComponentType` | `'div'` | Use different component with Flex styling |
16
16
  | children | `ReactNode` | - | Content to render inside the flex item |
17
17
 
18
+ ### Box props (shared `BoxProps`)
19
+ Spacing props accept T-Shirt sizes (`'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL'`) that map to the theme spacing scale, or any raw CSS string (e.g. `'auto'`, `'0'`, `'1.6rem'`, `'1.6rem 2.4rem'`). Sizing props accept any CSS dimension string (e.g. `'100%'`, `'22rem'`, `'0'`).
20
+
21
+ | Prop | Type | Default | Description |
22
+ |------|------|---------|-------------|
23
+ | padding | `SpacingSize` | - | Padding on all sides |
24
+ | paddingInline | `SpacingSize` | - | Inline (left/right) padding |
25
+ | paddingBlock | `SpacingSize` | - | Block (top/bottom) padding |
26
+ | margin | `SpacingSize` | - | Margin on all sides |
27
+ | marginInline | `SpacingSize` | - | Inline (left/right) margin |
28
+ | marginBlock | `SpacingSize` | - | Block (top/bottom) margin |
29
+ | width | `string` | - | Width, e.g. `'100%'`, `'22rem'` |
30
+ | minWidth | `string` | - | Min width, e.g. `'0'` |
31
+ | maxWidth | `string` | - | Max width |
32
+ | height | `string` | - | Height, e.g. `'100%'` |
33
+ | minHeight | `string` | - | Min height |
34
+ | maxHeight | `string` | - | Max height |
35
+
18
36
  The component also extends all native `HTMLAttributes<HTMLElement>` props (excluding `children` and `content`).
19
37
 
20
38
  ## Examples
@@ -22,7 +40,7 @@ The component also extends all native `HTMLAttributes<HTMLElement>` props (exclu
22
40
  ### Toolbar with FlexItem
23
41
  > From the FlexGroup "Complex Layout: Toolbar" story. Demonstrates using `FlexItem` to wrap a search input within a flex toolbar layout.
24
42
  ```tsx
25
- import { FlexGroup, FlexItem, FlexSplit, FlexDivider, SearchInput, Button, Badge, IconButton } from '@redis-ui/components';
43
+ import { FlexGroup, FlexItem, FlexSplit, FlexDivider, SearchInput, Button, Badge, IconButton, Typography } from '@redis-ui/components';
26
44
  import { MarketplaceIcon, CopyIcon, MenuIcon } from '@redis-ui/icons';
27
45
 
28
46
  <FlexGroup gap="XL" style={{ paddingInline: '2.4rem', minHeight: '5.6rem' }}>
@@ -54,5 +72,6 @@ import { MarketplaceIcon, CopyIcon, MenuIcon } from '@redis-ui/icons';
54
72
  - `FlexItem` is typically used inside a `FlexGroup` to control individual item sizing and alignment.
55
73
  - The `flex` prop maps directly to the CSS `flex` shorthand property (e.g., `"auto"`, `"none"`, `"1"`, `"0 0 200px"`).
56
74
  - The `selfAlign` prop maps to the CSS `align-self` property, allowing an item to override the parent's `align` setting.
75
+ - The box props (`padding*`, `margin*`, and sizing) are the shared `BoxProps`, so `FlexItem`, `FlexGroup`, and `Grid` all accept them. Prefer T-Shirt spacing tokens over raw values so spacing stays theme-consistent.
57
76
  - Use the `component` prop to render as a different element (e.g., `component="span"`) or a custom React component while preserving flex item styling.
58
77
  - `FlexItem` renders as a `div` by default.
@@ -0,0 +1,91 @@
1
+ # Gauge
2
+
3
+ A compact radial (arc) gauge with a freeform center label and semantic color variants. The arc fills proportionally to `value`; the color is chosen independently via `variant`, so the consumer decides which threshold a value maps to.
4
+
5
+ ## Import
6
+
7
+ ```tsx
8
+ import { Gauge } from '@redis-ui/components';
9
+ ```
10
+
11
+ ## Props
12
+
13
+ | Prop | Type | Default | Description |
14
+ |------|------|---------|-------------|
15
+ | value | `number` | required | Arc fill magnitude; clamped to `[0, maxValue]` |
16
+ | maxValue | `number` | `100` | Upper bound used to compute the fill percentage (`(value / maxValue) * 100`) |
17
+ | variant | `'success' \| 'attention' \| 'danger'` | `'success'` | Semantic color state |
18
+ | size | `'S' \| 'M' \| 'L'` | `'M'` | Gauge size |
19
+ | label | `ReactNode` | - | Freeform content rendered in the center, e.g. `<2ms`. Omit to render just the arc |
20
+
21
+ > `Gauge` also accepts standard `HTMLAttributes<HTMLDivElement>` (e.g. `className`, `style`, `id`), which are spread onto the root element. The meter semantics are managed internally: `Gauge` always renders `role="meter"` on a fixed percentage scale — `aria-valuemin` is always `0` and `aria-valuemax` is always `100`, regardless of `maxValue`, and `aria-valuenow` is the fill percentage derived from `value`/`maxValue` rather than the raw `value`. Only these four attributes are fixed — a caller-supplied `role`, `aria-valuenow`, `aria-valuemin`, or `aria-valuemax` is ignored so the accessible value cannot drift from the rendered arc. Other attributes, including `aria-valuetext`, still pass through to the root element.
22
+
23
+ ## Examples
24
+
25
+ ### Playground
26
+
27
+ ```tsx
28
+ import { Gauge } from '@redis-ui/components';
29
+
30
+ <Gauge value={65} variant="success" size="M" label="<2ms" />
31
+ ```
32
+
33
+ ### Variants
34
+
35
+ > Use the `variant` prop to apply a semantic color scheme. The arc fill (`value`) and the color (`variant`) are independent — the consumer decides which threshold a value belongs to.
36
+
37
+ ```tsx
38
+ import { Gauge } from '@redis-ui/components';
39
+
40
+ <>
41
+ <Gauge variant="success" value={20} label="<2ms" />
42
+ <Gauge variant="attention" value={55} label="8ms" />
43
+ <Gauge variant="danger" value={90} label="20ms" />
44
+ </>
45
+ ```
46
+
47
+ ### Sizes
48
+
49
+ > Named sizes are driven by theme tokens.
50
+
51
+ ```tsx
52
+ import { Gauge } from '@redis-ui/components';
53
+
54
+ <>
55
+ <Gauge size="S" value={65} label="<2ms" />
56
+ <Gauge size="M" value={65} label="<2ms" />
57
+ <Gauge size="L" value={65} label="<2ms" />
58
+ </>
59
+ ```
60
+
61
+ ### FillLevels
62
+
63
+ > The arc fills proportionally to `value` (clamped to `[0, maxValue]`).
64
+
65
+ ```tsx
66
+ import { Gauge } from '@redis-ui/components';
67
+
68
+ <>
69
+ <Gauge value={0} label="0" />
70
+ <Gauge value={50} label="50" />
71
+ <Gauge value={100} label="100" />
72
+ </>
73
+ ```
74
+
75
+ ### WithoutLabel
76
+
77
+ > The center `label` is freeform. Omit it to render just the arc.
78
+
79
+ ```tsx
80
+ import { Gauge } from '@redis-ui/components';
81
+
82
+ <Gauge value={65} variant="success" />
83
+ ```
84
+
85
+ ## Notes
86
+
87
+ - The fill percentage is `(value / maxValue) * 100`, clamped to `[0, 100]` and rounded to one decimal place. A `maxValue` of `0` or less yields a `0%` fill.
88
+ - The arc fill (`value`) and the color (`variant`) are independent — pick the `variant` that matches the threshold the value falls into.
89
+ - The center `label` is freeform and optional; omit it to render just the arc.
90
+ - The gauge is exposed as `role="meter"` on a fixed percentage scale. `aria-valuenow` is the fill percentage — i.e. `value / maxValue * 100`, so it reflects both props — while the bounds stay fixed: `aria-valuemin` is always `0` and `aria-valuemax` is always `100`, never `maxValue`. With `value={130} maxValue={200}` the meter reports `aria-valuenow="65"`, not `130`. Pass `aria-valuetext` when a screen reader should announce the underlying quantity (e.g. `"130 of 200 GB"`) instead of the bare percentage.
91
+ - `role` and those three `aria-value*` attributes are fixed and cannot be overridden. Other attributes, including `aria-valuetext`, pass through to the root element.
@@ -0,0 +1,105 @@
1
+ # Grid
2
+
3
+ A layout container that arranges its children using CSS grid — a 2-D layout with rows and columns, template areas, and cell spanning. Use it when flexbox (`FlexGroup`) is not enough, i.e. when tracks must line up across both axes. Like the other layouts it extends the shared box props (padding/margin/sizing) via `FlexItem`, and it can position itself inside a parent `Grid` via `gridColumn`/`gridRow`/`gridArea`.
4
+
5
+ ## Import
6
+ ```tsx
7
+ import { Grid } from '@redis-ui/components';
8
+ ```
9
+
10
+ ## Props
11
+ | Prop | Type | Default | Description |
12
+ |------|------|---------|-------------|
13
+ | columns | `string` | - | `grid-template-columns`, e.g. `'1fr 1fr'`, `'2fr 1fr'`, `'repeat(3, minmax(0, 1fr))'` |
14
+ | rows | `string` | - | `grid-template-rows` |
15
+ | areas | `string` | - | `grid-template-areas`, e.g. `'"header header" "sidebar main"'` |
16
+ | gap | `'XXS' \| 'XS' \| 'S' \| 'M' \| 'L' \| 'XL' \| 'XXL' \| string` | `'S'` | Gap between cells. T-Shirt sizes map to the theme scale, or any raw CSS value |
17
+ | columnGap | `SpacingSize` | - | Column gap. Overrides `gap` on the inline axis |
18
+ | rowGap | `SpacingSize` | - | Row gap. Overrides `gap` on the block axis |
19
+ | align | `'start' \| 'end' \| 'center' \| 'stretch' \| 'baseline'` | - | `align-items` — aligns cell content along the block (column) axis |
20
+ | justify | `'start' \| 'end' \| 'center' \| 'stretch'` | - | `justify-items` — aligns cell content along the inline (row) axis |
21
+ | autoFlow | `'row' \| 'column' \| 'row dense' \| 'column dense' \| string` | - | `grid-auto-flow` |
22
+ | autoRows | `string` | - | `grid-auto-rows` |
23
+ | autoColumns | `string` | - | `grid-auto-columns` |
24
+ | inline | `boolean` | - | Use `inline-grid` instead of `grid` |
25
+ | gridColumn | `string` | - | `grid-column` placement, for when this `Grid` is itself a child of another `Grid` (e.g. `'1 / 3'`, `'span 2'`) |
26
+ | gridRow | `string` | - | `grid-row` placement, for when this `Grid` is nested inside another `Grid` |
27
+ | gridArea | `string` | - | `grid-area` placement, for when this `Grid` is nested inside another `Grid` |
28
+
29
+ ### Box props (shared `BoxProps`, inherited from FlexItem)
30
+ `Grid` also accepts the shared box props — `padding`, `paddingInline`, `paddingBlock`, `margin`, `marginInline`, `marginBlock` (T-Shirt sizes or raw CSS), `width`/`minWidth`/`maxWidth`/`height`/`minHeight`/`maxHeight` (CSS dimension strings), and `component`. See the [FlexItem](./FlexItem.md) reference for the full box-prop table.
31
+
32
+ The component also extends all native HTML element props via `ComposeElementProps`.
33
+
34
+ ## Examples
35
+
36
+ ### Playground
37
+ ```tsx
38
+ import { Grid } from '@redis-ui/components';
39
+
40
+ <Grid columns="repeat(3, minmax(0, 1fr))" gap="L">
41
+ <div>a</div>
42
+ <div>b</div>
43
+ <div>c</div>
44
+ <div>d</div>
45
+ <div>e</div>
46
+ </Grid>
47
+ ```
48
+
49
+ ### Usage
50
+ ```tsx
51
+ import { Grid } from '@redis-ui/components';
52
+
53
+ <Grid columns="2fr 1fr" rows="auto 1fr" gap="M" align="stretch" justify="start" width="100%">
54
+ {children}
55
+ </Grid>
56
+ ```
57
+
58
+ ### Child placement
59
+ > A `Grid` owns the tracks (`columns` / `rows` / `areas`). When a `Grid` is nested inside another `Grid`, it positions itself with its own `gridColumn` / `gridRow` / `gridArea` props. Non-`Grid` children position themselves via the CSS `grid-*` properties in `style`.
60
+ ```tsx
61
+ import { Grid, Typography } from '@redis-ui/components';
62
+
63
+ // gridColumn — span across columns
64
+ <Grid columns="repeat(3, 1fr)" gap="M">
65
+ <Grid gridColumn="1 / 3" justify="center" align="center" padding="M">
66
+ <Typography.Body>gridColumn="1 / 3"</Typography.Body>
67
+ </Grid>
68
+ <Grid justify="center" align="center" padding="M">
69
+ <Typography.Body>(auto)</Typography.Body>
70
+ </Grid>
71
+ <Grid gridColumn="span 2" justify="center" align="center" padding="M">
72
+ <Typography.Body>gridColumn="span 2"</Typography.Body>
73
+ </Grid>
74
+ </Grid>
75
+
76
+ // gridRow — span across rows (first cell spans both rows)
77
+ <Grid columns="repeat(3, 1fr)" rows="repeat(2, 4rem)" gap="M">
78
+ <Grid gridRow="1 / 3" justify="center" align="center" padding="M">
79
+ <Typography.Body>gridRow="1 / 3"</Typography.Body>
80
+ </Grid>
81
+ <Grid justify="center" align="center" padding="M">
82
+ <Typography.Body>(auto)</Typography.Body>
83
+ </Grid>
84
+ </Grid>
85
+
86
+ // gridArea — named template areas
87
+ <Grid areas={'"header header" "sidebar main"'} columns="10rem 1fr" rows="auto 6rem" gap="M">
88
+ <Grid gridArea="header" justify="center" align="center" padding="M">
89
+ <Typography.Body>header</Typography.Body>
90
+ </Grid>
91
+ <Grid gridArea="sidebar" justify="center" align="center" padding="M">
92
+ <Typography.Body>sidebar</Typography.Body>
93
+ </Grid>
94
+ <Grid gridArea="main" justify="center" align="center" padding="M">
95
+ <Typography.Body>main</Typography.Body>
96
+ </Grid>
97
+ </Grid>
98
+ ```
99
+
100
+ ## Notes
101
+ - Reach for `Grid` only when a 2-D layout is needed (tracks aligned across both axes). For 1-D rows/columns, prefer `FlexGroup`.
102
+ - `gap` defaults to `'S'`. Use `columnGap` / `rowGap` to override the gap on a single axis.
103
+ - `align` maps to `align-items` (block axis) and `justify` maps to `justify-items` (inline axis) — these align content *within* each cell.
104
+ - `gridColumn` / `gridRow` / `gridArea` are for placing a nested `Grid` inside a parent `Grid`. A non-`Grid` child sets these via CSS in its own `style`.
105
+ - Like `FlexGroup`, `Grid` is built on `FlexItem`, so it inherits the shared box props (`padding*`, `margin*`, sizing) and the `component` prop.