@dxc-technology/halstack-react 0.0.0-ee92231 → 0.0.0-f0d662d
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.js +2 -2
- package/accordion/Accordion.stories.tsx +307 -0
- package/accordion/types.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.stories.tsx +225 -0
- package/accordion-group/types.d.ts +1 -1
- package/alert/Alert.js +2 -2
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +1 -1
- 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.d.ts +1 -1
- package/box/Box.js +4 -7
- package/box/types.d.ts +0 -4
- package/button/Button.d.ts +1 -1
- package/button/Button.js +13 -19
- package/button/Button.stories.tsx +222 -241
- package/button/types.d.ts +5 -9
- package/card/Card.js +5 -6
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +4 -6
- package/checkbox/Checkbox.js +2 -2
- package/checkbox/types.d.ts +2 -2
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +5 -27
- package/chip/Chip.stories.tsx +121 -0
- package/chip/types.d.ts +53 -0
- package/chip/types.js +5 -0
- package/common/variables.js +70 -27
- package/date/Date.js +1 -1
- package/date-input/DateInput.js +10 -13
- package/date-input/DateInput.stories.tsx +138 -0
- package/dialog/Dialog.js +4 -3
- package/dialog/Dialog.stories.tsx +212 -0
- package/dropdown/Dropdown.js +1 -1
- package/dropdown/Dropdown.stories.tsx +247 -0
- package/dropdown/types.d.ts +1 -1
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +167 -109
- package/file-input/FileInput.stories.tsx +507 -0
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +12 -21
- package/file-input/types.d.ts +112 -0
- package/file-input/types.js +5 -0
- 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 +22 -18
- package/header/Header.js +2 -2
- package/header/Header.stories.tsx +162 -0
- package/header/Icons.d.ts +2 -0
- package/header/types.d.ts +4 -2
- package/heading/Heading.d.ts +4 -0
- package/heading/Heading.js +7 -24
- package/heading/Heading.stories.tsx +54 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- 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 +9 -19
- package/layout/ApplicationLayout.stories.tsx +171 -0
- package/layout/types.d.ts +57 -0
- package/layout/types.js +5 -0
- package/link/Link.js +3 -3
- package/link/Link.stories.tsx +146 -0
- 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 +7 -3
- package/main.js +34 -2
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +5 -50
- package/number-input/{NumberInput.stories.jsx → NumberInput.stories.tsx} +0 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/number-input/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- 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 +17 -10
- package/progress-bar/ProgressBar.js +4 -4
- package/radio/Radio.js +2 -2
- package/radio/types.d.ts +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 +4 -0
- package/resultsetTable/ResultsetTable.js +5 -28
- package/resultsetTable/ResultsetTable.stories.tsx +275 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- 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/Select.stories.tsx +572 -0
- package/select/types.d.ts +170 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/sidenav/Sidenav.js +6 -15
- package/sidenav/Sidenav.stories.tsx +182 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +43 -32
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +2 -7
- 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 +3 -3
- package/table/Table.stories.jsx +2 -1
- package/tabs/Tabs.js +11 -9
- package/tabs/Tabs.stories.tsx +120 -0
- package/tabs/types.d.ts +25 -18
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +4 -25
- package/tag/{Tag.stories.jsx → Tag.stories.tsx} +1 -1
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/text/Text.d.ts +7 -0
- package/text/Text.js +30 -0
- package/text/Text.stories.tsx +19 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +54 -85
- package/text-input/TextInput.stories.tsx +456 -0
- package/text-input/types.d.ts +159 -0
- package/text-input/types.js +5 -0
- 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 +173 -0
- 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.d.ts +4 -0
- package/wizard/Wizard.js +69 -59
- package/wizard/Wizard.stories.tsx +224 -0
- package/wizard/types.d.ts +60 -0
- package/wizard/types.js +5 -0
- package/chip/index.d.ts +0 -22
- package/file-input/index.d.ts +0 -81
- package/heading/index.d.ts +0 -17
- package/number-input/index.d.ts +0 -113
- package/resultsetTable/index.d.ts +0 -19
- package/select/index.d.ts +0 -131
- package/sidenav/index.d.ts +0 -13
- package/tag/index.d.ts +0 -24
- package/text-input/index.d.ts +0 -135
- package/textarea/index.d.ts +0 -117
- package/toggle-group/index.d.ts +0 -21
- package/wizard/Icons.js +0 -65
- package/wizard/index.d.ts +0 -18
|
@@ -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
|
*/
|
|
@@ -58,9 +66,8 @@ declare type Props = {
|
|
|
58
66
|
*/
|
|
59
67
|
onTabHover?: (tabIndex: number) => void;
|
|
60
68
|
/**
|
|
61
|
-
* Size of the margin to be applied to the component
|
|
62
|
-
* with 'top', 'bottom', 'left' and 'right' properties in order to specify
|
|
63
|
-
* different margin sizes.
|
|
69
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
70
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
64
71
|
*/
|
|
65
72
|
margin?: Space | Margin;
|
|
66
73
|
/**
|
package/tag/Tag.d.ts
ADDED
package/tag/Tag.js
CHANGED
|
@@ -9,8 +9,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports["default"] = void 0;
|
|
11
11
|
|
|
12
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
-
|
|
14
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
13
|
|
|
16
14
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -21,11 +19,9 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
21
19
|
|
|
22
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
23
21
|
|
|
24
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
25
|
-
|
|
26
22
|
var _variables = require("../common/variables.js");
|
|
27
23
|
|
|
28
|
-
var _useTheme = _interopRequireDefault(require("../useTheme
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
29
25
|
|
|
30
26
|
var _utils = require("../common/utils.js");
|
|
31
27
|
|
|
@@ -40,8 +36,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
40
36
|
var DxcTag = function DxcTag(_ref) {
|
|
41
37
|
var icon = _ref.icon,
|
|
42
38
|
iconSrc = _ref.iconSrc,
|
|
43
|
-
label = _ref.label,
|
|
44
|
-
|
|
39
|
+
_ref$label = _ref.label,
|
|
40
|
+
label = _ref$label === void 0 ? "" : _ref$label,
|
|
45
41
|
linkHref = _ref.linkHref,
|
|
46
42
|
onClick = _ref.onClick,
|
|
47
43
|
_ref$iconBgColor = _ref.iconBgColor,
|
|
@@ -50,6 +46,7 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
50
46
|
labelPosition = _ref$labelPosition === void 0 ? "after" : _ref$labelPosition,
|
|
51
47
|
_ref$newWindow = _ref.newWindow,
|
|
52
48
|
newWindow = _ref$newWindow === void 0 ? false : _ref$newWindow,
|
|
49
|
+
margin = _ref.margin,
|
|
53
50
|
_ref$size = _ref.size,
|
|
54
51
|
size = _ref$size === void 0 ? "fitContent" : _ref$size,
|
|
55
52
|
_ref$tabIndex = _ref.tabIndex,
|
|
@@ -192,23 +189,5 @@ var TagLabel = _styledComponents["default"].div(_templateObject8 || (_templateOb
|
|
|
192
189
|
return props.theme.labelPaddingRight;
|
|
193
190
|
});
|
|
194
191
|
|
|
195
|
-
DxcTag.propTypes = {
|
|
196
|
-
size: _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(sizes))),
|
|
197
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].element, _propTypes["default"].func]),
|
|
198
|
-
iconSrc: _propTypes["default"].string,
|
|
199
|
-
iconBgColor: _propTypes["default"].string,
|
|
200
|
-
label: _propTypes["default"].string,
|
|
201
|
-
labelPosition: _propTypes["default"].oneOf(["before", "after"]),
|
|
202
|
-
linkHref: _propTypes["default"].string,
|
|
203
|
-
onClick: _propTypes["default"].func,
|
|
204
|
-
newWindow: _propTypes["default"].bool,
|
|
205
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
206
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
207
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
208
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
209
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
210
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))]),
|
|
211
|
-
tabIndex: _propTypes["default"].number
|
|
212
|
-
};
|
|
213
192
|
var _default = DxcTag;
|
|
214
193
|
exports["default"] = _default;
|
|
@@ -132,7 +132,7 @@ export const Chromatic = () => (
|
|
|
132
132
|
);
|
|
133
133
|
|
|
134
134
|
const LinkTag = () => (
|
|
135
|
-
<ExampleContainer>
|
|
135
|
+
<ExampleContainer expanded>
|
|
136
136
|
<Title title="Hover link tag" theme="light" level={4} />
|
|
137
137
|
<DxcTag label="Tag" icon={icon} linkHref="https://www.dxc.com" />
|
|
138
138
|
</ExampleContainer>
|
package/tag/types.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
|
+
top?: Space;
|
|
5
|
+
bottom?: Space;
|
|
6
|
+
left?: Space;
|
|
7
|
+
right?: Space;
|
|
8
|
+
};
|
|
9
|
+
declare type SVG = React.SVGProps<SVGSVGElement> | React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
|
10
|
+
declare type Props = {
|
|
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;
|
|
23
|
+
/**
|
|
24
|
+
* If defined, the tag will be displayed as an anchor, using this prop as "href".
|
|
25
|
+
* Component will show some visual feedback on hover.
|
|
26
|
+
*/
|
|
27
|
+
linkHref?: string;
|
|
28
|
+
/**
|
|
29
|
+
* If defined, the tag will be displayed as a button. This function will
|
|
30
|
+
* be called when the user clicks the tag. Component will show some
|
|
31
|
+
* visual feedback on hover.
|
|
32
|
+
*/
|
|
33
|
+
onClick?: () => void;
|
|
34
|
+
/**
|
|
35
|
+
* Background color of the icon section of the tag.
|
|
36
|
+
*/
|
|
37
|
+
iconBgColor?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Whether the label should appear after or before the icon.
|
|
40
|
+
*/
|
|
41
|
+
labelPosition?: "before" | "after";
|
|
42
|
+
/**
|
|
43
|
+
* If true, the page is opened in a new browser tab.
|
|
44
|
+
*/
|
|
45
|
+
newWindow?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
48
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
49
|
+
*/
|
|
50
|
+
margin?: Space | Margin;
|
|
51
|
+
/**
|
|
52
|
+
* Size of the component.
|
|
53
|
+
*/
|
|
54
|
+
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
55
|
+
/**
|
|
56
|
+
* Value of the tabindex attribute.
|
|
57
|
+
*/
|
|
58
|
+
tabIndex?: number;
|
|
59
|
+
};
|
|
60
|
+
export default Props;
|
package/tag/types.js
ADDED
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"])));
|
|
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
|
+
);
|