@dxc-technology/halstack-react 0.0.0-ec7b867 → 0.0.0-ecc45e2
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.d.ts +12 -0
- package/HalstackContext.js +295 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +7 -28
- package/accordion/Accordion.stories.tsx +12 -12
- package/accordion/Accordion.test.js +72 -0
- package/accordion/types.d.ts +5 -1
- package/accordion-group/AccordionGroup.d.ts +1 -1
- package/accordion-group/AccordionGroup.js +14 -15
- package/accordion-group/AccordionGroup.stories.tsx +1 -1
- package/accordion-group/AccordionGroup.test.js +151 -0
- package/accordion-group/types.d.ts +5 -1
- package/alert/Alert.js +4 -1
- package/alert/Alert.test.js +92 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +5 -3
- package/badge/types.d.ts +5 -0
- package/{list → badge}/types.js +0 -0
- package/bleed/Bleed.js +1 -34
- package/bleed/Bleed.stories.tsx +94 -95
- package/bleed/types.d.ts +25 -1
- package/box/Box.js +22 -32
- package/box/Box.test.js +18 -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/{radio → bulleted-list}/types.js +0 -0
- package/button/Button.js +53 -68
- package/button/Button.stories.tsx +9 -0
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +7 -7
- package/card/Card.js +24 -27
- package/card/Card.test.js +50 -0
- package/checkbox/Checkbox.d.ts +1 -1
- package/checkbox/Checkbox.js +43 -39
- package/checkbox/Checkbox.stories.tsx +124 -128
- package/checkbox/Checkbox.test.js +78 -0
- package/checkbox/types.d.ts +7 -3
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +1 -1
- package/common/variables.js +229 -336
- package/date-input/DateInput.js +56 -42
- package/date-input/DateInput.stories.tsx +7 -7
- package/date-input/DateInput.test.js +479 -0
- package/date-input/types.d.ts +16 -9
- package/dialog/Dialog.js +46 -50
- package/dialog/Dialog.stories.tsx +1 -2
- package/dialog/Dialog.test.js +70 -0
- package/dialog/types.d.ts +2 -2
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +242 -250
- package/dropdown/Dropdown.stories.tsx +126 -63
- package/dropdown/Dropdown.test.js +591 -0
- 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.js +9 -6
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.js +7 -5
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +21 -0
- package/{row → flex}/types.js +0 -0
- package/footer/Footer.js +15 -88
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.js +1 -1
- package/footer/types.d.ts +1 -1
- package/header/Header.js +95 -114
- package/header/Header.stories.tsx +46 -36
- package/header/Header.test.js +79 -0
- package/header/Icons.js +2 -2
- package/header/types.d.ts +2 -2
- package/heading/Heading.test.js +186 -0
- package/inset/Inset.js +1 -34
- package/inset/Inset.stories.tsx +36 -36
- package/inset/types.d.ts +25 -1
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +71 -131
- package/layout/ApplicationLayout.stories.tsx +83 -93
- package/layout/Icons.d.ts +5 -0
- package/layout/Icons.js +13 -2
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +18 -33
- package/link/Link.d.ts +3 -2
- package/link/Link.js +57 -74
- package/link/Link.stories.tsx +95 -53
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +7 -23
- package/main.d.ts +10 -15
- package/main.js +48 -82
- package/number-input/NumberInput.js +11 -18
- package/number-input/NumberInput.stories.tsx +5 -5
- package/number-input/NumberInput.test.js +506 -0
- package/number-input/types.d.ts +17 -10
- package/package.json +12 -10
- package/paginator/Paginator.js +17 -38
- package/paginator/Paginator.test.js +308 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.js +7 -4
- package/password-input/PasswordInput.test.js +180 -0
- package/password-input/types.d.ts +14 -11
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +57 -51
- package/progress-bar/ProgressBar.stories.jsx +13 -11
- package/progress-bar/ProgressBar.test.js +110 -0
- package/progress-bar/types.d.ts +3 -4
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +118 -0
- package/quick-nav/QuickNav.stories.tsx +264 -0
- package/quick-nav/types.d.ts +21 -0
- package/{stack → quick-nav}/types.js +0 -0
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +25 -24
- package/radio-group/RadioGroup.js +58 -50
- package/radio-group/RadioGroup.stories.tsx +60 -39
- package/radio-group/RadioGroup.test.js +530 -83
- package/radio-group/types.d.ts +80 -2
- package/resultsetTable/ResultsetTable.test.js +348 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +199 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.js +145 -365
- package/select/Select.stories.tsx +231 -176
- package/select/Select.test.js +2175 -0
- package/select/types.d.ts +52 -12
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +184 -52
- package/sidenav/Sidenav.stories.tsx +154 -156
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +50 -27
- package/slider/Slider.d.ts +1 -1
- package/slider/Slider.js +5 -4
- package/slider/Slider.stories.tsx +8 -8
- package/slider/Slider.test.js +187 -0
- package/slider/types.d.ts +4 -0
- package/spinner/Spinner.js +1 -1
- package/spinner/Spinner.test.js +64 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +127 -55
- package/switch/Switch.stories.tsx +20 -42
- package/switch/Switch.test.js +212 -0
- package/switch/types.d.ts +9 -6
- package/table/Table.test.js +26 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +9 -11
- package/tabs/Tabs.stories.tsx +0 -8
- package/tabs/Tabs.test.js +140 -0
- package/tabs/types.d.ts +5 -1
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +130 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.js +14 -19
- package/tag/Tag.stories.tsx +12 -8
- package/tag/Tag.test.js +60 -0
- package/tag/types.d.ts +1 -1
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +55 -0
- package/text-input/TextInput.js +68 -101
- package/text-input/TextInput.stories.tsx +31 -14
- package/text-input/TextInput.test.js +1712 -0
- package/text-input/types.d.ts +31 -12
- package/textarea/Textarea.js +20 -27
- package/textarea/Textarea.stories.jsx +33 -12
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +18 -11
- package/toggle-group/ToggleGroup.d.ts +1 -1
- package/toggle-group/ToggleGroup.js +5 -4
- package/toggle-group/ToggleGroup.stories.tsx +4 -4
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +9 -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/typography/types.js +5 -0
- package/useTheme.js +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +1 -1
- package/wizard/Wizard.js +58 -54
- package/wizard/Wizard.stories.tsx +33 -24
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +10 -5
- package/ThemeContext.d.ts +0 -15
- package/ThemeContext.js +0 -243
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- package/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- 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 -10
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -9
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
package/select/types.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare type Margin = {
|
|
|
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 OptionGroup = {
|
|
11
11
|
/**
|
|
12
12
|
* Label of the group to be shown in the select's listbox.
|
|
@@ -53,7 +53,7 @@ declare type CommonProps = {
|
|
|
53
53
|
/**
|
|
54
54
|
* An array of objects representing the selectable options.
|
|
55
55
|
*/
|
|
56
|
-
options
|
|
56
|
+
options: Option[] | OptionGroup[];
|
|
57
57
|
/**
|
|
58
58
|
* Helper text to be placed above the select.
|
|
59
59
|
*/
|
|
@@ -79,9 +79,12 @@ declare type CommonProps = {
|
|
|
79
79
|
*/
|
|
80
80
|
searchable?: boolean;
|
|
81
81
|
/**
|
|
82
|
-
* If it is defined
|
|
83
|
-
* the error below the select component.
|
|
84
|
-
*
|
|
82
|
+
* If it is a defined value and also a truthy string, the component will
|
|
83
|
+
* change its appearance, showing the error below the select component.
|
|
84
|
+
* If the defined value is an empty string, it will reserve a space below
|
|
85
|
+
* the component for a future error, but it would not change its look. In
|
|
86
|
+
* case of being undefined or null, both the appearance and the space for
|
|
87
|
+
* the error message would not be modified.
|
|
85
88
|
*/
|
|
86
89
|
error?: string;
|
|
87
90
|
/**
|
|
@@ -105,6 +108,10 @@ declare type SingleSelect = CommonProps & {
|
|
|
105
108
|
* option value.
|
|
106
109
|
*/
|
|
107
110
|
multiple?: false;
|
|
111
|
+
/**
|
|
112
|
+
* Initial value of the select, only when it is uncontrolled.
|
|
113
|
+
*/
|
|
114
|
+
defaultValue?: string;
|
|
108
115
|
/**
|
|
109
116
|
* Value of the select. If undefined, the component will be uncontrolled
|
|
110
117
|
* and the value will be managed internally by the component.
|
|
@@ -113,21 +120,21 @@ declare type SingleSelect = CommonProps & {
|
|
|
113
120
|
/**
|
|
114
121
|
* This function will be called when the user selects an option.
|
|
115
122
|
* An object including the current value and the error (if the value entered is not valid)
|
|
116
|
-
* will be passed to this function. If there is no error, error will be
|
|
123
|
+
* will be passed to this function. If there is no error, error will not be defined.
|
|
117
124
|
*/
|
|
118
125
|
onChange?: (val: {
|
|
119
126
|
value: string;
|
|
120
|
-
error
|
|
127
|
+
error?: string;
|
|
121
128
|
}) => void;
|
|
122
129
|
/**
|
|
123
130
|
* This function will be called when the select loses the focus. An
|
|
124
131
|
* object including the value and the error (if the value
|
|
125
132
|
* selected is not valid) will be passed to this function. If there is no error,
|
|
126
|
-
* error will be
|
|
133
|
+
* error will not be defined.
|
|
127
134
|
*/
|
|
128
135
|
onBlur?: (val: {
|
|
129
136
|
value: string;
|
|
130
|
-
error
|
|
137
|
+
error?: string;
|
|
131
138
|
}) => void;
|
|
132
139
|
};
|
|
133
140
|
declare type MultipleSelect = CommonProps & {
|
|
@@ -137,6 +144,10 @@ declare type MultipleSelect = CommonProps & {
|
|
|
137
144
|
* option value.
|
|
138
145
|
*/
|
|
139
146
|
multiple: true;
|
|
147
|
+
/**
|
|
148
|
+
* Initial value of the select, only when it is uncontrolled.
|
|
149
|
+
*/
|
|
150
|
+
defaultValue?: string[];
|
|
140
151
|
/**
|
|
141
152
|
* Value of the select. If undefined, the component will be uncontrolled
|
|
142
153
|
* and the value will be managed internally by the component.
|
|
@@ -149,7 +160,7 @@ declare type MultipleSelect = CommonProps & {
|
|
|
149
160
|
*/
|
|
150
161
|
onChange?: (val: {
|
|
151
162
|
value: string[];
|
|
152
|
-
error
|
|
163
|
+
error?: string;
|
|
153
164
|
}) => void;
|
|
154
165
|
/**
|
|
155
166
|
* This function will be called when the select loses the focus. An
|
|
@@ -159,12 +170,41 @@ declare type MultipleSelect = CommonProps & {
|
|
|
159
170
|
*/
|
|
160
171
|
onBlur?: (val: {
|
|
161
172
|
value: string[];
|
|
162
|
-
error
|
|
173
|
+
error?: string;
|
|
163
174
|
}) => void;
|
|
164
175
|
};
|
|
165
176
|
declare type Props = SingleSelect | MultipleSelect;
|
|
166
177
|
/**
|
|
167
|
-
*
|
|
178
|
+
* Single option of the select component.
|
|
179
|
+
*/
|
|
180
|
+
export declare type OptionProps = {
|
|
181
|
+
id: string;
|
|
182
|
+
option: Option;
|
|
183
|
+
onClick: (option: Option) => void;
|
|
184
|
+
multiple: boolean;
|
|
185
|
+
visualFocused: boolean;
|
|
186
|
+
isGroupedOption?: boolean;
|
|
187
|
+
isLastOption: boolean;
|
|
188
|
+
isSelected: boolean;
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Listbox from the select component.
|
|
192
|
+
*/
|
|
193
|
+
export declare type ListboxProps = {
|
|
194
|
+
id: string;
|
|
195
|
+
currentValue: string | string[];
|
|
196
|
+
options: Option[] | OptionGroup[];
|
|
197
|
+
visualFocusIndex: number;
|
|
198
|
+
lastOptionIndex: number;
|
|
199
|
+
multiple: boolean;
|
|
200
|
+
optional: boolean;
|
|
201
|
+
optionalItem: Option;
|
|
202
|
+
searchable: boolean;
|
|
203
|
+
handleOptionOnClick: (option: Option) => void;
|
|
204
|
+
getSelectWidth: () => number;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Reference to the select component.
|
|
168
208
|
*/
|
|
169
209
|
export declare type RefType = HTMLDivElement;
|
|
170
210
|
export default Props;
|
package/sidenav/Sidenav.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import SidenavPropsType, {
|
|
1
|
+
import React from "react";
|
|
2
|
+
import SidenavPropsType, { SidenavGroupPropsType, SidenavLinkPropsType, SidenavSectionPropsType, SidenavTitlePropsType } from "./types.js";
|
|
3
3
|
declare const DxcSidenav: {
|
|
4
|
-
({
|
|
4
|
+
({ children, title }: SidenavPropsType): JSX.Element;
|
|
5
|
+
Section: ({ children }: SidenavSectionPropsType) => JSX.Element;
|
|
6
|
+
Group: ({ children, title, collapsable, icon }: SidenavGroupPropsType) => JSX.Element;
|
|
7
|
+
Link: React.ForwardRefExoticComponent<SidenavLinkPropsType & React.RefAttributes<HTMLAnchorElement>>;
|
|
5
8
|
Title: ({ children }: SidenavTitlePropsType) => JSX.Element;
|
|
6
|
-
Subtitle: ({ children }: SidenavSubtitlePropsType) => JSX.Element;
|
|
7
|
-
Link: ({ tabIndex, href, onClick, children }: SidenavLinkPropsType) => JSX.Element;
|
|
8
9
|
};
|
|
9
10
|
export default DxcSidenav;
|
package/sidenav/Sidenav.js
CHANGED
|
@@ -11,126 +11,258 @@ exports["default"] = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
21
|
|
|
16
22
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
23
|
|
|
18
24
|
var _variables = require("../common/variables.js");
|
|
19
25
|
|
|
26
|
+
var _SidenavContext = require("../layout/SidenavContext");
|
|
27
|
+
|
|
20
28
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
21
29
|
|
|
22
30
|
var _BackgroundColorContext = require("../BackgroundColorContext");
|
|
23
31
|
|
|
24
|
-
var
|
|
32
|
+
var _Flex = _interopRequireDefault(require("../flex/Flex"));
|
|
33
|
+
|
|
34
|
+
var _Bleed = _interopRequireDefault(require("../bleed/Bleed"));
|
|
35
|
+
|
|
36
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
|
|
37
|
+
|
|
38
|
+
var _excluded = ["href", "children", "newWindow", "selected", "icon", "tabIndex", "onClick"];
|
|
25
39
|
|
|
26
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
27
41
|
|
|
28
42
|
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; }
|
|
29
43
|
|
|
44
|
+
var collapsedIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
45
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
46
|
+
height: "24px",
|
|
47
|
+
viewBox: "0 0 24 24",
|
|
48
|
+
width: "24px",
|
|
49
|
+
fill: "currentColor"
|
|
50
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
51
|
+
d: "M0 0h24v24H0z",
|
|
52
|
+
fill: "none"
|
|
53
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
54
|
+
d: "M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"
|
|
55
|
+
}));
|
|
56
|
+
|
|
57
|
+
var collapsableIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
58
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59
|
+
height: "24px",
|
|
60
|
+
viewBox: "0 0 24 24",
|
|
61
|
+
width: "24px",
|
|
62
|
+
fill: "currentColor"
|
|
63
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
64
|
+
d: "M0 0h24v24H0z",
|
|
65
|
+
fill: "none"
|
|
66
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
67
|
+
d: "M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"
|
|
68
|
+
}));
|
|
69
|
+
|
|
70
|
+
var externalLinkIcon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
71
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
72
|
+
height: "24",
|
|
73
|
+
viewBox: "0 0 24 24",
|
|
74
|
+
width: "24",
|
|
75
|
+
fill: "currentColor"
|
|
76
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
77
|
+
d: "M0 0h24v24H0z",
|
|
78
|
+
fill: "none"
|
|
79
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
80
|
+
d: "M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"
|
|
81
|
+
}));
|
|
82
|
+
|
|
30
83
|
var DxcSidenav = function DxcSidenav(_ref) {
|
|
31
|
-
var
|
|
32
|
-
|
|
84
|
+
var children = _ref.children,
|
|
85
|
+
title = _ref.title;
|
|
33
86
|
var colorsTheme = (0, _useTheme["default"])();
|
|
34
87
|
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
35
88
|
theme: colorsTheme.sidenav
|
|
36
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
37
|
-
padding: padding
|
|
38
|
-
}, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
89
|
+
}, /*#__PURE__*/_react["default"].createElement(SidenavContainer, null, /*#__PURE__*/_react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
39
90
|
color: colorsTheme.sidenav.backgroundColor
|
|
40
|
-
},
|
|
91
|
+
}, title, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
92
|
+
direction: "column",
|
|
93
|
+
gap: "1rem"
|
|
94
|
+
}, _react["default"].Children.map(children, function (child, index) {
|
|
95
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, child, index !== _react["default"].Children.count(children) - 1 && /*#__PURE__*/_react["default"].createElement(Divider, null));
|
|
96
|
+
})))));
|
|
41
97
|
};
|
|
42
98
|
|
|
43
99
|
var Title = function Title(_ref2) {
|
|
44
100
|
var children = _ref2.children;
|
|
45
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
101
|
+
return /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
|
|
102
|
+
horizontal: "1rem"
|
|
103
|
+
}, /*#__PURE__*/_react["default"].createElement(SidenavTitle, null, children));
|
|
46
104
|
};
|
|
47
105
|
|
|
48
|
-
var
|
|
106
|
+
var Section = function Section(_ref3) {
|
|
49
107
|
var children = _ref3.children;
|
|
50
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
108
|
+
return /*#__PURE__*/_react["default"].createElement(_Bleed["default"], {
|
|
109
|
+
horizontal: "1rem"
|
|
110
|
+
}, /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
111
|
+
direction: "column"
|
|
112
|
+
}, children));
|
|
51
113
|
};
|
|
52
114
|
|
|
53
|
-
var
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
115
|
+
var Group = function Group(_ref4) {
|
|
116
|
+
var children = _ref4.children,
|
|
117
|
+
title = _ref4.title,
|
|
118
|
+
_ref4$collapsable = _ref4.collapsable,
|
|
119
|
+
collapsable = _ref4$collapsable === void 0 ? false : _ref4$collapsable,
|
|
120
|
+
icon = _ref4.icon;
|
|
121
|
+
|
|
122
|
+
var _useState = (0, _react.useState)(false),
|
|
123
|
+
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
124
|
+
collapsed = _useState2[0],
|
|
125
|
+
setCollapsed = _useState2[1];
|
|
126
|
+
|
|
127
|
+
var selectedGroup = (0, _react.useMemo)(function () {
|
|
128
|
+
return collapsed ? _react["default"].Children.toArray(children).some(function (child) {
|
|
129
|
+
var _child$props;
|
|
130
|
+
|
|
131
|
+
return (_child$props = child["props"]) === null || _child$props === void 0 ? void 0 : _child$props.selected;
|
|
132
|
+
}) : false;
|
|
133
|
+
}, [collapsed, children]);
|
|
134
|
+
return /*#__PURE__*/_react["default"].createElement(SidenavGroup, null, collapsable && title ? /*#__PURE__*/_react["default"].createElement(SidenavGroupTitleButton, {
|
|
135
|
+
role: "button",
|
|
136
|
+
"aria-expanded": !collapsed,
|
|
137
|
+
onClick: function onClick() {
|
|
138
|
+
return setCollapsed(!collapsed);
|
|
139
|
+
},
|
|
140
|
+
selectedGroup: selectedGroup
|
|
141
|
+
}, /*#__PURE__*/_react["default"].createElement(SidenavContent, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(SidenavIcon, {
|
|
142
|
+
src: icon
|
|
143
|
+
}) : icon, title), collapsed ? collapsedIcon : collapsableIcon) : title && /*#__PURE__*/_react["default"].createElement(SidenavGroupTitle, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(SidenavIcon, {
|
|
144
|
+
src: icon
|
|
145
|
+
}) : icon, title), !collapsed && children);
|
|
64
146
|
};
|
|
65
147
|
|
|
66
|
-
var
|
|
148
|
+
var Link = /*#__PURE__*/(0, _react.forwardRef)(function (_ref5, ref) {
|
|
149
|
+
var href = _ref5.href,
|
|
150
|
+
children = _ref5.children,
|
|
151
|
+
_ref5$newWindow = _ref5.newWindow,
|
|
152
|
+
newWindow = _ref5$newWindow === void 0 ? false : _ref5$newWindow,
|
|
153
|
+
_ref5$selected = _ref5.selected,
|
|
154
|
+
selected = _ref5$selected === void 0 ? false : _ref5$selected,
|
|
155
|
+
icon = _ref5.icon,
|
|
156
|
+
_ref5$tabIndex = _ref5.tabIndex,
|
|
157
|
+
tabIndex = _ref5$tabIndex === void 0 ? 0 : _ref5$tabIndex,
|
|
158
|
+
onClick = _ref5.onClick,
|
|
159
|
+
otherProps = (0, _objectWithoutProperties2["default"])(_ref5, _excluded);
|
|
160
|
+
var setIsSidenavVisibleResponsive = (0, _SidenavContext.useResponsiveSidenavVisibility)();
|
|
161
|
+
|
|
162
|
+
var handleClick = function handleClick($event) {
|
|
163
|
+
onClick === null || onClick === void 0 ? void 0 : onClick($event);
|
|
164
|
+
setIsSidenavVisibleResponsive === null || setIsSidenavVisibleResponsive === void 0 ? void 0 : setIsSidenavVisibleResponsive(false);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
return /*#__PURE__*/_react["default"].createElement(SidenavLink, (0, _extends2["default"])({
|
|
168
|
+
selected: selected,
|
|
169
|
+
href: href ? href : undefined,
|
|
170
|
+
target: href ? newWindow ? "_blank" : "_self" : undefined,
|
|
171
|
+
ref: ref,
|
|
172
|
+
tabIndex: tabIndex,
|
|
173
|
+
onClick: handleClick
|
|
174
|
+
}, otherProps), /*#__PURE__*/_react["default"].createElement(SidenavContent, null, typeof icon === "string" ? /*#__PURE__*/_react["default"].createElement(SidenavIcon, {
|
|
175
|
+
src: icon
|
|
176
|
+
}) : icon, children), newWindow && externalLinkIcon);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
var SidenavContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n background-color: ", ";\n box-sizing: border-box;\n width: 280px;\n @media (max-width: ", "rem) {\n width: 100vw;\n }\n\n height: 100%;\n padding: 2rem 1rem;\n\n overflow-y: auto;\n overflow-x: hidden;\n ::-webkit-scrollbar {\n width: 2px;\n }\n ::-webkit-scrollbar-track {\n background-color: ", ";\n border-radius: 3px;\n }\n ::-webkit-scrollbar-thumb {\n background-color: ", ";\n border-radius: 3px;\n }\n"])), function (props) {
|
|
67
180
|
return props.theme.backgroundColor;
|
|
68
|
-
}, function (props) {
|
|
69
|
-
return props.padding ? "calc(300px - ".concat(_variables.spaces[props.padding], " - ").concat(_variables.spaces[props.padding], ")") : "300px";
|
|
70
|
-
}, function (props) {
|
|
71
|
-
return props.padding ? _variables.spaces[props.padding] : "";
|
|
72
|
-
}, function (props) {
|
|
181
|
+
}, _variables.responsiveSizes.medium, function (props) {
|
|
73
182
|
return props.theme.scrollBarTrackColor;
|
|
74
183
|
}, function (props) {
|
|
75
184
|
return props.theme.scrollBarThumbColor;
|
|
76
185
|
});
|
|
77
186
|
|
|
78
|
-
var
|
|
187
|
+
var SidenavTitle = _styledComponents["default"].div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: 27px;\n display: flex;\n align-items: center;\n color: ", ";\n text-transform: ", ";\n letter-spacing: ", ";\n padding: 0.5rem 1.2rem;\n\n svg {\n margin-right: 0.5rem;\n }\n"])), function (props) {
|
|
79
188
|
return props.theme.titleFontFamily;
|
|
80
|
-
}, function (props) {
|
|
81
|
-
return props.theme.titleFontSize;
|
|
82
189
|
}, function (props) {
|
|
83
190
|
return props.theme.titleFontStyle;
|
|
84
191
|
}, function (props) {
|
|
85
192
|
return props.theme.titleFontWeight;
|
|
86
193
|
}, function (props) {
|
|
87
|
-
return props.theme.
|
|
194
|
+
return props.theme.titleFontSize;
|
|
88
195
|
}, function (props) {
|
|
89
|
-
return props.theme.
|
|
196
|
+
return props.theme.titleFontColor;
|
|
90
197
|
}, function (props) {
|
|
91
198
|
return props.theme.titleFontTextTransform;
|
|
199
|
+
}, function (props) {
|
|
200
|
+
return props.theme.titleFontLetterSpacing;
|
|
92
201
|
});
|
|
93
202
|
|
|
94
|
-
var
|
|
95
|
-
|
|
203
|
+
var Divider = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n height: 1px;\n background-color: #999999;\n"])));
|
|
204
|
+
|
|
205
|
+
var SidenavGroup = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n width: 100%;\n a {\n padding: 0.5rem 1.2rem 0.5rem 2.25rem;\n }\n"])));
|
|
206
|
+
|
|
207
|
+
var SidenavGroupTitle = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n svg {\n width: 16px;\n margin-right: 0.5rem;\n }\n box-sizing: border-box;\n width: 100%;\n\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: 18px;\n\n display: flex;\n align-items: center;\n margin: 0px;\n padding: 0.5rem 1.2rem;\n"])), function (props) {
|
|
208
|
+
return props.theme.groupTitleFontFamily;
|
|
96
209
|
}, function (props) {
|
|
97
|
-
return props.theme.
|
|
210
|
+
return props.theme.groupTitleFontStyle;
|
|
98
211
|
}, function (props) {
|
|
99
|
-
return props.theme.
|
|
212
|
+
return props.theme.groupTitleFontWeight;
|
|
100
213
|
}, function (props) {
|
|
101
|
-
return props.theme.
|
|
214
|
+
return props.theme.groupTitleFontSize;
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
var SidenavGroupTitleButton = _styledComponents["default"].button(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n all: unset;\n cursor: pointer;\n justify-content: space-between;\n box-sizing: border-box;\n width: 100%;\n\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: 19px;\n\n display: flex;\n align-items: center;\n margin: 0px;\n padding: 0.5rem 1.2rem;\n &:focus-visible {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n &:hover {\n ", "\n }\n &:active {\n background-color: ", ";\n color: ", ";\n }\n ", "\n svg {\n width: 18px;\n height: auto;\n }\n"])), function (props) {
|
|
218
|
+
return props.theme.groupTitleFontFamily;
|
|
102
219
|
}, function (props) {
|
|
103
|
-
return props.theme.
|
|
220
|
+
return props.theme.groupTitleFontStyle;
|
|
104
221
|
}, function (props) {
|
|
105
|
-
return props.theme.
|
|
222
|
+
return props.theme.groupTitleFontWeight;
|
|
106
223
|
}, function (props) {
|
|
107
|
-
return props.theme.
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
var SideNavMenuLink = _styledComponents["default"].a(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n color: ", ";\n letter-spacing: ", ";\n text-transform: ", ";\n text-decoration: ", ";\n margin: ", ";\n cursor: pointer;\n\n :focus-visible {\n outline: 2px solid ", ";\n outline-offset: 1px;\n }\n"])), function (props) {
|
|
111
|
-
return props.theme.linkFontFamily;
|
|
224
|
+
return props.theme.groupTitleFontSize;
|
|
112
225
|
}, function (props) {
|
|
113
|
-
return props.theme.
|
|
226
|
+
return props.theme.linkFocusColor;
|
|
114
227
|
}, function (props) {
|
|
115
|
-
return props.theme.
|
|
228
|
+
return props.selectedGroup ? "color: ".concat(props.theme.groupTitleSelectedHoverFontColor, "; background: ").concat(props.theme.groupTitleSelectedHoverBackgroundColor, ";") : "color: ".concat(props.theme.groupTitleFontColor, "; background: ").concat(props.theme.groupTitleHoverBackgroundColor, ";");
|
|
116
229
|
}, function (props) {
|
|
117
|
-
return props.theme.
|
|
230
|
+
return props.theme.groupTitleActiveBackgroundColor;
|
|
118
231
|
}, function (props) {
|
|
119
|
-
return props.theme.
|
|
232
|
+
return props.theme.groupTitleFontColor;
|
|
120
233
|
}, function (props) {
|
|
234
|
+
return props.selectedGroup ? "color: ".concat(props.theme.groupTitleSelectedFontColor, "; background: ").concat(props.theme.groupTitleSelectedBackgroundColor, ";") : "color: ".concat(props.theme.groupTitleFontColor, "; background: transparent;");
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
var SidenavLink = _styledComponents["default"].a(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2["default"])(["\n letter-spacing: ", ";\n\n text-transform: ", ";\n text-decoration: ", ";\n\n font-family: ", ";\n font-style: ", ";\n font-weight: ", ";\n font-size: ", ";\n line-height: 19px;\n\n ", "\n\n display: flex;\n align-items: center;\n justify-content: space-between;\n\n box-shadow: 0 0 0 2px transparent;\n\n padding: 0.5rem 1.2rem;\n\n cursor: pointer;\n svg {\n width: 16px;\n margin-right: 0.5rem;\n }\n\n &:hover {\n ", "\n }\n\n &:focus {\n outline: 2px solid ", ";\n outline-offset: -2px;\n }\n\n &:active {\n color: #ffffff;\n background: #4d4d4d;\n outline: 2px solid #0095ff;\n outline-offset: -2px;\n }\n"])), function (props) {
|
|
121
238
|
return props.theme.linkFontLetterSpacing;
|
|
122
239
|
}, function (props) {
|
|
123
240
|
return props.theme.linkFontTextTransform;
|
|
124
241
|
}, function (props) {
|
|
125
242
|
return props.theme.linkTextDecoration;
|
|
126
243
|
}, function (props) {
|
|
127
|
-
return
|
|
244
|
+
return props.theme.linkFontFamily;
|
|
245
|
+
}, function (props) {
|
|
246
|
+
return props.theme.linkFontStyle;
|
|
247
|
+
}, function (props) {
|
|
248
|
+
return props.theme.linkFontWeight;
|
|
249
|
+
}, function (props) {
|
|
250
|
+
return props.theme.linkFontSize;
|
|
251
|
+
}, function (props) {
|
|
252
|
+
return props.selected ? "color: ".concat(props.theme.linkSelectedFontColor, "; background: ").concat(props.theme.linkSelectedBackgroundColor, ";") : "color: ".concat(props.theme.linkFontColor, "; background: transparent;");
|
|
253
|
+
}, function (props) {
|
|
254
|
+
return props.selected ? "color: ".concat(props.theme.linkSelectedHoverFontColor, "; background: ").concat(props.theme.linkSelectedHoverBackgroundColor, ";") : "color: ".concat(props.theme.linkFontColor, "; background: ").concat(props.theme.linkHoverBackgroundColor, ";");
|
|
128
255
|
}, function (props) {
|
|
129
256
|
return props.theme.linkFocusColor;
|
|
130
257
|
});
|
|
131
258
|
|
|
132
|
-
|
|
133
|
-
|
|
259
|
+
var SidenavContent = _styledComponents["default"].span(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n\n svg {\n width: 16px;\n margin-right: 0.5rem;\n }\n"])));
|
|
260
|
+
|
|
261
|
+
var SidenavIcon = _styledComponents["default"].img(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2["default"])(["\n width: 16px;\n margin-right: 0.5rem;\n"])));
|
|
262
|
+
|
|
263
|
+
DxcSidenav.Section = Section;
|
|
264
|
+
DxcSidenav.Group = Group;
|
|
134
265
|
DxcSidenav.Link = Link;
|
|
266
|
+
DxcSidenav.Title = Title;
|
|
135
267
|
var _default = DxcSidenav;
|
|
136
268
|
exports["default"] = _default;
|