@dxc-technology/halstack-react 0.0.0-8d998c7 → 0.0.0-8db6a95

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.
Files changed (159) hide show
  1. package/README.md +46 -0
  2. package/dist/index.d.mts +6669 -0
  3. package/dist/index.d.ts +6669 -0
  4. package/dist/index.js +14523 -0
  5. package/dist/index.mjs +14465 -0
  6. package/package.json +69 -68
  7. package/BackgroundColorContext.js +0 -50
  8. package/ThemeContext.js +0 -246
  9. package/V3Select/V3Select.js +0 -455
  10. package/V3Select/index.d.ts +0 -27
  11. package/V3Textarea/V3Textarea.js +0 -260
  12. package/V3Textarea/index.d.ts +0 -27
  13. package/accordion/Accordion.d.ts +0 -4
  14. package/accordion/Accordion.js +0 -258
  15. package/accordion/types.d.ts +0 -68
  16. package/accordion/types.js +0 -5
  17. package/accordion-group/AccordionGroup.d.ts +0 -7
  18. package/accordion-group/AccordionGroup.js +0 -170
  19. package/accordion-group/types.d.ts +0 -72
  20. package/accordion-group/types.js +0 -5
  21. package/alert/Alert.d.ts +0 -4
  22. package/alert/Alert.js +0 -290
  23. package/alert/types.d.ts +0 -49
  24. package/alert/types.js +0 -5
  25. package/badge/Badge.js +0 -59
  26. package/box/Box.js +0 -152
  27. package/box/Box.stories.jsx +0 -132
  28. package/box/index.d.ts +0 -25
  29. package/button/Button.d.ts +0 -4
  30. package/button/Button.js +0 -182
  31. package/button/Button.stories.tsx +0 -293
  32. package/button/types.d.ts +0 -57
  33. package/button/types.js +0 -5
  34. package/card/Card.d.ts +0 -4
  35. package/card/Card.js +0 -165
  36. package/card/types.d.ts +0 -69
  37. package/card/types.js +0 -5
  38. package/checkbox/Checkbox.d.ts +0 -4
  39. package/checkbox/Checkbox.js +0 -253
  40. package/checkbox/types.d.ts +0 -60
  41. package/checkbox/types.js +0 -5
  42. package/chip/Chip.js +0 -221
  43. package/chip/index.d.ts +0 -22
  44. package/common/OpenSans.css +0 -81
  45. package/common/RequiredComponent.js +0 -32
  46. package/common/fonts/OpenSans-Bold.ttf +0 -0
  47. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  48. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  49. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  50. package/common/fonts/OpenSans-Italic.ttf +0 -0
  51. package/common/fonts/OpenSans-Light.ttf +0 -0
  52. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  53. package/common/fonts/OpenSans-Regular.ttf +0 -0
  54. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  55. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  56. package/common/utils.js +0 -22
  57. package/common/variables.js +0 -1569
  58. package/date/Date.js +0 -373
  59. package/date/index.d.ts +0 -27
  60. package/date-input/DateInput.d.ts +0 -4
  61. package/date-input/DateInput.js +0 -361
  62. package/date-input/types.d.ts +0 -100
  63. package/date-input/types.js +0 -5
  64. package/dialog/Dialog.js +0 -184
  65. package/dialog/index.d.ts +0 -18
  66. package/dropdown/Dropdown.d.ts +0 -4
  67. package/dropdown/Dropdown.js +0 -417
  68. package/dropdown/types.d.ts +0 -89
  69. package/dropdown/types.js +0 -5
  70. package/file-input/FileInput.js +0 -532
  71. package/file-input/FileItem.js +0 -193
  72. package/file-input/index.d.ts +0 -81
  73. package/footer/Footer.d.ts +0 -4
  74. package/footer/Footer.js +0 -266
  75. package/footer/Icons.js +0 -77
  76. package/footer/types.d.ts +0 -61
  77. package/footer/types.js +0 -5
  78. package/header/Header.js +0 -326
  79. package/header/Icons.js +0 -59
  80. package/header/index.d.ts +0 -25
  81. package/heading/Heading.js +0 -176
  82. package/heading/index.d.ts +0 -17
  83. package/input-text/Icons.js +0 -22
  84. package/input-text/InputText.js +0 -611
  85. package/input-text/index.d.ts +0 -36
  86. package/layout/ApplicationLayout.js +0 -235
  87. package/layout/Icons.js +0 -55
  88. package/link/Link.js +0 -183
  89. package/link/index.d.ts +0 -23
  90. package/main.d.ts +0 -44
  91. package/main.js +0 -363
  92. package/number-input/NumberInput.js +0 -128
  93. package/number-input/NumberInputContext.js +0 -16
  94. package/number-input/index.d.ts +0 -113
  95. package/paginator/Icons.js +0 -66
  96. package/paginator/Paginator.d.ts +0 -4
  97. package/paginator/Paginator.js +0 -198
  98. package/paginator/types.d.ts +0 -38
  99. package/paginator/types.js +0 -5
  100. package/password-input/PasswordInput.js +0 -199
  101. package/password-input/PasswordInput.stories.jsx +0 -131
  102. package/password-input/index.d.ts +0 -94
  103. package/progress-bar/ProgressBar.d.ts +0 -4
  104. package/progress-bar/ProgressBar.js +0 -170
  105. package/progress-bar/types.d.ts +0 -37
  106. package/progress-bar/types.js +0 -5
  107. package/radio/Radio.d.ts +0 -4
  108. package/radio/Radio.js +0 -174
  109. package/radio/types.d.ts +0 -54
  110. package/radio/types.js +0 -5
  111. package/resultsetTable/ResultsetTable.js +0 -274
  112. package/resultsetTable/index.d.ts +0 -19
  113. package/select/Select.js +0 -865
  114. package/select/index.d.ts +0 -131
  115. package/sidenav/Sidenav.js +0 -145
  116. package/sidenav/index.d.ts +0 -13
  117. package/slider/Slider.d.ts +0 -4
  118. package/slider/Slider.js +0 -306
  119. package/slider/types.d.ts +0 -83
  120. package/slider/types.js +0 -5
  121. package/spinner/Spinner.js +0 -267
  122. package/spinner/index.d.ts +0 -17
  123. package/switch/Switch.d.ts +0 -4
  124. package/switch/Switch.js +0 -179
  125. package/switch/types.d.ts +0 -58
  126. package/switch/types.js +0 -5
  127. package/table/Table.js +0 -118
  128. package/table/index.d.ts +0 -13
  129. package/tabs/Tabs.d.ts +0 -4
  130. package/tabs/Tabs.js +0 -211
  131. package/tabs/types.d.ts +0 -71
  132. package/tabs/types.js +0 -5
  133. package/tag/Tag.js +0 -208
  134. package/tag/index.d.ts +0 -24
  135. package/text-input/TextInput.js +0 -825
  136. package/text-input/index.d.ts +0 -135
  137. package/textarea/Textarea.js +0 -317
  138. package/textarea/Textarea.stories.jsx +0 -135
  139. package/textarea/index.d.ts +0 -117
  140. package/toggle/Toggle.js +0 -186
  141. package/toggle/index.d.ts +0 -21
  142. package/toggle-group/ToggleGroup.js +0 -243
  143. package/toggle-group/index.d.ts +0 -21
  144. package/upload/Upload.js +0 -201
  145. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  146. package/upload/buttons-upload/Icons.js +0 -40
  147. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  148. package/upload/dragAndDropArea/Icons.js +0 -39
  149. package/upload/file-upload/FileToUpload.js +0 -115
  150. package/upload/file-upload/Icons.js +0 -66
  151. package/upload/files-upload/FilesToUpload.js +0 -109
  152. package/upload/index.d.ts +0 -15
  153. package/upload/transaction/Icons.js +0 -160
  154. package/upload/transaction/Transaction.js +0 -104
  155. package/upload/transactions/Transactions.js +0 -94
  156. package/useTheme.js +0 -22
  157. package/wizard/Icons.js +0 -65
  158. package/wizard/Wizard.js +0 -271
  159. package/wizard/index.d.ts +0 -18
