@vitality-ds/components 5.7.0-alpha.1 → 5.7.0-alpha.3
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/AuditTrail/components/AuditItem/index.spec.js +14 -13
- package/dist/AuditTrail/components/IconAvatar/index.js +3 -4
- package/dist/AuditTrail/constants.js +21 -20
- package/dist/Breadcrumbs/components/Breadcrumb/index.js +3 -3
- package/dist/Button/components/ButtonIcon/styles/BaseButtonIcon.styles.js +27 -30
- package/dist/Button/primitives/styles/BaseContentContainer.styles.js +1 -1
- package/dist/Callout/constants.js +19 -17
- package/dist/Callout/hooks/useCalloutContent.js +1 -1
- package/dist/Callout/index.js +10 -14
- package/dist/Callout/styles/BaseCalloutIconContainer.styles.js +12 -2
- package/dist/Chip/components/Checkbox/constants.js +4 -4
- package/dist/Chip/components/ChipIcon/index.js +2 -2
- package/dist/Chip/components/RemoveButton/index.js +4 -4
- package/dist/Chip/components/RemoveButton/styles/BaseRemoveButtonButton.styles.js +4 -1
- package/dist/Chip/styles/BaseChip.styles.js +1 -1
- package/dist/ComboButton/index.js +2 -2
- package/dist/Dialog/components/DialogHeader/index.js +5 -4
- package/dist/Dialog/constants.js +3 -3
- package/dist/DropdownMenu/components/Content/index.js +5 -6
- package/dist/DropdownMenu/components/IconContainer/index.js +1 -2
- package/dist/DropdownMenu/styles/Content.styles.js +4 -1
- package/dist/Form/FormField/index.js +4 -4
- package/dist/Form/HelperMessage/index.js +4 -4
- package/dist/IconButton/index.js +2 -2
- package/dist/IconButton/styles/BaseIconButton.styles.js +6 -3
- package/dist/Input/DatePicker/components/Calendar/index.js +3 -3
- package/dist/Input/DatePicker/index.js +2 -2
- package/dist/Input/DateRangePicker/index.js +4 -6
- package/dist/Input/DateRangePicker/styles/ExtrasContainers.js +7 -2
- package/dist/Input/PasswordInput/constants.js +3 -3
- package/dist/Input/SearchInput/index.js +2 -2
- package/dist/Input/Select/SearchSelectInput/index.js +2 -2
- package/dist/Input/Select/components/Chip/MultiValueRemove/index.js +4 -4
- package/dist/Input/Select/components/ClearButton/index.js +4 -4
- package/dist/Input/Select/components/DropdownIndicator/index.js +7 -7
- package/dist/Input/TextInput/components/IconAdornment/index.js +1 -2
- package/dist/Input/TextInput/components/IconAdornment/styles/BaseIconWrapper.styles.js +6 -2
- package/dist/Input/TextInput/components/IconButtonAdornment/index.js +1 -4
- package/dist/Input/TextInput/components/IconButtonAdornment/styles/BaseIconButtonWrapper.styles.js +1 -6
- package/dist/Input/TextInput/components/SpinnerAdornment/index.js +1 -1
- package/dist/Input/TextInput/components/SpinnerAdornment/styles/BaseSpinnerWrapper.styles.js +1 -1
- package/dist/LucideProvider/index.js +18 -0
- package/dist/LucideProvider/types.js +1 -0
- package/dist/Provider/index.js +3 -1
- package/dist/Sidebar/components/SidebarCloseButton/index.js +2 -2
- package/dist/StatusBadge/components/StatusBadgeIcon/styles/BaseStatusBadge.styles.js +1 -1
- package/dist/StatusBadge/constants.js +9 -6
- package/dist/StatusBadge/logic.spec.js +13 -6
- package/dist/StatusBadge/styles/BaseStatusBadge.styles.js +27 -1
- package/dist/Switch/index.js +4 -4
- package/dist/Table/components/Cells/RowActions/constants.js +5 -5
- package/dist/Table/components/Cells/SortableHeader/components/SortableIcon/index.js +3 -4
- package/dist/Table/components/Cells/SortableHeader/components/SortableIcon/styles/BaseSortableIconContainer.styles.js +3 -1
- package/dist/Table/components/Cells/SortableHeader/components/SortedIcon/index.js +4 -4
- package/dist/Table/components/Cells/SortableHeader/components/SortedIcon/styles/BaseSortedIconContainer.js +4 -2
- package/dist/Table/components/MemoizedCell/constants.js +4 -1
- package/dist/Table/components/MemoizedCell/logic.js +6 -5
- package/dist/Table/components/MemoizedCell/logic.spec.js +24 -0
- package/dist/Table/components/Pagination/index.js +3 -3
- package/dist/Table/components/States/Error/index.js +5 -4
- package/dist/Toaster/components/CloseIconButton/index.js +4 -4
- package/dist/Toaster/components/Toast/constants.js +6 -6
- package/dist/Toaster/components/Toast/helpers/getVariantsByColorScale.js +2 -4
- package/dist/Toaster/components/Toast/index.js +1 -1
- package/dist/Toaster/components/Toast/logic.spec.js +6 -6
- package/dist/Toaster/components/Toast/styles/BaseToast.styles.js +3 -0
- package/dist/Typography/styles/BaseTypography.styles.js +128 -127
- package/dist/components/src/AuditTrail/components/IconAvatar/types.d.ts +2 -3
- package/dist/components/src/AuditTrail/logic.d.ts +2 -2
- package/dist/components/src/AuditTrail/types.d.ts +2 -3
- package/dist/components/src/Button/components/ButtonIcon/styled.d.ts +2 -45
- package/dist/components/src/Button/components/ButtonIcon/styles/BaseButtonIcon.styles.d.ts +2 -45
- package/dist/components/src/Callout/styled.d.ts +408 -1
- package/dist/components/src/Callout/styles/BaseCalloutIconContainer.styles.d.ts +14 -1
- package/dist/components/src/Callout/types.d.ts +4 -4
- package/dist/components/src/Chip/components/ChipIcon/types.d.ts +2 -3
- package/dist/components/src/Chip/types.d.ts +3 -4
- package/dist/components/src/Dialog/types.d.ts +4 -4
- package/dist/components/src/DropdownMenu/components/DropdownMenuItem/types.d.ts +2 -3
- package/dist/components/src/Form/FormField/constants.d.ts +2 -2
- package/dist/components/src/IconButton/styled.d.ts +10 -4
- package/dist/components/src/IconButton/styles/BaseIconButton.styles.d.ts +5 -2
- package/dist/components/src/IconButton/types.d.ts +3 -4
- package/dist/components/src/Input/PasswordInput/types.d.ts +3 -2
- package/dist/components/src/Input/SearchInput/types.d.ts +2 -3
- package/dist/components/src/Input/Select/AsyncSelect/index.d.ts +1 -1
- package/dist/components/src/Input/Select/SearchSelectInput/index.d.ts +1 -1
- package/dist/components/src/Input/Select/types.d.ts +2 -2
- package/dist/components/src/Input/TextInput/components/IconAdornment/types.d.ts +3 -7
- package/dist/components/src/Link/styled.d.ts +3 -259
- package/dist/components/src/LucideProvider/index.d.ts +4 -0
- package/dist/components/src/LucideProvider/types.d.ts +7 -0
- package/dist/components/src/Provider/types.d.ts +10 -1
- package/dist/components/src/StatusBadge/styled.d.ts +6 -0
- package/dist/components/src/StatusBadge/styles/BaseStatusBadge.styles.d.ts +2 -0
- package/dist/components/src/StatusBadge/types.d.ts +1 -1
- package/dist/components/src/Table/components/Cells/Icon/types.d.ts +3 -4
- package/dist/components/src/Table/components/Cells/RowActions/constants.d.ts +4 -5
- package/dist/components/src/Table/components/Cells/SortableHeader/components/SortedIcon/styled.d.ts +2 -0
- package/dist/components/src/Table/components/Cells/SortableHeader/components/SortedIcon/styles/BaseSortedIconContainer.d.ts +2 -0
- package/dist/components/src/Table/components/MemoizedCell/constants.d.ts +1 -0
- package/dist/components/src/Toaster/components/Toast/constants.d.ts +5 -6
- package/dist/components/src/Toaster/components/Toast/helpers/getVariantsByColorScale.d.ts +2 -4
- package/dist/components/src/Toaster/components/Toast/styled.d.ts +13 -20
- package/dist/components/src/Toaster/components/Toast/styles/BaseToast.styles.d.ts +13 -20
- package/dist/components/src/Typography/styled.d.ts +3 -259
- package/dist/components/src/Typography/styles/BaseTypography.styles.d.ts +3 -313
- package/dist/esm/AuditTrail/components/AuditItem/index.spec.js +15 -14
- package/dist/esm/AuditTrail/components/IconAvatar/index.js +3 -4
- package/dist/esm/AuditTrail/constants.js +22 -21
- package/dist/esm/Breadcrumbs/components/Breadcrumb/index.js +2 -2
- package/dist/esm/Button/components/ButtonIcon/styles/BaseButtonIcon.styles.js +27 -29
- package/dist/esm/Button/primitives/styles/BaseContentContainer.styles.js +1 -1
- package/dist/esm/Callout/constants.js +14 -13
- package/dist/esm/Callout/hooks/useCalloutContent.js +1 -1
- package/dist/esm/Callout/index.js +10 -14
- package/dist/esm/Callout/styles/BaseCalloutIconContainer.styles.js +12 -2
- package/dist/esm/Chip/components/Checkbox/constants.js +4 -4
- package/dist/esm/Chip/components/ChipIcon/index.js +2 -2
- package/dist/esm/Chip/components/RemoveButton/index.js +4 -4
- package/dist/esm/Chip/components/RemoveButton/styles/BaseRemoveButtonButton.styles.js +4 -1
- package/dist/esm/Chip/styles/BaseChip.styles.js +1 -1
- package/dist/esm/ComboButton/index.js +2 -2
- package/dist/esm/Dialog/components/DialogHeader/index.js +5 -4
- package/dist/esm/Dialog/constants.js +3 -3
- package/dist/esm/DropdownMenu/components/Content/index.js +4 -5
- package/dist/esm/DropdownMenu/components/IconContainer/index.js +1 -2
- package/dist/esm/DropdownMenu/styles/Content.styles.js +4 -1
- package/dist/esm/Form/FormField/index.js +3 -3
- package/dist/esm/Form/HelperMessage/index.js +4 -4
- package/dist/esm/IconButton/index.js +2 -2
- package/dist/esm/IconButton/styles/BaseIconButton.styles.js +6 -3
- package/dist/esm/Input/DatePicker/components/Calendar/index.js +1 -1
- package/dist/esm/Input/DatePicker/index.js +2 -2
- package/dist/esm/Input/DateRangePicker/index.js +4 -6
- package/dist/esm/Input/DateRangePicker/styles/ExtrasContainers.js +6 -2
- package/dist/esm/Input/PasswordInput/constants.js +3 -3
- package/dist/esm/Input/SearchInput/index.js +1 -1
- package/dist/esm/Input/Select/SearchSelectInput/index.js +1 -1
- package/dist/esm/Input/Select/components/Chip/MultiValueRemove/index.js +4 -4
- package/dist/esm/Input/Select/components/ClearButton/index.js +4 -4
- package/dist/esm/Input/Select/components/DropdownIndicator/index.js +7 -7
- package/dist/esm/Input/TextInput/components/IconAdornment/index.js +1 -2
- package/dist/esm/Input/TextInput/components/IconAdornment/styles/BaseIconWrapper.styles.js +6 -3
- package/dist/esm/Input/TextInput/components/IconButtonAdornment/index.js +1 -4
- package/dist/esm/Input/TextInput/components/IconButtonAdornment/styles/BaseIconButtonWrapper.styles.js +1 -6
- package/dist/esm/Input/TextInput/components/SpinnerAdornment/index.js +1 -1
- package/dist/esm/Input/TextInput/components/SpinnerAdornment/styles/BaseSpinnerWrapper.styles.js +1 -1
- package/dist/esm/LucideProvider/index.js +11 -0
- package/dist/esm/LucideProvider/types.js +1 -0
- package/dist/esm/Provider/index.js +3 -1
- package/dist/esm/Sidebar/components/SidebarCloseButton/index.js +2 -2
- package/dist/esm/StatusBadge/components/StatusBadgeIcon/styles/BaseStatusBadge.styles.js +1 -1
- package/dist/esm/StatusBadge/constants.js +8 -5
- package/dist/esm/StatusBadge/logic.spec.js +11 -4
- package/dist/esm/StatusBadge/styles/BaseStatusBadge.styles.js +27 -1
- package/dist/esm/Switch/index.js +4 -4
- package/dist/esm/Table/components/Cells/RowActions/constants.js +4 -4
- package/dist/esm/Table/components/Cells/SortableHeader/components/SortableIcon/index.js +3 -4
- package/dist/esm/Table/components/Cells/SortableHeader/components/SortableIcon/styles/BaseSortableIconContainer.styles.js +3 -1
- package/dist/esm/Table/components/Cells/SortableHeader/components/SortedIcon/index.js +4 -4
- package/dist/esm/Table/components/Cells/SortableHeader/components/SortedIcon/styles/BaseSortedIconContainer.js +4 -2
- package/dist/esm/Table/components/MemoizedCell/constants.js +3 -0
- package/dist/esm/Table/components/MemoizedCell/logic.js +7 -6
- package/dist/esm/Table/components/MemoizedCell/logic.spec.js +24 -0
- package/dist/esm/Table/components/Pagination/index.js +1 -1
- package/dist/esm/Table/components/States/Error/index.js +5 -4
- package/dist/esm/Toaster/components/CloseIconButton/index.js +4 -4
- package/dist/esm/Toaster/components/Toast/constants.js +4 -4
- package/dist/esm/Toaster/components/Toast/helpers/getVariantsByColorScale.js +2 -4
- package/dist/esm/Toaster/components/Toast/index.js +1 -1
- package/dist/esm/Toaster/components/Toast/logic.spec.js +4 -4
- package/dist/esm/Toaster/components/Toast/styles/BaseToast.styles.js +3 -0
- package/dist/esm/Typography/styles/BaseTypography.styles.js +128 -127
- package/dist/esm/helpers/logic/get-component-from-lookup.spec.js +3 -3
- package/dist/helpers/logic/get-component-from-lookup.spec.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -2,13 +2,15 @@ import { colorUseCases, css, getColorScaleValueByUseCase } from "@vitality-ds/sy
|
|
|
2
2
|
var text = colorUseCases.text;
|
|
3
3
|
export default css({
|
|
4
4
|
color: getColorScaleValueByUseCase("neutral", text.lowContrast),
|
|
5
|
+
height: "1rem",
|
|
6
|
+
width: "1rem",
|
|
5
7
|
variants: {
|
|
6
8
|
sortBy: {
|
|
7
9
|
descending: {
|
|
8
|
-
transform: "rotate(
|
|
10
|
+
transform: "rotate(180deg)"
|
|
9
11
|
},
|
|
10
12
|
ascending: {
|
|
11
|
-
transform: "rotate(
|
|
13
|
+
transform: "rotate(0deg)"
|
|
12
14
|
}
|
|
13
15
|
}
|
|
14
16
|
}
|
|
@@ -2,6 +2,9 @@ import { AsyncSelectCell, ButtonCell, CreatableSelectCell, CurrencyInputCell, Da
|
|
|
2
2
|
import CustomCell from "../Cells/Custom";
|
|
3
3
|
import SearchSelectInputCell from "../Cells/SearchSelectInput";
|
|
4
4
|
export var DEFAULT_EMPTY_PLACEHOLDER = "-";
|
|
5
|
+
|
|
6
|
+
// Cell types that can safely render a placeholder with only `children`
|
|
7
|
+
export var PLACEHOLDER_SAFE_CELL_TYPES = ["text", "number"];
|
|
5
8
|
var errorGetCellProps = function errorGetCellProps(componentName) {
|
|
6
9
|
// eslint-disable-next-line no-console
|
|
7
10
|
console.error("[Vitality] You're trying to render a ".concat(componentName, " cell. But no getCellProps function was given to the column as a result nothing could be rendered. Please refer to https://vitalitydesignsystem.com/components/table for an implementation."));
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import {
|
|
3
|
-
import { CELL_TYPES, DEFAULT_EMPTY_PLACEHOLDER } from "./constants";
|
|
2
|
+
import { CELL_TYPES, DEFAULT_EMPTY_PLACEHOLDER, PLACEHOLDER_SAFE_CELL_TYPES } from "./constants";
|
|
4
3
|
function isCellContentsEmpty(rowData, colId, computedCellProps) {
|
|
5
4
|
return rowData[colId] !== 0 && !rowData[colId] && !computedCellProps;
|
|
6
5
|
}
|
|
@@ -9,14 +8,16 @@ function getCellType(cellType, _ref, rowData, emptyPlaceholderText) {
|
|
|
9
8
|
getCellProps = _ref.getCellProps;
|
|
10
9
|
var computedCellProps = typeof getCellProps === "function" && getCellProps(colId, rowData);
|
|
11
10
|
if (isCellContentsEmpty(rowData, colId, computedCellProps)) {
|
|
11
|
+
var _ref2 = PLACEHOLDER_SAFE_CELL_TYPES.includes(cellType) ? CELL_TYPES[cellType] : CELL_TYPES.text,
|
|
12
|
+
EmptyComponent = _ref2.component;
|
|
12
13
|
return {
|
|
13
|
-
as:
|
|
14
|
+
as: EmptyComponent,
|
|
14
15
|
children: emptyPlaceholderText || DEFAULT_EMPTY_PLACEHOLDER
|
|
15
16
|
};
|
|
16
17
|
}
|
|
17
|
-
var
|
|
18
|
-
Component =
|
|
19
|
-
defaultGetCellProps =
|
|
18
|
+
var _ref3 = CELL_TYPES[cellType] || CELL_TYPES.text,
|
|
19
|
+
Component = _ref3.component,
|
|
20
|
+
defaultGetCellProps = _ref3.getCellProps;
|
|
20
21
|
var getCellPropsFn = getCellProps || defaultGetCellProps;
|
|
21
22
|
return _extends({}, getCellPropsFn(colId, rowData), {
|
|
22
23
|
as: Component
|
|
@@ -68,6 +68,30 @@ describe("getCellType function", function () {
|
|
|
68
68
|
expect(data.as).toEqual(NumberCell);
|
|
69
69
|
expect(data.children).toEqual("12");
|
|
70
70
|
});
|
|
71
|
+
it("Should return a NumberCell with placeholder when number cell is empty", function () {
|
|
72
|
+
rowData.number = "";
|
|
73
|
+
var data = getCellType("number", {
|
|
74
|
+
colId: "number"
|
|
75
|
+
}, rowData, null);
|
|
76
|
+
expect(data.as).toEqual(NumberCell);
|
|
77
|
+
expect(data.children).toEqual("-");
|
|
78
|
+
});
|
|
79
|
+
it("Should fall back to TextCell with placeholder when link cell is empty", function () {
|
|
80
|
+
rowData.link = "";
|
|
81
|
+
var data = getCellType("link", {
|
|
82
|
+
colId: "link"
|
|
83
|
+
}, rowData, null);
|
|
84
|
+
expect(data.as).toEqual(TextCell);
|
|
85
|
+
expect(data.children).toEqual("-");
|
|
86
|
+
});
|
|
87
|
+
it("Should fall back to TextCell with placeholder when icon cell is empty", function () {
|
|
88
|
+
rowData.icon = "";
|
|
89
|
+
var data = getCellType("icon", {
|
|
90
|
+
colId: "icon"
|
|
91
|
+
}, rowData, null);
|
|
92
|
+
expect(data.as).toEqual(TextCell);
|
|
93
|
+
expect(data.children).toEqual("-");
|
|
94
|
+
});
|
|
71
95
|
it("Should return an statusBadge with a console error", function () {
|
|
72
96
|
var logSpy = jest.spyOn(global.console, "error");
|
|
73
97
|
var data = getCellType("statusBadge", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CircleAlert } from "lucide-react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import Button from "../../../../Button";
|
|
4
4
|
import { EMPTY_OBJ } from "../../../../helpers/logic/empties";
|
|
@@ -20,9 +20,10 @@ export function ErrorState(_ref) {
|
|
|
20
20
|
align: "center",
|
|
21
21
|
direction: size === "compact" ? "horizontal" : "vertical"
|
|
22
22
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
23
|
-
direction: "horizontal"
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
direction: "horizontal",
|
|
24
|
+
align: "center"
|
|
25
|
+
}, /*#__PURE__*/React.createElement(CircleAlert, {
|
|
26
|
+
color: "var(--vitality-colors-critical11)"
|
|
26
27
|
}), /*#__PURE__*/React.createElement(Typography, {
|
|
27
28
|
color: "critical"
|
|
28
29
|
}, errorMessage)), errorButtonProps && onClick && /*#__PURE__*/React.createElement(Button, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { X } from "lucide-react";
|
|
2
2
|
import React, { useContext } from "react";
|
|
3
3
|
import Tooltip from "../../../Tooltip";
|
|
4
4
|
import { ToastContext } from "../../ToastProvider";
|
|
@@ -11,9 +11,9 @@ function CloseIconButton(_ref) {
|
|
|
11
11
|
}, /*#__PURE__*/React.createElement(BaseCloseIconButton, {
|
|
12
12
|
type: type,
|
|
13
13
|
onClick: onClose
|
|
14
|
-
}, /*#__PURE__*/React.createElement(
|
|
15
|
-
size: "
|
|
16
|
-
color: "
|
|
14
|
+
}, /*#__PURE__*/React.createElement(X, {
|
|
15
|
+
size: "1rem",
|
|
16
|
+
color: "currentColor"
|
|
17
17
|
})));
|
|
18
18
|
}
|
|
19
19
|
export default CloseIconButton;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CircleAlert, CircleCheck, Info } from "lucide-react";
|
|
2
2
|
var TOAST_TYPES = {
|
|
3
3
|
success: {
|
|
4
|
-
icon:
|
|
4
|
+
icon: CircleCheck
|
|
5
5
|
},
|
|
6
6
|
warning: {
|
|
7
|
-
icon:
|
|
7
|
+
icon: CircleAlert
|
|
8
8
|
},
|
|
9
9
|
error: {
|
|
10
|
-
icon:
|
|
10
|
+
icon: CircleAlert
|
|
11
11
|
},
|
|
12
12
|
info: {
|
|
13
13
|
icon: Info
|
|
@@ -6,10 +6,8 @@ function getVariantsByColorScale(colorScale) {
|
|
|
6
6
|
return {
|
|
7
7
|
backgroundColor: getColorScaleValueByUseCase(colorScale, backgrounds.app),
|
|
8
8
|
color: getColorScaleValueByUseCase(colorScale, text.hiContrast),
|
|
9
|
-
svg: {
|
|
10
|
-
|
|
11
|
-
fill: getColorScaleValueByUseCase(colorScale, text.lowContrast)
|
|
12
|
-
}
|
|
9
|
+
"svg.icon": {
|
|
10
|
+
color: getColorScaleValueByUseCase(colorScale, text.lowContrast)
|
|
13
11
|
},
|
|
14
12
|
borderColor: "".concat(getColorScaleValueByUseCase(colorScale, text.hiSaturation), " ").concat(getColorScaleValueByUseCase(colorScale, borders.uiElement), " ").concat(getColorScaleValueByUseCase(colorScale, borders.uiElement))
|
|
15
13
|
};
|
|
@@ -15,7 +15,7 @@ function Toast(_ref) {
|
|
|
15
15
|
return /*#__PURE__*/React.createElement(BaseToast, {
|
|
16
16
|
type: type
|
|
17
17
|
}, !hideIcon && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(IconComponent, {
|
|
18
|
-
|
|
18
|
+
className: "icon"
|
|
19
19
|
})), /*#__PURE__*/React.createElement(BaseContent, null, title && /*#__PURE__*/React.createElement(Typography, {
|
|
20
20
|
variant: "display200"
|
|
21
21
|
}, title), message && /*#__PURE__*/React.createElement(Typography, null, message)), /*#__PURE__*/React.createElement(CloseIconButton, {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CircleAlert, CircleCheck, Info } from "lucide-react";
|
|
2
2
|
import { getIconFromType } from "./logic";
|
|
3
3
|
describe("getIconFromType", function () {
|
|
4
4
|
it("should return the icon for the success toast type", function () {
|
|
5
5
|
var type = "success";
|
|
6
6
|
var icon = getIconFromType(type);
|
|
7
|
-
expect(icon).toEqual(
|
|
7
|
+
expect(icon).toEqual(CircleCheck);
|
|
8
8
|
});
|
|
9
9
|
it("should return the icon for the warning toast type", function () {
|
|
10
10
|
var type = "warning";
|
|
11
11
|
var icon = getIconFromType(type);
|
|
12
|
-
expect(icon).toEqual(
|
|
12
|
+
expect(icon).toEqual(CircleAlert);
|
|
13
13
|
});
|
|
14
14
|
it("should return the icon for the error toast type", function () {
|
|
15
15
|
var type = "error";
|
|
16
16
|
var icon = getIconFromType(type);
|
|
17
|
-
expect(icon).toEqual(
|
|
17
|
+
expect(icon).toEqual(CircleAlert);
|
|
18
18
|
});
|
|
19
19
|
it("should return the icon for the info toast type", function () {
|
|
20
20
|
var type = "info";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
-
import { BaseIcon } from "@vitality-ds/icons";
|
|
5
3
|
import { colorUseCases, css, getColorScaleValueByUseCase } from "@vitality-ds/system";
|
|
6
4
|
import { AVAILABLE_MAX_LINES, AVAILABLE_VARIANTS } from "../constants/variants";
|
|
7
5
|
import { getMaxLines, getMaxLinesVariants, getVariantStyles } from "./helpers";
|
|
@@ -9,137 +7,140 @@ var text = colorUseCases.text;
|
|
|
9
7
|
var overflowSharedStyles = {
|
|
10
8
|
overflow: "hidden"
|
|
11
9
|
};
|
|
12
|
-
export default css(
|
|
10
|
+
export default css({
|
|
13
11
|
fontFamily: "$default",
|
|
14
12
|
fontSize: "inherit",
|
|
15
13
|
// Reset browser default margins added to certain semantic HTML elements
|
|
16
|
-
marginBlock: 0
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
marginTop: "-.2em"
|
|
20
|
-
}), "variants", {
|
|
21
|
-
/**
|
|
22
|
-
* Set the text element's text alignment
|
|
23
|
-
*/
|
|
24
|
-
textAlign: {
|
|
25
|
-
start: {
|
|
26
|
-
textAlign: "start"
|
|
27
|
-
},
|
|
28
|
-
end: {
|
|
29
|
-
textAlign: "end"
|
|
30
|
-
},
|
|
31
|
-
left: {
|
|
32
|
-
textAlign: "left"
|
|
33
|
-
},
|
|
34
|
-
right: {
|
|
35
|
-
textAlign: "right"
|
|
36
|
-
},
|
|
37
|
-
center: {
|
|
38
|
-
textAlign: "center"
|
|
39
|
-
},
|
|
40
|
-
justify: {
|
|
41
|
-
textAlign: "justify"
|
|
42
|
-
},
|
|
43
|
-
matchParent: {
|
|
44
|
-
textAlign: "match-parent"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
/**
|
|
48
|
-
* Allows you to handle CSS text overflow behaviour
|
|
49
|
-
*/
|
|
50
|
-
textOverflow: {
|
|
51
|
-
ellipsis: _extends({}, overflowSharedStyles, {
|
|
52
|
-
textOverflow: "ellipsis"
|
|
53
|
-
}),
|
|
54
|
-
clip: _extends({}, overflowSharedStyles, {
|
|
55
|
-
textOverflow: "clip"
|
|
56
|
-
})
|
|
57
|
-
},
|
|
58
|
-
/**
|
|
59
|
-
* Allows you to handle CSS white space behaviour
|
|
60
|
-
*/
|
|
61
|
-
wrap: {
|
|
62
|
-
"true": _extends({}, overflowSharedStyles, {
|
|
63
|
-
whiteSpace: "break-spaces"
|
|
64
|
-
}),
|
|
65
|
-
"false": _extends({}, overflowSharedStyles, {
|
|
66
|
-
whiteSpace: "nowrap"
|
|
67
|
-
})
|
|
14
|
+
marginBlock: 0,
|
|
15
|
+
"& > svg.lucide": {
|
|
16
|
+
verticalAlign: "baseline"
|
|
68
17
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
color: getColorScaleValueByUseCase("yellow", text.hiSaturation)
|
|
96
|
-
},
|
|
97
|
-
critical: {
|
|
98
|
-
color: getColorScaleValueByUseCase("critical", text.hiSaturation)
|
|
18
|
+
variants: {
|
|
19
|
+
/**
|
|
20
|
+
* Set the text element's text alignment
|
|
21
|
+
*/
|
|
22
|
+
textAlign: {
|
|
23
|
+
start: {
|
|
24
|
+
textAlign: "start"
|
|
25
|
+
},
|
|
26
|
+
end: {
|
|
27
|
+
textAlign: "end"
|
|
28
|
+
},
|
|
29
|
+
left: {
|
|
30
|
+
textAlign: "left"
|
|
31
|
+
},
|
|
32
|
+
right: {
|
|
33
|
+
textAlign: "right"
|
|
34
|
+
},
|
|
35
|
+
center: {
|
|
36
|
+
textAlign: "center"
|
|
37
|
+
},
|
|
38
|
+
justify: {
|
|
39
|
+
textAlign: "justify"
|
|
40
|
+
},
|
|
41
|
+
matchParent: {
|
|
42
|
+
textAlign: "match-parent"
|
|
43
|
+
}
|
|
99
44
|
},
|
|
100
|
-
|
|
101
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Allows you to handle CSS text overflow behaviour
|
|
47
|
+
*/
|
|
48
|
+
textOverflow: {
|
|
49
|
+
ellipsis: _extends({}, overflowSharedStyles, {
|
|
50
|
+
textOverflow: "ellipsis"
|
|
51
|
+
}),
|
|
52
|
+
clip: _extends({}, overflowSharedStyles, {
|
|
53
|
+
textOverflow: "clip"
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
/**
|
|
57
|
+
* Allows you to handle CSS white space behaviour
|
|
58
|
+
*/
|
|
59
|
+
wrap: {
|
|
60
|
+
"true": _extends({}, overflowSharedStyles, {
|
|
61
|
+
whiteSpace: "break-spaces"
|
|
62
|
+
}),
|
|
63
|
+
"false": _extends({}, overflowSharedStyles, {
|
|
64
|
+
whiteSpace: "nowrap"
|
|
65
|
+
})
|
|
66
|
+
},
|
|
67
|
+
/**
|
|
68
|
+
* Sets the color of the text.
|
|
69
|
+
*/
|
|
70
|
+
color: {
|
|
71
|
+
inherit: {
|
|
72
|
+
color: "inherit"
|
|
73
|
+
},
|
|
74
|
+
hiContrast: {
|
|
75
|
+
color: getColorScaleValueByUseCase("greyA", text.hiContrast)
|
|
76
|
+
},
|
|
77
|
+
primary: {
|
|
78
|
+
color: getColorScaleValueByUseCase("primary", text.hiSaturation)
|
|
79
|
+
},
|
|
80
|
+
lowContrast: {
|
|
81
|
+
color: getColorScaleValueByUseCase("greyA", text.lowContrast)
|
|
82
|
+
},
|
|
83
|
+
disabled: {
|
|
84
|
+
color: getColorScaleValueByUseCase("greyA", text.disabled)
|
|
85
|
+
},
|
|
86
|
+
accent: {
|
|
87
|
+
color: getColorScaleValueByUseCase("accent", text.hiSaturation)
|
|
88
|
+
},
|
|
89
|
+
info: {
|
|
90
|
+
color: getColorScaleValueByUseCase("info", text.hiSaturation)
|
|
91
|
+
},
|
|
92
|
+
moderate: {
|
|
93
|
+
color: getColorScaleValueByUseCase("yellow", text.hiSaturation)
|
|
94
|
+
},
|
|
95
|
+
critical: {
|
|
96
|
+
color: getColorScaleValueByUseCase("critical", text.hiSaturation)
|
|
97
|
+
},
|
|
98
|
+
warning: {
|
|
99
|
+
color: getColorScaleValueByUseCase("warning", text.hiSaturation)
|
|
100
|
+
},
|
|
101
|
+
success: {
|
|
102
|
+
color: getColorScaleValueByUseCase("success", text.hiSaturation)
|
|
103
|
+
}
|
|
102
104
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Customises the font size and weight to a pre-set option.
|
|
107
|
+
*/
|
|
108
|
+
variant: {
|
|
109
|
+
inherit: getVariantStyles("inherit"),
|
|
110
|
+
caption: getVariantStyles("$caption"),
|
|
111
|
+
button: getVariantStyles("$button"),
|
|
112
|
+
body: getVariantStyles("$body"),
|
|
113
|
+
paragraph: _extends({}, getVariantStyles("$body"), {
|
|
114
|
+
"& + &": {
|
|
115
|
+
marginTop: "$md"
|
|
116
|
+
}
|
|
117
|
+
}),
|
|
118
|
+
sectionSubtitle: getVariantStyles("$sectionSubtitle"),
|
|
119
|
+
sectionTitle: getVariantStyles("$sectionTitle"),
|
|
120
|
+
pageTitle: getVariantStyles("$pageTitle"),
|
|
121
|
+
display100: getVariantStyles("$display100"),
|
|
122
|
+
display200: getVariantStyles("$display200"),
|
|
123
|
+
display300: getVariantStyles("$display300"),
|
|
124
|
+
display400: getVariantStyles("$display400"),
|
|
125
|
+
display500: getVariantStyles("$display500"),
|
|
126
|
+
display600: getVariantStyles("$display600"),
|
|
127
|
+
display700: getVariantStyles("$display700"),
|
|
128
|
+
display800: getVariantStyles("$display800"),
|
|
129
|
+
display900: getVariantStyles("$display900")
|
|
130
|
+
},
|
|
131
|
+
/**
|
|
132
|
+
* Sets a limit on the maximum number of lines to display.
|
|
133
|
+
*/
|
|
134
|
+
maxLines: {
|
|
135
|
+
1: getMaxLines(1, "$body"),
|
|
136
|
+
2: getMaxLines(2, "$body"),
|
|
137
|
+
3: getMaxLines(3, "$body")
|
|
105
138
|
}
|
|
106
139
|
},
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
caption: getVariantStyles("$caption"),
|
|
113
|
-
button: getVariantStyles("$button"),
|
|
114
|
-
body: getVariantStyles("$body"),
|
|
115
|
-
paragraph: _extends({}, getVariantStyles("$body"), {
|
|
116
|
-
"& + &": {
|
|
117
|
-
marginTop: "$md"
|
|
118
|
-
}
|
|
119
|
-
}),
|
|
120
|
-
sectionSubtitle: getVariantStyles("$sectionSubtitle"),
|
|
121
|
-
sectionTitle: getVariantStyles("$sectionTitle"),
|
|
122
|
-
pageTitle: getVariantStyles("$pageTitle"),
|
|
123
|
-
display100: getVariantStyles("$display100"),
|
|
124
|
-
display200: getVariantStyles("$display200"),
|
|
125
|
-
display300: getVariantStyles("$display300"),
|
|
126
|
-
display400: getVariantStyles("$display400"),
|
|
127
|
-
display500: getVariantStyles("$display500"),
|
|
128
|
-
display600: getVariantStyles("$display600"),
|
|
129
|
-
display700: getVariantStyles("$display700"),
|
|
130
|
-
display800: getVariantStyles("$display800"),
|
|
131
|
-
display900: getVariantStyles("$display900")
|
|
132
|
-
},
|
|
133
|
-
/**
|
|
134
|
-
* Sets a limit on the maximum number of lines to display.
|
|
135
|
-
*/
|
|
136
|
-
maxLines: {
|
|
137
|
-
1: getMaxLines(1, "$body"),
|
|
138
|
-
2: getMaxLines(2, "$body"),
|
|
139
|
-
3: getMaxLines(3, "$body")
|
|
140
|
+
compoundVariants: _toConsumableArray(getMaxLinesVariants(AVAILABLE_MAX_LINES, AVAILABLE_VARIANTS)),
|
|
141
|
+
"ul, ol": {
|
|
142
|
+
listStylePosition: "inside",
|
|
143
|
+
paddingInlineStart: 0,
|
|
144
|
+
marginBlock: "inherit"
|
|
140
145
|
}
|
|
141
|
-
})
|
|
142
|
-
listStylePosition: "inside",
|
|
143
|
-
paddingInlineStart: 0,
|
|
144
|
-
marginBlock: "inherit"
|
|
145
|
-
}));
|
|
146
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Paperclip } from "lucide-react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import IconButton from "../../IconButton";
|
|
4
4
|
import getComponentFromLookup from "./get-component-from-lookup";
|
|
@@ -12,7 +12,7 @@ describe("getComponentFromLookup", function () {
|
|
|
12
12
|
var trigger = {
|
|
13
13
|
type: "iconButton",
|
|
14
14
|
props: {
|
|
15
|
-
icon: /*#__PURE__*/React.createElement(
|
|
15
|
+
icon: /*#__PURE__*/React.createElement(Paperclip, null),
|
|
16
16
|
tooltipContent: "Content"
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -26,7 +26,7 @@ describe("getComponentFromLookup", function () {
|
|
|
26
26
|
var trigger = {
|
|
27
27
|
type: "iconButton",
|
|
28
28
|
props: {
|
|
29
|
-
icon: /*#__PURE__*/React.createElement(
|
|
29
|
+
icon: /*#__PURE__*/React.createElement(Paperclip, null),
|
|
30
30
|
tooltipContent: "Content",
|
|
31
31
|
disabled: true
|
|
32
32
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var
|
|
4
|
+
var _lucideReact = require("lucide-react");
|
|
5
5
|
var _react = _interopRequireDefault(require("react"));
|
|
6
6
|
var _IconButton = _interopRequireDefault(require("../../IconButton"));
|
|
7
7
|
var _getComponentFromLookup = _interopRequireDefault(require("./get-component-from-lookup"));
|
|
@@ -15,7 +15,7 @@ describe("getComponentFromLookup", function () {
|
|
|
15
15
|
var trigger = {
|
|
16
16
|
type: "iconButton",
|
|
17
17
|
props: {
|
|
18
|
-
icon: /*#__PURE__*/_react["default"].createElement(
|
|
18
|
+
icon: /*#__PURE__*/_react["default"].createElement(_lucideReact.Paperclip, null),
|
|
19
19
|
tooltipContent: "Content"
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -29,7 +29,7 @@ describe("getComponentFromLookup", function () {
|
|
|
29
29
|
var trigger = {
|
|
30
30
|
type: "iconButton",
|
|
31
31
|
props: {
|
|
32
|
-
icon: /*#__PURE__*/_react["default"].createElement(
|
|
32
|
+
icon: /*#__PURE__*/_react["default"].createElement(_lucideReact.Paperclip, null),
|
|
33
33
|
tooltipContent: "Content",
|
|
34
34
|
disabled: true
|
|
35
35
|
}
|