@dxc-technology/halstack-react 0.0.0-522074c → 0.0.0-52f9f99

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 (154) hide show
  1. package/README.md +46 -0
  2. package/dist/index.d.mts +6683 -0
  3. package/dist/index.d.ts +6683 -0
  4. package/dist/index.js +1 -0
  5. package/dist/index.mjs +1 -0
  6. package/package.json +69 -66
  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/index.d.ts +0 -25
  28. package/button/Button.d.ts +0 -4
  29. package/button/Button.js +0 -182
  30. package/button/Button.stories.tsx +0 -293
  31. package/button/types.d.ts +0 -57
  32. package/button/types.js +0 -5
  33. package/card/Card.d.ts +0 -4
  34. package/card/Card.js +0 -165
  35. package/card/types.d.ts +0 -69
  36. package/card/types.js +0 -5
  37. package/checkbox/Checkbox.d.ts +0 -4
  38. package/checkbox/Checkbox.js +0 -253
  39. package/checkbox/types.d.ts +0 -60
  40. package/checkbox/types.js +0 -5
  41. package/chip/Chip.js +0 -221
  42. package/chip/index.d.ts +0 -22
  43. package/common/OpenSans.css +0 -81
  44. package/common/RequiredComponent.js +0 -32
  45. package/common/fonts/OpenSans-Bold.ttf +0 -0
  46. package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
  47. package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
  48. package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
  49. package/common/fonts/OpenSans-Italic.ttf +0 -0
  50. package/common/fonts/OpenSans-Light.ttf +0 -0
  51. package/common/fonts/OpenSans-LightItalic.ttf +0 -0
  52. package/common/fonts/OpenSans-Regular.ttf +0 -0
  53. package/common/fonts/OpenSans-SemiBold.ttf +0 -0
  54. package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
  55. package/common/utils.js +0 -22
  56. package/common/variables.js +0 -1569
  57. package/date/Date.js +0 -373
  58. package/date/index.d.ts +0 -27
  59. package/date-input/DateInput.d.ts +0 -4
  60. package/date-input/DateInput.js +0 -361
  61. package/date-input/types.d.ts +0 -100
  62. package/date-input/types.js +0 -5
  63. package/dialog/Dialog.js +0 -184
  64. package/dialog/index.d.ts +0 -18
  65. package/dropdown/Dropdown.d.ts +0 -4
  66. package/dropdown/Dropdown.js +0 -417
  67. package/dropdown/types.d.ts +0 -89
  68. package/dropdown/types.js +0 -5
  69. package/file-input/FileInput.js +0 -532
  70. package/file-input/FileItem.js +0 -193
  71. package/file-input/index.d.ts +0 -81
  72. package/footer/Footer.js +0 -297
  73. package/footer/Icons.js +0 -77
  74. package/footer/index.d.ts +0 -25
  75. package/header/Header.js +0 -326
  76. package/header/Icons.js +0 -59
  77. package/header/index.d.ts +0 -25
  78. package/heading/Heading.js +0 -176
  79. package/heading/index.d.ts +0 -17
  80. package/input-text/Icons.js +0 -22
  81. package/input-text/InputText.js +0 -611
  82. package/input-text/index.d.ts +0 -36
  83. package/layout/ApplicationLayout.js +0 -235
  84. package/layout/Icons.js +0 -55
  85. package/link/Link.js +0 -183
  86. package/link/index.d.ts +0 -23
  87. package/main.d.ts +0 -44
  88. package/main.js +0 -363
  89. package/number-input/NumberInput.js +0 -128
  90. package/number-input/NumberInputContext.js +0 -16
  91. package/number-input/index.d.ts +0 -113
  92. package/paginator/Icons.js +0 -66
  93. package/paginator/Paginator.d.ts +0 -4
  94. package/paginator/Paginator.js +0 -198
  95. package/paginator/types.d.ts +0 -38
  96. package/paginator/types.js +0 -5
  97. package/password-input/PasswordInput.js +0 -199
  98. package/password-input/PasswordInput.stories.jsx +0 -131
  99. package/password-input/index.d.ts +0 -94
  100. package/progress-bar/ProgressBar.d.ts +0 -4
  101. package/progress-bar/ProgressBar.js +0 -170
  102. package/progress-bar/types.d.ts +0 -37
  103. package/progress-bar/types.js +0 -5
  104. package/radio/Radio.d.ts +0 -4
  105. package/radio/Radio.js +0 -174
  106. package/radio/types.d.ts +0 -54
  107. package/radio/types.js +0 -5
  108. package/resultsetTable/ResultsetTable.js +0 -274
  109. package/resultsetTable/index.d.ts +0 -19
  110. package/select/Select.js +0 -865
  111. package/select/index.d.ts +0 -131
  112. package/sidenav/Sidenav.js +0 -145
  113. package/sidenav/index.d.ts +0 -13
  114. package/slider/Slider.d.ts +0 -4
  115. package/slider/Slider.js +0 -306
  116. package/slider/types.d.ts +0 -83
  117. package/slider/types.js +0 -5
  118. package/spinner/Spinner.js +0 -267
  119. package/spinner/index.d.ts +0 -17
  120. package/switch/Switch.d.ts +0 -4
  121. package/switch/Switch.js +0 -179
  122. package/switch/types.d.ts +0 -58
  123. package/switch/types.js +0 -5
  124. package/table/Table.js +0 -118
  125. package/table/index.d.ts +0 -13
  126. package/tabs/Tabs.js +0 -259
  127. package/tabs/index.d.ts +0 -19
  128. package/tag/Tag.js +0 -208
  129. package/tag/index.d.ts +0 -24
  130. package/text-input/TextInput.js +0 -825
  131. package/text-input/index.d.ts +0 -135
  132. package/textarea/Textarea.js +0 -317
  133. package/textarea/Textarea.stories.jsx +0 -135
  134. package/textarea/index.d.ts +0 -117
  135. package/toggle/Toggle.js +0 -186
  136. package/toggle/index.d.ts +0 -21
  137. package/toggle-group/ToggleGroup.js +0 -243
  138. package/toggle-group/index.d.ts +0 -21
  139. package/upload/Upload.js +0 -201
  140. package/upload/buttons-upload/ButtonsUpload.js +0 -111
  141. package/upload/buttons-upload/Icons.js +0 -40
  142. package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
  143. package/upload/dragAndDropArea/Icons.js +0 -39
  144. package/upload/file-upload/FileToUpload.js +0 -115
  145. package/upload/file-upload/Icons.js +0 -66
  146. package/upload/files-upload/FilesToUpload.js +0 -109
  147. package/upload/index.d.ts +0 -15
  148. package/upload/transaction/Icons.js +0 -160
  149. package/upload/transaction/Transaction.js +0 -104
  150. package/upload/transactions/Transactions.js +0 -94
  151. package/useTheme.js +0 -22
  152. package/wizard/Icons.js +0 -65
  153. package/wizard/Wizard.js +0 -271
  154. package/wizard/index.d.ts +0 -18
