@redis-ui/components 51.25.0 → 51.27.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 (61) hide show
  1. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.cjs +17 -8
  2. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.js +17 -8
  3. package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.d.ts +5 -1
  4. package/dist/Inputs/Input/Input.cjs +9 -2
  5. package/dist/Inputs/Input/Input.d.ts +4 -1
  6. package/dist/Inputs/Input/Input.js +9 -2
  7. package/dist/Inputs/Input/Input.types.d.ts +5 -1
  8. package/dist/Inputs/PasswordInput/components/Compose/Compose.types.d.ts +1 -1
  9. package/dist/Inputs/TextArea/TextArea.cjs +16 -6
  10. package/dist/Inputs/TextArea/TextArea.d.ts +3 -1
  11. package/dist/Inputs/TextArea/TextArea.js +16 -6
  12. package/dist/Inputs/TextArea/TextArea.types.d.ts +4 -1
  13. package/dist/Inputs/TextArea/components/CopyButton/CopyButton.cjs +7 -0
  14. package/dist/Inputs/TextArea/components/CopyButton/CopyButton.d.ts +2 -0
  15. package/dist/Inputs/TextArea/components/CopyButton/CopyButton.js +7 -0
  16. package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.cjs +17 -0
  17. package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.d.ts +1 -0
  18. package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.js +15 -0
  19. package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.cjs +3 -1
  20. package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.js +4 -2
  21. package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.style.cjs +8 -1
  22. package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.style.js +8 -1
  23. package/dist/Inputs/components/Compose/CommonCompose.cjs +23 -18
  24. package/dist/Inputs/components/Compose/CommonCompose.d.ts +1 -1
  25. package/dist/Inputs/components/Compose/CommonCompose.js +24 -19
  26. package/dist/Inputs/components/Compose/CommonCompose.types.d.ts +2 -0
  27. package/dist/Inputs/components/Compose/Compose.style.cjs +7 -0
  28. package/dist/Inputs/components/Compose/Compose.style.js +7 -0
  29. package/dist/Inputs/components/Compose/NumericCompose.types.d.ts +1 -1
  30. package/dist/Inputs/components/CopyButton/CopyButton.cjs +15 -0
  31. package/dist/Inputs/components/CopyButton/CopyButton.d.ts +2 -0
  32. package/dist/Inputs/components/CopyButton/CopyButton.js +15 -0
  33. package/dist/Inputs/components/CopyButton/CopyButton.style.cjs +17 -0
  34. package/dist/Inputs/components/CopyButton/CopyButton.style.d.ts +1 -0
  35. package/dist/Inputs/components/CopyButton/CopyButton.style.js +15 -0
  36. package/dist/Inputs/components/CopyButton/CopyButton.types.d.ts +6 -0
  37. package/dist/Inputs/components/CopyButton/CopyButton.types.js +1 -0
  38. package/dist/Inputs/components/InputTag/InputTag.cjs +3 -1
  39. package/dist/Inputs/components/InputTag/InputTag.js +4 -2
  40. package/dist/Inputs/components/InputTag/InputTag.style.cjs +1 -1
  41. package/dist/Inputs/components/InputTag/InputTag.style.js +1 -1
  42. package/dist/UseCaseList/UseCaseList.cjs +28 -0
  43. package/dist/UseCaseList/UseCaseList.d.ts +3 -0
  44. package/dist/UseCaseList/UseCaseList.js +28 -0
  45. package/dist/UseCaseList/UseCaseList.style.cjs +54 -0
  46. package/dist/UseCaseList/UseCaseList.style.d.ts +10 -0
  47. package/dist/UseCaseList/UseCaseList.style.js +48 -0
  48. package/dist/UseCaseList/UseCaseList.types.d.ts +12 -0
  49. package/dist/UseCaseList/UseCaseList.types.js +1 -0
  50. package/dist/UseCaseList/index.d.ts +2 -0
  51. package/dist/UseCaseList/index.js +2 -0
  52. package/dist/index.cjs +2 -0
  53. package/dist/index.d.ts +1 -0
  54. package/dist/index.js +2 -1
  55. package/package.json +2 -2
  56. package/skills/redis-ui-components/SKILL.md +1 -0
  57. package/skills/redis-ui-components/references/CopyToClipboardButton.md +23 -1
  58. package/skills/redis-ui-components/references/Input.md +39 -2
  59. package/skills/redis-ui-components/references/SearchInput.md +1 -1
  60. package/skills/redis-ui-components/references/TextArea.md +19 -1
  61. package/skills/redis-ui-components/references/UseCaseList.md +86 -0
@@ -1,7 +1,7 @@
1
1
  import { combineHandlers } from "../../../Helpers/react.utils.js";
2
2
  import { SharedIdTransProvider } from "../../../Helpers/contexts/SharedId.context.js";
3
3
  import { ErrorContentProvider, FieldDisabledTransProvider } from "../Context/Field.context.js";
