@ultraviolet/ui 3.7.1 → 3.8.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/components/Alert/styles.css.d.ts +1 -1
- package/dist/components/Avatar/index.d.ts.map +1 -1
- package/dist/components/Avatar/index.js +45 -41
- package/dist/components/Avatar/styles.css.js +1 -0
- package/dist/components/Avatar/variables.css.js +0 -1
- package/dist/components/Banner/index.d.ts.map +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Banner/styles.css.d.ts +1 -1
- package/dist/components/BarStack/styles.css.js +1 -1
- package/dist/components/Button/index.d.ts +41 -22
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +18 -10
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.js +44 -38
- package/dist/components/Chip/index.d.ts +1 -1
- package/dist/components/DateInput/helpersLocale.d.ts.map +1 -1
- package/dist/components/DateInput/helpersLocale.js +8 -5
- package/dist/components/Dialog/constants.d.ts +1 -1
- package/dist/components/Dialog/index.d.ts +20 -5
- package/dist/components/Dialog/index.d.ts.map +1 -1
- package/dist/components/Drawer/styles.css.d.ts +1 -1
- package/dist/components/EmptyState/index.d.ts.map +1 -1
- package/dist/components/EmptyState/index.js +10 -1
- package/dist/components/EmptyState/styles.css.d.ts +1 -1
- package/dist/components/ExpandableCard/index.d.ts.map +1 -1
- package/dist/components/ExpandableCard/index.js +28 -20
- package/dist/components/FileInput/components/List.d.ts.map +1 -1
- package/dist/components/FileInput/components/List.js +15 -2
- package/dist/components/FileInput/index.d.ts.map +1 -1
- package/dist/components/GlobalAlert/GlobalAlertLink.d.ts +3 -1
- package/dist/components/GlobalAlert/GlobalAlertLink.d.ts.map +1 -1
- package/dist/components/GlobalAlert/index.d.ts +61 -1
- package/dist/components/GlobalAlert/index.d.ts.map +1 -1
- package/dist/components/Link/index.d.ts +23 -2
- package/dist/components/Link/index.d.ts.map +1 -1
- package/dist/components/Link/index.js +26 -14
- package/dist/components/List/HeaderCell.d.ts.map +1 -1
- package/dist/components/List/HeaderCell.js +3 -1
- package/dist/components/List/ListContext.d.ts.map +1 -1
- package/dist/components/List/ListContext.js +3 -1
- package/dist/components/List/Row.d.ts.map +1 -1
- package/dist/components/List/Row.js +14 -5
- package/dist/components/List/SkeletonRows.d.ts.map +1 -1
- package/dist/components/List/SkeletonRows.js +0 -1
- package/dist/components/List/styles.css.d.ts +1 -0
- package/dist/components/List/styles.css.d.ts.map +1 -1
- package/dist/components/List/styles.css.js +3 -1
- package/dist/components/List/variables.css.js +1 -1
- package/dist/components/Menu/helpers.d.ts +1 -1
- package/dist/components/Menu/index.d.ts +1 -1
- package/dist/components/Meter/index.d.ts.map +1 -1
- package/dist/components/Meter/index.js +43 -40
- package/dist/components/Modal/components/Dialog.d.ts.map +1 -1
- package/dist/components/Modal/components/Dialog.js +10 -1
- package/dist/components/NumberInput/styles.css.d.ts +1 -1
- package/dist/components/Pagination/styles.css.d.ts +2 -2
- package/dist/components/ProgressBar/styles.css.d.ts +1 -1
- package/dist/components/Radio/index.js +22 -22
- package/dist/components/Row/styles.css.d.ts +44 -44
- package/dist/components/SelectInput/components/Dropdown.d.ts.map +1 -1
- package/dist/components/SelectInput/components/Dropdown.js +52 -56
- package/dist/components/SelectInput/components/selectBar.css.d.ts +1 -1
- package/dist/components/SelectableCard/IllustrationContainer.d.ts +8 -0
- package/dist/components/SelectableCard/IllustrationContainer.d.ts.map +1 -0
- package/dist/components/SelectableCard/IllustrationContainer.js +66 -0
- package/dist/components/SelectableCard/MultiStateInput.d.ts +3 -0
- package/dist/components/SelectableCard/MultiStateInput.d.ts.map +1 -0
- package/dist/components/SelectableCard/MultiStateInput.js +94 -0
- package/dist/components/SelectableCard/SelectableCard.d.ts +7 -0
- package/dist/components/SelectableCard/SelectableCard.d.ts.map +1 -0
- package/dist/components/SelectableCard/SelectableCard.js +165 -0
- package/dist/components/SelectableCard/index.d.ts +1 -33
- package/dist/components/SelectableCard/index.d.ts.map +1 -1
- package/dist/components/SelectableCard/types.d.ts +32 -0
- package/dist/components/SelectableCard/types.d.ts.map +1 -0
- package/dist/components/SelectableCardGroup/index.js +1 -1
- package/dist/components/SelectableCardOptionGroup/components/Option.js +1 -1
- package/dist/components/Separator/index.d.ts.map +1 -1
- package/dist/components/Separator/index.js +1 -0
- package/dist/components/Skeleton/Donut.d.ts.map +1 -1
- package/dist/components/Skeleton/Donut.js +12 -9
- package/dist/components/Slider/styles.css.d.ts +1 -1
- package/dist/components/Stack/styles.css.d.ts +46 -46
- package/dist/components/Stepper/styles.css.d.ts +1 -1
- package/dist/components/SwitchButton/Option.js +1 -1
- package/dist/components/SwitchButton/index.d.ts.map +1 -1
- package/dist/components/SwitchButton/index.js +7 -4
- package/dist/components/SwitchButton/styles.css.d.ts +2 -2
- package/dist/components/SwitchButton/styles.css.d.ts.map +1 -1
- package/dist/components/Table/HeaderRow.d.ts.map +1 -1
- package/dist/components/Table/HeaderRow.js +22 -25
- package/dist/components/Table/SkeletonRows.d.ts.map +1 -1
- package/dist/components/Table/SkeletonRows.js +4 -13
- package/dist/components/Tabs/index.d.ts +2 -2
- package/dist/components/TextInput/index.d.ts.map +1 -1
- package/dist/components/TextInput/index.js +6 -1
- package/dist/components/TextInput/styles.css.d.ts +1 -1
- package/dist/components/TextInput/styles.css.d.ts.map +1 -1
- package/dist/components/Toggle/index.d.ts +2 -7
- package/dist/components/Toggle/index.d.ts.map +1 -1
- package/dist/components/Toggle/index.js +13 -1
- package/dist/components/Tooltip/index.d.ts +1 -1
- package/dist/components/UnitInput/index.d.ts.map +1 -1
- package/dist/components/UnitInput/index.js +2 -1
- package/dist/components/UnitInput/styles.css.d.ts +2 -2
- package/dist/components/VerificationCode/styles.css.d.ts +1 -1
- package/dist/components/compositions/OptionSelector/__mock__/resources.d.ts.map +1 -1
- package/dist/components/compositions/OptionSelector/index.js +1 -1
- package/dist/index.js +3 -2
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +46 -4
- package/dist/theme/index.d.ts +3 -2
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +1 -2
- package/dist/ui.css +1 -1
- package/package.json +2 -2
- package/dist/components/SelectableCard/index.js +0 -232
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const maxWidthTag: `var(--${string})`;
|
|
2
2
|
export declare const minWidthTag: `var(--${string})`;
|
|
3
|
-
export declare const selectbarState: Record<"
|
|
3
|
+
export declare const selectbarState: Record<"small" | "large", string>;
|
|
4
4
|
export declare const selectinputPlaceholder: string;
|
|
5
5
|
export declare const selectBarBase: string;
|
|
6
6
|
export declare const selectBar: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { SelectableCardProps } from './types';
|
|
3
|
+
export declare const IllustrationContainer: ({ children: subChildren, productIcon, illustration, }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
productIcon: SelectableCardProps["productIcon"];
|
|
6
|
+
illustration: SelectableCardProps["illustration"];
|
|
7
|
+
}) => string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
8
|
+
//# sourceMappingURL=IllustrationContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IllustrationContainer.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCard/IllustrationContainer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,eAAO,MAAM,qBAAqB,GAAI,uDAInC;IACD,QAAQ,EAAE,SAAS,CAAA;IACnB,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAA;IAC/C,YAAY,EAAE,mBAAmB,CAAC,cAAc,CAAC,CAAA;CAClD,4UAoEA,CAAA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as ProductIcon from "@ultraviolet/icons/product";
|
|
4
|
+
import { useTheme } from "@ultraviolet/themes";
|
|
5
|
+
import { useState, useEffect } from "react";
|
|
6
|
+
import { Stack } from "../Stack/index.js";
|
|
7
|
+
import { illustrationSelectableCard, divSelectableCard, imageSelectableCard } from "./styles.css.js";
|
|
8
|
+
const IllustrationContainer = ({
|
|
9
|
+
children: subChildren,
|
|
10
|
+
productIcon,
|
|
11
|
+
illustration
|
|
12
|
+
}) => {
|
|
13
|
+
const theme = useTheme();
|
|
14
|
+
const [svgContent, setSvgContent] = useState(null);
|
|
15
|
+
const ProductIconUsed = productIcon ? (
|
|
16
|
+
// biome-ignore lint/performance/noDynamicNamespaceImportAccess: to fix
|
|
17
|
+
ProductIcon[`${productIcon.charAt(0).toUpperCase() + productIcon.slice(1)}ProductIcon`]
|
|
18
|
+
) : null;
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (illustration?.endsWith(".svg")) {
|
|
21
|
+
fetch(illustration).then((response) => response.text()).then((svg) => {
|
|
22
|
+
const updatedSvg = svg.replace(
|
|
23
|
+
/fill="[^"]*"/g,
|
|
24
|
+
`fill="${theme.colors.neutral.backgroundStronger}"`
|
|
25
|
+
).replace(/width="[^"]*"/g, `width="220px"`).replace(/height="[^"]*"/g, `height="220px"`);
|
|
26
|
+
setSvgContent(updatedSvg);
|
|
27
|
+
}).catch(() => null);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
if (ProductIconUsed || illustration) {
|
|
31
|
+
return /* @__PURE__ */ jsxs(
|
|
32
|
+
Stack,
|
|
33
|
+
{
|
|
34
|
+
alignItems: "stretch",
|
|
35
|
+
direction: "row",
|
|
36
|
+
flex: 1,
|
|
37
|
+
justifyContent: "space-between",
|
|
38
|
+
width: "100%",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx(Stack, { className: illustrationSelectableCard, children: subChildren }),
|
|
41
|
+
/* @__PURE__ */ jsx(Stack, { justifyContent: "center", children: ProductIconUsed ? /* @__PURE__ */ jsx(ProductIconUsed, { size: "large" }) : null }),
|
|
42
|
+
illustration ? /* @__PURE__ */ jsx("div", { className: divSelectableCard, children: illustration.endsWith(".svg") && svgContent ? /* @__PURE__ */ jsx(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: imageSelectableCard,
|
|
46
|
+
dangerouslySetInnerHTML: { __html: svgContent }
|
|
47
|
+
}
|
|
48
|
+
) : /* @__PURE__ */ jsx(
|
|
49
|
+
"img",
|
|
50
|
+
{
|
|
51
|
+
alt: "illustration",
|
|
52
|
+
className: imageSelectableCard,
|
|
53
|
+
height: 220,
|
|
54
|
+
src: illustration,
|
|
55
|
+
width: 220
|
|
56
|
+
}
|
|
57
|
+
) }) : null
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return subChildren;
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
IllustrationContainer
|
|
66
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { MultiStateProps } from './types';
|
|
2
|
+
export declare const MultiStateInput: ({ checked, disabled, id, label, "aria-label": ariaLabel, innerRef, isError, name, onBlur, onChange, onFocus, type, value, }: MultiStateProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
//# sourceMappingURL=MultiStateInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiStateInput.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCard/MultiStateInput.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,eAAe,GAAI,6HAc7B,eAAe,mDA4EjB,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Checkbox } from "../Checkbox/index.js";
|
|
3
|
+
import { Radio } from "../Radio/index.js";
|
|
4
|
+
import { Toggle } from "../Toggle/index.js";
|
|
5
|
+
import { selectableElementSelectableCard } from "./styles.css.js";
|
|
6
|
+
const MultiStateInput = ({
|
|
7
|
+
checked,
|
|
8
|
+
disabled,
|
|
9
|
+
id,
|
|
10
|
+
label,
|
|
11
|
+
"aria-label": ariaLabel,
|
|
12
|
+
innerRef,
|
|
13
|
+
isError,
|
|
14
|
+
name,
|
|
15
|
+
onBlur,
|
|
16
|
+
onChange,
|
|
17
|
+
onFocus,
|
|
18
|
+
type,
|
|
19
|
+
value
|
|
20
|
+
}) => {
|
|
21
|
+
if (!type) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
if (type === "checkbox") {
|
|
25
|
+
const labelProps = label ? { "aria-label": void 0, children: label } : { "aria-label": ariaLabel };
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
Checkbox,
|
|
28
|
+
{
|
|
29
|
+
checked,
|
|
30
|
+
className: selectableElementSelectableCard,
|
|
31
|
+
"data-error": isError,
|
|
32
|
+
disabled,
|
|
33
|
+
error: isError,
|
|
34
|
+
id,
|
|
35
|
+
name,
|
|
36
|
+
onBlur,
|
|
37
|
+
onChange,
|
|
38
|
+
onFocus,
|
|
39
|
+
ref: innerRef,
|
|
40
|
+
tabIndex: -1,
|
|
41
|
+
value,
|
|
42
|
+
...labelProps
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
if (type === "radio") {
|
|
47
|
+
const labelProps = label ? { label } : { "aria-label": ariaLabel };
|
|
48
|
+
return /* @__PURE__ */ jsx(
|
|
49
|
+
Radio,
|
|
50
|
+
{
|
|
51
|
+
checked,
|
|
52
|
+
className: selectableElementSelectableCard,
|
|
53
|
+
"data-error": isError,
|
|
54
|
+
disabled,
|
|
55
|
+
error: isError,
|
|
56
|
+
id,
|
|
57
|
+
name,
|
|
58
|
+
onBlur,
|
|
59
|
+
onChange,
|
|
60
|
+
onFocus,
|
|
61
|
+
ref: innerRef,
|
|
62
|
+
tabIndex: -1,
|
|
63
|
+
value,
|
|
64
|
+
...labelProps
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
if (type === "toggle") {
|
|
69
|
+
const labelProps = label ? { label } : { "aria-label": ariaLabel };
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
Toggle,
|
|
72
|
+
{
|
|
73
|
+
checked,
|
|
74
|
+
className: selectableElementSelectableCard,
|
|
75
|
+
"data-error": isError,
|
|
76
|
+
disabled,
|
|
77
|
+
error: isError,
|
|
78
|
+
id,
|
|
79
|
+
name,
|
|
80
|
+
onBlur,
|
|
81
|
+
onChange,
|
|
82
|
+
onFocus,
|
|
83
|
+
ref: innerRef,
|
|
84
|
+
tabIndex: -1,
|
|
85
|
+
value,
|
|
86
|
+
...labelProps
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
return null;
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
MultiStateInput
|
|
94
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SelectableCardProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* SelectableCard is a component that can be used to create a radio or checkbox card.
|
|
4
|
+
* It can be used to create a list of selectable items or a single selectable item.
|
|
5
|
+
*/
|
|
6
|
+
export declare const SelectableCard: import("react").ForwardRefExoticComponent<SelectableCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
//# sourceMappingURL=SelectableCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectableCard.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCard/SelectableCard.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAGlD;;;GAGG;AACH,eAAO,MAAM,cAAc,gHAyL1B,CAAA"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "@ultraviolet/utils";
|
|
4
|
+
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
|
+
import { forwardRef, useRef, useMemo, useCallback } from "react";
|
|
6
|
+
import { Stack } from "../Stack/index.js";
|
|
7
|
+
import { Tooltip } from "../Tooltip/index.js";
|
|
8
|
+
import { IllustrationContainer } from "./IllustrationContainer.js";
|
|
9
|
+
import { MultiStateInput } from "./MultiStateInput.js";
|
|
10
|
+
import { stackSelectableCard, indentedCard, containerSelectableCard, labelContainerSelectableCardLabel, labelContainerSelectableCardNoLabel } from "./styles.css.js";
|
|
11
|
+
import { widthSelectable, labelDisplay, inputDisplay } from "./variables.css.js";
|
|
12
|
+
const SelectableCard = forwardRef(
|
|
13
|
+
({
|
|
14
|
+
name,
|
|
15
|
+
value,
|
|
16
|
+
onChange,
|
|
17
|
+
showTick = false,
|
|
18
|
+
type = "radio",
|
|
19
|
+
checked = false,
|
|
20
|
+
disabled = false,
|
|
21
|
+
children,
|
|
22
|
+
className,
|
|
23
|
+
isError,
|
|
24
|
+
onFocus,
|
|
25
|
+
onBlur,
|
|
26
|
+
tooltip,
|
|
27
|
+
id,
|
|
28
|
+
label,
|
|
29
|
+
"data-testid": dataTestId,
|
|
30
|
+
productIcon,
|
|
31
|
+
illustration,
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
style,
|
|
34
|
+
indented = true
|
|
35
|
+
}, ref) => {
|
|
36
|
+
const innerRef = useRef(null);
|
|
37
|
+
const childrenRef = useRef(null);
|
|
38
|
+
const image = useMemo(() => {
|
|
39
|
+
if (illustration) {
|
|
40
|
+
return "illustration";
|
|
41
|
+
}
|
|
42
|
+
if (productIcon) {
|
|
43
|
+
return "icon";
|
|
44
|
+
}
|
|
45
|
+
return "none";
|
|
46
|
+
}, [illustration, productIcon]);
|
|
47
|
+
const ParentContainer = useCallback(
|
|
48
|
+
({ children: subChildren }) => {
|
|
49
|
+
if (tooltip) {
|
|
50
|
+
return /* @__PURE__ */ jsx(Stack, { flex: 1, children: /* @__PURE__ */ jsx(Tooltip, { containerFullHeight: true, text: tooltip, children: subChildren }) });
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ jsx(Tooltip, { children: subChildren });
|
|
53
|
+
},
|
|
54
|
+
[tooltip]
|
|
55
|
+
);
|
|
56
|
+
const onKeyDown = useCallback(
|
|
57
|
+
(event) => {
|
|
58
|
+
if (event.key === " " && innerRef?.current) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
innerRef.current.click();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
[innerRef]
|
|
64
|
+
);
|
|
65
|
+
const isComplexChildren = ["function", "array", "object"].includes(
|
|
66
|
+
typeof children
|
|
67
|
+
);
|
|
68
|
+
const onClickContainer = useCallback(
|
|
69
|
+
(event) => {
|
|
70
|
+
if (innerRef.current && !disabled) {
|
|
71
|
+
const inputElement = innerRef.current;
|
|
72
|
+
const labelElement = document.querySelector(
|
|
73
|
+
`label[for="${inputElement.id}"]`
|
|
74
|
+
);
|
|
75
|
+
const targetNode = event.target;
|
|
76
|
+
if (!(inputElement.contains(targetNode) || labelElement?.contains(targetNode))) {
|
|
77
|
+
inputElement.click();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
[disabled]
|
|
82
|
+
);
|
|
83
|
+
return /* @__PURE__ */ jsx(ParentContainer, { children: /* @__PURE__ */ jsx(
|
|
84
|
+
Stack,
|
|
85
|
+
{
|
|
86
|
+
alignItems: "flex-start",
|
|
87
|
+
className: cn(
|
|
88
|
+
className,
|
|
89
|
+
containerSelectableCard({
|
|
90
|
+
cursor: (type === "checkbox" || type === "toggle") && isComplexChildren ? "default" : "custom",
|
|
91
|
+
image
|
|
92
|
+
}),
|
|
93
|
+
label ? labelContainerSelectableCardLabel : labelContainerSelectableCardNoLabel
|
|
94
|
+
),
|
|
95
|
+
"data-checked": checked,
|
|
96
|
+
"data-disabled": disabled,
|
|
97
|
+
"data-error": isError,
|
|
98
|
+
"data-testid": dataTestId,
|
|
99
|
+
"data-type": type,
|
|
100
|
+
direction: label ? "column" : "row",
|
|
101
|
+
flex: 1,
|
|
102
|
+
gap: 0.5,
|
|
103
|
+
onClick: (type === "checkbox" || type === "toggle") && isComplexChildren ? void 0 : onClickContainer,
|
|
104
|
+
onKeyDown,
|
|
105
|
+
ref,
|
|
106
|
+
role: "button",
|
|
107
|
+
style: {
|
|
108
|
+
...assignInlineVars({
|
|
109
|
+
[inputDisplay]: showTick ? "inline" : "none",
|
|
110
|
+
[labelDisplay]: showTick || label ? "inline" : "none",
|
|
111
|
+
[widthSelectable]: label ? "100%" : "auto"
|
|
112
|
+
}),
|
|
113
|
+
...style
|
|
114
|
+
},
|
|
115
|
+
tabIndex: disabled ? void 0 : 0,
|
|
116
|
+
children: /* @__PURE__ */ jsxs(
|
|
117
|
+
IllustrationContainer,
|
|
118
|
+
{
|
|
119
|
+
illustration,
|
|
120
|
+
productIcon,
|
|
121
|
+
children: [
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
MultiStateInput,
|
|
124
|
+
{
|
|
125
|
+
"aria-label": ariaLabel,
|
|
126
|
+
checked,
|
|
127
|
+
"data-error": isError,
|
|
128
|
+
disabled,
|
|
129
|
+
id,
|
|
130
|
+
innerRef,
|
|
131
|
+
isError,
|
|
132
|
+
label,
|
|
133
|
+
name,
|
|
134
|
+
onBlur,
|
|
135
|
+
onChange,
|
|
136
|
+
onFocus,
|
|
137
|
+
type,
|
|
138
|
+
value
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
children ? /* @__PURE__ */ jsx(
|
|
142
|
+
Stack,
|
|
143
|
+
{
|
|
144
|
+
className: cn(
|
|
145
|
+
stackSelectableCard,
|
|
146
|
+
!!label && showTick && indented ? indentedCard : void 0
|
|
147
|
+
),
|
|
148
|
+
"data-has-default-cursor": (type === "checkbox" || type === "toggle") && isComplexChildren,
|
|
149
|
+
"data-has-label": !!label && showTick,
|
|
150
|
+
onKeyDown: (event) => event.stopPropagation(),
|
|
151
|
+
ref: childrenRef,
|
|
152
|
+
width: "100%",
|
|
153
|
+
children: typeof children === "function" ? children({ checked, disabled }) : children
|
|
154
|
+
}
|
|
155
|
+
) : null
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
) });
|
|
161
|
+
}
|
|
162
|
+
);
|
|
163
|
+
export {
|
|
164
|
+
SelectableCard
|
|
165
|
+
};
|
|
@@ -1,34 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { ChangeEventHandler, CSSProperties, FocusEventHandler, ReactNode } from 'react';
|
|
3
|
-
import type { LabelProp, PascalToCamelCaseWithoutSuffix } from '../../types';
|
|
4
|
-
export type SelectableCardProps = {
|
|
5
|
-
name?: string;
|
|
6
|
-
children?: (({ disabled, checked, }: Pick<SelectableCardProps, 'checked' | 'disabled'>) => ReactNode) | ReactNode;
|
|
7
|
-
value: string | number;
|
|
8
|
-
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
9
|
-
showTick?: boolean;
|
|
10
|
-
type?: 'radio' | 'checkbox';
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
checked?: boolean;
|
|
13
|
-
className?: string;
|
|
14
|
-
isError?: boolean;
|
|
15
|
-
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
16
|
-
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
17
|
-
id?: string;
|
|
18
|
-
tooltip?: string;
|
|
19
|
-
'data-testid'?: string;
|
|
20
|
-
style?: CSSProperties;
|
|
21
|
-
indented?: boolean;
|
|
22
|
-
} & ({
|
|
23
|
-
illustration?: string;
|
|
24
|
-
productIcon?: never;
|
|
25
|
-
} | {
|
|
26
|
-
productIcon?: PascalToCamelCaseWithoutSuffix<keyof typeof ProductIcon, 'ProductIcon'>;
|
|
27
|
-
illustration?: never;
|
|
28
|
-
}) & LabelProp;
|
|
29
|
-
/**
|
|
30
|
-
* SelectableCard is a component that can be used to create a radio or checkbox card.
|
|
31
|
-
* It can be used to create a list of selectable items or a single selectable item.
|
|
32
|
-
*/
|
|
33
|
-
export declare const SelectableCard: import("react").ForwardRefExoticComponent<SelectableCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
1
|
+
export { SelectableCard } from './SelectableCard';
|
|
34
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCard/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type * as ProductIcon from '@ultraviolet/icons/product';
|
|
2
|
+
import type { ChangeEventHandler, CSSProperties, FocusEventHandler, ReactNode, RefObject } from 'react';
|
|
3
|
+
import type { LabelProp, PascalToCamelCaseWithoutSuffix } from '../../types';
|
|
4
|
+
export type SelectableCardProps = {
|
|
5
|
+
name?: string;
|
|
6
|
+
children?: (({ disabled, checked, }: Pick<SelectableCardProps, 'checked' | 'disabled'>) => ReactNode) | ReactNode;
|
|
7
|
+
value: string | number;
|
|
8
|
+
onChange: ChangeEventHandler<HTMLInputElement>;
|
|
9
|
+
showTick?: boolean;
|
|
10
|
+
type?: 'radio' | 'checkbox' | 'toggle';
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
onFocus?: FocusEventHandler<HTMLInputElement>;
|
|
16
|
+
onBlur?: FocusEventHandler<HTMLInputElement>;
|
|
17
|
+
id?: string;
|
|
18
|
+
tooltip?: string;
|
|
19
|
+
'data-testid'?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
21
|
+
indented?: boolean;
|
|
22
|
+
} & ({
|
|
23
|
+
illustration?: string;
|
|
24
|
+
productIcon?: never;
|
|
25
|
+
} | {
|
|
26
|
+
productIcon?: PascalToCamelCaseWithoutSuffix<keyof typeof ProductIcon, 'ProductIcon'>;
|
|
27
|
+
illustration?: never;
|
|
28
|
+
}) & LabelProp;
|
|
29
|
+
export type MultiStateProps = Pick<SelectableCardProps, 'type' | 'checked' | 'isError' | 'id' | 'disabled' | 'onFocus' | 'label' | 'aria-label' | 'onChange' | 'name' | 'showTick' | 'onBlur' | 'value'> & {
|
|
30
|
+
innerRef: RefObject<HTMLInputElement | null>;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/SelectableCard/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,WAAW,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,SAAS,EACV,MAAM,OAAO,CAAA;AAEd,OAAO,KAAK,EAAE,SAAS,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAA;AAE5E,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EACL,CAAC,CAAC,EACA,QAAQ,EACR,OAAO,GACR,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,UAAU,CAAC,KAAK,SAAS,CAAC,GACnE,SAAS,CAAA;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,QAAQ,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IAC7C,MAAM,CAAC,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,CAAA;IAC5C,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,CACA;IACE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,KAAK,CAAA;CACpB,GACD;IACE,WAAW,CAAC,EAAE,8BAA8B,CAC1C,MAAM,OAAO,WAAW,EACxB,aAAa,CACd,CAAA;IACD,YAAY,CAAC,EAAE,KAAK,CAAA;CACrB,CACJ,GACC,SAAS,CAAA;AAEX,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,mBAAmB,EACjB,MAAM,GACN,SAAS,GACT,SAAS,GACT,IAAI,GACJ,UAAU,GACV,SAAS,GACT,OAAO,GACP,YAAY,GACZ,UAAU,GACV,MAAM,GACN,UAAU,GACV,QAAQ,GACR,OAAO,CACV,GAAG;IACF,QAAQ,EAAE,SAAS,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAA;CAC7C,CAAA"}
|
|
@@ -4,10 +4,10 @@ import { cn } from "@ultraviolet/utils";
|
|
|
4
4
|
import { useMemo, createContext, useContext } from "react";
|
|
5
5
|
import { Label } from "../Label/index.js";
|
|
6
6
|
import { Row } from "../Row/index.js";
|
|
7
|
-
import { SelectableCard } from "../SelectableCard/index.js";
|
|
8
7
|
import { Stack } from "../Stack/index.js";
|
|
9
8
|
import { Text } from "../Text/index.js";
|
|
10
9
|
import { selectableCardGroupFieldSet } from "./styles.css.js";
|
|
10
|
+
import { SelectableCard } from "../SelectableCard/SelectableCard.js";
|
|
11
11
|
const SelectableCardGroupContext = createContext(void 0);
|
|
12
12
|
const CardSelectableCard = ({
|
|
13
13
|
value,
|
|
@@ -3,12 +3,12 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { cn } from "@ultraviolet/utils";
|
|
4
4
|
import { useId } from "react";
|
|
5
5
|
import { Label } from "../../Label/index.js";
|
|
6
|
-
import { SelectableCard } from "../../SelectableCard/index.js";
|
|
7
6
|
import { SelectInput } from "../../SelectInput/index.js";
|
|
8
7
|
import { Stack } from "../../Stack/index.js";
|
|
9
8
|
import { useSelectableCardOptionGroup } from "../Provider.js";
|
|
10
9
|
import { optionFullHeight, optionPadded, optionSelectInput, optionSelectInputDisabled, optionSelectInputError, selectableCard } from "../styles.css.js";
|
|
11
10
|
import { Image } from "./Image.js";
|
|
11
|
+
import { SelectableCard } from "../../SelectableCard/SelectableCard.js";
|
|
12
12
|
const Option = ({
|
|
13
13
|
value,
|
|
14
14
|
label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Separator/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGrD,KAAK,cAAc,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,GAAG,iBAAiB,CAAA;AAErB;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,6FAQvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Separator/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAGrD,KAAK,cAAc,GAAG;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,GAAG,iBAAiB,CAAA;AAErB;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,6FAQvB,cAAc,4CAmCd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Donut.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/Donut.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,KAAK,+
|
|
1
|
+
{"version":3,"file":"Donut.d.ts","sourceRoot":"","sources":["../../../src/components/Skeleton/Donut.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,KAAK,+CA0BjB,CAAA"}
|
|
@@ -3,15 +3,18 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { Line } from "./Line.js";
|
|
4
4
|
import { donutSkeletonContainer, donutSkeletonSvg, donutSkeletonCircle, CIRCLE_SIZE, donutSkeletonLineList } from "./stylesVariants.css.js";
|
|
5
5
|
const Donut = () => /* @__PURE__ */ jsxs("div", { className: donutSkeletonContainer, children: [
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
/* @__PURE__ */ jsxs("svg", { className: donutSkeletonSvg, children: [
|
|
7
|
+
/* @__PURE__ */ jsx("title", { children: "donut skeleton" }),
|
|
8
|
+
/* @__PURE__ */ jsx(
|
|
9
|
+
"circle",
|
|
10
|
+
{
|
|
11
|
+
className: donutSkeletonCircle,
|
|
12
|
+
cx: `${CIRCLE_SIZE / 2}rem`,
|
|
13
|
+
cy: `${CIRCLE_SIZE / 2}rem`,
|
|
14
|
+
r: "90"
|
|
15
|
+
}
|
|
16
|
+
)
|
|
17
|
+
] }),
|
|
15
18
|
/* @__PURE__ */ jsxs("ul", { className: donutSkeletonLineList, children: [
|
|
16
19
|
/* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Line, {}) }),
|
|
17
20
|
/* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Line, {}) }),
|
|
@@ -94,7 +94,7 @@ export declare const sliderThumbStyle: import("@vanilla-extract/recipes").Runtim
|
|
|
94
94
|
export declare const sliderDoubleText: import("@vanilla-extract/recipes").RuntimeFn<{
|
|
95
95
|
isDouble: {
|
|
96
96
|
false: {
|
|
97
|
-
alignSelf: "end";
|
|
97
|
+
alignSelf: "flex-end";
|
|
98
98
|
};
|
|
99
99
|
true: {
|
|
100
100
|
alignSelf: "center";
|