@ultraviolet/ui 3.3.1 → 3.5.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/index.js +1 -1
- package/dist/components/Alert/styles.css.d.ts +8 -8
- package/dist/components/Alert/styles.css.js +1 -1
- package/dist/components/Avatar/styles.css.d.ts +36 -36
- package/dist/components/Avatar/styles.css.js +4 -4
- package/dist/components/Badge/styles.css.d.ts +28 -28
- package/dist/components/Badge/styles.css.js +1 -1
- package/dist/components/Banner/index.js +1 -1
- package/dist/components/Banner/styles.css.d.ts +2 -2
- package/dist/components/Banner/styles.css.js +2 -2
- package/dist/components/BarStack/styles.css.d.ts +7 -7
- package/dist/components/BarStack/styles.css.js +1 -1
- package/dist/components/Bullet/styles.css.d.ts +13 -13
- package/dist/components/Bullet/styles.css.js +1 -1
- package/dist/components/Button/index.d.ts +2 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/styles.css.d.ts +39 -39
- package/dist/components/Button/styles.css.js +1 -1
- package/dist/components/Card/styles.css.js +0 -1
- package/dist/components/Checkbox/index.js +4 -4
- package/dist/components/Chip/ChipIcon.d.ts.map +1 -1
- package/dist/components/Chip/ChipIcon.js +4 -1
- package/dist/components/CopyButton/index.js +1 -1
- package/dist/components/DateInput/components/CalendarContent.js +7 -7
- package/dist/components/DateInput/components/CalendarDaily.js +1 -1
- package/dist/components/DateInput/components/CalendarMonthly.d.ts.map +1 -1
- package/dist/components/DateInput/components/CalendarMonthly.js +1 -1
- package/dist/components/DateInput/helpers.d.ts.map +1 -1
- package/dist/components/Dialog/components/Buttons.js +1 -1
- package/dist/components/Dialog/index.d.ts +2 -2
- package/dist/components/Drawer/styles.css.js +1 -1
- package/dist/components/EmptyState/styles.css.d.ts +11 -11
- package/dist/components/EmptyState/styles.css.js +2 -2
- package/dist/components/Expandable/index.js +1 -1
- package/dist/components/ExpandableCard/styles.css.d.ts.map +1 -1
- package/dist/components/FileInput/index.js +1 -1
- package/dist/components/FileInput/styles.css.d.ts +11 -11
- package/dist/components/FileInput/styles.css.js +5 -5
- package/dist/components/GlobalAlert/styles.css.js +1 -1
- package/dist/components/Key/styles.css.d.ts +12 -12
- package/dist/components/Key/styles.css.js +1 -1
- package/dist/components/Label/index.d.ts +2 -1
- package/dist/components/Label/index.d.ts.map +1 -1
- package/dist/components/Label/index.js +44 -30
- package/dist/components/Label/styles.css.js +1 -1
- package/dist/components/Link/styles.css.d.ts +31 -31
- package/dist/components/Link/styles.css.js +1 -1
- package/dist/components/List/ListContext.d.ts +2 -2
- package/dist/components/List/ListContext.d.ts.map +1 -1
- package/dist/components/List/Row.d.ts +1 -1
- package/dist/components/List/Row.d.ts.map +1 -1
- package/dist/components/List/SelectBar.d.ts +1 -1
- package/dist/components/List/SelectBar.d.ts.map +1 -1
- package/dist/components/List/SkeletonRows.d.ts.map +1 -1
- package/dist/components/List/index.d.ts +2 -2
- package/dist/components/List/index.d.ts.map +1 -1
- package/dist/components/List/styles.css.d.ts +3 -3
- package/dist/components/List/styles.css.js +1 -1
- package/dist/components/Menu/styles.css.js +1 -1
- package/dist/components/Modal/ModalContent.d.ts.map +1 -1
- package/dist/components/Modal/components/Dialog.d.ts.map +1 -1
- package/dist/components/Modal/components/Dialog.js +1 -1
- package/dist/components/Modal/index.js +3 -3
- package/dist/components/Modal/styles.css.d.ts +17 -17
- package/dist/components/Modal/styles.css.js +1 -1
- package/dist/components/NumberInput/index.js +2 -2
- package/dist/components/NumberInput/styles.css.d.ts +48 -48
- package/dist/components/NumberInput/styles.css.d.ts.map +1 -1
- package/dist/components/NumberInput/styles.css.js +4 -4
- package/dist/components/Pagination/getPageNumbers.d.ts +1 -1
- package/dist/components/Pagination/styles.css.js +2 -2
- package/dist/components/PieChart/index.js +3 -3
- package/dist/components/PieChart/styles.css.d.ts +7 -7
- package/dist/components/PieChart/styles.css.js +3 -3
- package/dist/components/Popover/index.js +1 -1
- package/dist/components/Popover/styles.css.d.ts +3 -3
- package/dist/components/Popup/helpers.js +2 -2
- package/dist/components/Popup/index.js +19 -19
- package/dist/components/Popup/styles.css.d.ts +6 -6
- package/dist/components/Popup/styles.css.js +2 -1
- package/dist/components/Popup/variables.css.js +0 -1
- package/dist/components/ProgressBar/styles.css.js +0 -1
- package/dist/components/ProgressBar/variables.css.js +1 -0
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/Radio/index.js +14 -11
- package/dist/components/RadioGroup/index.js +1 -1
- package/dist/components/Row/styles.css.d.ts +19 -19
- package/dist/components/Row/styles.css.d.ts.map +1 -1
- package/dist/components/Row/styles.css.js +2 -2
- package/dist/components/Row/variables.css.d.ts +1 -1
- package/dist/components/Row/variables.css.d.ts.map +1 -1
- package/dist/components/Row/variables.css.js +2 -2
- package/dist/components/SelectInput/components/Dropdown.d.ts.map +1 -1
- package/dist/components/SelectInput/components/Dropdown.js +205 -196
- package/dist/components/SelectInput/components/SearchBarDropdown.js +15 -15
- package/dist/components/SelectInput/components/SelectBar.js +7 -7
- package/dist/components/SelectInput/components/dropdown.css.d.ts +6 -5
- package/dist/components/SelectInput/components/dropdown.css.d.ts.map +1 -1
- package/dist/components/SelectInput/components/dropdown.css.js +9 -9
- package/dist/components/SelectInput/components/selectBar.css.d.ts +43 -43
- package/dist/components/SelectInput/components/selectBar.css.d.ts.map +1 -1
- package/dist/components/SelectInput/components/selectBar.css.js +2 -2
- package/dist/components/SelectInput/findOptionInOptions.js +3 -3
- package/dist/components/SelectInput/index.d.ts.map +1 -1
- package/dist/components/SelectInput/index.js +1 -1
- package/dist/components/SelectableCard/index.d.ts.map +1 -1
- package/dist/components/SelectableCard/index.js +8 -5
- package/dist/components/SelectableCard/styles.css.d.ts +9 -9
- package/dist/components/SelectableCard/styles.css.js +2 -2
- package/dist/components/Separator/index.d.ts.map +1 -1
- package/dist/components/Separator/index.js +33 -31
- package/dist/components/Skeleton/Block.d.ts.map +1 -1
- package/dist/components/Skeleton/Block.js +7 -4
- package/dist/components/Skeleton/Blocks.d.ts.map +1 -1
- package/dist/components/Skeleton/Blocks.js +7 -4
- package/dist/components/Skeleton/BoxWithIcon.d.ts.map +1 -1
- package/dist/components/Skeleton/BoxWithIcon.js +7 -4
- package/dist/components/Skeleton/List.d.ts.map +1 -1
- package/dist/components/Skeleton/List.js +8 -2
- package/dist/components/Skeleton/Slider.d.ts.map +1 -1
- package/dist/components/Skeleton/Slider.js +4 -1
- package/dist/components/Skeleton/index.d.ts.map +1 -1
- package/dist/components/Skeleton/index.js +17 -14
- package/dist/components/Slider/components/DoubleSlider.js +10 -10
- package/dist/components/Slider/components/SingleSlider.js +1 -1
- package/dist/components/Slider/styles.css.d.ts +47 -43
- package/dist/components/Slider/styles.css.d.ts.map +1 -1
- package/dist/components/Slider/styles.css.js +5 -5
- package/dist/components/Snippet/index.js +1 -1
- package/dist/components/Snippet/styles.css.d.ts +12 -12
- package/dist/components/Snippet/styles.css.js +7 -7
- package/dist/components/Stack/styles.css.d.ts +87 -87
- package/dist/components/Stack/styles.css.js +4 -4
- package/dist/components/Status/styles.css.d.ts +1 -1
- package/dist/components/StepList/styles.css.d.ts +7 -7
- package/dist/components/StepList/styles.css.js +2 -2
- package/dist/components/Stepper/index.d.ts.map +1 -1
- package/dist/components/Stepper/index.js +13 -10
- package/dist/components/Stepper/styles.css.d.ts +45 -45
- package/dist/components/Stepper/styles.css.js +6 -6
- package/dist/components/SwitchButton/index.js +3 -3
- package/dist/components/SwitchButton/styles.css.js +3 -3
- package/dist/components/Table/HeaderRow.d.ts.map +1 -1
- package/dist/components/Table/HeaderRow.js +25 -22
- package/dist/components/Table/Row.d.ts +1 -1
- package/dist/components/Table/Row.d.ts.map +1 -1
- package/dist/components/Table/SelectBar.d.ts +1 -1
- package/dist/components/Table/SelectBar.d.ts.map +1 -1
- package/dist/components/Table/SkeletonRows.d.ts.map +1 -1
- package/dist/components/Table/index.d.ts +4 -4
- package/dist/components/Table/index.d.ts.map +1 -1
- package/dist/components/Table/styles.css.d.ts +21 -21
- package/dist/components/Table/styles.css.js +2 -2
- package/dist/components/Tabs/Tab.js +1 -1
- package/dist/components/Tabs/styles.css.js +1 -1
- package/dist/components/Tag/styles.css.d.ts +10 -10
- package/dist/components/Tag/styles.css.js +1 -1
- package/dist/components/TagInput/index.js +5 -5
- package/dist/components/TagInput/styles.css.d.ts +4 -4
- package/dist/components/TagInput/styles.css.js +1 -1
- package/dist/components/TagList/index.d.ts.map +1 -1
- package/dist/components/TagList/index.js +1 -1
- package/dist/components/Text/style.css.d.ts +26 -26
- package/dist/components/Text/style.css.d.ts.map +1 -1
- package/dist/components/Text/style.css.js +1 -2
- package/dist/components/Text/variables.css.js +1 -0
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.js +14 -7
- package/dist/components/TextArea/styles.css.d.ts +2 -2
- package/dist/components/TextArea/styles.css.js +1 -1
- package/dist/components/TextInput/index.js +2 -2
- package/dist/components/TimeInput/helpers.d.ts.map +1 -1
- package/dist/components/TimeInput/helpers.js +2 -1
- package/dist/components/TimeInput/index.js +4 -4
- package/dist/components/TimeInput/styles.css.d.ts +22 -22
- package/dist/components/TimeInput/styles.css.js +1 -1
- package/dist/components/Toaster/constants.d.ts.map +1 -1
- package/dist/components/Toggle/styles.css.d.ts +53 -53
- package/dist/components/Toggle/styles.css.js +2 -2
- package/dist/components/TreeMapChart/index.d.ts +1 -1
- package/dist/components/TreeMapChart/index.d.ts.map +1 -1
- package/dist/components/TreeMapChart/index.js +39 -42
- package/dist/components/TreeMapChart/styles.css.d.ts +1 -1
- package/dist/components/TreeMapChart/styles.css.d.ts.map +1 -1
- package/dist/components/TreeMapChart/styles.css.js +2 -2
- package/dist/components/UnitInput/index.js +1 -1
- package/dist/components/UnitInput/styles.css.js +3 -3
- package/dist/components/VerificationCode/index.d.ts.map +1 -1
- package/dist/components/VerificationCode/index.js +2 -2
- package/dist/components/VerificationCode/styles.css.js +1 -1
- package/dist/components/compositions/OptionSelector/RevealOnHover.d.ts +6 -0
- package/dist/components/compositions/OptionSelector/RevealOnHover.d.ts.map +1 -0
- package/dist/components/compositions/OptionSelector/RevealOnHover.js +12 -0
- package/dist/components/compositions/OptionSelector/__mock__/resources.d.ts +35 -0
- package/dist/components/compositions/OptionSelector/__mock__/resources.d.ts.map +1 -0
- package/dist/components/compositions/OptionSelector/index.d.ts +7 -0
- package/dist/components/compositions/OptionSelector/index.d.ts.map +1 -0
- package/dist/components/compositions/OptionSelector/index.js +181 -0
- package/dist/components/compositions/OptionSelector/styles.css.d.ts +10 -0
- package/dist/components/compositions/OptionSelector/styles.css.d.ts.map +1 -0
- package/dist/components/compositions/OptionSelector/styles.css.js +23 -0
- package/dist/components/compositions/OptionSelector/types.d.ts +37 -0
- package/dist/components/compositions/OptionSelector/types.d.ts.map +1 -0
- package/dist/components/compositions/index.d.ts +2 -0
- package/dist/components/compositions/index.d.ts.map +1 -0
- package/dist/components/compositions/index.js +4 -0
- package/dist/helpers/treeMap.d.ts +4 -5
- package/dist/helpers/treeMap.d.ts.map +1 -1
- package/dist/helpers/treeMap.js +7 -5
- package/dist/theme/ThemeProvider.d.ts +33 -0
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/index.d.ts +33 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/ui.css +1 -1
- package/package.json +10 -5
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ResponsiveTreeMapHtml } from "@nivo/treemap";
|
|
4
4
|
import { useTheme } from "@ultraviolet/themes";
|
|
5
|
+
import { cn } from "@ultraviolet/utils";
|
|
5
6
|
import { useMemo, useCallback } from "react";
|
|
6
7
|
import { getDataColors } from "../../helpers/treeMap.js";
|
|
7
|
-
import {
|
|
8
|
-
import { treeMapContentWrapper } from "./styles.css.js";
|
|
8
|
+
import { treeMapContainer } from "./styles.css.js";
|
|
9
9
|
import { Tooltip } from "./Tooltip.js";
|
|
10
10
|
const TreeMapChart = ({
|
|
11
11
|
height = "537px",
|
|
@@ -17,7 +17,6 @@ const TreeMapChart = ({
|
|
|
17
17
|
"data-testid": dataTestId
|
|
18
18
|
}) => {
|
|
19
19
|
const theme = useTheme();
|
|
20
|
-
const DEFAULT_COLOR = theme.colors.primary.text;
|
|
21
20
|
const colors = useMemo(() => getDataColors(data, theme), [data, theme]);
|
|
22
21
|
const tooltip = useCallback(
|
|
23
22
|
(props) => {
|
|
@@ -26,48 +25,46 @@ const TreeMapChart = ({
|
|
|
26
25
|
},
|
|
27
26
|
[tooltipFunction]
|
|
28
27
|
);
|
|
29
|
-
const
|
|
30
|
-
(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
className: treeMapContentWrapper,
|
|
37
|
-
onMouseEnter: node.onMouseEnter,
|
|
38
|
-
onMouseLeave: node.onMouseLeave,
|
|
39
|
-
onMouseMove: node.onMouseMove,
|
|
40
|
-
style: {
|
|
41
|
-
backgroundColor,
|
|
42
|
-
height: node.height - spacing,
|
|
43
|
-
left: node.x + spacing / 2,
|
|
44
|
-
top: node.y + spacing / 2,
|
|
45
|
-
width: node.width - spacing
|
|
46
|
-
},
|
|
47
|
-
children: /* @__PURE__ */ jsx(Text, { as: "div", oneLine: true, variant: "captionStrong", children: node.data.content })
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
},
|
|
51
|
-
[colors, DEFAULT_COLOR]
|
|
28
|
+
const nivoTheme = useMemo(
|
|
29
|
+
() => ({
|
|
30
|
+
labels: {
|
|
31
|
+
text: theme.typography.captionStrong
|
|
32
|
+
}
|
|
33
|
+
}),
|
|
34
|
+
[theme.typography.captionStrong]
|
|
52
35
|
);
|
|
53
|
-
return /* @__PURE__ */ jsx(
|
|
54
|
-
|
|
36
|
+
return /* @__PURE__ */ jsx(
|
|
37
|
+
"div",
|
|
55
38
|
{
|
|
56
|
-
|
|
57
|
-
data,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
39
|
+
className: cn(className, treeMapContainer),
|
|
40
|
+
"data-testid": dataTestId,
|
|
41
|
+
style: { height },
|
|
42
|
+
children: /* @__PURE__ */ jsx(
|
|
43
|
+
ResponsiveTreeMapHtml,
|
|
44
|
+
{
|
|
45
|
+
animate: false,
|
|
46
|
+
borderColor: theme.colors.neutral.background,
|
|
47
|
+
borderWidth: 2,
|
|
48
|
+
colors,
|
|
49
|
+
data,
|
|
50
|
+
enableParentLabel: false,
|
|
51
|
+
identity: "id",
|
|
52
|
+
label: (node) => typeof node.data.content === "string" ? node.data.content : node.id,
|
|
53
|
+
labelSkipSize: 20,
|
|
54
|
+
labelTextColor: theme.colors.neutral.background,
|
|
55
|
+
leavesOnly: true,
|
|
56
|
+
motionConfig: "none",
|
|
57
|
+
nodeOpacity: 1,
|
|
58
|
+
orientLabel: false,
|
|
59
|
+
theme: nivoTheme,
|
|
60
|
+
tile: "squarify",
|
|
61
|
+
tooltip,
|
|
62
|
+
value: "value",
|
|
63
|
+
...chartProps
|
|
64
|
+
}
|
|
65
|
+
)
|
|
69
66
|
}
|
|
70
|
-
)
|
|
67
|
+
);
|
|
71
68
|
};
|
|
72
69
|
export {
|
|
73
70
|
TreeMapChart
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/TreeMapChart/styles.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,QAOlC,CAAA;AAEF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../src/components/TreeMapChart/styles.css.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,QAOlC,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAE3B,CAAA"}
|
|
@@ -183,7 +183,7 @@ const UnitInput = ({
|
|
|
183
183
|
children: error || success || helper
|
|
184
184
|
}
|
|
185
185
|
) : null,
|
|
186
|
-
!error
|
|
186
|
+
!(error || success) && typeof helper !== "string" && helper ? helper : null
|
|
187
187
|
]
|
|
188
188
|
}
|
|
189
189
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
/* empty css */
|
|
3
3
|
var widthSelectInput = "var(--uv_gwf0fl0)";
|
|
4
|
-
var unitInputNumber = {
|
|
5
|
-
var unitInputState = {
|
|
4
|
+
var unitInputNumber = { large: "uv_gwf0fl2 uv_gwf0fl1", medium: "uv_gwf0fl3 uv_gwf0fl1", small: "uv_gwf0fl4 uv_gwf0fl1" };
|
|
5
|
+
var unitInputState = { "default": "uv_gwf0fl6 uv_gwf0fl5", disabled: "uv_gwf0fl7 uv_gwf0fl5", error: "uv_gwf0fl8 uv_gwf0fl5", readOnly: "uv_gwf0fl9 uv_gwf0fl5", success: "uv_gwf0fla uv_gwf0fl5" };
|
|
6
6
|
var unitInputNumberWrapper = "uv_gwf0flb";
|
|
7
|
-
var unitInputSize = {
|
|
7
|
+
var unitInputSize = { large: "uv_gwf0flc", medium: "uv_gwf0fld", small: "uv_gwf0fle" };
|
|
8
8
|
var unitInputUnitWidth = "uv_gwf0flf";
|
|
9
9
|
var unitInputUnit = "uv_gwf0flg";
|
|
10
10
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/VerificationCode/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,aAAa,EAGb,SAAS,EACV,MAAM,OAAO,CAAA;AAWd,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAC5B,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC1B,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,8NAoB9B,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/VerificationCode/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAGV,aAAa,EAGb,SAAS,EACV,MAAM,OAAO,CAAA;AAWd,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IACxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAA;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACpC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,gBAAgB,CAAC,EAAE,SAAS,CAAA;IAC5B,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAA;IAC1B,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,8NAoB9B,qBAAqB,4CAyNvB,CAAA"}
|
|
@@ -195,13 +195,13 @@ const VerificationCode = ({
|
|
|
195
195
|
{
|
|
196
196
|
as: "p",
|
|
197
197
|
disabled,
|
|
198
|
-
prominence:
|
|
198
|
+
prominence: error || success ? "default" : "weak",
|
|
199
199
|
sentiment,
|
|
200
200
|
variant: "caption",
|
|
201
201
|
children: error || success || helper
|
|
202
202
|
}
|
|
203
203
|
) : null,
|
|
204
|
-
!error
|
|
204
|
+
!(error || success) && typeof helper !== "string" && helper ? helper : null
|
|
205
205
|
]
|
|
206
206
|
}
|
|
207
207
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
var inputSizes = {
|
|
2
|
+
var inputSizes = { large: "uv_1k9synd0", medium: "uv_1k9synd1", small: "uv_1k9synd2", xlarge: "uv_1k9synd3" };
|
|
3
3
|
var inputClass = "uv_1k9synd4";
|
|
4
4
|
var filedSetClass = "uv_1k9synd5";
|
|
5
5
|
export {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RevealOnHover.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/OptionSelector/RevealOnHover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,eAAO,MAAM,aAAa,GAAI,4BAG3B;IACD,OAAO,EAAE,SAAS,CAAA;IAClB,YAAY,EAAE,SAAS,CAAA;CACxB,4CAKA,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { revealOnHover } from "./styles.css.js";
|
|
3
|
+
const RevealOnHover = ({
|
|
4
|
+
content,
|
|
5
|
+
hoverContent
|
|
6
|
+
}) => /* @__PURE__ */ jsxs("div", { className: revealOnHover, children: [
|
|
7
|
+
/* @__PURE__ */ jsx("div", { "data-visibility": "unhover", children: content }),
|
|
8
|
+
/* @__PURE__ */ jsx("div", { "data-visibility": "hover", children: hoverContent })
|
|
9
|
+
] });
|
|
10
|
+
export {
|
|
11
|
+
RevealOnHover
|
|
12
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const firstSelectorOptions: {
|
|
2
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
value: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const franceOptions: ({
|
|
7
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
hoverContent: import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
optionalInfo: import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
value: string;
|
|
12
|
+
} | {
|
|
13
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
hoverContent: import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
value: string;
|
|
17
|
+
optionalInfo?: undefined;
|
|
18
|
+
})[];
|
|
19
|
+
export declare const polandOptions: {
|
|
20
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
hoverContent: import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
value: string;
|
|
24
|
+
}[];
|
|
25
|
+
export declare const netherlandsOptions: {
|
|
26
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
hoverContent: import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
icon: import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
value: string;
|
|
30
|
+
}[];
|
|
31
|
+
export type ValueType = {
|
|
32
|
+
first?: string;
|
|
33
|
+
second?: string;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../../../../src/components/compositions/OptionSelector/__mock__/resources.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,oBAAoB;;;;GA2ChC,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;IAwEzB,CAAA;AAED,eAAO,MAAM,aAAa;;;;;GAmEzB,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;GAmE9B,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { OptionSelectorProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* A compound selection component that displays two sequential select inputs
|
|
4
|
+
* where the first selection contextualizes and filters the options available in the second.
|
|
5
|
+
*/
|
|
6
|
+
export declare const OptionSelector: ({ className, style, "data-testid": dataTestId, firstSelector, secondSelector, size, disabled, readOnly, "aria-label": ariaLabel, error, required, onChange, name, value, }: OptionSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/OptionSelector/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,SAAS,CAAA;AA+ClE;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,4KAe5B,mBAAmB,4CA0IrB,CAAA"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { RayStartArrowIcon } from "@ultraviolet/icons";
|
|
4
|
+
import { cn } from "@ultraviolet/utils";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { Label } from "../../Label/index.js";
|
|
7
|
+
import { SelectInput } from "../../SelectInput/index.js";
|
|
8
|
+
import { Stack } from "../../Stack/index.js";
|
|
9
|
+
import { Text } from "../../Text/index.js";
|
|
10
|
+
import { RevealOnHover } from "./RevealOnHover.js";
|
|
11
|
+
import { firstLabel, secondLabel, firstSelectInput, arrow, secondSelectInput, errorFirstSelector, errorSecondSelector, optionSelectorWrapper } from "./styles.css.js";
|
|
12
|
+
const IconWithContent = ({
|
|
13
|
+
content,
|
|
14
|
+
icon
|
|
15
|
+
}) => /* @__PURE__ */ jsxs(Stack, { alignItems: "center", direction: "row", gap: "1.5", children: [
|
|
16
|
+
icon,
|
|
17
|
+
content
|
|
18
|
+
] });
|
|
19
|
+
const makeSelectInputOptions = (options) => options.map((option) => {
|
|
20
|
+
const optionLabel = option.hoverContent ? /* @__PURE__ */ jsx(
|
|
21
|
+
RevealOnHover,
|
|
22
|
+
{
|
|
23
|
+
content: /* @__PURE__ */ jsx(IconWithContent, { content: option.content, icon: option.icon }),
|
|
24
|
+
hoverContent: /* @__PURE__ */ jsx(IconWithContent, { content: option.hoverContent, icon: option.icon })
|
|
25
|
+
},
|
|
26
|
+
option.value
|
|
27
|
+
) : /* @__PURE__ */ jsx(
|
|
28
|
+
IconWithContent,
|
|
29
|
+
{
|
|
30
|
+
content: option.content,
|
|
31
|
+
icon: option.icon
|
|
32
|
+
},
|
|
33
|
+
option.value
|
|
34
|
+
);
|
|
35
|
+
return {
|
|
36
|
+
disabled: option.disabled,
|
|
37
|
+
label: optionLabel,
|
|
38
|
+
optionalInfo: option.optionalInfo,
|
|
39
|
+
searchText: option.value,
|
|
40
|
+
tooltip: option.tooltip,
|
|
41
|
+
value: option.value
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
const OptionSelector = ({
|
|
45
|
+
className,
|
|
46
|
+
style,
|
|
47
|
+
"data-testid": dataTestId,
|
|
48
|
+
firstSelector,
|
|
49
|
+
secondSelector,
|
|
50
|
+
size = "large",
|
|
51
|
+
disabled,
|
|
52
|
+
readOnly,
|
|
53
|
+
"aria-label": ariaLabel,
|
|
54
|
+
error,
|
|
55
|
+
required,
|
|
56
|
+
onChange,
|
|
57
|
+
name,
|
|
58
|
+
value
|
|
59
|
+
}) => {
|
|
60
|
+
const firstValue = useMemo(() => {
|
|
61
|
+
if (value?.first) {
|
|
62
|
+
return value.first;
|
|
63
|
+
}
|
|
64
|
+
if (firstSelector.options.length === 1) {
|
|
65
|
+
onChange?.({
|
|
66
|
+
first: firstSelector.options[0].value,
|
|
67
|
+
second: value?.second
|
|
68
|
+
});
|
|
69
|
+
return firstSelector.options[0].value;
|
|
70
|
+
}
|
|
71
|
+
return void 0;
|
|
72
|
+
}, [value?.first, value?.second, onChange, firstSelector]);
|
|
73
|
+
const secondValue = useMemo(() => {
|
|
74
|
+
if (value?.second) {
|
|
75
|
+
return value.second;
|
|
76
|
+
}
|
|
77
|
+
if (secondSelector?.options.length === 1) {
|
|
78
|
+
onChange?.({
|
|
79
|
+
first: value?.first,
|
|
80
|
+
second: secondSelector.options[0].value
|
|
81
|
+
});
|
|
82
|
+
return secondSelector?.options[0].value;
|
|
83
|
+
}
|
|
84
|
+
return void 0;
|
|
85
|
+
}, [secondSelector, value?.first, value?.second, onChange]);
|
|
86
|
+
const firstSelectorOptions = makeSelectInputOptions(firstSelector.options);
|
|
87
|
+
const secondSelectorOptions = secondSelector?.options ? makeSelectInputOptions(secondSelector.options) : void 0;
|
|
88
|
+
const onChangeFirstSelector = (val) => {
|
|
89
|
+
onChange?.({ first: val, second: value?.second });
|
|
90
|
+
};
|
|
91
|
+
const onChangeSecondSelector = (val) => onChange?.({ first: value?.first, second: val });
|
|
92
|
+
return (
|
|
93
|
+
// biome-ignore lint/a11y/useAriaPropsSupportedByRole: to fix
|
|
94
|
+
/* @__PURE__ */ jsxs(
|
|
95
|
+
"fieldset",
|
|
96
|
+
{
|
|
97
|
+
"aria-label": ariaLabel,
|
|
98
|
+
"aria-required": required,
|
|
99
|
+
className: cn(className, optionSelectorWrapper),
|
|
100
|
+
"data-testid": dataTestId,
|
|
101
|
+
name,
|
|
102
|
+
style,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ jsx(Label, { className: firstLabel, required, children: firstSelector.label }),
|
|
105
|
+
firstValue && secondSelector && secondSelectorOptions ? /* @__PURE__ */ jsx(Label, { className: secondLabel, required, children: secondSelector?.label }) : null,
|
|
106
|
+
/* @__PURE__ */ jsx(
|
|
107
|
+
SelectInput,
|
|
108
|
+
{
|
|
109
|
+
className: firstSelectInput,
|
|
110
|
+
"data-testid": "first-selector",
|
|
111
|
+
disabled: firstSelector.disabled || disabled,
|
|
112
|
+
error: error || !!firstSelector.error,
|
|
113
|
+
helper: firstSelector.helper,
|
|
114
|
+
labelDescription: firstSelector.labelDescription,
|
|
115
|
+
onChange: onChangeFirstSelector,
|
|
116
|
+
optionalInfoPlacement: "right",
|
|
117
|
+
options: firstSelectorOptions,
|
|
118
|
+
placeholder: firstSelector.placeholder,
|
|
119
|
+
readOnly: firstSelector.options.length === 1 || firstSelector.readOnly || readOnly,
|
|
120
|
+
required,
|
|
121
|
+
size,
|
|
122
|
+
value: firstValue
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
firstValue && secondSelector && secondSelectorOptions ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
126
|
+
/* @__PURE__ */ jsx(
|
|
127
|
+
RayStartArrowIcon,
|
|
128
|
+
{
|
|
129
|
+
className: arrow,
|
|
130
|
+
prominence: "weak",
|
|
131
|
+
sentiment: "neutral",
|
|
132
|
+
size
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
SelectInput,
|
|
137
|
+
{
|
|
138
|
+
className: secondSelectInput,
|
|
139
|
+
"data-testid": "second-selector",
|
|
140
|
+
disabled: !!firstSelector.error || secondSelector.disabled || disabled,
|
|
141
|
+
error: !!error || !!secondSelector.error,
|
|
142
|
+
helper: secondSelector.helper,
|
|
143
|
+
labelDescription: secondSelector.labelDescription,
|
|
144
|
+
onChange: onChangeSecondSelector,
|
|
145
|
+
optionalInfoPlacement: "right",
|
|
146
|
+
options: secondSelectorOptions,
|
|
147
|
+
placeholder: secondSelector.placeholder,
|
|
148
|
+
readOnly: secondSelector.options.length === 1 || secondSelector.readOnly || readOnly,
|
|
149
|
+
size,
|
|
150
|
+
value: secondValue
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
] }) : null,
|
|
154
|
+
firstSelector.error && typeof firstSelector.error === "string" ? /* @__PURE__ */ jsx(
|
|
155
|
+
Text,
|
|
156
|
+
{
|
|
157
|
+
as: "p",
|
|
158
|
+
className: errorFirstSelector,
|
|
159
|
+
sentiment: "danger",
|
|
160
|
+
variant: "caption",
|
|
161
|
+
children: firstSelector.error
|
|
162
|
+
}
|
|
163
|
+
) : null,
|
|
164
|
+
secondSelector?.error && typeof secondSelector?.error === "string" ? /* @__PURE__ */ jsx(
|
|
165
|
+
Text,
|
|
166
|
+
{
|
|
167
|
+
as: "p",
|
|
168
|
+
className: errorSecondSelector,
|
|
169
|
+
sentiment: "danger",
|
|
170
|
+
variant: "caption",
|
|
171
|
+
children: secondSelector.error
|
|
172
|
+
}
|
|
173
|
+
) : null
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
);
|
|
178
|
+
};
|
|
179
|
+
export {
|
|
180
|
+
OptionSelector
|
|
181
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const optionSelectorWrapper: string;
|
|
2
|
+
export declare const revealOnHover: string;
|
|
3
|
+
export declare const firstLabel: string;
|
|
4
|
+
export declare const secondLabel: string;
|
|
5
|
+
export declare const firstSelectInput: string;
|
|
6
|
+
export declare const secondSelectInput: string;
|
|
7
|
+
export declare const arrow: string;
|
|
8
|
+
export declare const errorFirstSelector: string;
|
|
9
|
+
export declare const errorSecondSelector: string;
|
|
10
|
+
//# sourceMappingURL=styles.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.css.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/OptionSelector/styles.css.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,qBAAqB,QAMhC,CAAA;AAEF,eAAO,MAAM,aAAa,QAAY,CAAA;AAwBtC,eAAO,MAAM,UAAU,QAGrB,CAAA;AAEF,eAAO,MAAM,WAAW,QAGtB,CAAA;AAEF,eAAO,MAAM,gBAAgB,QAG3B,CAAA;AAEF,eAAO,MAAM,iBAAiB,QAG5B,CAAA;AAEF,eAAO,MAAM,KAAK,QAGhB,CAAA;AAEF,eAAO,MAAM,kBAAkB,QAI7B,CAAA;AAEF,eAAO,MAAM,mBAAmB,QAI9B,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
/* empty css */
|
|
4
|
+
var optionSelectorWrapper = "uv_12opk3l0";
|
|
5
|
+
var revealOnHover = "uv_12opk3l1";
|
|
6
|
+
var firstLabel = "uv_12opk3l2";
|
|
7
|
+
var secondLabel = "uv_12opk3l3";
|
|
8
|
+
var firstSelectInput = "uv_12opk3l4";
|
|
9
|
+
var secondSelectInput = "uv_12opk3l5";
|
|
10
|
+
var arrow = "uv_12opk3l6";
|
|
11
|
+
var errorFirstSelector = "uv_12opk3l7";
|
|
12
|
+
var errorSecondSelector = "uv_12opk3l8";
|
|
13
|
+
export {
|
|
14
|
+
arrow,
|
|
15
|
+
errorFirstSelector,
|
|
16
|
+
errorSecondSelector,
|
|
17
|
+
firstLabel,
|
|
18
|
+
firstSelectInput,
|
|
19
|
+
optionSelectorWrapper,
|
|
20
|
+
revealOnHover,
|
|
21
|
+
secondLabel,
|
|
22
|
+
secondSelectInput
|
|
23
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ComponentProps, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { SelectInput } from '../../SelectInput';
|
|
3
|
+
export type SelectorOption = {
|
|
4
|
+
content: ReactNode;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
value: string;
|
|
7
|
+
hoverContent?: ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
tooltip?: string;
|
|
10
|
+
optionalInfo?: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
export type SelectorProps = Pick<ComponentProps<typeof SelectInput>, 'label' | 'labelDescription' | 'error' | 'disabled' | 'helper' | 'readOnly' | 'placeholder'> & {
|
|
13
|
+
options: SelectorOption[];
|
|
14
|
+
};
|
|
15
|
+
export type OptionSelectorProps = {
|
|
16
|
+
className?: string;
|
|
17
|
+
'data-testid'?: string;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
firstSelector: SelectorProps;
|
|
20
|
+
secondSelector?: SelectorProps;
|
|
21
|
+
size?: ComponentProps<typeof SelectInput>['size'];
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
name?: string;
|
|
25
|
+
'aria-label'?: string;
|
|
26
|
+
error?: string | boolean;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
onChange?: (values: {
|
|
29
|
+
first?: string;
|
|
30
|
+
second?: string;
|
|
31
|
+
}) => void;
|
|
32
|
+
value?: {
|
|
33
|
+
first?: string;
|
|
34
|
+
second?: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/OptionSelector/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,SAAS,CAAA;IAClB,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,SAAS,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,cAAc,CAAC,OAAO,WAAW,CAAC,EAChC,OAAO,GACP,kBAAkB,GAClB,OAAO,GACP,UAAU,GACV,QAAQ,GACR,UAAU,GACV,aAAa,CAChB,GAAG;IAAE,OAAO,EAAE,cAAc,EAAE,CAAA;CAAE,CAAA;AAEjC,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,aAAa,CAAA;IACrB,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,CAAC,EAAE,aAAa,CAAA;IAC9B,IAAI,CAAC,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAA;IACjD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAChE,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/compositions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DefaultTreeMapDatum } from '@nivo/treemap';
|
|
2
2
|
import type { consoleLightTheme } from '@ultraviolet/themes';
|
|
3
3
|
type Theme = typeof consoleLightTheme;
|
|
4
|
-
type ReturnType = Record<string, string>;
|
|
5
4
|
/**
|
|
6
5
|
* Recursively collects all IDs from a tree map data structure.
|
|
7
6
|
*
|
|
@@ -65,11 +64,11 @@ export declare const getOpacity: (n: number) => number;
|
|
|
65
64
|
*/
|
|
66
65
|
export declare const percentToHex: (percentage: number) => string;
|
|
67
66
|
/**
|
|
68
|
-
* Generates
|
|
67
|
+
* Generates the needed colors for the tree map with graduated opacity values.
|
|
69
68
|
*
|
|
70
69
|
* @param {DefaultTreeMapDatum} data - The tree map data structure to generate colors for
|
|
71
70
|
* @param {Theme} theme - The theme object containing color configuration
|
|
72
|
-
* @returns {
|
|
71
|
+
* @returns {string[]} An array of color strings in hex format with alpha channel
|
|
73
72
|
*
|
|
74
73
|
* @description
|
|
75
74
|
* This function creates a color scheme for a tree map visualization by:
|
|
@@ -85,8 +84,8 @@ export declare const percentToHex: (percentage: number) => string;
|
|
|
85
84
|
* const data = { id: 'root', children: [{ id: 'child1' }, { id: 'child2' }] }
|
|
86
85
|
* const theme = { colors: { primary: { text: '#3B82F6' } } }
|
|
87
86
|
* getDataColors(data, theme)
|
|
88
|
-
* // returns { '
|
|
87
|
+
* // returns { '#3B82F6FF', '#3B82F600', '#3B82F610' }
|
|
89
88
|
*/
|
|
90
|
-
export declare const getDataColors: (data: DefaultTreeMapDatum, theme: Theme) =>
|
|
89
|
+
export declare const getDataColors: (data: DefaultTreeMapDatum, theme: Theme) => string[];
|
|
91
90
|
export {};
|
|
92
91
|
//# sourceMappingURL=treeMap.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeMap.d.ts","sourceRoot":"","sources":["../../src/helpers/treeMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,KAAK,KAAK,GAAG,OAAO,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"treeMap.d.ts","sourceRoot":"","sources":["../../src/helpers/treeMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,KAAK,KAAK,GAAG,OAAO,iBAAiB,CAAA;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,mBAAmB,KAAG,MAAM,EAU3D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,MAAM,KAAG,MAkBtC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,GAAI,YAAY,MAAM,KAAG,MAKjD,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,aAAa,GACxB,MAAM,mBAAmB,EACzB,OAAO,KAAK,KACX,MAAM,EASR,CAAA"}
|
package/dist/helpers/treeMap.js
CHANGED
|
@@ -28,11 +28,13 @@ const percentToHex = (percentage) => {
|
|
|
28
28
|
};
|
|
29
29
|
const getDataColors = (data, theme) => {
|
|
30
30
|
const baseColor = theme.colors.primary.text;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
return getAllIds(data).map(
|
|
32
|
+
(_, index) => (
|
|
33
|
+
// if we have more than 100 elements, we use the mod function to be able to return to the start
|
|
34
|
+
// as we only have 100 transparency values for a given color
|
|
35
|
+
`${baseColor}${percentToHex(getOpacity((100 - index) % 100))}`
|
|
36
|
+
)
|
|
37
|
+
);
|
|
36
38
|
};
|
|
37
39
|
export {
|
|
38
40
|
getAllIds,
|
|
@@ -598,6 +598,39 @@ export declare const useTheme: () => {
|
|
|
598
598
|
textDecoration: string;
|
|
599
599
|
weight: string;
|
|
600
600
|
};
|
|
601
|
+
codeSmall: {
|
|
602
|
+
fontFamily: string;
|
|
603
|
+
fontSize: string;
|
|
604
|
+
fontWeight: string;
|
|
605
|
+
letterSpacing: string;
|
|
606
|
+
lineHeight: string;
|
|
607
|
+
paragraphSpacing: string;
|
|
608
|
+
textCase: string;
|
|
609
|
+
textDecoration: string;
|
|
610
|
+
weight: string;
|
|
611
|
+
};
|
|
612
|
+
codeSmallStrong: {
|
|
613
|
+
fontFamily: string;
|
|
614
|
+
fontSize: string;
|
|
615
|
+
fontWeight: string;
|
|
616
|
+
letterSpacing: string;
|
|
617
|
+
lineHeight: string;
|
|
618
|
+
paragraphSpacing: string;
|
|
619
|
+
textCase: string;
|
|
620
|
+
textDecoration: string;
|
|
621
|
+
weight: string;
|
|
622
|
+
};
|
|
623
|
+
codeSmallStronger: {
|
|
624
|
+
fontFamily: string;
|
|
625
|
+
fontSize: string;
|
|
626
|
+
fontWeight: string;
|
|
627
|
+
letterSpacing: string;
|
|
628
|
+
lineHeight: string;
|
|
629
|
+
paragraphSpacing: string;
|
|
630
|
+
textCase: string;
|
|
631
|
+
textDecoration: string;
|
|
632
|
+
weight: string;
|
|
633
|
+
};
|
|
601
634
|
codeStrong: {
|
|
602
635
|
fontFamily: string;
|
|
603
636
|
fontSize: string;
|