orcs-design-system 3.2.36 → 3.2.39
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/es/assets/Colour/index.js +1 -1
- package/es/components/ActionsMenu/index.js +48 -39
- package/es/components/ActionsMenu/useActionMenu.js +2 -2
- package/es/components/Avatar/index.js +5 -5
- package/es/components/Badge/index.js +1 -1
- package/es/components/Button/index.js +5 -5
- package/es/components/ButtonGroup/index.js +1 -1
- package/es/components/Checkbox/index.js +3 -3
- package/es/components/DatePicker/index.js +2 -2
- package/es/components/Divider/index.js +1 -1
- package/es/components/Header/Header.stories.js +6 -6
- package/es/components/Header/index.js +2 -2
- package/es/components/HeaderSimple/HeaderSimple.stories.js +2 -2
- package/es/components/Icon/index.js +1 -1
- package/es/components/Modal/Modal.stories.js +226 -4
- package/es/components/Modal/index.js +1 -1
- package/es/components/Popover/index.js +45 -25
- package/es/components/ProgressBar/index.js +2 -2
- package/es/components/RadioButton/index.js +2 -2
- package/es/components/Range/index.js +17 -2
- package/es/components/Select/index.js +11 -12
- package/es/components/SideNav/SideNav.stories.js +22 -33
- package/es/components/SideNav/index.js +9 -30
- package/es/components/Sidebar/index.js +1 -1
- package/es/components/StyledLink/StyledLink.stories.js +3 -4
- package/es/components/Table/Table.stories.js +2 -2
- package/es/components/Table/getExpandColumnConfig.js +5 -5
- package/es/components/Table/muiStyleOverrides.js +1 -2
- package/es/components/Tabs/index.js +3 -3
- package/es/components/Tag/index.js +4 -4
- package/es/components/TextArea/index.js +2 -2
- package/es/components/TextInput/index.js +11 -11
- package/es/components.test.js +72 -1
- package/es/systemThemeCollapsed.js +9 -9
- package/es/systemtheme.js +9 -9
- package/es/utils/floatingUiHelpers.js +3 -8
- package/package.json +18 -13
|
@@ -47,7 +47,43 @@ export const basicModal = () => /*#__PURE__*/_jsx(Basic, {});
|
|
|
47
47
|
basicModal.parameters = {
|
|
48
48
|
docs: {
|
|
49
49
|
source: {
|
|
50
|
-
code:
|
|
50
|
+
code: `
|
|
51
|
+
const Basic = () => {
|
|
52
|
+
const [visible, setVisible] = useState(false);
|
|
53
|
+
|
|
54
|
+
const handleOnButtonClick = () => {
|
|
55
|
+
setVisible(true);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const handleOnConfirm = () => {
|
|
59
|
+
setVisible(false);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const onToggleModal = (visible) => () => {
|
|
63
|
+
setVisible(visible);
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<Button onClick={handleOnButtonClick}>
|
|
69
|
+
Open basic modal
|
|
70
|
+
</Button>
|
|
71
|
+
<Modal
|
|
72
|
+
ariaLabel="Modal Title"
|
|
73
|
+
visible={visible}
|
|
74
|
+
handleOnConfirm={handleOnConfirm}
|
|
75
|
+
onClose={onToggleModal(false)}
|
|
76
|
+
>
|
|
77
|
+
<Spacer mb="r">
|
|
78
|
+
<H3>Modal Title</H3>
|
|
79
|
+
<P>
|
|
80
|
+
Content of the modal. Modal accepts any child components or content.
|
|
81
|
+
</P>
|
|
82
|
+
</Spacer>
|
|
83
|
+
</Modal>
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
};`
|
|
51
87
|
}
|
|
52
88
|
}
|
|
53
89
|
};
|
|
@@ -100,7 +136,80 @@ export const advancedModal = () => /*#__PURE__*/_jsx(Advanced, {});
|
|
|
100
136
|
advancedModal.parameters = {
|
|
101
137
|
docs: {
|
|
102
138
|
source: {
|
|
103
|
-
code:
|
|
139
|
+
code: `
|
|
140
|
+
const Advanced = () => {
|
|
141
|
+
const [visible, setVisible] = useState(false);
|
|
142
|
+
|
|
143
|
+
const handleOnButtonClick = () => {
|
|
144
|
+
setVisible(true);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const handleOnConfirm = () => {
|
|
148
|
+
setVisible(false);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const onToggleModal = (visible) => () => {
|
|
152
|
+
setVisible(visible);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const modalHeader = <H3>Modal Title</H3>;
|
|
156
|
+
|
|
157
|
+
const modalFooter = (
|
|
158
|
+
<Button onClick={handleOnConfirm}>Go to full article</Button>
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<>
|
|
163
|
+
<Button onClick={handleOnButtonClick}>
|
|
164
|
+
Open advanced modal
|
|
165
|
+
</Button>
|
|
166
|
+
<Modal
|
|
167
|
+
maxWidth="500px"
|
|
168
|
+
maxHeight="400px"
|
|
169
|
+
height="90vh"
|
|
170
|
+
width="90vw"
|
|
171
|
+
visible={visible}
|
|
172
|
+
handleOnConfirm={handleOnConfirm}
|
|
173
|
+
onClose={onToggleModal(false)}
|
|
174
|
+
headerContent={modalHeader}
|
|
175
|
+
footerContent={modalFooter}
|
|
176
|
+
>
|
|
177
|
+
<Spacer my="r">
|
|
178
|
+
<P>
|
|
179
|
+
Content of the modal. Modal accepts any child components or content.
|
|
180
|
+
This content will be scrollable if it exeeds the height of the
|
|
181
|
+
modal.
|
|
182
|
+
</P>
|
|
183
|
+
<P>
|
|
184
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do
|
|
185
|
+
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim
|
|
186
|
+
ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
|
|
187
|
+
aliquip ex ea commodo consequat. Duis aute irure dolor in
|
|
188
|
+
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
|
|
189
|
+
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
|
|
190
|
+
culpa qui officia deserunt mollit anim id est laborum.
|
|
191
|
+
</P>
|
|
192
|
+
<P>
|
|
193
|
+
Sed ut perspiciatis unde omnis iste natus error sit voluptatem
|
|
194
|
+
accusantium doloremque laudantium, totam rem aperiam, eaque ipsa
|
|
195
|
+
quae ab illo inventore veritatis et quasi architecto beatae vitae
|
|
196
|
+
dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit
|
|
197
|
+
aspernatur aut odit aut fugit, sed quia consequuntur magni dolores
|
|
198
|
+
eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est,
|
|
199
|
+
qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit,
|
|
200
|
+
sed quia non numquam eius modi tempora incidunt ut labore et dolore
|
|
201
|
+
magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis
|
|
202
|
+
nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut
|
|
203
|
+
aliquid ex ea commodi consequatur? Quis autem vel eum iure
|
|
204
|
+
reprehenderit qui in ea voluptate velit esse quam nihil molestiae
|
|
205
|
+
consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla
|
|
206
|
+
pariatur?
|
|
207
|
+
</P>
|
|
208
|
+
</Spacer>
|
|
209
|
+
</Modal>
|
|
210
|
+
</>
|
|
211
|
+
);
|
|
212
|
+
};`
|
|
104
213
|
}
|
|
105
214
|
}
|
|
106
215
|
};
|
|
@@ -159,7 +268,61 @@ export const basicDialogueModal = () => /*#__PURE__*/_jsx(BasicDialogue, {});
|
|
|
159
268
|
basicDialogueModal.parameters = {
|
|
160
269
|
docs: {
|
|
161
270
|
source: {
|
|
162
|
-
code:
|
|
271
|
+
code: `
|
|
272
|
+
const BasicDialogue = () => {
|
|
273
|
+
const [visible, setVisible] = useState(false);
|
|
274
|
+
|
|
275
|
+
const handleOnButtonClick = () => {
|
|
276
|
+
setVisible(true);
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
const handleOnConfirm = () => {
|
|
280
|
+
setVisible(false);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const onToggleModal = (visible) => () => {
|
|
284
|
+
setVisible(visible);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const modalFooter = (
|
|
288
|
+
<Flex>
|
|
289
|
+
<Spacer mr="s">
|
|
290
|
+
<Button onClick={handleOnConfirm} px="l">
|
|
291
|
+
OK
|
|
292
|
+
</Button>
|
|
293
|
+
<Button variant="ghost" onClick={onToggleModal(false)}>
|
|
294
|
+
Cancel
|
|
295
|
+
</Button>
|
|
296
|
+
</Spacer>
|
|
297
|
+
</Flex>
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
return (
|
|
301
|
+
<>
|
|
302
|
+
<Button
|
|
303
|
+
onClick={handleOnButtonClick}
|
|
304
|
+
variant="danger"
|
|
305
|
+
iconLeft
|
|
306
|
+
>
|
|
307
|
+
<Icon icon={["fas", "trash"]} />
|
|
308
|
+
Delete data
|
|
309
|
+
</Button>
|
|
310
|
+
<Modal
|
|
311
|
+
visible={visible}
|
|
312
|
+
handleOnConfirm={handleOnConfirm}
|
|
313
|
+
onClose={onToggleModal(false)}
|
|
314
|
+
footerContent={modalFooter}
|
|
315
|
+
>
|
|
316
|
+
<Spacer mb="r">
|
|
317
|
+
<P weight="bold" marginBottom="sm">
|
|
318
|
+
This will remove all data from the application.
|
|
319
|
+
</P>
|
|
320
|
+
<P>Do you wish to continue?</P>
|
|
321
|
+
</Spacer>
|
|
322
|
+
</Modal>
|
|
323
|
+
</>
|
|
324
|
+
);
|
|
325
|
+
};`
|
|
163
326
|
}
|
|
164
327
|
}
|
|
165
328
|
};
|
|
@@ -231,7 +394,66 @@ export const editDialogueModal = () => /*#__PURE__*/_jsx(EditDialogue, {});
|
|
|
231
394
|
editDialogueModal.parameters = {
|
|
232
395
|
docs: {
|
|
233
396
|
source: {
|
|
234
|
-
code:
|
|
397
|
+
code: `
|
|
398
|
+
const EditDialogue = () => {
|
|
399
|
+
const [visible, setVisible] = useState(false);
|
|
400
|
+
|
|
401
|
+
const handleOnButtonClick = () => {
|
|
402
|
+
setVisible(true);
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
const handleOnConfirm = () => {
|
|
406
|
+
setVisible(false);
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
const onToggleModal = (visible) => () => {
|
|
410
|
+
setVisible(visible);
|
|
411
|
+
};
|
|
412
|
+
|
|
413
|
+
const modalHeader = <H3>Modify Details</H3>;
|
|
414
|
+
|
|
415
|
+
const modalFooter = (
|
|
416
|
+
<Flex>
|
|
417
|
+
<Spacer mr="s">
|
|
418
|
+
<Button onClick={handleOnConfirm} variant="success" iconLeft>
|
|
419
|
+
<Icon icon={["fas", "save"]} />
|
|
420
|
+
Save
|
|
421
|
+
</Button>
|
|
422
|
+
<Button variant="ghost" onClick={onToggleModal(false)} iconLeft>
|
|
423
|
+
<Icon icon={["fas", "times"]} />
|
|
424
|
+
Cancel
|
|
425
|
+
</Button>
|
|
426
|
+
</Spacer>
|
|
427
|
+
</Flex>
|
|
428
|
+
);
|
|
429
|
+
return (
|
|
430
|
+
<>
|
|
431
|
+
<Button onClick={handleOnButtonClick} iconLeft>
|
|
432
|
+
<Icon icon={["fas", "edit"]} />
|
|
433
|
+
Modify Details
|
|
434
|
+
</Button>
|
|
435
|
+
<Modal
|
|
436
|
+
visible={visible}
|
|
437
|
+
handleOnConfirm={handleOnConfirm}
|
|
438
|
+
onClose={onToggleModal(false)}
|
|
439
|
+
headerContent={modalHeader}
|
|
440
|
+
footerContent={modalFooter}
|
|
441
|
+
>
|
|
442
|
+
<Spacer my="r">
|
|
443
|
+
<TextInput
|
|
444
|
+
id="textInput1"
|
|
445
|
+
key="textInput1"
|
|
446
|
+
type="text"
|
|
447
|
+
fullWidth
|
|
448
|
+
label="Name"
|
|
449
|
+
placeholder="E.g. Awesome Project"
|
|
450
|
+
/>
|
|
451
|
+
<TextArea id="TextArea01" label="Description" fullWidth />
|
|
452
|
+
</Spacer>
|
|
453
|
+
</Modal>
|
|
454
|
+
</>
|
|
455
|
+
);
|
|
456
|
+
};`
|
|
235
457
|
}
|
|
236
458
|
}
|
|
237
459
|
};
|
|
@@ -81,7 +81,7 @@ const Modal = _ref => {
|
|
|
81
81
|
}, [restProps.ariaLabel, headerContent]);
|
|
82
82
|
const focusLastActiveElement = useCallback(() => {
|
|
83
83
|
if (!lastActiveElement) return;
|
|
84
|
-
if (lastActiveElement
|
|
84
|
+
if (lastActiveElement?.dataset.actionMenuId && isHidden(lastActiveElement?.parentNode)) {
|
|
85
85
|
const actionMenu = document.getElementById(lastActiveElement.dataset.actionMenuId);
|
|
86
86
|
actionMenu.focus();
|
|
87
87
|
} else {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
1
|
+
import React, { useState, useMemo } from "react";
|
|
2
2
|
import { useFloating, autoUpdate, offset, flip, shift, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingPortal, safePolygon, FloatingFocusManager } from "@floating-ui/react";
|
|
3
3
|
import themeGet from "@styled-system/theme-get";
|
|
4
4
|
import styled from "styled-components";
|
|
@@ -28,9 +28,8 @@ const TooltipControl = styled.div.withConfig({
|
|
|
28
28
|
const StyledPopover = styled.div.withConfig({
|
|
29
29
|
displayName: "Popover__StyledPopover",
|
|
30
30
|
componentId: "sc-1bwoak-2"
|
|
31
|
-
})(["font-size:", ";line-height:", ";font-weight:", ";text-align:", ";word-break:break-word;color:", ";outline:0;padding:", ";border-radius:", ";width:", ";background:", ";border:1px solid ", ";box-shadow:", ";user-select:", ";pointer-events:none;opacity:0;visibility:hidden
|
|
31
|
+
})(["font-size:", ";line-height:", ";font-weight:", ";text-align:", ";word-break:break-word;color:", ";outline:0;padding:", ";border-radius:", ";width:", ";background:", ";border:1px solid ", ";box-shadow:", ";user-select:", ";&.hack-for-legacy-tests{position:absolute;pointer-events:none;opacity:0;visibility:hidden;height:0;width:0;padding:0;overflow:hidden;}&.visible{opacity:1;pointer-events:auto;visibility:visible;}& a{font-size:", ";}&:before{content:\"\";z-index:2;height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;border-color:transparent;border-right-color:", ";left:-6px;top:50%;margin-top:-6px;position:absolute;}&:after{content:\"\";z-index:1;position:absolute;border-color:transparent;border-right-color:", ";height:0;width:0;border-style:solid;border-width:6px 6px 6px 0;left:-7px;top:50%;margin-top:-6px;}&.top{&:before{left:50%;top:auto;margin-top:0;bottom:-9px;margin-left:-3px;transform:rotate(-90deg);}&:after{left:50%;top:auto;margin-top:0;bottom:-10px;margin-left:-3px;transform:rotate(-90deg);}}&.topRight,&.top-end{&:before{left:1px;top:auto;margin-top:0;bottom:-5px;margin-left:-6px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}&:after{left:1px;top:auto;margin-top:0;bottom:-6px;margin-left:-7px;transform:rotate(-45deg);border-width:5px 10px 5px 0;}}&.bottomRight,&.bottom-end{&:before{left:1px;bottom:auto;margin-top:0;top:-5px;margin-left:-6px;transform:rotate(45deg);border-width:5px 10px 5px 0;}&:after{left:1px;bottom:auto;margin-top:0;top:-6px;margin-left:-7px;transform:rotate(45deg);border-width:5px 10px 5px 0;}}&.bottom{&:before{left:50%;top:-9px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}&:after{left:50%;top:-10px;margin-top:0;margin-left:-3px;transform:rotate(90deg);}}&.bottomLeft,&.bottom-start{&:before{right:1px;left:auto;bottom:auto;margin-top:0;top:-5px;margin-right:-6px;transform:rotate(135deg);border-width:5px 10px 5px 0;}&:after{right:1px;left:auto;bottom:auto;margin-top:0;top:-6px;margin-right:-7px;transform:rotate(135deg);border-width:5px 10px 5px 0;}}&.left{&:before{left:auto;right:-6px;transform:rotate(180deg);}&:after{left:auto;right:-7px;transform:rotate(180deg);top:50%;margin-top:-6px;}}&.topLeft,&.top-start{&:before{right:1px;left:auto;top:auto;margin-top:0;bottom:-5px;margin-right:-6px;transform:rotate(225deg);border-width:5px 10px 5px 0;}&:after{right:1px;left:auto;top:auto;margin-top:0;bottom:-6px;margin-right:-7px;transform:rotate(225deg);border-width:5px 10px 5px 0;}}"], themeGet("fontSizes.0"), themeGet("fontSizes.1"), themeGet("fontWeights.1"), props => props.textAlign ? props.textAlign : "left", themeGet("colors.greyDarkest"), themeGet("space.3"), themeGet("radii.1"), props => props.width ? props.width : "200px", themeGet("colors.white"), themeGet("colors.greyLight"), themeGet("shadows.boxDefault"), props => props.enableSelectAll ? "all" : "auto", themeGet("fontSizes.0"), themeGet("colors.white"), themeGet("colors.greyMid"));
|
|
32
32
|
export default function Popover(_ref) {
|
|
33
|
-
var _refs$floating;
|
|
34
33
|
let {
|
|
35
34
|
children,
|
|
36
35
|
direction = "right",
|
|
@@ -82,28 +81,23 @@ export default function Popover(_ref) {
|
|
|
82
81
|
getReferenceProps,
|
|
83
82
|
getFloatingProps
|
|
84
83
|
} = useInteractions([hover, focus, dismiss, role]);
|
|
85
|
-
const triggerProps = {
|
|
84
|
+
const triggerProps = useMemo(() => ({
|
|
86
85
|
...getReferenceProps({
|
|
87
86
|
ref: refs.setReference
|
|
88
87
|
}),
|
|
89
88
|
tabIndex: "0"
|
|
90
|
-
};
|
|
91
|
-
const directionClass = context.placement === DIRECTIONS_MAP[direction] ? direction : context.placement;
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
...getFloatingProps(),
|
|
103
|
-
ariaLabel: ariaLabel,
|
|
104
|
-
children: text
|
|
105
|
-
});
|
|
106
|
-
const containsLinks = (_refs$floating = refs.floating) === null || _refs$floating === void 0 || (_refs$floating = _refs$floating.current) === null || _refs$floating === void 0 ? void 0 : _refs$floating.querySelectorAll("a").length;
|
|
89
|
+
}), [getReferenceProps, refs.setReference]);
|
|
90
|
+
const directionClass = useMemo(() => context.placement === DIRECTIONS_MAP[direction] ? direction : context.placement, [context.placement, direction]);
|
|
91
|
+
const style = useMemo(() => ({
|
|
92
|
+
...floatingStyles,
|
|
93
|
+
zIndex: getFloatingUiZIndex(context.refs.reference)
|
|
94
|
+
}), [floatingStyles, context.refs.reference]);
|
|
95
|
+
const containsLinks = refs.floating?.current?.querySelectorAll("a").length;
|
|
96
|
+
const visiblePopoverClassName = useMemo(() => `Tooltip popover visible ${directionClass}`, [directionClass]);
|
|
97
|
+
const floatingProps = useMemo(() => getFloatingProps({
|
|
98
|
+
...props,
|
|
99
|
+
className: `${props.className} ${visiblePopoverClassName}`
|
|
100
|
+
}), [getFloatingProps, props, visiblePopoverClassName]);
|
|
107
101
|
return /*#__PURE__*/_jsxs(Container, {
|
|
108
102
|
inlineBlock: inlineBlock,
|
|
109
103
|
...props,
|
|
@@ -124,16 +118,42 @@ export default function Popover(_ref) {
|
|
|
124
118
|
context: context,
|
|
125
119
|
modal: false,
|
|
126
120
|
initialFocus: isRenderedInReactSelectMenu(context.refs.reference) && -1,
|
|
127
|
-
children:
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
children: /*#__PURE__*/_jsx(StyledPopover, {
|
|
122
|
+
className: visiblePopoverClassName,
|
|
123
|
+
ref: refs.setFloating,
|
|
124
|
+
textAlign: textAlign,
|
|
125
|
+
width: width,
|
|
126
|
+
enableSelectAll: enableSelectAll,
|
|
127
|
+
ariaLabel: ariaLabel,
|
|
128
|
+
style: style,
|
|
129
|
+
...floatingProps,
|
|
130
|
+
children: text
|
|
131
|
+
})
|
|
132
|
+
}) : /*#__PURE__*/_jsx(StyledPopover, {
|
|
133
|
+
className: visiblePopoverClassName,
|
|
134
|
+
ref: refs.setFloating,
|
|
135
|
+
textAlign: textAlign,
|
|
136
|
+
width: width,
|
|
137
|
+
enableSelectAll: enableSelectAll,
|
|
138
|
+
ariaLabel: ariaLabel,
|
|
139
|
+
style: style,
|
|
140
|
+
...floatingProps,
|
|
141
|
+
children: text
|
|
142
|
+
})
|
|
143
|
+
}) :
|
|
144
|
+
/*#__PURE__*/
|
|
130
145
|
/*
|
|
131
146
|
* HACK: Fixing all the broken tests in teamform-app-ui is too time consuming
|
|
132
147
|
* right this moment with a lot of the tests asserting against Popover items.
|
|
133
148
|
* Rendering the markup even when closed but in a hidden state ensures that tests pass.
|
|
134
149
|
* Ideally, we would update all the tests in teamform-app-ui to open the Popover
|
|
135
150
|
* before assertion.
|
|
136
|
-
**/
|
|
151
|
+
**/
|
|
152
|
+
_jsx(StyledPopover, {
|
|
153
|
+
ariaLabel: ariaLabel,
|
|
154
|
+
className: "Tooltip popover hack-for-legacy-tests",
|
|
155
|
+
children: text
|
|
156
|
+
})), children]
|
|
137
157
|
});
|
|
138
158
|
}
|
|
139
159
|
Popover.propTypes = {
|
|
@@ -17,8 +17,8 @@ const Fill = styled.div.withConfig({
|
|
|
17
17
|
const sixPxInPercentage = 6 / props.containerWidthPx * 100;
|
|
18
18
|
const minPixelValue = 1; // Minimum pixel value for visibility
|
|
19
19
|
const minPercentageValue = minPixelValue / props.containerWidthPx * 100;
|
|
20
|
-
const calculatedWidth =
|
|
21
|
-
return
|
|
20
|
+
const calculatedWidth = `calc(${props.fillWidth}% - ${sixPxInPercentage}%)`;
|
|
21
|
+
return `max(${calculatedWidth}, ${minPercentageValue}%)`;
|
|
22
22
|
}
|
|
23
23
|
return "0";
|
|
24
24
|
}, expandWidth, props => themeGet("transition.transitionDefault")(props), props => props.gradient ? css(["background:linear-gradient( to right,", " 0%,", " 50%,", " 100% );"], themeGet("colors.danger")(props), themeGet("colors.warning")(props), themeGet("colors.success")(props)) : css(["background:", ";"], themeGet("colors.primary")(props)));
|
|
@@ -208,10 +208,10 @@ RadioButton.propTypes = {
|
|
|
208
208
|
// ariaLabel prop must be specified if label is not provided
|
|
209
209
|
ariaLabel: (props, propName) => {
|
|
210
210
|
if (!props.label && (props[propName] == null || props[propName] === "")) {
|
|
211
|
-
return new Error(
|
|
211
|
+
return new Error(`Missing prop \`${propName}\` not specified for Radio component. When \`label\` is not provided, \`${propName}\` is required.`);
|
|
212
212
|
}
|
|
213
213
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
214
|
-
return new Error(
|
|
214
|
+
return new Error(`Invalid propType \`${propName}\` supplied to Radio component. Expected \`string\`, received \`${typeof props[propName]}\`.`);
|
|
215
215
|
}
|
|
216
216
|
return null;
|
|
217
217
|
},
|
|
@@ -8,8 +8,23 @@ const vars = {
|
|
|
8
8
|
trackHeight: "4px",
|
|
9
9
|
thumbDiameter: "20px"
|
|
10
10
|
};
|
|
11
|
-
const thumb = props =>
|
|
12
|
-
|
|
11
|
+
const thumb = props => `
|
|
12
|
+
margin-top: -8px;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
border: none;
|
|
15
|
+
width: ${vars.thumbDiameter};
|
|
16
|
+
height: ${vars.thumbDiameter};
|
|
17
|
+
border-radius: ${vars.thumbDiameter};
|
|
18
|
+
background: ${themeGet("colors.primary")(props)};
|
|
19
|
+
`;
|
|
20
|
+
const track = props => `
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
border: none;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: ${vars.trackHeight};
|
|
25
|
+
background: ${themeGet("colors.greyLight")(props)};
|
|
26
|
+
border-radius: 4px;
|
|
27
|
+
`;
|
|
13
28
|
const Wrapper = styled.div.withConfig({
|
|
14
29
|
displayName: "Range__Wrapper",
|
|
15
30
|
componentId: "sc-zb0zps-0"
|
|
@@ -44,7 +44,7 @@ const MultiValueRemove = props => {
|
|
|
44
44
|
...props,
|
|
45
45
|
innerProps: {
|
|
46
46
|
...innerProps,
|
|
47
|
-
"aria-label":
|
|
47
|
+
"aria-label": `Remove ${data.label}`
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
};
|
|
@@ -75,7 +75,6 @@ const SELECT_TYPES = {
|
|
|
75
75
|
*
|
|
76
76
|
*/
|
|
77
77
|
const Select = /*#__PURE__*/forwardRef((props, ref) => {
|
|
78
|
-
var _SELECT_TYPES$props$s;
|
|
79
78
|
const theme = useTheme();
|
|
80
79
|
const inputRef = useInputFocus(ref, props.focus);
|
|
81
80
|
const {
|
|
@@ -180,11 +179,11 @@ const Select = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
180
179
|
theme
|
|
181
180
|
}),
|
|
182
181
|
overflow: "hidden",
|
|
183
|
-
border:
|
|
182
|
+
border: `1px solid ${props.invalid ? themeGet("colors.danger")({
|
|
184
183
|
theme
|
|
185
184
|
}) : themeGet("colors.black30")({
|
|
186
185
|
theme
|
|
187
|
-
})
|
|
186
|
+
})}`
|
|
188
187
|
}),
|
|
189
188
|
container: (provided, state) => ({
|
|
190
189
|
...provided,
|
|
@@ -301,9 +300,9 @@ const Select = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
301
300
|
color: themeGet("colors.white")({
|
|
302
301
|
theme
|
|
303
302
|
}),
|
|
304
|
-
borderLeft:
|
|
303
|
+
borderLeft: `solid 1px ${themeGet("colors.primaryDark")({
|
|
305
304
|
theme
|
|
306
|
-
})
|
|
305
|
+
})}`,
|
|
307
306
|
padding: "6.5px 6px 6.5px 5px",
|
|
308
307
|
display: state.data.isFixed ? "none" : provided.display,
|
|
309
308
|
cursor: "pointer",
|
|
@@ -353,9 +352,9 @@ const Select = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
353
352
|
});
|
|
354
353
|
const components = {
|
|
355
354
|
MultiValueRemove,
|
|
356
|
-
...(
|
|
355
|
+
...(props?.components || {})
|
|
357
356
|
};
|
|
358
|
-
const SelectComponent =
|
|
357
|
+
const SelectComponent = SELECT_TYPES[props?.selectType] ?? SELECT_TYPES.default;
|
|
359
358
|
const component = /*#__PURE__*/_jsxs(Wrapper, {
|
|
360
359
|
inverted: props.inverted,
|
|
361
360
|
"data-testid": props["data-testid"],
|
|
@@ -397,10 +396,10 @@ Select.propTypes = {
|
|
|
397
396
|
// ariaLabel prop must be specified if label is not provided
|
|
398
397
|
ariaLabel: (props, propName) => {
|
|
399
398
|
if (!props.label && (props[propName] == null || props[propName] === "")) {
|
|
400
|
-
return new Error(
|
|
399
|
+
return new Error(`Missing prop \`${propName}\` not specified for Select component. When \`label\` is not provided, \`${propName}\` is required.`);
|
|
401
400
|
}
|
|
402
401
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
403
|
-
return new Error(
|
|
402
|
+
return new Error(`Invalid propType \`${propName}\` supplied to Select component. Expected \`string\`, received \`${typeof props[propName]}\`.`);
|
|
404
403
|
}
|
|
405
404
|
return null;
|
|
406
405
|
},
|
|
@@ -411,10 +410,10 @@ Select.propTypes = {
|
|
|
411
410
|
/** Specifies the ID for the rendered Select box. If you use the label prop label will automatically point to this ID, so this is required. */
|
|
412
411
|
inputId: (props, propName) => {
|
|
413
412
|
if (props.label && (props[propName] == null || props[propName] === "")) {
|
|
414
|
-
return new Error(
|
|
413
|
+
return new Error(`Missing prop \`${propName}\` not specified for Select component. When \`label\` is provided, \`${propName}\` is required.`);
|
|
415
414
|
}
|
|
416
415
|
if (props[propName] && typeof props[propName] !== "string") {
|
|
417
|
-
return new Error(
|
|
416
|
+
return new Error(`Invalid propType \`${propName}\` supplied to Select component. Expected \`string\`, received \`${typeof props[propName]}\`.`);
|
|
418
417
|
}
|
|
419
418
|
return null;
|
|
420
419
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react/prop-types */
|
|
2
2
|
import React from "react";
|
|
3
3
|
import SideNav from "./index";
|
|
4
|
-
import { BrowserRouter as Router, Route, Link,
|
|
4
|
+
import { BrowserRouter as Router, Route, Link, Routes, useParams, useMatch, Navigate } from "react-router-dom";
|
|
5
5
|
import { H5, P } from "../Typography";
|
|
6
6
|
import Box from "../Box";
|
|
7
7
|
import { far } from "@fortawesome/free-regular-svg-icons";
|
|
@@ -59,59 +59,46 @@ const PageCard = _ref2 => {
|
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
const SideBarWithConfig = () => {
|
|
62
|
-
const
|
|
62
|
+
const isHome = useMatch("/");
|
|
63
|
+
const isProfile = useMatch("/profile");
|
|
64
|
+
const isSearch = useMatch("/search");
|
|
63
65
|
const items = [{
|
|
64
66
|
iconName: "building",
|
|
65
67
|
name: "Home",
|
|
66
68
|
component: makeLinkComponent("/"),
|
|
67
69
|
actionType: "link",
|
|
68
|
-
isActive:
|
|
69
|
-
path: "/",
|
|
70
|
-
exact: true
|
|
71
|
-
})
|
|
70
|
+
isActive: !!isHome
|
|
72
71
|
}, {
|
|
73
72
|
iconName: "user",
|
|
74
73
|
name: "My profile",
|
|
75
74
|
component: makeLinkComponent("/profile"),
|
|
76
75
|
actionType: "link",
|
|
77
|
-
isActive:
|
|
78
|
-
path: "/profile"
|
|
79
|
-
})
|
|
76
|
+
isActive: !!isProfile
|
|
80
77
|
}, {
|
|
81
78
|
iconName: "id-card",
|
|
82
79
|
name: "Search Page",
|
|
83
80
|
component: makeLinkComponent("/search"),
|
|
84
81
|
actionType: "link",
|
|
85
|
-
isActive:
|
|
86
|
-
path: "/search"
|
|
87
|
-
})
|
|
82
|
+
isActive: isSearch
|
|
88
83
|
}, {
|
|
89
84
|
iconName: "snowflake",
|
|
90
85
|
name: "Filter",
|
|
91
|
-
hide: !
|
|
92
|
-
path: "/search"
|
|
93
|
-
}),
|
|
86
|
+
hide: !isSearch,
|
|
94
87
|
// Specify hide if you want to hide this item
|
|
95
88
|
component: makePanelComponent("Filter"),
|
|
96
89
|
actionType: "component",
|
|
97
90
|
// Use 'component' for a component
|
|
98
|
-
pageSpecific:
|
|
99
|
-
path: "/search"
|
|
100
|
-
}),
|
|
91
|
+
pageSpecific: isSearch,
|
|
101
92
|
isExpandedByDefault: true
|
|
102
93
|
}, {
|
|
103
94
|
iconName: "sun",
|
|
104
95
|
name: "People",
|
|
105
|
-
hide: !
|
|
106
|
-
path: "/profile"
|
|
107
|
-
}),
|
|
96
|
+
hide: !isProfile,
|
|
108
97
|
// Specify hide if you want to hide this item
|
|
109
98
|
component: makePanelComponent("People"),
|
|
110
99
|
actionType: "component",
|
|
111
100
|
// Use 'component' for a component
|
|
112
|
-
pageSpecific:
|
|
113
|
-
path: "/profile"
|
|
114
|
-
}),
|
|
101
|
+
pageSpecific: isProfile,
|
|
115
102
|
isExpandedByDefault: true
|
|
116
103
|
}, {
|
|
117
104
|
iconName: "bell",
|
|
@@ -128,7 +115,7 @@ const SideBarWithConfig = () => {
|
|
|
128
115
|
component: makePanelComponent("BrowseTeams", /*#__PURE__*/_jsx(Flex, {
|
|
129
116
|
flexDirection: "column",
|
|
130
117
|
children: ["Team 1", "Team 2", "Team 3"].map(team => /*#__PURE__*/_jsx(Link, {
|
|
131
|
-
to:
|
|
118
|
+
to: `/teams/${team}`,
|
|
132
119
|
children: team
|
|
133
120
|
}, team))
|
|
134
121
|
})),
|
|
@@ -172,30 +159,32 @@ const SideBarWithConfig = () => {
|
|
|
172
159
|
children: [/*#__PURE__*/_jsx(SideNav, {
|
|
173
160
|
items: items,
|
|
174
161
|
sideNavHeight: "500px"
|
|
175
|
-
}), /*#__PURE__*/_jsxs(
|
|
162
|
+
}), /*#__PURE__*/_jsxs(Routes, {
|
|
176
163
|
children: [/*#__PURE__*/_jsx(Route, {
|
|
177
|
-
exact: true,
|
|
178
164
|
path: "/",
|
|
179
|
-
|
|
165
|
+
element: /*#__PURE__*/_jsx(PageCard, {
|
|
180
166
|
children: /*#__PURE__*/_jsx("div", {
|
|
181
167
|
children: "Home"
|
|
182
168
|
})
|
|
183
169
|
})
|
|
184
170
|
}), /*#__PURE__*/_jsx(Route, {
|
|
185
171
|
path: "/profile",
|
|
186
|
-
|
|
172
|
+
element: /*#__PURE__*/_jsx(PageCard, {
|
|
187
173
|
children: /*#__PURE__*/_jsx("div", {
|
|
188
174
|
children: "Profile route"
|
|
189
175
|
})
|
|
190
176
|
})
|
|
191
177
|
}), /*#__PURE__*/_jsx(Route, {
|
|
192
178
|
path: "/teams/:teamId",
|
|
193
|
-
|
|
179
|
+
element: /*#__PURE__*/_jsx(PageCard, {
|
|
194
180
|
children: /*#__PURE__*/_jsx(Teams, {})
|
|
195
181
|
})
|
|
196
|
-
}), /*#__PURE__*/_jsx(
|
|
197
|
-
|
|
198
|
-
|
|
182
|
+
}), /*#__PURE__*/_jsx(Route, {
|
|
183
|
+
path: "/iframe.html",
|
|
184
|
+
element: /*#__PURE__*/_jsx(Navigate, {
|
|
185
|
+
to: "/",
|
|
186
|
+
replace: true
|
|
187
|
+
})
|
|
199
188
|
})]
|
|
200
189
|
})]
|
|
201
190
|
});
|