@dxc-technology/halstack-react 0.0.0-5bbb9f7 → 0.0.0-5beed19
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.js +1 -4
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +62 -63
- package/bleed/types.d.ts +1 -1
- package/box/Box.js +22 -32
- package/card/Card.js +34 -36
- package/common/variables.js +3 -18
- package/footer/Icons.js +1 -1
- package/inline/Inline.d.ts +4 -0
- package/inline/Inline.js +54 -0
- package/inline/Inline.stories.tsx +240 -0
- package/inline/types.d.ts +32 -0
- package/{radio → inline}/types.js +0 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +33 -33
- package/inset/types.d.ts +1 -1
- package/layout/ApplicationLayout.d.ts +4 -3
- package/layout/ApplicationLayout.js +83 -102
- package/layout/ApplicationLayout.stories.tsx +14 -59
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +5 -10
- package/link/Link.js +15 -10
- package/list/List.js +1 -1
- package/list/List.stories.tsx +16 -22
- package/list/types.d.ts +1 -1
- package/main.d.ts +2 -2
- package/main.js +8 -8
- package/package.json +2 -1
- package/paginator/Paginator.test.js +42 -0
- package/quick-nav/QuickNav.js +4 -4
- package/resultsetTable/ResultsetTable.test.js +42 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +30 -7
- package/select/Select.js +46 -31
- package/select/Select.stories.tsx +130 -98
- package/select/Select.test.js +42 -0
- package/select/types.d.ts +3 -4
- package/sidenav/Sidenav.d.ts +1 -1
- package/sidenav/Sidenav.js +20 -9
- package/stack/Stack.d.ts +2 -1
- package/stack/Stack.js +23 -70
- package/stack/Stack.stories.tsx +120 -81
- package/stack/types.d.ts +11 -7
- package/tabs-nav/NavTabs.d.ts +2 -1
- package/tabs-nav/NavTabs.js +35 -16
- package/tabs-nav/Tab.js +26 -11
- package/tabs-nav/types.d.ts +6 -4
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -173
- package/radio/Radio.stories.tsx +0 -192
- package/radio/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
package/layout/Icons.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.twitterLogo = exports.linkedinLogo = exports.facebookLogo = void 0;
|
|
8
|
+
exports.twitterLogo = exports.linkedinLogo = exports.hamburgerIcon = exports.facebookLogo = void 0;
|
|
9
9
|
|
|
10
10
|
var _react = _interopRequireDefault(require("react"));
|
|
11
11
|
|
|
@@ -52,4 +52,15 @@ var linkedinLogo = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
52
52
|
d: "M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123 C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126 h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225 C438.532,59.576,430.49,40.204,414.41,24.123z M133.618,367.157H67.666V169.016h65.952V367.157z M127.626,132.332 c-6.851,6.567-15.893,9.851-27.124,9.851h-0.288c-10.848,0-19.648-3.284-26.407-9.851c-6.76-6.567-10.138-14.703-10.138-24.41 c0-9.897,3.476-18.083,10.421-24.556c6.95-6.471,15.942-9.708,26.98-9.708c11.039,0,19.89,3.237,26.553,9.708 c6.661,6.473,10.088,14.659,10.277,24.556C137.899,117.625,134.477,125.761,127.626,132.332z M370.873,367.157h-65.952v-105.92 c0-29.879-11.036-44.823-33.116-44.823c-8.374,0-15.42,2.331-21.128,6.995c-5.715,4.661-9.996,10.324-12.847,16.991 c-1.335,3.422-1.999,8.75-1.999,15.981v110.775h-65.952c0.571-119.529,0.571-185.579,0-198.142h65.952v27.974 c13.867-21.681,33.558-32.544,59.101-32.544c22.84,0,41.21,7.52,55.104,22.554c13.895,15.037,20.841,37.214,20.841,66.519v113.64 H370.873z"
|
|
53
53
|
})));
|
|
54
54
|
|
|
55
|
-
exports.linkedinLogo = linkedinLogo;
|
|
55
|
+
exports.linkedinLogo = linkedinLogo;
|
|
56
|
+
|
|
57
|
+
var hamburgerIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
58
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59
|
+
height: "24",
|
|
60
|
+
width: "24",
|
|
61
|
+
viewBox: "0 0 24 24"
|
|
62
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
63
|
+
d: "M3 18V16H21V18ZM3 13V11H21V13ZM3 8V6H21V8Z"
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
exports.hamburgerIcon = hamburgerIcon;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type SidenavContextType = (isSidenavVisible: boolean) => void;
|
|
3
|
+
export declare const SidenavContextProvider: import("react").Provider<SidenavContextType>;
|
|
4
|
+
export declare const useResponsiveSidenavVisibility: () => SidenavContextType;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useResponsiveSidenavVisibility = exports.SidenavContextProvider = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
var SidenavContext = /*#__PURE__*/(0, _react.createContext)(null);
|
|
11
|
+
var SidenavContextProvider = SidenavContext.Provider;
|
|
12
|
+
exports.SidenavContextProvider = SidenavContextProvider;
|
|
13
|
+
|
|
14
|
+
var useResponsiveSidenavVisibility = function useResponsiveSidenavVisibility() {
|
|
15
|
+
var changeResponsiveSidenavVisibility = (0, _react.useContext)(SidenavContext);
|
|
16
|
+
return changeResponsiveSidenavVisibility;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.useResponsiveSidenavVisibility = useResponsiveSidenavVisibility;
|
package/layout/types.d.ts
CHANGED
|
@@ -37,18 +37,13 @@ export declare type AppLayoutSidenavPropsType = {
|
|
|
37
37
|
* The area inside the sidenav. This area can be used to render custom content.
|
|
38
38
|
*/
|
|
39
39
|
children: React.ReactNode;
|
|
40
|
-
/**
|
|
41
|
-
* If false, the arrow button is hidden.
|
|
42
|
-
* In lower resolutions the arrow will be always displayed.
|
|
43
|
-
*/
|
|
44
|
-
displayArrow?: boolean;
|
|
45
|
-
/**
|
|
46
|
-
* Default action over the content of the page, overlay the content or push to the right ('push' | 'overlay').
|
|
47
|
-
* In lower resolutions the mode will always be overlay.
|
|
48
|
-
*/
|
|
49
|
-
mode: "push" | "overlay";
|
|
50
40
|
};
|
|
51
41
|
declare type AppLayoutPropsType = {
|
|
42
|
+
/**
|
|
43
|
+
* Text to be placed next to the hamburger button that toggles the
|
|
44
|
+
* visibility of the sidenav.
|
|
45
|
+
*/
|
|
46
|
+
visibilityToggleLabel?: string;
|
|
52
47
|
/**
|
|
53
48
|
* The area inside the sidenav. This area can be used to render custom content.
|
|
54
49
|
*/
|
package/link/Link.js
CHANGED
|
@@ -13,6 +13,10 @@ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
|
13
13
|
|
|
14
14
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
15
|
|
|
16
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
17
|
+
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
|
+
|
|
16
20
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
21
|
|
|
18
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
@@ -21,7 +25,9 @@ var _variables = require("../common/variables.js");
|
|
|
21
25
|
|
|
22
26
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
23
27
|
|
|
24
|
-
var _templateObject, _templateObject2, _templateObject3
|
|
28
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
29
|
+
|
|
30
|
+
var _excluded = ["inheritColor", "disabled", "icon", "iconPosition", "href", "newWindow", "onClick", "margin", "tabIndex", "children"];
|
|
25
31
|
|
|
26
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); }
|
|
27
33
|
|
|
@@ -31,7 +37,7 @@ var LinkContent = /*#__PURE__*/_react["default"].memo(function (_ref) {
|
|
|
31
37
|
var iconPosition = _ref.iconPosition,
|
|
32
38
|
icon = _ref.icon,
|
|
33
39
|
children = _ref.children;
|
|
34
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
40
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, iconPosition === "after" && children, icon && /*#__PURE__*/_react["default"].createElement(LinkIconContainer, {
|
|
35
41
|
iconPosition: iconPosition
|
|
36
42
|
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(LinkIcon, {
|
|
37
43
|
src: icon
|
|
@@ -54,11 +60,12 @@ var DxcLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
54
60
|
margin = _ref2.margin,
|
|
55
61
|
_ref2$tabIndex = _ref2.tabIndex,
|
|
56
62
|
tabIndex = _ref2$tabIndex === void 0 ? 0 : _ref2$tabIndex,
|
|
57
|
-
children = _ref2.children
|
|
63
|
+
children = _ref2.children,
|
|
64
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref2, _excluded);
|
|
58
65
|
var colorsTheme = (0, _useTheme["default"])();
|
|
59
66
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
60
67
|
theme: colorsTheme.link
|
|
61
|
-
}, /*#__PURE__*/_react["default"].createElement(StyledLink, {
|
|
68
|
+
}, /*#__PURE__*/_react["default"].createElement(StyledLink, (0, _extends2["default"])({
|
|
62
69
|
as: href ? "a" : "button",
|
|
63
70
|
tabIndex: tabIndex,
|
|
64
71
|
onClick: !disabled && onClick,
|
|
@@ -68,14 +75,14 @@ var DxcLink = /*#__PURE__*/(0, _react.forwardRef)(function (_ref2, ref) {
|
|
|
68
75
|
inheritColor: inheritColor,
|
|
69
76
|
margin: margin,
|
|
70
77
|
ref: ref
|
|
71
|
-
}, /*#__PURE__*/_react["default"].createElement(LinkContent, {
|
|
78
|
+
}, otherProps), /*#__PURE__*/_react["default"].createElement(LinkContent, {
|
|
72
79
|
iconPosition: iconPosition,
|
|
73
80
|
icon: icon,
|
|
74
81
|
children: children
|
|
75
82
|
})));
|
|
76
83
|
});
|
|
77
84
|
|
|
78
|
-
var StyledLink = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-size: ", ";\n font-weight: ", ";\n font-style: ", ";\n font-family: ", ";\n text-decoration-color: transparent;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
|
|
85
|
+
var StyledLink = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n\n background: none;\n border: none;\n padding: 0;\n cursor: pointer;\n font-size: ", ";\n font-weight: ", ";\n font-style: ", ";\n font-family: ", ";\n text-decoration-color: transparent;\n width: fit-content;\n\n ", "\n ", "\n color: ", ";\n ", "\n\n &:visited {\n color: ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n ", "\n }\n &:focus {\n border-radius: 2px;\n outline: 2px solid ", ";\n ", "\n }\n &:active {\n ", "\n }\n"])), function (props) {
|
|
79
86
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
80
87
|
}, function (props) {
|
|
81
88
|
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
@@ -115,11 +122,9 @@ var StyledLink = _styledComponents["default"].div(_templateObject || (_templateO
|
|
|
115
122
|
return "color: ".concat(props.theme.activeFontColor, " !important;\n border-bottom-color: ").concat(props.theme.activeUnderlineColor, " !important;");
|
|
116
123
|
});
|
|
117
124
|
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
var LinkIcon = _styledComponents["default"].img(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
125
|
+
var LinkIcon = _styledComponents["default"].img(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
121
126
|
|
|
122
|
-
var LinkIconContainer = _styledComponents["default"].div(
|
|
127
|
+
var LinkIconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: ", ";\n height: ", ";\n ", ";\n overflow: hidden;\n align-self: center;\n\n img,\n svg {\n height: 100%;\n width: 100%;\n }\n"])), function (props) {
|
|
123
128
|
return props.theme.iconSize;
|
|
124
129
|
}, function (props) {
|
|
125
130
|
return props.theme.iconSize;
|
package/list/List.js
CHANGED
|
@@ -24,7 +24,7 @@ function List(_ref) {
|
|
|
24
24
|
_ref$type = _ref.type,
|
|
25
25
|
type = _ref$type === void 0 ? "disc" : _ref$type,
|
|
26
26
|
_ref$gutter = _ref.gutter,
|
|
27
|
-
gutter = _ref$gutter === void 0 ? "
|
|
27
|
+
gutter = _ref$gutter === void 0 ? "0.25rem" : _ref$gutter;
|
|
28
28
|
return /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
|
|
29
29
|
as: type === "number" ? "ol" : "ul",
|
|
30
30
|
gutter: gutter
|
package/list/List.stories.tsx
CHANGED
|
@@ -41,52 +41,46 @@ export const Chromatic = () => (
|
|
|
41
41
|
<DxcText>Text 2.</DxcText>
|
|
42
42
|
</DxcList>
|
|
43
43
|
</Container>
|
|
44
|
-
<Title title="gutter =
|
|
45
|
-
<DxcList gutter="
|
|
44
|
+
<Title title="gutter = 0rem" theme="light" level={4} />
|
|
45
|
+
<DxcList gutter="0rem">
|
|
46
46
|
<DxcText>Text 1.</DxcText>
|
|
47
47
|
<DxcText>Text 2.</DxcText>
|
|
48
48
|
</DxcList>
|
|
49
|
-
<Title title="gutter =
|
|
50
|
-
<DxcList gutter="
|
|
49
|
+
<Title title="gutter = 0.125rem" theme="light" level={4} />
|
|
50
|
+
<DxcList gutter="0.125rem">
|
|
51
51
|
<DxcText>Text 1.</DxcText>
|
|
52
52
|
<DxcText>Text 2.</DxcText>
|
|
53
53
|
</DxcList>
|
|
54
|
-
<Title title="gutter =
|
|
55
|
-
<DxcList gutter="
|
|
54
|
+
<Title title="gutter = 0.25rem" theme="light" level={4} />
|
|
55
|
+
<DxcList gutter="0.25rem">
|
|
56
56
|
<DxcText>Text 1.</DxcText>
|
|
57
57
|
<DxcText>Text 2.</DxcText>
|
|
58
58
|
</DxcList>
|
|
59
|
-
<Title title="gutter =
|
|
60
|
-
<DxcList gutter="
|
|
59
|
+
<Title title="gutter = 0.5rem" theme="light" level={4} />
|
|
60
|
+
<DxcList gutter="0.5rem">
|
|
61
61
|
<DxcText>Text 1.</DxcText>
|
|
62
62
|
<DxcText>Text 2.</DxcText>
|
|
63
63
|
</DxcList>
|
|
64
|
-
<Title title="gutter =
|
|
65
|
-
<DxcList gutter="
|
|
64
|
+
<Title title="gutter = 0.75rem" theme="light" level={4} />
|
|
65
|
+
<DxcList gutter="0.75rem">
|
|
66
66
|
<DxcText>Text 1.</DxcText>
|
|
67
67
|
<DxcText>Text 2.</DxcText>
|
|
68
68
|
</DxcList>
|
|
69
|
-
<Title title="gutter =
|
|
70
|
-
<DxcList gutter="
|
|
69
|
+
<Title title="gutter = 1rem" theme="light" level={4} />
|
|
70
|
+
<DxcList gutter="1rem">
|
|
71
71
|
<DxcText>Text 1.</DxcText>
|
|
72
72
|
<DxcText>Text 2.</DxcText>
|
|
73
73
|
</DxcList>
|
|
74
|
-
<Title title="gutter =
|
|
75
|
-
<DxcList gutter="
|
|
74
|
+
<Title title="gutter = 1.5rem" theme="light" level={4} />
|
|
75
|
+
<DxcList gutter="1.5rem">
|
|
76
76
|
<DxcText>Text 1.</DxcText>
|
|
77
77
|
<DxcText>Text 2.</DxcText>
|
|
78
78
|
</DxcList>
|
|
79
|
-
<Title title="gutter =
|
|
80
|
-
<DxcList gutter="
|
|
79
|
+
<Title title="gutter = 2rem" theme="light" level={4} />
|
|
80
|
+
<DxcList gutter="2rem">
|
|
81
81
|
<DxcText>Text 1.</DxcText>
|
|
82
82
|
<DxcText>Text 2.</DxcText>
|
|
83
83
|
</DxcList>
|
|
84
|
-
<Title title="gutter = xxxlarge" theme="light" level={4} />
|
|
85
|
-
<DxcList gutter="xxxlarge">
|
|
86
|
-
<DxcText>Text 1.</DxcText>
|
|
87
|
-
<DxcText>Text 2.</DxcText>
|
|
88
|
-
</DxcList>
|
|
89
|
-
|
|
90
84
|
</>
|
|
91
85
|
);
|
|
92
86
|
|
package/list/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
declare type Props = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
|
-
gutter?: "
|
|
4
|
+
gutter?: "0rem" | "0.125rem" | "0.25rem" | "0.5rem" | "0.75rem" | "1rem" | "1.5rem" | "2rem";
|
|
5
5
|
type?: "disc" | "circle" | "square" | "number";
|
|
6
6
|
};
|
|
7
7
|
export default Props;
|
package/main.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import DxcDialog from "./dialog/Dialog";
|
|
|
7
7
|
import DxcDropdown from "./dropdown/Dropdown";
|
|
8
8
|
import DxcFooter from "./footer/Footer";
|
|
9
9
|
import DxcHeader from "./header/Header";
|
|
10
|
-
import DxcRadio from "./radio/Radio";
|
|
11
10
|
import DxcSlider from "./slider/Slider";
|
|
12
11
|
import DxcSwitch from "./switch/Switch";
|
|
13
12
|
import DxcTabs from "./tabs/Tabs";
|
|
@@ -43,6 +42,7 @@ import DxcBleed from "./bleed/Bleed";
|
|
|
43
42
|
import DxcInset from "./inset/Inset";
|
|
44
43
|
import DxcQuickNav from "./quick-nav/QuickNav";
|
|
45
44
|
import DxcNavTabs from "./tabs-nav/NavTabs";
|
|
45
|
+
import DxcInline from "./inline/Inline";
|
|
46
46
|
import HalstackContext, { HalstackProvider, HalstackLanguageContext } from "./HalstackContext";
|
|
47
47
|
import { BackgroundColorProvider } from "./BackgroundColorContext";
|
|
48
|
-
export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider,
|
|
48
|
+
export { DxcAlert, DxcButton, DxcFooter, DxcCheckbox, DxcTextInput, DxcDropdown, DxcSwitch, DxcSlider, DxcHeader, DxcTable, DxcTabs, DxcToggleGroup, DxcDialog, DxcCard, DxcProgressBar, DxcAccordion, DxcSpinner, DxcBox, DxcTag, DxcPaginator, DxcSidenav, DxcWizard, DxcLink, DxcHeading, DxcResultsetTable, DxcChip, DxcApplicationLayout, HalstackContext, HalstackLanguageContext, HalstackProvider, BackgroundColorProvider, DxcAccordionGroup, DxcBadge, DxcPasswordInput, DxcDateInput, DxcNumberInput, DxcTextarea, DxcSelect, DxcFileInput, DxcStack, DxcRow, DxcText, DxcList, DxcRadioGroup, DxcBleed, DxcInset, DxcQuickNav, DxcNavTabs, DxcInline, };
|
package/main.js
CHANGED
|
@@ -121,6 +121,12 @@ Object.defineProperty(exports, "DxcHeading", {
|
|
|
121
121
|
return _Heading["default"];
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
+
Object.defineProperty(exports, "DxcInline", {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function get() {
|
|
127
|
+
return _Inline["default"];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
124
130
|
Object.defineProperty(exports, "DxcInset", {
|
|
125
131
|
enumerable: true,
|
|
126
132
|
get: function get() {
|
|
@@ -175,12 +181,6 @@ Object.defineProperty(exports, "DxcQuickNav", {
|
|
|
175
181
|
return _QuickNav["default"];
|
|
176
182
|
}
|
|
177
183
|
});
|
|
178
|
-
Object.defineProperty(exports, "DxcRadio", {
|
|
179
|
-
enumerable: true,
|
|
180
|
-
get: function get() {
|
|
181
|
-
return _Radio["default"];
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
184
|
Object.defineProperty(exports, "DxcRadioGroup", {
|
|
185
185
|
enumerable: true,
|
|
186
186
|
get: function get() {
|
|
@@ -320,8 +320,6 @@ var _Footer = _interopRequireDefault(require("./footer/Footer"));
|
|
|
320
320
|
|
|
321
321
|
var _Header = _interopRequireDefault(require("./header/Header"));
|
|
322
322
|
|
|
323
|
-
var _Radio = _interopRequireDefault(require("./radio/Radio"));
|
|
324
|
-
|
|
325
323
|
var _Slider = _interopRequireDefault(require("./slider/Slider"));
|
|
326
324
|
|
|
327
325
|
var _Switch = _interopRequireDefault(require("./switch/Switch"));
|
|
@@ -392,6 +390,8 @@ var _QuickNav = _interopRequireDefault(require("./quick-nav/QuickNav"));
|
|
|
392
390
|
|
|
393
391
|
var _NavTabs = _interopRequireDefault(require("./tabs-nav/NavTabs"));
|
|
394
392
|
|
|
393
|
+
var _Inline = _interopRequireDefault(require("./inline/Inline"));
|
|
394
|
+
|
|
395
395
|
var _HalstackContext = _interopRequireWildcard(require("./HalstackContext"));
|
|
396
396
|
|
|
397
397
|
var _BackgroundColorContext = require("./BackgroundColorContext");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxc-technology/halstack-react",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5beed19",
|
|
4
4
|
"description": "DXC Halstack React components library",
|
|
5
5
|
"repository": "dxc-technology/halstack-react",
|
|
6
6
|
"homepage": "http://developer.dxc.com/tools/react",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"@material-ui/lab": "4.0.0-alpha.17",
|
|
25
25
|
"@material-ui/pickers": "3.2.2",
|
|
26
26
|
"@material-ui/styles": "4.0.2",
|
|
27
|
+
"@radix-ui/react-popover": "^0.1.6",
|
|
27
28
|
"@types/styled-components": "^5.1.24",
|
|
28
29
|
"@types/uuid": "^8.3.4",
|
|
29
30
|
"color": "^3.1.3",
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
6
|
+
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
|
|
5
9
|
var _react = _interopRequireDefault(require("react"));
|
|
6
10
|
|
|
7
11
|
var _react2 = require("@testing-library/react");
|
|
@@ -10,6 +14,44 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
|
10
14
|
|
|
11
15
|
var _Paginator = _interopRequireDefault(require("./Paginator"));
|
|
12
16
|
|
|
17
|
+
// Mocking DOMRect for Radix Primitive Popover
|
|
18
|
+
global.globalThis = global;
|
|
19
|
+
|
|
20
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
21
|
+
function ResizeObserver(cb) {
|
|
22
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
23
|
+
this.cb = cb;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
(0, _createClass2["default"])(ResizeObserver, [{
|
|
27
|
+
key: "observe",
|
|
28
|
+
value: function observe() {
|
|
29
|
+
this.cb([{
|
|
30
|
+
borderBoxSize: {
|
|
31
|
+
inlineSize: 0,
|
|
32
|
+
blockSize: 0
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "unobserve",
|
|
38
|
+
value: function unobserve() {}
|
|
39
|
+
}]);
|
|
40
|
+
return ResizeObserver;
|
|
41
|
+
}();
|
|
42
|
+
|
|
43
|
+
global.DOMRect = {
|
|
44
|
+
fromRect: function fromRect() {
|
|
45
|
+
return {
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
right: 0,
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
13
55
|
describe("Paginator component tests", function () {
|
|
14
56
|
test("Paginator renders with default values", function () {
|
|
15
57
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Paginator["default"], null)),
|
package/quick-nav/QuickNav.js
CHANGED
|
@@ -43,24 +43,24 @@ var DxcQuickNav = function DxcQuickNav(_ref) {
|
|
|
43
43
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
44
44
|
theme: colorsTheme.quickNav
|
|
45
45
|
}, /*#__PURE__*/_react["default"].createElement(QuickNavContainer, null, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
|
|
46
|
-
gutter: "
|
|
46
|
+
gutter: "0.5rem"
|
|
47
47
|
}, /*#__PURE__*/_react["default"].createElement(_Heading["default"], {
|
|
48
48
|
level: 4,
|
|
49
49
|
text: title || translatedLabels.quickNav.contentTitle
|
|
50
50
|
}), /*#__PURE__*/_react["default"].createElement(ListColumn, null, /*#__PURE__*/_react["default"].createElement(_Stack["default"], {
|
|
51
|
-
gutter: "
|
|
51
|
+
gutter: "0.5rem"
|
|
52
52
|
}, links.map(function (link) {
|
|
53
53
|
var _link$links;
|
|
54
54
|
|
|
55
55
|
return /*#__PURE__*/_react["default"].createElement(ListRow, null, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
|
|
56
|
-
space: "
|
|
56
|
+
space: "0.25rem"
|
|
57
57
|
}, /*#__PURE__*/_react["default"].createElement(_Text["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
|
|
58
58
|
href: "#".concat((0, _slugify["default"])(link === null || link === void 0 ? void 0 : link.label, {
|
|
59
59
|
lower: true
|
|
60
60
|
}))
|
|
61
61
|
}, link === null || link === void 0 ? void 0 : link.label), (_link$links = link.links) === null || _link$links === void 0 ? void 0 : _link$links.map(function (sublink) {
|
|
62
62
|
return /*#__PURE__*/_react["default"].createElement(ListRow, null, /*#__PURE__*/_react["default"].createElement(_Inset["default"], {
|
|
63
|
-
horizontal: "
|
|
63
|
+
horizontal: "0.5rem"
|
|
64
64
|
}, /*#__PURE__*/_react["default"].createElement(_Text["default"], null, /*#__PURE__*/_react["default"].createElement(Link, {
|
|
65
65
|
href: "#".concat((0, _slugify["default"])(sublink === null || sublink === void 0 ? void 0 : sublink.label, {
|
|
66
66
|
lower: true
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
6
|
+
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
|
|
5
9
|
var _react = _interopRequireDefault(require("react"));
|
|
6
10
|
|
|
7
11
|
var _react2 = require("@testing-library/react");
|
|
@@ -10,6 +14,44 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
|
10
14
|
|
|
11
15
|
var _ResultsetTable = _interopRequireDefault(require("./ResultsetTable"));
|
|
12
16
|
|
|
17
|
+
// Mocking DOMRect for Radix Primitive Popover
|
|
18
|
+
global.globalThis = global;
|
|
19
|
+
|
|
20
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
21
|
+
function ResizeObserver(cb) {
|
|
22
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
23
|
+
this.cb = cb;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
(0, _createClass2["default"])(ResizeObserver, [{
|
|
27
|
+
key: "observe",
|
|
28
|
+
value: function observe() {
|
|
29
|
+
this.cb([{
|
|
30
|
+
borderBoxSize: {
|
|
31
|
+
inlineSize: 0,
|
|
32
|
+
blockSize: 0
|
|
33
|
+
}
|
|
34
|
+
}]);
|
|
35
|
+
}
|
|
36
|
+
}, {
|
|
37
|
+
key: "unobserve",
|
|
38
|
+
value: function unobserve() {}
|
|
39
|
+
}]);
|
|
40
|
+
return ResizeObserver;
|
|
41
|
+
}();
|
|
42
|
+
|
|
43
|
+
global.DOMRect = {
|
|
44
|
+
fromRect: function fromRect() {
|
|
45
|
+
return {
|
|
46
|
+
top: 0,
|
|
47
|
+
left: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
right: 0,
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
13
55
|
var columns = [{
|
|
14
56
|
displayValue: "Id",
|
|
15
57
|
isSortable: false
|
package/select/Listbox.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ListboxProps } from "./types";
|
|
3
|
-
declare const _default: React.MemoExoticComponent<
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ id, currentValue, options, visualFocusIndex, lastOptionIndex, multiple, optional, optionalItem, searchable, handleOptionOnClick, styles, }: ListboxProps) => JSX.Element>;
|
|
4
4
|
export default _default;
|
package/select/Listbox.js
CHANGED
|
@@ -11,7 +11,7 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
-
var _react =
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
|
|
16
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
17
|
|
|
@@ -37,7 +37,7 @@ var groupsHaveOptions = function groupsHaveOptions(options) {
|
|
|
37
37
|
}) : true;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
var Listbox =
|
|
40
|
+
var Listbox = function Listbox(_ref) {
|
|
41
41
|
var id = _ref.id,
|
|
42
42
|
currentValue = _ref.currentValue,
|
|
43
43
|
options = _ref.options,
|
|
@@ -47,9 +47,11 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
47
47
|
optional = _ref.optional,
|
|
48
48
|
optionalItem = _ref.optionalItem,
|
|
49
49
|
searchable = _ref.searchable,
|
|
50
|
-
handleOptionOnClick = _ref.handleOptionOnClick
|
|
50
|
+
handleOptionOnClick = _ref.handleOptionOnClick,
|
|
51
|
+
styles = _ref.styles;
|
|
51
52
|
var colorsTheme = (0, _useTheme["default"])();
|
|
52
53
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
54
|
+
var listboxRef = (0, _react.useRef)(null);
|
|
53
55
|
var globalIndex = optional && !multiple ? 0 : -1; // index for options, starting from 0 to options.length -1
|
|
54
56
|
|
|
55
57
|
var mapOptionFunc = function mapOptionFunc(option, mapIndex) {
|
|
@@ -92,6 +94,26 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
92
94
|
}
|
|
93
95
|
};
|
|
94
96
|
|
|
97
|
+
(0, _react.useLayoutEffect)(function () {
|
|
98
|
+
if (currentValue && !multiple) {
|
|
99
|
+
var _listEl$scrollTo;
|
|
100
|
+
|
|
101
|
+
var listEl = listboxRef === null || listboxRef === void 0 ? void 0 : listboxRef.current;
|
|
102
|
+
var selectedListOptionEl = listEl === null || listEl === void 0 ? void 0 : listEl.querySelector("[aria-selected='true']");
|
|
103
|
+
listEl === null || listEl === void 0 ? void 0 : (_listEl$scrollTo = listEl.scrollTo) === null || _listEl$scrollTo === void 0 ? void 0 : _listEl$scrollTo.call(listEl, {
|
|
104
|
+
top: (selectedListOptionEl === null || selectedListOptionEl === void 0 ? void 0 : selectedListOptionEl.offsetTop) - (listEl === null || listEl === void 0 ? void 0 : listEl.clientHeight) / 2
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}, [currentValue, multiple]);
|
|
108
|
+
(0, _react.useLayoutEffect)(function () {
|
|
109
|
+
var _listboxRef$current, _visualFocusedOptionE;
|
|
110
|
+
|
|
111
|
+
var visualFocusedOptionEl = listboxRef === null || listboxRef === void 0 ? void 0 : (_listboxRef$current = listboxRef.current) === null || _listboxRef$current === void 0 ? void 0 : _listboxRef$current.querySelectorAll("[role='option']")[visualFocusIndex];
|
|
112
|
+
visualFocusedOptionEl === null || visualFocusedOptionEl === void 0 ? void 0 : (_visualFocusedOptionE = visualFocusedOptionEl.scrollIntoView) === null || _visualFocusedOptionE === void 0 ? void 0 : _visualFocusedOptionE.call(visualFocusedOptionEl, {
|
|
113
|
+
block: "nearest",
|
|
114
|
+
inline: "start"
|
|
115
|
+
});
|
|
116
|
+
}, [visualFocusIndex]);
|
|
95
117
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
96
118
|
theme: colorsTheme.select
|
|
97
119
|
}, /*#__PURE__*/_react["default"].createElement(ListboxContainer, {
|
|
@@ -102,10 +124,11 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
102
124
|
onMouseDown: function onMouseDown(event) {
|
|
103
125
|
event.preventDefault();
|
|
104
126
|
},
|
|
105
|
-
ref:
|
|
127
|
+
ref: listboxRef,
|
|
106
128
|
role: "listbox",
|
|
107
129
|
"aria-multiselectable": multiple,
|
|
108
|
-
"aria-orientation": "vertical"
|
|
130
|
+
"aria-orientation": "vertical",
|
|
131
|
+
style: styles
|
|
109
132
|
}, searchable && (options.length === 0 || !groupsHaveOptions(options)) ? /*#__PURE__*/_react["default"].createElement(OptionsSystemMessage, null, /*#__PURE__*/_react["default"].createElement(NoMatchesFoundIcon, null, _Icons["default"].searchOff), translatedLabels.select.noMatchesErrorMessage) : optional && !multiple && /*#__PURE__*/_react["default"].createElement(_Option["default"], {
|
|
110
133
|
key: "option-".concat(optionalItem.value),
|
|
111
134
|
id: "option-".concat(0),
|
|
@@ -117,9 +140,9 @@ var Listbox = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
|
117
140
|
isLastOption: lastOptionIndex === 0,
|
|
118
141
|
isSelected: multiple ? currentValue.includes(optionalItem.value) : currentValue === optionalItem.value
|
|
119
142
|
}), options.map(mapOptionFunc)));
|
|
120
|
-
}
|
|
143
|
+
};
|
|
121
144
|
|
|
122
|
-
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
145
|
+
var ListboxContainer = _styledComponents["default"].ul(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n max-height: 304px;\n overflow-y: auto;\n margin: 0;\n padding: 0.25rem 0;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 0.25rem;\n box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);\n cursor: default;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n"])), function (props) {
|
|
123
146
|
return props.theme.listDialogBackgroundColor;
|
|
124
147
|
}, function (props) {
|
|
125
148
|
return props.theme.listDialogBorderColor;
|