@ultraviolet/ui 1.28.0 → 1.29.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/README.md +14 -7
- package/dist/index.d.ts +51 -2
- package/dist/src/components/ActionBar/index.js +22 -37
- package/dist/src/components/Alert/index.js +27 -41
- package/dist/src/components/Avatar/index.js +48 -69
- package/dist/src/components/Badge/index.js +29 -49
- package/dist/src/components/Banner/index.js +42 -62
- package/dist/src/components/BarChart/Tooltip.js +35 -50
- package/dist/src/components/BarChart/index.js +13 -14
- package/dist/src/components/BarStack/index.js +100 -191
- package/dist/src/components/Breadcrumbs/index.js +29 -39
- package/dist/src/components/Bullet/index.js +42 -55
- package/dist/src/components/Button/index.js +73 -99
- package/dist/src/components/Card/index.js +39 -57
- package/dist/src/components/Carousel/index.js +32 -60
- package/dist/src/components/Checkbox/index.js +153 -341
- package/dist/src/components/CheckboxGroup/index.js +25 -27
- package/dist/src/components/CopyButton/index.js +11 -12
- package/dist/src/components/DateInput/index.js +141 -268
- package/dist/src/components/EmptyState/index.js +68 -83
- package/dist/src/components/Expandable/index.js +13 -20
- package/dist/src/components/GlobalAlert/GlobalAlertLink.js +12 -13
- package/dist/src/components/GlobalAlert/index.js +19 -32
- package/dist/src/components/LineChart/CustomLegend.js +80 -89
- package/dist/src/components/LineChart/Tooltip.js +32 -47
- package/dist/src/components/LineChart/helpers.js +15 -50
- package/dist/src/components/LineChart/index.js +23 -33
- package/dist/src/components/Link/index.js +46 -65
- package/dist/src/components/List/Body.js +9 -15
- package/dist/src/components/List/Cell.js +6 -7
- package/dist/src/components/List/HeaderCell.js +28 -56
- package/dist/src/components/List/HeaderRow.js +9 -16
- package/dist/src/components/List/ListContext.js +5 -6
- package/dist/src/components/List/Row.js +44 -90
- package/dist/src/components/List/SelectBar.js +9 -13
- package/dist/src/components/List/SkeletonRows.js +5 -6
- package/dist/src/components/List/index.js +15 -25
- package/dist/src/components/Loader/index.js +18 -25
- package/dist/src/components/Menu/Item.js +39 -49
- package/dist/src/components/Menu/index.js +31 -56
- package/dist/src/components/MenuV2/Item.js +39 -49
- package/dist/src/components/MenuV2/index.js +28 -47
- package/dist/src/components/Meter/index.js +25 -47
- package/dist/src/components/Modal/Dialog.js +33 -58
- package/dist/src/components/Modal/Disclosure.js +8 -9
- package/dist/src/components/Modal/index.js +26 -33
- package/dist/src/components/Notice/index.js +21 -27
- package/dist/src/components/NumberInput/index.js +73 -137
- package/dist/src/components/Pagination/getPageNumbers.js +1 -4
- package/dist/src/components/Pagination/index.js +17 -27
- package/dist/src/components/PasswordCheck/index.js +26 -32
- package/dist/src/components/PasswordStrengthMeter/index.js +25 -44
- package/dist/src/components/PieChart/Legends.js +71 -107
- package/dist/src/components/PieChart/Tooltip.js +33 -36
- package/dist/src/components/PieChart/index.js +13 -17
- package/dist/src/components/Popover/index.js +58 -75
- package/dist/src/components/Popup/helpers.js +13 -15
- package/dist/src/components/Popup/index.js +55 -98
- package/dist/src/components/ProgressBar/index.js +31 -49
- package/dist/src/components/Radio/index.js +58 -113
- package/dist/src/components/RadioGroup/index.js +26 -28
- package/dist/src/components/Row/index.js +25 -31
- package/dist/src/components/SelectInput/index.js +357 -410
- package/dist/src/components/SelectableCard/index.js +73 -115
- package/dist/src/components/Separator/index.js +52 -73
- package/dist/src/components/Skeleton/Block.js +23 -41
- package/dist/src/components/Skeleton/Blocks.js +23 -41
- package/dist/src/components/Skeleton/BoxWithIcon.js +21 -36
- package/dist/src/components/Skeleton/Donut.js +3 -6
- package/dist/src/components/Skeleton/IconSkeleton.js +13 -31
- package/dist/src/components/Skeleton/Line.js +5 -11
- package/dist/src/components/Skeleton/List.js +22 -31
- package/dist/src/components/Skeleton/Slider.js +25 -46
- package/dist/src/components/Skeleton/Square.js +3 -6
- package/dist/src/components/Skeleton/index.js +17 -33
- package/dist/src/components/Snippet/index.js +82 -137
- package/dist/src/components/Stack/index.js +11 -14
- package/dist/src/components/Status/index.js +48 -78
- package/dist/src/components/StepList/index.js +45 -63
- package/dist/src/components/Stepper/index.js +74 -129
- package/dist/src/components/SwitchButton/FocusOverlay.js +13 -23
- package/dist/src/components/SwitchButton/index.js +36 -62
- package/dist/src/components/Table/Body.js +5 -8
- package/dist/src/components/Table/Cell.js +14 -20
- package/dist/src/components/Table/Header.js +8 -14
- package/dist/src/components/Table/HeaderCell.js +40 -56
- package/dist/src/components/Table/HeaderRow.js +4 -5
- package/dist/src/components/Table/Row.js +10 -14
- package/dist/src/components/Table/SelectBar.js +9 -13
- package/dist/src/components/Table/SkeletonRows.js +5 -6
- package/dist/src/components/Table/TableContext.js +6 -7
- package/dist/src/components/Table/index.js +44 -50
- package/dist/src/components/Tabs/Tab.js +57 -118
- package/dist/src/components/Tabs/TabMenu.js +32 -38
- package/dist/src/components/Tabs/TabMenuItem.js +9 -13
- package/dist/src/components/Tabs/index.js +24 -43
- package/dist/src/components/Tag/index.js +57 -74
- package/dist/src/components/TagInput/index.js +63 -94
- package/dist/src/components/TagList/index.js +22 -35
- package/dist/src/components/Text/index.js +29 -31
- package/dist/src/components/TextArea/index.js +240 -0
- package/dist/src/components/TextInput/index.js +166 -260
- package/dist/src/components/TimeInput/index.js +10 -13
- package/dist/src/components/Toaster/index.js +51 -67
- package/dist/src/components/Toggle/index.js +62 -129
- package/dist/src/components/ToggleGroup/index.js +21 -23
- package/dist/src/components/Tooltip/index.js +28 -31
- package/dist/src/components/VerificationCode/index.js +55 -90
- package/dist/src/index.js +1 -0
- package/dist/src/utils/ids.js +1 -6
- package/package.json +3 -3
|
@@ -29,41 +29,23 @@ const List = /*#__PURE__*/_styled("ul", {
|
|
|
29
29
|
});
|
|
30
30
|
const ListItem = /*#__PURE__*/_styled("li", {
|
|
31
31
|
target: "e12qyakg7"
|
|
32
|
-
})("display:flex;align-items:center;margin-top:",
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, ";
|
|
38
|
-
let {
|
|
39
|
-
isFocused,
|
|
40
|
-
theme
|
|
41
|
-
} = _ref2;
|
|
42
|
-
return isFocused ? theme.colors.primary.text : theme.colors.neutral.text;
|
|
43
|
-
}, ";");
|
|
32
|
+
})("display:flex;align-items:center;margin-top:", ({
|
|
33
|
+
theme
|
|
34
|
+
}) => theme.space['1'], ";width:100%;color:", ({
|
|
35
|
+
isFocused,
|
|
36
|
+
theme
|
|
37
|
+
}) => isFocused ? theme.colors.primary.text : theme.colors.neutral.text, ";");
|
|
44
38
|
const Bullet = /*#__PURE__*/_styled("div", {
|
|
45
39
|
target: "e12qyakg6"
|
|
46
|
-
})("display:inline-block;border-radius:",
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return theme.space['1'];
|
|
56
|
-
}, ";background:", _ref5 => {
|
|
57
|
-
let {
|
|
58
|
-
color
|
|
59
|
-
} = _ref5;
|
|
60
|
-
return color;
|
|
61
|
-
}, ";", _ref6 => {
|
|
62
|
-
let {
|
|
63
|
-
isFocused
|
|
64
|
-
} = _ref6;
|
|
65
|
-
return animationFlash(isFocused);
|
|
66
|
-
}, ";");
|
|
40
|
+
})("display:inline-block;border-radius:", ({
|
|
41
|
+
theme
|
|
42
|
+
}) => theme.radii.circle, ";width:10px;height:10px;margin:0 ", ({
|
|
43
|
+
theme
|
|
44
|
+
}) => theme.space['1'], ";background:", ({
|
|
45
|
+
color
|
|
46
|
+
}) => color, ";", ({
|
|
47
|
+
isFocused
|
|
48
|
+
}) => animationFlash(isFocused), ";");
|
|
67
49
|
const Label = /*#__PURE__*/_styled("div", {
|
|
68
50
|
target: "e12qyakg5"
|
|
69
51
|
})(process.env.NODE_ENV === "production" ? {
|
|
@@ -76,20 +58,14 @@ const Label = /*#__PURE__*/_styled("div", {
|
|
|
76
58
|
});
|
|
77
59
|
const Value = /*#__PURE__*/_styled("div", {
|
|
78
60
|
target: "e12qyakg4"
|
|
79
|
-
})("margin-left:6px;font-weight:",
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} = _ref7;
|
|
83
|
-
return isFocused ? 500 : 400;
|
|
84
|
-
}, ";");
|
|
61
|
+
})("margin-left:6px;font-weight:", ({
|
|
62
|
+
isFocused
|
|
63
|
+
}) => isFocused ? 500 : 400, ";");
|
|
85
64
|
const Text = /*#__PURE__*/_styled("span", {
|
|
86
65
|
target: "e12qyakg3"
|
|
87
|
-
})("flex:none;margin-right:6px;font-weight:",
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
} = _ref8;
|
|
91
|
-
return isFocused ? 500 : 400;
|
|
92
|
-
}, ";");
|
|
66
|
+
})("flex:none;margin-right:6px;font-weight:", ({
|
|
67
|
+
isFocused
|
|
68
|
+
}) => isFocused ? 500 : 400, ";");
|
|
93
69
|
const ToggleBox = /*#__PURE__*/_styled("div", {
|
|
94
70
|
target: "e12qyakg2"
|
|
95
71
|
})(process.env.NODE_ENV === "production" ? {
|
|
@@ -102,73 +78,61 @@ const ToggleBox = /*#__PURE__*/_styled("div", {
|
|
|
102
78
|
});
|
|
103
79
|
const Line = /*#__PURE__*/_styled("span", {
|
|
104
80
|
target: "e12qyakg1"
|
|
105
|
-
})("border-bottom:1px solid ",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
} = _ref9;
|
|
109
|
-
return theme.colors.neutral.border;
|
|
110
|
-
}, ";position:relative;width:100%;");
|
|
81
|
+
})("border-bottom:1px solid ", ({
|
|
82
|
+
theme
|
|
83
|
+
}) => theme.colors.neutral.border, ";position:relative;width:100%;");
|
|
111
84
|
const ProgressiveLine = /*#__PURE__*/_styled("span", {
|
|
112
85
|
target: "e12qyakg0"
|
|
113
|
-
})("border-bottom:1px solid ",
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
86
|
+
})("border-bottom:1px solid ", ({
|
|
87
|
+
theme
|
|
88
|
+
}) => theme.colors.primary.border, ";position:absolute;left:0;top:0;bottom:-1px;transition:width 500ms ease;width:", ({
|
|
89
|
+
isFocused
|
|
90
|
+
}) => isFocused ? 100 : 0, "%;");
|
|
91
|
+
const Legends = ({
|
|
92
|
+
focused,
|
|
93
|
+
data,
|
|
94
|
+
onFocusChange,
|
|
95
|
+
colors
|
|
96
|
+
}) => jsx(List, {
|
|
97
|
+
children: data?.map((item, index) => {
|
|
98
|
+
const isSegmentFocused = focused !== undefined && item.id === focused;
|
|
99
|
+
const id = `chart-legend-${item.id}`;
|
|
100
|
+
return jsx(Tooltip, {
|
|
101
|
+
visible: isSegmentFocused,
|
|
102
|
+
id: id,
|
|
103
|
+
text: jsx(TooltipContainer, {
|
|
104
|
+
data: item
|
|
105
|
+
}),
|
|
106
|
+
children: jsxs(ListItem, {
|
|
107
|
+
isFocused: isSegmentFocused,
|
|
108
|
+
children: [jsx(ToggleBox, {
|
|
109
|
+
"data-testid": id,
|
|
110
|
+
onMouseOver: () => onFocusChange(item.id),
|
|
111
|
+
onFocus: () => onFocusChange(item.id),
|
|
112
|
+
onMouseOut: () => onFocusChange(),
|
|
113
|
+
onBlur: () => onFocusChange()
|
|
114
|
+
}), jsx(Bullet, {
|
|
115
|
+
color: colors[index],
|
|
142
116
|
isFocused: isSegmentFocused,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
onMouseOut: () => onFocusChange(),
|
|
148
|
-
onBlur: () => onFocusChange()
|
|
149
|
-
}), jsx(Bullet, {
|
|
150
|
-
color: colors[index],
|
|
117
|
+
needPattern: item.needPattern,
|
|
118
|
+
id: `chart-legend-${item.id}`
|
|
119
|
+
}), jsxs(Label, {
|
|
120
|
+
children: [jsx(Text, {
|
|
151
121
|
isFocused: isSegmentFocused,
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
children: item.name
|
|
158
|
-
}), jsx(Line, {
|
|
159
|
-
children: jsx(ProgressiveLine, {
|
|
160
|
-
isFocused: isSegmentFocused
|
|
161
|
-
})
|
|
162
|
-
})]
|
|
163
|
-
}), jsx(Value, {
|
|
164
|
-
isFocused: isSegmentFocused,
|
|
165
|
-
children: item.value
|
|
122
|
+
children: item.name
|
|
123
|
+
}), jsx(Line, {
|
|
124
|
+
children: jsx(ProgressiveLine, {
|
|
125
|
+
isFocused: isSegmentFocused
|
|
126
|
+
})
|
|
166
127
|
})]
|
|
167
|
-
})
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
128
|
+
}), jsx(Value, {
|
|
129
|
+
isFocused: isSegmentFocused,
|
|
130
|
+
children: item.value
|
|
131
|
+
})]
|
|
132
|
+
})
|
|
133
|
+
}, item.id);
|
|
134
|
+
})
|
|
135
|
+
});
|
|
172
136
|
var Legends$1 = Legends;
|
|
173
137
|
|
|
174
138
|
export { Legends$1 as default };
|
|
@@ -23,42 +23,39 @@ const StyledItem = /*#__PURE__*/_styled("li", {
|
|
|
23
23
|
styles: "display:flex;margin-top:6px;width:100%;justify-content:space-between;text-align:left;gap:8px",
|
|
24
24
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
25
25
|
});
|
|
26
|
-
const Tooltip =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
};
|
|
26
|
+
const Tooltip = ({
|
|
27
|
+
data
|
|
28
|
+
}) => jsx("div", {
|
|
29
|
+
tabIndex: -1,
|
|
30
|
+
role: "tooltip",
|
|
31
|
+
children: jsxs(StyledList, {
|
|
32
|
+
children: [jsxs(StyledItem, {
|
|
33
|
+
children: [jsx(Text, {
|
|
34
|
+
as: "p",
|
|
35
|
+
variant: "body",
|
|
36
|
+
prominence: "stronger",
|
|
37
|
+
children: data.name
|
|
38
|
+
}), jsx(Text, {
|
|
39
|
+
as: "p",
|
|
40
|
+
variant: "body",
|
|
41
|
+
prominence: "stronger",
|
|
42
|
+
children: data.value
|
|
43
|
+
})]
|
|
44
|
+
}), data.details?.map(detail => jsxs(StyledItem, {
|
|
45
|
+
children: [jsx(Text, {
|
|
46
|
+
as: "p",
|
|
47
|
+
variant: "bodySmall",
|
|
48
|
+
prominence: "stronger",
|
|
49
|
+
children: detail.name
|
|
50
|
+
}), jsx(Text, {
|
|
51
|
+
as: "p",
|
|
52
|
+
variant: "bodySmall",
|
|
53
|
+
prominence: "stronger",
|
|
54
|
+
children: detail.value
|
|
55
|
+
})]
|
|
56
|
+
}, detail.name))]
|
|
57
|
+
})
|
|
58
|
+
});
|
|
62
59
|
var TooltipContainer = Tooltip;
|
|
63
60
|
|
|
64
61
|
export { TooltipContainer as default };
|
|
@@ -10,12 +10,9 @@ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
|
10
10
|
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
11
11
|
const Container = /*#__PURE__*/_styled("div", {
|
|
12
12
|
target: "epjfe5p2"
|
|
13
|
-
})("display:flex;align-items:center;height:",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} = _ref;
|
|
17
|
-
return `${height}px`;
|
|
18
|
-
}, ";");
|
|
13
|
+
})("display:flex;align-items:center;height:", ({
|
|
14
|
+
height
|
|
15
|
+
}) => `${height}px`, ";");
|
|
19
16
|
const EmptyLegend = /*#__PURE__*/_styled("div", {
|
|
20
17
|
target: "epjfe5p1"
|
|
21
18
|
})(process.env.NODE_ENV === "production" ? {
|
|
@@ -49,17 +46,16 @@ const DEFAULT_MARGIN = {
|
|
|
49
46
|
* See https://nivo.rocks/pie/ for more information.
|
|
50
47
|
* @experimental This component is experimental and may be subject to breaking changes in the future.
|
|
51
48
|
*/
|
|
52
|
-
const PieChart =
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
} = _ref2;
|
|
49
|
+
const PieChart = ({
|
|
50
|
+
height = 206,
|
|
51
|
+
width = 206,
|
|
52
|
+
data = undefined,
|
|
53
|
+
emptyLegend,
|
|
54
|
+
content,
|
|
55
|
+
withLegend = false,
|
|
56
|
+
margin = DEFAULT_MARGIN,
|
|
57
|
+
chartProps = DEFAULT_CHARTPROPS
|
|
58
|
+
}) => {
|
|
63
59
|
const theme = useTheme();
|
|
64
60
|
const [currentFocusIndex, setCurrentFocusIndex] = useState();
|
|
65
61
|
const emptyTooltip = useCallback(() => jsx("span", {}), []);
|
|
@@ -14,26 +14,16 @@ const SIZES_WIDTH = {
|
|
|
14
14
|
const StyledPopup = /*#__PURE__*/_styled(Popup, {
|
|
15
15
|
shouldForwardProp: prop => !['sentiment', 'size'].includes(prop),
|
|
16
16
|
target: "ejpxv5a1"
|
|
17
|
-
})("padding:",
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}, "px;max-width:", _ref3 => {
|
|
28
|
-
let {
|
|
29
|
-
size
|
|
30
|
-
} = _ref3;
|
|
31
|
-
return SIZES_WIDTH[size];
|
|
32
|
-
}, "px;text-align:initial;", _ref4 => {
|
|
33
|
-
let {
|
|
34
|
-
theme,
|
|
35
|
-
sentiment
|
|
36
|
-
} = _ref4;
|
|
17
|
+
})("padding:", ({
|
|
18
|
+
theme
|
|
19
|
+
}) => theme.space['2'], ";width:", ({
|
|
20
|
+
size
|
|
21
|
+
}) => SIZES_WIDTH[size], "px;max-width:", ({
|
|
22
|
+
size
|
|
23
|
+
}) => SIZES_WIDTH[size], "px;text-align:initial;", ({
|
|
24
|
+
theme,
|
|
25
|
+
sentiment
|
|
26
|
+
}) => {
|
|
37
27
|
if (sentiment === 'neutral') {
|
|
38
28
|
return `
|
|
39
29
|
background: ${theme.colors.neutral.background};
|
|
@@ -59,67 +49,60 @@ const StyledPopup = /*#__PURE__*/_styled(Popup, {
|
|
|
59
49
|
// This is to avoid having text inherit color from popup (which is white on white background)
|
|
60
50
|
const StyledStack = /*#__PURE__*/_styled(Stack, {
|
|
61
51
|
target: "ejpxv5a0"
|
|
62
|
-
})("color:",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
direction: "row",
|
|
79
|
-
justifyContent: "space-between",
|
|
80
|
-
children: [jsx(Text, {
|
|
81
|
-
variant: "bodyStrong",
|
|
82
|
-
as: "h3",
|
|
83
|
-
sentiment: "neutral",
|
|
84
|
-
prominence: sentiment === 'neutral' ? 'strong' : 'stronger',
|
|
85
|
-
children: title
|
|
86
|
-
}), jsx(Button, {
|
|
87
|
-
variant: sentiment === 'neutral' ? 'ghost' : 'filled',
|
|
88
|
-
sentiment: sentiment === 'neutral' ? 'neutral' : 'primary',
|
|
89
|
-
onClick: onClose,
|
|
90
|
-
size: "small",
|
|
91
|
-
icon: "close",
|
|
92
|
-
"aria-label": "close"
|
|
93
|
-
})]
|
|
94
|
-
}), typeof children === 'string' ? jsx(Text, {
|
|
95
|
-
variant: "bodySmall",
|
|
96
|
-
as: "p",
|
|
52
|
+
})("color:", ({
|
|
53
|
+
theme
|
|
54
|
+
}) => theme.colors.neutral.text, ";");
|
|
55
|
+
const ContentWrapper = ({
|
|
56
|
+
title,
|
|
57
|
+
onClose,
|
|
58
|
+
children,
|
|
59
|
+
sentiment
|
|
60
|
+
}) => jsxs(StyledStack, {
|
|
61
|
+
gap: 1,
|
|
62
|
+
children: [jsxs(Stack, {
|
|
63
|
+
direction: "row",
|
|
64
|
+
justifyContent: "space-between",
|
|
65
|
+
children: [jsx(Text, {
|
|
66
|
+
variant: "bodyStrong",
|
|
67
|
+
as: "h3",
|
|
97
68
|
sentiment: "neutral",
|
|
98
69
|
prominence: sentiment === 'neutral' ? 'strong' : 'stronger',
|
|
99
|
-
children:
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
|
|
70
|
+
children: title
|
|
71
|
+
}), jsx(Button, {
|
|
72
|
+
variant: sentiment === 'neutral' ? 'ghost' : 'filled',
|
|
73
|
+
sentiment: sentiment === 'neutral' ? 'neutral' : 'primary',
|
|
74
|
+
onClick: onClose,
|
|
75
|
+
size: "small",
|
|
76
|
+
icon: "close",
|
|
77
|
+
"aria-label": "close"
|
|
78
|
+
})]
|
|
79
|
+
}), typeof children === 'string' ? jsx(Text, {
|
|
80
|
+
variant: "bodySmall",
|
|
81
|
+
as: "p",
|
|
82
|
+
sentiment: "neutral",
|
|
83
|
+
prominence: sentiment === 'neutral' ? 'strong' : 'stronger',
|
|
84
|
+
children: children
|
|
85
|
+
}) : children]
|
|
86
|
+
});
|
|
103
87
|
/**
|
|
104
88
|
* Popover component is used to display additional information or actions on top of the main content of the page.
|
|
105
89
|
* It is usually triggered by clicking on a button. It includes a title, a close button and a content area.
|
|
106
90
|
*/
|
|
107
|
-
const Popover = /*#__PURE__*/forwardRef((
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} = _ref7;
|
|
91
|
+
const Popover = /*#__PURE__*/forwardRef(({
|
|
92
|
+
visible = false,
|
|
93
|
+
children,
|
|
94
|
+
placement,
|
|
95
|
+
content,
|
|
96
|
+
title,
|
|
97
|
+
sentiment = 'neutral',
|
|
98
|
+
size = 'medium',
|
|
99
|
+
onClose,
|
|
100
|
+
className,
|
|
101
|
+
maxWidth,
|
|
102
|
+
maxHeight,
|
|
103
|
+
'data-testid': dataTestId,
|
|
104
|
+
portalTarget
|
|
105
|
+
}, ref) => {
|
|
123
106
|
const innerRef = useRef(null);
|
|
124
107
|
const [localVisible, setLocalVisible] = useState(visible);
|
|
125
108
|
|
|
@@ -13,14 +13,13 @@ const DEFAULT_POSITIONS = {
|
|
|
13
13
|
/**
|
|
14
14
|
* This function will find the best placement in a window for popup based on children position and popup size
|
|
15
15
|
*/
|
|
16
|
-
const computePlacement =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} = _ref;
|
|
16
|
+
const computePlacement = ({
|
|
17
|
+
childrenStructuredRef,
|
|
18
|
+
popupStructuredRef,
|
|
19
|
+
offsetParentRect,
|
|
20
|
+
offsetParent,
|
|
21
|
+
popupPortalTarget
|
|
22
|
+
}) => {
|
|
24
23
|
const {
|
|
25
24
|
top: childrenTop,
|
|
26
25
|
left: childrenLeft,
|
|
@@ -82,13 +81,12 @@ const findOffsetParent = element => {
|
|
|
82
81
|
/**
|
|
83
82
|
* This function will compute the positions of popup and arrow based on children position and popup size
|
|
84
83
|
*/
|
|
85
|
-
const computePositions =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} = _ref2;
|
|
84
|
+
const computePositions = ({
|
|
85
|
+
placement,
|
|
86
|
+
childrenRef,
|
|
87
|
+
popupRef,
|
|
88
|
+
popupPortalTarget
|
|
89
|
+
}) => {
|
|
92
90
|
const childrenRect = childrenRef.current.getBoundingClientRect();
|
|
93
91
|
const offsetParent = findOffsetParent(childrenRef);
|
|
94
92
|
const offsetParentRect = offsetParent?.getBoundingClientRect() ?? {
|