4
- import { FieldAdditionTextIdTransProvider, FieldRequiredTransProvider, FieldStatusTransProvider, useFieldReadonly } from "../../../FormField/FormField.context.js";
4
+ import { FieldAdditionTextIdTransProvider, FieldReadonlyTransProvider, FieldRequiredTransProvider, FieldStatusTransProvider, useFieldReadonly } from "../../../FormField/FormField.context.js";
5
5
  import { InputTag } from "../InputTag/InputTag.style.js";
6
6
  import { CommonInputCompose as CommonInputCompose$1, ReadonlyValue } from "./Compose.style.js";
7
7
  import { ReadonlyRenderWrapper } from "../ReadonlyRender/ReadonlyRenderWrapper.js";
@@ -11,30 +11,35 @@ var DefaultReadonlyRender = ({ value, ...restProps }) => /* @__PURE__ */ jsx(Rea
11
11
  ...restProps,
12
12
  children: value
13
13
  });
14
- var CommonInputCompose = ({ id, readOnly, readonlyRender = DefaultReadonlyRender, readonlyProps, variant = "outline", error, valid, children, onPointerUp, ...restProps }) => {
14
+ var CommonInputCompose = ({ id, readOnly, readonlyRender = DefaultReadonlyRender, readonlyProps, boxedReadonly = false, variant = "outline", error, valid, children, onPointerUp, ...restProps }) => {
15
+ const fieldReadonly = useFieldReadonly(readOnly);
15
16
  return /* @__PURE__ */ jsx(SharedIdTransProvider, {
16
17
  customId: id,
17
- children: useFieldReadonly(readOnly) ? /* @__PURE__ */ jsx(ReadonlyRenderWrapper, {
18
+ children: fieldReadonly && !boxedReadonly ? /* @__PURE__ */ jsx(ReadonlyRenderWrapper, {
18
19
  ...readonlyProps,
19
20
  ...restProps,
20
21
  render: readonlyRender,
21
22
  "$data-children": children
22
- }) : /* @__PURE__ */ jsx(FieldDisabledTransProvider, { children: /* @__PURE__ */ jsx(FieldStatusTransProvider, {
23
- value: error && "error" || valid && "success" || "none",
24
- children: /* @__PURE__ */ jsx(FieldRequiredTransProvider, { children: /* @__PURE__ */ jsx(FieldAdditionTextIdTransProvider, { children: /* @__PURE__ */ jsx(ErrorContentProvider, {
25
- value: error ?? "",
26
- children: /* @__PURE__ */ jsx(CommonInputCompose$1, {
27
- $variant: variant,
28
- ...restProps,
29
- "data-editable": "",
30
- onPointerUp: combineHandlers((e) => {
31
- const target = e.target;
32
- if (target.tagName !== "INPUT" && target.tagName !== "TEXTAREA") (e.currentTarget.querySelector(`input${InputTag}`) ?? e.currentTarget.querySelector("textarea"))?.focus();
33
- }, onPointerUp),
34
- children
35
- })
36
- }) }) })
37
- }) })
23
+ }) : /* @__PURE__ */ jsx(FieldReadonlyTransProvider, {
24
+ value: fieldReadonly,
25
+ children: /* @__PURE__ */ jsx(FieldDisabledTransProvider, { children: /* @__PURE__ */ jsx(FieldStatusTransProvider, {
26
+ value: error && "error" || valid && "success" || "none",
27
+ children: /* @__PURE__ */ jsx(FieldRequiredTransProvider, { children: /* @__PURE__ */ jsx(FieldAdditionTextIdTransProvider, { children: /* @__PURE__ */ jsx(ErrorContentProvider, {
28
+ value: error ?? "",
29
+ children: /* @__PURE__ */ jsx(CommonInputCompose$1, {
30
+ $variant: variant,
31
+ ...restProps,
32
+ "data-editable": "",
33
+ "data-readonly": fieldReadonly ? "" : void 0,
34
+ onPointerUp: combineHandlers((e) => {
35
+ const target = e.target;
36
+ if (target.tagName !== "INPUT" && target.tagName !== "TEXTAREA") (e.currentTarget.querySelector(`input${InputTag}`) ?? e.currentTarget.querySelector("textarea"))?.focus();
37
+ }, onPointerUp),
38
+ children
39
+ })
40
+ }) }) })
41
+ }) })
42
+ })
38
43
  });
39
44
  };
40
45
  //#endregion
@@ -11,5 +11,7 @@ export type CommonInputComposeProps = {
11
11
  };
12
12
  export type RestCommonInputComposeProps = Omit<ComposeElementProps, 'defaultValue' | 'onChange'> & {
13
13
  readonlyRender?: ReadOnlyRenderComponent;
14
+ /** Keeps the field box when read-only, with a non-editable but selectable value, instead of `readonlyRender`. */
15
+ boxedReadonly?: boolean;
14
16
  readonlyProps?: HTMLAttributes<HTMLElement>;
15
17
  };
@@ -59,6 +59,13 @@ var getStateStyle = (theme) => {
59
59
  })};
60
60
  }
61
61
 
