@redis-ui/components 51.8.1 → 51.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Stepper/Stepper.context.d.ts +2 -0
- package/dist/Stepper/Stepper.d.ts +1 -1
- package/dist/Stepper/components/Compose/Compose.cjs +5 -3
- package/dist/Stepper/components/Compose/Compose.d.ts +1 -1
- package/dist/Stepper/components/Compose/Compose.js +5 -3
- package/dist/Stepper/components/Compose/Compose.style.cjs +25 -1
- package/dist/Stepper/components/Compose/Compose.style.d.ts +1 -0
- package/dist/Stepper/components/Compose/Compose.style.js +26 -3
- package/dist/Stepper/components/Compose/Compose.types.d.ts +2 -0
- package/dist/Stepper/components/Step/components/Compose/Compose.style.cjs +3 -1
- package/dist/Stepper/components/Step/components/Compose/Compose.style.js +3 -1
- package/dist/Stepper/components/Step/components/Icon/Icon.cjs +4 -2
- package/dist/Stepper/components/Step/components/Icon/Icon.js +4 -2
- package/dist/Stepper/components/Step/components/Icon/Icon.style.cjs +4 -1
- package/dist/Stepper/components/Step/components/Icon/Icon.style.js +4 -1
- package/dist/Stepper/components/Step/components/Label/Label.style.cjs +8 -2
- package/dist/Stepper/components/Step/components/Label/Label.style.js +8 -2
- package/dist/Stepper/components/Step/components/Separator/Separator.style.cjs +5 -2
- package/dist/Stepper/components/Step/components/Separator/Separator.style.js +5 -2
- package/package.json +2 -2
- package/skills/redis-ui-components/references/Stepper.md +19 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { StepperVariant } from './components/Compose/Compose.types';
|
|
1
2
|
export type StepperContextType = {
|
|
2
3
|
registerStep: (stepId: string) => void;
|
|
3
4
|
unregisterStep: (stepId: string) => void;
|
|
4
5
|
getStepIndex: (stepId: string) => number;
|
|
5
6
|
collectStepOrder: (stepId: string) => void;
|
|
6
7
|
currentStep: number;
|
|
8
|
+
variant: StepperVariant;
|
|
7
9
|
onStepChange?: (stepIndex: number) => void;
|
|
8
10
|
getIsStepInteractive: (stepIndex: number) => boolean;
|
|
9
11
|
};
|
|
@@ -7,7 +7,7 @@ declare const Stepper: (({ steps, ...restProps }: StepperProps) => import("react
|
|
|
7
7
|
Separator: ({ state, ...restProps }: import("./components/Step/components/Separator/Separator.types").SeparatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
useStepContext: () => import(".").StepperStepContextType;
|
|
9
9
|
};
|
|
10
|
-
Compose: (({ currentStep, getIsStepInteractive, onStepChange, onKeyDown, ...restProps }: import("./components/Compose/Compose.types").StepperComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
10
|
+
Compose: (({ currentStep, variant, getIsStepInteractive, onStepChange, onKeyDown, ...restProps }: import("./components/Compose/Compose.types").StepperComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
11
11
|
Step: (({ children, ...restProps }: import(".").StepperStepProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
12
12
|
Compose: ({ onClick, ...restProps }: import("./components/Step/components/Compose/Compose.types").ComposeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
13
|
Icon: ({ children, ...restProps }: import("./components/Step/components/Icon/Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ const require_useStepIndexing = require("../../hooks/useStepIndexing.cjs");
|
|
|
6
6
|
const require_useStepperFocusing = require("../../hooks/useStepperFocusing.cjs");
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
8
|
//#region src/Stepper/components/Compose/Compose.tsx
|
|
9
|
-
var StepperCompose = Object.assign(({ currentStep = -1, getIsStepInteractive, onStepChange, onKeyDown, ...restProps }) => {
|
|
9
|
+
var StepperCompose = Object.assign(({ currentStep = -1, variant = "default", getIsStepInteractive, onStepChange, onKeyDown, ...restProps }) => {
|
|
10
10
|
const stepIndexingContext = require_useStepIndexing.useStepIndexing();
|
|
11
11
|
const focusingProps = require_useStepperFocusing.useStepperFocusing({ isInteractive: !!onStepChange });
|
|
12
12
|
const { context: interactivityContext, props: interactivityProps } = require_useStepperInteractive.useStepperInteractive({
|
|
@@ -20,12 +20,14 @@ var StepperCompose = Object.assign(({ currentStep = -1, getIsStepInteractive, on
|
|
|
20
20
|
value: {
|
|
21
21
|
...stepIndexingContext,
|
|
22
22
|
...interactivityContext,
|
|
23
|
-
currentStep
|
|
23
|
+
currentStep,
|
|
24
|
+
variant
|
|
24
25
|
},
|
|
25
26
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Compose_style.StepperCompose, {
|
|
26
27
|
...focusingProps,
|
|
27
28
|
...interactivityProps,
|
|
28
|
-
...restProps
|
|
29
|
+
...restProps,
|
|
30
|
+
"data-variant": variant
|
|
29
31
|
})
|
|
30
32
|
});
|
|
31
33
|
}, { Step: require_Step.default });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StepperComposeProps } from './Compose.types';
|
|
2
|
-
declare const StepperCompose: (({ currentStep, getIsStepInteractive, onStepChange, onKeyDown, ...restProps }: StepperComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
2
|
+
declare const StepperCompose: (({ currentStep, variant, getIsStepInteractive, onStepChange, onKeyDown, ...restProps }: StepperComposeProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
3
|
Step: (({ children, ...restProps }: import("../..").StepperStepProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
4
|
Compose: ({ onClick, ...restProps }: import("../Step/components/Compose/Compose.types").ComposeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
5
5
|
Icon: ({ children, ...restProps }: import("../Step/components/Icon/Icon.types").IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { useStepIndexing } from "../../hooks/useStepIndexing.js";
|
|
|
6
6
|
import { useStepperFocusing } from "../../hooks/useStepperFocusing.js";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
//#region src/Stepper/components/Compose/Compose.tsx
|
|
9
|
-
var StepperCompose = Object.assign(({ currentStep = -1, getIsStepInteractive, onStepChange, onKeyDown, ...restProps }) => {
|
|
9
|
+
var StepperCompose = Object.assign(({ currentStep = -1, variant = "default", getIsStepInteractive, onStepChange, onKeyDown, ...restProps }) => {
|
|
10
10
|
const stepIndexingContext = useStepIndexing();
|
|
11
11
|
const focusingProps = useStepperFocusing({ isInteractive: !!onStepChange });
|
|
12
12
|
const { context: interactivityContext, props: interactivityProps } = useStepperInteractive({
|
|
@@ -20,12 +20,14 @@ var StepperCompose = Object.assign(({ currentStep = -1, getIsStepInteractive, on
|
|
|
20
20
|
value: {
|
|
21
21
|
...stepIndexingContext,
|
|
22
22
|
...interactivityContext,
|
|
23
|
-
currentStep
|
|
23
|
+
currentStep,
|
|
24
|
+
variant
|
|
24
25
|
},
|
|
25
26
|
children: /* @__PURE__ */ jsx(StepperCompose$1, {
|
|
26
27
|
...focusingProps,
|
|
27
28
|
...interactivityProps,
|
|
28
|
-
...restProps
|
|
29
|
+
...restProps,
|
|
30
|
+
"data-variant": variant
|
|
29
31
|
})
|
|
30
32
|
});
|
|
31
33
|
}, { Step });
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_Step_types = require("../Step/Step.types.cjs");
|
|
2
3
|
let styled_components = require("styled-components");
|
|
3
4
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
4
5
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -6,6 +7,29 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
|
6
7
|
var StepperCompose = styled_components.default.div.withConfig({
|
|
7
8
|
displayName: "Composestyle__StepperCompose",
|
|
8
9
|
componentId: "RedisUI__sc-ey8bn4-0"
|
|
9
|
-
})([
|
|
10
|
+
})([
|
|
11
|
+
"display:flex;gap:",
|
|
12
|
+
";align-items:center;&[data-variant='compact']{",
|
|
13
|
+
"}"
|
|
14
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.gap, () => {
|
|
15
|
+
const { compact } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper;
|
|
16
|
+
return styled_components.css`
|
|
17
|
+
gap: ${compact.gap};
|
|
18
|
+
font-family: ${compact.fontFamily};
|
|
19
|
+
font-size: ${compact.fontSize};
|
|
20
|
+
letter-spacing: ${compact.letterSpacing};
|
|
21
|
+
text-transform: ${compact.textTransform};
|
|
22
|
+
`;
|
|
23
|
+
});
|
|
24
|
+
var useCompactStateStyle = () => {
|
|
25
|
+
const { states } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.compact;
|
|
26
|
+
return Object.values(require_Step_types.StepperStepState).map((state) => styled_components.css`
|
|
27
|
+
${StepperCompose}[data-variant='compact'] &[data-state='${state}'] {
|
|
28
|
+
color: ${states[state].textColor};
|
|
29
|
+
font-weight: ${states[state].fontWeight};
|
|
30
|
+
}
|
|
31
|
+
`);
|
|
32
|
+
};
|
|
10
33
|
//#endregion
|
|
11
34
|
exports.StepperCompose = StepperCompose;
|
|
35
|
+
exports.useCompactStateStyle = useCompactStateStyle;
|
|
@@ -1,9 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { StepperStepState } from "../Step/Step.types.js";
|
|
2
|
+
import _styled, { css } from "styled-components";
|
|
2
3
|
import { useTheme } from "@redis-ui/styles";
|
|
3
4
|
//#region src/Stepper/components/Compose/Compose.style.ts
|
|
4
5
|
var StepperCompose = _styled.div.withConfig({
|
|
5
6
|
displayName: "Composestyle__StepperCompose",
|
|
6
7
|
componentId: "RedisUI__sc-ey8bn4-0"
|
|
7
|
-
})([
|
|
8
|
+
})([
|
|
9
|
+
"display:flex;gap:",
|
|
10
|
+
";align-items:center;&[data-variant='compact']{",
|
|
11
|
+
"}"
|
|
12
|
+
], () => useTheme().components.stepper.gap, () => {
|
|
13
|
+
const { compact } = useTheme().components.stepper;
|
|
14
|
+
return css`
|
|
15
|
+
gap: ${compact.gap};
|
|
16
|
+
font-family: ${compact.fontFamily};
|
|
17
|
+
font-size: ${compact.fontSize};
|
|
18
|
+
letter-spacing: ${compact.letterSpacing};
|
|
19
|
+
text-transform: ${compact.textTransform};
|
|
20
|
+
`;
|
|
21
|
+
});
|
|
22
|
+
var useCompactStateStyle = () => {
|
|
23
|
+
const { states } = useTheme().components.stepper.compact;
|
|
24
|
+
return Object.values(StepperStepState).map((state) => css`
|
|
25
|
+
${StepperCompose}[data-variant='compact'] &[data-state='${state}'] {
|
|
26
|
+
color: ${states[state].textColor};
|
|
27
|
+
font-weight: ${states[state].fontWeight};
|
|
28
|
+
}
|
|
29
|
+
`);
|
|
30
|
+
};
|
|
8
31
|
//#endregion
|
|
9
|
-
export { StepperCompose };
|
|
32
|
+
export { StepperCompose, useCompactStateStyle };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ComposeElementProps } from '../../../Helpers';
|
|
2
|
+
export type StepperVariant = 'default' | 'compact';
|
|
2
3
|
export interface StepperComposeProps extends ComposeElementProps {
|
|
4
|
+
variant?: StepperVariant;
|
|
3
5
|
currentStep?: number;
|
|
4
6
|
getIsStepInteractive?: (stepIndex: number) => boolean;
|
|
5
7
|
onStepChange?: (stepIndex: number) => void;
|
|
@@ -10,8 +10,10 @@ var StepCompose = styled_components.default.div.withConfig({
|
|
|
10
10
|
})([
|
|
11
11
|
"display:flex;align-items:center;justify-content:left;gap:",
|
|
12
12
|
";flex-shrink:0;",
|
|
13
|
+
"[data-variant='compact'] &{gap:",
|
|
14
|
+
";}",
|
|
13
15
|
":not(.no-focus-visible):focus-visible &[aria-selected=true]{",
|
|
14
16
|
"}&[role='tab']:not([aria-disabled='true']){cursor:pointer;}"
|
|
15
|
-
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step.gap, require_Compose_style.StepperCompose, (0, _redislabsdev_redis_ui_styles.getFocusStyleProperties)());
|
|
17
|
+
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step.gap, require_Compose_style.StepperCompose, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.compact.stepGap, require_Compose_style.StepperCompose, (0, _redislabsdev_redis_ui_styles.getFocusStyleProperties)());
|
|
16
18
|
//#endregion
|
|
17
19
|
exports.StepCompose = StepCompose;
|
|
@@ -8,8 +8,10 @@ var StepCompose = _styled.div.withConfig({
|
|
|
8
8
|
})([
|
|
9
9
|
"display:flex;align-items:center;justify-content:left;gap:",
|
|
10
10
|
";flex-shrink:0;",
|
|
11
|
+
"[data-variant='compact'] &{gap:",
|
|
12
|
+
";}",
|
|
11
13
|
":not(.no-focus-visible):focus-visible &[aria-selected=true]{",
|
|
12
14
|
"}&[role='tab']:not([aria-disabled='true']){cursor:pointer;}"
|
|
13
|
-
], () => useTheme().components.stepper.step.gap, StepperCompose, getFocusStyleProperties());
|
|
15
|
+
], () => useTheme().components.stepper.step.gap, StepperCompose, () => useTheme().components.stepper.compact.stepGap, StepperCompose, getFocusStyleProperties());
|
|
14
16
|
//#endregion
|
|
15
17
|
export { StepCompose };
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
const require_Typography = require("../../../../../Typography/Typography.cjs");
|
|
2
2
|
const require_Step_context = require("../../Step.context.cjs");
|
|
3
|
+
const require_Stepper_context = require("../../../../Stepper.context.cjs");
|
|
3
4
|
const require_Step_types = require("../../Step.types.cjs");
|
|
4
5
|
const require_Icon_style = require("./Icon.style.cjs");
|
|
5
6
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
6
7
|
//#region src/Stepper/components/Step/components/Icon/Icon.tsx
|
|
7
8
|
var Icon = ({ children, ...restProps }) => {
|
|
8
9
|
const { index, state } = require_Step_context.useStepContext();
|
|
10
|
+
const isCompact = require_Stepper_context.useStepperContext().variant === "compact";
|
|
9
11
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon_style.Container, {
|
|
10
12
|
...restProps,
|
|
11
13
|
"data-state": state,
|
|
12
14
|
"aria-hidden": true,
|
|
13
|
-
children: state === require_Step_types.StepperStepState.COMPLETED ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon_style.IconCheck, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.default.Body, {
|
|
15
|
+
children: state === require_Step_types.StepperStepState.COMPLETED && !isCompact ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icon_style.IconCheck, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.default.Body, {
|
|
14
16
|
size: "S",
|
|
15
17
|
component: "div",
|
|
16
|
-
children: children || index + 1
|
|
18
|
+
children: !isCompact && children || index + 1
|
|
17
19
|
})
|
|
18
20
|
});
|
|
19
21
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import Typography from "../../../../../Typography/Typography.js";
|
|
2
2
|
import { useStepContext } from "../../Step.context.js";
|
|
3
|
+
import { useStepperContext } from "../../../../Stepper.context.js";
|
|
3
4
|
import { StepperStepState } from "../../Step.types.js";
|
|
4
5
|
import { Container, IconCheck } from "./Icon.style.js";
|
|
5
6
|
import { jsx } from "react/jsx-runtime";
|
|
6
7
|
//#region src/Stepper/components/Step/components/Icon/Icon.tsx
|
|
7
8
|
var Icon = ({ children, ...restProps }) => {
|
|
8
9
|
const { index, state } = useStepContext();
|
|
10
|
+
const isCompact = useStepperContext().variant === "compact";
|
|
9
11
|
return /* @__PURE__ */ jsx(Container, {
|
|
10
12
|
...restProps,
|
|
11
13
|
"data-state": state,
|
|
12
14
|
"aria-hidden": true,
|
|
13
|
-
children: state === StepperStepState.COMPLETED ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(Typography.Body, {
|
|
15
|
+
children: state === StepperStepState.COMPLETED && !isCompact ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(Typography.Body, {
|
|
14
16
|
size: "S",
|
|
15
17
|
component: "div",
|
|
16
|
-
children: children || index + 1
|
|
18
|
+
children: !isCompact && children || index + 1
|
|
17
19
|
})
|
|
18
20
|
});
|
|
19
21
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_Step_types = require("../../Step.types.cjs");
|
|
3
|
+
const require_Compose_style = require("../../../Compose/Compose.style.cjs");
|
|
3
4
|
let styled_components = require("styled-components");
|
|
4
5
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
5
6
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -12,6 +13,8 @@ var Container = styled_components.default.div.withConfig({
|
|
|
12
13
|
"display:flex;align-items:center;justify-content:center;flex:none;line-height:0;transition:all 0.3s ease;@media (prefers-reduced-motion:reduce){transition:none;}width:",
|
|
13
14
|
";height:",
|
|
14
15
|
";",
|
|
16
|
+
" ",
|
|
17
|
+
"[data-variant='compact'] &&{width:auto;height:auto;padding:0;border-radius:0;background-color:transparent;line-height:inherit;> *{font-family:inherit;font-size:inherit;}}",
|
|
15
18
|
""
|
|
16
19
|
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step.indicator.size, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step.indicator.size, () => {
|
|
17
20
|
const { states } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step;
|
|
@@ -26,7 +29,7 @@ var Container = styled_components.default.div.withConfig({
|
|
|
26
29
|
}
|
|
27
30
|
`;
|
|
28
31
|
});
|
|
29
|
-
});
|
|
32
|
+
}, require_Compose_style.StepperCompose, require_Compose_style.useCompactStateStyle);
|
|
30
33
|
var IconCheck = (0, styled_components.default)(_redislabsdev_redis_ui_icons.CheckBoldIcon).withConfig({
|
|
31
34
|
displayName: "Iconstyle__IconCheck",
|
|
32
35
|
componentId: "RedisUI__sc-1ojkwgp-1"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StepperStepState } from "../../Step.types.js";
|
|
2
|
+
import { StepperCompose, useCompactStateStyle } from "../../../Compose/Compose.style.js";
|
|
2
3
|
import _styled, { css } from "styled-components";
|
|
3
4
|
import { useTheme } from "@redis-ui/styles";
|
|
4
5
|
import { CheckBoldIcon } from "@redis-ui/icons";
|
|
@@ -10,6 +11,8 @@ var Container = _styled.div.withConfig({
|
|
|
10
11
|
"display:flex;align-items:center;justify-content:center;flex:none;line-height:0;transition:all 0.3s ease;@media (prefers-reduced-motion:reduce){transition:none;}width:",
|
|
11
12
|
";height:",
|
|
12
13
|
";",
|
|
14
|
+
" ",
|
|
15
|
+
"[data-variant='compact'] &&{width:auto;height:auto;padding:0;border-radius:0;background-color:transparent;line-height:inherit;> *{font-family:inherit;font-size:inherit;}}",
|
|
13
16
|
""
|
|
14
17
|
], () => useTheme().components.stepper.step.indicator.size, () => useTheme().components.stepper.step.indicator.size, () => {
|
|
15
18
|
const { states } = useTheme().components.stepper.step;
|
|
@@ -24,7 +27,7 @@ var Container = _styled.div.withConfig({
|
|
|
24
27
|
}
|
|
25
28
|
`;
|
|
26
29
|
});
|
|
27
|
-
});
|
|
30
|
+
}, StepperCompose, useCompactStateStyle);
|
|
28
31
|
var IconCheck = _styled(CheckBoldIcon).withConfig({
|
|
29
32
|
displayName: "Iconstyle__IconCheck",
|
|
30
33
|
componentId: "RedisUI__sc-1ojkwgp-1"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_Typography = require("../../../../../Typography/Typography.cjs");
|
|
3
3
|
const require_Step_types = require("../../Step.types.cjs");
|
|
4
|
+
const require_Compose_style = require("../../../Compose/Compose.style.cjs");
|
|
4
5
|
let styled_components = require("styled-components");
|
|
5
6
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
6
7
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -8,7 +9,12 @@ let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
|
8
9
|
var StepLabel = (0, styled_components.default)(require_Typography.default.Body).withConfig({
|
|
9
10
|
displayName: "Labelstyle__StepLabel",
|
|
10
11
|
componentId: "RedisUI__sc-dclu3d-0"
|
|
11
|
-
})([
|
|
12
|
+
})([
|
|
13
|
+
"display:flex;align-items:center;",
|
|
14
|
+
" ",
|
|
15
|
+
"[data-variant='compact'] &&{font-family:inherit;font-size:inherit;letter-spacing:inherit;}",
|
|
16
|
+
""
|
|
17
|
+
], () => {
|
|
12
18
|
const { states } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step;
|
|
13
19
|
return Object.values(require_Step_types.StepperStepState).map((state) => {
|
|
14
20
|
const theme = states[state].label;
|
|
@@ -20,6 +26,6 @@ var StepLabel = (0, styled_components.default)(require_Typography.default.Body).
|
|
|
20
26
|
}
|
|
21
27
|
`;
|
|
22
28
|
});
|
|
23
|
-
});
|
|
29
|
+
}, require_Compose_style.StepperCompose, require_Compose_style.useCompactStateStyle);
|
|
24
30
|
//#endregion
|
|
25
31
|
exports.StepLabel = StepLabel;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import Typography from "../../../../../Typography/Typography.js";
|
|
2
2
|
import { StepperStepState } from "../../Step.types.js";
|
|
3
|
+
import { StepperCompose, useCompactStateStyle } from "../../../Compose/Compose.style.js";
|
|
3
4
|
import _styled, { css } from "styled-components";
|
|
4
5
|
import { useTheme } from "@redis-ui/styles";
|
|
5
6
|
//#region src/Stepper/components/Step/components/Label/Label.style.ts
|
|
6
7
|
var StepLabel = _styled(Typography.Body).withConfig({
|
|
7
8
|
displayName: "Labelstyle__StepLabel",
|
|
8
9
|
componentId: "RedisUI__sc-dclu3d-0"
|
|
9
|
-
})([
|
|
10
|
+
})([
|
|
11
|
+
"display:flex;align-items:center;",
|
|
12
|
+
" ",
|
|
13
|
+
"[data-variant='compact'] &&{font-family:inherit;font-size:inherit;letter-spacing:inherit;}",
|
|
14
|
+
""
|
|
15
|
+
], () => {
|
|
10
16
|
const { states } = useTheme().components.stepper.step;
|
|
11
17
|
return Object.values(StepperStepState).map((state) => {
|
|
12
18
|
const theme = states[state].label;
|
|
@@ -18,6 +24,6 @@ var StepLabel = _styled(Typography.Body).withConfig({
|
|
|
18
24
|
}
|
|
19
25
|
`;
|
|
20
26
|
});
|
|
21
|
-
});
|
|
27
|
+
}, StepperCompose, useCompactStateStyle);
|
|
22
28
|
//#endregion
|
|
23
29
|
export { StepLabel };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../../../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_Step_types = require("../../Step.types.cjs");
|
|
3
|
+
const require_Compose_style = require("../../../Compose/Compose.style.cjs");
|
|
3
4
|
let styled_components = require("styled-components");
|
|
4
5
|
styled_components = require_runtime.__toESM(styled_components, 1);
|
|
5
6
|
let _redislabsdev_redis_ui_styles = require("@redis-ui/styles");
|
|
@@ -10,7 +11,9 @@ var Separator = styled_components.default.div.withConfig({
|
|
|
10
11
|
})([
|
|
11
12
|
"width:1.6rem;height:",
|
|
12
13
|
";transition:background-color 0.3s ease;",
|
|
13
|
-
""
|
|
14
|
+
" ",
|
|
15
|
+
"[data-variant='compact'] &&{width:auto;height:auto;background-color:transparent;color:",
|
|
16
|
+
";&::before{content:'—';}}"
|
|
14
17
|
], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step.separator.height, () => {
|
|
15
18
|
const { states } = (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.step;
|
|
16
19
|
return Object.values(require_Step_types.StepperStepState).map((state) => {
|
|
@@ -20,6 +23,6 @@ var Separator = styled_components.default.div.withConfig({
|
|
|
20
23
|
}
|
|
21
24
|
`;
|
|
22
25
|
});
|
|
23
|
-
});
|
|
26
|
+
}, require_Compose_style.StepperCompose, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.stepper.compact.separatorColor);
|
|
24
27
|
//#endregion
|
|
25
28
|
exports.Separator = Separator;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { StepperStepState } from "../../Step.types.js";
|
|
2
|
+
import { StepperCompose } from "../../../Compose/Compose.style.js";
|
|
2
3
|
import _styled, { css } from "styled-components";
|
|
3
4
|
import { useTheme } from "@redis-ui/styles";
|
|
4
5
|
//#region src/Stepper/components/Step/components/Separator/Separator.style.ts
|
|
@@ -8,7 +9,9 @@ var Separator = _styled.div.withConfig({
|
|
|
8
9
|
})([
|
|
9
10
|
"width:1.6rem;height:",
|
|
10
11
|
";transition:background-color 0.3s ease;",
|
|
11
|
-
""
|
|
12
|
+
" ",
|
|
13
|
+
"[data-variant='compact'] &&{width:auto;height:auto;background-color:transparent;color:",
|
|
14
|
+
";&::before{content:'—';}}"
|
|
12
15
|
], () => useTheme().components.stepper.step.separator.height, () => {
|
|
13
16
|
const { states } = useTheme().components.stepper.step;
|
|
14
17
|
return Object.values(StepperStepState).map((state) => {
|
|
@@ -18,6 +21,6 @@ var Separator = _styled.div.withConfig({
|
|
|
18
21
|
}
|
|
19
22
|
`;
|
|
20
23
|
});
|
|
21
|
-
});
|
|
24
|
+
}, StepperCompose, () => useTheme().components.stepper.compact.separatorColor);
|
|
22
25
|
//#endregion
|
|
23
26
|
export { Separator };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redis-ui/components",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "51.
|
|
4
|
+
"version": "51.9.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.
|
|
33
|
+
"@redis-ui/styles": "^21.15.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"
|
|
@@ -18,6 +18,7 @@ If you want to style against step state, also import `StepperStepState` from the
|
|
|
18
18
|
|------|------|---------|-------------|
|
|
19
19
|
| steps | `StepperStep[]` | required | Array of step descriptors rendered by the root stepper |
|
|
20
20
|
| currentStep | `number` | `-1` | Zero-based active step index |
|
|
21
|
+
| variant | `'default' \| 'compact'` | `'default'` | `compact` renders the steps as one line of text: the step number and label, with a dash between steps. Custom icons are ignored and completed steps show their number |
|
|
21
22
|
| getIsStepInteractive | `(stepIndex: number) => boolean` | - | Optional predicate that marks specific steps interactive |
|
|
22
23
|
| onStepChange | `(stepIndex: number) => void` | - | Called when the user activates a step |
|
|
23
24
|
| compose root props | `ComposeElementProps<HTMLElement>` | - | Additional container props forwarded to `Stepper.Compose` |
|
|
@@ -37,6 +38,7 @@ If you want to style against step state, also import `StepperStepState` from the
|
|
|
37
38
|
|------|------|---------|-------------|
|
|
38
39
|
| children | `ReactNode` | required | Step compositions rendered inside the stepper |
|
|
39
40
|
| currentStep | `number` | `-1` | Zero-based active step index |
|
|
41
|
+
| variant | `'default' \| 'compact'` | `'default'` | `compact` renders the steps as one line of text: the step number and label. Custom icons are ignored and completed steps show their number. Add `Stepper.Step.Separator` between steps to get the dash |
|
|
40
42
|
| getIsStepInteractive | `(stepIndex: number) => boolean` | - | Optional predicate that marks specific steps interactive |
|
|
41
43
|
| onStepChange | `(stepIndex: number) => void` | - | Called when the user activates a step |
|
|
42
44
|
| compose root props | `ComposeElementProps<HTMLElement>` | - | Standard container props forwarded to the compose root |
|
|
@@ -63,7 +65,7 @@ If you want to style against step state, also import `StepperStepState` from the
|
|
|
63
65
|
|
|
64
66
|
| Prop | Type | Default | Description |
|
|
65
67
|
|------|------|---------|-------------|
|
|
66
|
-
| children | `ReactNode` | - | Custom icon content; when omitted, the step number is shown and completed steps render a check icon |
|
|
68
|
+
| children | `ReactNode` | - | Custom icon content; when omitted, the step number is shown and completed steps render a check icon. In the `compact` variant the step number is always shown and `children` are ignored |
|
|
67
69
|
| icon wrapper props | `HTMLAttributes<HTMLDivElement>` | - | Additional props forwarded to the icon container |
|
|
68
70
|
|
|
69
71
|
### `Stepper.Step.Label`
|
|
@@ -124,6 +126,20 @@ const storySteps = [
|
|
|
124
126
|
</>
|
|
125
127
|
```
|
|
126
128
|
|
|
129
|
+
### Compact
|
|
130
|
+
|
|
131
|
+
> `variant="compact"` renders the steps as a single line of text, for tight spots such as a modal header.
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
import { Stepper } from '@redis-ui/components';
|
|
135
|
+
|
|
136
|
+
<Stepper
|
|
137
|
+
variant="compact"
|
|
138
|
+
currentStep={0}
|
|
139
|
+
steps={[{ label: 'Configure' }, { label: 'Payment' }, { label: 'Connect' }]}
|
|
140
|
+
/>
|
|
141
|
+
```
|
|
142
|
+
|
|
127
143
|
### Interactive
|
|
128
144
|
|
|
129
145
|
> `Stepper` can be interactive if `onStepChange` is defined. It allows only controlled mode.<br/>
|
|
@@ -283,6 +299,7 @@ function Example() {
|
|
|
283
299
|
- `Stepper` supports both data-driven steps via `steps` and custom step compositions via `Stepper.Compose`.
|
|
284
300
|
- `onStepChange` enables interactive controlled mode and keyboard navigation with `ArrowLeft/Right`, `Home`, and `End`.
|
|
285
301
|
- `Stepper.Step` can render any `ReactNode`, not just plain text labels.
|
|
286
|
-
- `Stepper.Step.Icon` falls back to the step number when no custom icon content is provided, and completed steps render a check icon.
|
|
302
|
+
- `Stepper.Step.Icon` falls back to the step number when no custom icon content is provided, and completed steps render a check icon. In the `compact` variant it always shows the step number.
|
|
303
|
+
- `Stepper.Step.Separator` renders a line in the default variant and a dash in the `compact` variant. The `Stepper` shorthand adds separators automatically; with `Stepper.Compose`, add them between steps yourself.
|
|
287
304
|
- `Stepper.Step` and its parts expose `data-state` values of `idle`, `focused`, and `completed`, which are intended for custom styling.
|
|
288
305
|
- `StepperStepState` is the exported constant to target those states in styled wrappers and CSS selectors.
|