package/badge/Badge.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
- var _react = _interopRequireDefault(require("react"));
15
-
16
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
17
-
18
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
19
-
20
- var _templateObject;
21
-
22
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
-
24
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
-
26
- var DxcBadge = function DxcBadge(_ref) {
27
- var notificationText = _ref.notificationText;
28
- var colorsTheme = (0, _useTheme["default"])();
29
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
30
- theme: colorsTheme.tabs
31
- }, /*#__PURE__*/_react["default"].createElement(StyledDxcBadge, {
32
- notificationText: notificationText
33
- }, /*#__PURE__*/_react["default"].createElement("span", null, notificationText)));
34
- };
35
-
36
- var StyledDxcBadge = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n background-color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n width: ", ";\n height: ", ";\n border-radius: ", ";\n display: flex;\n padding-bottom: 1px;\n padding-right: 1px;\n flex-wrap: wrap;\n box-sizing: border-box;\n align-items: center;\n line-height: 1;\n align-content: center;\n flex-direction: row;\n justify-content: center;\n"])), function (props) {
37
- return props.theme.badgeBackgroundColor;
38
- }, function (props) {
39
- return props.theme.badgeFontFamily;
40
- }, function (props) {
41
- return props.theme.badgeFontSize;
42
- }, function (props) {
43
- return props.theme.badgeFontStyle;
44
- }, function (props) {
45
- return props.theme.badgeFontWeight;
46
- }, function (props) {
47
- return props.theme.badgeFontColor;
48
- }, function (props) {
49
- return props.theme.badgeLetterSpacing;
50
- }, function (props) {
51
- return props.notificationText === true ? props.theme.badgeWidth : props.theme.badgeWidthWithNotificationNumber;
52
- }, function (props) {
53
- return props.notificationText === true ? props.theme.badgeHeight : props.theme.badgeHeightWithNotificationNumber;
54
- }, function (props) {
55
- return props.notificationText === true ? props.theme.badgeRadius : props.theme.badgeRadiusWithNotificationNumber;
56
- });
57
-
58
- var _default = DxcBadge;
59
- exports["default"] = _default;
package/box/Box.js DELETED
@@ -1,152 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
-
16
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
-
18
- var _react = _interopRequireDefault(require("react"));
19
-
20
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
-
22
- var _propTypes = _interopRequireDefault(require("prop-types"));
23
-
24
- var _variables = require("../common/variables.js");
25
-
26
- var _utils = require("../common/utils.js");
27
-
28
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
29
-
30
- var _BackgroundColorContext = require("../BackgroundColorContext.js");
31
-
32
- var _templateObject;
33
-
34
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
-
36
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
-
38
- var DxcBox = function DxcBox(_ref) {
39
- var shadowDepth = _ref.shadowDepth,
40
- margin = _ref.margin,
41
- padding = _ref.padding,
42
- _ref$display = _ref.display,
43
- display = _ref$display === void 0 ? "inline-flex" : _ref$display,
44
- children = _ref.children,
45
- _ref$size = _ref.size,
46
- size = _ref$size === void 0 ? "fitContent" : _ref$size;
47
- var colorsTheme = (0, _useTheme["default"])();
48
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
49
- theme: colorsTheme.box
50
- }, /*#__PURE__*/_react["default"].createElement(StyledDxcBox, {
51
- shadowDepth: shadowDepth,
52
- display: display,
53
- margin: margin,
54
- padding: padding,
55
- size: size
56
- }, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
57
- color: colorsTheme.box.backgroundColor
58
- }, children)));
59
- };
60
-
61
- var sizes = {
62
- small: "48px",
63
- medium: "240px",
64
- large: "480px",
65
- fillParent: "100%",
66
- fitContent: "unset"
67
- };
68
-
69
- var calculateWidth = function calculateWidth(margin, size, padding) {
70
- if (size === "fillParent") {
71
- return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), " -\n ").concat((0, _utils.getMargin)(padding, "left"), " - ").concat((0, _utils.getMargin)(padding, "right"), ")");
72
- }
73
-
74
- return sizes[size];
75
- };
76
-
77
- var StyledDxcBox = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n letter-spacing: ", ";\n overflow: hidden;\n width: ", ";\n background-color: ", ";\n box-shadow: ", ";\n\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n padding: ", ";\n padding-top: ", ";\n padding-right: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n"])), function (_ref2) {
78
- var display = _ref2.display;
79
- return display;
80
- }, function (props) {
81
- return props.theme.borderRadius;
82
- }, function (props) {
83
- return props.theme.borderThickness;
84
- }, function (props) {
85
- return props.theme.borderStyle;
86
- }, function (props) {
87
- return props.theme.borderColor;
88
- }, function (props) {
89
- return props.theme.letterSpacing;
90
- }, function (props) {
91
- return calculateWidth(props.margin, props.size, props.padding);
92
- }, function (props) {
93
- return props.theme.backgroundColor;
94
- }, function (props) {
95
- return props.shadowDepth === 1 ? "".concat(props.theme.oneShadowDepthShadowOffsetX, " ").concat(props.theme.oneShadowDepthShadowOffsetY, " ").concat(props.theme.oneShadowDepthShadowBlur, " ").concat(props.theme.oneShadowDepthShadowSpread, " ").concat(props.theme.oneShadowDepthShadowColor) : props.shadowDepth === 2 ? "".concat(props.theme.twoShadowDepthShadowOffsetX, " ").concat(props.theme.twoShadowDepthShadowOffsetY, " ").concat(props.theme.twoShadowDepthShadowBlur, " ").concat(props.theme.twoShadowDepthShadowSpread, " ").concat(props.theme.twoShadowDepthShadowColor) : "".concat(props.theme.noneShadowDepthShadowOffsetX, " ").concat(props.theme.noneShadowDepthShadowOffsetY, " ").concat(props.theme.noneShadowDepthShadowBlur, " ").concat(props.theme.noneShadowDepthShadowSpread, " ").concat(props.theme.noneShadowDepthShadowColor);
96
- }, function (_ref3) {
97
- var margin = _ref3.margin;
98
- return margin && (0, _typeof2["default"])(margin) !== "object" ? _variables.spaces[margin] : "0px";
99
- }, function (_ref4) {
100
- var margin = _ref4.margin;
101
- return margin && margin.top ? _variables.spaces[margin.top] : "";
102
- }, function (_ref5) {
103
- var margin = _ref5.margin;
104
- return margin && margin.right ? _variables.spaces[margin.right] : "";
105
- }, function (_ref6) {
106
- var margin = _ref6.margin;
107
- return margin && margin.bottom ? _variables.spaces[margin.bottom] : "";
108
- }, function (_ref7) {
109
- var margin = _ref7.margin;
110
- return margin && margin.left ? _variables.spaces[margin.left] : "";
111
- }, function (_ref8) {
112
- var padding = _ref8.padding;
113
- return padding && (0, _typeof2["default"])(padding) !== "object" ? _variables.spaces[padding] : "0px";
114
- }, function (_ref9) {
115
- var padding = _ref9.padding;
116
- return padding && padding.top ? _variables.spaces[padding.top] : "";
117
- }, function (_ref10) {
118
- var padding = _ref10.padding;
119
- return padding && padding.right ? _variables.spaces[padding.right] : "";
120
- }, function (_ref11) {
121
- var padding = _ref11.padding;
122
- return padding && padding.bottom ? _variables.spaces[padding.bottom] : "";
123
- }, function (_ref12) {
124
- var padding = _ref12.padding;
125
- return padding && padding.left ? _variables.spaces[padding.left] : "";
126
- });
127
-
128
- DxcBox.propTypes = {
129
- size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
130
- display: _propTypes["default"].string,
131
- shadowDepth: _propTypes["default"].oneOf([0, 1, 2]),
132
- margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
133
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
134
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
135
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
136
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
137
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
138
- padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
139
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
140
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
141
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
142
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
143
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
144
- };
145
- DxcBox.defaultProps = {
146
- shadowDepth: 2,
147
- display: "inline-flex",
148
- margin: null,
149
- padding: null
150
- };
151
- var _default = DxcBox;
152
- exports["default"] = _default;
@@ -1,132 +0,0 @@
1
- import React from "react";
2
- import Title from "../../.storybook/components/Title";
3
- import ExampleContainer from "../../.storybook/components/ExampleContainer";
4
- import DxcBox from "./Box";
5
-
6
- export default {
7
- title: "Box ",
8
- component: DxcBox,
9
- };
10
-
11
- export const Chromatic = () => (
12
- <>
13
- <Title title="Display flex" theme="light" level={2} />
14
- <ExampleContainer>
15
- <DxcBox display="flex" padding="medium">
16
- Box
17
- </DxcBox>
18
- </ExampleContainer>
19
- <Title title="ShadowDepth" theme="light" level={2} />
20
- <ExampleContainer>
21
- <Title title="ShadowDepth 0" theme="light" level={4} />
22
- <DxcBox shadowDepth={0} margin="medium" padding="medium">
23
- Box
24
- </DxcBox>
25
- </ExampleContainer>
26
- <ExampleContainer>
27
- <Title title="ShadowDepth 1" theme="light" level={4} />
28
- <DxcBox shadowDepth={1} margin="medium" padding="medium">
29
- Box
30
- </DxcBox>
31
- </ExampleContainer>
32
- <ExampleContainer>
33
- <Title title="ShadowDepth 2" theme="light" level={4} />
34
- <DxcBox shadowDepth={2} margin="medium" padding="medium">
35
- Box
36
- </DxcBox>
37
- </ExampleContainer>
38
- <Title title="Paddings" theme="light" level={2} />
39
- <ExampleContainer>
40
- <Title title="Xxsmall padding" theme="light" level={4} />
41
- <DxcBox padding="xxsmall">Box</DxcBox>
42
- </ExampleContainer>
43
- <ExampleContainer>
44
- <Title title="Xsmall padding" theme="light" level={4} />
45
- <DxcBox padding="xsmall">Box</DxcBox>
46
- </ExampleContainer>
47
- <ExampleContainer>
48
- <Title title="Small padding" theme="light" level={4} />
49
- <DxcBox padding="small">Box</DxcBox>
50
- </ExampleContainer>
51
- <ExampleContainer>
52
- <Title title="Medium padding" theme="light" level={4} />
53
- <DxcBox padding="medium">Box</DxcBox>
54
- </ExampleContainer>
55
- <ExampleContainer>
56
- <Title title="Large padding" theme="light" level={4} />
57
- <DxcBox padding="large">Box</DxcBox>
58
- </ExampleContainer>
59
- <ExampleContainer>
60
- <Title title="Xlarge padding" theme="light" level={4} />
61
- <DxcBox padding="xlarge">Box</DxcBox>
62
- </ExampleContainer>
63
- <ExampleContainer>
64
- <Title title="Xxlarge padding" theme="light" level={4} />
65
- <DxcBox padding="xxlarge">Box</DxcBox>
66
- </ExampleContainer>
67
- <Title title="Margins" theme="light" level={2} />
68
- <ExampleContainer>
69
- <Title title="Xxsmall margin" theme="light" level={4} />
70
- <DxcBox margin="xxsmall" padding="medium">
71
- Box
72
- </DxcBox>
73
- </ExampleContainer>
74
- <ExampleContainer>
75
- <Title title="Xsmall margin" theme="light" level={4} />
76
- <DxcBox margin="xsmall" padding="medium">
77
- Box
78
- </DxcBox>
79
- </ExampleContainer>
80
- <ExampleContainer>
81
- <Title title="Small margin" theme="light" level={4} />
82
- <DxcBox margin="small" padding="medium">
83
- Box
84
- </DxcBox>
85
- </ExampleContainer>
86
- <ExampleContainer>
87
- <Title title="Medium margin" theme="light" level={4} />
88
- <DxcBox margin="medium" padding="medium">
89
- Box
90
- </DxcBox>
91
- </ExampleContainer>
92
- <ExampleContainer>
93
- <Title title="Large margin" theme="light" level={4} />
94
- <DxcBox margin="large" padding="medium">
95
- Box
96
- </DxcBox>
97
- </ExampleContainer>
98
- <ExampleContainer>
99
- <Title title="Xlarge margin" theme="light" level={4} />
100
- <DxcBox margin="xlarge" padding="medium">
101
- Box
102
- </DxcBox>
103
- </ExampleContainer>
104
- <ExampleContainer>
105
- <Title title="Xxlarge margin" theme="light" level={4} />
106
- <DxcBox margin="xxlarge" padding="medium">
107
- Box
108
- </DxcBox>
109
- </ExampleContainer>
110
- <Title title="Sizes" theme="light" level={2} />
111
- <ExampleContainer>
112
- <Title title="Small size" theme="light" level={4} />
113
- <DxcBox size="small">Box</DxcBox>
114
- </ExampleContainer>
115
- <ExampleContainer>
116
- <Title title="Medium size" theme="light" level={4} />
117
- <DxcBox size="medium">Box</DxcBox>
118
- </ExampleContainer>
119
- <ExampleContainer>
120
- <Title title="Large size" theme="light" level={4} />
121
- <DxcBox size="large">Box</DxcBox>
122
- </ExampleContainer>
123
- <ExampleContainer>
124
- <Title title="FillParent size" theme="light" level={4} />
125
- <DxcBox size="fillParent">Box</DxcBox>
126
- </ExampleContainer>
127
- <ExampleContainer>
128
- <Title title="FitContent" theme="light" level={4} />
129
- <DxcBox size="fitContent">Box</DxcBox>
130
- </ExampleContainer>
131
- </>
132
- );
package/box/index.d.ts DELETED
@@ -1,25 +0,0 @@
1
- type Size = "small" | "medium" | "large" | "fillParent" | "fitContent";
2
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
3
- type Margin = {
4
- top?: Space;
5
- bottom?: Space;
6
- left?: Space;
7
- right?: Space;
8
- };
9
- type Padding = {
10
- top?: Space;
11
- bottom?: Space;
12
- left?: Space;
13
- right?: Space;
14
- };
15
-
16
-
17
- type Props = {
18
- shadowDepth?: 0 | 1 | 2;
19
- margin?: Space | Margin;
20
- padging?: Space | Padding;
21
- display: string;
22
- size: Size;
23
- };
24
-
25
- export default function DxcBox(props: Props): JSX.Element;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import ButtonPropsType from "./types";
3
- declare const DxcButton: ({ label, mode, disabled, iconPosition, type, iconSrc, icon, onClick, margin, size, tabIndex, }: ButtonPropsType) => JSX.Element;
4
- export default DxcButton;
package/button/Button.js DELETED
@@ -1,182 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- var _typeof3 = require("@babel/runtime/helpers/typeof");
6
-
7
- Object.defineProperty(exports, "__esModule", {
8
- value: true
9
- });
10
- exports["default"] = void 0;
11
-
12
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
-
14
- var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
15
-
16
- var _react = _interopRequireWildcard(require("react"));
17
-
18
- var _Button = _interopRequireDefault(require("@material-ui/core/Button"));
19
-
20
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
21
-
22
- var _variables = require("../common/variables.js");
23
-
24
- var _utils = require("../common/utils.js");
25
-
26
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
27
-
28
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
29
-
30
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
31
-
32
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
-
34
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
-
36
- var DxcButton = function DxcButton(_ref) {
37
- var _ref$label = _ref.label,
38
- label = _ref$label === void 0 ? "" : _ref$label,
39
- _ref$mode = _ref.mode,
40
- mode = _ref$mode === void 0 ? "primary" : _ref$mode,
41
- _ref$disabled = _ref.disabled,
42
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
43
- _ref$iconPosition = _ref.iconPosition,
44
- iconPosition = _ref$iconPosition === void 0 ? "before" : _ref$iconPosition,
45
- _ref$type = _ref.type,
46
- type = _ref$type === void 0 ? "button" : _ref$type,
47
- _ref$iconSrc = _ref.iconSrc,
48
- iconSrc = _ref$iconSrc === void 0 ? "" : _ref$iconSrc,
49
- icon = _ref.icon,
50
- _ref$onClick = _ref.onClick,
51
- _onClick = _ref$onClick === void 0 ? "" : _ref$onClick,
52
- margin = _ref.margin,
53
- size = _ref.size,
54
- _ref$tabIndex = _ref.tabIndex,
55
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
56
-
57
- var colorsTheme = (0, _useTheme["default"])();
58
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
59
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
60
- theme: colorsTheme.button
61
- }, /*#__PURE__*/_react["default"].createElement(DxCButton, {
62
- type: type,
63
- margin: margin,
64
- mode: mode !== "primary" && mode !== "secondary" && mode !== "text" ? "primary" : mode,
65
- disabled: disabled,
66
- iconPosition: iconPosition,
67
- size: size,
68
- backgroundType: backgroundType,
69
- icon: icon
70
- }, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
71
- disabled: disabled,
72
- type: type,
73
- disableRipple: true,
74
- "aria-disabled": disabled ? true : false,
75
- tabIndex: disabled ? -1 : tabIndex,
76
- onClick: function onClick() {
77
- if (_onClick) {
78
- _onClick();
79
- }
80
- }
81
- }, label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
82
- icon: icon,
83
- iconPosition: iconPosition
84
- }, label), icon ? /*#__PURE__*/_react["default"].createElement(IconContainer, {
85
- label: label,
86
- iconPosition: iconPosition
87
- }, (0, _typeof2["default"])(icon) === "object" ? icon : /*#__PURE__*/_react["default"].createElement(icon)) : iconSrc && /*#__PURE__*/_react["default"].createElement(ButtonIcon, {
88
- label: label,
89
- iconPosition: iconPosition,
90
- src: iconSrc
91
- }))));
92
- };
93
-
94
- var sizes = {
95
- small: "42px",
96
- medium: "120px",
97
- large: "240px",
98
- fillParent: "100%",
99
- fitContent: "unset"
100
- };
101
-
102
- var calculateWidth = function calculateWidth(margin, size) {
103
- if (size === "fillParent") {
104
- return "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
105
- }
106
-
107
- return sizes[size];
108
- };
109
-
110
- var LabelContainer = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n line-height: ", ";\n font-size: ", ";\n text-overflow: ellipsis;\n overflow: hidden;\n text-transform: none;\n white-space: nowrap;\n margin-right: ", ";\n margin-left: ", ";\n"])), function (props) {
111
- return props.theme.labelFontLineHeight;
112
- }, function (props) {
113
- return props.theme.fontSize;
114
- }, function (props) {
115
- return !props.icon || props.iconPosition === "before" ? "8px" : "0px";
116
- }, function (props) {
117
- return !props.icon || props.iconPosition === "after" ? "8px" : "0px";
118
- });
119
-
120
- var IconContainer = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n overflow: hidden;\n display: flex;\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
121
- return !props.label ? "0px" : props.iconPosition === "after" && props.label !== "" && "8px" || "8px";
122
- }, function (props) {
123
- return !props.label ? "0px" : props.iconPosition === "before" && props.label !== "" && "8px" || "8px";
124
- });
125
-
126
- var ButtonIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n max-height: 24px;\n max-width: 24px;\n margin-left: ", ";\n margin-right: ", ";\n"])), function (props) {
127
- return props.iconPosition === "after" && props.label !== "" && "10px" || "0px";
128
- }, function (props) {
129
- return props.iconPosition === "before" && props.label !== "" && "10px" || "0px";
130
- });
131
-
132
- var DxCButton = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n display: inline-block;\n width: ", ";\n cursor: ", ";\n\n .MuiButtonBase-root {\n padding-left: ", ";\n padding-right: ", ";\n padding-top: ", ";\n padding-bottom: ", ";\n\n .MuiButton-label {\n display: flex;\n flex-direction: ", ";\n align-items: center;\n }\n\n box-shadow: 0 0 0 2px transparent;\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n letter-spacing: ", ";\n min-width: ", ";\n width: 100%;\n height: 40px;\n transition: none !important;\n\n &:focus {\n border-color: transparent;\n box-shadow: 0 0 0 2px\n ", ";\n }\n\n ", "\n }\n"])), function (props) {
133
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
134
- }, function (props) {
135
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
136
- }, function (props) {
137
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
138
- }, function (props) {
139
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
140
- }, function (props) {
141
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
142
- }, function (props) {
143
- return calculateWidth(props.margin, props.size);
144
- }, function (props) {
145
- return props.disabled && "not-allowed" || "pointer";
146
- }, function (props) {
147
- return props.theme.paddingLeft;
148
- }, function (props) {
149
- return props.theme.paddingRight;
150
- }, function (props) {
151
- return props.theme.paddingTop;
152
- }, function (props) {
153
- return props.theme.paddingBottom;
154
- }, function (props) {
155
- return props.iconPosition === "after" && "row" || "row-reverse";
156
- }, function (props) {
157
- return props.theme.fontFamily;
158
- }, function (props) {
159
- return props.theme.fontSize;
160
- }, function (props) {
161
- return props.theme.fontWeight;
162
- }, function (props) {
163
- return props.theme.labelLetterSpacing;
164
- }, function (props) {
165
- return props.size === "small" && "calc(100% - 22px)" || "unset";
166
- }, function (props) {
167
- return props.backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor;
168
- }, function (props) {
169
- var mode = props.mode,
170
- backgroundType = props.backgroundType;
171
-
172
- if (mode === "primary") {
173
- return "\n border-radius: ".concat(props.theme.primaryBorderRadius, ";\n border-width: ").concat(props.theme.primaryBorderThickness, ";\n border-style: ").concat(props.theme.primaryBorderStyle, ";\n font-family: ").concat(props.theme.primaryFontFamily, ";\n font-size: ").concat(props.theme.primaryFontSize, ";\n font-weight: ").concat(props.theme.primaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryBackgroundColorOnDark : props.theme.primaryBackgroundColor, ";\n color: ").concat(backgroundType && backgroundType === "dark" ? props.theme.primaryFontColorOnDark : props.theme.primaryFontColor, " !important;\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryHoverBackgroundColorOnDark : props.theme.primaryHoverBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryActiveBackgroundColorOnDark : props.theme.primaryActiveBackgroundColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled { \n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledBackgroundColorOnDark : props.theme.primaryDisabledBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.primaryDisabledFontColorOnDark : props.theme.primaryDisabledFontColor, "!important; \n }\n .MuiButton-label {\n z-index: 5;\n }\n ");
174
- } else if (mode === "secondary") {
175
- return "\n border-radius: ".concat(props.theme.secondaryBorderRadius, ";\n border-width: ").concat(props.theme.secondaryBorderThickness, ";\n border-style: ").concat(props.theme.secondaryBorderStyle, ";\n font-family: ").concat(props.theme.secondaryFontFamily, ";\n font-size: ").concat(props.theme.secondaryFontSize, ";\n font-weight: ").concat(props.theme.secondaryFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBackgroundColorOnDark : props.theme.secondaryBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryFontColorOnDark : props.theme.secondaryFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryBorderColorOnDark : props.theme.secondaryBorderColor, ";\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverBackgroundColorOnDark : props.theme.secondaryHoverBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryActiveBackgroundColorOnDark : props.theme.secondaryActiveBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryHoverFontColorOnDark : props.theme.secondaryHoverFontColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled {\n cursor: not-allowed;\n background-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBackgroundColorOnDark : props.theme.secondaryDisabledBackgroundColor, " !important;\n color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledFontColorOnDark : props.theme.secondaryDisabledFontColor, " !important;\n border-color: ").concat(backgroundType === "dark" ? props.theme.secondaryDisabledBorderColorOnDark : props.theme.secondaryDisabledBorderColor, ";\n }\n .MuiButton-label {\n z-index: 5;\n }\n ");
176
- } else if (mode === "text") {
177
- return "\n border-radius: ".concat(props.theme.textBorderRadius, ";\n border-width: ").concat(props.theme.textBorderThickness, ";\n border-style: ").concat(props.theme.textBorderStyle, ";\n font-family: ").concat(props.theme.textFontFamily, ";\n font-size: ").concat(props.theme.textFontSize, ";\n font-weight: ").concat(props.theme.textFontWeight, ";\n background-color: ").concat(backgroundType === "dark" ? props.theme.textBackgroundColorOnDark : props.theme.textBackgroundColor, ";\n color: ").concat(backgroundType === "dark" ? props.theme.textFontColorOnDark : props.theme.textFontColor, " !important;\n\n &:hover {\n background-color: ").concat(backgroundType === "dark" ? props.theme.textHoverBackgroundColorOnDark : props.theme.textHoverBackgroundColor, ";\n }\n &:active {\n background-color: ").concat(backgroundType === "dark" ? props.theme.textActiveBackgroundColorOnDark : props.theme.textActiveBackgroundColor, " !important;\n border-color: transparent;\n box-shadow: 0 0 0 2px ").concat(backgroundType === "dark" ? props.theme.focusBorderColorOnDark : props.theme.focusBorderColor, ";\n }\n &:disabled {\n cursor:not-allowed;\n color: ").concat(backgroundType === "dark" ? props.theme.textDisabledFontColorOnDark : props.theme.textDisabledFontColor, " !important;\n background-color: ").concat(backgroundType === "dark" ? props.theme.textDisabledBackgroundColorOnDark : props.theme.textDisabledBackgroundColor, ";\n }\n ");
178
- }
179
- });
180
-
181
- var _default = DxcButton;
182
- exports["default"] = _default;