@dxc-technology/halstack-react 0.0.0-d238e47 → 0.0.0-d30020b
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/BackgroundColorContext.d.ts +10 -0
- package/BackgroundColorContext.js +1 -4
- package/ThemeContext.d.ts +15 -0
- package/ThemeContext.js +5 -8
- package/V3Select/V3Select.js +2 -2
- package/V3Textarea/V3Textarea.js +2 -2
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +11 -22
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +4 -8
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +4 -8
- package/alert/Alert.js +2 -2
- package/badge/Badge.js +1 -1
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +84 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +13 -0
- package/bleed/types.js +5 -0
- package/box/Box.js +2 -2
- package/button/Button.d.ts +1 -1
- package/button/Button.js +9 -17
- package/button/Button.stories.tsx +6 -8
- package/button/types.d.ts +3 -7
- package/card/Card.js +1 -1
- package/card/Card.stories.tsx +1 -1
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/types.d.ts +1 -1
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +16 -76
- package/chip/Chip.stories.tsx +6 -8
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/variables.js +57 -23
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +10 -13
- package/dialog/Dialog.js +4 -3
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +13 -35
- package/dropdown/Dropdown.stories.tsx +249 -0
- package/dropdown/types.d.ts +6 -15
- package/file-input/FileInput.d.ts +1 -1
- package/file-input/FileInput.js +160 -81
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.js +8 -6
- package/file-input/types.d.ts +32 -7
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +28 -36
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +1 -22
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +3 -3
- package/footer/types.d.ts +21 -17
- package/header/Header.js +2 -2
- package/header/Icons.d.ts +2 -0
- package/heading/Heading.js +1 -1
- package/heading/Heading.stories.tsx +3 -2
- package/input-text/InputText.js +2 -2
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +84 -0
- package/inset/Inset.stories.tsx +229 -0
- package/inset/types.d.ts +13 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +10 -0
- package/layout/ApplicationLayout.js +17 -21
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.js +8 -16
- package/link/Link.stories.tsx +6 -1
- package/link/types.d.ts +5 -9
- package/list/List.d.ts +4 -0
- package/list/List.js +47 -0
- package/list/List.stories.tsx +95 -0
- package/list/types.d.ts +7 -0
- package/list/types.js +5 -0
- package/main.d.ts +8 -3
- package/main.js +42 -2
- package/number-input/NumberInput.js +3 -6
- package/package.json +4 -2
- package/paginator/Paginator.js +2 -8
- package/password-input/PasswordInput.js +19 -18
- package/password-input/PasswordInput.stories.tsx +3 -3
- package/password-input/types.d.ts +13 -11
- package/progress-bar/ProgressBar.js +4 -4
- package/radio/Radio.js +2 -2
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +140 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +273 -0
- package/radio-group/RadioGroup.stories.tsx +79 -0
- package/radio-group/RadioGroup.test.js +248 -0
- package/radio-group/types.d.ts +36 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/ResultsetTable.d.ts +1 -1
- package/resultsetTable/ResultsetTable.js +9 -4
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/types.d.ts +6 -2
- package/row/Row.d.ts +3 -0
- package/row/Row.js +127 -0
- package/row/Row.stories.tsx +237 -0
- package/row/types.d.ts +10 -0
- package/row/types.js +5 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +20 -22
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.js +2 -2
- package/sidenav/Sidenav.stories.tsx +18 -1
- package/slider/Slider.js +2 -2
- package/spinner/Spinner.js +2 -2
- package/spinner/Spinner.stories.jsx +1 -0
- package/stack/Stack.d.ts +3 -0
- package/stack/Stack.js +97 -0
- package/stack/Stack.stories.tsx +164 -0
- package/stack/types.d.ts +9 -0
- package/stack/types.js +5 -0
- package/switch/Switch.js +2 -2
- package/switch/Switch.stories.tsx +1 -1
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.js +8 -8
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/types.d.ts +23 -15
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +7 -12
- package/tag/Tag.stories.tsx +15 -22
- package/tag/types.d.ts +23 -14
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.js +50 -41
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +14 -12
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +27 -60
- package/textarea/Textarea.stories.jsx +4 -3
- package/textarea/types.d.ts +130 -0
- package/textarea/types.js +5 -0
- package/toggle/Toggle.js +1 -1
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +16 -45
- package/toggle-group/ToggleGroup.stories.tsx +23 -28
- package/toggle-group/types.d.ts +97 -0
- package/toggle-group/types.js +5 -0
- package/upload/buttons-upload/ButtonsUpload.js +2 -2
- package/upload/dragAndDropArea/DragAndDropArea.js +2 -2
- package/upload/file-upload/FileToUpload.js +1 -1
- package/upload/files-upload/FilesToUpload.js +1 -1
- package/upload/transaction/Transaction.js +2 -2
- package/upload/transactions/Transactions.js +1 -1
- package/useTheme.d.ts +2 -0
- package/useTheme.js +1 -1
- package/wizard/Wizard.js +59 -9
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +0 -0
- package/wizard/types.d.ts +3 -7
- package/chip/index.d.ts +0 -22
- package/select/index.d.ts +0 -131
- package/textarea/index.d.ts +0 -117
- package/toggle-group/index.d.ts +0 -21
- package/wizard/Icons.js +0 -65
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import DxcTabs from "./Tabs";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Tabs",
|
|
9
|
+
component: DxcTabs,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const iconSVG = (
|
|
13
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
14
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
15
|
+
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const tabs: any = [
|
|
20
|
+
{
|
|
21
|
+
label: "Tab 1",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: "Tab 2",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Tab 3",
|
|
28
|
+
isDisabled: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "Tab 4",
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
|
|
35
|
+
const tabsNotification = tabs.map((tab, index) => ({
|
|
36
|
+
...tab,
|
|
37
|
+
notificationNumber: (index === 0 && true) || (index === 1 && 5) || (index === 2 && 200),
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
const tabsIcon = tabs.map((tab) => ({ ...tab, icon: iconSVG }));
|
|
41
|
+
|
|
42
|
+
const tabsNotificationIcon = tabsNotification.map((tab) => ({ ...tab, icon: iconSVG }));
|
|
43
|
+
|
|
44
|
+
export const Chromatic = () => (
|
|
45
|
+
<>
|
|
46
|
+
<ExampleContainer>
|
|
47
|
+
<Title title="Only label" theme="light" level={4} />
|
|
48
|
+
<DxcTabs tabs={tabs} />
|
|
49
|
+
</ExampleContainer>
|
|
50
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
51
|
+
<Title title="Hovered tabs" theme="light" level={4} />
|
|
52
|
+
<DxcTabs tabs={tabs} />
|
|
53
|
+
</ExampleContainer>
|
|
54
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
55
|
+
<Title title="Focused tabs" theme="light" level={4} />
|
|
56
|
+
<DxcTabs tabs={tabs} />
|
|
57
|
+
</ExampleContainer>
|
|
58
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
59
|
+
<Title title="Actived tabs" theme="light" level={4} />
|
|
60
|
+
<DxcTabs tabs={tabs} />
|
|
61
|
+
</ExampleContainer>
|
|
62
|
+
<ExampleContainer>
|
|
63
|
+
<Title title="With notification number" theme="light" level={4} />
|
|
64
|
+
<DxcTabs tabs={tabsNotification} />
|
|
65
|
+
</ExampleContainer>
|
|
66
|
+
<ExampleContainer>
|
|
67
|
+
<Title title="With icon position top" theme="light" level={4} />
|
|
68
|
+
<DxcTabs tabs={tabsIcon} />
|
|
69
|
+
</ExampleContainer>
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<Title title="With icon position left" theme="light" level={4} />
|
|
72
|
+
<DxcTabs tabs={tabsIcon} iconPosition="left" />
|
|
73
|
+
</ExampleContainer>
|
|
74
|
+
<ExampleContainer>
|
|
75
|
+
<Title title="With icon and notification number" theme="light" level={4} />
|
|
76
|
+
<DxcTabs tabs={tabsNotificationIcon} />
|
|
77
|
+
</ExampleContainer>
|
|
78
|
+
<ExampleContainer>
|
|
79
|
+
<Title title="With icon on the left and notification number" theme="light" level={4} />
|
|
80
|
+
<DxcTabs tabs={tabsNotificationIcon} iconPosition="left" />
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<ExampleContainer>
|
|
83
|
+
<Title title="Scrollable" theme="light" level={4} />
|
|
84
|
+
<div style={{ width: "400px" }}>
|
|
85
|
+
<DxcTabs tabs={tabsNotificationIcon} iconPosition="left" activeTabIndex={1} />
|
|
86
|
+
</div>
|
|
87
|
+
</ExampleContainer>
|
|
88
|
+
|
|
89
|
+
<Title title="Margins" theme="light" level={2} />
|
|
90
|
+
<ExampleContainer>
|
|
91
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
92
|
+
<DxcTabs tabs={tabs} margin="xxsmall" />
|
|
93
|
+
</ExampleContainer>
|
|
94
|
+
<ExampleContainer>
|
|
95
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
96
|
+
<DxcTabs tabs={tabs} margin="xsmall" />
|
|
97
|
+
</ExampleContainer>
|
|
98
|
+
<ExampleContainer>
|
|
99
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
100
|
+
<DxcTabs tabs={tabs} margin="small" />
|
|
101
|
+
</ExampleContainer>
|
|
102
|
+
<ExampleContainer>
|
|
103
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
104
|
+
<DxcTabs tabs={tabs} margin="medium" />
|
|
105
|
+
</ExampleContainer>
|
|
106
|
+
<ExampleContainer>
|
|
107
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
108
|
+
<DxcTabs tabs={tabs} margin="large" />
|
|
109
|
+
</ExampleContainer>
|
|
110
|
+
<ExampleContainer>
|
|
111
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
112
|
+
<DxcTabs tabs={tabs} margin="xlarge" />
|
|
113
|
+
</ExampleContainer>
|
|
114
|
+
<ExampleContainer>
|
|
115
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
116
|
+
<DxcTabs tabs={tabs} margin="xxlarge" />
|
|
117
|
+
<hr />
|
|
118
|
+
</ExampleContainer>
|
|
119
|
+
</>
|
|
120
|
+
);
|
package/tabs/types.d.ts
CHANGED
|
@@ -6,20 +6,8 @@ declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG = React.SVGProps<SVGSVGElement
|
|
10
|
-
declare type
|
|
11
|
-
/**
|
|
12
|
-
* Tab label.
|
|
13
|
-
*/
|
|
14
|
-
label?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Element used as the icon that will be displayed in the tab.
|
|
17
|
-
*/
|
|
18
|
-
icon?: SVG;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated URL of the icon to be displayed in the tab.
|
|
21
|
-
*/
|
|
22
|
-
iconSrc?: string;
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
10
|
+
declare type TabCommonProps = {
|
|
23
11
|
/**
|
|
24
12
|
* Whether the tab is disabled or not.
|
|
25
13
|
*/
|
|
@@ -33,11 +21,31 @@ declare type Tab = {
|
|
|
33
21
|
*/
|
|
34
22
|
notificationNumber?: boolean | number;
|
|
35
23
|
};
|
|
24
|
+
declare type TabLabelProps = TabCommonProps & {
|
|
25
|
+
/**
|
|
26
|
+
* Tab label.
|
|
27
|
+
*/
|
|
28
|
+
label: string;
|
|
29
|
+
/**
|
|
30
|
+
* Element or path used as the icon that will be displayed in the tab.
|
|
31
|
+
*/
|
|
32
|
+
icon?: string | SVG;
|
|
33
|
+
};
|
|
34
|
+
declare type TabIconProps = TabCommonProps & {
|
|
35
|
+
/**
|
|
36
|
+
* Tab label.
|
|
37
|
+
*/
|
|
38
|
+
label?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Element or path used as the icon that will be displayed in the tab.
|
|
41
|
+
*/
|
|
42
|
+
icon: string | SVG;
|
|
43
|
+
};
|
|
36
44
|
declare type Props = {
|
|
37
45
|
/**
|
|
38
46
|
* An array of objects representing the tabs.
|
|
39
47
|
*/
|
|
40
|
-
tabs:
|
|
48
|
+
tabs: (TabLabelProps | TabIconProps)[];
|
|
41
49
|
/**
|
|
42
50
|
* Whether the icon should appear above or to the left of the label.
|
|
43
51
|
*/
|
package/tag/Tag.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import TagPropsType from "./types";
|
|
3
|
-
declare const DxcTag: ({ icon,
|
|
3
|
+
declare const DxcTag: ({ icon, label, linkHref, onClick, iconBgColor, labelPosition, newWindow, margin, size, tabIndex, }: TagPropsType) => JSX.Element;
|
|
4
4
|
export default DxcTag;
|
package/tag/Tag.js
CHANGED
|
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
12
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
15
13
|
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
@@ -21,7 +21,7 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
21
21
|
|
|
22
22
|
var _variables = require("../common/variables.js");
|
|
23
23
|
|
|
24
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
26
|
var _utils = require("../common/utils.js");
|
|
27
27
|
|
|
@@ -35,7 +35,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
|
|
36
36
|
var DxcTag = function DxcTag(_ref) {
|
|
37
37
|
var icon = _ref.icon,
|
|
38
|
-
iconSrc = _ref.iconSrc,
|
|
39
38
|
_ref$label = _ref.label,
|
|
40
39
|
label = _ref$label === void 0 ? "" : _ref$label,
|
|
41
40
|
linkHref = _ref.linkHref,
|
|
@@ -69,9 +68,9 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
69
68
|
labelPosition: labelPosition
|
|
70
69
|
}, /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
71
70
|
iconBgColor: iconBgColor
|
|
72
|
-
}, icon
|
|
73
|
-
src:
|
|
74
|
-
})), size !== "small" && /*#__PURE__*/_react["default"].createElement(TagLabel, null, label)));
|
|
71
|
+
}, icon && /*#__PURE__*/_react["default"].createElement(TagIconContainer, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(TagIcon, {
|
|
72
|
+
src: icon
|
|
73
|
+
}) : icon)), size !== "small" && /*#__PURE__*/_react["default"].createElement(TagLabel, null, label)));
|
|
75
74
|
|
|
76
75
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
77
76
|
theme: colorsTheme.tag
|
|
@@ -146,11 +145,7 @@ var StyledButton = _styledComponents["default"].button(_templateObject4 || (_tem
|
|
|
146
145
|
return props.theme.focusColor;
|
|
147
146
|
});
|
|
148
147
|
|
|
149
|
-
var TagIcon = _styledComponents["default"].img(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["
|
|
150
|
-
return props.theme.iconWidth;
|
|
151
|
-
}, function (props) {
|
|
152
|
-
return props.theme.iconHeight;
|
|
153
|
-
});
|
|
148
|
+
var TagIcon = _styledComponents["default"].img(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])([""])));
|
|
154
149
|
|
|
155
150
|
var TagIconContainer = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n justify-content: center;\n align-items: center;\n overflow: hidden;\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
|
|
156
151
|
return props.theme.iconWidth;
|
package/tag/Tag.stories.tsx
CHANGED
|
@@ -9,29 +9,22 @@ export default {
|
|
|
9
9
|
component: DxcTag,
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const icon = (
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</svg>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
12
|
+
const icon = (
|
|
13
|
+
<svg viewBox="0 0 24 24" fill="currentColor">
|
|
14
|
+
<path d="M0 0h24v24H0z" fill="none" />
|
|
15
|
+
<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z" />
|
|
16
|
+
</svg>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const largeIcon = (
|
|
20
|
+
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
21
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
22
|
+
<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z" />
|
|
23
|
+
</svg>
|
|
24
|
+
);
|
|
28
25
|
|
|
29
26
|
export const Chromatic = () => (
|
|
30
27
|
<>
|
|
31
|
-
<ExampleContainer>
|
|
32
|
-
<Title title="Without label" theme="light" level={4} />
|
|
33
|
-
<DxcTag />
|
|
34
|
-
</ExampleContainer>
|
|
35
28
|
<ExampleContainer>
|
|
36
29
|
<Title title="With icon" theme="light" level={4} />
|
|
37
30
|
<DxcTag icon={icon} />
|
|
@@ -46,7 +39,7 @@ export const Chromatic = () => (
|
|
|
46
39
|
</ExampleContainer>
|
|
47
40
|
<ExampleContainer>
|
|
48
41
|
<Title title="With label and icon" theme="light" level={4} />
|
|
49
|
-
<DxcTag label="Tag" icon=
|
|
42
|
+
<DxcTag label="Tag" icon="https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png" />
|
|
50
43
|
</ExampleContainer>
|
|
51
44
|
<ExampleContainer>
|
|
52
45
|
<Title title="With right icon" theme="light" level={4} />
|
|
@@ -132,7 +125,7 @@ export const Chromatic = () => (
|
|
|
132
125
|
);
|
|
133
126
|
|
|
134
127
|
const LinkTag = () => (
|
|
135
|
-
<ExampleContainer>
|
|
128
|
+
<ExampleContainer expanded>
|
|
136
129
|
<Title title="Hover link tag" theme="light" level={4} />
|
|
137
130
|
<DxcTag label="Tag" icon={icon} linkHref="https://www.dxc.com" />
|
|
138
131
|
</ExampleContainer>
|
package/tag/types.d.ts
CHANGED
|
@@ -6,20 +6,8 @@ declare type Margin = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG = React.SVGProps<SVGSVGElement
|
|
10
|
-
declare type
|
|
11
|
-
/**
|
|
12
|
-
* Element used as the icon that will be placed next to the label.
|
|
13
|
-
*/
|
|
14
|
-
icon?: SVG;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated URL of the icon.
|
|
17
|
-
*/
|
|
18
|
-
iconSrc?: string;
|
|
19
|
-
/**
|
|
20
|
-
* Text to be placed next inside the tag.
|
|
21
|
-
*/
|
|
22
|
-
label?: string;
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
10
|
+
declare type TagCommonProps = {
|
|
23
11
|
/**
|
|
24
12
|
* If defined, the tag will be displayed as an anchor, using this prop as "href".
|
|
25
13
|
* Component will show some visual feedback on hover.
|
|
@@ -57,4 +45,25 @@ declare type Props = {
|
|
|
57
45
|
*/
|
|
58
46
|
tabIndex?: number;
|
|
59
47
|
};
|
|
48
|
+
declare type TagLabelProps = TagCommonProps & {
|
|
49
|
+
/**
|
|
50
|
+
* Element or path used as the icon that will be placed next to the label.
|
|
51
|
+
*/
|
|
52
|
+
icon?: string | SVG;
|
|
53
|
+
/**
|
|
54
|
+
* Text to be placed next inside the tag.
|
|
55
|
+
*/
|
|
56
|
+
label: string;
|
|
57
|
+
};
|
|
58
|
+
declare type TagIconProps = TagCommonProps & {
|
|
59
|
+
/**
|
|
60
|
+
* Element or path used as the icon that will be placed next to the label.
|
|
61
|
+
*/
|
|
62
|
+
icon: string | SVG;
|
|
63
|
+
/**
|
|
64
|
+
* Text to be placed next inside the tag.
|
|
65
|
+
*/
|
|
66
|
+
label?: string;
|
|
67
|
+
};
|
|
68
|
+
declare type Props = TagLabelProps | TagIconProps;
|
|
60
69
|
export default Props;
|
package/text/Text.d.ts
ADDED
package/text/Text.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
function Text(_ref) {
|
|
19
|
+
var _ref$as = _ref.as,
|
|
20
|
+
as = _ref$as === void 0 ? "span" : _ref$as,
|
|
21
|
+
children = _ref.children;
|
|
22
|
+
return /*#__PURE__*/_react["default"].createElement(StyledText, {
|
|
23
|
+
as: as
|
|
24
|
+
}, children);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var StyledText = _styledComponents["default"].span(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n margin: 0px;\n font-family: Open Sans, sans-serif;\n line-height: 1.5em;\n"])));
|
|
28
|
+
|
|
29
|
+
var _default = Text;
|
|
30
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import DxcText from "./Text";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Text",
|
|
7
|
+
component: DxcText,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Chromatic = () => (
|
|
11
|
+
<>
|
|
12
|
+
<Title title="Two texts as span" theme="light" level={4} />
|
|
13
|
+
<DxcText>Text 1.</DxcText>
|
|
14
|
+
<DxcText>Text 2.</DxcText>
|
|
15
|
+
<Title title="Two texts as p" theme="light" level={4} />
|
|
16
|
+
<DxcText as="p">Text 1.</DxcText>
|
|
17
|
+
<DxcText as="p">Text 2.</DxcText>
|
|
18
|
+
</>
|
|
19
|
+
);
|