@dxc-technology/halstack-react 0.0.0-3a65d35 → 0.0.0-3a698b0
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 +2 -2
- package/BackgroundColorContext.js +1 -1
- package/HalstackContext.d.ts +1332 -5
- package/HalstackContext.js +117 -77
- package/accordion/Accordion.js +13 -24
- package/accordion/Accordion.stories.tsx +102 -13
- package/accordion/Accordion.test.js +1 -1
- package/accordion/types.d.ts +3 -3
- package/accordion-group/AccordionGroup.js +2 -2
- package/accordion-group/AccordionGroup.test.js +1 -1
- package/accordion-group/types.d.ts +2 -2
- package/alert/Alert.js +3 -5
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.js +1 -1
- package/bleed/Bleed.stories.tsx +1 -0
- package/box/Box.js +3 -5
- package/box/Box.stories.tsx +15 -0
- package/box/Box.test.js +1 -1
- package/button/Button.js +13 -16
- package/button/Button.stories.tsx +150 -8
- package/button/Button.test.js +1 -1
- package/button/types.d.ts +3 -3
- package/card/Card.js +12 -13
- package/card/Card.stories.tsx +12 -13
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +18 -17
- package/checkbox/Checkbox.stories.tsx +131 -59
- package/checkbox/Checkbox.test.js +1 -1
- package/checkbox/types.d.ts +6 -2
- package/chip/Chip.js +18 -26
- package/chip/Chip.stories.tsx +96 -9
- package/chip/Chip.test.js +3 -5
- package/common/utils.d.ts +1 -0
- package/common/utils.js +4 -4
- package/common/variables.d.ts +1625 -0
- package/common/variables.js +286 -290
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.js +134 -237
- package/date-input/DateInput.stories.tsx +199 -33
- package/date-input/DateInput.test.js +494 -138
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -0
- package/date-input/types.d.ts +51 -0
- package/dialog/Dialog.js +61 -74
- package/dialog/Dialog.stories.tsx +211 -159
- package/dialog/Dialog.test.js +302 -3
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.js +37 -37
- package/dropdown/Dropdown.stories.tsx +210 -84
- package/dropdown/Dropdown.test.js +20 -24
- package/dropdown/DropdownMenu.js +8 -18
- package/dropdown/DropdownMenuItem.js +4 -17
- package/dropdown/types.d.ts +3 -3
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +174 -220
- package/file-input/FileInput.stories.tsx +122 -11
- package/file-input/FileInput.test.js +14 -14
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +39 -63
- package/file-input/types.d.ts +17 -0
- package/flex/Flex.stories.tsx +19 -24
- package/footer/Footer.js +6 -8
- package/footer/Footer.stories.tsx +91 -0
- package/footer/Footer.test.js +14 -26
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +91 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/header/Header.d.ts +3 -2
- package/header/Header.js +21 -23
- package/header/Header.stories.tsx +149 -6
- package/header/Header.test.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.js +1 -1
- package/inset/Inset.stories.tsx +1 -0
- package/layout/ApplicationLayout.d.ts +1 -1
- package/layout/ApplicationLayout.js +1 -1
- package/link/Link.js +3 -3
- package/link/Link.stories.tsx +60 -0
- package/link/Link.test.js +2 -4
- package/link/types.d.ts +2 -2
- package/main.d.ts +3 -2
- package/main.js +9 -1
- package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
- package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
- package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
- package/{tabs-nav → nav-tabs}/Tab.js +37 -17
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.test.js +6 -7
- package/package.json +8 -13
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +16 -28
- package/paginator/Paginator.js +6 -14
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.js +44 -47
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +5 -5
- package/password-input/PasswordInput.test.js +1 -1
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +5 -5
- package/progress-bar/ProgressBar.stories.jsx +35 -2
- package/progress-bar/ProgressBar.test.js +1 -1
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.stories.tsx +14 -0
- package/radio-group/RadioGroup.stories.tsx +131 -18
- package/radio-group/RadioGroup.test.js +1 -1
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.js +49 -106
- package/resultsetTable/ResultsetTable.stories.tsx +50 -25
- package/resultsetTable/ResultsetTable.test.js +41 -64
- package/resultsetTable/types.d.ts +1 -1
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +5 -34
- package/select/Option.js +11 -24
- package/select/Select.js +56 -35
- package/select/Select.stories.tsx +494 -150
- package/select/Select.test.js +76 -81
- package/select/types.d.ts +2 -2
- package/sidenav/Sidenav.js +9 -11
- package/sidenav/Sidenav.stories.tsx +148 -46
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +11 -11
- package/slider/Slider.stories.tsx +57 -0
- package/slider/Slider.test.js +1 -1
- package/slider/types.d.ts +6 -2
- package/spinner/Spinner.js +17 -23
- package/spinner/Spinner.stories.jsx +53 -27
- package/spinner/Spinner.test.js +1 -1
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +7 -6
- package/switch/Switch.stories.tsx +33 -0
- package/switch/Switch.test.js +1 -1
- package/switch/types.d.ts +8 -3
- package/table/Table.js +2 -2
- package/table/Table.stories.jsx +80 -1
- package/table/Table.test.js +2 -2
- package/tabs/Tab.js +12 -15
- package/tabs/Tabs.js +11 -17
- package/tabs/Tabs.stories.tsx +45 -5
- package/tabs/Tabs.test.js +4 -5
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.js +7 -9
- package/tag/Tag.stories.tsx +14 -1
- package/tag/Tag.test.js +1 -1
- package/text-input/Suggestion.js +34 -7
- package/text-input/TextInput.js +10 -14
- package/text-input/TextInput.stories.tsx +92 -4
- package/text-input/TextInput.test.js +587 -635
- package/textarea/Textarea.js +3 -4
- package/textarea/Textarea.stories.jsx +60 -1
- package/textarea/Textarea.test.js +2 -4
- package/toggle-group/ToggleGroup.js +7 -4
- package/toggle-group/ToggleGroup.stories.tsx +42 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +1 -1
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +14 -113
- package/typography/Typography.stories.tsx +1 -1
- package/useTheme.d.ts +1234 -1
- package/useTheme.js +1 -1
- package/useTranslatedLabels.d.ts +84 -1
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +139 -0
- package/wizard/Wizard.js +2 -2
- package/wizard/Wizard.stories.tsx +20 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +5 -6
- package/common/RequiredComponent.js +0 -32
- /package/{tabs-nav → grid}/types.js +0 -0
- /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
- /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
package/tabs/Tabs.js
CHANGED
|
@@ -19,7 +19,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _variables = require("../common/variables
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
@@ -193,7 +193,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
193
193
|
var _refTabList$current3;
|
|
194
194
|
|
|
195
195
|
var scrollWidth = (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current3 = refTabList.current) === null || _refTabList$current3 === void 0 ? void 0 : _refTabList$current3.offsetWidth) * 0.75;
|
|
196
|
-
var moveX;
|
|
196
|
+
var moveX = 0;
|
|
197
197
|
|
|
198
198
|
if (countClick <= scrollWidth) {
|
|
199
199
|
moveX = 0;
|
|
@@ -213,7 +213,7 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
213
213
|
var _refTabList$current4, _refTabList$current5;
|
|
214
214
|
|
|
215
215
|
var scrollWidth = (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current4 = refTabList.current) === null || _refTabList$current4 === void 0 ? void 0 : _refTabList$current4.offsetWidth) * 0.75;
|
|
216
|
-
var moveX;
|
|
216
|
+
var moveX = 0;
|
|
217
217
|
|
|
218
218
|
if (countClick + scrollWidth + (refTabList === null || refTabList === void 0 ? void 0 : (_refTabList$current5 = refTabList.current) === null || _refTabList$current5 === void 0 ? void 0 : _refTabList$current5.offsetWidth) >= totalTabsWidth) {
|
|
219
219
|
var _refTabList$current6;
|
|
@@ -343,9 +343,8 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
343
343
|
iconPosition: iconPosition
|
|
344
344
|
}, /*#__PURE__*/_react["default"].createElement(ScrollIndicator, {
|
|
345
345
|
onClick: scrollLeft,
|
|
346
|
-
scrollLeftEnabled: scrollLeftEnabled,
|
|
347
346
|
enabled: enabledIndicator,
|
|
348
|
-
|
|
347
|
+
disabled: !scrollLeftEnabled,
|
|
349
348
|
"aria-label": translatedLabels.tabs.scrollLeft,
|
|
350
349
|
tabIndex: scrollLeftEnabled ? tabIndex : -1,
|
|
351
350
|
minHeightTabs: minHeightTabs
|
|
@@ -386,16 +385,15 @@ var DxcTabs = function DxcTabs(_ref) {
|
|
|
386
385
|
"aria-disabled": isActiveIndicatorDisabled
|
|
387
386
|
}))), /*#__PURE__*/_react["default"].createElement(ScrollIndicator, {
|
|
388
387
|
onClick: scrollRight,
|
|
389
|
-
scrollRightEnabled: scrollRightEnabled,
|
|
390
388
|
enabled: enabledIndicator,
|
|
391
|
-
|
|
389
|
+
disabled: !scrollRightEnabled,
|
|
392
390
|
"aria-label": translatedLabels.tabs.scrollRight,
|
|
393
391
|
tabIndex: scrollRightEnabled ? tabIndex : -1,
|
|
394
392
|
minHeightTabs: minHeightTabs
|
|
395
393
|
}, arrowIcons.right))));
|
|
396
394
|
};
|
|
397
395
|
|
|
398
|
-
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n left: 0;\n bottom: 0;\n width: 100%;\n
|
|
396
|
+
var Underline = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: ", ";\n background-color: ", ";\n"])), function (props) {
|
|
399
397
|
return props.theme.dividerThickness;
|
|
400
398
|
}, function (props) {
|
|
401
399
|
return props.theme.dividerColor;
|
|
@@ -421,16 +419,12 @@ var Tabs = _styledComponents["default"].div(_templateObject3 || (_templateObject
|
|
|
421
419
|
return props.theme.unselectedBackgroundColor;
|
|
422
420
|
});
|
|
423
421
|
|
|
424
|
-
var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: ", ";\n
|
|
422
|
+
var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: ", ";\n justify-content: center;\n min-width: ", ";\n height: ", "px;\n padding: 0;\n border: none;\n background-color: #ffffff;\n font-size: 1.25rem;\n cursor: pointer;\n\n &:hover {\n background-color: ", ";\n }\n &:focus {\n outline: ", " solid 1px;\n outline-offset: -1px;\n }\n &:active {\n background-color: ", ";\n }\n &:disabled {\n cursor: default;\n svg {\n visibility: hidden;\n }\n &:focus {\n outline: none;\n }\n &:hover,\n &:active {\n background-color: transparent !important;\n }\n }\n\n svg {\n align-self: center;\n height: 20px;\n width: 20px;\n fill: ", ";\n }\n"])), function (props) {
|
|
425
423
|
return props.enabled ? "flex" : "none";
|
|
426
424
|
}, function (props) {
|
|
427
425
|
return props.theme.scrollButtonsWidth;
|
|
428
426
|
}, function (props) {
|
|
429
427
|
return props.minHeightTabs - 1;
|
|
430
|
-
}, function (props) {
|
|
431
|
-
return props.theme.dividerThickness;
|
|
432
|
-
}, function (props) {
|
|
433
|
-
return props.theme.dividerColor;
|
|
434
428
|
}, function (props) {
|
|
435
429
|
return "".concat(props.theme.hoverBackgroundColor, " !important");
|
|
436
430
|
}, function (props) {
|
|
@@ -441,19 +435,19 @@ var ScrollIndicator = _styledComponents["default"].button(_templateObject4 || (_
|
|
|
441
435
|
return props.theme.unselectedFontColor;
|
|
442
436
|
});
|
|
443
437
|
|
|
444
|
-
var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
438
|
+
var ActiveIndicator = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n position: absolute;\n bottom: 0;\n left: ", ";\n width: ", ";\n height: ", ";\n background-color: ", ";\n &[aria-disabled=\"true\"] {\n background-color: ", ";\n display: none;\n }\n"])), function (props) {
|
|
445
439
|
return "".concat(props.tabLeft, "px");
|
|
446
440
|
}, function (props) {
|
|
447
441
|
return "".concat(props.tabWidth, "px");
|
|
448
|
-
}, function (props) {
|
|
449
|
-
return props.theme.selectedUnderlineColor;
|
|
450
442
|
}, function (props) {
|
|
451
443
|
return props.theme.selectedUnderlineThickness;
|
|
444
|
+
}, function (props) {
|
|
445
|
+
return props.theme.selectedUnderlineColor;
|
|
452
446
|
}, function (props) {
|
|
453
447
|
return props.theme.disabledFontColor;
|
|
454
448
|
});
|
|
455
449
|
|
|
456
|
-
var TabsContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n
|
|
450
|
+
var TabsContent = _styledComponents["default"].div(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n flex: 1 1 auto;\n display: inline-block;\n position: relative;\n white-space: nowrap;\n overflow-x: scroll;\n ::-webkit-scrollbar {\n display: none;\n }\n"])));
|
|
457
451
|
|
|
458
452
|
var TabList = _styledComponents["default"].div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n min-height: ", "px;\n"])), function (props) {
|
|
459
453
|
return props.minHeightTabs;
|
package/tabs/Tabs.stories.tsx
CHANGED
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import DxcTabs from "./Tabs";
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
5
6
|
|
|
6
7
|
export default {
|
|
7
8
|
title: "Tabs",
|
|
@@ -9,9 +10,8 @@ export default {
|
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
const iconSVG = (
|
|
12
|
-
<svg viewBox="0 0
|
|
13
|
-
<path d="
|
|
14
|
-
<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" />
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20" fill="currentColor">
|
|
14
|
+
<path d="m10 17-1.042-.938q-2.083-1.854-3.437-3.177-1.354-1.323-2.136-2.354Q2.604 9.5 2.302 8.646 2 7.792 2 6.896q0-1.854 1.271-3.125T6.396 2.5q1.021 0 1.979.438.958.437 1.625 1.229.667-.792 1.625-1.229.958-.438 1.979-.438 1.854 0 3.125 1.271T18 6.896q0 .896-.292 1.729-.291.833-1.073 1.854-.781 1.021-2.145 2.365-1.365 1.344-3.49 3.26Zm0-2.021q1.938-1.729 3.188-2.948 1.25-1.219 1.989-2.125.74-.906 1.031-1.614.292-.709.292-1.396 0-1.229-.833-2.063Q14.833 4 13.604 4q-.729 0-1.364.302-.636.302-1.094.844L10.417 6h-.834l-.729-.854q-.458-.542-1.114-.844Q7.083 4 6.396 4q-1.229 0-2.063.833-.833.834-.833 2.063 0 .687.271 1.364.271.678.989 1.573.719.896 1.98 2.125Q8 13.188 10 14.979Zm0-5.5Z" />
|
|
15
15
|
</svg>
|
|
16
16
|
);
|
|
17
17
|
|
|
@@ -74,10 +74,20 @@ const tabsNotification = tabs.map((tab, index) => ({
|
|
|
74
74
|
notificationNumber: (index === 0 && true) || (index === 1 && 5) || (index === 2 && 200),
|
|
75
75
|
}));
|
|
76
76
|
|
|
77
|
-
const tabsIcon = tabs.map((tab) =>
|
|
77
|
+
const tabsIcon = tabs.map((tab, index) =>
|
|
78
|
+
index <= tabs.length / 2
|
|
79
|
+
? { ...tab, icon: "https://cdn-icons-png.flaticon.com/512/5039/5039041.png" }
|
|
80
|
+
: { ...tab, icon: iconSVG }
|
|
81
|
+
);
|
|
78
82
|
|
|
79
83
|
const tabsNotificationIcon = tabsNotification.map((tab) => ({ ...tab, icon: iconSVG }));
|
|
80
84
|
|
|
85
|
+
const opinionatedTheme = {
|
|
86
|
+
tabs: {
|
|
87
|
+
baseColor: "#5f249f",
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
81
91
|
export const Chromatic = () => (
|
|
82
92
|
<>
|
|
83
93
|
<ExampleContainer>
|
|
@@ -152,7 +162,37 @@ export const Chromatic = () => (
|
|
|
152
162
|
<ExampleContainer>
|
|
153
163
|
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
154
164
|
<DxcTabs tabs={tabs} margin="xxlarge" />
|
|
155
|
-
|
|
165
|
+
</ExampleContainer>
|
|
166
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
167
|
+
<ExampleContainer>
|
|
168
|
+
<Title title="With icon and notification" theme="light" level={4} />
|
|
169
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
170
|
+
<DxcTabs tabs={tabsNotificationIcon} />
|
|
171
|
+
</HalstackProvider>
|
|
172
|
+
</ExampleContainer>
|
|
173
|
+
<ExampleContainer>
|
|
174
|
+
<Title title="Disabled" theme="light" level={4} />
|
|
175
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
176
|
+
<DxcTabs activeTabIndex={0} tabs={disabledTabs} />
|
|
177
|
+
</HalstackProvider>
|
|
178
|
+
</ExampleContainer>
|
|
179
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
180
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
181
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
182
|
+
<DxcTabs tabs={tabs} />
|
|
183
|
+
</HalstackProvider>
|
|
184
|
+
</ExampleContainer>
|
|
185
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
186
|
+
<Title title="Focused" theme="light" level={4} />
|
|
187
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
188
|
+
<DxcTabs tabs={tabs} />
|
|
189
|
+
</HalstackProvider>
|
|
190
|
+
</ExampleContainer>
|
|
191
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
192
|
+
<Title title="Actived" theme="light" level={4} />
|
|
193
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
194
|
+
<DxcTabs tabs={tabs} />
|
|
195
|
+
</HalstackProvider>
|
|
156
196
|
</ExampleContainer>
|
|
157
197
|
</>
|
|
158
198
|
);
|
package/tabs/Tabs.test.js
CHANGED
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _Tabs = _interopRequireDefault(require("./Tabs"));
|
|
9
|
+
var _Tabs = _interopRequireDefault(require("./Tabs.tsx"));
|
|
10
10
|
|
|
11
11
|
var sampleTabs = [{
|
|
12
12
|
label: "Tab-1"
|
|
@@ -17,13 +17,13 @@ var sampleTabs = [{
|
|
|
17
17
|
}];
|
|
18
18
|
var sampleTabsWithBadge = [{
|
|
19
19
|
label: "Tab-1",
|
|
20
|
-
notificationNumber:
|
|
20
|
+
notificationNumber: 10
|
|
21
21
|
}, {
|
|
22
22
|
label: "Tab-2",
|
|
23
|
-
notificationNumber:
|
|
23
|
+
notificationNumber: 20
|
|
24
24
|
}, {
|
|
25
25
|
label: "Tab-3",
|
|
26
|
-
notificationNumber:
|
|
26
|
+
notificationNumber: 101
|
|
27
27
|
}];
|
|
28
28
|
var sampleTabsMiddleDisabled = [{
|
|
29
29
|
label: "Tab-1"
|
|
@@ -149,7 +149,6 @@ describe("Tabs component tests", function () {
|
|
|
149
149
|
onTabClick: onTabClick,
|
|
150
150
|
activeTabIndex: 0
|
|
151
151
|
})),
|
|
152
|
-
getByText = _render7.getByText,
|
|
153
152
|
getAllByRole = _render7.getAllByRole;
|
|
154
153
|
|
|
155
154
|
var tabs = getAllByRole("tab");
|
package/tabs/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
declare type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
package/tag/Tag.js
CHANGED
|
@@ -19,11 +19,11 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
19
|
|
|
20
20
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
21
21
|
|
|
22
|
-
var _variables = require("../common/variables
|
|
22
|
+
var _variables = require("../common/variables");
|
|
23
23
|
|
|
24
24
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
25
|
|
|
26
|
-
var _utils = require("../common/utils
|
|
26
|
+
var _utils = require("../common/utils");
|
|
27
27
|
|
|
28
28
|
var _Box = _interopRequireDefault(require("../box/Box"));
|
|
29
29
|
|
|
@@ -64,9 +64,7 @@ var DxcTag = function DxcTag(_ref) {
|
|
|
64
64
|
var tagContent = /*#__PURE__*/_react["default"].createElement(_Box["default"], {
|
|
65
65
|
size: size,
|
|
66
66
|
shadowDepth: isHovered && (onClick || linkHref) && 2 || 1
|
|
67
|
-
}, /*#__PURE__*/_react["default"].createElement(TagContent, {
|
|
68
|
-
labelPosition: labelPosition
|
|
69
|
-
}, labelPosition === "before" && size !== "small" && label && /*#__PURE__*/_react["default"].createElement(TagLabel, null, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement(TagContent, null, labelPosition === "before" && size !== "small" && label && /*#__PURE__*/_react["default"].createElement(TagLabel, null, label), icon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
70
68
|
iconBgColor: iconBgColor
|
|
71
69
|
}, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(TagIcon, {
|
|
72
70
|
src: icon
|
|
@@ -114,16 +112,16 @@ var StyledDxcTag = _styledComponents["default"].div(_templateObject || (_templat
|
|
|
114
112
|
return margin && (0, _typeof2["default"])(margin) !== "object" ? _variables.spaces[margin] : "0px";
|
|
115
113
|
}, function (_ref4) {
|
|
116
114
|
var margin = _ref4.margin;
|
|
117
|
-
return margin && margin.top ? _variables.spaces[margin.top] : "";
|
|
115
|
+
return margin && (0, _typeof2["default"])(margin) === "object" && margin.top ? _variables.spaces[margin.top] : "";
|
|
118
116
|
}, function (_ref5) {
|
|
119
117
|
var margin = _ref5.margin;
|
|
120
|
-
return margin && margin.right ? _variables.spaces[margin.right] : "";
|
|
118
|
+
return margin && (0, _typeof2["default"])(margin) === "object" && margin.right ? _variables.spaces[margin.right] : "";
|
|
121
119
|
}, function (_ref6) {
|
|
122
120
|
var margin = _ref6.margin;
|
|
123
|
-
return margin && margin.bottom ? _variables.spaces[margin.bottom] : "";
|
|
121
|
+
return margin && (0, _typeof2["default"])(margin) === "object" && margin.bottom ? _variables.spaces[margin.bottom] : "";
|
|
124
122
|
}, function (_ref7) {
|
|
125
123
|
var margin = _ref7.margin;
|
|
126
|
-
return margin && margin.left ? _variables.spaces[margin.left] : "";
|
|
124
|
+
return margin && (0, _typeof2["default"])(margin) === "object" && margin.left ? _variables.spaces[margin.left] : "";
|
|
127
125
|
}, function (props) {
|
|
128
126
|
return calculateWidth(props.margin, props.size);
|
|
129
127
|
}, function (props) {
|
package/tag/Tag.stories.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { userEvent, within } from "@storybook/testing-library";
|
|
|
3
3
|
import Title from "../../.storybook/components/Title";
|
|
4
4
|
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
5
5
|
import DxcTag from "./Tag";
|
|
6
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
6
7
|
|
|
7
8
|
export default {
|
|
8
9
|
title: "Tag",
|
|
@@ -23,6 +24,13 @@ const largeIcon = (
|
|
|
23
24
|
</svg>
|
|
24
25
|
);
|
|
25
26
|
|
|
27
|
+
const opinionatedTheme = {
|
|
28
|
+
tag: {
|
|
29
|
+
fontColor: "#000000",
|
|
30
|
+
iconColor: "#ffffff",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
26
34
|
export const Chromatic = () => (
|
|
27
35
|
<>
|
|
28
36
|
<ExampleContainer>
|
|
@@ -124,7 +132,12 @@ export const Chromatic = () => (
|
|
|
124
132
|
<Title title="FitContent size" theme="light" level={4} />
|
|
125
133
|
<DxcTag label="FitContent" size="fitContent" icon={icon} />
|
|
126
134
|
</ExampleContainer>
|
|
127
|
-
<
|
|
135
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
136
|
+
<ExampleContainer>
|
|
137
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
138
|
+
<DxcTag label="Tag" icon={icon} />
|
|
139
|
+
</HalstackProvider>
|
|
140
|
+
</ExampleContainer>
|
|
128
141
|
</>
|
|
129
142
|
);
|
|
130
143
|
|
package/tag/Tag.test.js
CHANGED
|
@@ -6,7 +6,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
6
6
|
|
|
7
7
|
var _react2 = require("@testing-library/react");
|
|
8
8
|
|
|
9
|
-
var _Tag = _interopRequireDefault(require("./Tag"));
|
|
9
|
+
var _Tag = _interopRequireDefault(require("./Tag.tsx"));
|
|
10
10
|
|
|
11
11
|
describe("Tag component tests", function () {
|
|
12
12
|
test("Tag renders with correct label", function () {
|
package/text-input/Suggestion.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
@@ -9,12 +11,33 @@ exports["default"] = void 0;
|
|
|
9
11
|
|
|
10
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
13
|
|
|
12
|
-
var _react =
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
13
15
|
|
|
14
16
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
17
|
|
|
16
18
|
var _templateObject, _templateObject2;
|
|
17
19
|
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
|
+
|
|
24
|
+
var transformSpecialChars = function transformSpecialChars(str) {
|
|
25
|
+
var specialCharsRegex = /[\\*()\[\]{}+?/]/;
|
|
26
|
+
var value = str;
|
|
27
|
+
|
|
28
|
+
if (specialCharsRegex.test(value)) {
|
|
29
|
+
var regexAsString = specialCharsRegex.toString().split("");
|
|
30
|
+
var uniqueSpecialChars = regexAsString.filter(function (item, index) {
|
|
31
|
+
return regexAsString.indexOf(item) === index;
|
|
32
|
+
});
|
|
33
|
+
uniqueSpecialChars.forEach(function (specialChar) {
|
|
34
|
+
if (str.includes(specialChar)) value = value.replace(specialChar, "\\" + specialChar);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return value;
|
|
39
|
+
};
|
|
40
|
+
|
|
18
41
|
var Suggestion = function Suggestion(_ref) {
|
|
19
42
|
var id = _ref.id,
|
|
20
43
|
value = _ref.value,
|
|
@@ -23,9 +46,13 @@ var Suggestion = function Suggestion(_ref) {
|
|
|
23
46
|
isLast = _ref.isLast,
|
|
24
47
|
visuallyFocused = _ref.visuallyFocused,
|
|
25
48
|
highlighted = _ref.highlighted;
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
49
|
+
var matchedSuggestion = (0, _react.useMemo)(function () {
|
|
50
|
+
var regEx = new RegExp(transformSpecialChars(value), "i");
|
|
51
|
+
return {
|
|
52
|
+
matchedWords: suggestion.match(regEx),
|
|
53
|
+
noMatchedWords: suggestion.replace(regEx, "")
|
|
54
|
+
};
|
|
55
|
+
}, [value, suggestion]);
|
|
29
56
|
return /*#__PURE__*/_react["default"].createElement(SuggestionContainer, {
|
|
30
57
|
id: id,
|
|
31
58
|
onClick: function onClick() {
|
|
@@ -35,9 +62,9 @@ var Suggestion = function Suggestion(_ref) {
|
|
|
35
62
|
role: "option",
|
|
36
63
|
"aria-selected": visuallyFocused ? true : undefined
|
|
37
64
|
}, /*#__PURE__*/_react["default"].createElement(StyledSuggestion, {
|
|
38
|
-
|
|
65
|
+
isLast: isLast,
|
|
39
66
|
visuallyFocused: visuallyFocused
|
|
40
|
-
}, highlighted ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedWords), noMatchedWords) : suggestion));
|
|
67
|
+
}, highlighted ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("strong", null, matchedSuggestion.matchedWords), matchedSuggestion.noMatchedWords) : suggestion));
|
|
41
68
|
};
|
|
42
69
|
|
|
43
70
|
var SuggestionContainer = _styledComponents["default"].li(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n padding: 0 0.5rem;\n line-height: 1.715em;\n cursor: pointer;\n box-shadow: inset 0 0 0 2px\n ", ";\n\n &:hover {\n background-color: ", ";\n }\n &:active {\n background-color: ", ";\n }\n"])), function (props) {
|
|
@@ -49,7 +76,7 @@ var SuggestionContainer = _styledComponents["default"].li(_templateObject || (_t
|
|
|
49
76
|
});
|
|
50
77
|
|
|
51
78
|
var StyledSuggestion = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n padding: 0.25rem 0.5rem 0.188rem 0.5rem;\n ", ";\n"])), function (props) {
|
|
52
|
-
return props.
|
|
79
|
+
return props.isLast || props.visuallyFocused ? "border-bottom: 1px solid transparent" : "border-bottom: 1px solid ".concat(props.theme.listOptionDividerColor);
|
|
53
80
|
});
|
|
54
81
|
|
|
55
82
|
var _default = /*#__PURE__*/_react["default"].memo(Suggestion);
|
package/text-input/TextInput.js
CHANGED
|
@@ -23,9 +23,9 @@ var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
|
23
23
|
|
|
24
24
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
25
25
|
|
|
26
|
-
var _variables = require("../common/variables
|
|
26
|
+
var _variables = require("../common/variables");
|
|
27
27
|
|
|
28
|
-
var _utils = require("../common/utils
|
|
28
|
+
var _utils = require("../common/utils");
|
|
29
29
|
|
|
30
30
|
var _BackgroundColorContext = _interopRequireDefault(require("../BackgroundColorContext"));
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ var _Icons = _interopRequireDefault(require("./Icons"));
|
|
|
39
39
|
|
|
40
40
|
var _uuid = require("uuid");
|
|
41
41
|
|
|
42
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11
|
|
42
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
43
43
|
|
|
44
44
|
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); }
|
|
45
45
|
|
|
@@ -547,7 +547,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
547
547
|
backgroundType: backgroundType,
|
|
548
548
|
tabIndex: tabIndex,
|
|
549
549
|
type: "button"
|
|
550
|
-
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement(
|
|
550
|
+
}, typeof action.icon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
551
551
|
src: action.icon
|
|
552
552
|
}) : action.icon), suffix && /*#__PURE__*/_react["default"].createElement(Suffix, {
|
|
553
553
|
disabled: disabled,
|
|
@@ -559,7 +559,7 @@ var DxcTextInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref2, re
|
|
|
559
559
|
}, error)));
|
|
560
560
|
});
|
|
561
561
|
|
|
562
|
-
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n
|
|
562
|
+
var TextInputContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n width: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n"])), function (props) {
|
|
563
563
|
return calculateWidth(props.margin, props.size);
|
|
564
564
|
}, function (props) {
|
|
565
565
|
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
@@ -635,11 +635,7 @@ var Input = _styledComponents["default"].input(_templateObject6 || (_templateObj
|
|
|
635
635
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPlaceholderFontColorOnDark : props.theme.disabledPlaceholderFontColor : props.backgroundType === "dark" ? props.theme.placeholderFontColorOnDark : props.theme.placeholderFontColor;
|
|
636
636
|
});
|
|
637
637
|
|
|
638
|
-
var
|
|
639
|
-
|
|
640
|
-
var Action = _styledComponents["default"].button(_templateObject8 || (_templateObject8 = (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 padding: 3px;\n margin-left: 0.25rem;\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n svg {\n line-height: 18px;\n }\n"])), function (props) {
|
|
641
|
-
return props.theme.fontFamily;
|
|
642
|
-
}, function (props) {
|
|
638
|
+
var Action = _styledComponents["default"].button(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n border: 1px solid transparent;\n border-radius: 2px;\n width: 24px;\n height: 24px;\n padding: 3px;\n margin-left: 0.25rem;\n ", "\n\n box-shadow: 0 0 0 2px transparent;\n background-color: ", ";\n\n color: ", ";\n\n ", "\n\n img, svg {\n width: 16px;\n height: 16px;\n }\n"])), function (props) {
|
|
643
639
|
return props.disabled ? "cursor: not-allowed;" : "cursor: pointer;";
|
|
644
640
|
}, function (props) {
|
|
645
641
|
return props.disabled ? props.backgroundType === "dark" ? props.theme.disabledActionBackgroundColorOnDark : props.theme.disabledActionBackgroundColor : props.backgroundType === "dark" ? props.theme.actionBackgroundColorOnDark : props.theme.actionBackgroundColor;
|
|
@@ -649,25 +645,25 @@ var Action = _styledComponents["default"].button(_templateObject8 || (_templateO
|
|
|
649
645
|
return !props.disabled && "\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ".concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:focus-visible {\n outline: none;\n box-shadow: 0 0 0 2px ").concat(props.backgroundType === "dark" ? props.theme.focusActionBorderColorOnDark : props.theme.focusActionBorderColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.focusActionIconColorOnDark : props.theme.focusActionIconColor, ";\n }\n &:hover {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionBackgroundColorOnDark : props.theme.hoverActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.hoverActionIconColorOnDark : props.theme.hoverActionIconColor, ";\n }\n &:active {\n background-color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionBackgroundColorOnDark : props.theme.activeActionBackgroundColor, ";\n color: ").concat(props.backgroundType === "dark" ? props.theme.activeActionIconColorOnDark : props.theme.activeActionIconColor, ";\n }\n ");
|
|
650
646
|
});
|
|
651
647
|
|
|
652
|
-
var Prefix = _styledComponents["default"].span(
|
|
648
|
+
var Prefix = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin-left: 0.25rem;\n padding: 0 0.5rem 0 0;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
|
|
653
649
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledPrefixColorOnDark : props.theme.disabledPrefixColor : props.backgroundType === "dark" ? props.theme.prefixColorOnDark : props.theme.prefixColor;
|
|
654
650
|
return "color: ".concat(color, "; border-right: 1px solid ").concat(color, ";");
|
|
655
651
|
}, function (props) {
|
|
656
652
|
return props.theme.fontFamily;
|
|
657
653
|
});
|
|
658
654
|
|
|
659
|
-
var Suffix = _styledComponents["default"].span(
|
|
655
|
+
var Suffix = _styledComponents["default"].span(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n height: 1.5rem;\n line-height: 1.5rem;\n margin: 0 0.25rem;\n padding: 0 0 0 0.5rem;\n ", ";\n font-family: ", ";\n font-size: 1rem;\n pointer-events: none;\n"])), function (props) {
|
|
660
656
|
var color = props.disabled ? props.backgroundType === "dark" ? props.theme.disabledSuffixColorOnDark : props.theme.disabledSuffixColor : props.backgroundType === "dark" ? props.theme.suffixColorOnDark : props.theme.suffixColor;
|
|
661
657
|
return "color: ".concat(color, "; border-left: 1px solid ").concat(color, ";");
|
|
662
658
|
}, function (props) {
|
|
663
659
|
return props.theme.fontFamily;
|
|
664
660
|
});
|
|
665
661
|
|
|
666
|
-
var ErrorIcon = _styledComponents["default"].span(
|
|
662
|
+
var ErrorIcon = _styledComponents["default"].span(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n align-content: center;\n padding: 3px;\n height: 18px;\n width: 18px;\n margin-left: 0.25rem;\n color: ", ";\n\n svg {\n line-height: 18px;\n font-size: 1.25rem;\n }\n"])), function (props) {
|
|
667
663
|
return props.backgroundType === "dark" ? props.theme.errorIconColorOnDark : props.theme.errorIconColor;
|
|
668
664
|
});
|
|
669
665
|
|
|
670
|
-
var Error = _styledComponents["default"].span(
|
|
666
|
+
var Error = _styledComponents["default"].span(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2["default"])(["\n min-height: 1.5em;\n color: ", ";\n font-family: ", ";\n font-size: 0.75rem;\n font-weight: 400;\n line-height: 1.5em;\n margin-top: 0.25rem;\n"])), function (props) {
|
|
671
667
|
return props.backgroundType === "dark" ? props.theme.errorMessageColorOnDark : props.theme.errorMessageColor;
|
|
672
668
|
}, function (props) {
|
|
673
669
|
return props.theme.fontFamily;
|
|
@@ -11,6 +11,7 @@ import DxcFlex from "../flex/Flex";
|
|
|
11
11
|
import Suggestions from "./Suggestions";
|
|
12
12
|
import { ThemeProvider } from "styled-components";
|
|
13
13
|
import useTheme from "../useTheme";
|
|
14
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
14
15
|
|
|
15
16
|
export default {
|
|
16
17
|
title: "Text input",
|
|
@@ -27,7 +28,7 @@ const action = {
|
|
|
27
28
|
),
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
const
|
|
31
|
+
const actionLargeIconSVG = {
|
|
31
32
|
onClick: () => {},
|
|
32
33
|
icon: (
|
|
33
34
|
<svg xmlns="http://www.w3.org/2000/svg" height="48px" viewBox="0 0 24 24" width="48px" fill="currentColor">
|
|
@@ -37,6 +38,11 @@ const actionLargeIcon = {
|
|
|
37
38
|
),
|
|
38
39
|
};
|
|
39
40
|
|
|
41
|
+
const actionLargeIconURL = {
|
|
42
|
+
onClick: () => {},
|
|
43
|
+
icon: "https://iconape.com/wp-content/files/yd/367773/svg/logo-linkedin-logo-icon-png-svg.png",
|
|
44
|
+
};
|
|
45
|
+
|
|
40
46
|
const country = ["Afghanistan"];
|
|
41
47
|
const countries = [
|
|
42
48
|
"Afghanistan",
|
|
@@ -61,8 +67,16 @@ const countries = [
|
|
|
61
67
|
"Dominica",
|
|
62
68
|
"Denmark",
|
|
63
69
|
"Djibouti",
|
|
70
|
+
"*",
|
|
64
71
|
];
|
|
65
72
|
|
|
73
|
+
const opinionatedTheme = {
|
|
74
|
+
textInput: {
|
|
75
|
+
fontColor: "#000000",
|
|
76
|
+
hoverBorderColor: "#a46ede",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
|
|
66
80
|
export const Chromatic = () => (
|
|
67
81
|
<>
|
|
68
82
|
<ExampleContainer pseudoState="pseudo-hover">
|
|
@@ -98,12 +112,21 @@ export const Chromatic = () => (
|
|
|
98
112
|
<DxcTextInput label="Text input" clearable defaultValue="Text" helperText="Help message" optional />
|
|
99
113
|
</ExampleContainer>
|
|
100
114
|
<ExampleContainer>
|
|
101
|
-
<Title title="Clearable and large icon action" theme="light" level={4} />
|
|
115
|
+
<Title title="Clearable and large icon action (SVG)" theme="light" level={4} />
|
|
102
116
|
<DxcTextInput
|
|
103
117
|
label="Text input"
|
|
104
118
|
defaultValue="Text text text text text text text text text text"
|
|
105
119
|
clearable
|
|
106
|
-
action={
|
|
120
|
+
action={actionLargeIconSVG}
|
|
121
|
+
/>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
<ExampleContainer>
|
|
124
|
+
<Title title="Clearable and large icon action (URL)" theme="light" level={4} />
|
|
125
|
+
<DxcTextInput
|
|
126
|
+
label="Text input"
|
|
127
|
+
defaultValue="Text text text text text text text text text text"
|
|
128
|
+
clearable
|
|
129
|
+
action={actionLargeIconURL}
|
|
107
130
|
/>
|
|
108
131
|
</ExampleContainer>
|
|
109
132
|
<ExampleContainer>
|
|
@@ -297,6 +320,66 @@ export const Chromatic = () => (
|
|
|
297
320
|
<Title title="FillParent size" theme="light" level={4} />
|
|
298
321
|
<DxcTextInput label="FillParent" size="fillParent" />
|
|
299
322
|
</ExampleContainer>
|
|
323
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
324
|
+
<ExampleContainer>
|
|
325
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
326
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
327
|
+
<Title title="Hovered input" theme="light" level={4} />
|
|
328
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
329
|
+
</ExampleContainer>
|
|
330
|
+
<ExampleContainer pseudoState="pseudo-focus-within">
|
|
331
|
+
<Title title="Focused input" theme="light" level={4} />
|
|
332
|
+
<DxcTextInput label="Text input" helperText="Help message" />
|
|
333
|
+
</ExampleContainer>
|
|
334
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
335
|
+
<Title title="Hovered action" theme="light" level={4} />
|
|
336
|
+
<DxcTextInput label="Text input" helperText="Help message" defaultValue="Text" clearable />
|
|
337
|
+
</ExampleContainer>
|
|
338
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
339
|
+
<Title title="Actived action" theme="light" level={4} />
|
|
340
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
341
|
+
</ExampleContainer>
|
|
342
|
+
<ExampleContainer pseudoState="pseudo-focus">
|
|
343
|
+
<Title title="Focused action" theme="light" level={4} />
|
|
344
|
+
<DxcTextInput label="Text input" helperText="Help message" action={action} clearable />
|
|
345
|
+
</ExampleContainer>
|
|
346
|
+
<ExampleContainer>
|
|
347
|
+
<Title title="Prefix" theme="light" level={4} />
|
|
348
|
+
<DxcTextInput label="With prefix" prefix="+34" helperText="Help message" />
|
|
349
|
+
</ExampleContainer>
|
|
350
|
+
<ExampleContainer>
|
|
351
|
+
<Title title="Suffix and action" theme="light" level={4} />
|
|
352
|
+
<DxcTextInput label="With suffix" helperText="Help message" suffix="USD" action={action} />
|
|
353
|
+
</ExampleContainer>
|
|
354
|
+
<ExampleContainer>
|
|
355
|
+
<Title title="Invalid" theme="light" level={4} />
|
|
356
|
+
<DxcTextInput
|
|
357
|
+
label="Error text input"
|
|
358
|
+
helperText="Help message"
|
|
359
|
+
error="Error message."
|
|
360
|
+
defaultValue="Text"
|
|
361
|
+
clearable
|
|
362
|
+
optional
|
|
363
|
+
action={action}
|
|
364
|
+
/>
|
|
365
|
+
</ExampleContainer>
|
|
366
|
+
<ExampleContainer>
|
|
367
|
+
<Title title="Disabled and placeholder" theme="light" level={4} />
|
|
368
|
+
<DxcTextInput label="Disabled text input" disabled placeholder="Placeholder" prefix="+34" suffix="USD" />
|
|
369
|
+
</ExampleContainer>
|
|
370
|
+
<ExampleContainer>
|
|
371
|
+
<Title title="Disabled, helper text, optional, value and action" theme="light" level={4} />
|
|
372
|
+
<DxcTextInput
|
|
373
|
+
label="Disabled text input"
|
|
374
|
+
helperText="Help message"
|
|
375
|
+
disabled
|
|
376
|
+
optional
|
|
377
|
+
defaultValue="Text"
|
|
378
|
+
action={action}
|
|
379
|
+
/>
|
|
380
|
+
</ExampleContainer>
|
|
381
|
+
</HalstackProvider>
|
|
382
|
+
</ExampleContainer>
|
|
300
383
|
</>
|
|
301
384
|
);
|
|
302
385
|
|
|
@@ -308,7 +391,11 @@ const AutosuggestListbox = () => {
|
|
|
308
391
|
<ExampleContainer>
|
|
309
392
|
<Title title="Autosuggest listbox" theme="light" level={2} />
|
|
310
393
|
<ExampleContainer>
|
|
311
|
-
<Title
|
|
394
|
+
<Title
|
|
395
|
+
title="List dialog uses a Radix Popover to appear over elements with a certain z-index"
|
|
396
|
+
theme="light"
|
|
397
|
+
level={3}
|
|
398
|
+
/>
|
|
312
399
|
<div
|
|
313
400
|
style={{
|
|
314
401
|
display: "flex",
|
|
@@ -322,6 +409,7 @@ const AutosuggestListbox = () => {
|
|
|
322
409
|
borderRadius: "4px",
|
|
323
410
|
overflow: "auto",
|
|
324
411
|
zIndex: "1300",
|
|
412
|
+
position: "relative",
|
|
325
413
|
}}
|
|
326
414
|
>
|
|
327
415
|
<DxcTextInput
|