@dxc-technology/halstack-react 0.0.0-509f1eb → 0.0.0-51152f3
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/HalstackContext.d.ts +16 -14
- package/action-icon/ActionIcon.d.ts +2 -2
- package/action-icon/ActionIcon.js +8 -4
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +140 -29
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/button/Button.test.js +3 -1
- package/common/coreTokens.js +2 -2
- package/common/variables.d.ts +16 -14
- package/common/variables.js +22 -20
- package/container/Container.js +1 -1
- package/dropdown/Dropdown.js +9 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +25 -12
- package/footer/Footer.stories.tsx +19 -0
- package/footer/Icons.d.ts +1 -0
- package/footer/Icons.js +65 -1
- package/footer/types.d.ts +6 -0
- package/layout/ApplicationLayout.d.ts +1 -1
- package/main.d.ts +3 -2
- package/main.js +8 -1
- package/nav-tabs/NavTabs.js +1 -1
- package/nav-tabs/NavTabs.stories.tsx +6 -4
- package/nav-tabs/NavTabs.test.js +3 -2
- package/nav-tabs/Tab.js +5 -4
- package/number-input/NumberInput.js +21 -2
- package/number-input/NumberInput.test.js +165 -6
- package/package.json +1 -1
- package/resultset-table/ResultsetTable.d.ts +4 -1
- package/resultset-table/ResultsetTable.js +14 -6
- package/resultset-table/ResultsetTable.stories.tsx +86 -5
- package/resultset-table/ResultsetTable.test.js +66 -0
- package/resultset-table/types.d.ts +6 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/table/ActionsCell.d.ts +4 -0
- package/table/ActionsCell.js +55 -0
- package/table/DropdownTheme.js +58 -0
- package/table/Table.d.ts +4 -1
- package/table/Table.js +22 -5
- package/table/Table.stories.tsx +261 -2
- package/table/Table.test.js +92 -0
- package/table/types.d.ts +39 -0
- package/tabs/Tab.js +7 -4
- package/tabs/Tabs.stories.tsx +1 -1
- package/text-input/TextInput.js +28 -35
- package/text-input/TextInput.test.js +96 -79
- package/useTheme.d.ts +16 -14
- package/utils/FocusLock.js +3 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
12
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
13
|
+
var DxcStatusLight = function DxcStatusLight(_ref) {
|
|
14
|
+
var _ref$mode = _ref.mode,
|
|
15
|
+
mode = _ref$mode === void 0 ? "default" : _ref$mode,
|
|
16
|
+
label = _ref.label,
|
|
17
|
+
_ref$size = _ref.size,
|
|
18
|
+
size = _ref$size === void 0 ? "medium" : _ref$size;
|
|
19
|
+
return /*#__PURE__*/_react["default"].createElement(StatusLightContainer, {
|
|
20
|
+
size: size,
|
|
21
|
+
"aria-label": "".concat(mode, ": ").concat(label),
|
|
22
|
+
"data-testid": "status_light-container"
|
|
23
|
+
}, /*#__PURE__*/_react["default"].createElement(StatusDot, {
|
|
24
|
+
mode: mode,
|
|
25
|
+
size: size,
|
|
26
|
+
"aria-hidden": "true",
|
|
27
|
+
"data-testid": "status-dot"
|
|
28
|
+
}), /*#__PURE__*/_react["default"].createElement(StatusLabel, {
|
|
29
|
+
mode: mode,
|
|
30
|
+
size: size
|
|
31
|
+
}, label));
|
|
32
|
+
};
|
|
33
|
+
var StatusLightContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n gap: ", ";\n"])), _coreTokens["default"].spacing_8);
|
|
34
|
+
var StatusDot = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n border-radius: 50%;\n background-color: ", ";\n"])), function (_ref2) {
|
|
35
|
+
var size = _ref2.size;
|
|
36
|
+
return size === "small" && _coreTokens["default"].type_scale_01 || size === "medium" && _coreTokens["default"].type_scale_02 || size === "large" && _coreTokens["default"].type_scale_03 || _coreTokens["default"].type_scale_02;
|
|
37
|
+
}, function (_ref3) {
|
|
38
|
+
var size = _ref3.size;
|
|
39
|
+
return size === "small" && _coreTokens["default"].type_scale_01 || size === "medium" && _coreTokens["default"].type_scale_02 || size === "large" && _coreTokens["default"].type_scale_03 || _coreTokens["default"].type_scale_02;
|
|
40
|
+
}, function (_ref4) {
|
|
41
|
+
var mode = _ref4.mode;
|
|
42
|
+
return mode === "default" && _coreTokens["default"].color_grey_700 || mode === "error" && _coreTokens["default"].color_red_700 || mode === "info" && _coreTokens["default"].color_blue_700 || mode === "success" && _coreTokens["default"].color_green_700 || mode === "warning" && _coreTokens["default"].color_orange_700 || _coreTokens["default"].color_grey_700;
|
|
43
|
+
});
|
|
44
|
+
var StatusLabel = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-align: center;\n text-overflow: ellipsis;\n overflow: hidden;\n white-space: nowrap;\n"])), function (_ref5) {
|
|
45
|
+
var size = _ref5.size;
|
|
46
|
+
return size === "small" && _coreTokens["default"].type_scale_01 || size === "medium" && _coreTokens["default"].type_scale_02 || size === "large" && _coreTokens["default"].type_scale_03 || _coreTokens["default"].type_scale_02;
|
|
47
|
+
}, _coreTokens["default"].type_sans, _coreTokens["default"].type_normal, _coreTokens["default"].type_semibold, function (_ref6) {
|
|
48
|
+
var mode = _ref6.mode;
|
|
49
|
+
return mode === "default" && _coreTokens["default"].color_grey_700 || mode === "error" && _coreTokens["default"].color_red_700 || mode === "info" && _coreTokens["default"].color_blue_700 || mode === "success" && _coreTokens["default"].color_green_700 || mode === "warning" && _coreTokens["default"].color_orange_700 || _coreTokens["default"].color_grey_700;
|
|
50
|
+
});
|
|
51
|
+
var _default = exports["default"] = DxcStatusLight;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcStatusLight from "./StatusLight";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Status Light",
|
|
8
|
+
component: DxcStatusLight,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<ExampleContainer>
|
|
14
|
+
<Title title="Default light small" theme="light" level={4} />
|
|
15
|
+
<DxcStatusLight label="StatusLight" size="small" />
|
|
16
|
+
</ExampleContainer>
|
|
17
|
+
<ExampleContainer>
|
|
18
|
+
<Title title="Default light medium" theme="light" level={4} />
|
|
19
|
+
<DxcStatusLight label="StatusLight" />
|
|
20
|
+
</ExampleContainer>
|
|
21
|
+
<ExampleContainer>
|
|
22
|
+
<Title title="Default light large" theme="light" level={4} />
|
|
23
|
+
<DxcStatusLight label="StatusLight" size="large" />
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
<ExampleContainer>
|
|
26
|
+
<Title title="Info light small" theme="light" level={4} />
|
|
27
|
+
<DxcStatusLight label="StatusLight" mode="info" size="small" />
|
|
28
|
+
</ExampleContainer>
|
|
29
|
+
<ExampleContainer>
|
|
30
|
+
<Title title="Info light medium" theme="light" level={4} />
|
|
31
|
+
<DxcStatusLight label="StatusLight" mode="info" />
|
|
32
|
+
</ExampleContainer>
|
|
33
|
+
<ExampleContainer>
|
|
34
|
+
<Title title="Info light large" theme="light" level={4} />
|
|
35
|
+
<DxcStatusLight label="StatusLight" mode="info" size="large" />
|
|
36
|
+
</ExampleContainer>
|
|
37
|
+
<ExampleContainer>
|
|
38
|
+
<Title title="Success light small" theme="light" level={4} />
|
|
39
|
+
<DxcStatusLight label="StatusLight" mode="success" size="small" />
|
|
40
|
+
</ExampleContainer>
|
|
41
|
+
<ExampleContainer>
|
|
42
|
+
<Title title="Success lights medium" theme="light" level={4} />
|
|
43
|
+
<DxcStatusLight label="StatusLight" mode="success" />
|
|
44
|
+
</ExampleContainer>
|
|
45
|
+
<ExampleContainer>
|
|
46
|
+
<Title title="Success lights large" theme="light" level={4} />
|
|
47
|
+
<DxcStatusLight label="StatusLight" mode="success" size="large" />
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
<ExampleContainer>
|
|
50
|
+
<Title title="Warning light small" theme="light" level={4} />
|
|
51
|
+
<DxcStatusLight label="StatusLight" mode="warning" size="small" />
|
|
52
|
+
</ExampleContainer>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<Title title="Warning light medium" theme="light" level={4} />
|
|
55
|
+
<DxcStatusLight label="StatusLight" mode="warning" />
|
|
56
|
+
</ExampleContainer>
|
|
57
|
+
<ExampleContainer>
|
|
58
|
+
<Title title="Warning light large" theme="light" level={4} />
|
|
59
|
+
<DxcStatusLight label="StatusLight" mode="warning" size="large" />
|
|
60
|
+
</ExampleContainer>
|
|
61
|
+
<ExampleContainer>
|
|
62
|
+
<Title title="Error light small" theme="light" level={4} />
|
|
63
|
+
<DxcStatusLight label="StatusLight" mode="error" size="small" />
|
|
64
|
+
</ExampleContainer>
|
|
65
|
+
<ExampleContainer>
|
|
66
|
+
<Title title="Error lights medium" theme="light" level={4} />
|
|
67
|
+
<DxcStatusLight label="StatusLight" mode="error" />
|
|
68
|
+
</ExampleContainer>
|
|
69
|
+
<ExampleContainer>
|
|
70
|
+
<Title title="Error lights large" theme="light" level={4} />
|
|
71
|
+
<DxcStatusLight label="StatusLight" mode="error" size="large" />
|
|
72
|
+
</ExampleContainer>
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _StatusLight = _interopRequireDefault(require("./StatusLight.tsx"));
|
|
7
|
+
describe("StatusLight component tests", function () {
|
|
8
|
+
test("StatusLight renders with correct label", function () {
|
|
9
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_StatusLight["default"], {
|
|
10
|
+
label: "Status Light Test"
|
|
11
|
+
})),
|
|
12
|
+
getByText = _render.getByText;
|
|
13
|
+
expect(getByText("Status Light Test")).toBeTruthy();
|
|
14
|
+
});
|
|
15
|
+
test("StatusLight applies accessibility attributes", function () {
|
|
16
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_StatusLight["default"], {
|
|
17
|
+
label: "Status Light Test"
|
|
18
|
+
})),
|
|
19
|
+
getByTestId = _render2.getByTestId;
|
|
20
|
+
var statusLightContainer = getByTestId("status_light-container");
|
|
21
|
+
var statusDot = getByTestId("status-dot");
|
|
22
|
+
expect(statusLightContainer.getAttribute("aria-label")).toBe("default: Status Light Test");
|
|
23
|
+
expect(statusDot.getAttribute("aria-hidden")).toBe("true");
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Mode = "default" | "info" | "success" | "warning" | "error";
|
|
2
|
+
type Size = "small" | "medium" | "large";
|
|
3
|
+
type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* It will define the color of the light based on its semantic meaning.
|
|
6
|
+
*/
|
|
7
|
+
mode?: Mode;
|
|
8
|
+
/**
|
|
9
|
+
* An auxiliar text that will add some context to the status.
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* Size of the component. Should be defined based on its importance and/or available space.
|
|
14
|
+
*/
|
|
15
|
+
size?: Size;
|
|
16
|
+
};
|
|
17
|
+
export default Props;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _ActionIcon = _interopRequireDefault(require("../action-icon/ActionIcon"));
|
|
10
|
+
var _main = require("../main");
|
|
11
|
+
var _DropdownTheme = _interopRequireDefault(require("./DropdownTheme"));
|
|
12
|
+
var moreVertIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
13
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
14
|
+
height: "24",
|
|
15
|
+
viewBox: "0 -960 960 960",
|
|
16
|
+
width: "24",
|
|
17
|
+
fill: "currentColor"
|
|
18
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
19
|
+
d: "M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z"
|
|
20
|
+
}));
|
|
21
|
+
var DxcActionsCell = function DxcActionsCell(_ref) {
|
|
22
|
+
var actions = _ref.actions;
|
|
23
|
+
var actionIcons = actions.filter(function (action) {
|
|
24
|
+
return !action.options;
|
|
25
|
+
});
|
|
26
|
+
var actionDropdown = actions.find(function (action) {
|
|
27
|
+
return action.options;
|
|
28
|
+
});
|
|
29
|
+
var maxNumberOfActions = actionDropdown ? 2 : 3;
|
|
30
|
+
return /*#__PURE__*/_react["default"].createElement(_main.DxcFlex, {
|
|
31
|
+
gap: "0.5rem",
|
|
32
|
+
alignItems: "center"
|
|
33
|
+
}, actionIcons.map(function (action, index) {
|
|
34
|
+
var _action$disabled, _action$tabIndex;
|
|
35
|
+
return index < maxNumberOfActions && /*#__PURE__*/_react["default"].createElement(_ActionIcon["default"], {
|
|
36
|
+
icon: action.icon,
|
|
37
|
+
title: action.title,
|
|
38
|
+
onClick: action.onClick,
|
|
39
|
+
disabled: (_action$disabled = action.disabled) !== null && _action$disabled !== void 0 ? _action$disabled : false,
|
|
40
|
+
tabIndex: (_action$tabIndex = action.tabIndex) !== null && _action$tabIndex !== void 0 ? _action$tabIndex : 0,
|
|
41
|
+
key: "action-".concat(index)
|
|
42
|
+
});
|
|
43
|
+
}), actionDropdown && /*#__PURE__*/_react["default"].createElement(_main.HalstackProvider, {
|
|
44
|
+
advancedTheme: _DropdownTheme["default"],
|
|
45
|
+
key: "provider-dropdown"
|
|
46
|
+
}, /*#__PURE__*/_react["default"].createElement(_main.DxcDropdown, {
|
|
47
|
+
options: actionDropdown.options,
|
|
48
|
+
onSelectOption: actionDropdown.onClick,
|
|
49
|
+
disabled: actionDropdown.disabled,
|
|
50
|
+
icon: moreVertIcon,
|
|
51
|
+
tabIndex: actionDropdown.tabIndex,
|
|
52
|
+
caretHidden: true
|
|
53
|
+
})));
|
|
54
|
+
};
|
|
55
|
+
var _default = exports["default"] = DxcActionsCell;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _variables = require("../common/variables");
|
|
8
|
+
var _default = exports["default"] = {
|
|
9
|
+
dropdown: {
|
|
10
|
+
// Breadcrumbs tokens
|
|
11
|
+
buttonIconSize: "16px",
|
|
12
|
+
buttonPaddingTop: "4px",
|
|
13
|
+
buttonPaddingBottom: "4px",
|
|
14
|
+
buttonPaddingLeft: "4px",
|
|
15
|
+
buttonPaddingRight: "4px",
|
|
16
|
+
buttonHeight: "24px",
|
|
17
|
+
buttonBorderRadius: "2px",
|
|
18
|
+
buttonBorderColor: "transparent",
|
|
19
|
+
optionFontSize: "14px",
|
|
20
|
+
optionPaddingTop: "0px",
|
|
21
|
+
optionPaddingBottom: "0px",
|
|
22
|
+
optionPaddingLeft: "16px",
|
|
23
|
+
optionPaddingRight: "16px",
|
|
24
|
+
// Dropdown tokens
|
|
25
|
+
buttonBackgroundColor: _variables.componentTokens.table.actionBackgroundColor,
|
|
26
|
+
hoverButtonBackgroundColor: _variables.componentTokens.table.hoverActionBackgroundColor,
|
|
27
|
+
activeButtonBackgroundColor: _variables.componentTokens.table.activeActionBackgroundColor,
|
|
28
|
+
buttonFontFamily: _variables.componentTokens.dropdown.buttonFontFamily,
|
|
29
|
+
buttonFontSize: _variables.componentTokens.dropdown.buttonFontSize,
|
|
30
|
+
buttonFontStyle: _variables.componentTokens.dropdown.buttonFontStyle,
|
|
31
|
+
buttonFontWeight: _variables.componentTokens.dropdown.buttonFontWeight,
|
|
32
|
+
buttonFontColor: _variables.componentTokens.dropdown.buttonFontColor,
|
|
33
|
+
buttonIconSpacing: _variables.componentTokens.dropdown.buttonIconSpacing,
|
|
34
|
+
buttonIconColor: _variables.componentTokens.table.actionIconColor,
|
|
35
|
+
disabledColor: _variables.componentTokens.table.disabledActionIconColor,
|
|
36
|
+
disabledButtonBackgroundColor: _variables.componentTokens.table.disabledActionBackgroundColor,
|
|
37
|
+
disabledBorderColor: _variables.componentTokens.dropdown.disabledBorderColor,
|
|
38
|
+
optionBackgroundColor: _variables.componentTokens.dropdown.optionBackgroundColor,
|
|
39
|
+
hoverOptionBackgroundColor: _variables.componentTokens.dropdown.hoverOptionBackgroundColor,
|
|
40
|
+
activeOptionBackgroundColor: _variables.componentTokens.dropdown.activeOptionBackgroundColor,
|
|
41
|
+
optionFontFamily: _variables.componentTokens.dropdown.optionFontFamily,
|
|
42
|
+
optionFontStyle: _variables.componentTokens.dropdown.optionFontStyle,
|
|
43
|
+
optionFontWeight: _variables.componentTokens.dropdown.optionFontWeight,
|
|
44
|
+
optionFontColor: _variables.componentTokens.dropdown.optionFontColor,
|
|
45
|
+
optionIconSize: _variables.componentTokens.dropdown.optionIconSize,
|
|
46
|
+
optionIconSpacing: _variables.componentTokens.dropdown.optionIconSpacing,
|
|
47
|
+
optionIconColor: _variables.componentTokens.dropdown.optionIconColor,
|
|
48
|
+
caretIconSize: _variables.componentTokens.dropdown.caretIconSize,
|
|
49
|
+
caretIconColor: _variables.componentTokens.dropdown.caretIconColor,
|
|
50
|
+
caretIconSpacing: _variables.componentTokens.dropdown.caretIconSpacing,
|
|
51
|
+
borderRadius: _variables.componentTokens.dropdown.borderRadius,
|
|
52
|
+
borderStyle: _variables.componentTokens.dropdown.borderStyle,
|
|
53
|
+
borderThickness: _variables.componentTokens.dropdown.borderThickness,
|
|
54
|
+
borderColor: _variables.componentTokens.dropdown.borderColor,
|
|
55
|
+
scrollBarThumbColor: _variables.componentTokens.dropdown.scrollBarThumbColor,
|
|
56
|
+
scrollBarTrackColor: _variables.componentTokens.dropdown.scrollBarTrackColor
|
|
57
|
+
}
|
|
58
|
+
};
|
package/table/Table.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import TablePropsType from "./types";
|
|
3
|
-
declare const DxcTable:
|
|
3
|
+
declare const DxcTable: {
|
|
4
|
+
({ children, margin, mode }: TablePropsType): JSX.Element;
|
|
5
|
+
ActionsCell: ({ actions }: import("./types").ActionCellsPropsType) => JSX.Element;
|
|
6
|
+
};
|
|
4
7
|
export default DxcTable;
|
package/table/Table.js
CHANGED
|
@@ -13,18 +13,24 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
13
13
|
var _variables = require("../common/variables");
|
|
14
14
|
var _utils = require("../common/utils");
|
|
15
15
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
16
|
+
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
17
|
+
var _ActionsCell = _interopRequireDefault(require("./ActionsCell"));
|
|
16
18
|
var _templateObject, _templateObject2;
|
|
17
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
19
21
|
var DxcTable = function DxcTable(_ref) {
|
|
20
22
|
var children = _ref.children,
|
|
21
|
-
margin = _ref.margin
|
|
23
|
+
margin = _ref.margin,
|
|
24
|
+
_ref$mode = _ref.mode,
|
|
25
|
+
mode = _ref$mode === void 0 ? "default" : _ref$mode;
|
|
22
26
|
var colorsTheme = (0, _useTheme["default"])();
|
|
23
27
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
24
28
|
theme: colorsTheme.table
|
|
25
29
|
}, /*#__PURE__*/_react["default"].createElement(DxcTableContainer, {
|
|
26
30
|
margin: margin
|
|
27
|
-
}, /*#__PURE__*/_react["default"].createElement(DxcTableContent,
|
|
31
|
+
}, /*#__PURE__*/_react["default"].createElement(DxcTableContent, {
|
|
32
|
+
mode: mode
|
|
33
|
+
}, children)));
|
|
28
34
|
};
|
|
29
35
|
var calculateWidth = function calculateWidth(margin) {
|
|
30
36
|
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
@@ -46,8 +52,10 @@ var DxcTableContainer = _styledComponents["default"].div(_templateObject || (_te
|
|
|
46
52
|
}, function (props) {
|
|
47
53
|
return props.theme.scrollBarTrackColor;
|
|
48
54
|
});
|
|
49
|
-
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n height:
|
|
55
|
+
var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n border-collapse: collapse;\n width: 100%;\n\n & tr {\n border-bottom: ", ";\n height: ", ";\n }\n & td {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th {\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n text-transform: ", ";\n text-align: ", ";\n line-height: ", ";\n padding: ", ";\n }\n & th:first-child {\n border-top-left-radius: ", ";\n padding-left: ", ";\n }\n & th:last-child {\n border-top-right-radius: ", ";\n padding-right: ", ";\n }\n & td:first-child {\n padding-left: ", ";\n }\n & td:last-child {\n padding-right: ", ";\n }\n"])), function (props) {
|
|
50
56
|
return "".concat(props.theme.rowSeparatorThickness, " ").concat(props.theme.rowSeparatorStyle, " ").concat(props.theme.rowSeparatorColor);
|
|
57
|
+
}, function (props) {
|
|
58
|
+
return props.mode === "default" ? "60px" : "36px";
|
|
51
59
|
}, function (props) {
|
|
52
60
|
return props.theme.dataBackgroundColor;
|
|
53
61
|
}, function (props) {
|
|
@@ -67,7 +75,7 @@ var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_t
|
|
|
67
75
|
}, function (props) {
|
|
68
76
|
return props.theme.dataTextLineHeight;
|
|
69
77
|
}, function (props) {
|
|
70
|
-
return "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft);
|
|
78
|
+
return props.mode === "default" ? "".concat(props.theme.dataPaddingTop, " ").concat(props.theme.dataPaddingRight, " ").concat(props.theme.dataPaddingBottom, " ").concat(props.theme.dataPaddingLeft) : "".concat(_coreTokens["default"].spacing_8, " ").concat(_coreTokens["default"].spacing_16);
|
|
71
79
|
}, function (props) {
|
|
72
80
|
return props.theme.headerBackgroundColor;
|
|
73
81
|
}, function (props) {
|
|
@@ -87,10 +95,19 @@ var DxcTableContent = _styledComponents["default"].table(_templateObject2 || (_t
|
|
|
87
95
|
}, function (props) {
|
|
88
96
|
return props.theme.headerTextLineHeight;
|
|
89
97
|
}, function (props) {
|
|
90
|
-
return "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft);
|
|
98
|
+
return props.mode === "default" ? "".concat(props.theme.headerPaddingTop, " ").concat(props.theme.headerPaddingRight, " ").concat(props.theme.headerPaddingBottom, " ").concat(props.theme.headerPaddingLeft) : "".concat(_coreTokens["default"].spacing_8, " ").concat(_coreTokens["default"].spacing_16);
|
|
91
99
|
}, function (props) {
|
|
92
100
|
return props.theme.headerBorderRadius;
|
|
101
|
+
}, function (props) {
|
|
102
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
93
103
|
}, function (props) {
|
|
94
104
|
return props.theme.headerBorderRadius;
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
109
|
+
}, function (props) {
|
|
110
|
+
return props.mode === "default" ? _coreTokens["default"].spacing_24 : "20px";
|
|
95
111
|
});
|
|
112
|
+
DxcTable.ActionsCell = _ActionsCell["default"];
|
|
96
113
|
var _default = exports["default"] = DxcTable;
|