62
+ &[data-readonly] {
63
+ ${require_css_utils.styleFromTokens({
64
+ tokenMaps: [bgColor, textColor],
65
+ tokens: statesStyle.boxedReadonly
66
+ })};
67
+ }
68
+
62
69
  &:has(:is(input, textarea):disabled) {
63
70
  ${require_css_utils.styleFromTokens({
64
71
  tokenMaps: maps,
@@ -57,6 +57,13 @@ var getStateStyle = (theme) => {
57
57
  })};
58
58
  }
59
59
 
60
+ &[data-readonly] {
61
+ ${styleFromTokens({
62
+ tokenMaps: [bgColor, textColor],
63
+ tokens: statesStyle.boxedReadonly
64
+ })};
65
+ }
66
+
60
67
  &:has(:is(input, textarea):disabled) {
61
68
  ${styleFromTokens({
62
69
  tokenMaps: maps,
@@ -1,4 +1,4 @@
1
1
  import { CommonInputComposeProps, RestCommonInputComposeProps } from './CommonCompose.types';
2
2
  import { NumericInputValueProviderProps } from '../Context/NumericInputValueProvider';
3
3
  export type NumericInputComposeProps = CommonInputComposeProps & Omit<NumericInputValueProviderProps, 'children'>;
4
- export type RestNumericInputComposeProps = RestCommonInputComposeProps;
4
+ export type RestNumericInputComposeProps = Omit<RestCommonInputComposeProps, 'boxedReadonly'>;
@@ -0,0 +1,15 @@
1
+ const require_react_utils = require("../../../Helpers/react.utils.cjs");
2
+ const require_InputValue_context = require("../Context/InputValue.context.cjs");
3
+ const require_CopyButton_style = require("./CopyButton.style.cjs");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/Inputs/components/CopyButton/CopyButton.tsx
6
+ var CopyButton = ({ showCopyButton = true, textToCopy, onMouseDown, ...restProps }) => {
7
+ const { value } = require_InputValue_context.useInputValueApi();
8
+ return showCopyButton ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CopyButton_style.CopyButton, {
9
+ textToCopy: textToCopy ?? value ?? "",
10
+ ...restProps,
11
+ onMouseDown: require_react_utils.combineHandlers((e) => e.preventDefault(), onMouseDown)
12
+ }) : null;
13
+ };
14
+ //#endregion
15
+ exports.CopyButton = CopyButton;
@@ -0,0 +1,2 @@
1
+ import { CopyButtonProps, RestCopyButtonProps } from './CopyButton.types';
2
+ export declare const CopyButton: ({ showCopyButton, textToCopy, onMouseDown, ...restProps }: RestCopyButtonProps & CopyButtonProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ import { combineHandlers } from "../../../Helpers/react.utils.js";
2
+ import { useInputValueApi } from "../Context/InputValue.context.js";
3
+ import { CopyButton as CopyButton$1 } from "./CopyButton.style.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ //#region src/Inputs/components/CopyButton/CopyButton.tsx
6
+ var CopyButton = ({ showCopyButton = true, textToCopy, onMouseDown, ...restProps }) => {
7
+ const { value } = useInputValueApi();
8
+ return showCopyButton ? /* @__PURE__ */ jsx(CopyButton$1, {
9
+ textToCopy: textToCopy ?? value ?? "",
10
+ ...restProps,
11
+ onMouseDown: combineHandlers((e) => e.preventDefault(), onMouseDown)
12
+ }) : null;
13
+ };
14
+ //#endregion
15
+ export { CopyButton };
@@ -0,0 +1,17 @@
1
+ const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
2
+ const require_CopyToClipboardButton = require("../../../Button/CopyToClipboardButton/CopyToClipboardButton.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/Inputs/components/CopyButton/CopyButton.style.ts
7
+ var CopyButton = (0, styled_components.default)(require_CopyToClipboardButton.default).withConfig({
8
+ displayName: "CopyButtonstyle__CopyButton",
9
+ componentId: "RedisUI__sc-eedjzk-0"
10
+ })([
11
+ "flex:none;&&:is(:hover,:active):not(:disabled){background-color:transparent;}&&:is(:hover,:active):not(:disabled,[data-copied]){color:",
12
+ ";}& svg{width:",
13
+ ";height:",
14
+ ";}"
15
+ ], () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.input.copyButton.hoverIconColor, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.input.copyButton.iconSize, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.input.copyButton.iconSize);
16
+ //#endregion
17
+ exports.CopyButton = CopyButton;
@@ -0,0 +1 @@
1
+ export declare const CopyButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../..").CopyToClipboardButtonProps & import("react").RefAttributes<HTMLButtonElement>>, any, {}, never>;
@@ -0,0 +1,15 @@
1
+ import CopyToClipboardButton from "../../../Button/CopyToClipboardButton/CopyToClipboardButton.js";
2
+ import _styled from "styled-components";
3
+ import { useTheme } from "@redis-ui/styles";
4
+ //#region src/Inputs/components/CopyButton/CopyButton.style.ts
5
+ var CopyButton = _styled(CopyToClipboardButton).withConfig({
6
+ displayName: "CopyButtonstyle__CopyButton",
7
+ componentId: "RedisUI__sc-eedjzk-0"
8
+ })([
9
+ "flex:none;&&:is(:hover,:active):not(:disabled){background-color:transparent;}&&:is(:hover,:active):not(:disabled,[data-copied]){color:",
10
+ ";}& svg{width:",
11
+ ";height:",
12
+ ";}"
13
+ ], () => useTheme().components.input.copyButton.hoverIconColor, () => useTheme().components.input.copyButton.iconSize, () => useTheme().components.input.copyButton.iconSize);
14
+ //#endregion
15
+ export { CopyButton };
@@ -0,0 +1,6 @@
1
+ import { CopyToClipboardButtonProps } from '../../../Button/CopyToClipboardButton/CopyToClipboardButton.types';
2
+ export type CopyButtonProps = {
3
+ /** Renders a copy button inside the field that copies the current value. */
4
+ showCopyButton?: boolean;
5
+ };
6
+ export type RestCopyButtonProps = Partial<Omit<CopyToClipboardButtonProps, 'variant'>>;
@@ -9,6 +9,7 @@ let react_jsx_runtime = require("react/jsx-runtime");
9
9
  //#region src/Inputs/components/InputTag/InputTag.tsx
10
10
  var InputTag = (0, require("react").forwardRef)(({ autoSize, id, type = "text", autoComplete = "off", disabled, "aria-describedby": ariaDescribedby, ...restProps }, ref) => {
11
11
  const fieldDisabled = require_Field_context.useFieldDisabled(disabled);
12
+ const fieldReadonly = require_FormField_context.useFieldReadonly();
12
13
  const sharedId = require_SharedId_context.useSharedId(id);
13
14
  const inputValueProps = require_InputValue_context.useInputValueProps(restProps, ref);
14
15
  const status = require_FormField_context.useFieldStatus();
@@ -27,7 +28,8 @@ var InputTag = (0, require("react").forwardRef)(({ autoSize, id, type = "text",
27
28
  const inputProps = {
28
29
  id: sharedId,
29
30
  type,
30
- disabled: fieldDisabled,
31
+ disabled: !fieldReadonly && fieldDisabled,
32
+ readOnly: fieldReadonly,
31
33
  autoComplete,
32
34
  ...required ? { "aria-required": true } : null,
33
35
  ...restProps,
@@ -3,13 +3,14 @@ import { VisuallyHidden } from "../../../packages/components/node_modules/@radix
3
3
  import { useSharedId } from "../../../Helpers/contexts/SharedId.context.js";
4
4
  import { useErrorContent, useFieldDisabled } from "../Context/Field.context.js";
5
5
  import { useInputValueProps } from "../Context/InputValue.context.js";
6
- import { useFieldAdditionTextId, useFieldRequired, useFieldStatus } from "../../../FormField/FormField.context.js";
6
+ import { useFieldAdditionTextId, useFieldReadonly, useFieldRequired, useFieldStatus } from "../../../FormField/FormField.context.js";
7
7
  import { AutoSizeInputTag, InputTag as InputTag$1 } from "./InputTag.style.js";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { forwardRef } from "react";
10
10
  //#region src/Inputs/components/InputTag/InputTag.tsx
11
11
  var InputTag = forwardRef(({ autoSize, id, type = "text", autoComplete = "off", disabled, "aria-describedby": ariaDescribedby, ...restProps }, ref) => {
12
12
  const fieldDisabled = useFieldDisabled(disabled);
13
+ const fieldReadonly = useFieldReadonly();
13
14
  const sharedId = useSharedId(id);
14
15
  const inputValueProps = useInputValueProps(restProps, ref);
15
16
  const status = useFieldStatus();
@@ -28,7 +29,8 @@ var InputTag = forwardRef(({ autoSize, id, type = "text", autoComplete = "off",
28
29
  const inputProps = {
29
30
  id: sharedId,
30
31
  type,
31
- disabled: fieldDisabled,
32
+ disabled: !fieldReadonly && fieldDisabled,
33
+ readOnly: fieldReadonly,
32
34
  autoComplete,
33
35
  ...required ? { "aria-required": true } : null,
34
36
  ...restProps,
@@ -55,7 +55,7 @@ var InputTag = styled_components.default.input.withConfig({
55
55
  componentId: "RedisUI__sc-15tql6o-0"
56
56
  })([
57
57
  "",
58
- ";align-self:stretch;padding:0;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;}&[type='password']:not(:placeholder-shown){font-family:",
58
+ ";align-self:stretch;padding:0;&[readonly]{text-overflow:ellipsis;}&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;}&[type='password']:not(:placeholder-shown){font-family:",
59
59
  ";font-size:",
60
60
  ";@supports not (-moz-appearance:none){font-size-adjust:",
61
61
  ";}}"
@@ -53,7 +53,7 @@ var InputTag = _styled.input.withConfig({
53
53
  componentId: "RedisUI__sc-15tql6o-0"
54
54
  })([
55
55
  "",
56
- ";align-self:stretch;padding:0;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;}&[type='password']:not(:placeholder-shown){font-family:",
56
+ ";align-self:stretch;padding:0;&[readonly]{text-overflow:ellipsis;}&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}&[type='number']{-moz-appearance:textfield;}&[type='password']:not(:placeholder-shown){font-family:",
57
57
  ";font-size:",
58
58
  ";@supports not (-moz-appearance:none){font-size-adjust:",
59
59
  ";}}"
@@ -0,0 +1,28 @@
1
+ const require_Typography = require("../Typography/Typography.cjs");
2
+ const require_UseCaseList_style = require("./UseCaseList.style.cjs");
3
+ let react_jsx_runtime = require("react/jsx-runtime");
4
+ //#region src/UseCaseList/UseCaseList.tsx
5
+ var formatPosition = (index) => String(index + 1).padStart(2, "0");
6
+ var UseCaseList = ({ items, ...restProps }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_UseCaseList_style.UseCaseList, {
7
+ role: "list",
8
+ ...restProps,
9
+ children: items.map(({ title, description, icon }, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_UseCaseList_style.UseCaseListItem, {
10
+ $numbered: !icon,
11
+ children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_UseCaseList_style.UseCaseListIcon, {
12
+ "aria-hidden": true,
13
+ children: icon
14
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_UseCaseList_style.UseCaseListNumber, {
15
+ "aria-hidden": true,
16
+ children: formatPosition(index)
17
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_UseCaseList_style.UseCaseListText, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.default.Body, {
18
+ variant: "semiBold",
19
+ children: title
20
+ }), description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Typography.default.Body, {
21
+ size: "S",
22
+ color: "secondary",
23
+ children: description
24
+ })] })]
25
+ }, `${index}-${title}`))
26
+ });
27
+ //#endregion
28
+ exports.default = UseCaseList;
@@ -0,0 +1,3 @@
1
+ import { UseCaseListProps } from './UseCaseList.types';
2
+ declare const UseCaseList: ({ items, ...restProps }: UseCaseListProps) => import("react/jsx-runtime").JSX.Element;
3
+ export default UseCaseList;
@@ -0,0 +1,28 @@
1
+ import Typography from "../Typography/Typography.js";
2
+ import { UseCaseList as UseCaseList$1, UseCaseListIcon, UseCaseListItem, UseCaseListNumber, UseCaseListText } from "./UseCaseList.style.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/UseCaseList/UseCaseList.tsx
5
+ var formatPosition = (index) => String(index + 1).padStart(2, "0");
6
+ var UseCaseList = ({ items, ...restProps }) => /* @__PURE__ */ jsx(UseCaseList$1, {
7
+ role: "list",
8
+ ...restProps,
9
+ children: items.map(({ title, description, icon }, index) => /* @__PURE__ */ jsxs(UseCaseListItem, {
10
+ $numbered: !icon,
11
+ children: [icon ? /* @__PURE__ */ jsx(UseCaseListIcon, {
12
+ "aria-hidden": true,
13
+ children: icon
14
+ }) : /* @__PURE__ */ jsx(UseCaseListNumber, {
15
+ "aria-hidden": true,
16
+ children: formatPosition(index)
17
+ }), /* @__PURE__ */ jsxs(UseCaseListText, { children: [/* @__PURE__ */ jsx(Typography.Body, {
18
+ variant: "semiBold",
19
+ children: title
20
+ }), description && /* @__PURE__ */ jsx(Typography.Body, {
21
+ size: "S",
22
+ color: "secondary",
23
+ children: description
24
+ })] })]
25
+ }, `${index}-${title}`))
26
+ });
27
+ //#endregion
28
+ export { UseCaseList as default };
@@ -0,0 +1,54 @@
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/UseCaseList/UseCaseList.style.ts
7
+ var UseCaseList = styled_components.default.ul.withConfig({
8
+ displayName: "UseCaseListstyle__UseCaseList",
9
+ componentId: "RedisUI__sc-fvyp7z-0"
10
+ })(["display:flex;flex-direction:column;min-width:0;margin:0;padding:0;list-style:none;"]);
11
+ var UseCaseListItem = styled_components.default.li.withConfig({
12
+ displayName: "UseCaseListstyle__UseCaseListItem",
13
+ componentId: "RedisUI__sc-fvyp7z-1"
14
+ })([
15
+ "display:flex;align-items:",
16
+ ";gap:",
17
+ ";padding-block:",
18
+ ";&:first-child{padding-top:",
19
+ ";}&:not(:first-child){border-top:",
20
+ ";}"
21
+ ], ({ $numbered }) => $numbered ? "baseline" : "flex-start", () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space200, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space200, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space050, () => {
22
+ const { core, components } = (0, _redislabsdev_redis_ui_styles.useTheme)();
23
+ return `${core.space.space010} solid ${(0, _redislabsdev_redis_ui_styles.withOpacity)(components.card.variants.primary.borderColor, .55)}`;
24
+ });
25
+ var leadSlot = styled_components.css`
26
+ flex: none;
27
+ width: ${() => (0, _redislabsdev_redis_ui_styles.useTheme)().core.icon.size.L};
28
+ `;
29
+ var UseCaseListIcon = styled_components.default.span.withConfig({
30
+ displayName: "UseCaseListstyle__UseCaseListIcon",
31
+ componentId: "RedisUI__sc-fvyp7z-2"
32
+ })([
33
+ "",
34
+ ";display:flex;margin-top:",
35
+ ";color:",
36
+ ";"
37
+ ], leadSlot, () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space025, () => (0, _redislabsdev_redis_ui_styles.useTheme)().components.typography.colors.secondary);
38
+ var UseCaseListNumber = (0, styled_components.default)(require_Typography.default.Code).attrs({
39
+ size: "S",
40
+ color: "secondary"
41
+ }).withConfig({
42
+ displayName: "UseCaseListstyle__UseCaseListNumber",
43
+ componentId: "RedisUI__sc-fvyp7z-3"
44
+ })(["", ";"], leadSlot);
45
+ var UseCaseListText = styled_components.default.div.withConfig({
46
+ displayName: "UseCaseListstyle__UseCaseListText",
47
+ componentId: "RedisUI__sc-fvyp7z-4"
48
+ })(["display:flex;flex-direction:column;gap:", ";min-width:0;"], () => (0, _redislabsdev_redis_ui_styles.useTheme)().core.space.space050);
49
+ //#endregion
50
+ exports.UseCaseList = UseCaseList;
51
+ exports.UseCaseListIcon = UseCaseListIcon;
52
+ exports.UseCaseListItem = UseCaseListItem;
53
+ exports.UseCaseListNumber = UseCaseListNumber;
54
+ exports.UseCaseListText = UseCaseListText;
@@ -0,0 +1,10 @@
1
+ export declare const UseCaseList: import("styled-components").StyledComponent<"ul", any, {}, never>;
2
+ export declare const UseCaseListItem: import("styled-components").StyledComponent<"li", any, {
3
+ $numbered: boolean;
4
+ }, never>;
5
+ export declare const UseCaseListIcon: import("styled-components").StyledComponent<"span", any, {}, never>;
6
+ export declare const UseCaseListNumber: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("..").TypographyCodeProps & import("react").RefAttributes<HTMLElement>>, any, {
7
+ size: "S";
8
+ color: "secondary";
9
+ }, "color" | "size">;
10
+ export declare const UseCaseListText: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,48 @@
1
+ import Typography from "../Typography/Typography.js";
2
+ import _styled, { css } from "styled-components";
3
+ import { useTheme, withOpacity } from "@redis-ui/styles";
4
+ //#region src/UseCaseList/UseCaseList.style.ts
5
+ var UseCaseList = _styled.ul.withConfig({
6
+ displayName: "UseCaseListstyle__UseCaseList",
7
+ componentId: "RedisUI__sc-fvyp7z-0"
8
+ })(["display:flex;flex-direction:column;min-width:0;margin:0;padding:0;list-style:none;"]);
9
+ var UseCaseListItem = _styled.li.withConfig({
10
+ displayName: "UseCaseListstyle__UseCaseListItem",
11
+ componentId: "RedisUI__sc-fvyp7z-1"
12
+ })([
13
+ "display:flex;align-items:",
14
+ ";gap:",
15
+ ";padding-block:",
16
+ ";&:first-child{padding-top:",
17
+ ";}&:not(:first-child){border-top:",
18
+ ";}"
19
+ ], ({ $numbered }) => $numbered ? "baseline" : "flex-start", () => useTheme().core.space.space200, () => useTheme().core.space.space200, () => useTheme().core.space.space050, () => {
20
+ const { core, components } = useTheme();
21
+ return `${core.space.space010} solid ${withOpacity(components.card.variants.primary.borderColor, .55)}`;
22
+ });
23
+ var leadSlot = css`
24
+ flex: none;
25
+ width: ${() => useTheme().core.icon.size.L};
26
+ `;
27
+ var UseCaseListIcon = _styled.span.withConfig({
28
+ displayName: "UseCaseListstyle__UseCaseListIcon",
29
+ componentId: "RedisUI__sc-fvyp7z-2"
30
+ })([
31
+ "",
32
+ ";display:flex;margin-top:",
33
+ ";color:",
34
+ ";"
35
+ ], leadSlot, () => useTheme().core.space.space025, () => useTheme().components.typography.colors.secondary);
36
+ var UseCaseListNumber = _styled(Typography.Code).attrs({
37
+ size: "S",
38
+ color: "secondary"
39
+ }).withConfig({
40
+ displayName: "UseCaseListstyle__UseCaseListNumber",
41
+ componentId: "RedisUI__sc-fvyp7z-3"
42
+ })(["", ";"], leadSlot);
43
+ var UseCaseListText = _styled.div.withConfig({
44
+ displayName: "UseCaseListstyle__UseCaseListText",
45
+ componentId: "RedisUI__sc-fvyp7z-4"
46
+ })(["display:flex;flex-direction:column;gap:", ";min-width:0;"], () => useTheme().core.space.space050);
47
+ //#endregion
48
+ export { UseCaseList, UseCaseListIcon, UseCaseListItem, UseCaseListNumber, UseCaseListText };
@@ -0,0 +1,12 @@
1
+ import { HTMLAttributes, ReactNode } from 'react';
2
+ export type UseCaseListItem = {
3
+ title: string;
4
+ description?: ReactNode;
5
+ /** Leading icon, sized `L`. Without one, the row shows its position as a two-digit number */
6
+ icon?: ReactNode;
7
+ };
8
+ export type OwnUseCaseListProps = {
9
+ items: UseCaseListItem[];
10
+ };
11
+ export type RestUseCaseListProps = HTMLAttributes<HTMLUListElement>;
12
+ export type UseCaseListProps = OwnUseCaseListProps & RestUseCaseListProps;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { default as UseCaseList } from './UseCaseList';
2
+ export * from './UseCaseList.types';
@@ -0,0 +1,2 @@
1
+ export { default as UseCaseList } from './UseCaseList';
2
+ export * from './UseCaseList.types';
package/dist/index.cjs CHANGED
@@ -114,6 +114,7 @@ const require_context = require("./Toast/core/context.cjs");
114
114
  const require_Toast = require("./Toast/Toast.cjs");
115
115
  const require_core = require("./Toast/core/core.cjs");
116
116
  const require_Toaster = require("./Toast/Toaster.cjs");
117
+ const require_UseCaseList = require("./UseCaseList/UseCaseList.cjs");
117
118
  const require_ProgressBar = require("./ProgressBar/ProgressBar.cjs");
118
119
  const require_ProfileIcon_style = require("./ProfileIcon/ProfileIcon.style.cjs");
119
120
  const require_ProfileIcon = require("./ProfileIcon/ProfileIcon.cjs");
@@ -267,6 +268,7 @@ exports.TooltipCard = require_TooltipCard.default;
267
268
  exports.TooltipProvider = require_Provider.default;
268
269
  exports.TreeView = require_TreeView.default;
269
270
  exports.Typography = require_Typography.default;
271
+ exports.UseCaseList = require_UseCaseList.default;
270
272
  exports.actionIconButtonSizes = require_ActionIconButton_types.actionIconButtonSizes;
271
273
  exports.badgeVariants = require_Badge_types.badgeVariants;
272
274
  exports.bannerVariants = require_Banner_types.bannerVariants;
package/dist/index.d.ts CHANGED
@@ -51,6 +51,7 @@ export * from './Toast';
51
51
  export * from './Tooltip';
52
52
  export * from './TreeView';
53
53
  export * from './Typography';
54
+ export * from './UseCaseList';
54
55
  export * from './ProgressBar';
55
56
  export * from './ProfileIcon';
56
57
  export * from './Slider';
package/dist/index.js CHANGED
@@ -114,8 +114,9 @@ import { useToastParams } from "./Toast/core/context.js";
114
114
  import Toast from "./Toast/Toast.js";
115
115
  import { toast } from "./Toast/core/core.js";
116
116
  import Toaster from "./Toast/Toaster.js";
117
+ import UseCaseList from "./UseCaseList/UseCaseList.js";
117
118
  import { ProgressBar } from "./ProgressBar/ProgressBar.js";
118
119
  import { ProfileIcon_style_exports } from "./ProfileIcon/ProfileIcon.style.js";
119
120
  import ProfileIcon from "./ProfileIcon/ProfileIcon.js";
120
121
  import Slider from "./Slider/Slider.js";
121
- export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, CodeBlock, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, Hero, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkList, LinkStyler, Loader, Menu, MidBar, Modal, MoreInfoIcon, MultiBoxSelectionGroup, MultiSelect, NumericInput, Overflow, Pagination, PasswordInput, Popover, PopperProvider, ProfileIcon, ProfileIcon_style_exports as ProfileIconStyles, ProgressBar, QuantityCounter, RadioGroup, RestylableElement, ScreenReaderAnnounce, SearchBar, SearchInput, Section, Select, SelfContained, SharedIdProvider, SharedIdTransProvider, SideBar, Skeleton, Slider, Stepper, StepperStepState, Switch, TableHeading, Tabs, TextArea, TextButton, TextButton_style_exports as TextButtonStyles, ThemeModeSwitch, Toast, Toaster, ToggleButton, ToggleButton_style_exports as ToggleButtonStyles, Tooltip, TooltipCard, Provider as TooltipProvider, TreeView, Typography, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardHoverEffects, cardVariants, childrenToString, codeBlockOverflows, codeBlockSizes, combineHandlers, copyToClipboardButtonVariants, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
122
+ export { ActionIconButton_style_exports as ActionButtonWithIconStyles, ActionIconButton, AppBar, AppBar_style_exports as AppBarStyles, AppSelectionMenu, AutoCompleteSelect, Badge, Badge_style_exports as BadgeStyles, Banner, BoxSelectionGroup, Breadcrumbs, Button, ButtonGroup, Button_style_exports as ButtonStyles, IconButton_style_exports as ButtonWithIconStyles, Card, CategoryValueList, Checkbox, Chip, ChipContainer, ChipList, CodeBlock, ContextProvider, CopyToClipboardButton, CountryFlag, Drawer, ErrorContentProvider, FieldAdditionTextIdProvider, FieldAdditionTextIdTransProvider, FieldDisabledProvider, FieldDisabledTransProvider, FieldReadonlyProvider, FieldReadonlyTransProvider, FieldRequiredProvider, FieldRequiredTransProvider, FieldStatusProvider, FieldStatusTransProvider, Filters, FlexDivider, FlexGroup, FlexItem, FlexSplit, FormField, Gauge, Grid, Hero, HighlightedIcon, HighlightedIcon_style_exports as HighlightedIconStyles, IconButton, Input, KeyValueList, Label, Link, LinkList, 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, UseCaseList, actionIconButtonSizes, badgeVariants, bannerVariants, buttonSizes, buttonVariants, buttonWithIconVariants, cardHoverEffects, cardVariants, childrenToString, codeBlockOverflows, codeBlockSizes, combineHandlers, copyToClipboardButtonVariants, createNullableContext, createPrimitiveContextState, debounce, forwardRefWithGenerics, generateId, getClosestDivisibleNumber, handlePreventDefault, handleStopPropagation, iconButtonSizes, isFragmentElement, isTextualNode, memoWithGenerics, textButtonSizes, textButtonVariants, throttle, toast, typographyColors, useEllipsisTooltip, useErrorContent, useFieldAdditionTextId, useFieldDisabled, useFieldReadonly, useFieldRequired, useFieldStatus, useGeneratedId, useInputValueApi, useInputValueProps, useKeyValueList, useMultiSelectContext, usePaginationContext, usePopperContext, useScrollable, useSelectContext, useSharedId, useThemeModeSwitch, useToastParams };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@redis-ui/components",
3
3
  "license": "UNLICENSED",
4
- "version": "51.25.0",
4
+ "version": "51.27.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.28.0",
33
+ "@redis-ui/styles": "^21.29.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"
@@ -171,6 +171,7 @@ Always check the relevant component reference before using a component. The refe
171
171
  - [ProgressBar](./references/ProgressBar.md)
172
172
  - [Gauge](./references/Gauge.md)
173
173
  - [Typography](./references/Typography.md)
174
+ - [UseCaseList](./references/UseCaseList.md)
174
175
  - [MoreInfoIcon](./references/MoreInfoIcon.md)
175
176
  - [HighlightedIcon](./references/HighlightedIcon.md)
176
177
  - [Icons](./references/Icons.md)
@@ -13,7 +13,9 @@ import { CopyToClipboardButton } from '@redis-ui/components';
13
13
  | textToCopy | `string` | *required* | Text copied to the clipboard when the button is clicked |
14
14
  | copiedLabel | `string` | - | Optional label shown while the copied success state is active |
15
15
  | variant | `'default' \| 'outline'` | `'default'` | `outline` renders a bordered square button for copyable values |
16
- | native button props | `Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'>` | - | Standard button attributes except `onClick`, which is handled internally |
16
+ | onCopy | `(text: string) => void` | - | Called with the copied text after it is written to the clipboard |
17
+ | onCopyError | `(error: unknown) => void` | - | Called when writing to the clipboard fails |
18
+ | native button props | `Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' \| 'onCopy'>` | - | Standard button attributes except `onClick`, which is handled internally, and the native `onCopy` event |
17
19
 
18
20
  ## Examples
19
21
 
@@ -74,6 +76,24 @@ import {
74
76
  <CopyToClipboardButton textToCopy="Text with custom label" copiedLabel="Successfully copied!" />
75
77
  ```
76
78
 
79
+ ### OnCopy
80
+
81
+ > `onCopy` is called with the copied text after it is written to the clipboard, for example to show a toast or send analytics. `onCopyError` is called when writing fails.
82
+
83
+ ```tsx
84
+ const [message, setMessage] = useState('Click to copy');
85
+
86
+ <>
87
+ <CopyToClipboardButton
88
+ textToCopy="7a1f3c9e-2b4d-4e8f"
89
+ aria-label="Copy project ID"
90
+ onCopy={() => setMessage('Project ID copied')}
91
+ onCopyError={() => setMessage('Could not copy the project ID')}
92
+ />
93
+ <span>{message}</span>
94
+ </>
95
+ ```
96
+
77
97
  ## Notes
78
98
  - The component forwards refs to the underlying `<button>` element.
79
99
  - After a successful copy, the icon changes to a check mark for 1.5 seconds before reverting.
@@ -81,3 +101,5 @@ import {
81
101
  - If `copiedLabel` is omitted, the accessible label falls back to `Copy`.
82
102
  - A successful copy is announced to screen readers (`copiedLabel`, or `Copied`).
83
103
  - Use `variant="outline"` for copyable values in Ultra surfaces.
104
+ - Use `onCopy` / `onCopyError` instead of `onClick` to run code after a copy. A failed copy keeps the button in its normal state.
105
+ - To copy the value of a field, use `showCopyButton` on `Input` or `TextArea` instead of placing this button next to the field.