@digital-ai/dot-components 1.7.0 → 1.8.0
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/CHANGE_LOG.md +19 -0
- package/dot-components.esm.js +140 -99
- package/dot-components.umd.js +191 -135
- package/lib/components/auto-complete/AutoComplete.d.ts +9 -5
- package/lib/components/auto-complete/AutoComplete.styles.d.ts +2 -0
- package/lib/components/auto-complete/Autocomplete.stories.data.d.ts +16 -0
- package/lib/components/auto-complete/utils/helpers.d.ts +7 -0
- package/lib/components/drawer/Drawer.d.ts +4 -4
- package/lib/components/index.d.ts +2 -1
- package/lib/components/sidebar/Sidebar.stories.data.d.ts +1 -0
- package/lib/components/table/Table.stories.data.d.ts +2 -0
- package/package.json +1 -1
package/CHANGE_LOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.0](https://github.com/digital-ai/dot-components/tree/1.8.0) (02/02/2022)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/digital-ai/dot-components/compare/1.7.0...1.8.0)
|
|
6
|
+
|
|
7
|
+
**Features:**
|
|
8
|
+
|
|
9
|
+
- Add option for autocomplete component [\#956](https://github.com/digital-ai/dot-components/issues/956)
|
|
10
|
+
- S-76952: `AutoComplete`: Add dense prop [\#976](https://github.com/digital-ai/dot-components/pull/976) ([dmiletic85](https://github.com/dmiletic85))
|
|
11
|
+
- S-81503: `Autocomplete` Improve functionality for adding new item [\#957](https://github.com/digital-ai/dot-components/pull/957) ([dmiletic85](https://github.com/dmiletic85))
|
|
12
|
+
|
|
13
|
+
**Fixed bugs:**
|
|
14
|
+
|
|
15
|
+
- D-19722: `Table`: Fix Storybook issues by refactoring Table's story. [\#974](https://github.com/digital-ai/dot-components/pull/974) ([dmiletic85](https://github.com/dmiletic85))
|
|
16
|
+
- D-19713: Do not show alert banner close button if onClose not provided [\#973](https://github.com/digital-ai/dot-components/pull/973) ([selsemore](https://github.com/selsemore))
|
|
17
|
+
|
|
18
|
+
**Merged pull requests:**
|
|
19
|
+
|
|
20
|
+
- S-76846: update to webpack 5 [\#940](https://github.com/digital-ai/dot-components/pull/940) ([CWSites](https://github.com/CWSites))
|
|
21
|
+
|
|
3
22
|
## [1.7.0](https://github.com/digital-ai/dot-components/tree/1.7.0) (01/28/2022)
|
|
4
23
|
|
|
5
24
|
[Full Changelog](https://github.com/digital-ai/dot-components/compare/1.6.2...1.7.0)
|
package/dot-components.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default, { useEffect, useState, Fragment, useRef, useMemo, useContext, createContext } from 'react';
|
|
3
|
-
import { Tooltip, Icon, Typography, Accordion, AccordionSummary, AccordionDetails, Divider, AccordionActions, Toolbar, StylesProvider, MuiThemeProvider, IconButton, Link, Avatar, List, ListItem, CircularProgress, Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Drawer, ListItemIcon, ListItemText, Collapse, ListSubheader, useMediaQuery,
|
|
3
|
+
import { Tooltip, Icon, Typography, Accordion, AccordionSummary, AccordionDetails, Divider, AccordionActions, Toolbar, StylesProvider, MuiThemeProvider, IconButton, Link, Avatar, List, ListItem, CircularProgress, Popper, Grow, Paper, ClickAwayListener, MenuList, MenuItem, Drawer, ListItemIcon, ListItemText, Collapse, ListSubheader, useMediaQuery, InputAdornment, TextField, Button, darken, Chip, Badge, Breadcrumbs, Card, CardContent, CardHeader, FormControlLabel, Checkbox, FormControl, FormGroup, FormLabel, FormHelperText, Dialog, DialogTitle, DialogContent, DialogActions, useTheme, RadioGroup, Radio, Switch, Snackbar, ButtonGroup, TablePagination, TableContainer, TableCell, TableRow, TableBody, TableSortLabel, TableHead, Table, Tabs, Tab } from '@material-ui/core';
|
|
4
4
|
import styled, { css, createGlobalStyle, ThemeProvider, keyframes } from 'styled-components';
|
|
5
5
|
import { Alert, Autocomplete, AvatarGroup, ToggleButtonGroup, ToggleButton, Skeleton } from '@material-ui/lab';
|
|
6
6
|
import { createTheme, alpha } from '@material-ui/core/styles';
|
|
@@ -1024,7 +1024,7 @@ const DotAlertBanner = ({
|
|
|
1024
1024
|
},
|
|
1025
1025
|
"data-testid": dataTestId,
|
|
1026
1026
|
iconMapping: AlertBannerIconMapping,
|
|
1027
|
-
onClose:
|
|
1027
|
+
onClose: onClose,
|
|
1028
1028
|
severity: severity
|
|
1029
1029
|
}, /*#__PURE__*/React__default.createElement(DotTypography, {
|
|
1030
1030
|
variant: _textVariant,
|
|
@@ -1370,7 +1370,7 @@ const StyledPopper = styled(Popper).withConfig({
|
|
|
1370
1370
|
componentId: "sc-134fmqu-0"
|
|
1371
1371
|
})(["", ""], ({
|
|
1372
1372
|
theme
|
|
1373
|
-
}) => css(["&.", "{z-index:", ";}&.", ",&.", "{&.loading .MuiPaper-root{align-items:center;display:flex;justify-content:center;min-height:200px;min-width:200px;}ul,.dot-action-item{background:", ";}ul{box-sizing:content-box;min-width:112px;max-height:calc(100vh - 24px);overflow:auto;.dot-li{min-height:auto;&:hover{background:", ";}&:active,&:focus{background:", ";}}.dot-link{color:", ";}}.dot-action-item{height:", "px;border-top:1px solid ", ";line-height:inherit;button.dot-button{border-radius:", ";justify-content:flex-start;height:100%;margin:0;&:focus-visible{background-color:", ";}.MuiButton-label{gap:", "px;.MuiButton-startIcon{margin-left:0;.dot-icon{flex-shrink:0;}}}}}}"], popperClassName, levelSecond, rootClassName$J, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3)));
|
|
1373
|
+
}) => css(["&.", "{z-index:", ";}&.", ",&.", "{&.loading .MuiPaper-root{align-items:center;display:flex;justify-content:center;min-height:200px;min-width:200px;}ul,.dot-action-item{background:", ";.dot-action-item-text{white-space:nowrap;overflow-x:hidden;text-overflow:ellipsis;}}ul{box-sizing:content-box;min-width:112px;max-height:calc(100vh - 24px);overflow:auto;.dot-li{min-height:auto;&:hover{background:", ";}&:active,&:focus{background:", ";}}.dot-link{color:", ";}}.dot-action-item{height:", "px;border-top:1px solid ", ";line-height:inherit;button.dot-button{border-radius:", ";justify-content:flex-start;height:100%;margin:0;&:focus-visible{background-color:", ";}.MuiButton-label{gap:", "px;.MuiButton-startIcon{margin-left:0;.dot-icon{flex-shrink:0;}}}}}}"], popperClassName, levelSecond, rootClassName$J, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3)));
|
|
1374
1374
|
|
|
1375
1375
|
const MENU_ITEM_HEIGHT_NORMAL = 33;
|
|
1376
1376
|
const MENU_ITEM_HEIGHT_DENSE = 28;
|
|
@@ -1644,6 +1644,8 @@ const DotDrawer = ({
|
|
|
1644
1644
|
}
|
|
1645
1645
|
}, []);
|
|
1646
1646
|
const rootClasses = useStylesWithRootClass(rootClassName$I, className);
|
|
1647
|
+
const headerExists = !!drawerHeaderProps;
|
|
1648
|
+
const bodyTestId = drawerBodyProps ? drawerBodyProps[`data-testid`] : 'drawer-body';
|
|
1647
1649
|
return /*#__PURE__*/React__default.createElement(StyledDrawer, {
|
|
1648
1650
|
ModalProps: ModalProps,
|
|
1649
1651
|
PaperProps: PaperProps,
|
|
@@ -1660,20 +1662,17 @@ const DotDrawer = ({
|
|
|
1660
1662
|
variant: _variant,
|
|
1661
1663
|
width: _width
|
|
1662
1664
|
}, drawerHeaderProps && /*#__PURE__*/React__default.createElement(DotDrawerHeader, {
|
|
1663
|
-
ariaLabel: drawerHeaderProps.ariaLabel,
|
|
1664
1665
|
className: drawerHeaderProps.className,
|
|
1665
1666
|
"data-testid": drawerHeaderProps[`data-testid`],
|
|
1666
1667
|
onClose: onClose,
|
|
1667
1668
|
variant: _variant
|
|
1668
|
-
}, drawerHeaderProps.children),
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
headerExists: drawerHeaderProps ? true : false,
|
|
1669
|
+
}, drawerHeaderProps.children), /*#__PURE__*/React__default.createElement(DotDrawerBody, {
|
|
1670
|
+
className: drawerBodyProps === null || drawerBodyProps === void 0 ? void 0 : drawerBodyProps.className,
|
|
1671
|
+
"data-testid": bodyTestId,
|
|
1672
|
+
headerExists: headerExists,
|
|
1673
1673
|
onClose: onClose,
|
|
1674
1674
|
variant: _variant
|
|
1675
|
-
}, drawerBodyProps.children)
|
|
1676
|
-
ariaLabel: drawerFooterProps.ariaLabel,
|
|
1675
|
+
}, (drawerBodyProps === null || drawerBodyProps === void 0 ? void 0 : drawerBodyProps.children) || children), drawerFooterProps && /*#__PURE__*/React__default.createElement(DotDrawerFooter, {
|
|
1677
1676
|
className: drawerFooterProps.className,
|
|
1678
1677
|
"data-testid": drawerFooterProps[`data-testid`]
|
|
1679
1678
|
}, drawerFooterProps.children));
|
|
@@ -2378,58 +2377,16 @@ const DotAppToolbar = ({
|
|
|
2378
2377
|
};
|
|
2379
2378
|
|
|
2380
2379
|
const rootClassName$C = 'dot-autocomplete';
|
|
2380
|
+
const inputRootClassName = 'dot-input-root';
|
|
2381
|
+
const inputMediumClassName = 'dot-input-medium';
|
|
2381
2382
|
const StyledAutocomplete = styled(Autocomplete).withConfig({
|
|
2382
2383
|
displayName: "AutoCompletestyles__StyledAutocomplete",
|
|
2383
2384
|
componentId: "j2sgjy-0"
|
|
2384
2385
|
})(["", ""], ({
|
|
2385
2386
|
theme
|
|
2386
|
-
}) => css(["&.", "{}"], rootClassName$C));
|
|
2387
|
-
|
|
2388
|
-
const rootClassName$B = 'dot-chip';
|
|
2389
|
-
const StyledChip = styled(Chip).withConfig({
|
|
2390
|
-
displayName: "Chipstyles__StyledChip",
|
|
2391
|
-
componentId: "f1tsra-0"
|
|
2392
|
-
})(["", ""], ({
|
|
2393
|
-
theme
|
|
2394
|
-
}) => css(["&.", "{border-color:", ";.dot-icon i{height:auto;}&.MuiChip-sizeSmall{.dot-icon,.dot-avatar{width:18px;height:18px;}}&.Mui-error{background-color:", ";border-color:", ";.MuiChip-deleteIcon{color:", ";}}&:not(.Mui-error){&:hover{background-color:", ";}.MuiChip-deleteIcon{&:hover{color:", ";}}}.MuiChip-deleteIcon{width:18px;height:18px;color:", ";}}"], rootClassName$B, theme.palette.grey[300], theme.palette.error[50], theme.palette.error.main, theme.palette.error.main, theme.palette.grey[50], theme.palette.grey[400], theme.palette.grey[300]));
|
|
2395
|
-
|
|
2396
|
-
const DotChip = ({
|
|
2397
|
-
ariaLabel,
|
|
2398
|
-
avatar,
|
|
2399
|
-
children,
|
|
2400
|
-
className,
|
|
2401
|
-
'data-testid': dataTestId,
|
|
2402
|
-
disabled: _disabled = false,
|
|
2403
|
-
error: _error = false,
|
|
2404
|
-
isClickable: _isClickable = false,
|
|
2405
|
-
isDeletable: _isDeletable = true,
|
|
2406
|
-
onClick,
|
|
2407
|
-
onDelete,
|
|
2408
|
-
size: _size = 'medium',
|
|
2409
|
-
startIcon
|
|
2410
|
-
}) => {
|
|
2411
|
-
const errorClass = _error ? 'Mui-error' : '';
|
|
2412
|
-
const rootClasses = useStylesWithRootClass(rootClassName$B, className, errorClass);
|
|
2413
|
-
return /*#__PURE__*/React__default.createElement(StyledChip, {
|
|
2414
|
-
"aria-label": ariaLabel,
|
|
2415
|
-
avatar: avatar,
|
|
2416
|
-
classes: {
|
|
2417
|
-
root: rootClasses
|
|
2418
|
-
},
|
|
2419
|
-
clickable: _isClickable,
|
|
2420
|
-
color: "default",
|
|
2421
|
-
"data-testid": dataTestId,
|
|
2422
|
-
disabled: _disabled,
|
|
2423
|
-
icon: avatar ? null : startIcon,
|
|
2424
|
-
label: children,
|
|
2425
|
-
onClick: event => onClick && onClick(event),
|
|
2426
|
-
onDelete: _isDeletable && onDelete ? event => onDelete(event) : undefined,
|
|
2427
|
-
size: _size,
|
|
2428
|
-
variant: "outlined"
|
|
2429
|
-
});
|
|
2430
|
-
};
|
|
2387
|
+
}) => css(["&.", "{.", ".", "{padding-top:", ";padding-bottom:", ";}}"], rootClassName$C, inputRootClassName, inputMediumClassName, theme.spacing(0), theme.spacing(0)));
|
|
2431
2388
|
|
|
2432
|
-
const rootClassName$
|
|
2389
|
+
const rootClassName$B = 'dot-text-field';
|
|
2433
2390
|
const rootSelectClassName = 'dot-select-field';
|
|
2434
2391
|
const warningClassName = 'dot-warning';
|
|
2435
2392
|
const adornmentIconClassName = 'dot-adornment-icon';
|
|
@@ -2443,15 +2400,15 @@ const StyledTextField = styled(TextField).withConfig({
|
|
|
2443
2400
|
})(["", ""], ({
|
|
2444
2401
|
theme,
|
|
2445
2402
|
InputProps
|
|
2446
|
-
}) => css(["&.", "{.MuiInputBase-root{background:", "}.MuiInputBase-input{box-sizing:content-box;}.MuiOutlinedInput-notchedOutline{border-color:", "}.MuiOutlinedInput-input{padding:", ";}.MuiOutlinedInput-inputMarginDense{padding-top:10.5px;padding-bottom:10.5px;}.MuiOutlinedInput-inputMultiline{padding:0;}}&.", ",&.", "{.dot-adornment-icon .dot-icon i{margin-top:-2px;}.MuiFormLabel-root.Mui-focused{color:", "}select.dot-select{background:", ";}.MuiSelect-select:focus{background-color:transparent;}.Mui-error .", "{color:", ";}.MuiSelect-icon{right:", ";}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.MuiInputLabel-outlined.MuiInputLabel-shrink{color:", ";}.", "{color:", ";}}.MuiOutlinedInput-adornedStart{padding-left:12px;}.MuiOutlinedInput-adornedEnd{padding-right:12px;}.MuiFormHelperText-root{font-size:", "px;margin:", ";display:flex;align-items:flex-end;&:not(.Mui-error){color:", ";}}.Mui-focused .MuiOutlinedInput-notchedOutline{border-color:", ";}"], rootClassName$
|
|
2403
|
+
}) => css(["&.", "{.MuiInputBase-root{background:", "}.MuiInputBase-input{box-sizing:content-box;}.MuiOutlinedInput-notchedOutline{border-color:", "}.MuiOutlinedInput-input{padding:", ";}.MuiOutlinedInput-inputMarginDense{padding-top:10.5px;padding-bottom:10.5px;}.MuiOutlinedInput-inputMultiline{padding:0;}}&.", ",&.", "{.dot-adornment-icon .dot-icon i{margin-top:-2px;}.MuiFormLabel-root.Mui-focused{color:", "}select.dot-select{background:", ";}.MuiSelect-select:focus{background-color:transparent;}.Mui-error .", "{color:", ";}.MuiSelect-icon{right:", ";}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.MuiInputLabel-outlined.MuiInputLabel-shrink{color:", ";}.", "{color:", ";}}.MuiOutlinedInput-adornedStart{padding-left:12px;}.MuiOutlinedInput-adornedEnd{padding-right:12px;}.MuiFormHelperText-root{font-size:", "px;margin:", ";display:flex;align-items:flex-end;&:not(.Mui-error){color:", ";}}.Mui-focused .MuiOutlinedInput-notchedOutline{border-color:", ";}"], rootClassName$B, theme.palette.product === 'agility' && theme.palette.layer.n0, theme.palette.product === 'agility' && theme.palette.layer.n100, InputProps.startAdornment ? `18px 12px 18px 0px` : `18px 12px`, rootSelectClassName, rootClassName$B, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.palette.product === 'agility' && theme.palette.layer.n0, adornmentIconClassName, theme.palette.error[500], InputProps.endAdornment ? `44px` : `12px`, warningClassName, theme.palette.warning[500], theme.palette.grey[700], adornmentIconClassName, theme.palette.warning[500], theme.typography.body2.fontSize, theme.spacing(0, 0, 0, 2), theme.palette.grey[700], theme.palette.product === 'agility' && agilityGreen));
|
|
2447
2404
|
|
|
2448
|
-
const rootClassName$
|
|
2405
|
+
const rootClassName$A = 'dot-button';
|
|
2449
2406
|
const StyledButton = styled(Button).withConfig({
|
|
2450
2407
|
displayName: "Buttonstyles__StyledButton",
|
|
2451
2408
|
componentId: "sx99hh-0"
|
|
2452
2409
|
})(["", ""], ({
|
|
2453
2410
|
theme
|
|
2454
|
-
}) => css(["&.", "{margin:", "px;min-width:auto;white-space:nowrap;&.MuiButton-containedPrimary{background-color:", ";}&.MuiButton-containedSecondary{background-color:", ";&:hover,&:active{background-color:", ";}}&.MuiButton-text{padding:6px 16px;}span.dot-icon{padding:0;i{height:auto;}}}"], rootClassName$
|
|
2411
|
+
}) => css(["&.", "{margin:", "px;min-width:auto;white-space:nowrap;&.MuiButton-containedPrimary{background-color:", ";}&.MuiButton-containedSecondary{background-color:", ";&:hover,&:active{background-color:", ";}}&.MuiButton-text{padding:6px 16px;}span.dot-icon{padding:0;i{height:auto;}}}"], rootClassName$A, theme.spacing(0.5), theme.palette.product === 'agility' && agilityGreen, theme.palette.error.main, darken(theme.palette.error.main, 0.2)));
|
|
2455
2412
|
|
|
2456
2413
|
/** This component wraps the Button component from @material-ui. */
|
|
2457
2414
|
|
|
@@ -2475,7 +2432,7 @@ const DotButton = /*#__PURE__*/React__default.forwardRef(({
|
|
|
2475
2432
|
tooltip,
|
|
2476
2433
|
type: _type = 'primary'
|
|
2477
2434
|
}, ref) => {
|
|
2478
|
-
const rootClasses = useStylesWithRootClass(rootClassName$
|
|
2435
|
+
const rootClasses = useStylesWithRootClass(rootClassName$A, className);
|
|
2479
2436
|
let color;
|
|
2480
2437
|
let variant;
|
|
2481
2438
|
|
|
@@ -2530,6 +2487,50 @@ const DotButton = /*#__PURE__*/React__default.forwardRef(({
|
|
|
2530
2487
|
}, children));
|
|
2531
2488
|
});
|
|
2532
2489
|
|
|
2490
|
+
const rootClassName$z = 'dot-chip';
|
|
2491
|
+
const StyledChip = styled(Chip).withConfig({
|
|
2492
|
+
displayName: "Chipstyles__StyledChip",
|
|
2493
|
+
componentId: "f1tsra-0"
|
|
2494
|
+
})(["", ""], ({
|
|
2495
|
+
theme
|
|
2496
|
+
}) => css(["&.", "{border-color:", ";.dot-icon i{height:auto;}&.MuiChip-sizeSmall{.dot-icon,.dot-avatar{width:18px;height:18px;}}&.Mui-error{background-color:", ";border-color:", ";.MuiChip-deleteIcon{color:", ";}}&:not(.Mui-error){&:hover{background-color:", ";}.MuiChip-deleteIcon{&:hover{color:", ";}}}.MuiChip-deleteIcon{width:18px;height:18px;color:", ";}}"], rootClassName$z, theme.palette.grey[300], theme.palette.error[50], theme.palette.error.main, theme.palette.error.main, theme.palette.grey[50], theme.palette.grey[400], theme.palette.grey[300]));
|
|
2497
|
+
|
|
2498
|
+
const DotChip = ({
|
|
2499
|
+
ariaLabel,
|
|
2500
|
+
avatar,
|
|
2501
|
+
children,
|
|
2502
|
+
className,
|
|
2503
|
+
'data-testid': dataTestId,
|
|
2504
|
+
disabled: _disabled = false,
|
|
2505
|
+
error: _error = false,
|
|
2506
|
+
isClickable: _isClickable = false,
|
|
2507
|
+
isDeletable: _isDeletable = true,
|
|
2508
|
+
onClick,
|
|
2509
|
+
onDelete,
|
|
2510
|
+
size: _size = 'medium',
|
|
2511
|
+
startIcon
|
|
2512
|
+
}) => {
|
|
2513
|
+
const errorClass = _error ? 'Mui-error' : '';
|
|
2514
|
+
const rootClasses = useStylesWithRootClass(rootClassName$z, className, errorClass);
|
|
2515
|
+
return /*#__PURE__*/React__default.createElement(StyledChip, {
|
|
2516
|
+
"aria-label": ariaLabel,
|
|
2517
|
+
avatar: avatar,
|
|
2518
|
+
classes: {
|
|
2519
|
+
root: rootClasses
|
|
2520
|
+
},
|
|
2521
|
+
clickable: _isClickable,
|
|
2522
|
+
color: "default",
|
|
2523
|
+
"data-testid": dataTestId,
|
|
2524
|
+
disabled: _disabled,
|
|
2525
|
+
icon: avatar ? null : startIcon,
|
|
2526
|
+
label: children,
|
|
2527
|
+
onClick: event => onClick && onClick(event),
|
|
2528
|
+
onDelete: _isDeletable && onDelete ? event => onDelete(event) : undefined,
|
|
2529
|
+
size: _size,
|
|
2530
|
+
variant: "outlined"
|
|
2531
|
+
});
|
|
2532
|
+
};
|
|
2533
|
+
|
|
2533
2534
|
// parses value and returns a string which is saved to state
|
|
2534
2535
|
|
|
2535
2536
|
const parseAutoCompleteValue = value => {
|
|
@@ -2555,6 +2556,24 @@ const parseAutoCompleteValue = value => {
|
|
|
2555
2556
|
|
|
2556
2557
|
return '';
|
|
2557
2558
|
};
|
|
2559
|
+
const getChipsFromAutocomplete = (values, getTagProps, chipSize = 'medium') => {
|
|
2560
|
+
return values.map((option, index) => {
|
|
2561
|
+
const hasStringValue = isString(option);
|
|
2562
|
+
const optionAsString = option;
|
|
2563
|
+
const optionAsObject = option;
|
|
2564
|
+
const chipError = hasStringValue ? undefined : optionAsObject.error;
|
|
2565
|
+
return /*#__PURE__*/React__default.createElement(DotChip, Object.assign({
|
|
2566
|
+
"data-testid": "dot-autocomplete-chip",
|
|
2567
|
+
error: chipError,
|
|
2568
|
+
size: chipSize
|
|
2569
|
+
}, getTagProps({
|
|
2570
|
+
index
|
|
2571
|
+
})), hasStringValue ? optionAsString : optionAsObject.title);
|
|
2572
|
+
});
|
|
2573
|
+
};
|
|
2574
|
+
const checkIfDuplicateItem = (itemText, autocompleteOptions) => autocompleteOptions.some(autocompleteOption => autocompleteOption.title === itemText);
|
|
2575
|
+
|
|
2576
|
+
const DEFAULT_ACTION_ITEM_TEXT = 'Add new item';
|
|
2558
2577
|
const DotAutoComplete = ({
|
|
2559
2578
|
actionItem,
|
|
2560
2579
|
ariaLabel,
|
|
@@ -2562,6 +2581,7 @@ const DotAutoComplete = ({
|
|
|
2562
2581
|
className,
|
|
2563
2582
|
'data-testid': dataTestId,
|
|
2564
2583
|
defaultValue,
|
|
2584
|
+
dense: _dense = true,
|
|
2565
2585
|
disabled: _disabled = false,
|
|
2566
2586
|
disablePortal: _disablePortal = true,
|
|
2567
2587
|
error: _error = false,
|
|
@@ -2585,9 +2605,18 @@ const DotAutoComplete = ({
|
|
|
2585
2605
|
value
|
|
2586
2606
|
}) => {
|
|
2587
2607
|
const [showPlaceholder, setShowPlaceholder] = useState(!value && !defaultValue);
|
|
2608
|
+
const {
|
|
2609
|
+
iconId: actionIconId = 'add',
|
|
2610
|
+
text: actionItemText,
|
|
2611
|
+
onClick: onActionItemClick,
|
|
2612
|
+
preventDuplicateInsertion
|
|
2613
|
+
} = actionItem || {};
|
|
2614
|
+
const isActionItemDefined = onActionItemClick !== undefined;
|
|
2588
2615
|
const [isOpened, setIsOpened] = useState(false);
|
|
2616
|
+
const [inputText, setInputText] = useState('');
|
|
2589
2617
|
const rootClasses = useStylesWithRootClass(rootClassName$C, className);
|
|
2590
|
-
const textFieldRootClasses = useStylesWithRootClass(rootClassName$
|
|
2618
|
+
const textFieldRootClasses = useStylesWithRootClass(rootClassName$B, className);
|
|
2619
|
+
const inputRootClasses = useStylesWithRootClass(inputRootClassName, _dense ? '' : inputMediumClassName);
|
|
2591
2620
|
let textFieldInput; // Used for focus management while popper is opened
|
|
2592
2621
|
|
|
2593
2622
|
const actionItemRef = useRef();
|
|
@@ -2607,22 +2636,6 @@ const DotAutoComplete = ({
|
|
|
2607
2636
|
}
|
|
2608
2637
|
};
|
|
2609
2638
|
|
|
2610
|
-
const getChips = (values, getTagProps) => {
|
|
2611
|
-
return values.map((option, index) => {
|
|
2612
|
-
if (typeof option === 'string') {
|
|
2613
|
-
return /*#__PURE__*/React__default.createElement(DotChip, Object.assign({}, getTagProps({
|
|
2614
|
-
index
|
|
2615
|
-
})), option);
|
|
2616
|
-
} else {
|
|
2617
|
-
return /*#__PURE__*/React__default.createElement(DotChip, Object.assign({
|
|
2618
|
-
error: option.error
|
|
2619
|
-
}, getTagProps({
|
|
2620
|
-
index
|
|
2621
|
-
})), option.title);
|
|
2622
|
-
}
|
|
2623
|
-
});
|
|
2624
|
-
};
|
|
2625
|
-
|
|
2626
2639
|
const valuesChanged = ({
|
|
2627
2640
|
event,
|
|
2628
2641
|
val,
|
|
@@ -2644,22 +2657,32 @@ const DotAutoComplete = ({
|
|
|
2644
2657
|
|
|
2645
2658
|
|
|
2646
2659
|
const DotPopper = props => {
|
|
2647
|
-
if (!
|
|
2660
|
+
if (!isActionItemDefined) return /*#__PURE__*/React__default.createElement(StyledPopper, Object.assign({}, props, {
|
|
2648
2661
|
className: popperClassName,
|
|
2649
2662
|
disablePortal: _disablePortal
|
|
2650
|
-
}));
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2663
|
+
})); // Disable action if customer explicitly enabled duplicate
|
|
2664
|
+
// item insertion and input text is found inside the 'options'
|
|
2665
|
+
|
|
2666
|
+
const isActionDisabled = preventDuplicateInsertion && checkIfDuplicateItem(inputText, options); // Display warning icon if disabled
|
|
2667
|
+
|
|
2668
|
+
const actionStartIconId = isActionDisabled ? 'warning-solid' : actionIconId;
|
|
2669
|
+
const defaultText = inputText ? `Add "${inputText}"` : DEFAULT_ACTION_ITEM_TEXT;
|
|
2670
|
+
const nonDisabledText = actionItemText ? actionItemText : defaultText;
|
|
2671
|
+
const itemText = isActionDisabled ? 'Value already exists' : nonDisabledText; // If simple text, we need to give it a class so that
|
|
2672
|
+
// styling for displaying ellipsis on a long text
|
|
2673
|
+
// can be applied. If it is custom node coming from the
|
|
2674
|
+
// consumer, then leave it as it is.
|
|
2675
|
+
|
|
2676
|
+
const itemTextNode = isString(itemText) ? /*#__PURE__*/React__default.createElement("span", {
|
|
2677
|
+
className: "dot-action-item-text"
|
|
2678
|
+
}, itemText) : itemText;
|
|
2656
2679
|
const paperProps = props.children.props;
|
|
2657
2680
|
const paperChildren = paperProps.children;
|
|
2658
2681
|
|
|
2659
2682
|
const onActionButtonClick = () => {
|
|
2660
2683
|
setIsOpened(false);
|
|
2661
2684
|
textFieldInput.focus();
|
|
2662
|
-
|
|
2685
|
+
onActionItemClick(inputText);
|
|
2663
2686
|
};
|
|
2664
2687
|
|
|
2665
2688
|
return /*#__PURE__*/React__default.createElement(StyledPopper, Object.assign({}, props, {
|
|
@@ -2684,15 +2707,17 @@ const DotAutoComplete = ({
|
|
|
2684
2707
|
}, /*#__PURE__*/React__default.createElement(DotButton, {
|
|
2685
2708
|
"data-testid": "dot-action-item-btn",
|
|
2686
2709
|
disableRipple: true,
|
|
2710
|
+
disabled: isActionDisabled,
|
|
2687
2711
|
fullWidth: true,
|
|
2688
2712
|
onClick: onActionButtonClick,
|
|
2689
2713
|
ref: actionItemRef,
|
|
2690
2714
|
startIcon: /*#__PURE__*/React__default.createElement(DotIcon, {
|
|
2715
|
+
ariaLabel: actionStartIconId,
|
|
2691
2716
|
fontSize: "small",
|
|
2692
|
-
iconId:
|
|
2717
|
+
iconId: actionStartIconId
|
|
2693
2718
|
}),
|
|
2694
2719
|
type: "text"
|
|
2695
|
-
},
|
|
2720
|
+
}, itemTextNode))));
|
|
2696
2721
|
}; // Use passed in onOpen callback (if exists), otherwise create custom function
|
|
2697
2722
|
|
|
2698
2723
|
|
|
@@ -2704,18 +2729,32 @@ const DotAutoComplete = ({
|
|
|
2704
2729
|
if (!('relatedTarget' in event) || event.relatedTarget !== actionItemRef.current) {
|
|
2705
2730
|
setIsOpened(false);
|
|
2706
2731
|
}
|
|
2707
|
-
}); //
|
|
2732
|
+
}); // Create handler only if 'onInputChange' or 'actionItem' prop is defined
|
|
2708
2733
|
|
|
2709
2734
|
|
|
2710
|
-
const handleInputChange = onInputChange && ((event, inputValue, reason) => {
|
|
2711
|
-
|
|
2712
|
-
|
|
2735
|
+
const handleInputChange = (onInputChange || isActionItemDefined) && ((event, inputValue, reason) => {
|
|
2736
|
+
isActionItemDefined && setInputText(inputValue);
|
|
2737
|
+
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, inputValue, reason);
|
|
2738
|
+
}) || undefined; // Create callback when action item click event handler is defined,
|
|
2739
|
+
// free-solo mode is NOT set and 'Enter' key has been pressed
|
|
2740
|
+
|
|
2741
|
+
|
|
2742
|
+
const handleKeyDown = !_freesolo && onActionItemClick && (event => {
|
|
2743
|
+
if (event.key === 'Enter') {
|
|
2744
|
+
// Do NOT execute callback if duplicate item
|
|
2745
|
+
if (preventDuplicateInsertion && checkIfDuplicateItem(inputText, options)) return;
|
|
2746
|
+
onActionItemClick(inputText);
|
|
2747
|
+
}
|
|
2748
|
+
}) || undefined;
|
|
2749
|
+
|
|
2750
|
+
const handleRenderChips = (values, getTagProps) => getChipsFromAutocomplete(values, getTagProps, _dense ? 'small' : 'medium');
|
|
2713
2751
|
|
|
2714
2752
|
return /*#__PURE__*/React__default.createElement(StyledAutocomplete, {
|
|
2715
2753
|
PopperComponent: DotPopper,
|
|
2716
2754
|
"aria-label": ariaLabel,
|
|
2717
2755
|
classes: {
|
|
2718
|
-
root: rootClasses
|
|
2756
|
+
root: rootClasses,
|
|
2757
|
+
inputRoot: inputRootClasses
|
|
2719
2758
|
},
|
|
2720
2759
|
"data-testid": dataTestId,
|
|
2721
2760
|
defaultValue: defaultValue,
|
|
@@ -2736,9 +2775,10 @@ const DotAutoComplete = ({
|
|
|
2736
2775
|
setIsOpened(false);
|
|
2737
2776
|
},
|
|
2738
2777
|
onClose: handleClose,
|
|
2778
|
+
onInputChange: handleInputChange,
|
|
2779
|
+
onKeyDown: handleKeyDown,
|
|
2739
2780
|
// We want to close the popper each time focus is shifted from the autocomplete
|
|
2740
2781
|
onOpen: handleOpen,
|
|
2741
|
-
onInputChange: handleInputChange,
|
|
2742
2782
|
open: open || isOpened,
|
|
2743
2783
|
options: sortOptions(),
|
|
2744
2784
|
renderInput: params => {
|
|
@@ -2789,11 +2829,12 @@ const DotAutoComplete = ({
|
|
|
2789
2829
|
},
|
|
2790
2830
|
placeholder: showPlaceholder ? placeholder : undefined,
|
|
2791
2831
|
required: _required,
|
|
2832
|
+
size: _dense ? 'small' : 'medium',
|
|
2792
2833
|
variant: "outlined"
|
|
2793
2834
|
}))
|
|
2794
2835
|
);
|
|
2795
2836
|
},
|
|
2796
|
-
renderTags: _multiple ?
|
|
2837
|
+
renderTags: _multiple ? handleRenderChips : null,
|
|
2797
2838
|
size: _size,
|
|
2798
2839
|
value: value
|
|
2799
2840
|
});
|
|
@@ -3968,7 +4009,7 @@ const StyledFormContainer = styled.div.withConfig({
|
|
|
3968
4009
|
componentId: "bbovqo-0"
|
|
3969
4010
|
})(["", ""], ({
|
|
3970
4011
|
theme
|
|
3971
|
-
}) => css(["&.", "{margin:", ";.", ",.", ",.", ",.", "{margin:", ";}.", ",.", "{.", "{margin:0;}}}"], rootClassName$m, theme.spacing(3, 0), rootClassName$s, rootClassName$u, rootClassName$
|
|
4012
|
+
}) => css(["&.", "{margin:", ";.", ",.", ",.", ",.", "{margin:", ";}.", ",.", "{.", "{margin:0;}}}"], rootClassName$m, theme.spacing(3, 0), rootClassName$s, rootClassName$u, rootClassName$B, rootSelectClassName, theme.spacing(1, 0), rootClassName$r, groupClassName, rootClassName$u));
|
|
3972
4013
|
|
|
3973
4014
|
const DotForm = ({
|
|
3974
4015
|
ariaLabel,
|
|
@@ -4234,7 +4275,7 @@ const DotInputText = ({
|
|
|
4234
4275
|
iconId: `${iconType}-solid`
|
|
4235
4276
|
});
|
|
4236
4277
|
|
|
4237
|
-
const rootStyles = useStylesWithRootClass(rootClassName$
|
|
4278
|
+
const rootStyles = useStylesWithRootClass(rootClassName$B, className, hasWarning);
|
|
4238
4279
|
|
|
4239
4280
|
const endAdornmentIcon = endIcon || _error && renderIcon('error') || _warning && renderIcon('warning'); // Used to control text value from the consumer component
|
|
4240
4281
|
// when debounce feature is enabled
|
|
@@ -5808,7 +5849,7 @@ const DotTablePagination = ({
|
|
|
5808
5849
|
onChangeRowsPerPage,
|
|
5809
5850
|
page: _page = 0,
|
|
5810
5851
|
rowsPerPage: _rowsPerPage = 10,
|
|
5811
|
-
typography
|
|
5852
|
+
typography: _typography = 'body1'
|
|
5812
5853
|
}) => {
|
|
5813
5854
|
const rootClasses = useStylesWithRootClass(rootClassName$a, className);
|
|
5814
5855
|
|
|
@@ -5825,7 +5866,7 @@ const DotTablePagination = ({
|
|
|
5825
5866
|
|
|
5826
5867
|
/* Container is used to pass 'typography' prop to a styled component */
|
|
5827
5868
|
React__default.createElement(StyledTablePagination, {
|
|
5828
|
-
typography:
|
|
5869
|
+
typography: _typography
|
|
5829
5870
|
}, /*#__PURE__*/React__default.createElement(TablePagination, {
|
|
5830
5871
|
"aria-label": ariaLabel,
|
|
5831
5872
|
classes: {
|
package/dot-components.umd.js
CHANGED
|
@@ -1130,9 +1130,7 @@
|
|
|
1130
1130
|
},
|
|
1131
1131
|
"data-testid": dataTestId,
|
|
1132
1132
|
iconMapping: AlertBannerIconMapping,
|
|
1133
|
-
onClose:
|
|
1134
|
-
return onClose ? onClose(event) : null;
|
|
1135
|
-
},
|
|
1133
|
+
onClose: onClose,
|
|
1136
1134
|
severity: severity
|
|
1137
1135
|
}, /*#__PURE__*/React__default["default"].createElement(DotTypography, {
|
|
1138
1136
|
variant: textVariant,
|
|
@@ -1510,7 +1508,7 @@
|
|
|
1510
1508
|
componentId: "sc-134fmqu-0"
|
|
1511
1509
|
})(templateObject_2$L || (templateObject_2$L = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
1512
1510
|
var theme = _a.theme;
|
|
1513
|
-
return styled.css(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n max-height: calc(100vh - 24px);\n overflow: auto;\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "], ["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n max-height: calc(100vh - 24px);\n overflow: auto;\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "])), popperClassName, levelSecond, rootClassName$J, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3));
|
|
1511
|
+
return styled.css(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n max-height: calc(100vh - 24px);\n overflow: auto;\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "], ["\n &.", " {\n z-index: ", ";\n }\n &.", ", &.", " {\n &.loading .MuiPaper-root {\n align-items: center;\n display: flex;\n justify-content: center;\n min-height: 200px;\n min-width: 200px;\n }\n\n ul,\n .dot-action-item {\n background: ", ";\n\n .dot-action-item-text {\n white-space: nowrap;\n overflow-x: hidden;\n text-overflow: ellipsis;\n }\n }\n\n ul {\n box-sizing: content-box;\n min-width: 112px;\n max-height: calc(100vh - 24px);\n overflow: auto;\n\n .dot-li {\n min-height: auto;\n\n &:hover {\n background: ", ";\n }\n\n &:active,\n &:focus {\n background: ", ";\n }\n }\n\n .dot-link {\n color: ", ";\n }\n }\n\n .dot-action-item {\n height: ", "px;\n border-top: 1px solid ", ";\n line-height: inherit;\n\n button.dot-button {\n border-radius: ", ";\n justify-content: flex-start;\n height: 100%;\n margin: 0;\n\n &:focus-visible {\n background-color: ", ";\n }\n\n .MuiButton-label {\n gap: ", "px;\n\n .MuiButton-startIcon {\n margin-left: 0;\n\n .dot-icon {\n flex-shrink: 0;\n }\n }\n }\n }\n }\n }\n "])), popperClassName, levelSecond, rootClassName$J, popperClassName, theme.palette.product === 'agility' && theme.palette.agilityInterface.menuBg, theme.palette.product === 'agility' && theme.palette.agilityInterface.fixedCol, theme.palette.product === 'agility' && theme.palette.agilityInterface.activeCardBg, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.spacing(7), theme.palette.grey[100], theme.spacing(0, 0, 0.5, 0.5), theme.palette.product === 'agility' && theme.palette.type === 'dark' ? theme.palette.layer.n200 : theme.palette.layer.n100, theme.spacing(3));
|
|
1514
1512
|
});
|
|
1515
1513
|
var templateObject_1$N, templateObject_2$L;
|
|
1516
1514
|
|
|
@@ -1801,6 +1799,8 @@
|
|
|
1801
1799
|
}
|
|
1802
1800
|
}, []);
|
|
1803
1801
|
var rootClasses = useStylesWithRootClass(rootClassName$I, className);
|
|
1802
|
+
var headerExists = !!drawerHeaderProps;
|
|
1803
|
+
var bodyTestId = drawerBodyProps ? drawerBodyProps["data-testid"] : 'drawer-body';
|
|
1804
1804
|
return /*#__PURE__*/React__default["default"].createElement(StyledDrawer, {
|
|
1805
1805
|
ModalProps: ModalProps,
|
|
1806
1806
|
PaperProps: PaperProps,
|
|
@@ -1819,20 +1819,17 @@
|
|
|
1819
1819
|
variant: variant,
|
|
1820
1820
|
width: width
|
|
1821
1821
|
}, drawerHeaderProps && /*#__PURE__*/React__default["default"].createElement(DotDrawerHeader, {
|
|
1822
|
-
ariaLabel: drawerHeaderProps.ariaLabel,
|
|
1823
1822
|
className: drawerHeaderProps.className,
|
|
1824
1823
|
"data-testid": drawerHeaderProps["data-testid"],
|
|
1825
1824
|
onClose: onClose,
|
|
1826
1825
|
variant: variant
|
|
1827
|
-
}, drawerHeaderProps.children),
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
headerExists: drawerHeaderProps ? true : false,
|
|
1826
|
+
}, drawerHeaderProps.children), /*#__PURE__*/React__default["default"].createElement(DotDrawerBody, {
|
|
1827
|
+
className: drawerBodyProps === null || drawerBodyProps === void 0 ? void 0 : drawerBodyProps.className,
|
|
1828
|
+
"data-testid": bodyTestId,
|
|
1829
|
+
headerExists: headerExists,
|
|
1832
1830
|
onClose: onClose,
|
|
1833
1831
|
variant: variant
|
|
1834
|
-
}, drawerBodyProps.children)
|
|
1835
|
-
ariaLabel: drawerFooterProps.ariaLabel,
|
|
1832
|
+
}, (drawerBodyProps === null || drawerBodyProps === void 0 ? void 0 : drawerBodyProps.children) || children), drawerFooterProps && /*#__PURE__*/React__default["default"].createElement(DotDrawerFooter, {
|
|
1836
1833
|
className: drawerFooterProps.className,
|
|
1837
1834
|
"data-testid": drawerFooterProps["data-testid"]
|
|
1838
1835
|
}, drawerFooterProps.children));
|
|
@@ -2595,96 +2592,44 @@
|
|
|
2595
2592
|
};
|
|
2596
2593
|
|
|
2597
2594
|
var rootClassName$C = 'dot-autocomplete';
|
|
2595
|
+
var inputRootClassName = 'dot-input-root';
|
|
2596
|
+
var inputMediumClassName = 'dot-input-medium';
|
|
2598
2597
|
var StyledAutocomplete = styled__default["default"](lab.Autocomplete).withConfig({
|
|
2599
2598
|
displayName: "AutoCompletestyles__StyledAutocomplete",
|
|
2600
2599
|
componentId: "j2sgjy-0"
|
|
2601
2600
|
})(templateObject_2$D || (templateObject_2$D = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
2602
|
-
_a.theme;
|
|
2603
|
-
return styled.css(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["\n &.", " {\n }\n "], ["\n &.", " {\n }\n "])), rootClassName$C);
|
|
2604
|
-
});
|
|
2605
|
-
var templateObject_1$F, templateObject_2$D;
|
|
2606
|
-
|
|
2607
|
-
var rootClassName$B = 'dot-chip';
|
|
2608
|
-
var StyledChip = styled__default["default"](core.Chip).withConfig({
|
|
2609
|
-
displayName: "Chipstyles__StyledChip",
|
|
2610
|
-
componentId: "f1tsra-0"
|
|
2611
|
-
})(templateObject_2$C || (templateObject_2$C = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
2612
2601
|
var theme = _a.theme;
|
|
2613
|
-
return styled.css(templateObject_1$
|
|
2602
|
+
return styled.css(templateObject_1$F || (templateObject_1$F = __makeTemplateObject(["\n &.", " {\n .", ".", " {\n /* Override only top/bottom, but preserve left/right padding */\n padding-top: ", ";\n padding-bottom: ", ";\n }\n }\n "], ["\n &.", " {\n .", ".", " {\n /* Override only top/bottom, but preserve left/right padding */\n padding-top: ", ";\n padding-bottom: ", ";\n }\n }\n "])), rootClassName$C, inputRootClassName, inputMediumClassName, theme.spacing(0), theme.spacing(0));
|
|
2614
2603
|
});
|
|
2615
|
-
var templateObject_1$
|
|
2616
|
-
|
|
2617
|
-
var DotChip = function DotChip(_a) {
|
|
2618
|
-
var ariaLabel = _a.ariaLabel,
|
|
2619
|
-
avatar = _a.avatar,
|
|
2620
|
-
children = _a.children,
|
|
2621
|
-
className = _a.className,
|
|
2622
|
-
dataTestId = _a["data-testid"],
|
|
2623
|
-
_b = _a.disabled,
|
|
2624
|
-
disabled = _b === void 0 ? false : _b,
|
|
2625
|
-
_c = _a.error,
|
|
2626
|
-
error = _c === void 0 ? false : _c,
|
|
2627
|
-
_d = _a.isClickable,
|
|
2628
|
-
isClickable = _d === void 0 ? false : _d,
|
|
2629
|
-
_e = _a.isDeletable,
|
|
2630
|
-
isDeletable = _e === void 0 ? true : _e,
|
|
2631
|
-
onClick = _a.onClick,
|
|
2632
|
-
onDelete = _a.onDelete,
|
|
2633
|
-
_f = _a.size,
|
|
2634
|
-
size = _f === void 0 ? 'medium' : _f,
|
|
2635
|
-
startIcon = _a.startIcon;
|
|
2636
|
-
var errorClass = error ? 'Mui-error' : '';
|
|
2637
|
-
var rootClasses = useStylesWithRootClass(rootClassName$B, className, errorClass);
|
|
2638
|
-
return /*#__PURE__*/React__default["default"].createElement(StyledChip, {
|
|
2639
|
-
"aria-label": ariaLabel,
|
|
2640
|
-
avatar: avatar,
|
|
2641
|
-
classes: {
|
|
2642
|
-
root: rootClasses
|
|
2643
|
-
},
|
|
2644
|
-
clickable: isClickable,
|
|
2645
|
-
color: "default",
|
|
2646
|
-
"data-testid": dataTestId,
|
|
2647
|
-
disabled: disabled,
|
|
2648
|
-
icon: avatar ? null : startIcon,
|
|
2649
|
-
label: children,
|
|
2650
|
-
onClick: function (event) {
|
|
2651
|
-
return onClick && onClick(event);
|
|
2652
|
-
},
|
|
2653
|
-
onDelete: isDeletable && onDelete ? function (event) {
|
|
2654
|
-
return onDelete(event);
|
|
2655
|
-
} : undefined,
|
|
2656
|
-
size: size,
|
|
2657
|
-
variant: "outlined"
|
|
2658
|
-
});
|
|
2659
|
-
};
|
|
2604
|
+
var templateObject_1$F, templateObject_2$D;
|
|
2660
2605
|
|
|
2661
|
-
var rootClassName$
|
|
2606
|
+
var rootClassName$B = 'dot-text-field';
|
|
2662
2607
|
var rootSelectClassName = 'dot-select-field';
|
|
2663
2608
|
var warningClassName = 'dot-warning';
|
|
2664
2609
|
var adornmentIconClassName = 'dot-adornment-icon';
|
|
2665
2610
|
var StyledAdornment = styled__default["default"](core.InputAdornment).withConfig({
|
|
2666
2611
|
displayName: "InputFormFieldsstyles__StyledAdornment",
|
|
2667
2612
|
componentId: "sc-1mbn9f0-0"
|
|
2668
|
-
})(templateObject_1$
|
|
2613
|
+
})(templateObject_1$E || (templateObject_1$E = __makeTemplateObject(["\n .dot-icon {\n font-size: 24px;\n height: 24px;\n padding: 0;\n width: 24px;\n }\n"], ["\n .dot-icon {\n font-size: 24px;\n height: 24px;\n padding: 0;\n width: 24px;\n }\n"])));
|
|
2669
2614
|
var StyledTextField = styled__default["default"](core.TextField).withConfig({
|
|
2670
2615
|
displayName: "InputFormFieldsstyles__StyledTextField",
|
|
2671
2616
|
componentId: "sc-1mbn9f0-1"
|
|
2672
2617
|
})(templateObject_3$6 || (templateObject_3$6 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
2673
2618
|
var theme = _a.theme,
|
|
2674
2619
|
InputProps = _a.InputProps;
|
|
2675
|
-
return styled.css(templateObject_2$
|
|
2620
|
+
return styled.css(templateObject_2$C || (templateObject_2$C = __makeTemplateObject(["\n &.", " {\n .MuiInputBase-root {\n background: ", "\n }\n .MuiInputBase-input {\n box-sizing: content-box;\n }\n .MuiOutlinedInput-notchedOutline {\n border-color: ", "\n }\n .MuiOutlinedInput-input {\n padding: ", ";\n }\n .MuiOutlinedInput-inputMarginDense {\n padding-top: 10.5px;\n padding-bottom: 10.5px;\n }\n .MuiOutlinedInput-inputMultiline {\n padding: 0;\n }\n }\n &.", ", &.", " {\n .dot-adornment-icon .dot-icon i {\n margin-top: -2px;\n }\n .MuiFormLabel-root.Mui-focused {\n color: ", "\n }\n select.dot-select {\n background: ", ";\n }\n .MuiSelect-select:focus {\n background-color: transparent;\n }\n .Mui-error .", " {\n color: ", ";\n }\n .MuiSelect-icon {\n right: ", ";\n }\n &.", " {\n .MuiOutlinedInput-notchedOutline {\n border-color: ", ";\n }\n .MuiInputLabel-outlined.MuiInputLabel-shrink {\n color: ", ";\n }\n .", " {\n color: ", ";\n }\n }\n .MuiOutlinedInput-adornedStart {\n padding-left: 12px;\n }\n .MuiOutlinedInput-adornedEnd {\n padding-right: 12px;\n }\n .MuiFormHelperText-root {\n font-size: ", "px;\n margin: ", ";\n display: flex;\n align-items: flex-end;\n &:not(.Mui-error) {\n color: ", ";\n }\n }\n .Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: ", ";\n }\n "], ["\n &.", " {\n .MuiInputBase-root {\n background: ", "\n }\n .MuiInputBase-input {\n box-sizing: content-box;\n }\n .MuiOutlinedInput-notchedOutline {\n border-color: ", "\n }\n .MuiOutlinedInput-input {\n padding: ", ";\n }\n .MuiOutlinedInput-inputMarginDense {\n padding-top: 10.5px;\n padding-bottom: 10.5px;\n }\n .MuiOutlinedInput-inputMultiline {\n padding: 0;\n }\n }\n &.", ", &.", " {\n .dot-adornment-icon .dot-icon i {\n margin-top: -2px;\n }\n .MuiFormLabel-root.Mui-focused {\n color: ", "\n }\n select.dot-select {\n background: ", ";\n }\n .MuiSelect-select:focus {\n background-color: transparent;\n }\n .Mui-error .", " {\n color: ", ";\n }\n .MuiSelect-icon {\n right: ", ";\n }\n &.", " {\n .MuiOutlinedInput-notchedOutline {\n border-color: ", ";\n }\n .MuiInputLabel-outlined.MuiInputLabel-shrink {\n color: ", ";\n }\n .", " {\n color: ", ";\n }\n }\n .MuiOutlinedInput-adornedStart {\n padding-left: 12px;\n }\n .MuiOutlinedInput-adornedEnd {\n padding-right: 12px;\n }\n .MuiFormHelperText-root {\n font-size: ", "px;\n margin: ", ";\n display: flex;\n align-items: flex-end;\n &:not(.Mui-error) {\n color: ", ";\n }\n }\n .Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: ", ";\n }\n "])), rootClassName$B, theme.palette.product === 'agility' && theme.palette.layer.n0, theme.palette.product === 'agility' && theme.palette.layer.n100, InputProps.startAdornment ? "18px 12px 18px 0px" : "18px 12px", rootSelectClassName, rootClassName$B, theme.palette.product === 'agility' && theme.palette.layer.n700, theme.palette.product === 'agility' && theme.palette.layer.n0, adornmentIconClassName, theme.palette.error[500], InputProps.endAdornment ? "44px" : "12px", warningClassName, theme.palette.warning[500], theme.palette.grey[700], adornmentIconClassName, theme.palette.warning[500], theme.typography.body2.fontSize, theme.spacing(0, 0, 0, 2), theme.palette.grey[700], theme.palette.product === 'agility' && agilityGreen);
|
|
2676
2621
|
});
|
|
2677
|
-
var templateObject_1$
|
|
2622
|
+
var templateObject_1$E, templateObject_2$C, templateObject_3$6;
|
|
2678
2623
|
|
|
2679
|
-
var rootClassName$
|
|
2624
|
+
var rootClassName$A = 'dot-button';
|
|
2680
2625
|
var StyledButton = styled__default["default"](core.Button).withConfig({
|
|
2681
2626
|
displayName: "Buttonstyles__StyledButton",
|
|
2682
2627
|
componentId: "sx99hh-0"
|
|
2683
|
-
})(templateObject_2$
|
|
2628
|
+
})(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
2684
2629
|
var theme = _a.theme;
|
|
2685
|
-
return styled.css(templateObject_1$
|
|
2630
|
+
return styled.css(templateObject_1$D || (templateObject_1$D = __makeTemplateObject(["\n &.", " {\n margin: ", "px;\n min-width: auto;\n white-space: nowrap;\n\n &.MuiButton-containedPrimary {\n background-color: ", ";\n }\n\n &.MuiButton-containedSecondary {\n background-color: ", ";\n\n &:hover,\n &:active {\n background-color: ", ";\n }\n }\n\n &.MuiButton-text {\n padding: 6px 16px;\n }\n\n span.dot-icon {\n padding: 0;\n\n i {\n height: auto;\n }\n }\n }\n "], ["\n &.", " {\n margin: ", "px;\n min-width: auto;\n white-space: nowrap;\n\n &.MuiButton-containedPrimary {\n background-color: ", ";\n }\n\n &.MuiButton-containedSecondary {\n background-color: ", ";\n\n &:hover,\n &:active {\n background-color: ", ";\n }\n }\n\n &.MuiButton-text {\n padding: 6px 16px;\n }\n\n span.dot-icon {\n padding: 0;\n\n i {\n height: auto;\n }\n }\n }\n "])), rootClassName$A, theme.spacing(0.5), theme.palette.product === 'agility' && agilityGreen, theme.palette.error.main, core.darken(theme.palette.error.main, 0.2));
|
|
2686
2631
|
});
|
|
2687
|
-
var templateObject_1$
|
|
2632
|
+
var templateObject_1$D, templateObject_2$B;
|
|
2688
2633
|
|
|
2689
2634
|
/** This component wraps the Button component from @material-ui. */
|
|
2690
2635
|
|
|
@@ -2714,7 +2659,7 @@
|
|
|
2714
2659
|
tooltip = _a.tooltip,
|
|
2715
2660
|
_h = _a.type,
|
|
2716
2661
|
type = _h === void 0 ? 'primary' : _h;
|
|
2717
|
-
var rootClasses = useStylesWithRootClass(rootClassName$
|
|
2662
|
+
var rootClasses = useStylesWithRootClass(rootClassName$A, className);
|
|
2718
2663
|
var color;
|
|
2719
2664
|
var variant;
|
|
2720
2665
|
|
|
@@ -2771,6 +2716,60 @@
|
|
|
2771
2716
|
}, children));
|
|
2772
2717
|
});
|
|
2773
2718
|
|
|
2719
|
+
var rootClassName$z = 'dot-chip';
|
|
2720
|
+
var StyledChip = styled__default["default"](core.Chip).withConfig({
|
|
2721
|
+
displayName: "Chipstyles__StyledChip",
|
|
2722
|
+
componentId: "f1tsra-0"
|
|
2723
|
+
})(templateObject_2$A || (templateObject_2$A = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
2724
|
+
var theme = _a.theme;
|
|
2725
|
+
return styled.css(templateObject_1$C || (templateObject_1$C = __makeTemplateObject(["\n &.", " {\n border-color: ", ";\n\n .dot-icon i {\n height: auto;\n }\n\n &.MuiChip-sizeSmall {\n .dot-icon,\n .dot-avatar {\n width: 18px;\n height: 18px;\n }\n }\n\n &.Mui-error {\n background-color: ", ";\n border-color: ", ";\n .MuiChip-deleteIcon {\n color: ", ";\n }\n }\n\n &:not(.Mui-error) {\n &:hover {\n background-color: ", ";\n }\n\n .MuiChip-deleteIcon {\n &:hover {\n color: ", ";\n }\n }\n }\n\n .MuiChip-deleteIcon {\n width: 18px;\n height: 18px;\n color: ", ";\n }\n }\n "], ["\n &.", " {\n border-color: ", ";\n\n .dot-icon i {\n height: auto;\n }\n\n &.MuiChip-sizeSmall {\n .dot-icon,\n .dot-avatar {\n width: 18px;\n height: 18px;\n }\n }\n\n &.Mui-error {\n background-color: ", ";\n border-color: ", ";\n .MuiChip-deleteIcon {\n color: ", ";\n }\n }\n\n &:not(.Mui-error) {\n &:hover {\n background-color: ", ";\n }\n\n .MuiChip-deleteIcon {\n &:hover {\n color: ", ";\n }\n }\n }\n\n .MuiChip-deleteIcon {\n width: 18px;\n height: 18px;\n color: ", ";\n }\n }\n "])), rootClassName$z, theme.palette.grey[300], theme.palette.error[50], theme.palette.error.main, theme.palette.error.main, theme.palette.grey[50], theme.palette.grey[400], theme.palette.grey[300]);
|
|
2726
|
+
});
|
|
2727
|
+
var templateObject_1$C, templateObject_2$A;
|
|
2728
|
+
|
|
2729
|
+
var DotChip = function DotChip(_a) {
|
|
2730
|
+
var ariaLabel = _a.ariaLabel,
|
|
2731
|
+
avatar = _a.avatar,
|
|
2732
|
+
children = _a.children,
|
|
2733
|
+
className = _a.className,
|
|
2734
|
+
dataTestId = _a["data-testid"],
|
|
2735
|
+
_b = _a.disabled,
|
|
2736
|
+
disabled = _b === void 0 ? false : _b,
|
|
2737
|
+
_c = _a.error,
|
|
2738
|
+
error = _c === void 0 ? false : _c,
|
|
2739
|
+
_d = _a.isClickable,
|
|
2740
|
+
isClickable = _d === void 0 ? false : _d,
|
|
2741
|
+
_e = _a.isDeletable,
|
|
2742
|
+
isDeletable = _e === void 0 ? true : _e,
|
|
2743
|
+
onClick = _a.onClick,
|
|
2744
|
+
onDelete = _a.onDelete,
|
|
2745
|
+
_f = _a.size,
|
|
2746
|
+
size = _f === void 0 ? 'medium' : _f,
|
|
2747
|
+
startIcon = _a.startIcon;
|
|
2748
|
+
var errorClass = error ? 'Mui-error' : '';
|
|
2749
|
+
var rootClasses = useStylesWithRootClass(rootClassName$z, className, errorClass);
|
|
2750
|
+
return /*#__PURE__*/React__default["default"].createElement(StyledChip, {
|
|
2751
|
+
"aria-label": ariaLabel,
|
|
2752
|
+
avatar: avatar,
|
|
2753
|
+
classes: {
|
|
2754
|
+
root: rootClasses
|
|
2755
|
+
},
|
|
2756
|
+
clickable: isClickable,
|
|
2757
|
+
color: "default",
|
|
2758
|
+
"data-testid": dataTestId,
|
|
2759
|
+
disabled: disabled,
|
|
2760
|
+
icon: avatar ? null : startIcon,
|
|
2761
|
+
label: children,
|
|
2762
|
+
onClick: function (event) {
|
|
2763
|
+
return onClick && onClick(event);
|
|
2764
|
+
},
|
|
2765
|
+
onDelete: isDeletable && onDelete ? function (event) {
|
|
2766
|
+
return onDelete(event);
|
|
2767
|
+
} : undefined,
|
|
2768
|
+
size: size,
|
|
2769
|
+
variant: "outlined"
|
|
2770
|
+
});
|
|
2771
|
+
};
|
|
2772
|
+
|
|
2774
2773
|
// parses value and returns a string which is saved to state
|
|
2775
2774
|
|
|
2776
2775
|
var parseAutoCompleteValue = function parseAutoCompleteValue(value) {
|
|
@@ -2796,6 +2795,32 @@
|
|
|
2796
2795
|
|
|
2797
2796
|
return '';
|
|
2798
2797
|
};
|
|
2798
|
+
var getChipsFromAutocomplete = function getChipsFromAutocomplete(values, getTagProps, chipSize) {
|
|
2799
|
+
if (chipSize === void 0) {
|
|
2800
|
+
chipSize = 'medium';
|
|
2801
|
+
}
|
|
2802
|
+
|
|
2803
|
+
return values.map(function (option, index) {
|
|
2804
|
+
var hasStringValue = isString(option);
|
|
2805
|
+
var optionAsString = option;
|
|
2806
|
+
var optionAsObject = option;
|
|
2807
|
+
var chipError = hasStringValue ? undefined : optionAsObject.error;
|
|
2808
|
+
return /*#__PURE__*/React__default["default"].createElement(DotChip, __assign({
|
|
2809
|
+
"data-testid": "dot-autocomplete-chip",
|
|
2810
|
+
error: chipError,
|
|
2811
|
+
size: chipSize
|
|
2812
|
+
}, getTagProps({
|
|
2813
|
+
index: index
|
|
2814
|
+
})), hasStringValue ? optionAsString : optionAsObject.title);
|
|
2815
|
+
});
|
|
2816
|
+
};
|
|
2817
|
+
var checkIfDuplicateItem = function checkIfDuplicateItem(itemText, autocompleteOptions) {
|
|
2818
|
+
return autocompleteOptions.some(function (autocompleteOption) {
|
|
2819
|
+
return autocompleteOption.title === itemText;
|
|
2820
|
+
});
|
|
2821
|
+
};
|
|
2822
|
+
|
|
2823
|
+
var DEFAULT_ACTION_ITEM_TEXT = 'Add new item';
|
|
2799
2824
|
var DotAutoComplete = function DotAutoComplete(_a) {
|
|
2800
2825
|
var actionItem = _a.actionItem,
|
|
2801
2826
|
ariaLabel = _a.ariaLabel,
|
|
@@ -2803,23 +2828,25 @@
|
|
|
2803
2828
|
className = _a.className,
|
|
2804
2829
|
dataTestId = _a["data-testid"],
|
|
2805
2830
|
defaultValue = _a.defaultValue,
|
|
2806
|
-
_b = _a.
|
|
2807
|
-
|
|
2808
|
-
_c = _a.
|
|
2809
|
-
|
|
2810
|
-
_d = _a.
|
|
2811
|
-
|
|
2812
|
-
_e = _a.
|
|
2813
|
-
|
|
2814
|
-
_f = _a.
|
|
2815
|
-
|
|
2831
|
+
_b = _a.dense,
|
|
2832
|
+
dense = _b === void 0 ? true : _b,
|
|
2833
|
+
_c = _a.disabled,
|
|
2834
|
+
disabled = _c === void 0 ? false : _c,
|
|
2835
|
+
_d = _a.disablePortal,
|
|
2836
|
+
disablePortal = _d === void 0 ? true : _d,
|
|
2837
|
+
_e = _a.error,
|
|
2838
|
+
error = _e === void 0 ? false : _e,
|
|
2839
|
+
_f = _a.freesolo,
|
|
2840
|
+
freesolo = _f === void 0 ? true : _f,
|
|
2841
|
+
_g = _a.group,
|
|
2842
|
+
group = _g === void 0 ? false : _g,
|
|
2816
2843
|
helperText = _a.helperText,
|
|
2817
2844
|
inputId = _a.inputId,
|
|
2818
2845
|
inputRef = _a.inputRef,
|
|
2819
2846
|
label = _a.label,
|
|
2820
2847
|
loading = _a.loading,
|
|
2821
|
-
|
|
2822
|
-
multiple =
|
|
2848
|
+
_h = _a.multiple,
|
|
2849
|
+
multiple = _h === void 0 ? true : _h,
|
|
2823
2850
|
onChange = _a.onChange,
|
|
2824
2851
|
onClose = _a.onClose,
|
|
2825
2852
|
onInputChange = _a.onInputChange,
|
|
@@ -2827,22 +2854,36 @@
|
|
|
2827
2854
|
open = _a.open,
|
|
2828
2855
|
options = _a.options,
|
|
2829
2856
|
placeholder = _a.placeholder,
|
|
2830
|
-
|
|
2831
|
-
required =
|
|
2832
|
-
|
|
2833
|
-
size =
|
|
2857
|
+
_j = _a.required,
|
|
2858
|
+
required = _j === void 0 ? false : _j,
|
|
2859
|
+
_k = _a.size,
|
|
2860
|
+
size = _k === void 0 ? 'small' : _k,
|
|
2834
2861
|
value = _a.value;
|
|
2835
2862
|
|
|
2836
|
-
var
|
|
2837
|
-
showPlaceholder =
|
|
2838
|
-
setShowPlaceholder =
|
|
2863
|
+
var _l = React.useState(!value && !defaultValue),
|
|
2864
|
+
showPlaceholder = _l[0],
|
|
2865
|
+
setShowPlaceholder = _l[1];
|
|
2839
2866
|
|
|
2840
|
-
var
|
|
2841
|
-
|
|
2842
|
-
|
|
2867
|
+
var _m = actionItem || {},
|
|
2868
|
+
_o = _m.iconId,
|
|
2869
|
+
actionIconId = _o === void 0 ? 'add' : _o,
|
|
2870
|
+
actionItemText = _m.text,
|
|
2871
|
+
onActionItemClick = _m.onClick,
|
|
2872
|
+
preventDuplicateInsertion = _m.preventDuplicateInsertion;
|
|
2873
|
+
|
|
2874
|
+
var isActionItemDefined = onActionItemClick !== undefined;
|
|
2875
|
+
|
|
2876
|
+
var _p = React.useState(false),
|
|
2877
|
+
isOpened = _p[0],
|
|
2878
|
+
setIsOpened = _p[1];
|
|
2879
|
+
|
|
2880
|
+
var _q = React.useState(''),
|
|
2881
|
+
inputText = _q[0],
|
|
2882
|
+
setInputText = _q[1];
|
|
2843
2883
|
|
|
2844
2884
|
var rootClasses = useStylesWithRootClass(rootClassName$C, className);
|
|
2845
|
-
var textFieldRootClasses = useStylesWithRootClass(rootClassName$
|
|
2885
|
+
var textFieldRootClasses = useStylesWithRootClass(rootClassName$B, className);
|
|
2886
|
+
var inputRootClasses = useStylesWithRootClass(inputRootClassName, dense ? '' : inputMediumClassName);
|
|
2846
2887
|
var textFieldInput; // Used for focus management while popper is opened
|
|
2847
2888
|
|
|
2848
2889
|
var actionItemRef = React.useRef();
|
|
@@ -2862,22 +2903,6 @@
|
|
|
2862
2903
|
}
|
|
2863
2904
|
};
|
|
2864
2905
|
|
|
2865
|
-
var getChips = function getChips(values, getTagProps) {
|
|
2866
|
-
return values.map(function (option, index) {
|
|
2867
|
-
if (typeof option === 'string') {
|
|
2868
|
-
return /*#__PURE__*/React__default["default"].createElement(DotChip, __assign({}, getTagProps({
|
|
2869
|
-
index: index
|
|
2870
|
-
})), option);
|
|
2871
|
-
} else {
|
|
2872
|
-
return /*#__PURE__*/React__default["default"].createElement(DotChip, __assign({
|
|
2873
|
-
error: option.error
|
|
2874
|
-
}, getTagProps({
|
|
2875
|
-
index: index
|
|
2876
|
-
})), option.title);
|
|
2877
|
-
}
|
|
2878
|
-
});
|
|
2879
|
-
};
|
|
2880
|
-
|
|
2881
2906
|
var valuesChanged = function valuesChanged(_a) {
|
|
2882
2907
|
var event = _a.event,
|
|
2883
2908
|
val = _a.val,
|
|
@@ -2900,20 +2925,32 @@
|
|
|
2900
2925
|
|
|
2901
2926
|
|
|
2902
2927
|
var DotPopper = function DotPopper(props) {
|
|
2903
|
-
if (!
|
|
2928
|
+
if (!isActionItemDefined) return /*#__PURE__*/React__default["default"].createElement(StyledPopper, __assign({}, props, {
|
|
2904
2929
|
className: popperClassName,
|
|
2905
2930
|
disablePortal: disablePortal
|
|
2906
|
-
}));
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2931
|
+
})); // Disable action if customer explicitly enabled duplicate
|
|
2932
|
+
// item insertion and input text is found inside the 'options'
|
|
2933
|
+
|
|
2934
|
+
var isActionDisabled = preventDuplicateInsertion && checkIfDuplicateItem(inputText, options); // Display warning icon if disabled
|
|
2935
|
+
|
|
2936
|
+
var actionStartIconId = isActionDisabled ? 'warning-solid' : actionIconId;
|
|
2937
|
+
var defaultText = inputText ? "Add \"" + inputText + "\"" : DEFAULT_ACTION_ITEM_TEXT;
|
|
2938
|
+
var nonDisabledText = actionItemText ? actionItemText : defaultText;
|
|
2939
|
+
var itemText = isActionDisabled ? 'Value already exists' : nonDisabledText; // If simple text, we need to give it a class so that
|
|
2940
|
+
// styling for displaying ellipsis on a long text
|
|
2941
|
+
// can be applied. If it is custom node coming from the
|
|
2942
|
+
// consumer, then leave it as it is.
|
|
2943
|
+
|
|
2944
|
+
var itemTextNode = isString(itemText) ? /*#__PURE__*/React__default["default"].createElement("span", {
|
|
2945
|
+
className: "dot-action-item-text"
|
|
2946
|
+
}, itemText) : itemText;
|
|
2910
2947
|
var paperProps = props.children.props;
|
|
2911
2948
|
var paperChildren = paperProps.children;
|
|
2912
2949
|
|
|
2913
2950
|
var onActionButtonClick = function onActionButtonClick() {
|
|
2914
2951
|
setIsOpened(false);
|
|
2915
2952
|
textFieldInput.focus();
|
|
2916
|
-
|
|
2953
|
+
onActionItemClick(inputText);
|
|
2917
2954
|
};
|
|
2918
2955
|
|
|
2919
2956
|
return /*#__PURE__*/React__default["default"].createElement(StyledPopper, __assign({}, props, {
|
|
@@ -2938,15 +2975,17 @@
|
|
|
2938
2975
|
}, /*#__PURE__*/React__default["default"].createElement(DotButton, {
|
|
2939
2976
|
"data-testid": "dot-action-item-btn",
|
|
2940
2977
|
disableRipple: true,
|
|
2978
|
+
disabled: isActionDisabled,
|
|
2941
2979
|
fullWidth: true,
|
|
2942
2980
|
onClick: onActionButtonClick,
|
|
2943
2981
|
ref: actionItemRef,
|
|
2944
2982
|
startIcon: /*#__PURE__*/React__default["default"].createElement(DotIcon, {
|
|
2983
|
+
ariaLabel: actionStartIconId,
|
|
2945
2984
|
fontSize: "small",
|
|
2946
|
-
iconId:
|
|
2985
|
+
iconId: actionStartIconId
|
|
2947
2986
|
}),
|
|
2948
2987
|
type: "text"
|
|
2949
|
-
},
|
|
2988
|
+
}, itemTextNode))));
|
|
2950
2989
|
}; // Use passed in onOpen callback (if exists), otherwise create custom function
|
|
2951
2990
|
|
|
2952
2991
|
|
|
@@ -2960,18 +2999,34 @@
|
|
|
2960
2999
|
if (!('relatedTarget' in event) || event.relatedTarget !== actionItemRef.current) {
|
|
2961
3000
|
setIsOpened(false);
|
|
2962
3001
|
}
|
|
2963
|
-
}; //
|
|
3002
|
+
}; // Create handler only if 'onInputChange' or 'actionItem' prop is defined
|
|
2964
3003
|
|
|
2965
3004
|
|
|
2966
|
-
var handleInputChange = onInputChange && function (event, inputValue, reason) {
|
|
2967
|
-
|
|
3005
|
+
var handleInputChange = (onInputChange || isActionItemDefined) && function (event, inputValue, reason) {
|
|
3006
|
+
isActionItemDefined && setInputText(inputValue);
|
|
3007
|
+
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(event, inputValue, reason);
|
|
3008
|
+
} || undefined; // Create callback when action item click event handler is defined,
|
|
3009
|
+
// free-solo mode is NOT set and 'Enter' key has been pressed
|
|
3010
|
+
|
|
3011
|
+
|
|
3012
|
+
var handleKeyDown = !freesolo && onActionItemClick && function (event) {
|
|
3013
|
+
if (event.key === 'Enter') {
|
|
3014
|
+
// Do NOT execute callback if duplicate item
|
|
3015
|
+
if (preventDuplicateInsertion && checkIfDuplicateItem(inputText, options)) return;
|
|
3016
|
+
onActionItemClick(inputText);
|
|
3017
|
+
}
|
|
3018
|
+
} || undefined;
|
|
3019
|
+
|
|
3020
|
+
var handleRenderChips = function handleRenderChips(values, getTagProps) {
|
|
3021
|
+
return getChipsFromAutocomplete(values, getTagProps, dense ? 'small' : 'medium');
|
|
2968
3022
|
};
|
|
2969
3023
|
|
|
2970
3024
|
return /*#__PURE__*/React__default["default"].createElement(StyledAutocomplete, {
|
|
2971
3025
|
PopperComponent: DotPopper,
|
|
2972
3026
|
"aria-label": ariaLabel,
|
|
2973
3027
|
classes: {
|
|
2974
|
-
root: rootClasses
|
|
3028
|
+
root: rootClasses,
|
|
3029
|
+
inputRoot: inputRootClasses
|
|
2975
3030
|
},
|
|
2976
3031
|
"data-testid": dataTestId,
|
|
2977
3032
|
defaultValue: defaultValue,
|
|
@@ -2996,9 +3051,10 @@
|
|
|
2996
3051
|
setIsOpened(false);
|
|
2997
3052
|
},
|
|
2998
3053
|
onClose: handleClose,
|
|
3054
|
+
onInputChange: handleInputChange,
|
|
3055
|
+
onKeyDown: handleKeyDown,
|
|
2999
3056
|
// We want to close the popper each time focus is shifted from the autocomplete
|
|
3000
3057
|
onOpen: handleOpen,
|
|
3001
|
-
onInputChange: handleInputChange,
|
|
3002
3058
|
open: open || isOpened,
|
|
3003
3059
|
options: sortOptions(),
|
|
3004
3060
|
renderInput: function (params) {
|
|
@@ -3049,13 +3105,12 @@
|
|
|
3049
3105
|
},
|
|
3050
3106
|
placeholder: showPlaceholder ? placeholder : undefined,
|
|
3051
3107
|
required: required,
|
|
3108
|
+
size: dense ? 'small' : 'medium',
|
|
3052
3109
|
variant: "outlined"
|
|
3053
3110
|
}))
|
|
3054
3111
|
);
|
|
3055
3112
|
},
|
|
3056
|
-
renderTags: multiple ?
|
|
3057
|
-
return getChips(values, getTagProps);
|
|
3058
|
-
} : null,
|
|
3113
|
+
renderTags: multiple ? handleRenderChips : null,
|
|
3059
3114
|
size: size,
|
|
3060
3115
|
value: value
|
|
3061
3116
|
});
|
|
@@ -4287,7 +4342,7 @@
|
|
|
4287
4342
|
componentId: "bbovqo-0"
|
|
4288
4343
|
})(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
4289
4344
|
var theme = _a.theme;
|
|
4290
|
-
return styled.css(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n &.", " {\n margin: ", ";\n\n .", ",\n .", ",\n .", ",\n .", " {\n margin: ", ";\n }\n\n .", ", .", " {\n .", " {\n margin: 0;\n }\n }\n }\n "], ["\n &.", " {\n margin: ", ";\n\n .", ",\n .", ",\n .", ",\n .", " {\n margin: ", ";\n }\n\n .", ", .", " {\n .", " {\n margin: 0;\n }\n }\n }\n "])), rootClassName$m, theme.spacing(3, 0), rootClassName$s, rootClassName$u, rootClassName$
|
|
4345
|
+
return styled.css(templateObject_1$m || (templateObject_1$m = __makeTemplateObject(["\n &.", " {\n margin: ", ";\n\n .", ",\n .", ",\n .", ",\n .", " {\n margin: ", ";\n }\n\n .", ", .", " {\n .", " {\n margin: 0;\n }\n }\n }\n "], ["\n &.", " {\n margin: ", ";\n\n .", ",\n .", ",\n .", ",\n .", " {\n margin: ", ";\n }\n\n .", ", .", " {\n .", " {\n margin: 0;\n }\n }\n }\n "])), rootClassName$m, theme.spacing(3, 0), rootClassName$s, rootClassName$u, rootClassName$B, rootSelectClassName, theme.spacing(1, 0), rootClassName$r, groupClassName, rootClassName$u);
|
|
4291
4346
|
});
|
|
4292
4347
|
var templateObject_1$m, templateObject_2$m;
|
|
4293
4348
|
|
|
@@ -4594,7 +4649,7 @@
|
|
|
4594
4649
|
});
|
|
4595
4650
|
};
|
|
4596
4651
|
|
|
4597
|
-
var rootStyles = useStylesWithRootClass(rootClassName$
|
|
4652
|
+
var rootStyles = useStylesWithRootClass(rootClassName$B, className, hasWarning);
|
|
4598
4653
|
var endAdornmentIcon = endIcon || error && renderIcon('error') || warning && renderIcon('warning'); // Used to control text value from the consumer component
|
|
4599
4654
|
// when debounce feature is enabled
|
|
4600
4655
|
|
|
@@ -6270,7 +6325,8 @@
|
|
|
6270
6325
|
page = _b === void 0 ? 0 : _b,
|
|
6271
6326
|
_c = _a.rowsPerPage,
|
|
6272
6327
|
rowsPerPage = _c === void 0 ? 10 : _c,
|
|
6273
|
-
|
|
6328
|
+
_d = _a.typography,
|
|
6329
|
+
typography = _d === void 0 ? 'body1' : _d;
|
|
6274
6330
|
var rootClasses = useStylesWithRootClass(rootClassName$a, className);
|
|
6275
6331
|
|
|
6276
6332
|
var handlePageChange = function handlePageChange(event, newPage) {
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { ChangeEvent, ReactNode, Ref } from 'react';
|
|
2
2
|
import { AutocompleteCloseReason } from '@material-ui/lab';
|
|
3
3
|
import { CommonProps } from '../CommonProps';
|
|
4
|
+
export declare const DEFAULT_ACTION_ITEM_TEXT = "Add new item";
|
|
4
5
|
export interface ActionItem {
|
|
5
6
|
/** The icon to display on the button */
|
|
6
|
-
iconId
|
|
7
|
+
iconId?: string;
|
|
7
8
|
/** Event callback */
|
|
8
|
-
onClick: () => void;
|
|
9
|
+
onClick: (inputText?: string) => void;
|
|
10
|
+
/** If set to true, it will prevent duplicate item insertion */
|
|
11
|
+
preventDuplicateInsertion?: boolean;
|
|
9
12
|
/** Text/Node displayed */
|
|
10
|
-
text
|
|
13
|
+
text?: string | ReactNode;
|
|
11
14
|
}
|
|
12
15
|
export declare type autoCompleteSize = 'medium' | 'small';
|
|
13
16
|
export declare type AutoCompleteValue = string | string[] | AutoCompleteOption | AutoCompleteOption[];
|
|
@@ -16,7 +19,6 @@ export interface AutoCompleteOption {
|
|
|
16
19
|
group?: string;
|
|
17
20
|
title: string;
|
|
18
21
|
}
|
|
19
|
-
export declare const parseAutoCompleteValue: (value: AutoCompleteValue) => string;
|
|
20
22
|
export interface AutoCompleteProps extends CommonProps {
|
|
21
23
|
/** Action button as the last element on the menu **/
|
|
22
24
|
actionItem?: ActionItem;
|
|
@@ -24,6 +26,8 @@ export interface AutoCompleteProps extends CommonProps {
|
|
|
24
26
|
autoFocus?: boolean;
|
|
25
27
|
/** default option that is selected */
|
|
26
28
|
defaultValue?: AutoCompleteValue;
|
|
29
|
+
/** When `true` input textbox will be small size, when `false` it will be medium size. Default value is `true`. **/
|
|
30
|
+
dense?: boolean;
|
|
27
31
|
/** Disable the portal behavior. If true, children stay within parent DOM hierarchy. */
|
|
28
32
|
disablePortal?: boolean;
|
|
29
33
|
/** If true, the input will be disabled. */
|
|
@@ -67,4 +71,4 @@ export interface AutoCompleteProps extends CommonProps {
|
|
|
67
71
|
/** value if this is a controlled component */
|
|
68
72
|
value?: AutoCompleteValue;
|
|
69
73
|
}
|
|
70
|
-
export declare const DotAutoComplete: ({ actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, disabled, disablePortal, error, freesolo, group, helperText, inputId, inputRef, label, loading, multiple, onChange, onClose, onInputChange, onOpen, open, options, placeholder, required, size, value, }: AutoCompleteProps) => JSX.Element;
|
|
74
|
+
export declare const DotAutoComplete: ({ actionItem, ariaLabel, autoFocus, className, "data-testid": dataTestId, defaultValue, dense, disabled, disablePortal, error, freesolo, group, helperText, inputId, inputRef, label, loading, multiple, onChange, onClose, onInputChange, onOpen, open, options, placeholder, required, size, value, }: AutoCompleteProps) => JSX.Element;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { Autocomplete } from '@material-ui/lab';
|
|
2
2
|
export declare const rootClassName = "dot-autocomplete";
|
|
3
|
+
export declare const inputRootClassName = "dot-input-root";
|
|
4
|
+
export declare const inputMediumClassName = "dot-input-medium";
|
|
3
5
|
export declare const StyledAutocomplete: import("styled-components").StyledComponent<typeof Autocomplete, any, {}, never>;
|
|
@@ -1,5 +1,21 @@
|
|
|
1
|
+
import { ActionItem } from './AutoComplete';
|
|
1
2
|
export declare const movies: {
|
|
2
3
|
group: string;
|
|
3
4
|
title: string;
|
|
4
5
|
error: boolean;
|
|
5
6
|
}[];
|
|
7
|
+
export declare const handleActionItemClick: (newItem?: string) => void;
|
|
8
|
+
export declare const actionItemOptions: ActionItem[];
|
|
9
|
+
export declare const actionItemArgType: {
|
|
10
|
+
options: string[];
|
|
11
|
+
mapping: ActionItem[];
|
|
12
|
+
control: {
|
|
13
|
+
type: string;
|
|
14
|
+
labels: {
|
|
15
|
+
0: string;
|
|
16
|
+
1: string;
|
|
17
|
+
2: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
defaultValue: string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AutocompleteGetTagProps } from '@material-ui/lab';
|
|
3
|
+
import { ChipSize } from '../../chip/Chip';
|
|
4
|
+
import { AutoCompleteOption, AutoCompleteValue } from '../AutoComplete';
|
|
5
|
+
export declare const parseAutoCompleteValue: (value: AutoCompleteValue) => string;
|
|
6
|
+
export declare const getChipsFromAutocomplete: (values: Array<AutoCompleteOption | string>, getTagProps: AutocompleteGetTagProps, chipSize?: ChipSize) => JSX.Element[];
|
|
7
|
+
export declare const checkIfDuplicateItem: (itemText: string, autocompleteOptions: AutoCompleteOption[]) => boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MouseEvent, ReactNode
|
|
1
|
+
import { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
2
|
import { CommonProps } from '../CommonProps';
|
|
3
3
|
export declare type DrawerAnchor = 'bottom' | 'left' | 'right' | 'top';
|
|
4
4
|
export declare type DrawerVariant = 'permanent' | 'persistent' | 'temporary';
|
|
@@ -23,11 +23,11 @@ export interface DrawerProps extends CommonProps {
|
|
|
23
23
|
/** string or JSX element that is displayed inside the drawer */
|
|
24
24
|
children?: ReactNode;
|
|
25
25
|
/** Props applied to drawer body */
|
|
26
|
-
drawerBodyProps?: DrawerSection
|
|
26
|
+
drawerBodyProps?: Omit<DrawerSection, 'ariaLabel'>;
|
|
27
27
|
/** Props applied to drawer footer */
|
|
28
|
-
drawerFooterProps?: DrawerSection
|
|
28
|
+
drawerFooterProps?: Omit<DrawerSection, 'ariaLabel'>;
|
|
29
29
|
/** Props applied to drawer header */
|
|
30
|
-
drawerHeaderProps?: DrawerSection
|
|
30
|
+
drawerHeaderProps?: Omit<DrawerSection, 'ariaLabel'>;
|
|
31
31
|
/** The height of the drawer when anchor is 'top' or 'bottom' */
|
|
32
32
|
height?: string;
|
|
33
33
|
/** Callback fired when the component requests to be closed. */
|
|
@@ -28,7 +28,7 @@ export { DotActionToolbar } from './action-toolbar/ActionToolbar';
|
|
|
28
28
|
export { DotAlertBanner } from './alert-banner/AlertBanner';
|
|
29
29
|
export { DotAppLogo } from './app-logo/AppLogo';
|
|
30
30
|
export { DotAppToolbar } from './app-toolbar/AppToolbar';
|
|
31
|
-
export { DotAutoComplete
|
|
31
|
+
export { DotAutoComplete } from './auto-complete/AutoComplete';
|
|
32
32
|
export { DotAvatar } from './avatar/Avatar';
|
|
33
33
|
export { DotAvatarGroup } from './avatar-group/AvatarGroup';
|
|
34
34
|
export { DotBadge } from './badge/Badge';
|
|
@@ -77,3 +77,4 @@ export { DotTooltip } from './tooltip/Tooltip';
|
|
|
77
77
|
export { DotTabs } from './tabs/Tabs';
|
|
78
78
|
export { DotTypography } from './typography/Typography';
|
|
79
79
|
export { DotFileUpload } from './file-upload/FileUpload';
|
|
80
|
+
export { parseAutoCompleteValue } from './auto-complete/utils/helpers';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { MouseEvent } from 'react';
|
|
2
2
|
import { ListItemProps } from '../list/utils/models';
|
|
3
|
+
export declare const childElement: JSX.Element;
|
|
3
4
|
export declare const getNavigationItems: (isSelected: (key: number) => boolean, handleClick: (key: number) => void) => ({
|
|
4
5
|
startIconId: string;
|
|
5
6
|
onClick: import("@storybook/addon-actions").HandlerFunction;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TextAlignment } from './TableCell';
|
|
3
|
+
import { TableProps } from './Table';
|
|
3
4
|
export declare const actionMenuColumns: ({
|
|
4
5
|
id: string;
|
|
5
6
|
label: string;
|
|
@@ -119,3 +120,4 @@ export declare const paginatedData: {
|
|
|
119
120
|
hit: string;
|
|
120
121
|
};
|
|
121
122
|
}[];
|
|
123
|
+
export declare const MultiSelectTable: (props: TableProps) => JSX.Element;
|