@dxc-technology/halstack-react 0.0.0-ebf4fe2 → 0.0.0-ec06b53
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 +7 -8
- package/accordion/Accordion.js +122 -103
- package/accordion/Accordion.stories.tsx +2 -3
- package/accordion/Accordion.test.js +9 -10
- package/accordion/types.d.ts +5 -4
- package/accordion-group/AccordionGroup.js +1 -21
- package/accordion-group/AccordionGroup.stories.tsx +27 -1
- package/accordion-group/AccordionGroup.test.js +20 -45
- package/accordion-group/types.d.ts +10 -3
- package/alert/Alert.js +1 -1
- package/bleed/Bleed.stories.tsx +63 -63
- package/box/Box.js +1 -1
- package/box/types.d.ts +1 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/{inline → bulleted-list}/types.js +0 -0
- package/button/Button.js +43 -61
- package/button/Button.stories.tsx +9 -0
- package/button/types.d.ts +7 -7
- package/card/types.d.ts +1 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +92 -99
- package/checkbox/Checkbox.stories.tsx +79 -59
- package/checkbox/Checkbox.test.js +93 -16
- package/checkbox/types.d.ts +6 -2
- package/chip/types.d.ts +1 -1
- package/common/variables.js +75 -33
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +77 -222
- package/date-input/DateInput.stories.tsx +30 -17
- package/date-input/DateInput.test.js +411 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +53 -0
- package/dialog/Dialog.js +52 -28
- package/dialog/Dialog.stories.tsx +57 -2
- package/dialog/Dialog.test.js +34 -4
- package/dialog/types.d.ts +3 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +247 -247
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +504 -108
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -0
- package/dropdown/types.d.ts +25 -5
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +177 -219
- package/file-input/FileInput.stories.tsx +38 -10
- package/file-input/FileInput.test.js +53 -12
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +38 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/{list → flex}/types.js +0 -0
- package/footer/Footer.stories.tsx +8 -1
- package/footer/types.d.ts +2 -1
- package/header/Header.js +74 -72
- package/header/Header.stories.tsx +4 -4
- package/header/Icons.js +2 -2
- package/header/types.d.ts +3 -2
- package/inset/Inset.stories.tsx +4 -4
- package/layout/ApplicationLayout.d.ts +15 -6
- package/layout/ApplicationLayout.js +36 -64
- package/layout/ApplicationLayout.stories.tsx +80 -44
- package/layout/types.d.ts +17 -27
- package/link/Link.js +2 -2
- package/link/Link.stories.tsx +13 -6
- package/link/types.d.ts +1 -1
- package/main.d.ts +5 -9
- package/main.js +27 -59
- package/number-input/NumberInput.test.js +43 -7
- package/package.json +16 -20
- package/paginator/Paginator.js +2 -2
- package/paginator/Paginator.test.js +1 -1
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.test.js +13 -12
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +56 -50
- package/progress-bar/ProgressBar.stories.jsx +3 -1
- package/progress-bar/ProgressBar.test.js +67 -22
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.js +18 -17
- package/quick-nav/QuickNav.stories.tsx +131 -26
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +43 -28
- package/radio-group/RadioGroup.js +23 -22
- package/radio-group/RadioGroup.stories.tsx +1 -0
- package/radio-group/RadioGroup.test.js +123 -96
- package/radio-group/types.d.ts +2 -2
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +48 -107
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +23 -41
- package/resultsetTable/types.d.ts +2 -2
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +25 -2
- package/select/Select.js +17 -32
- package/select/Select.stories.tsx +6 -5
- package/select/Select.test.js +321 -250
- package/select/types.d.ts +2 -4
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +176 -55
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +25 -37
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +120 -95
- package/slider/Slider.stories.tsx +7 -1
- package/slider/Slider.test.js +121 -21
- package/slider/types.d.ts +6 -2
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +135 -68
- package/switch/Switch.stories.tsx +8 -30
- package/switch/Switch.test.js +144 -17
- package/switch/types.d.ts +6 -2
- package/table/Table.js +1 -1
- package/table/Table.test.js +1 -1
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +135 -0
- package/tabs/Tabs.js +360 -104
- package/tabs/Tabs.stories.tsx +74 -0
- package/tabs/Tabs.test.js +217 -6
- package/tabs/types.d.ts +15 -5
- package/tabs-nav/NavTabs.js +5 -5
- package/tabs-nav/Tab.js +3 -5
- package/tabs-nav/types.d.ts +1 -1
- package/tag/Tag.js +1 -1
- package/tag/types.d.ts +1 -1
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +60 -0
- package/text-input/Suggestion.js +7 -5
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.js +189 -282
- package/text-input/TextInput.stories.tsx +189 -182
- package/text-input/TextInput.test.js +639 -727
- package/text-input/types.d.ts +22 -3
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/{row → typography}/types.js +0 -0
- package/wizard/Wizard.js +9 -16
- package/wizard/Wizard.stories.tsx +20 -1
- package/wizard/types.d.ts +5 -4
- package/inline/Inline.d.ts +0 -4
- package/inline/Inline.js +0 -60
- package/inline/Inline.stories.tsx +0 -305
- package/inline/types.d.ts +0 -36
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -89
- package/list/types.d.ts +0 -7
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/stack/Stack.d.ts +0 -4
- package/stack/Stack.js +0 -52
- package/stack/Stack.stories.tsx +0 -225
- package/stack/types.d.ts +0 -28
- package/stack/types.js +0 -5
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
|
@@ -2,14 +2,14 @@ import React from "react";
|
|
|
2
2
|
import DxcFileInput from "./FileInput";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import FileItem from "./FileItem";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "File input",
|
|
8
9
|
component: DxcFileInput,
|
|
9
10
|
};
|
|
10
11
|
|
|
11
|
-
const picPreview =
|
|
12
|
-
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAABmJLR0QA/wD/AP+gvaeTAAAEDklEQVRogdXaXaxcUxQH8J/etloajVT1I9qgCbdIUB8PXPeKBJHgsV5ExAuVivBUgtSDxgNBVMVHxEeRUhIhkpJ40BYhoTShaQglQtA2VR+ttjMe1j45c6cztzNnzszc+09Ocs/Za+39/++zzt5rr7l0D1diA35P14b0bMJgAE+g2uR6FpP7xq4NZCL2YjlOSNdt6VkVj/eNXYu4VhD9G+c3aL8gtVWS7bjEsfhRCFk2ht2yZPNT8hl3WCUIfoZJY9gdhY+T7QM94NUWFmEfDuHCFuyXJNv9OL2LvNrGO2KGn2rD55nks6ErjAog+8B3YXYbfrPwR/Lt+4d/NLYLMrcW8F+efL/DtBJ5tY17EpEvxEbYLgawJfVxXxObRZhbiF2LWCjfE4Y66OeS1Mc/OLnm+Uw8ggP4oYP+j4hHxUy+VEJfL6e+3hTL8/X4RZ7W/FvCGE1xOdZp7wNvhvny9CULtSo+1QMhZWImPpQL+A03YbouCpkqXn8ZqA+jg1iD41P7NF0QMiAy2N0ipDrFWUa/hU9wXp1N6UIuEktsNug3HfY3gD2pr4rYTxrlZ6UJmY3n0mBZ7JYhhDi3ZP1+i6sb2HQsZBJuEEfUqljjV+Ic5QkhzifZylTF+xisae9IyBIRr1nnb+PU1DaoXCHkk5blXfvxGGYoKGQWnhbpdZb/XFNn0w0hGebgBXm4fY/rtClkOn6Wz8j96Vk9uikkw5DRm2JLQrKV4hB2pr+niJznuPI5toRN4rx/u1jZiLfUMqZiBf4Ss7Bb7Bu1WW0v3kgt5mA17i7iPB8vymN1Cy5Obb0W0jFm4Fd5jFbEfjJsggl5UBDeiLvk4bZP/4RcJj76W1p1OE2sXAfFBkgcotYrL0UpghF5BfOkVhzeTQ5rGrRdIXbiVWWxaxNvCG6vHckwq4jsFPXa8YYF8gPYVc2MaisiN/eGVyGsEBy3C86H4d5k8LliFZFeYSq+FlwP218WiJWpIpbY8Y5heeXllNqGdcqriPQKrwrO67MHZwh1ezGvT6SKIKu8VLCYWGareKgPZEZECrS5oP/Dgvtq2Jpuzi6FWmuYh7XyfK5asJ9zk++X5EWARuePsjEZd9SM+afOhBwjz9TtSDeDY3mUgBH526/gFRHnnQhZLD9NejLdvG7sn8yKoj6MtuLSmvaiQibJ8781RNl+V3rwEZaKpGxKQeIZ6sNoD+5s0G87QqYkbksT1yydWpQZDMl/kS16bawb9AN5GK3VfGnvZMwd0qEv+w+ETTgTN4rEcRAninSgVdTP6oE2fFvFf6JIuA1v4XmRkXQVk+UFhGoacKXDJ6eTj72nmGt0DWCbONdkmDBCMgzjK6MrmAtNQCGUvyH2HfXhNmGFZBgRNYD3Ou3ofwlpcfptqgzTAAAAAElFTkSuQmCC";
|
|
12
|
+
const picPreview = "https://cdn.mos.cms.futurecdn.net/CAZ6JXi6huSuN4QGE627NR.jpg"
|
|
13
13
|
|
|
14
14
|
const file1 = new File(["file1"], "file.pdf", { type: "text/plain" });
|
|
15
15
|
const file2 = new File(["file2"], "file2.mp3", {
|
|
@@ -21,7 +21,7 @@ const file3 = new File(["file3"], "file3.png", {
|
|
|
21
21
|
const file4 = new File(["file4"], "file4file4file4file4file4file4file4file4file4.mp4", {
|
|
22
22
|
type: "video",
|
|
23
23
|
});
|
|
24
|
-
const file5 = new File(["
|
|
24
|
+
const file5 = new File(["file5"], "file5file5file5file5file5file5file5file5file5.mp4", {
|
|
25
25
|
type: "video",
|
|
26
26
|
});
|
|
27
27
|
|
|
@@ -53,7 +53,7 @@ const filesExamples = [
|
|
|
53
53
|
file: file4,
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
error: "
|
|
56
|
+
error: "This error message is a multiline paragraph for testing.",
|
|
57
57
|
file: file5,
|
|
58
58
|
},
|
|
59
59
|
{
|
|
@@ -65,17 +65,45 @@ const filesExamples = [
|
|
|
65
65
|
|
|
66
66
|
export const Chromatic = () => (
|
|
67
67
|
<>
|
|
68
|
+
<Title title="File item states" theme="light" level={2} />
|
|
68
69
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
69
|
-
<Title title="
|
|
70
|
-
<
|
|
70
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
71
|
+
<FileItem
|
|
72
|
+
fileName="file"
|
|
73
|
+
error=""
|
|
74
|
+
singleFileMode={false}
|
|
75
|
+
showPreview={false}
|
|
76
|
+
preview={picPreview}
|
|
77
|
+
type="image/png"
|
|
78
|
+
onDelete={() => {}}
|
|
79
|
+
tabIndex={0}
|
|
80
|
+
/>
|
|
71
81
|
</ExampleContainer>
|
|
72
82
|
<ExampleContainer pseudoState="pseudo-focus">
|
|
73
|
-
<Title title="
|
|
74
|
-
<
|
|
83
|
+
<Title title="Focused" theme="light" level={4} />
|
|
84
|
+
<FileItem
|
|
85
|
+
fileName="file"
|
|
86
|
+
error=""
|
|
87
|
+
singleFileMode={false}
|
|
88
|
+
showPreview={false}
|
|
89
|
+
preview={picPreview}
|
|
90
|
+
type="image/png"
|
|
91
|
+
onDelete={() => {}}
|
|
92
|
+
tabIndex={0}
|
|
93
|
+
/>
|
|
75
94
|
</ExampleContainer>
|
|
76
95
|
<ExampleContainer pseudoState="pseudo-active">
|
|
77
|
-
<Title title="
|
|
78
|
-
<
|
|
96
|
+
<Title title="Actived" theme="light" level={4} />
|
|
97
|
+
<FileItem
|
|
98
|
+
fileName="file"
|
|
99
|
+
error=""
|
|
100
|
+
singleFileMode={false}
|
|
101
|
+
showPreview={false}
|
|
102
|
+
preview={picPreview}
|
|
103
|
+
type="image/png"
|
|
104
|
+
onDelete={() => {}}
|
|
105
|
+
tabIndex={0}
|
|
106
|
+
/>
|
|
79
107
|
</ExampleContainer>
|
|
80
108
|
<Title title="File" theme="light" level={2} />
|
|
81
109
|
<ExampleContainer>
|
|
@@ -14,19 +14,19 @@ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
|
14
14
|
|
|
15
15
|
var _FileInput = _interopRequireDefault(require("./FileInput"));
|
|
16
16
|
|
|
17
|
+
var file1 = new File(["file1"], "file1.png", {
|
|
18
|
+
type: "image/png"
|
|
19
|
+
});
|
|
20
|
+
var file2 = new File(["file2"], "file2.txt", {
|
|
21
|
+
type: "text/plain"
|
|
22
|
+
});
|
|
23
|
+
var allFiles = [{
|
|
24
|
+
file: file1
|
|
25
|
+
}, {
|
|
26
|
+
error: "Error message",
|
|
27
|
+
file: file2
|
|
28
|
+
}];
|
|
17
29
|
describe("FileInput component tests", function () {
|
|
18
|
-
var file1 = new File(["file1"], "file1.png", {
|
|
19
|
-
type: "image/png"
|
|
20
|
-
});
|
|
21
|
-
var file2 = new File(["file2"], "file2.txt", {
|
|
22
|
-
type: "text/plain"
|
|
23
|
-
});
|
|
24
|
-
var allFiles = [{
|
|
25
|
-
file: file1
|
|
26
|
-
}, {
|
|
27
|
-
error: "Error message",
|
|
28
|
-
file: file2
|
|
29
|
-
}];
|
|
30
30
|
test("Renders with correct labels and helper text in file mode", function () {
|
|
31
31
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
32
32
|
label: "File input label",
|
|
@@ -454,4 +454,45 @@ describe("FileInput component tests", function () {
|
|
|
454
454
|
}
|
|
455
455
|
}, _callee6);
|
|
456
456
|
})));
|
|
457
|
+
test("File input sends value when submitted in a form", function () {
|
|
458
|
+
var newFile = new File(["newFile"], "newFile.pdf", {
|
|
459
|
+
type: "pdf"
|
|
460
|
+
});
|
|
461
|
+
var handlerOnSubmit = jest.fn(function (e) {
|
|
462
|
+
e.preventDefault();
|
|
463
|
+
var formData = new FormData(e.target);
|
|
464
|
+
var formProps = Object.fromEntries(formData);
|
|
465
|
+
expect(formProps).toStrictEqual({
|
|
466
|
+
file: newFile
|
|
467
|
+
});
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
var _render17 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement("form", {
|
|
471
|
+
onSubmit: handlerOnSubmit
|
|
472
|
+
}, /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
473
|
+
label: "File input label",
|
|
474
|
+
name: "file",
|
|
475
|
+
helperText: "File input helper text",
|
|
476
|
+
mode: "filedrop",
|
|
477
|
+
buttonLabel: "Choose",
|
|
478
|
+
dropAreaLabel: "(or drop the files)"
|
|
479
|
+
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
480
|
+
type: "submit"
|
|
481
|
+
}, "Submit"))),
|
|
482
|
+
getByText = _render17.getByText,
|
|
483
|
+
getByLabelText = _render17.getByLabelText;
|
|
484
|
+
|
|
485
|
+
var inputFile = getByLabelText("File input label", {
|
|
486
|
+
hidden: true
|
|
487
|
+
});
|
|
488
|
+
var submit = getByText("Submit");
|
|
489
|
+
|
|
490
|
+
_react2.fireEvent.change(inputFile, {
|
|
491
|
+
target: {
|
|
492
|
+
files: [newFile]
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
_userEvent["default"].click(submit);
|
|
497
|
+
});
|
|
457
498
|
});
|
package/file-input/FileItem.d.ts
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
name?: string;
|
|
6
|
-
error?: string;
|
|
7
|
-
showPreview: any;
|
|
8
|
-
preview: any;
|
|
9
|
-
type: any;
|
|
10
|
-
numFiles: any;
|
|
11
|
-
onDelete: any;
|
|
12
|
-
tabIndex: any;
|
|
13
|
-
}) => JSX.Element;
|
|
14
|
-
export default FileItem;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FileItemProps } from "./types";
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ fileName, error, singleFileMode, showPreview, preview, type, onDelete, tabIndex, }: FileItemProps) => JSX.Element>;
|
|
4
|
+
export default _default;
|
package/file-input/FileItem.js
CHANGED
|
@@ -15,9 +15,13 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
17
|
|
|
18
|
+
var _main = require("../main");
|
|
19
|
+
|
|
18
20
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
19
21
|
|
|
20
|
-
var
|
|
22
|
+
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
23
|
+
|
|
24
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
21
25
|
|
|
22
26
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
27
|
|
|
@@ -47,103 +51,75 @@ var errorIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
|
47
51
|
}));
|
|
48
52
|
|
|
49
53
|
var FileItem = function FileItem(_ref) {
|
|
50
|
-
var
|
|
51
|
-
|
|
52
|
-
_ref$name = _ref.name,
|
|
53
|
-
name = _ref$name === void 0 ? "" : _ref$name,
|
|
54
|
+
var _ref$fileName = _ref.fileName,
|
|
55
|
+
fileName = _ref$fileName === void 0 ? "" : _ref$fileName,
|
|
54
56
|
_ref$error = _ref.error,
|
|
55
57
|
error = _ref$error === void 0 ? "" : _ref$error,
|
|
58
|
+
singleFileMode = _ref.singleFileMode,
|
|
56
59
|
showPreview = _ref.showPreview,
|
|
57
60
|
preview = _ref.preview,
|
|
58
61
|
type = _ref.type,
|
|
59
|
-
numFiles = _ref.numFiles,
|
|
60
62
|
onDelete = _ref.onDelete,
|
|
61
63
|
tabIndex = _ref.tabIndex;
|
|
62
64
|
var colorsTheme = (0, _useTheme["default"])();
|
|
63
|
-
var
|
|
65
|
+
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
64
66
|
|
|
65
67
|
var getIconAriaLabel = function getIconAriaLabel() {
|
|
66
|
-
if (type.includes("video"))
|
|
67
|
-
return "video";
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (type.includes("audio")) {
|
|
71
|
-
return "audio";
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return "file";
|
|
68
|
+
if (type.includes("video")) return "video";else if (type.includes("audio")) return "audio";else return "file";
|
|
75
69
|
};
|
|
76
70
|
|
|
77
71
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
78
72
|
theme: colorsTheme.fileInput
|
|
79
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
80
|
-
mode: mode,
|
|
81
|
-
multiple: multiple,
|
|
73
|
+
}, /*#__PURE__*/_react["default"].createElement(MainContainer, {
|
|
82
74
|
error: error,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, showPreview && (
|
|
75
|
+
singleFileMode: singleFileMode,
|
|
76
|
+
showPreview: showPreview
|
|
77
|
+
}, showPreview && (type.includes("image") ? /*#__PURE__*/_react["default"].createElement(ImagePreview, {
|
|
86
78
|
src: preview,
|
|
87
|
-
alt:
|
|
88
|
-
}) : /*#__PURE__*/_react["default"].createElement(
|
|
79
|
+
alt: fileName
|
|
80
|
+
}) : /*#__PURE__*/_react["default"].createElement(IconPreview, {
|
|
89
81
|
error: error,
|
|
90
82
|
"aria-label": getIconAriaLabel()
|
|
91
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
mode: mode,
|
|
95
|
-
multiple: multiple,
|
|
96
|
-
error: error,
|
|
97
|
-
showPreview: showPreview,
|
|
98
|
-
numFiles: numFiles
|
|
99
|
-
}, name), error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, {
|
|
100
|
-
"aria-label": "Error"
|
|
101
|
-
}, errorIcon), /*#__PURE__*/_react["default"].createElement(DeleteIcon, {
|
|
102
|
-
error: error,
|
|
83
|
+
}, preview)), /*#__PURE__*/_react["default"].createElement(FileItemContent, null, /*#__PURE__*/_react["default"].createElement(FileName, null, fileName), /*#__PURE__*/_react["default"].createElement(_main.DxcFlex, {
|
|
84
|
+
gap: "0.25rem"
|
|
85
|
+
}, error && /*#__PURE__*/_react["default"].createElement(ErrorIcon, null, errorIcon), /*#__PURE__*/_react["default"].createElement(DeleteFileAction, {
|
|
103
86
|
onClick: function onClick() {
|
|
104
|
-
|
|
87
|
+
onDelete(fileName);
|
|
105
88
|
},
|
|
106
|
-
|
|
89
|
+
title: translatedLabels.fileInput.deleteFileActionTitle,
|
|
90
|
+
"aria-label": translatedLabels.fileInput.deleteFileActionTitle,
|
|
107
91
|
tabIndex: tabIndex
|
|
108
|
-
}, deleteIcon)), error &&
|
|
92
|
+
}, deleteIcon)), error && !singleFileMode && /*#__PURE__*/_react["default"].createElement(ErrorMessage, null, error))));
|
|
109
93
|
};
|
|
110
94
|
|
|
111
|
-
var
|
|
112
|
-
return props.
|
|
113
|
-
}, function (props) {
|
|
114
|
-
return props.error && props.theme.errorFileItemBackgroundColor;
|
|
115
|
-
}, function (props) {
|
|
116
|
-
return props.theme.fileItemBorderRadius;
|
|
95
|
+
var MainContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n gap: 0.75rem;\n width: ", ";\n padding: ", ";\n ", ";\n border-color: ", ";\n border-width: ", ";\n border-style: ", ";\n border-radius: ", ";\n"])), function (props) {
|
|
96
|
+
return props.singleFileMode ? "230px" : "320px";
|
|
117
97
|
}, function (props) {
|
|
118
|
-
return props.
|
|
98
|
+
return props.showPreview ? "calc(8px - ".concat(props.theme.fileItemBorderThickness, ")") : "calc(8px - ".concat(props.theme.fileItemBorderThickness, ") calc(8px - ").concat(props.theme.fileItemBorderThickness, ") calc(8px - ").concat(props.theme.fileItemBorderThickness, ") 16px");
|
|
119
99
|
}, function (props) {
|
|
120
|
-
return props.
|
|
100
|
+
return props.error ? "background-color: ".concat(props.theme.errorFileItemBackgroundColor, ";") : "";
|
|
121
101
|
}, function (props) {
|
|
122
102
|
return props.error ? props.theme.errorFileItemBorderColor : props.theme.fileItemBorderColor;
|
|
123
103
|
}, function (props) {
|
|
124
104
|
return props.theme.fileItemBorderThickness;
|
|
125
105
|
}, function (props) {
|
|
126
106
|
return props.theme.fileItemBorderStyle;
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.theme.fileItemBorderRadius;
|
|
127
109
|
});
|
|
128
110
|
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
var FileItemContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n align-items: center;\n"])));
|
|
132
|
-
|
|
133
|
-
var ImagePreview = _styledComponents["default"].img(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n object-fit: contain;\n margin-right: 12px;\n border-radius: 2px;\n"])));
|
|
111
|
+
var ImagePreview = _styledComponents["default"].img(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 48px;\n height: 48px;\n border-radius: 2px;\n object-fit: contain;\n"])));
|
|
134
112
|
|
|
135
|
-
var
|
|
113
|
+
var IconPreview = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n width: 48px;\n height: 48px;\n padding: 15px;\n border-radius: 2px;\n color: ", ";\n\n svg {\n height: 18px;\n width: 18px;\n }\n"])), function (props) {
|
|
136
114
|
return props.error ? props.theme.errorFilePreviewBackgroundColor : props.theme.filePreviewBackgroundColor;
|
|
137
115
|
}, function (props) {
|
|
138
116
|
return props.error ? props.theme.errorFilePreviewIconColor : props.theme.filePreviewIconColor;
|
|
139
117
|
});
|
|
140
118
|
|
|
141
|
-
var
|
|
119
|
+
var FileItemContent = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n flex-grow: 1;\n display: grid;\n grid-template-columns: auto min-content;\n grid-template-rows: min-content auto;\n column-gap: 0.25rem;\n"])));
|
|
142
120
|
|
|
143
|
-
var FileName = _styledComponents["default"].span(
|
|
121
|
+
var FileName = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n align-self: center;\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n"])), function (props) {
|
|
144
122
|
return props.theme.fileNameFontColor;
|
|
145
|
-
}, function (props) {
|
|
146
|
-
return props.mode === "file" && !props.multiple && props.error && props.numFiles === 1 ? "calc(230px - 76px)" : props.mode === "file" && !props.multiple && !props.error && props.numFiles === 1 ? "calc(230px - 50px)" : !props.showPreview && !props.error ? "calc(320px - 52px)" : !props.showPreview && props.error ? "calc(320px - 76px)" : props.showPreview && props.error ? "calc(320px - 128px)" : props.showPreview && !props.error && "calc(320px - 102px)";
|
|
147
123
|
}, function (props) {
|
|
148
124
|
return props.theme.fileItemFontFamily;
|
|
149
125
|
}, function (props) {
|
|
@@ -154,9 +130,9 @@ var FileName = _styledComponents["default"].span(_templateObject7 || (_templateO
|
|
|
154
130
|
return props.theme.fileItemLineHeight;
|
|
155
131
|
});
|
|
156
132
|
|
|
157
|
-
var ErrorIcon = _styledComponents["default"].span(
|
|
133
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n color: #d0011b;\n"])));
|
|
158
134
|
|
|
159
|
-
var
|
|
135
|
+
var DeleteFileAction = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n height: 24px;\n width: 24px;\n font-size: 1rem;\n font-family: ", ";\n border: 1px solid transparent;\n border-radius: 2px;\n background-color: transparent;\n box-shadow: 0 0 0 2px transparent;\n padding: 3px;\n cursor: pointer;\n color: ", ";\n\n svg {\n line-height: 18px;\n }\n &:hover {\n background-color: ", ";\n }\n &:focus,\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
160
136
|
return props.theme.fontFamily;
|
|
161
137
|
}, function (props) {
|
|
162
138
|
return props.theme.deleteFileItemColor;
|
|
@@ -164,13 +140,11 @@ var DeleteIcon = _styledComponents["default"].button(_templateObject9 || (_templ
|
|
|
164
140
|
return props.theme.hoverDeleteFileItemBackgroundColor;
|
|
165
141
|
}, function (props) {
|
|
166
142
|
return props.theme.focusDeleteFileItemBorderColor;
|
|
167
|
-
}, function (props) {
|
|
168
|
-
return props.theme.focusDeleteFileItemBorderColor;
|
|
169
143
|
}, function (props) {
|
|
170
144
|
return props.theme.activeDeleteFileItemBackgroundColor;
|
|
171
145
|
});
|
|
172
146
|
|
|
173
|
-
var ErrorMessage = _styledComponents["default"].span(
|
|
147
|
+
var ErrorMessage = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"])), function (props) {
|
|
174
148
|
return props.theme.errorMessageFontColor;
|
|
175
149
|
}, function (props) {
|
|
176
150
|
return props.theme.errorMessageFontFamily;
|
|
@@ -182,5 +156,6 @@ var ErrorMessage = _styledComponents["default"].span(_templateObject10 || (_temp
|
|
|
182
156
|
return props.theme.errorMessageLineHeight;
|
|
183
157
|
});
|
|
184
158
|
|
|
185
|
-
var _default = FileItem;
|
|
159
|
+
var _default = /*#__PURE__*/_react["default"].memo(FileItem);
|
|
160
|
+
|
|
186
161
|
exports["default"] = _default;
|
package/file-input/types.d.ts
CHANGED
|
@@ -108,5 +108,22 @@ declare type FileModeProps = CommonProps & {
|
|
|
108
108
|
*/
|
|
109
109
|
dropAreaLabel?: never;
|
|
110
110
|
};
|
|
111
|
+
/**
|
|
112
|
+
* Reference to the component.
|
|
113
|
+
*/
|
|
114
|
+
export declare type RefType = HTMLDivElement;
|
|
111
115
|
declare type Props = DropModeProps | FileModeProps;
|
|
116
|
+
/**
|
|
117
|
+
* Single file item preview.
|
|
118
|
+
*/
|
|
119
|
+
export declare type FileItemProps = {
|
|
120
|
+
fileName?: string;
|
|
121
|
+
error?: string;
|
|
122
|
+
showPreview: boolean;
|
|
123
|
+
singleFileMode: boolean;
|
|
124
|
+
preview: string;
|
|
125
|
+
type: string;
|
|
126
|
+
onDelete: (fileName: string) => void;
|
|
127
|
+
tabIndex: number;
|
|
128
|
+
};
|
|
112
129
|
export default Props;
|
package/flex/Flex.d.ts
ADDED
package/flex/Flex.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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 _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireDefault(require("react"));
|
|
19
|
+
|
|
20
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
21
|
+
|
|
22
|
+
var _templateObject;
|
|
23
|
+
|
|
24
|
+
var _excluded = ["direction", "wrap", "gap", "order", "grow", "shrink", "basis", "children"],
|
|
25
|
+
_excluded2 = ["justifyContent", "alignItems", "alignContent", "alignSelf"];
|
|
26
|
+
|
|
27
|
+
var DxcFlex = function DxcFlex(_ref) {
|
|
28
|
+
var _ref$direction = _ref.direction,
|
|
29
|
+
direction = _ref$direction === void 0 ? "row" : _ref$direction,
|
|
30
|
+
_ref$wrap = _ref.wrap,
|
|
31
|
+
wrap = _ref$wrap === void 0 ? "nowrap" : _ref$wrap,
|
|
32
|
+
_ref$gap = _ref.gap,
|
|
33
|
+
gap = _ref$gap === void 0 ? "0" : _ref$gap,
|
|
34
|
+
_ref$order = _ref.order,
|
|
35
|
+
order = _ref$order === void 0 ? 0 : _ref$order,
|
|
36
|
+
_ref$grow = _ref.grow,
|
|
37
|
+
grow = _ref$grow === void 0 ? 0 : _ref$grow,
|
|
38
|
+
_ref$shrink = _ref.shrink,
|
|
39
|
+
shrink = _ref$shrink === void 0 ? 1 : _ref$shrink,
|
|
40
|
+
_ref$basis = _ref.basis,
|
|
41
|
+
basis = _ref$basis === void 0 ? "auto" : _ref$basis,
|
|
42
|
+
children = _ref.children,
|
|
43
|
+
props = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
|
|
44
|
+
return /*#__PURE__*/_react["default"].createElement(Flex, (0, _extends2["default"])({
|
|
45
|
+
$direction: direction,
|
|
46
|
+
$wrap: wrap,
|
|
47
|
+
$order: order,
|
|
48
|
+
$grow: grow,
|
|
49
|
+
$shrink: shrink,
|
|
50
|
+
$basis: basis,
|
|
51
|
+
$gap: gap
|
|
52
|
+
}, props), children);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
var Flex = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n ", "\n"])), function (_ref2) {
|
|
56
|
+
var _ref2$justifyContent = _ref2.justifyContent,
|
|
57
|
+
justifyContent = _ref2$justifyContent === void 0 ? "flex-start" : _ref2$justifyContent,
|
|
58
|
+
_ref2$alignItems = _ref2.alignItems,
|
|
59
|
+
alignItems = _ref2$alignItems === void 0 ? "stretch" : _ref2$alignItems,
|
|
60
|
+
_ref2$alignContent = _ref2.alignContent,
|
|
61
|
+
alignContent = _ref2$alignContent === void 0 ? "normal" : _ref2$alignContent,
|
|
62
|
+
_ref2$alignSelf = _ref2.alignSelf,
|
|
63
|
+
alignSelf = _ref2$alignSelf === void 0 ? "auto" : _ref2$alignSelf,
|
|
64
|
+
props = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
|
|
65
|
+
return "\n flex-direction: ".concat(props.$direction, "; \n flex-wrap: ").concat(props.$wrap, "; \n justify-content: ").concat(justifyContent, "; \n align-items: ").concat(alignItems, ";\n align-content: ").concat(alignContent, ";\n align-self: ").concat(alignSelf, ";\n gap: ").concat((0, _typeof2["default"])(props.$gap) === "object" ? "".concat(props.$gap.rowGap, " ").concat(props.$gap.columnGap) : props.$gap, ";\n order: ").concat(props.$order, ";\n flex-grow: ").concat(props.$grow, ";\n flex-shrink: ").concat(props.$shrink, ";\n flex-basis: ").concat(props.$basis, ";\n ");
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
var _default = DxcFlex;
|
|
69
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Title from "../../.storybook/components/Title";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import DxcFlex from "./Flex";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Flex",
|
|
8
|
+
component: DxcFlex,
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const Chromatic = () => (
|
|
12
|
+
<>
|
|
13
|
+
<Title title="Default" level={4} />
|
|
14
|
+
<Container>
|
|
15
|
+
<DxcFlex>
|
|
16
|
+
<Placeholder />
|
|
17
|
+
<Placeholder width="50px" />
|
|
18
|
+
<Placeholder />
|
|
19
|
+
<Placeholder width="50px" />
|
|
20
|
+
<Placeholder width="50px" />
|
|
21
|
+
</DxcFlex>
|
|
22
|
+
</Container>
|
|
23
|
+
<Title title="Direction column, wrap, justify content end, align items center and gap" level={4} />
|
|
24
|
+
<Container>
|
|
25
|
+
<DxcFlex direction="column" wrap="wrap" justifyContent="end" alignItems="center" gap="20px">
|
|
26
|
+
<Placeholder />
|
|
27
|
+
<Placeholder width="100px" />
|
|
28
|
+
<Placeholder />
|
|
29
|
+
<Placeholder width="100px" />
|
|
30
|
+
<Placeholder />
|
|
31
|
+
</DxcFlex>
|
|
32
|
+
</Container>
|
|
33
|
+
<Title title="Wrap with align content space between, row and column gaps, and as a span" level={4} />
|
|
34
|
+
<Container height="250px">
|
|
35
|
+
<DxcFlex wrap="wrap" alignContent="space-between" as="span" gap={{ rowGap: "10px", columnGap: "20px" }}>
|
|
36
|
+
<Placeholder />
|
|
37
|
+
<Placeholder />
|
|
38
|
+
<Placeholder />
|
|
39
|
+
<Placeholder />
|
|
40
|
+
<Placeholder width="100px" />
|
|
41
|
+
<Placeholder />
|
|
42
|
+
<Placeholder />
|
|
43
|
+
<Placeholder width="100px" />
|
|
44
|
+
<Placeholder />
|
|
45
|
+
<Placeholder />
|
|
46
|
+
<Placeholder width="100px" />
|
|
47
|
+
<Placeholder />
|
|
48
|
+
</DxcFlex>
|
|
49
|
+
</Container>
|
|
50
|
+
<Title title="Basis 100%, order, grow and align self" level={4} />
|
|
51
|
+
<Container height="75px">
|
|
52
|
+
<DxcFlex basis="100%">
|
|
53
|
+
<DxcFlex order={3} grow={1} alignSelf="flex-end">
|
|
54
|
+
<PlaceholderGrowAndShrink>order 3, grow 1, align self end</PlaceholderGrowAndShrink>
|
|
55
|
+
</DxcFlex>
|
|
56
|
+
<DxcFlex order={-1} grow={4}>
|
|
57
|
+
<PlaceholderGrowAndShrink>order -1, grow 4</PlaceholderGrowAndShrink>
|
|
58
|
+
</DxcFlex>
|
|
59
|
+
<DxcFlex order={5} grow={1}>
|
|
60
|
+
<PlaceholderGrowAndShrink>order 5, grow 1</PlaceholderGrowAndShrink>
|
|
61
|
+
</DxcFlex>
|
|
62
|
+
<DxcFlex order={2} grow={2}>
|
|
63
|
+
<PlaceholderGrowAndShrink>order 2. grow 2</PlaceholderGrowAndShrink>
|
|
64
|
+
</DxcFlex>
|
|
65
|
+
</DxcFlex>
|
|
66
|
+
</Container>
|
|
67
|
+
<Title title="Basis and shrink" level={4} />
|
|
68
|
+
<Container>
|
|
69
|
+
<DxcFlex basis="600px">
|
|
70
|
+
<DxcFlex shrink={4} basis="400px">
|
|
71
|
+
<PlaceholderGrowAndShrink>shrink 4</PlaceholderGrowAndShrink>
|
|
72
|
+
</DxcFlex>
|
|
73
|
+
<DxcFlex shrink={2} basis="400px">
|
|
74
|
+
<PlaceholderGrowAndShrink>shrink 2</PlaceholderGrowAndShrink>
|
|
75
|
+
</DxcFlex>
|
|
76
|
+
<DxcFlex shrink={1} basis="400px">
|
|
77
|
+
<PlaceholderGrowAndShrink>shrink 1</PlaceholderGrowAndShrink>
|
|
78
|
+
</DxcFlex>
|
|
79
|
+
</DxcFlex>
|
|
80
|
+
</Container>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const Container = styled.div<{ height?: string }>`
|
|
85
|
+
display: flex;
|
|
86
|
+
background: #f2eafa;
|
|
87
|
+
margin: 2.5rem;
|
|
88
|
+
${({ height }) => (height ? `height: ${height}` : "max-height: 150px")};
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const Placeholder = styled.div<{ width?: string }>`
|
|
92
|
+
height: 40px;
|
|
93
|
+
min-width: ${({ width }) => width || "200px"};
|
|
94
|
+
border: 1px solid #a46ede;
|
|
95
|
+
background-color: #e5d5f6;
|
|
96
|
+
`;
|
|
97
|
+
|
|
98
|
+
const PlaceholderGrowAndShrink = styled.div`
|
|
99
|
+
height: 40px;
|
|
100
|
+
width: 100%;
|
|
101
|
+
border: 1px solid #a46ede;
|
|
102
|
+
background-color: #e5d5f6;
|
|
103
|
+
`;
|
package/flex/types.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare type Gap = {
|
|
3
|
+
rowGap: string;
|
|
4
|
+
columnGap: string;
|
|
5
|
+
};
|
|
6
|
+
declare type CommonProps = {
|
|
7
|
+
justifyContent?: "flex-start" | "flex-end" | "start" | "end" | "left" | "right" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
8
|
+
alignItems?: "stretch" | "flex-start" | "flex-end" | "start" | "end" | "self-start" | "self-end" | "center" | "baseline";
|
|
9
|
+
alignContent?: "normal" | "flex-start" | "flex-end" | "start" | "end" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch";
|
|
10
|
+
alignSelf?: "auto" | "flex-start" | "flex-end" | "center" | "baseline" | "stretch";
|
|
11
|
+
};
|
|
12
|
+
declare type Props = CommonProps & {
|
|
13
|
+
direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
14
|
+
wrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
15
|
+
gap?: string | Gap;
|
|
16
|
+
order?: number;
|
|
17
|
+
grow?: number;
|
|
18
|
+
shrink?: number;
|
|
19
|
+
basis?: string;
|
|
20
|
+
as?: keyof HTMLElementTagNameMap;
|
|
21
|
+
children: React.ReactNode;
|
|
22
|
+
};
|
|
23
|
+
export declare type StyledProps = CommonProps & {
|
|
24
|
+
$direction?: "row" | "row-reverse" | "column" | "column-reverse";
|
|
25
|
+
$wrap?: "nowrap" | "wrap" | "wrap-reverse";
|
|
26
|
+
$gap?: string | Gap;
|
|
27
|
+
$order?: number;
|
|
28
|
+
$grow?: number;
|
|
29
|
+
$shrink?: number;
|
|
30
|
+
$basis?: string;
|
|
31
|
+
};
|
|
32
|
+
export default Props;
|
package/{list → flex}/types.js
RENAMED
|
File without changes
|
|
@@ -28,7 +28,14 @@ const social = [
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
href: "https://twitter.com/dxctechnology",
|
|
31
|
-
logo:
|
|
31
|
+
logo: (
|
|
32
|
+
<svg viewBox="0 0 248 204" fill="currentColor">
|
|
33
|
+
<path
|
|
34
|
+
fill="#1d9bf0"
|
|
35
|
+
d="M221.95 51.29c.15 2.17.15 4.34.15 6.53 0 66.73-50.8 143.69-143.69 143.69v-.04c-27.44.04-54.31-7.82-77.41-22.64 3.99.48 8 .72 12.02.73 22.74.02 44.83-7.61 62.72-21.66-21.61-.41-40.56-14.5-47.18-35.07 7.57 1.46 15.37 1.16 22.8-.87-23.56-4.76-40.51-25.46-40.51-49.5v-.64c7.02 3.91 14.88 6.08 22.92 6.32C11.58 63.31 4.74 33.79 18.14 10.71c25.64 31.55 63.47 50.73 104.08 52.76-4.07-17.54 1.49-35.92 14.61-48.25 20.34-19.12 52.33-18.14 71.45 2.19 11.31-2.23 22.15-6.38 32.07-12.26-3.77 11.69-11.66 21.62-22.2 27.93 10.01-1.18 19.79-3.86 29-7.95-6.78 10.16-15.32 19.01-25.2 26.16z"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
),
|
|
32
39
|
},
|
|
33
40
|
{
|
|
34
41
|
href: "https://www.facebook.com/DXCTechnology/",
|
package/footer/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare type Size = {
|
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
declare type SVG = React.SVGProps<SVGSVGElement>;
|
|
9
|
+
declare type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
10
|
declare type SocialLink = {
|
|
11
11
|
/**
|
|
12
12
|
* Element used as the icon for the link.
|
|
@@ -57,6 +57,7 @@ declare type FooterPropsType = {
|
|
|
57
57
|
*/
|
|
58
58
|
margin?: Space | Size;
|
|
59
59
|
/**
|
|
60
|
+
* @deprecated This prop will be removed shortly, consider using the Inset component for this purpose.
|
|
60
61
|
* Size of the padding to be applied to the custom area of the component.
|
|
61
62
|
* You can pass an object with properties in order to specify different padding sizes.
|
|
62
63
|
*/
|