package/select/index.d.ts DELETED
@@ -1,131 +0,0 @@
1
- type SVG = string | (HTMLElement & SVGElement);
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
-
10
- type OptionGroup = {
11
- /**
12
- * Label of the group to be shown in the select's listbox.
13
- */
14
- label: string;
15
- /**
16
- * List of the grouped options.
17
- */
18
- options: Option[];
19
- };
20
- type Option = {
21
- /**
22
- * Element used as the icon that will be placed before the option label.
23
- * It can be a url of an image or an inline SVG. If the url option
24
- * is the chosen one, take into account that the component's
25
- * color styling tokens will not be applied to the image.
26
- */
27
- icon?: SVG;
28
- /**
29
- * Label of the option to be shown in the select's listbox.
30
- */
31
- label: string;
32
- /**
33
- * Value of the option. It should be unique and
34
- * not an empty string, which is reserved to the empty option added
35
- * by optional prop.
36
- */
37
- value: string;
38
- };
39
-
40
- type Props = {
41
- /**
42
- * Text to be placed above the select.
43
- */
44
- label?: string;
45
- /**
46
- * Name attribute of the input element. This attribute will allow users
47
- * to find the component's value during the submit event. In this event,
48
- * the component's value will always be a regular string, for both single
49
- * and multiple selection modes, been in the first one a single option
50
- * value and in the multiple variant more than one option value,
51
- * separated by commas.
52
- */
53
- name?: string;
54
- /**
55
- * Value of the select. If undefined, the component will be uncontrolled
56
- * and the value will be managed internally by the component.
57
- */
58
- value?: string | string[];
59
- /**
60
- * An array of objects representing the selectable options.
61
- */
62
- options?: Option[] | OptionGroup[];
63
- /**
64
- * Helper text to be placed above the select.
65
- */
66
- helperText?: string;
67
- /**
68
- * Text to be put as placeholder of the select.
69
- */
70
- placeholder?: string;
71
- /**
72
- * If true, the component will be disabled.
73
- */
74
- disabled?: boolean;
75
- /**
76
- * If true, the select will be optional, showing '(Optional)'
77
- * next to the label and adding a default first option with an empty string as value,
78
- * been the placeholder (if defined) its label. Otherwise, the field will be
79
- * considered required and an error will be passed as a parameter to the
80
- * OnBlur and onChange functions if an option wasn't selected.
81
- */
82
- optional?: boolean;
83
- /**
84
- * If true, enables search functionality.
85
- */
86
- searchable?: boolean;
87
- /**
88
- * If true, the select component will support multiple selected options.
89
- * In that case, value will be an array of strings with each selected
90
- * option value.
91
- */
92
- multiple?: boolean;
93
- /**
94
- * This function will be called when the user selects an option.
95
- * An object including the current value and the error (if the value entered is not valid)
96
- * will be passed to this function. If there is no error, error will be null.
97
- */
98
- onChange?: (value: string | string[]) => void;
99
- /**
100
- * This function will be called when the select loses the focus. An
101
- * object including the value (or values) and the error (if the value
102
- * selected is not valid) will be passed to this function. If there is no error,
103
- * error will be null.
104
- */
105
- onBlur?: (val: { value: string | string[]; error: string }) => void;
106
- /**
107
- * If it is defined, the component will change its appearance, showing
108
- * the error below the select component. If it is not defined, the error
109
- * messages will be managed internally, but never displayed on its own.
110
- */
111
- error?: string;
112
- /**
113
- * Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
114
- * You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
115
- */
116
- margin?: Space | Margin;
117
- /**
118
- * Size of the component ('small' | 'medium' | 'large' | 'fillParent').
119
- */
120
- size?: "small" | "medium" | "large" | "fillParent";
121
- /**
122
- * Value of the tabindex attribute.
123
- */
124
- tabIndex?: number;
125
- /**
126
- * Reference to the component.
127
- */
128
- ref?: React.RefObject<HTMLDivElement>;
129
- };
130
-
131
- export default function DxcSelect(props: Props): JSX.Element;
@@ -1,145 +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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _react = _interopRequireDefault(require("react"));
17
-
18
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
-
20
- var _propTypes = _interopRequireDefault(require("prop-types"));
21
-
22
- var _variables = require("../common/variables.js");
23
-
24
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
25
-
26
- var _BackgroundColorContext = require("../BackgroundColorContext.js");
27
-
28
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
29
-
30
- 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); }
31
-
32
- 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; }
33
-
34
- var DxcSidenav = function DxcSidenav(_ref) {
35
- var padding = _ref.padding,
36
- children = _ref.children;
37
- var colorsTheme = (0, _useTheme["default"])();
38
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
39
- theme: colorsTheme.sidenav
40
- }, /*#__PURE__*/_react["default"].createElement(SideNavContainer, {
41
- padding: padding
42
- }, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
43
- color: colorsTheme.sidenav.backgroundColor
44
- }, children)));
45
- };
46
-
47
- var Title = function Title(_ref2) {
48
- var children = _ref2.children;
49
- return /*#__PURE__*/_react["default"].createElement(SideNavMenuTitle, null, children);
50
- };
51
-
52
- var Subtitle = function Subtitle(_ref3) {
53
- var children = _ref3.children;
54
- return /*#__PURE__*/_react["default"].createElement(SideNavMenuSubTitle, null, children);
55
- };
56
-
57
- var Link = function Link(_ref4) {
58
- var href = _ref4.href,
59
- onClick = _ref4.onClick,
60
- children = _ref4.children;
61
- return /*#__PURE__*/_react["default"].createElement(SideNavMenuLink, {
62
- href: href,
63
- onClick: onClick
64
- }, children);
65
- };
66
-
67
- var SideNavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n background-color: ", ";\n max-width: 300px;\n width: ", ";\n padding: ", ";\n\n overflow-y: auto;\n overflow-x: hidden;\n ::-webkit-scrollbar {\n width: 2px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n"])), function (props) {
68
- return props.theme.backgroundColor;
69
- }, function (props) {
70
- return props.padding ? "calc(300px - ".concat(_variables.spaces[props.padding], " - ").concat(_variables.spaces[props.padding], ")") : "300px";
71
- }, function (props) {
72
- return props.padding ? _variables.spaces[props.padding] : "";
73
- }, function (props) {
74
- return props.theme.scrollBarTrackColor;
75
- }, function (props) {
76
- return props.theme.scrollBarThumbColor;
77
- });
78
-
79
- var SideNavMenuTitle = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n margin-bottom: 16px;\n"])), function (props) {
80
- return props.theme.titleFontFamily;
81
- }, function (props) {
82
- return props.theme.titleFontSize;
83
- }, function (props) {
84
- return props.theme.titleFontStyle;
85
- }, function (props) {
86
- return props.theme.titleFontWeight;
87
- }, function (props) {
88
- return props.theme.titleFontColor;
89
- }, function (props) {
90
- return props.theme.titleFontLetterSpacing;
91
- }, function (props) {
92
- return props.theme.titleFontTextTransform;
93
- });
94
-
95
- var SideNavMenuSubTitle = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n margin-bottom: 4px;\n"])), function (props) {
96
- return props.theme.subtitleFontFamily;
97
- }, function (props) {
98
- return props.theme.subtitleFontSize;
99
- }, function (props) {
100
- return props.theme.subtitleFontStyle;
101
- }, function (props) {
102
- return props.theme.subtitleFontWeight;
103
- }, function (props) {
104
- return props.theme.subtitleFontColor;
105
- }, function (props) {
106
- return props.theme.subtitleFontLetterSpacing;
107
- }, function (props) {
108
- return props.theme.subtitleFontTextTransform;
109
- });
110
-
111
- var SideNavMenuLink = _styledComponents["default"].a(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n text-decoration: ", ";\n margin: ", ";\n cursor: pointer;\n\n :focus-visible {\n outline: 2px solid ", ";\n outline-offset: 1px;\n }\n"])), function (props) {
112
- return props.theme.linkFontFamily;
113
- }, function (props) {
114
- return props.theme.linkFontSize;
115
- }, function (props) {
116
- return props.theme.linkFontStyle;
117
- }, function (props) {
118
- return props.theme.linkFontWeight;
119
- }, function (props) {
120
- return props.theme.linkFontColor;
121
- }, function (props) {
122
- return props.theme.linkFontLetterSpacing;
123
- }, function (props) {
124
- return props.theme.linkFontTextTransform;
125
- }, function (props) {
126
- return props.theme.linkTextDecoration;
127
- }, function (props) {
128
- return "".concat(props.theme.linkMarginTop, " ").concat(props.theme.linkMarginRight, " ").concat(props.theme.linkMarginBottom, " ").concat(props.theme.linkMarginLeft);
129
- }, function (props) {
130
- return props.theme.linkFocusColor;
131
- });
132
-
133
- DxcSidenav.propTypes = {
134
- padding: _propTypes["default"].oneOfType([_propTypes["default"].shape({
135
- top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
136
- bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
137
- left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
138
- right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
139
- }), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
140
- };
141
- DxcSidenav.Title = Title;
142
- DxcSidenav.Subtitle = Subtitle;
143
- DxcSidenav.Link = Link;
144
- var _default = DxcSidenav;
145
- exports["default"] = _default;
@@ -1,13 +0,0 @@
1
- type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
2
- type Padding = {
3
- top?: Space;
4
- bottom?: Space;
5
- left?: Space;
6
- right?: Space;
7
- };
8
-
9
- type Props = {
10
- padding?: Space | Padding;
11
- };
12
-
13
- export default function DxcSidenav(props: Props): JSX.Element;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import SliderPropsType from "./types";
3
- declare const DxcSlider: ({ label, name, value, helperText, minValue, maxValue, step, showLimitsValues, showInput, disabled, marks, onChange, onDragEnd, labelFormatCallback, margin, size, tabIndex, }: SliderPropsType) => JSX.Element;
4
- export default DxcSlider;
package/slider/Slider.js DELETED
@@ -1,306 +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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
15
-
16
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
17
-
18
- var _react = _interopRequireWildcard(require("react"));
19
-
20
- var _Slider = _interopRequireDefault(require("@material-ui/lab/Slider"));
21
-
22
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
23
-
24
- var _TextInput = _interopRequireDefault(require("../text-input/TextInput"));
25
-
26
- var _variables = require("../common/variables.js");
27
-
28
- var _utils = require("../common/utils.js");
29
-
30
- var _useTheme = _interopRequireDefault(require("../useTheme.js"));
31
-
32
- var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext.js"));
33
-
34
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
35
-
36
- 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); }
37
-
38
- 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; }
39
-
40
- var DxcSlider = function DxcSlider(_ref) {
41
- var _ref$label = _ref.label,
42
- label = _ref$label === void 0 ? "" : _ref$label,
43
- _ref$name = _ref.name,
44
- name = _ref$name === void 0 ? "" : _ref$name,
45
- value = _ref.value,
46
- _ref$helperText = _ref.helperText,
47
- helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
48
- _ref$minValue = _ref.minValue,
49
- minValue = _ref$minValue === void 0 ? 0 : _ref$minValue,
50
- _ref$maxValue = _ref.maxValue,
51
- maxValue = _ref$maxValue === void 0 ? 100 : _ref$maxValue,
52
- _ref$step = _ref.step,
53
- step = _ref$step === void 0 ? 1 : _ref$step,
54
- _ref$showLimitsValues = _ref.showLimitsValues,
55
- showLimitsValues = _ref$showLimitsValues === void 0 ? false : _ref$showLimitsValues,
56
- _ref$showInput = _ref.showInput,
57
- showInput = _ref$showInput === void 0 ? false : _ref$showInput,
58
- _ref$disabled = _ref.disabled,
59
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
60
- _ref$marks = _ref.marks,
61
- marks = _ref$marks === void 0 ? false : _ref$marks,
62
- onChange = _ref.onChange,
63
- onDragEnd = _ref.onDragEnd,
64
- labelFormatCallback = _ref.labelFormatCallback,
65
- margin = _ref.margin,
66
- _ref$size = _ref.size,
67
- size = _ref$size === void 0 ? "fillParent" : _ref$size,
68
- _ref$tabIndex = _ref.tabIndex,
69
- tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
70
-
71
- var _useState = (0, _react.useState)(0),
72
- _useState2 = (0, _slicedToArray2["default"])(_useState, 2),
73
- innerValue = _useState2[0],
74
- setInnerValue = _useState2[1];
75
-
76
- var colorsTheme = (0, _useTheme["default"])();
77
- var backgroundType = (0, _react.useContext)(_BackgroundColorContext["default"]);
78
- var minLabel = (0, _react.useMemo)(function () {
79
- return labelFormatCallback ? labelFormatCallback(minValue) : minValue;
80
- }, [labelFormatCallback, minValue]);
81
- var maxLabel = (0, _react.useMemo)(function () {
82
- return labelFormatCallback ? labelFormatCallback(maxValue) : maxValue;
83
- }, [labelFormatCallback, maxValue]);
84
-
85
- var handlerSliderChange = function handlerSliderChange(event, newValue) {
86
- var valueToCheck = value !== null && value !== void 0 ? value : innerValue;
87
- valueToCheck !== newValue && setInnerValue(newValue);
88
- onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
89
- };
90
-
91
- var handleSliderOnChangeCommited = function handleSliderOnChangeCommited(event, selectedValue) {
92
- onDragEnd === null || onDragEnd === void 0 ? void 0 : onDragEnd(selectedValue);
93
- };
94
-
95
- var handlerInputChange = function handlerInputChange(event) {
96
- var intValue = parseInt(event.value, 10);
97
-
98
- if (value == null) {
99
- if (!Number.isNaN(intValue)) setInnerValue(intValue > maxValue ? maxValue : intValue);
100
- }
101
-
102
- if (!Number.isNaN(intValue)) {
103
- onChange === null || onChange === void 0 ? void 0 : onChange(intValue > maxValue ? maxValue : intValue);
104
- }
105
- };
106
-
107
- return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
108
- theme: colorsTheme.slider
109
- }, /*#__PURE__*/_react["default"].createElement(Container, {
110
- margin: margin,
111
- size: size
112
- }, /*#__PURE__*/_react["default"].createElement(Label, null, label), /*#__PURE__*/_react["default"].createElement(HelperText, null, helperText), /*#__PURE__*/_react["default"].createElement(SliderContainer, {
113
- backgroundType: backgroundType
114
- }, showLimitsValues && /*#__PURE__*/_react["default"].createElement(MinLabelContainer, {
115
- backgroundType: backgroundType,
116
- disabled: disabled
117
- }, minLabel), /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
118
- value: value != null && value >= 0 && value || innerValue,
119
- min: minValue,
120
- max: maxValue,
121
- onChange: handlerSliderChange,
122
- onChangeCommitted: handleSliderOnChangeCommited,
123
- step: step,
124
- marks: marks || [],
125
- disabled: disabled,
126
- tabIndex: tabIndex
127
- }), showLimitsValues && /*#__PURE__*/_react["default"].createElement(MaxLabelContainer, {
128
- backgroundType: backgroundType,
129
- disabled: disabled,
130
- step: step
131
- }, maxLabel), showInput && /*#__PURE__*/_react["default"].createElement(StyledTextInput, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
132
- name: name,
133
- value: value != null && value >= 0 && value || innerValue,
134
- disabled: disabled,
135
- onChange: handlerInputChange,
136
- size: "fillParent",
137
- tabIndex: tabIndex
138
- })))));
139
- };
140
-
141
- var sizes = {
142
- medium: "240px",
143
- large: "480px",
144
- fillParent: "100%"
145
- };
146
-
147
- var calculateWidth = function calculateWidth(margin, size) {
148
- return size === "fillParent" ? "calc(".concat(sizes[size], " - ").concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")") : sizes[size];
149
- };
150
-
151
- var Container = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: ", ";\n"])), function (props) {
152
- return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
153
- }, function (props) {
154
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
155
- }, function (props) {
156
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
157
- }, function (props) {
158
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
159
- }, function (props) {
160
- return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
161
- }, function (props) {
162
- return calculateWidth(props.margin, props.size);
163
- });
164
-
165
- var Label = _styledComponents["default"].label(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
166
- return props.theme.labelFontColor;
167
- }, function (props) {
168
- return props.theme.labelFontFamily;
169
- }, function (props) {
170
- return props.theme.labelFontSize;
171
- }, function (props) {
172
- return props.theme.labelFontStyle;
173
- }, function (props) {
174
- return props.theme.labelFontWeight;
175
- }, function (props) {
176
- return props.theme.labelLineHeight;
177
- });
178
-
179
- var HelperText = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
180
- return props.theme.helperTextFontColor;
181
- }, function (props) {
182
- return props.theme.helperTextFontFamily;
183
- }, function (props) {
184
- return props.theme.helperTextFontSize;
185
- }, function (props) {
186
- return props.theme.helperTextFontstyle;
187
- }, function (props) {
188
- return props.theme.helperTextFontWeight;
189
- }, function (props) {
190
- return props.theme.helperTextLineHeight;
191
- });
192
-
193
- var SliderContainer = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n height: 48px;\n align-items: center;\n\n .MultiSlider-root {\n display: flex;\n align-items: center;\n }\n .MuiSlider-container {\n padding: 30px 24px;\n }\n .MuiSlider-root.Mui-disabled {\n color: ", ";\n cursor: not-allowed;\n }\n .Mui-disabled {\n & .MuiSlider-thumb {\n height: ", ";\n width: ", ";\n background-color: ", ";\n top: ", ";\n }\n & .MuiSlider-track {\n background-color: ", ";\n }\n & .MuiSlider-rail {\n background-color: ", ";\n }\n & > .MuiSlider-mark.MuiSlider-markActive {\n background-color: ", " !important;\n }\n & > .MuiSlider-mark {\n background-color: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n top: ", ";\n }\n }\n .MuiSlider-thumb {\n height: ", ";\n width: ", ";\n background-color: ", ";\n top: ", ";\n border-radius: 9999px;\n\n :hover,\n &.Mui-focusVisible {\n box-shadow: none;\n }\n &.MuiSlider-active {\n box-shadow: none;\n }\n :focus {\n outline: ", "\n auto 1px;\n outline-offset: 2px;\n background-color: ", ";\n }\n :hover {\n background-color: ", ";\n transform: scale(", ");\n transform-origin: center;\n height: ", ";\n width: ", ";\n top: ", ";\n }\n :active {\n background-color: ", ";\n transform: scale(", ");\n transform-origin: center;\n }\n }\n .MuiSlider-track {\n background-color: ", ";\n height: ", ";\n top: ", ";\n border-radius: 9999px;\n }\n .MuiSlider-track.MuiSlider-trackAfter {\n background-color: ", ";\n }\n .MuiSlider-rail {\n background-color: ", ";\n height: ", ";\n top: ", ";\n }\n .MuiSlider-mark.MuiSlider-markActive {\n background-color: ", ";\n }\n .MuiSlider-mark {\n background-color: ", ";\n height: ", ";\n width: ", ";\n border-radius: 18px;\n top: ", ";\n }\n"])), function (props) {
194
- return props.backgroundType === "dark" ? props.theme.disabledThumbBackgroundColorOnDark : props.theme.disabledThumbBackgroundColor;
195
- }, function (props) {
196
- return props.theme.thumbHeight;
197
- }, function (props) {
198
- return props.theme.thumbWidth;
199
- }, function (props) {
200
- return props.backgroundType === "dark" ? props.theme.disabledThumbBackgroundColorOnDark : props.theme.disabledThumbBackgroundColor;
201
- }, function (props) {
202
- return props.theme.disabledThumbVerticalPosition;
203
- }, function (props) {
204
- return props.backgroundType === "dark" ? props.theme.disabledTrackLineColorOnDark : props.theme.disabledTrackLineColor;
205
- }, function (props) {
206
- return props.backgroundType === "dark" ? props.theme.disabledTotalLineColorOnDark : props.theme.disabledTotalLineColor;
207
- }, function (props) {
208
- return props.backgroundType === "dark" ? props.theme.disabledTickBackgroundColorOnDark : props.theme.disabledTickBackgroundColor;
209
- }, function (props) {
210
- return props.backgroundType === "dark" ? props.theme.disabledTickBackgroundColorOnDark : props.theme.disabledTickBackgroundColor;
211
- }, function (props) {
212
- return props.theme.tickHeight;
213
- }, function (props) {
214
- return props.theme.tickWidth;
215
- }, function (props) {
216
- return props.theme.disabledTickVerticalPosition;
217
- }, function (props) {
218
- return props.theme.thumbHeight;
219
- }, function (props) {
220
- return props.theme.thumbWidth;
221
- }, function (props) {
222
- return props.backgroundType === "dark" ? props.theme.thumbBackgroundColorOnDark : props.theme.thumbBackgroundColor;
223
- }, function (props) {
224
- return props.theme.thumbVerticalPosition;
225
- }, function (props) {
226
- return props.backgroundType === "dark" ? props.theme.focusColorOnDark : props.theme.focusColor;
227
- }, function (props) {
228
- return props.backgroundType === "dark" ? props.theme.focusThumbBackgroundColorOnDark : props.theme.focusThumbBackgroundColor;
229
- }, function (props) {
230
- return props.backgroundType === "dark" ? props.theme.hoverThumbBackgroundColorOnDark : props.theme.hoverThumbBackgroundColor;
231
- }, function (props) {
232
- return props.theme.hoverThumbScale;
233
- }, function (props) {
234
- return props.theme.hoverThumbHeight;
235
- }, function (props) {
236
- return props.theme.hoverThumbWidth;
237
- }, function (props) {
238
- return props.theme.hoverThumbVerticalPosition;
239
- }, function (props) {
240
- return props.backgroundType === "dark" ? props.theme.activeThumbBackgroundColorOnDark : props.theme.activeThumbBackgroundColor;
241
- }, function (props) {
242
- return props.theme.activeThumbScale;
243
- }, function (props) {
244
- return props.backgroundType === "dark" ? props.theme.trackLineColorOnDark : props.theme.trackLineColor;
245
- }, function (props) {
246
- return props.theme.trackLineThickness;
247
- }, function (props) {
248
- return props.theme.trackLineVerticalPosition;
249
- }, function (props) {
250
- return props.backgroundType === "dark" ? props.theme.trackLineColorOnDark : props.theme.trackLineColor;
251
- }, function (props) {
252
- return props.backgroundType === "dark" ? props.theme.totalLineColorOnDark : props.theme.totalLineColor;
253
- }, function (props) {
254
- return props.theme.totalLineThickness;
255
- }, function (props) {
256
- return props.theme.totalLineVerticalPosition;
257
- }, function (props) {
258
- return props.backgroundType === "dark" ? props.theme.tickBackgroundColorOnDark : props.theme.tickBackgroundColor;
259
- }, function (props) {
260
- return props.backgroundType === "dark" ? props.theme.tickBackgroundColorOnDark : props.theme.tickBackgroundColor;
261
- }, function (props) {
262
- return props.theme.tickHeight;
263
- }, function (props) {
264
- return props.theme.tickWidth;
265
- }, function (props) {
266
- return props.theme.tickVerticalPosition;
267
- });
268
-
269
- var MinLabelContainer = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n margin-right: ", ";\n"])), function (props) {
270
- return props.theme.fontFamily;
271
- }, function (props) {
272
- return props.theme.fontSize;
273
- }, function (props) {
274
- return props.theme.fontStyle;
275
- }, function (props) {
276
- return props.theme.fontWeight;
277
- }, function (props) {
278
- return props.disabled ? props.theme.disabledFontColor : props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
279
- }, function (props) {
280
- return props.theme.fontLetterSpacing;
281
- }, function (props) {
282
- return props.theme.floorLabelMarginRight;
283
- });
284
-
285
- var MaxLabelContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n margin-left: ", ";\n"])), function (props) {
286
- return props.theme.fontFamily;
287
- }, function (props) {
288
- return props.theme.fontSize;
289
- }, function (props) {
290
- return props.theme.fontStyle;
291
- }, function (props) {
292
- return props.theme.fontWeight;
293
- }, function (props) {
294
- return props.disabled ? props.theme.disabledFontColor : props.backgroundType === "dark" ? props.theme.fontColorOnDark : props.theme.fontColor;
295
- }, function (props) {
296
- return props.theme.fontLetterSpacing;
297
- }, function (props) {
298
- return props.step === 1 ? props.theme.ceilLabelMarginLeft : "1.25rem";
299
- });
300
-
301
- var StyledTextInput = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n label + .MuiInput-formControl {\n margin-top: 2px;\n }\n max-width: 70px;\n"])), function (props) {
302
- return props.theme.inputMarginLeft;
303
- });
304
-
305
- var _default = DxcSlider;
306
- exports["default"] = _default;