@redis-ui/components 41.11.0 → 42.0.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/Button/Button.style.cjs +1 -1
- package/dist/Button/Button.style.js +1 -1
- package/dist/Button/Button.types.cjs +1 -1
- package/dist/Button/Button.types.d.ts +1 -1
- package/dist/Button/Button.types.js +1 -1
- package/dist/Chip/Chip.cjs +3 -1
- package/dist/Chip/Chip.d.ts +2 -2
- package/dist/Chip/Chip.js +3 -1
- package/dist/Chip/Chip.types.d.ts +2 -1
- package/dist/Chip/components/CloseButton/CloseButton.cjs +2 -1
- package/dist/Chip/components/CloseButton/CloseButton.d.ts +1 -1
- package/dist/Chip/components/CloseButton/CloseButton.js +2 -1
- package/dist/Chip/components/CloseButton/CloseButton.types.d.ts +1 -1
- package/dist/ChipList/ChipList.cjs +2 -0
- package/dist/ChipList/ChipList.d.ts +1 -1
- package/dist/ChipList/ChipList.js +2 -0
- package/dist/ChipList/ChipList.types.d.ts +1 -0
- package/dist/Helpers/css.utils.cjs +4 -0
- package/dist/Helpers/css.utils.js +4 -0
- package/dist/RadioGroup/RadioGroup.cjs +5 -23
- package/dist/RadioGroup/RadioGroup.d.ts +2 -15
- package/dist/RadioGroup/RadioGroup.js +5 -23
- package/dist/RadioGroup/RadioGroup.types.d.ts +1 -27
- package/dist/RadioGroup/components/Compose/Compose.cjs +23 -12
- package/dist/RadioGroup/components/Compose/Compose.d.ts +1 -1
- package/dist/RadioGroup/components/Compose/Compose.js +23 -12
- package/dist/RadioGroup/components/Compose/Compose.style.cjs +3 -1
- package/dist/RadioGroup/components/Compose/Compose.style.js +3 -1
- package/dist/RadioGroup/components/Item/Item.context.cjs +5 -10
- package/dist/RadioGroup/components/Item/Item.context.d.ts +1 -2
- package/dist/RadioGroup/components/Item/Item.context.js +5 -10
- package/dist/RadioGroup/components/Item/components/Compose/Compose.cjs +1 -1
- package/dist/RadioGroup/components/Item/components/Compose/Compose.js +2 -2
- package/dist/RadioGroup/components/Item/components/Indicator/Indicator.cjs +3 -1
- package/dist/RadioGroup/components/Item/components/Indicator/Indicator.js +3 -1
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ const baseButtonStyle = _styled.css`
|
|
|
25
25
|
}
|
|
26
26
|
`;
|
|
27
27
|
const sizeTokenMaps = [css_utils.tokenMaps.borderRadius, css_utils.tokenMaps.padding, css_utils.tokenMaps.height, css_utils.tokenMaps.lineHeight];
|
|
28
|
-
const variantTokenMaps = [css_utils.tokenMaps.bgColor, css_utils.tokenMaps.textColor, css_utils.tokenMaps.shadowBorder];
|
|
28
|
+
const variantTokenMaps = [css_utils.tokenMaps.bgColor, css_utils.tokenMaps.bgGradient, css_utils.tokenMaps.textColor, css_utils.tokenMaps.shadowBorder];
|
|
29
29
|
const Button = _styled__default.default.button.withConfig({
|
|
30
30
|
displayName: "Buttonstyle__Button",
|
|
31
31
|
componentId: "RedisUI__sc-6zckac-0"
|
|
@@ -21,7 +21,7 @@ const baseButtonStyle = css`
|
|
|
21
21
|
}
|
|
22
22
|
`;
|
|
23
23
|
const sizeTokenMaps = [tokenMaps.borderRadius, tokenMaps.padding, tokenMaps.height, tokenMaps.lineHeight];
|
|
24
|
-
const variantTokenMaps = [tokenMaps.bgColor, tokenMaps.textColor, tokenMaps.shadowBorder];
|
|
24
|
+
const variantTokenMaps = [tokenMaps.bgColor, tokenMaps.bgGradient, tokenMaps.textColor, tokenMaps.shadowBorder];
|
|
25
25
|
const Button = _styled.button.withConfig({
|
|
26
26
|
displayName: "Buttonstyle__Button",
|
|
27
27
|
componentId: "RedisUI__sc-6zckac-0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const buttonSizes = ["large", "medium", "small"];
|
|
4
|
-
const buttonVariants = ["primary", "destructive", "secondary-fill", "secondary-invert", "secondary-ghost"];
|
|
4
|
+
const buttonVariants = ["primary", "destructive", "secondary-fill", "secondary-invert", "secondary-ghost", "upsell"];
|
|
5
5
|
exports.buttonSizes = buttonSizes;
|
|
6
6
|
exports.buttonVariants = buttonVariants;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ButtonHTMLAttributes } from 'react';
|
|
2
2
|
import { Theme } from '@redislabsdev/redis-ui-styles';
|
|
3
3
|
export declare const buttonSizes: readonly ["large", "medium", "small"];
|
|
4
|
-
export declare const buttonVariants: readonly ["primary", "destructive", "secondary-fill", "secondary-invert", "secondary-ghost"];
|
|
4
|
+
export declare const buttonVariants: readonly ["primary", "destructive", "secondary-fill", "secondary-invert", "secondary-ghost", "upsell"];
|
|
5
5
|
export type ButtonSizes = (typeof buttonSizes)[number];
|
|
6
6
|
export type ButtonVariants = (typeof buttonVariants)[number];
|
|
7
7
|
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const buttonSizes = ["large", "medium", "small"];
|
|
2
|
-
const buttonVariants = ["primary", "destructive", "secondary-fill", "secondary-invert", "secondary-ghost"];
|
|
2
|
+
const buttonVariants = ["primary", "destructive", "secondary-fill", "secondary-invert", "secondary-ghost", "upsell"];
|
|
3
3
|
export {
|
|
4
4
|
buttonSizes,
|
|
5
5
|
buttonVariants
|
package/dist/Chip/Chip.cjs
CHANGED
|
@@ -7,6 +7,7 @@ const Title = require("./components/Title/Title.cjs");
|
|
|
7
7
|
const Chip = Object.assign(({
|
|
8
8
|
text,
|
|
9
9
|
onClose,
|
|
10
|
+
closeButtonTitle,
|
|
10
11
|
...restProps
|
|
11
12
|
}) => {
|
|
12
13
|
return jsxRuntime.jsxRuntimeExports.jsxs(Chip.Compose, {
|
|
@@ -14,7 +15,8 @@ const Chip = Object.assign(({
|
|
|
14
15
|
children: [jsxRuntime.jsxRuntimeExports.jsx(Chip.Title, {
|
|
15
16
|
children: text
|
|
16
17
|
}), jsxRuntime.jsxRuntimeExports.jsx(Chip.CloseButton, {
|
|
17
|
-
onClose
|
|
18
|
+
onClose,
|
|
19
|
+
title: closeButtonTitle
|
|
18
20
|
})]
|
|
19
21
|
});
|
|
20
22
|
}, {
|
package/dist/Chip/Chip.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ChipProps } from './Chip.types';
|
|
3
|
-
declare const Chip: (({ text, onClose, ...restProps }: ChipProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
|
+
declare const Chip: (({ text, onClose, closeButtonTitle, ...restProps }: ChipProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
4
|
Compose: ({ size, variant, disabled, tooltip, ...restProps }: import("..").ComposeChildrenProps & Omit<import("react").HTMLAttributes<HTMLSpanElement>, "content" | "children"> & import("./components/Compose/Compose.types").ChipComposeProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
Title: ({ size, ...restProps }: import("..").TypographyBodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
CloseButton: ({ onClose, icon: Icon, ...restProps }: Pick<import("react").HTMLAttributes<HTMLElement>, "style" | "className"> & {
|
|
6
|
+
CloseButton: ({ onClose, icon: Icon, title, ...restProps }: Pick<import("react").HTMLAttributes<HTMLElement>, "style" | "title" | "className"> & {
|
|
7
7
|
icon?: import("@redislabsdev/redis-ui-icons/monochrome").IconType | undefined;
|
|
8
8
|
} & import("./components/CloseButton/CloseButton.types").ChipCloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
9
|
};
|
package/dist/Chip/Chip.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Title } from "./components/Title/Title.js";
|
|
|
5
5
|
const Chip = Object.assign(({
|
|
6
6
|
text,
|
|
7
7
|
onClose,
|
|
8
|
+
closeButtonTitle,
|
|
8
9
|
...restProps
|
|
9
10
|
}) => {
|
|
10
11
|
return jsxRuntimeExports.jsxs(Chip.Compose, {
|
|
@@ -12,7 +13,8 @@ const Chip = Object.assign(({
|
|
|
12
13
|
children: [jsxRuntimeExports.jsx(Chip.Title, {
|
|
13
14
|
children: text
|
|
14
15
|
}), jsxRuntimeExports.jsx(Chip.CloseButton, {
|
|
15
|
-
onClose
|
|
16
|
+
onClose,
|
|
17
|
+
title: closeButtonTitle
|
|
16
18
|
})]
|
|
17
19
|
});
|
|
18
20
|
}, {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ChipComposeProps, RestChipComposeProps } from './components/Compose/Compose.types';
|
|
2
2
|
import type { ChipCloseButtonProps } from './components/CloseButton/CloseButton.types';
|
|
3
|
-
import type { ChildFree } from '../Helpers
|
|
3
|
+
import type { ChildFree } from '../Helpers';
|
|
4
4
|
export interface ChipProps extends ChipComposeProps, ChildFree<RestChipComposeProps>, ChipCloseButtonProps {
|
|
5
5
|
text: string;
|
|
6
|
+
closeButtonTitle?: string;
|
|
6
7
|
}
|
|
7
8
|
export type ChipSizes = 'M' | 'S';
|
|
8
9
|
export type ChipVariants = 'regular' | 'flat';
|
|
@@ -11,6 +11,7 @@ const sizeMapper = {
|
|
|
11
11
|
const CloseButton = ({
|
|
12
12
|
onClose,
|
|
13
13
|
icon: Icon = redisUiIcons.ToastCancelIcon,
|
|
14
|
+
title = "Remove",
|
|
14
15
|
...restProps
|
|
15
16
|
}) => {
|
|
16
17
|
const {
|
|
@@ -29,7 +30,7 @@ const CloseButton = ({
|
|
|
29
30
|
onClick: handleRemoveChip,
|
|
30
31
|
"$size": size,
|
|
31
32
|
"$variant": variant,
|
|
32
|
-
title
|
|
33
|
+
title,
|
|
33
34
|
...restProps,
|
|
34
35
|
children: jsxRuntime.jsxRuntimeExports.jsx(Icon, {
|
|
35
36
|
size: sizeMapper[size],
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { ChipCloseButtonProps, RestChipCloseButtonProps } from './CloseButton.types';
|
|
2
|
-
export declare const CloseButton: ({ onClose, icon: Icon, ...restProps }: RestChipCloseButtonProps & ChipCloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
2
|
+
export declare const CloseButton: ({ onClose, icon: Icon, title, ...restProps }: RestChipCloseButtonProps & ChipCloseButtonProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -9,6 +9,7 @@ const sizeMapper = {
|
|
|
9
9
|
const CloseButton = ({
|
|
10
10
|
onClose,
|
|
11
11
|
icon: Icon = ToastCancelIcon,
|
|
12
|
+
title = "Remove",
|
|
12
13
|
...restProps
|
|
13
14
|
}) => {
|
|
14
15
|
const {
|
|
@@ -27,7 +28,7 @@ const CloseButton = ({
|
|
|
27
28
|
onClick: handleRemoveChip,
|
|
28
29
|
"$size": size,
|
|
29
30
|
"$variant": variant,
|
|
30
|
-
title
|
|
31
|
+
title,
|
|
31
32
|
...restProps,
|
|
32
33
|
children: jsxRuntimeExports.jsx(Icon, {
|
|
33
34
|
size: sizeMapper[size],
|
|
@@ -3,6 +3,6 @@ import { IconType } from '@redislabsdev/redis-ui-icons';
|
|
|
3
3
|
export type ChipCloseButtonProps = {
|
|
4
4
|
onClose?: VoidFunction;
|
|
5
5
|
};
|
|
6
|
-
export type RestChipCloseButtonProps = Pick<HTMLAttributes<HTMLElement>, 'className' | 'style'> & {
|
|
6
|
+
export type RestChipCloseButtonProps = Pick<HTMLAttributes<HTMLElement>, 'className' | 'style' | 'title'> & {
|
|
7
7
|
icon?: IconType;
|
|
8
8
|
};
|
|
@@ -7,6 +7,7 @@ const ChipList_style = require("./ChipList.style.cjs");
|
|
|
7
7
|
const ChipList = ({
|
|
8
8
|
chips,
|
|
9
9
|
onRemoveItem,
|
|
10
|
+
removeItemButtonTitle,
|
|
10
11
|
maxRows = 1,
|
|
11
12
|
size = "M",
|
|
12
13
|
variant,
|
|
@@ -28,6 +29,7 @@ const ChipList = ({
|
|
|
28
29
|
children: chips.map((item) => jsxRuntime.jsxRuntimeExports.jsx(Chip.default, {
|
|
29
30
|
text: item.label,
|
|
30
31
|
onClose: onRemoveItem ? () => onRemoveItem(item.key) : void 0,
|
|
32
|
+
closeButtonTitle: removeItemButtonTitle,
|
|
31
33
|
tooltip: item.tooltip,
|
|
32
34
|
size,
|
|
33
35
|
variant,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ChipListProps } from './ChipList.types';
|
|
2
|
-
declare const ChipList: ({ chips, onRemoveItem, maxRows, size, variant, disabled, renderExtraTooltip, ...restProps }: ChipListProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const ChipList: ({ chips, onRemoveItem, removeItemButtonTitle, maxRows, size, variant, disabled, renderExtraTooltip, ...restProps }: ChipListProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default ChipList;
|
|
@@ -5,6 +5,7 @@ import { ChipListOverflow } from "./ChipList.style.js";
|
|
|
5
5
|
const ChipList = ({
|
|
6
6
|
chips,
|
|
7
7
|
onRemoveItem,
|
|
8
|
+
removeItemButtonTitle,
|
|
8
9
|
maxRows = 1,
|
|
9
10
|
size = "M",
|
|
10
11
|
variant,
|
|
@@ -26,6 +27,7 @@ const ChipList = ({
|
|
|
26
27
|
children: chips.map((item) => jsxRuntimeExports.jsx(Chip, {
|
|
27
28
|
text: item.label,
|
|
28
29
|
onClose: onRemoveItem ? () => onRemoveItem(item.key) : void 0,
|
|
30
|
+
closeButtonTitle: removeItemButtonTitle,
|
|
29
31
|
tooltip: item.tooltip,
|
|
30
32
|
size,
|
|
31
33
|
variant,
|
|
@@ -10,6 +10,7 @@ export interface ChipItem extends HTMLAttributes<HTMLSpanElement> {
|
|
|
10
10
|
export interface ChipListProps {
|
|
11
11
|
chips: ChipItem[];
|
|
12
12
|
onRemoveItem?: (chip: string) => void;
|
|
13
|
+
removeItemButtonTitle?: string;
|
|
13
14
|
maxRows?: number;
|
|
14
15
|
size?: ChipSizes;
|
|
15
16
|
variant?: ChipVariants;
|
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const React = require("react");
|
|
4
3
|
const jsxRuntime = require("../node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const React = require("react");
|
|
5
5
|
const Item = require("./components/Item/Item.cjs");
|
|
6
6
|
const Compose = require("./components/Compose/Compose.cjs");
|
|
7
|
-
const Label = require("../Label/Label.cjs");
|
|
8
7
|
const RadioGroup = Object.assign(({
|
|
9
|
-
label,
|
|
10
|
-
required = false,
|
|
11
|
-
optional = false,
|
|
12
|
-
infoIconProps,
|
|
13
|
-
initialValue,
|
|
14
|
-
defaultValue = initialValue,
|
|
15
8
|
items,
|
|
16
|
-
children,
|
|
17
9
|
...restProps
|
|
18
|
-
}) => jsxRuntime.jsxRuntimeExports.
|
|
19
|
-
defaultValue,
|
|
10
|
+
}) => jsxRuntime.jsxRuntimeExports.jsx(RadioGroup.Compose, {
|
|
20
11
|
...restProps,
|
|
21
|
-
children:
|
|
22
|
-
label,
|
|
23
|
-
infoIconProps,
|
|
24
|
-
required,
|
|
25
|
-
optional
|
|
26
|
-
}), items ? items.map((item) => React.createElement(RadioGroup.Item, {
|
|
12
|
+
children: items.map((item) => React.createElement(RadioGroup.Item, {
|
|
27
13
|
...item,
|
|
28
14
|
key: item.value
|
|
29
|
-
}))
|
|
15
|
+
}))
|
|
30
16
|
}), {
|
|
31
17
|
Compose: Compose.Compose,
|
|
32
|
-
Item: Item.default
|
|
33
|
-
/**
|
|
34
|
-
* @deprecated use global `Label` or `FormField` instead
|
|
35
|
-
*/
|
|
36
|
-
Label: Label.default
|
|
18
|
+
Item: Item.default
|
|
37
19
|
});
|
|
38
20
|
const RadioGroup$1 = RadioGroup;
|
|
39
21
|
exports.default = RadioGroup$1;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { RadioGroupProps, RestRadioGroupProps } from './RadioGroup.types';
|
|
3
|
-
declare const RadioGroup: (({
|
|
4
|
-
Compose: ({ id, onChange, disabled, layout, readOnly, ...restProps }: Pick<import("@radix-ui/react-radio-group").RadioGroupProps, "defaultValue" | "disabled" | "value"> & {
|
|
2
|
+
declare const RadioGroup: (({ items, ...restProps }: RestRadioGroupProps & RadioGroupProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
3
|
+
Compose: ({ id, onChange, value: valueProp, defaultValue, disabled, layout, readOnly, ...restProps }: Pick<import("@radix-ui/react-radio-group").RadioGroupProps, "defaultValue" | "disabled" | "value"> & {
|
|
5
4
|
onChange?: ((value: string) => void) | undefined;
|
|
6
5
|
layout?: "horizontal" | "vertical" | undefined;
|
|
7
6
|
readOnly?: boolean | undefined;
|
|
@@ -11,17 +10,5 @@ declare const RadioGroup: (({ label, required, optional, infoIconProps, initialV
|
|
|
11
10
|
Indicator: ({ ...restProps }: import("./components/Item/components/Indicator/Indicator.types").IndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
11
|
Label: ({ children, ...restProps }: import("./components/Item/components/Label/Label.types").LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
12
|
};
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated use global `Label` or `FormField` instead
|
|
16
|
-
*/
|
|
17
|
-
Label: (({ label, infoIconProps, required, optional, readOnly, ...restProps }: import("../Label").LabelProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
18
|
-
Text: ({ children, readOnly, ...restProps }: import("../Label/components/Text/Text.types").TextProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
InfoIcon: ({ size, text, content, ...tooltipProps }: import("../Label/components/InfoIcon/InfoIcon.types").InfoIconProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
Required: ({ children, show, size, ...restProps }: import("../Label/components/Required/Required.types").RequiredProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
21
|
-
Optional: ({ children, show, size, ...restProps }: import("../Label/components/Optional/Optional.types").OptionalProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
22
|
-
Compose: ({ htmlFor, show, ...props }: import("react").LabelHTMLAttributes<HTMLLabelElement> & {
|
|
23
|
-
show?: boolean | undefined;
|
|
24
|
-
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
25
|
-
};
|
|
26
13
|
};
|
|
27
14
|
export default RadioGroup;
|
|
@@ -1,37 +1,19 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
import { j as jsxRuntimeExports } from "../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { createElement } from "react";
|
|
3
3
|
import Item from "./components/Item/Item.js";
|
|
4
4
|
import { Compose } from "./components/Compose/Compose.js";
|
|
5
|
-
import Label from "../Label/Label.js";
|
|
6
5
|
const RadioGroup = Object.assign(({
|
|
7
|
-
label,
|
|
8
|
-
required = false,
|
|
9
|
-
optional = false,
|
|
10
|
-
infoIconProps,
|
|
11
|
-
initialValue,
|
|
12
|
-
defaultValue = initialValue,
|
|
13
6
|
items,
|
|
14
|
-
children,
|
|
15
7
|
...restProps
|
|
16
|
-
}) => jsxRuntimeExports.
|
|
17
|
-
defaultValue,
|
|
8
|
+
}) => jsxRuntimeExports.jsx(RadioGroup.Compose, {
|
|
18
9
|
...restProps,
|
|
19
|
-
children:
|
|
20
|
-
label,
|
|
21
|
-
infoIconProps,
|
|
22
|
-
required,
|
|
23
|
-
optional
|
|
24
|
-
}), items ? items.map((item) => createElement(RadioGroup.Item, {
|
|
10
|
+
children: items.map((item) => createElement(RadioGroup.Item, {
|
|
25
11
|
...item,
|
|
26
12
|
key: item.value
|
|
27
|
-
}))
|
|
13
|
+
}))
|
|
28
14
|
}), {
|
|
29
15
|
Compose,
|
|
30
|
-
Item
|
|
31
|
-
/**
|
|
32
|
-
* @deprecated use global `Label` or `FormField` instead
|
|
33
|
-
*/
|
|
34
|
-
Label
|
|
16
|
+
Item
|
|
35
17
|
});
|
|
36
18
|
const RadioGroup$1 = RadioGroup;
|
|
37
19
|
export {
|
|
@@ -1,32 +1,6 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { InfoIconProps } from '../Label/components/InfoIcon/InfoIcon.types';
|
|
3
1
|
import { RadioGroupComposeProps, RestRadioGroupComposeProps } from './components/Compose/Compose.types';
|
|
4
2
|
export interface RadioGroupProps extends RadioGroupComposeProps {
|
|
5
|
-
items
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated use `defaultValue` instead
|
|
8
|
-
*/
|
|
9
|
-
initialValue?: string;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated use global `Label` or `FormField` instead
|
|
12
|
-
*/
|
|
13
|
-
label?: string;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated use global `Label` or `FormField` instead
|
|
16
|
-
*/
|
|
17
|
-
infoIconProps?: InfoIconProps;
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated use global `Label` or `FormField` instead
|
|
20
|
-
*/
|
|
21
|
-
required?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated use global `Label` or `FormField` instead
|
|
24
|
-
*/
|
|
25
|
-
optional?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* @deprecated use `items` prop or `Compose` with `children` instead
|
|
28
|
-
*/
|
|
29
|
-
children?: ReactNode;
|
|
3
|
+
items: RadioGroupItem[];
|
|
30
4
|
}
|
|
31
5
|
export type RestRadioGroupProps = Omit<RestRadioGroupComposeProps, 'children'>;
|
|
32
6
|
export type RadioGroupItem = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("../../../node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const index = require("../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs");
|
|
4
5
|
const Compose_style = require("./Compose.style.cjs");
|
|
5
6
|
const Field_context = require("../../../Inputs/components/Context/Field.context.cjs");
|
|
6
7
|
const SharedId_context = require("../../../Helpers/contexts/SharedId.context.cjs");
|
|
@@ -8,22 +9,32 @@ const FormField_context = require("../../../FormField/FormField.context.cjs");
|
|
|
8
9
|
const Compose = ({
|
|
9
10
|
id,
|
|
10
11
|
onChange,
|
|
12
|
+
value: valueProp,
|
|
13
|
+
defaultValue,
|
|
11
14
|
disabled,
|
|
12
15
|
layout,
|
|
13
16
|
readOnly,
|
|
14
17
|
...restProps
|
|
15
|
-
}) =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
}) => {
|
|
19
|
+
const [value = "", setValue] = index.useControllableState({
|
|
20
|
+
prop: valueProp,
|
|
21
|
+
defaultProp: defaultValue,
|
|
22
|
+
onChange
|
|
23
|
+
});
|
|
24
|
+
return jsxRuntime.jsxRuntimeExports.jsx(SharedId_context.SharedIdTransProvider, {
|
|
25
|
+
customId: id,
|
|
26
|
+
children: jsxRuntime.jsxRuntimeExports.jsx(FormField_context.FieldReadonlyTransProvider, {
|
|
27
|
+
value: readOnly,
|
|
28
|
+
children: jsxRuntime.jsxRuntimeExports.jsx(Field_context.FieldDisabledTransProvider, {
|
|
29
|
+
value: disabled,
|
|
30
|
+
children: jsxRuntime.jsxRuntimeExports.jsx(Compose_style.RadioGroupCompose, {
|
|
31
|
+
onValueChange: readOnly ? void 0 : setValue,
|
|
32
|
+
value,
|
|
33
|
+
orientation: layout,
|
|
34
|
+
...restProps
|
|
35
|
+
})
|
|
25
36
|
})
|
|
26
37
|
})
|
|
27
|
-
})
|
|
28
|
-
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
29
40
|
exports.Compose = Compose;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { RadioGroupComposeProps, RestRadioGroupComposeProps } from './Compose.types';
|
|
2
|
-
export declare const Compose: ({ id, onChange, disabled, layout, readOnly, ...restProps }: RadioGroupComposeProps & RestRadioGroupComposeProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const Compose: ({ id, onChange, value: valueProp, defaultValue, disabled, layout, readOnly, ...restProps }: RadioGroupComposeProps & RestRadioGroupComposeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../../node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { useControllableState } from "../../../node_modules/@radix-ui/react-use-controllable-state/dist/index.js";
|
|
2
3
|
import { RadioGroupCompose } from "./Compose.style.js";
|
|
3
4
|
import { FieldDisabledTransProvider } from "../../../Inputs/components/Context/Field.context.js";
|
|
4
5
|
import { SharedIdTransProvider } from "../../../Helpers/contexts/SharedId.context.js";
|
|
@@ -6,24 +7,34 @@ import { FieldReadonlyTransProvider } from "../../../FormField/FormField.context
|
|
|
6
7
|
const Compose = ({
|
|
7
8
|
id,
|
|
8
9
|
onChange,
|
|
10
|
+
value: valueProp,
|
|
11
|
+
defaultValue,
|
|
9
12
|
disabled,
|
|
10
13
|
layout,
|
|
11
14
|
readOnly,
|
|
12
15
|
...restProps
|
|
13
|
-
}) =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
}) => {
|
|
17
|
+
const [value = "", setValue] = useControllableState({
|
|
18
|
+
prop: valueProp,
|
|
19
|
+
defaultProp: defaultValue,
|
|
20
|
+
onChange
|
|
21
|
+
});
|
|
22
|
+
return jsxRuntimeExports.jsx(SharedIdTransProvider, {
|
|
23
|
+
customId: id,
|
|
24
|
+
children: jsxRuntimeExports.jsx(FieldReadonlyTransProvider, {
|
|
25
|
+
value: readOnly,
|
|
26
|
+
children: jsxRuntimeExports.jsx(FieldDisabledTransProvider, {
|
|
27
|
+
value: disabled,
|
|
28
|
+
children: jsxRuntimeExports.jsx(RadioGroupCompose, {
|
|
29
|
+
onValueChange: readOnly ? void 0 : setValue,
|
|
30
|
+
value,
|
|
31
|
+
orientation: layout,
|
|
32
|
+
...restProps
|
|
33
|
+
})
|
|
23
34
|
})
|
|
24
35
|
})
|
|
25
|
-
})
|
|
26
|
-
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
27
38
|
export {
|
|
28
39
|
Compose
|
|
29
40
|
};
|
|
@@ -9,7 +9,9 @@ const SharedId_context = require("../../../Helpers/contexts/SharedId.context.cjs
|
|
|
9
9
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
10
|
const _styled__default = /* @__PURE__ */ _interopDefault(_styled);
|
|
11
11
|
const RadioGroupCompose = _styled__default.default(index.Root).attrs(() => ({
|
|
12
|
-
|
|
12
|
+
...FormField_context.useFieldReadonly() ? {
|
|
13
|
+
tabIndex: -1
|
|
14
|
+
} : null,
|
|
13
15
|
disabled: Field_context.useFieldDisabled() ? true : void 0,
|
|
14
16
|
id: SharedId_context.useSharedId()
|
|
15
17
|
})).withConfig({
|
|
@@ -5,7 +5,9 @@ import { useFieldReadonly } from "../../../FormField/FormField.context.js";
|
|
|
5
5
|
import { useFieldDisabled } from "../../../Inputs/components/Context/Field.context.js";
|
|
6
6
|
import { useSharedId } from "../../../Helpers/contexts/SharedId.context.js";
|
|
7
7
|
const RadioGroupCompose = _styled(Root2).attrs(() => ({
|
|
8
|
-
|
|
8
|
+
...useFieldReadonly() ? {
|
|
9
|
+
tabIndex: -1
|
|
10
|
+
} : null,
|
|
9
11
|
disabled: useFieldDisabled() ? true : void 0,
|
|
10
12
|
id: useSharedId()
|
|
11
13
|
})).withConfig({
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
throw new Error(`Item compound components cannot be rendered outside the Item component`);
|
|
9
|
-
}
|
|
10
|
-
return itemContext;
|
|
11
|
-
}
|
|
12
|
-
exports.ItemContext = ItemContext;
|
|
3
|
+
const NullableContext = require("../../../Helpers/contexts/NullableContext.cjs");
|
|
4
|
+
const [useItemContext, ItemContextProvider] = NullableContext.createNullableContext({
|
|
5
|
+
forComponentName: "RadioGroupItem"
|
|
6
|
+
});
|
|
7
|
+
exports.ItemContextProvider = ItemContextProvider;
|
|
13
8
|
exports.useItemContext = useItemContext;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ItemContextType } from './components/Compose/Compose.types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare function useItemContext(): ItemContextType;
|
|
3
|
+
export declare const useItemContext: () => ItemContextType, ItemContextProvider: import("react").Provider<ItemContextType>;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!itemContext) {
|
|
6
|
-
throw new Error(`Item compound components cannot be rendered outside the Item component`);
|
|
7
|
-
}
|
|
8
|
-
return itemContext;
|
|
9
|
-
}
|
|
1
|
+
import { createNullableContext } from "../../../Helpers/contexts/NullableContext.js";
|
|
2
|
+
const [useItemContext, ItemContextProvider] = createNullableContext({
|
|
3
|
+
forComponentName: "RadioGroupItem"
|
|
4
|
+
});
|
|
10
5
|
export {
|
|
11
|
-
|
|
6
|
+
ItemContextProvider,
|
|
12
7
|
useItemContext
|
|
13
8
|
};
|
|
@@ -18,7 +18,7 @@ const Compose = ({
|
|
|
18
18
|
}), [value, disabled]);
|
|
19
19
|
return jsxRuntime.jsxRuntimeExports.jsx(SharedId_context.SharedIdProvider, {
|
|
20
20
|
customId: id,
|
|
21
|
-
children: jsxRuntime.jsxRuntimeExports.jsx(Item_context.
|
|
21
|
+
children: jsxRuntime.jsxRuntimeExports.jsx(Item_context.ItemContextProvider, {
|
|
22
22
|
value: contextValue,
|
|
23
23
|
children: jsxRuntime.jsxRuntimeExports.jsx(Compose_style.RadioGroupItemCompose, {
|
|
24
24
|
...restProps,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../../../../node_modules/react/jsx-runtime.js";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { ItemContextProvider } from "../../Item.context.js";
|
|
4
4
|
import { RadioGroupItemCompose } from "./Compose.style.js";
|
|
5
5
|
import { SharedIdProvider } from "../../../../../Helpers/contexts/SharedId.context.js";
|
|
6
6
|
const Compose = ({
|
|
@@ -16,7 +16,7 @@ const Compose = ({
|
|
|
16
16
|
}), [value, disabled]);
|
|
17
17
|
return jsxRuntimeExports.jsx(SharedIdProvider, {
|
|
18
18
|
customId: id,
|
|
19
|
-
children: jsxRuntimeExports.jsx(
|
|
19
|
+
children: jsxRuntimeExports.jsx(ItemContextProvider, {
|
|
20
20
|
value: contextValue,
|
|
21
21
|
children: jsxRuntimeExports.jsx(RadioGroupItemCompose, {
|
|
22
22
|
...restProps,
|
|
@@ -17,7 +17,9 @@ const Indicator = ({
|
|
|
17
17
|
disabled,
|
|
18
18
|
id: SharedId_context.useSharedId(),
|
|
19
19
|
...restProps,
|
|
20
|
-
|
|
20
|
+
...FormField_context.useFieldReadonly() ? {
|
|
21
|
+
tabIndex: -1
|
|
22
|
+
} : null,
|
|
21
23
|
children: jsxRuntime.jsxRuntimeExports.jsx(Indicator_style.RadioGroupItemIndicatorCheck, {})
|
|
22
24
|
});
|
|
23
25
|
};
|
|
@@ -15,7 +15,9 @@ const Indicator = ({
|
|
|
15
15
|
disabled,
|
|
16
16
|
id: useSharedId(),
|
|
17
17
|
...restProps,
|
|
18
|
-
|
|
18
|
+
...useFieldReadonly() ? {
|
|
19
|
+
tabIndex: -1
|
|
20
|
+
} : null,
|
|
19
21
|
children: jsxRuntimeExports.jsx(RadioGroupItemIndicatorCheck, {})
|
|
20
22
|
});
|
|
21
23
|
};
|