@digital-ai/dot-components 2.7.3 → 2.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 +39 -11
- package/index.esm.js +244 -131
- package/index.umd.js +446 -296
- package/lib/Typography.stories.d.ts +1 -1
- package/lib/components/AccessibilityProps.d.ts +1 -0
- package/lib/components/CommonProps.d.ts +3 -0
- package/lib/components/app-switcher/AppSwitcher.styles.d.ts +1 -1
- package/lib/components/app-toolbar/AppToolbar.styles.d.ts +1 -1
- package/lib/components/auto-complete/AutoComplete.d.ts +7 -3
- package/lib/components/auto-complete/AutoComplete.stories.d.ts +3 -1
- package/lib/components/auto-complete/AutoComplete.stories.styles.d.ts +2 -0
- package/lib/components/auto-complete/Autocomplete.stories.data.d.ts +1 -5
- package/lib/components/auto-complete/index.d.ts +1 -1
- package/lib/components/avatar/Avatar.d.ts +1 -1
- package/lib/components/avatar/Avatar.stories.d.ts +1 -1
- package/lib/components/button/IconButton.d.ts +1 -1
- package/lib/components/button/IconButton.stories.d.ts +1 -1
- package/lib/components/date-picker/DatePicker.d.ts +6 -3
- package/lib/components/date-picker/DatePicker.stories.d.ts +1 -5
- package/lib/components/date-picker/index.d.ts +2 -0
- package/lib/components/date-picker/utils/helpers.d.ts +5 -0
- package/lib/components/date-picker/utils/models.d.ts +5 -0
- package/lib/components/drawer/Drawer.d.ts +3 -1
- package/lib/components/drawer/Drawer.stories.d.ts +1 -1
- package/lib/components/drawer/DrawerBody.d.ts +1 -1
- package/lib/components/drawer/DrawerFooter.d.ts +1 -1
- package/lib/components/file-upload/FileUpload.d.ts +1 -1
- package/lib/components/file-upload/FileUpload.stories.d.ts +1 -1
- package/lib/components/icon/Icon.d.ts +1 -1
- package/lib/components/icon/Icon.stories.d.ts +1 -1
- package/lib/components/index.d.ts +2 -2
- package/lib/components/inline-edit/InlineEdit.d.ts +1 -1
- package/lib/components/inline-edit/InlineEdit.stories.d.ts +1 -1
- package/lib/components/link/Link.d.ts +1 -1
- package/lib/components/link/Link.stories.d.ts +1 -1
- package/lib/components/list/List.d.ts +2 -2
- package/lib/components/list/List.stories.d.ts +1 -1
- package/lib/components/list/NestedList.styles.d.ts +1 -1
- package/lib/components/menu/Menu.d.ts +1 -1
- package/lib/components/menu/Menu.stories.d.ts +1 -1
- package/lib/components/radio/RadioGroup.d.ts +1 -1
- package/lib/components/radio/RadioGroup.stories.d.ts +1 -1
- package/lib/components/search-input/SearchInput.d.ts +1 -1
- package/lib/components/split-button/SplitButton.styles.d.ts +1 -1
- package/lib/components/stepper/Stepper.styles.d.ts +1 -1
- package/lib/components/table/Table.styles.d.ts +1 -1
- package/lib/components/table/TableActions.styles.d.ts +1 -1
- package/lib/components/time-picker/TimePicker.d.ts +12 -5
- package/lib/components/time-picker/TimePicker.stories.d.ts +3 -2
- package/lib/components/time-picker/TimePicker.stories.styles.d.ts +2 -0
- package/lib/components/time-picker/utils/helpers.d.ts +2 -0
- package/lib/components/tooltip/Tooltip.d.ts +1 -1
- package/lib/components/tooltip/Tooltip.stories.d.ts +1 -1
- package/lib/components/typography/Typography.d.ts +3 -1
- package/lib/components/typography/Typography.stories.d.ts +1 -1
- package/package.json +1 -1
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useEffect, useState, useRef, useMemo, useContext, createContext, forwardRef, Fragment, useCallback, createElement, useLayoutEffect } from 'react';
|
|
4
4
|
import { Tooltip, Icon, Typography, Accordion, AccordionSummary, AccordionDetails, AccordionActions, InputAdornment, InputLabel, TextField, Toolbar, Alert, Fade, StyledEngineProvider, Avatar, Button, darken, Link, List, ListItem, CircularProgress, Popper, MenuList, MenuItem, Paper, ClickAwayListener, Drawer, IconButton, ListItemIcon, Collapse, ListSubheader, Divider, ListItemText, Badge, useMediaQuery, Autocomplete, Chip, AvatarGroup, Breadcrumbs, ToggleButtonGroup, ToggleButton, Card, CardContent, CardHeader, FormControlLabel, Checkbox, FormControl, FormGroup, FormLabel, FormHelperText, Dialog, DialogContent, DialogActions, useTheme as useTheme$1, RadioGroup, Radio, Switch, Skeleton, Snackbar, ButtonGroup, Stepper, Step, StepLabel, StepContent, TablePagination, TableContainer, TableCell, TableRow, TableBody, TableSortLabel, TableHead, Table, Tabs, Tab, LinearProgress } from '@mui/material';
|
|
5
5
|
import '@digital-ai/dot-icons';
|
|
6
6
|
import styled, { css, createGlobalStyle, ThemeProvider as ThemeProvider$1, keyframes } from 'styled-components';
|
|
@@ -21,6 +21,7 @@ function useStylesWithRootClass(name, className, ...args) {
|
|
|
21
21
|
|
|
22
22
|
const DotTooltip = ({
|
|
23
23
|
ariaLabel,
|
|
24
|
+
ariaRole: _ariaRole = 'tooltip',
|
|
24
25
|
children,
|
|
25
26
|
className,
|
|
26
27
|
'data-testid': dataTestId,
|
|
@@ -39,6 +40,7 @@ const DotTooltip = ({
|
|
|
39
40
|
onClose: onClose,
|
|
40
41
|
open: open,
|
|
41
42
|
placement: _placement,
|
|
43
|
+
role: _ariaRole,
|
|
42
44
|
title: title
|
|
43
45
|
}, {
|
|
44
46
|
children: jsx("span", {
|
|
@@ -55,6 +57,7 @@ const StyledIcon = styled(Icon).withConfig({
|
|
|
55
57
|
|
|
56
58
|
const DotIcon = ({
|
|
57
59
|
ariaLabel,
|
|
60
|
+
ariaRole: _ariaRole = 'img',
|
|
58
61
|
className,
|
|
59
62
|
'data-testid': dataTestId,
|
|
60
63
|
fontSize: _fontSize = 'medium',
|
|
@@ -72,11 +75,13 @@ const DotIcon = ({
|
|
|
72
75
|
root: rootClasses
|
|
73
76
|
},
|
|
74
77
|
"data-testid": dataTestId,
|
|
75
|
-
fontSize: _fontSize
|
|
78
|
+
fontSize: _fontSize,
|
|
79
|
+
role: _ariaRole
|
|
76
80
|
}, {
|
|
77
81
|
children: jsx("i", {
|
|
78
82
|
className: `icon-${iconId} dot-i`,
|
|
79
|
-
"data-testid": dataTestId && `${dataTestId}-i
|
|
83
|
+
"data-testid": dataTestId && `${dataTestId}-i`,
|
|
84
|
+
role: _ariaRole
|
|
80
85
|
}, void 0)
|
|
81
86
|
}), void 0)
|
|
82
87
|
}), void 0);
|
|
@@ -84,6 +89,8 @@ const DotIcon = ({
|
|
|
84
89
|
|
|
85
90
|
const DotTypography = ({
|
|
86
91
|
ariaLabel,
|
|
92
|
+
ariaLevel,
|
|
93
|
+
ariaRole,
|
|
87
94
|
className,
|
|
88
95
|
'data-testid': dataTestId,
|
|
89
96
|
children,
|
|
@@ -93,14 +100,21 @@ const DotTypography = ({
|
|
|
93
100
|
variant
|
|
94
101
|
}) => {
|
|
95
102
|
const rootClasses = useStylesWithRootClass('dot-typography', className);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (ariaRole === 'heading' && !ariaLevel) {
|
|
105
|
+
console.warn('please include ariaLevel when using ariaRole="heading"');
|
|
106
|
+
}
|
|
107
|
+
}, []);
|
|
96
108
|
return jsx(Typography, Object.assign({
|
|
97
109
|
"aria-label": ariaLabel,
|
|
110
|
+
"aria-level": ariaLevel,
|
|
98
111
|
classes: {
|
|
99
112
|
root: rootClasses
|
|
100
113
|
},
|
|
101
114
|
component: component,
|
|
102
115
|
"data-testid": dataTestId,
|
|
103
116
|
noWrap: noWrap,
|
|
117
|
+
role: ariaRole,
|
|
104
118
|
style: {
|
|
105
119
|
marginBottom: noMarginBottom ? 0 : undefined
|
|
106
120
|
},
|
|
@@ -1655,6 +1669,7 @@ const AvatarContent = ({
|
|
|
1655
1669
|
const DotAvatar = ({
|
|
1656
1670
|
alt,
|
|
1657
1671
|
ariaLabel,
|
|
1672
|
+
ariaRole: _ariaRole = 'img',
|
|
1658
1673
|
className,
|
|
1659
1674
|
component: _component = 'div',
|
|
1660
1675
|
color,
|
|
@@ -1691,6 +1706,7 @@ const DotAvatar = ({
|
|
|
1691
1706
|
component: onClick ? 'button' : _component,
|
|
1692
1707
|
"data-testid": dataTestId,
|
|
1693
1708
|
onClick: event => onClick ? onClick(event) : null,
|
|
1709
|
+
role: onClick ? 'button' : _ariaRole,
|
|
1694
1710
|
src: _type === 'image' ? imageSrc : null,
|
|
1695
1711
|
style: style,
|
|
1696
1712
|
tabIndex: tooltip ? _tabIndex : undefined,
|
|
@@ -1700,9 +1716,9 @@ const DotAvatar = ({
|
|
|
1700
1716
|
"data-testid": dataTestId,
|
|
1701
1717
|
iconId: iconId,
|
|
1702
1718
|
imageSrc: imageSrc,
|
|
1719
|
+
size: _size,
|
|
1703
1720
|
text: _text,
|
|
1704
|
-
type: _type
|
|
1705
|
-
size: _size
|
|
1721
|
+
type: _type
|
|
1706
1722
|
}, void 0)
|
|
1707
1723
|
}), void 0)
|
|
1708
1724
|
}), void 0);
|
|
@@ -1719,6 +1735,7 @@ const StyledButton = styled(Button).withConfig({
|
|
|
1719
1735
|
/** This component wraps the Button component from @material-ui. */
|
|
1720
1736
|
const DotButton = /*#__PURE__*/forwardRef(({
|
|
1721
1737
|
ariaLabel,
|
|
1738
|
+
ariaRole: _ariaRole = 'button',
|
|
1722
1739
|
autoFocus: _autoFocus = false,
|
|
1723
1740
|
children,
|
|
1724
1741
|
className,
|
|
@@ -1775,6 +1792,7 @@ const DotButton = /*#__PURE__*/forwardRef(({
|
|
|
1775
1792
|
onClick: event => onClick && onClick(event),
|
|
1776
1793
|
onKeyDown: onKeyDown,
|
|
1777
1794
|
ref: ref,
|
|
1795
|
+
role: _ariaRole,
|
|
1778
1796
|
size: _size,
|
|
1779
1797
|
startIcon: startIcon,
|
|
1780
1798
|
tabIndex: tabIndex,
|
|
@@ -1794,6 +1812,7 @@ const StyledLink = styled(Link).withConfig({
|
|
|
1794
1812
|
|
|
1795
1813
|
const DotLink = ({
|
|
1796
1814
|
ariaLabel,
|
|
1815
|
+
ariaRole: _ariaRole = 'link',
|
|
1797
1816
|
children,
|
|
1798
1817
|
className,
|
|
1799
1818
|
color: _color = 'primary',
|
|
@@ -1831,6 +1850,7 @@ const DotLink = ({
|
|
|
1831
1850
|
onMouseEnter: onMouseEnter,
|
|
1832
1851
|
onPointerDown: onPointerDown,
|
|
1833
1852
|
rel: _rel,
|
|
1853
|
+
role: _ariaRole,
|
|
1834
1854
|
tabIndex: _tabIndex,
|
|
1835
1855
|
target: target,
|
|
1836
1856
|
underline: underline
|
|
@@ -2126,6 +2146,7 @@ const DotMenuList = /*#__PURE__*/forwardRef(({
|
|
|
2126
2146
|
const DotMenu = ({
|
|
2127
2147
|
anchorEl,
|
|
2128
2148
|
ariaLabel,
|
|
2149
|
+
ariaRole: _ariaRole = 'menu',
|
|
2129
2150
|
className,
|
|
2130
2151
|
'data-testid': dataTestId,
|
|
2131
2152
|
dense: _dense = true,
|
|
@@ -2223,6 +2244,7 @@ const DotMenu = ({
|
|
|
2223
2244
|
onSelect: onSelect,
|
|
2224
2245
|
selectedKey: selectedKey
|
|
2225
2246
|
}, void 0),
|
|
2247
|
+
ariaRole: _ariaRole,
|
|
2226
2248
|
selectedKey: selectedKey
|
|
2227
2249
|
}, void 0)
|
|
2228
2250
|
}), void 0)
|
|
@@ -2269,6 +2291,7 @@ const StyledIconButton = styled(IconButton).withConfig({
|
|
|
2269
2291
|
|
|
2270
2292
|
const DotIconButton = ({
|
|
2271
2293
|
ariaLabel,
|
|
2294
|
+
ariaRole: _ariaRole = 'button',
|
|
2272
2295
|
className,
|
|
2273
2296
|
color: _color = 'inherit',
|
|
2274
2297
|
'data-testid': dataTestId,
|
|
@@ -2296,6 +2319,7 @@ const DotIconButton = ({
|
|
|
2296
2319
|
disableRipple: _disableRipple,
|
|
2297
2320
|
disabled: _disabled,
|
|
2298
2321
|
onClick: event => onClick && onClick(event),
|
|
2322
|
+
role: _ariaRole,
|
|
2299
2323
|
size: _size
|
|
2300
2324
|
}, {
|
|
2301
2325
|
children: jsx(DotIcon, {
|
|
@@ -2318,8 +2342,10 @@ const DotDrawerHeader = ({
|
|
|
2318
2342
|
const rootClasses = useStylesWithRootClass(rootClassName$T, className);
|
|
2319
2343
|
return jsxs(StyleDrawerHeader, Object.assign({
|
|
2320
2344
|
"aria-label": ariaLabel,
|
|
2345
|
+
"aria-level": 2,
|
|
2321
2346
|
className: rootClasses,
|
|
2322
|
-
"data-testid": dataTestId
|
|
2347
|
+
"data-testid": dataTestId,
|
|
2348
|
+
role: "heading"
|
|
2323
2349
|
}, {
|
|
2324
2350
|
children: [children, variant !== 'permanent' && jsx(DotIconButton, {
|
|
2325
2351
|
className: "close-button",
|
|
@@ -2337,6 +2363,7 @@ const StyleDrawerBody = styled.div.withConfig({
|
|
|
2337
2363
|
|
|
2338
2364
|
const DotDrawerBody = ({
|
|
2339
2365
|
ariaLabel,
|
|
2366
|
+
ariaRole: _ariaRole = 'region',
|
|
2340
2367
|
children,
|
|
2341
2368
|
className,
|
|
2342
2369
|
'data-testid': dataTestId,
|
|
@@ -2348,7 +2375,8 @@ const DotDrawerBody = ({
|
|
|
2348
2375
|
return jsxs(StyleDrawerBody, Object.assign({
|
|
2349
2376
|
"aria-label": ariaLabel,
|
|
2350
2377
|
className: rootClasses,
|
|
2351
|
-
"data-testid": dataTestId
|
|
2378
|
+
"data-testid": dataTestId,
|
|
2379
|
+
role: _ariaRole
|
|
2352
2380
|
}, {
|
|
2353
2381
|
children: [children, !headerExists && variant !== 'permanent' && jsx(DotIconButton, {
|
|
2354
2382
|
className: "dot-drawer-close-button",
|
|
@@ -2368,6 +2396,7 @@ const StyleDrawerFooter = styled.div.withConfig({
|
|
|
2368
2396
|
|
|
2369
2397
|
const DotDrawerFooter = ({
|
|
2370
2398
|
ariaLabel,
|
|
2399
|
+
ariaRole: _ariaRole = 'region',
|
|
2371
2400
|
children,
|
|
2372
2401
|
className,
|
|
2373
2402
|
'data-testid': dataTestId
|
|
@@ -2376,7 +2405,8 @@ const DotDrawerFooter = ({
|
|
|
2376
2405
|
return jsx(StyleDrawerFooter, Object.assign({
|
|
2377
2406
|
"aria-label": ariaLabel,
|
|
2378
2407
|
className: rootClasses,
|
|
2379
|
-
"data-testid": dataTestId
|
|
2408
|
+
"data-testid": dataTestId,
|
|
2409
|
+
role: _ariaRole
|
|
2380
2410
|
}, {
|
|
2381
2411
|
children: children
|
|
2382
2412
|
}), void 0);
|
|
@@ -2385,6 +2415,7 @@ const DotDrawerFooter = ({
|
|
|
2385
2415
|
const DotDrawer = ({
|
|
2386
2416
|
anchor: _anchor = 'right',
|
|
2387
2417
|
ariaLabel,
|
|
2418
|
+
ariaRole: _ariaRole = 'presentation',
|
|
2388
2419
|
className,
|
|
2389
2420
|
children,
|
|
2390
2421
|
'data-testid': dataTestId,
|
|
@@ -2414,7 +2445,9 @@ const DotDrawer = ({
|
|
|
2414
2445
|
const bodyTestId = drawerBodyProps ? drawerBodyProps[`data-testid`] : 'drawer-body';
|
|
2415
2446
|
return jsxs(StyledDrawer, Object.assign({
|
|
2416
2447
|
ModalProps: ModalProps,
|
|
2417
|
-
PaperProps: PaperProps,
|
|
2448
|
+
PaperProps: Object.assign(Object.assign({}, PaperProps), {
|
|
2449
|
+
role: _ariaRole
|
|
2450
|
+
}),
|
|
2418
2451
|
anchor: _anchor,
|
|
2419
2452
|
"aria-label": ariaLabel,
|
|
2420
2453
|
classes: {
|
|
@@ -2425,6 +2458,7 @@ const DotDrawer = ({
|
|
|
2425
2458
|
height: height,
|
|
2426
2459
|
onClose: handleClose,
|
|
2427
2460
|
open: open,
|
|
2461
|
+
role: _ariaRole,
|
|
2428
2462
|
variant: _variant,
|
|
2429
2463
|
width: _width
|
|
2430
2464
|
}, {
|
|
@@ -2483,6 +2517,7 @@ const DotListDivider = ({
|
|
|
2483
2517
|
};
|
|
2484
2518
|
const DotList = ({
|
|
2485
2519
|
ariaLabel,
|
|
2520
|
+
ariaRole: _ariaRole = 'list',
|
|
2486
2521
|
children,
|
|
2487
2522
|
className,
|
|
2488
2523
|
component: _component = 'ul',
|
|
@@ -2512,6 +2547,7 @@ const DotList = ({
|
|
|
2512
2547
|
dense: _dense,
|
|
2513
2548
|
disablePadding: _disablePadding,
|
|
2514
2549
|
ref: listRef,
|
|
2550
|
+
role: _ariaRole,
|
|
2515
2551
|
style: {
|
|
2516
2552
|
width: listWidth
|
|
2517
2553
|
}
|
|
@@ -2568,6 +2604,7 @@ const DotList = ({
|
|
|
2568
2604
|
};
|
|
2569
2605
|
const DotListItem = ({
|
|
2570
2606
|
ariaLabel,
|
|
2607
|
+
ariaRole: _ariaRole2 = 'listitem',
|
|
2571
2608
|
className,
|
|
2572
2609
|
component: _component2 = 'li',
|
|
2573
2610
|
'data-testid': dataTestId,
|
|
@@ -2634,6 +2671,7 @@ const DotListItem = ({
|
|
|
2634
2671
|
divider: _divider,
|
|
2635
2672
|
href: onClick ? null : href,
|
|
2636
2673
|
onClick: onClick || !href ? handleClick : null,
|
|
2674
|
+
role: onClick ? 'button' : _ariaRole2,
|
|
2637
2675
|
selected: isFlyout ? isOpened : selected,
|
|
2638
2676
|
target: target
|
|
2639
2677
|
}, {
|
|
@@ -2984,6 +3022,7 @@ const StyledSearchInput = styled.span.withConfig({
|
|
|
2984
3022
|
|
|
2985
3023
|
function SearchInput({
|
|
2986
3024
|
'data-testid': dataTestId,
|
|
3025
|
+
ariaRole = 'searchbox',
|
|
2987
3026
|
autoFocus = true,
|
|
2988
3027
|
className,
|
|
2989
3028
|
disabled = false,
|
|
@@ -3028,6 +3067,7 @@ function SearchInput({
|
|
|
3028
3067
|
title: tooltip
|
|
3029
3068
|
}, {
|
|
3030
3069
|
children: jsx(DotInputText, {
|
|
3070
|
+
ariaRole: ariaRole,
|
|
3031
3071
|
"data-testid": dataTestId,
|
|
3032
3072
|
autoFocus: autoFocus,
|
|
3033
3073
|
className: "search-text",
|
|
@@ -3504,7 +3544,8 @@ const DotAppSwitcherView = ({
|
|
|
3504
3544
|
if (selectedAppType && appTypeMap && appTypeLabels) {
|
|
3505
3545
|
const labelConfig = appTypeLabels.get(selectedAppType);
|
|
3506
3546
|
return jsxs("div", Object.assign({
|
|
3507
|
-
className: "content"
|
|
3547
|
+
className: "content",
|
|
3548
|
+
role: "contentinfo"
|
|
3508
3549
|
}, {
|
|
3509
3550
|
children: [jsx("span", {
|
|
3510
3551
|
children: jsx(DotButton, Object.assign({
|
|
@@ -3520,7 +3561,9 @@ const DotAppSwitcherView = ({
|
|
|
3520
3561
|
}, void 0)
|
|
3521
3562
|
}), void 0)
|
|
3522
3563
|
}, void 0), jsx("div", Object.assign({
|
|
3523
|
-
|
|
3564
|
+
"aria-level": 2,
|
|
3565
|
+
className: "product-heading",
|
|
3566
|
+
role: "heading"
|
|
3524
3567
|
}, {
|
|
3525
3568
|
children: createAppTypeLabel(selectedAppType, labelConfig.logo, labelConfig.singleTypeApps)
|
|
3526
3569
|
}), void 0), ((_a = appTypeMap === null || appTypeMap === void 0 ? void 0 : appTypeMap.get(selectedAppType)) === null || _a === void 0 ? void 0 : _a.length) >= _searchInstancesThreshold && jsx("div", Object.assign({
|
|
@@ -3533,14 +3576,16 @@ const DotAppSwitcherView = ({
|
|
|
3533
3576
|
value: searchText
|
|
3534
3577
|
}, void 0)
|
|
3535
3578
|
}), void 0), jsx("div", Object.assign({
|
|
3536
|
-
className: "product-applications"
|
|
3579
|
+
className: "product-applications",
|
|
3580
|
+
role: "list"
|
|
3537
3581
|
}, {
|
|
3538
3582
|
children: filteredAppInstances()
|
|
3539
3583
|
}), void 0)]
|
|
3540
3584
|
}), void 0);
|
|
3541
3585
|
} else {
|
|
3542
3586
|
return jsxs("div", Object.assign({
|
|
3543
|
-
className: "content"
|
|
3587
|
+
className: "content",
|
|
3588
|
+
role: "contentinfo"
|
|
3544
3589
|
}, {
|
|
3545
3590
|
children: [jsx(DotList, {
|
|
3546
3591
|
items: appTypeMenuItems === null || appTypeMenuItems === void 0 ? void 0 : appTypeMenuItems.map(item => ({
|
|
@@ -3554,7 +3599,9 @@ const DotAppSwitcherView = ({
|
|
|
3554
3599
|
const header = {
|
|
3555
3600
|
className: 'app-switcher-header',
|
|
3556
3601
|
children: jsxs("div", Object.assign({
|
|
3602
|
+
"aria-level": 1,
|
|
3557
3603
|
className: "app-switcher-header-title",
|
|
3604
|
+
role: "heading",
|
|
3558
3605
|
style: {
|
|
3559
3606
|
marginTop: _yOffset + 'px',
|
|
3560
3607
|
width: '80%'
|
|
@@ -3566,6 +3613,8 @@ const DotAppSwitcherView = ({
|
|
|
3566
3613
|
type: "image",
|
|
3567
3614
|
variant: "circular"
|
|
3568
3615
|
}, void 0), jsx(DotTypography, Object.assign({
|
|
3616
|
+
ariaRole: "heading",
|
|
3617
|
+
ariaLevel: 1,
|
|
3569
3618
|
className: "app-switcher-label"
|
|
3570
3619
|
}, {
|
|
3571
3620
|
children: "App switcher"
|
|
@@ -4307,8 +4356,10 @@ const DotAutoComplete = ({
|
|
|
4307
4356
|
disablePortal: _disablePortal = true,
|
|
4308
4357
|
endAdornmentTooltip,
|
|
4309
4358
|
error: _error = false,
|
|
4359
|
+
filterOptions,
|
|
4310
4360
|
filterSelectedOptions: _filterSelectedOptions = true,
|
|
4311
4361
|
freesolo: _freesolo = true,
|
|
4362
|
+
checkIfOptionDisabled,
|
|
4312
4363
|
group: _group = false,
|
|
4313
4364
|
helperText,
|
|
4314
4365
|
inputId,
|
|
@@ -4527,9 +4578,11 @@ const DotAutoComplete = ({
|
|
|
4527
4578
|
"data-testid": dataTestId,
|
|
4528
4579
|
defaultValue: defaultValue,
|
|
4529
4580
|
disabled: _disabled,
|
|
4581
|
+
filterOptions: filterOptions,
|
|
4530
4582
|
filterSelectedOptions: _filterSelectedOptions,
|
|
4531
4583
|
freeSolo: _freesolo,
|
|
4532
4584
|
getOptionLabel: option => parseAutoCompleteValue(option),
|
|
4585
|
+
getOptionDisabled: checkIfOptionDisabled,
|
|
4533
4586
|
groupBy: _group ? option => option.group : undefined,
|
|
4534
4587
|
ListboxComponent: ListboxComponent,
|
|
4535
4588
|
loading: loading,
|
|
@@ -4967,7 +5020,9 @@ const DotBreadcrumbs = ({
|
|
|
4967
5020
|
itemsAfterCollapse: itemsAfterCollapse,
|
|
4968
5021
|
maxItems: getMaxItems(adjustMaxItems, maxVisibleItems, maxItems),
|
|
4969
5022
|
ref: breadcrumbRef,
|
|
5023
|
+
role: "navigation",
|
|
4970
5024
|
separator: jsx(DotIcon, {
|
|
5025
|
+
ariaRole: "presentation",
|
|
4971
5026
|
className: "separator",
|
|
4972
5027
|
iconId: "chevron-right"
|
|
4973
5028
|
}, void 0)
|
|
@@ -6250,6 +6305,7 @@ function DotRadioButton({
|
|
|
6250
6305
|
return jsx(StyledFormControlLabel, {
|
|
6251
6306
|
className: rootClasses,
|
|
6252
6307
|
control: radioControl,
|
|
6308
|
+
"aria-label": value,
|
|
6253
6309
|
label: label || radioControl,
|
|
6254
6310
|
labelPlacement: labelPlacement,
|
|
6255
6311
|
value: value
|
|
@@ -6258,6 +6314,7 @@ function DotRadioButton({
|
|
|
6258
6314
|
|
|
6259
6315
|
const DotRadioGroup = ({
|
|
6260
6316
|
ariaLabel,
|
|
6317
|
+
ariaRole: _ariaRole = 'radiogroup',
|
|
6261
6318
|
className,
|
|
6262
6319
|
'data-testid': dataTestId,
|
|
6263
6320
|
defaultValue,
|
|
@@ -6336,6 +6393,7 @@ const DotRadioGroup = ({
|
|
|
6336
6393
|
defaultValue: defaultValue,
|
|
6337
6394
|
name: name,
|
|
6338
6395
|
onChange: handleChange,
|
|
6396
|
+
role: _ariaRole,
|
|
6339
6397
|
row: row,
|
|
6340
6398
|
value: selectedValue
|
|
6341
6399
|
}, {
|
|
@@ -7052,6 +7110,7 @@ const checkIfEmptyValue = inputValue => inputValue.trim() === '';
|
|
|
7052
7110
|
*/
|
|
7053
7111
|
const DotInlineEdit = ({
|
|
7054
7112
|
ariaLabel,
|
|
7113
|
+
ariaRole: _ariaRole = 'combobox',
|
|
7055
7114
|
bindings,
|
|
7056
7115
|
charactersLimit,
|
|
7057
7116
|
className,
|
|
@@ -7184,7 +7243,8 @@ const DotInlineEdit = ({
|
|
|
7184
7243
|
children: viewModeChildren
|
|
7185
7244
|
}), void 0) : jsx("div", Object.assign({
|
|
7186
7245
|
className: viewModeClasses,
|
|
7187
|
-
"data-testid": dataTestId && `${dataTestId}-view-mode-wrapper
|
|
7246
|
+
"data-testid": dataTestId && `${dataTestId}-view-mode-wrapper`,
|
|
7247
|
+
role: "presentation"
|
|
7188
7248
|
}, {
|
|
7189
7249
|
children: viewModeChildren
|
|
7190
7250
|
}), void 0);
|
|
@@ -7256,6 +7316,7 @@ const DotInlineEdit = ({
|
|
|
7256
7316
|
onMouseOut: () => handleShowTooltip(false),
|
|
7257
7317
|
onKeyDown: !readOnly ? event => handleKeyPress(event) : undefined,
|
|
7258
7318
|
ref: inlineEditRef,
|
|
7319
|
+
role: _ariaRole,
|
|
7259
7320
|
tabIndex: !readOnly ? _tabIndex : undefined,
|
|
7260
7321
|
typography: _typography
|
|
7261
7322
|
}, {
|
|
@@ -7342,19 +7403,23 @@ const StyledPill = styled(Chip).withConfig({
|
|
|
7342
7403
|
componentId: "l7oxi2-0"
|
|
7343
7404
|
})(["", ""], ({
|
|
7344
7405
|
theme
|
|
7345
|
-
}) => css(["&.", "{background-color:", ";color:", ";
|
|
7406
|
+
}) => css(["&.", "{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}&.MuiChip-outlined{&.error{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}&.success{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}&.warning{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}&.in-progress{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}}&.MuiChip-filled{&.error{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}&.success{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}&.warning{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}&.in-progress{background-color:", ";border-color:", ";color:", ";.dot-icon{color:", ";}}}}"], rootClassName$n, ({
|
|
7346
7407
|
backgroundcolor
|
|
7347
7408
|
}) => {
|
|
7348
7409
|
return backgroundcolor || theme.palette.grey[200];
|
|
7410
|
+
}, ({
|
|
7411
|
+
bordercolor
|
|
7412
|
+
}) => {
|
|
7413
|
+
return bordercolor ? bordercolor : theme.palette.layer.n700;
|
|
7349
7414
|
}, ({
|
|
7350
7415
|
labelcolor
|
|
7351
7416
|
}) => {
|
|
7352
7417
|
return labelcolor ? labelcolor : theme.palette.layer.n700;
|
|
7353
7418
|
}, ({
|
|
7354
|
-
|
|
7419
|
+
labelcolor
|
|
7355
7420
|
}) => {
|
|
7356
|
-
return
|
|
7357
|
-
}, theme.palette.error[100], theme.palette.error.main, theme.palette.
|
|
7421
|
+
return labelcolor ? labelcolor : theme.palette.layer.n700;
|
|
7422
|
+
}, theme.palette.error[100], theme.palette.error.main, theme.palette.layer.n700, theme.palette.error.main, theme.palette.success[100], theme.palette.success.main, theme.palette.layer.n700, theme.palette.success.main, theme.palette.warning[100], theme.palette.warning.main, theme.palette.layer.n700, theme.palette.warning.main, theme.palette.primary[100], theme.palette.primary.main, theme.palette.layer.n700, theme.palette.primary.main, theme.palette.error.main, theme.palette.error.main, theme.palette.layer.n0, theme.palette.layer.n0, theme.palette.success.main, theme.palette.success.main, theme.palette.layer.n0, theme.palette.layer.n0, theme.palette.warning.main, theme.palette.warning.main, theme.palette.layer.n700, theme.palette.layer.n700, theme.palette.primary.main, theme.palette.primary.main, theme.palette.layer.n0, theme.palette.layer.n0));
|
|
7358
7423
|
|
|
7359
7424
|
const DotPill = ({
|
|
7360
7425
|
ariaLabel,
|
|
@@ -9177,6 +9242,7 @@ const joinAcceptedAndRejectedFiles = (filesAccepted, filesRejected) => mapAccept
|
|
|
9177
9242
|
const DotFileUpload = ({
|
|
9178
9243
|
accept,
|
|
9179
9244
|
ariaLabel,
|
|
9245
|
+
ariaRole: _ariaRole = 'region',
|
|
9180
9246
|
buttonOnly: _buttonOnly = false,
|
|
9181
9247
|
className,
|
|
9182
9248
|
'data-testid': dataTestId,
|
|
@@ -9240,7 +9306,8 @@ const DotFileUpload = ({
|
|
|
9240
9306
|
uploadedFiles
|
|
9241
9307
|
});
|
|
9242
9308
|
return jsxs(StyledFileUploadContainer, Object.assign({
|
|
9243
|
-
className: containerClassName$2
|
|
9309
|
+
className: containerClassName$2,
|
|
9310
|
+
role: _ariaRole
|
|
9244
9311
|
}, {
|
|
9245
9312
|
children: [jsxs(StyledFileUpload, Object.assign({}, getRootProps(), {
|
|
9246
9313
|
"aria-label": ariaLabel,
|
|
@@ -9468,6 +9535,26 @@ const DotLinearProgress = ({
|
|
|
9468
9535
|
}, void 0);
|
|
9469
9536
|
};
|
|
9470
9537
|
|
|
9538
|
+
var DatePickerKeydownContext;
|
|
9539
|
+
(function (DatePickerKeydownContext) {
|
|
9540
|
+
DatePickerKeydownContext[DatePickerKeydownContext["Input"] = 0] = "Input";
|
|
9541
|
+
DatePickerKeydownContext[DatePickerKeydownContext["PickerButton"] = 1] = "PickerButton";
|
|
9542
|
+
DatePickerKeydownContext[DatePickerKeydownContext["Popper"] = 2] = "Popper";
|
|
9543
|
+
})(DatePickerKeydownContext || (DatePickerKeydownContext = {}));
|
|
9544
|
+
|
|
9545
|
+
/** This returns a `boolean` indicating whether the Day.js object contains a valid date or not. */
|
|
9546
|
+
const checkIfValidDate = (date, format) => dayjs(date, format, true).isValid();
|
|
9547
|
+
const getContextEnumBasedOnTarget = (event, inputElement, contextEnum) => {
|
|
9548
|
+
const targetElement = event.target;
|
|
9549
|
+
const isWithinInput = inputElement === null || inputElement === void 0 ? void 0 : inputElement.contains(targetElement);
|
|
9550
|
+
let currentContextEnum = contextEnum;
|
|
9551
|
+
// Key was captured within text field but not on the input itself
|
|
9552
|
+
if (contextEnum === DatePickerKeydownContext.Input && !isWithinInput) {
|
|
9553
|
+
currentContextEnum = DatePickerKeydownContext.PickerButton;
|
|
9554
|
+
}
|
|
9555
|
+
return currentContextEnum;
|
|
9556
|
+
};
|
|
9557
|
+
|
|
9471
9558
|
const rootClassName$1 = 'dot-date-picker';
|
|
9472
9559
|
const containerClassName$1 = 'dot-date-picker-container';
|
|
9473
9560
|
const rectanglePickersDayClassName = 'dot-rectangle-pickers-day';
|
|
@@ -9494,6 +9581,7 @@ const RectanglePickersDay = pickersDayProps => {
|
|
|
9494
9581
|
disableRipple: true
|
|
9495
9582
|
}), void 0);
|
|
9496
9583
|
};
|
|
9584
|
+
const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD';
|
|
9497
9585
|
const DotDatePicker = ({
|
|
9498
9586
|
ariaLabel,
|
|
9499
9587
|
autoFocus: _autoFocus = false,
|
|
@@ -9524,6 +9612,7 @@ const DotDatePicker = ({
|
|
|
9524
9612
|
onChange,
|
|
9525
9613
|
onClose,
|
|
9526
9614
|
onError,
|
|
9615
|
+
onKeyDown,
|
|
9527
9616
|
onOpen,
|
|
9528
9617
|
open,
|
|
9529
9618
|
persistentLabel,
|
|
@@ -9532,7 +9621,7 @@ const DotDatePicker = ({
|
|
|
9532
9621
|
showDaysOutsideCurrentMonth,
|
|
9533
9622
|
value
|
|
9534
9623
|
}) => {
|
|
9535
|
-
const
|
|
9624
|
+
const displayFormat = format || DEFAULT_DATE_FORMAT;
|
|
9536
9625
|
const hasValueWithoutChangeHandler = value !== undefined && onChange === undefined;
|
|
9537
9626
|
const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
|
|
9538
9627
|
const isInputReadOnly = _readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
|
|
@@ -9566,13 +9655,13 @@ const DotDatePicker = ({
|
|
|
9566
9655
|
}, [locale]);
|
|
9567
9656
|
const handleChange = (changedValue, context) => {
|
|
9568
9657
|
if (!onChange || changedValue && !changedValue.isValid()) return;
|
|
9569
|
-
onChange(changedValue ? changedValue.format(
|
|
9658
|
+
onChange(changedValue ? changedValue.format(DEFAULT_DATE_FORMAT) : null, context);
|
|
9570
9659
|
};
|
|
9571
9660
|
const handleAccept = changedValue => {
|
|
9572
9661
|
if (!onAccept) return;
|
|
9573
|
-
onAccept(changedValue ? changedValue.format(
|
|
9662
|
+
onAccept(changedValue ? changedValue.format(DEFAULT_DATE_FORMAT) : null);
|
|
9574
9663
|
};
|
|
9575
|
-
const handleError = (validationError, currentValue) => onError === null || onError === void 0 ? void 0 : onError(validationError, dayjs(currentValue).format(
|
|
9664
|
+
const handleError = (validationError, currentValue) => onError === null || onError === void 0 ? void 0 : onError(validationError, dayjs(currentValue).format(DEFAULT_DATE_FORMAT));
|
|
9576
9665
|
const handleOpen = () => {
|
|
9577
9666
|
if (focusInputOnPopperOpened && inputRef.current) {
|
|
9578
9667
|
focusInput(inputRef);
|
|
@@ -9588,6 +9677,10 @@ const DotDatePicker = ({
|
|
|
9588
9677
|
}
|
|
9589
9678
|
return actionBar;
|
|
9590
9679
|
};
|
|
9680
|
+
const handleKeyDown = contextEnum => event => {
|
|
9681
|
+
const currentContextEnum = getContextEnumBasedOnTarget(event, inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, contextEnum);
|
|
9682
|
+
onKeyDown(event, currentContextEnum);
|
|
9683
|
+
};
|
|
9591
9684
|
return jsx(StyledDatePickerContainer, Object.assign({
|
|
9592
9685
|
className: containerClasses,
|
|
9593
9686
|
"data-testid": dataTestId
|
|
@@ -9607,16 +9700,16 @@ const DotDatePicker = ({
|
|
|
9607
9700
|
autoFocus: _autoFocus,
|
|
9608
9701
|
closeOnSelect: _closeOnSelect,
|
|
9609
9702
|
className: rootClasses,
|
|
9610
|
-
defaultValue: defaultValue && dayjs(defaultValue,
|
|
9703
|
+
defaultValue: defaultValue && dayjs(defaultValue, DEFAULT_DATE_FORMAT),
|
|
9611
9704
|
disableOpenPicker: disableOpenPicker || isInputReadOnly || disabled,
|
|
9612
9705
|
disablePast: disablePast,
|
|
9613
9706
|
disabled: disabled,
|
|
9614
9707
|
displayWeekNumber: displayWeekNumber,
|
|
9615
9708
|
fixedWeekNumber: fixedWeekNumber,
|
|
9616
|
-
format:
|
|
9709
|
+
format: displayFormat,
|
|
9617
9710
|
label: persistentLabel ? null : label,
|
|
9618
|
-
maxDate: maxDate && dayjs(maxDate,
|
|
9619
|
-
minDate: minDate && dayjs(minDate,
|
|
9711
|
+
maxDate: maxDate && dayjs(maxDate, DEFAULT_DATE_FORMAT),
|
|
9712
|
+
minDate: minDate && dayjs(minDate, DEFAULT_DATE_FORMAT),
|
|
9620
9713
|
onAccept: handleAccept,
|
|
9621
9714
|
onChange: handleChange,
|
|
9622
9715
|
onClose: onClose,
|
|
@@ -9651,6 +9744,7 @@ const DotDatePicker = ({
|
|
|
9651
9744
|
'data-testid': 'dot-date-picker-input',
|
|
9652
9745
|
onBlur
|
|
9653
9746
|
},
|
|
9747
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Input),
|
|
9654
9748
|
inputRef,
|
|
9655
9749
|
fullWidth: _fullWidth,
|
|
9656
9750
|
name: inputName
|
|
@@ -9662,10 +9756,11 @@ const DotDatePicker = ({
|
|
|
9662
9756
|
disableEnforceFocus: true
|
|
9663
9757
|
},
|
|
9664
9758
|
popper: {
|
|
9665
|
-
disablePortal: _disablePortal
|
|
9759
|
+
disablePortal: _disablePortal,
|
|
9760
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Popper)
|
|
9666
9761
|
}
|
|
9667
9762
|
},
|
|
9668
|
-
value: value && dayjs(value,
|
|
9763
|
+
value: value && dayjs(value, DEFAULT_DATE_FORMAT)
|
|
9669
9764
|
}, void 0)]
|
|
9670
9765
|
}), void 0)
|
|
9671
9766
|
}), void 0);
|
|
@@ -9734,6 +9829,8 @@ const getPopperButtonTabIndex = (index, isSelected, selectedValue) => selectedVa
|
|
|
9734
9829
|
const getDaytimeButtonTabIndex = (currentDaytime, selectedDaytime) => selectedDaytime && currentDaytime === selectedDaytime || !selectedDaytime && currentDaytime === Daytime.AM ? undefined : -1;
|
|
9735
9830
|
const getSelectedDaytime = dateTime => dateTime && dateTime.format('A') || Daytime.AM;
|
|
9736
9831
|
const getTimePickerButtonType = selectedDaytime => selectedDaytime && selectedDaytime === Daytime.PM ? 'primary' : 'text';
|
|
9832
|
+
const checkIfOpenPropDefined = open => open !== null && open !== undefined;
|
|
9833
|
+
const getDaytimeButtonType = daytimeSelected => daytimeSelected && daytimeSelected === Daytime.AM ? 'primary' : 'text';
|
|
9737
9834
|
|
|
9738
9835
|
const rootClassName = 'dot-time-picker';
|
|
9739
9836
|
const containerClassName = 'dot-time-picker-container';
|
|
@@ -9755,17 +9852,18 @@ const StyledTimePicker = styled(TimePicker).withConfig({
|
|
|
9755
9852
|
}) => css(["&.", "{", ";}"], rootClassName, pickerInputStyles(theme)));
|
|
9756
9853
|
|
|
9757
9854
|
dayjs.extend(utc);
|
|
9758
|
-
const DEFAULT_PICKER_TIME_FORMAT = '
|
|
9759
|
-
const DEFAULT_TIME_FORMAT = '
|
|
9855
|
+
const DEFAULT_PICKER_TIME_FORMAT = 'HH:mm';
|
|
9856
|
+
const DEFAULT_TIME_FORMAT = 'HH:mm';
|
|
9760
9857
|
const DEFAULT_TIME = '01:00';
|
|
9761
9858
|
const DotTimePicker = ({
|
|
9762
|
-
ampm: _ampm =
|
|
9859
|
+
ampm: _ampm = false,
|
|
9763
9860
|
ariaLabel,
|
|
9764
9861
|
autoFocus: _autoFocus = false,
|
|
9765
9862
|
className,
|
|
9766
9863
|
'data-testid': dataTestId,
|
|
9767
9864
|
defaultValue,
|
|
9768
9865
|
disableOpenPicker: _disableOpenPicker = false,
|
|
9866
|
+
disableClickAwayListener: _disableClickAwayListener = false,
|
|
9769
9867
|
disabled,
|
|
9770
9868
|
error,
|
|
9771
9869
|
format,
|
|
@@ -9777,8 +9875,10 @@ const DotTimePicker = ({
|
|
|
9777
9875
|
label,
|
|
9778
9876
|
onAccept,
|
|
9779
9877
|
onBlur,
|
|
9878
|
+
onCancel,
|
|
9780
9879
|
onChange,
|
|
9781
9880
|
onClose,
|
|
9881
|
+
onKeyDown,
|
|
9782
9882
|
onOpen,
|
|
9783
9883
|
open,
|
|
9784
9884
|
persistentLabel,
|
|
@@ -9786,7 +9886,7 @@ const DotTimePicker = ({
|
|
|
9786
9886
|
required: _required = false,
|
|
9787
9887
|
value
|
|
9788
9888
|
}) => {
|
|
9789
|
-
const
|
|
9889
|
+
const displayFormat = format || DEFAULT_TIME_FORMAT;
|
|
9790
9890
|
const hasValueWithoutChangeHandler = value !== undefined && onChange === undefined;
|
|
9791
9891
|
const hasBothValueAndDefaultValue = value !== undefined && defaultValue !== undefined;
|
|
9792
9892
|
const isComponentReadOnly = _readOnly || hasValueWithoutChangeHandler || hasBothValueAndDefaultValue;
|
|
@@ -9803,7 +9903,7 @@ const DotTimePicker = ({
|
|
|
9803
9903
|
const minutes = getMinutesForTimePicker();
|
|
9804
9904
|
const daytimeSelected = getSelectedDaytime(pickerTime);
|
|
9805
9905
|
const selectedPickerHour = pickerTime && calculateHourBasedOnTimeFormat(pickerTime, _ampm);
|
|
9806
|
-
const isOpenPropDefined = open
|
|
9906
|
+
const isOpenPropDefined = checkIfOpenPropDefined(open);
|
|
9807
9907
|
const isControlledComponent = onChange && value !== undefined;
|
|
9808
9908
|
useEffect(() => {
|
|
9809
9909
|
if (hasValueWithoutChangeHandler) {
|
|
@@ -9816,9 +9916,9 @@ const DotTimePicker = ({
|
|
|
9816
9916
|
useEffect(() => {
|
|
9817
9917
|
let timeValue = null;
|
|
9818
9918
|
if (defaultValue) {
|
|
9819
|
-
timeValue = getDayjsUtcDate(defaultValue,
|
|
9919
|
+
timeValue = getDayjsUtcDate(defaultValue, DEFAULT_TIME_FORMAT);
|
|
9820
9920
|
} else if (value) {
|
|
9821
|
-
timeValue = getDayjsUtcDate(value,
|
|
9921
|
+
timeValue = getDayjsUtcDate(value, DEFAULT_TIME_FORMAT);
|
|
9822
9922
|
}
|
|
9823
9923
|
setTime(timeValue);
|
|
9824
9924
|
setPickerTime(timeValue);
|
|
@@ -9844,7 +9944,7 @@ const DotTimePicker = ({
|
|
|
9844
9944
|
const currentTimeValue = currentValue ? currentValue : null;
|
|
9845
9945
|
setPickerTime(currentValue ? currentValue : null);
|
|
9846
9946
|
!isControlledComponent && setTime(currentTimeValue);
|
|
9847
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(currentValue ? currentValue.format(
|
|
9947
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(currentValue ? currentValue.format(DEFAULT_TIME_FORMAT) : null, context);
|
|
9848
9948
|
};
|
|
9849
9949
|
const handleClose = () => {
|
|
9850
9950
|
!isOpenPropDefined && setIsPickerOpened(false);
|
|
@@ -9869,6 +9969,7 @@ const DotTimePicker = ({
|
|
|
9869
9969
|
};
|
|
9870
9970
|
const handleCancel = () => {
|
|
9871
9971
|
setPickerTime(time);
|
|
9972
|
+
onCancel === null || onCancel === void 0 ? void 0 : onCancel();
|
|
9872
9973
|
handleClose();
|
|
9873
9974
|
};
|
|
9874
9975
|
const handleSet = () => {
|
|
@@ -9877,12 +9978,16 @@ const DotTimePicker = ({
|
|
|
9877
9978
|
return;
|
|
9878
9979
|
}
|
|
9879
9980
|
setTime(pickerTime);
|
|
9880
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(pickerTime.format(
|
|
9981
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(pickerTime.format(DEFAULT_TIME_FORMAT), {
|
|
9881
9982
|
validationError: null
|
|
9882
9983
|
});
|
|
9883
|
-
onAccept === null || onAccept === void 0 ? void 0 : onAccept(pickerTime.format(
|
|
9984
|
+
onAccept === null || onAccept === void 0 ? void 0 : onAccept(pickerTime.format(DEFAULT_TIME_FORMAT));
|
|
9884
9985
|
handleClose();
|
|
9885
9986
|
};
|
|
9987
|
+
const handleKeyDown = contextEnum => event => {
|
|
9988
|
+
const currentContextEnum = getContextEnumBasedOnTarget(event, inputRef === null || inputRef === void 0 ? void 0 : inputRef.current, contextEnum);
|
|
9989
|
+
onKeyDown(event, currentContextEnum);
|
|
9990
|
+
};
|
|
9886
9991
|
const scrollToSelectedTime = () => {
|
|
9887
9992
|
if (!(hoursRef === null || hoursRef === void 0 ? void 0 : hoursRef.current) || !(minutesRef === null || minutesRef === void 0 ? void 0 : minutesRef.current)) return;
|
|
9888
9993
|
const selectedHour = calculateHourBasedOnTimeFormat(time, _ampm);
|
|
@@ -9915,6 +10020,100 @@ const DotTimePicker = ({
|
|
|
9915
10020
|
if (event.key !== 'Escape' || !isPickerOpened) return;
|
|
9916
10021
|
handleCancel();
|
|
9917
10022
|
};
|
|
10023
|
+
const wrapWithClickAwayListener = children => jsx(ClickAwayListener, Object.assign({
|
|
10024
|
+
onClickAway: handleSet
|
|
10025
|
+
}, {
|
|
10026
|
+
children: children
|
|
10027
|
+
}), void 0);
|
|
10028
|
+
const renderTimePickerHours = () => hours.map((hour, index) => {
|
|
10029
|
+
const isSelected = pickerTime ? selectedPickerHour === hour : false;
|
|
10030
|
+
return jsx(DotButton, Object.assign({
|
|
10031
|
+
className: "dot-picker-button",
|
|
10032
|
+
"data-testid": dataTestId && `${dataTestId}-hour-button-${hour}`,
|
|
10033
|
+
onClick: () => handleHourClick(hour),
|
|
10034
|
+
onKeyDown: handleTimeKeydown(hoursRef, index),
|
|
10035
|
+
tabIndex: getPopperButtonTabIndex(index, isSelected, selectedPickerHour),
|
|
10036
|
+
type: isSelected ? 'primary' : 'text'
|
|
10037
|
+
}, {
|
|
10038
|
+
children: hour.toString().padStart(2, '0')
|
|
10039
|
+
}), hour);
|
|
10040
|
+
});
|
|
10041
|
+
const renderTimePickerMinutes = () => minutes.map((minute, index) => {
|
|
10042
|
+
const isSelected = pickerTime ? pickerTime.minute() === minute : false;
|
|
10043
|
+
return jsx(DotButton, Object.assign({
|
|
10044
|
+
className: "dot-picker-button",
|
|
10045
|
+
"data-testid": dataTestId && `${dataTestId}-minute-button-${minute}`,
|
|
10046
|
+
type: isSelected ? 'primary' : 'text',
|
|
10047
|
+
onClick: () => handleMinuteClick(minute),
|
|
10048
|
+
onKeyDown: handleTimeKeydown(minutesRef, index),
|
|
10049
|
+
tabIndex: getPopperButtonTabIndex(index, isSelected, pickerTime === null || pickerTime === void 0 ? void 0 : pickerTime.minute())
|
|
10050
|
+
}, {
|
|
10051
|
+
children: minute.toString().padStart(2, '0')
|
|
10052
|
+
}), minute);
|
|
10053
|
+
});
|
|
10054
|
+
const renderTimePickerActionButtons = () => jsxs("div", Object.assign({
|
|
10055
|
+
className: "dot-time-picker-action-buttons"
|
|
10056
|
+
}, {
|
|
10057
|
+
children: [jsx(DotButton, Object.assign({
|
|
10058
|
+
"data-testid": dataTestId && `${dataTestId}-cancel`,
|
|
10059
|
+
onClick: handleCancel,
|
|
10060
|
+
size: "small",
|
|
10061
|
+
type: "text"
|
|
10062
|
+
}, {
|
|
10063
|
+
children: "Cancel"
|
|
10064
|
+
}), void 0), jsx(DotButton, Object.assign({
|
|
10065
|
+
"data-testid": dataTestId && `${dataTestId}-set`,
|
|
10066
|
+
onClick: handleSet,
|
|
10067
|
+
size: "small",
|
|
10068
|
+
type: "text"
|
|
10069
|
+
}, {
|
|
10070
|
+
children: "Set"
|
|
10071
|
+
}), void 0)]
|
|
10072
|
+
}), void 0);
|
|
10073
|
+
const renderDaytime = () => jsxs("div", Object.assign({
|
|
10074
|
+
className: "dot-time-picker-daytime",
|
|
10075
|
+
ref: daytimeRef
|
|
10076
|
+
}, {
|
|
10077
|
+
children: [jsx(DotButton, Object.assign({
|
|
10078
|
+
className: "dot-picker-button",
|
|
10079
|
+
"data-testid": dataTestId && `${dataTestId}-am-button`,
|
|
10080
|
+
onClick: () => handleDaytimeSelection(Daytime.AM),
|
|
10081
|
+
onKeyDown: handleTimeKeydown(daytimeRef, 0),
|
|
10082
|
+
tabIndex: getDaytimeButtonTabIndex(Daytime.AM, daytimeSelected),
|
|
10083
|
+
type: getDaytimeButtonType(daytimeSelected)
|
|
10084
|
+
}, {
|
|
10085
|
+
children: Daytime.AM
|
|
10086
|
+
}), Daytime.AM), jsx(DotButton, Object.assign({
|
|
10087
|
+
className: "dot-picker-button",
|
|
10088
|
+
"data-testid": dataTestId && `${dataTestId}-pm-button`,
|
|
10089
|
+
onClick: () => handleDaytimeSelection(Daytime.PM),
|
|
10090
|
+
onKeyDown: handleTimeKeydown(daytimeRef, 1),
|
|
10091
|
+
tabIndex: getDaytimeButtonTabIndex(Daytime.PM, daytimeSelected),
|
|
10092
|
+
type: getTimePickerButtonType(daytimeSelected)
|
|
10093
|
+
}, {
|
|
10094
|
+
children: Daytime.PM
|
|
10095
|
+
}), Daytime.PM)]
|
|
10096
|
+
}), void 0);
|
|
10097
|
+
const paperComponent = jsxs(Paper, Object.assign({
|
|
10098
|
+
className: "dot-time-picker-paper",
|
|
10099
|
+
elevation: 8
|
|
10100
|
+
}, {
|
|
10101
|
+
children: [jsxs("div", Object.assign({
|
|
10102
|
+
className: "dot-time-picker-selection"
|
|
10103
|
+
}, {
|
|
10104
|
+
children: [jsx("div", Object.assign({
|
|
10105
|
+
className: "dot-time-picker-hours",
|
|
10106
|
+
ref: hoursRef
|
|
10107
|
+
}, {
|
|
10108
|
+
children: renderTimePickerHours()
|
|
10109
|
+
}), void 0), jsx("div", Object.assign({
|
|
10110
|
+
className: "dot-time-picker-minutes",
|
|
10111
|
+
ref: minutesRef
|
|
10112
|
+
}, {
|
|
10113
|
+
children: renderTimePickerMinutes()
|
|
10114
|
+
}), void 0), _ampm && renderDaytime()]
|
|
10115
|
+
}), void 0), !hideActionButtons && renderTimePickerActionButtons()]
|
|
10116
|
+
}), void 0);
|
|
9918
10117
|
return jsxs(StyledTimePickerContainer, Object.assign({
|
|
9919
10118
|
className: containerClasses,
|
|
9920
10119
|
"data-testid": dataTestId,
|
|
@@ -9936,7 +10135,7 @@ const DotTimePicker = ({
|
|
|
9936
10135
|
autoFocus: _autoFocus,
|
|
9937
10136
|
className: rootClasses,
|
|
9938
10137
|
disabled: disabled,
|
|
9939
|
-
format:
|
|
10138
|
+
format: displayFormat,
|
|
9940
10139
|
inputRef: inputRef,
|
|
9941
10140
|
label: persistentLabel ? null : label,
|
|
9942
10141
|
onChange: handleInputChange,
|
|
@@ -9966,7 +10165,8 @@ const DotTimePicker = ({
|
|
|
9966
10165
|
onBlur
|
|
9967
10166
|
},
|
|
9968
10167
|
fullWidth: _fullWidth,
|
|
9969
|
-
name: inputName
|
|
10168
|
+
name: inputName,
|
|
10169
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Input)
|
|
9970
10170
|
},
|
|
9971
10171
|
field: {
|
|
9972
10172
|
readOnly: isComponentReadOnly
|
|
@@ -9980,97 +10180,10 @@ const DotTimePicker = ({
|
|
|
9980
10180
|
"data-testid": dataTestId && `${dataTestId}-popper`,
|
|
9981
10181
|
disablePortal: true,
|
|
9982
10182
|
open: isPickerOpened,
|
|
10183
|
+
onKeyDown: onKeyDown && handleKeyDown(DatePickerKeydownContext.Popper),
|
|
9983
10184
|
placement: "bottom-start"
|
|
9984
10185
|
}, {
|
|
9985
|
-
children:
|
|
9986
|
-
onClickAway: handleSet
|
|
9987
|
-
}, {
|
|
9988
|
-
children: jsxs(Paper, Object.assign({
|
|
9989
|
-
className: "dot-time-picker-paper",
|
|
9990
|
-
elevation: 8
|
|
9991
|
-
}, {
|
|
9992
|
-
children: [jsxs("div", Object.assign({
|
|
9993
|
-
className: "dot-time-picker-selection"
|
|
9994
|
-
}, {
|
|
9995
|
-
children: [jsx("div", Object.assign({
|
|
9996
|
-
className: "dot-time-picker-hours",
|
|
9997
|
-
ref: hoursRef
|
|
9998
|
-
}, {
|
|
9999
|
-
children: hours.map((hour, index) => {
|
|
10000
|
-
const isSelected = pickerTime ? selectedPickerHour === hour : false;
|
|
10001
|
-
return jsx(DotButton, Object.assign({
|
|
10002
|
-
className: "dot-picker-button",
|
|
10003
|
-
"data-testid": dataTestId && `${dataTestId}-hour-button-${hour}`,
|
|
10004
|
-
onClick: () => handleHourClick(hour),
|
|
10005
|
-
onKeyDown: handleTimeKeydown(hoursRef, index),
|
|
10006
|
-
tabIndex: getPopperButtonTabIndex(index, isSelected, selectedPickerHour),
|
|
10007
|
-
type: isSelected ? 'primary' : 'text'
|
|
10008
|
-
}, {
|
|
10009
|
-
children: hour.toString().padStart(2, '0')
|
|
10010
|
-
}), hour);
|
|
10011
|
-
})
|
|
10012
|
-
}), void 0), jsx("div", Object.assign({
|
|
10013
|
-
className: "dot-time-picker-minutes",
|
|
10014
|
-
ref: minutesRef
|
|
10015
|
-
}, {
|
|
10016
|
-
children: minutes.map((minute, index) => {
|
|
10017
|
-
const isSelected = pickerTime ? pickerTime.minute() === minute : false;
|
|
10018
|
-
return jsx(DotButton, Object.assign({
|
|
10019
|
-
className: "dot-picker-button",
|
|
10020
|
-
"data-testid": dataTestId && `${dataTestId}-minute-button-${minute}`,
|
|
10021
|
-
type: isSelected ? 'primary' : 'text',
|
|
10022
|
-
onClick: () => handleMinuteClick(minute),
|
|
10023
|
-
onKeyDown: handleTimeKeydown(minutesRef, index),
|
|
10024
|
-
tabIndex: getPopperButtonTabIndex(index, isSelected, pickerTime === null || pickerTime === void 0 ? void 0 : pickerTime.minute())
|
|
10025
|
-
}, {
|
|
10026
|
-
children: minute.toString().padStart(2, '0')
|
|
10027
|
-
}), minute);
|
|
10028
|
-
})
|
|
10029
|
-
}), void 0), _ampm && jsxs("div", Object.assign({
|
|
10030
|
-
className: "dot-time-picker-daytime",
|
|
10031
|
-
ref: daytimeRef
|
|
10032
|
-
}, {
|
|
10033
|
-
children: [jsx(DotButton, Object.assign({
|
|
10034
|
-
className: "dot-picker-button",
|
|
10035
|
-
"data-testid": dataTestId && `${dataTestId}-am-button`,
|
|
10036
|
-
onClick: () => handleDaytimeSelection(Daytime.AM),
|
|
10037
|
-
onKeyDown: handleTimeKeydown(daytimeRef, 0),
|
|
10038
|
-
tabIndex: getDaytimeButtonTabIndex(Daytime.AM, daytimeSelected),
|
|
10039
|
-
type: daytimeSelected && daytimeSelected === Daytime.AM ? 'primary' : 'text'
|
|
10040
|
-
}, {
|
|
10041
|
-
children: Daytime.AM
|
|
10042
|
-
}), Daytime.AM), jsx(DotButton, Object.assign({
|
|
10043
|
-
className: "dot-picker-button",
|
|
10044
|
-
"data-testid": dataTestId && `${dataTestId}-pm-button`,
|
|
10045
|
-
onClick: () => handleDaytimeSelection(Daytime.PM),
|
|
10046
|
-
onKeyDown: handleTimeKeydown(daytimeRef, 1),
|
|
10047
|
-
tabIndex: getDaytimeButtonTabIndex(Daytime.PM, daytimeSelected),
|
|
10048
|
-
type: getTimePickerButtonType(daytimeSelected)
|
|
10049
|
-
}, {
|
|
10050
|
-
children: Daytime.PM
|
|
10051
|
-
}), Daytime.PM)]
|
|
10052
|
-
}), void 0)]
|
|
10053
|
-
}), void 0), !hideActionButtons && jsxs("div", Object.assign({
|
|
10054
|
-
className: "dot-time-picker-action-buttons"
|
|
10055
|
-
}, {
|
|
10056
|
-
children: [jsx(DotButton, Object.assign({
|
|
10057
|
-
"data-testid": dataTestId && `${dataTestId}-cancel`,
|
|
10058
|
-
onClick: handleCancel,
|
|
10059
|
-
size: "small",
|
|
10060
|
-
type: "text"
|
|
10061
|
-
}, {
|
|
10062
|
-
children: "Cancel"
|
|
10063
|
-
}), void 0), jsx(DotButton, Object.assign({
|
|
10064
|
-
"data-testid": dataTestId && `${dataTestId}-set`,
|
|
10065
|
-
onClick: handleSet,
|
|
10066
|
-
size: "small",
|
|
10067
|
-
type: "text"
|
|
10068
|
-
}, {
|
|
10069
|
-
children: "Set"
|
|
10070
|
-
}), void 0)]
|
|
10071
|
-
}), void 0)]
|
|
10072
|
-
}), void 0)
|
|
10073
|
-
}), void 0)
|
|
10186
|
+
children: _disableClickAwayListener ? paperComponent : wrapWithClickAwayListener(paperComponent)
|
|
10074
10187
|
}), void 0)]
|
|
10075
10188
|
}), void 0);
|
|
10076
10189
|
};
|
|
@@ -10087,4 +10200,4 @@ const DotClickAwayListener = ({
|
|
|
10087
10200
|
}, void 0);
|
|
10088
10201
|
};
|
|
10089
10202
|
|
|
10090
|
-
export { Cell, CreateUUID, CssCell, CssGrid, CssGridDebug, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCheckbox, DotCheckboxGroup, DotChip, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotInlineEdit, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, lightThemeColors as lightColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotCoreApiContext, useDotSnackbarContext };
|
|
10203
|
+
export { Cell, CreateUUID, CssCell, CssGrid, CssGridDebug, DatePickerKeydownContext, Daytime, DotAccordion, DotActionToolbar, DotAlertBanner, DotAppLogo, DotAppSwitcher, DotAppToolbar, DotAutoComplete, DotAvatar, DotAvatarGroup, DotBadge, DotBreadcrumbs, DotButton, DotButtonToggle, DotCard, DotCardContent, DotCardFooter, DotCardHeader, DotCheckbox, DotCheckboxGroup, DotChip, DotClickAwayListener, DotConfirmationDialog, DotCopyButton, DotCoreApiProvider, DotDatePicker, DotDialog, DotDivider, DotDraggableList, DotDrawer, DotDynamicForm, DotEmptyState, DotFileListItem, DotFileUpload, DotForm, DotFormGroup, DotHeaderRow, DotIcon, DotIconButton, DotInlineEdit, DotInputSelect, DotInputText, DotLinearProgress, DotLink, DotList, DotMenu, DotNavigationRail, DotPill, DotPopper, DotProgress, DotProgressButton, DotRadioButton, DotRadioGroup, DotSidebar, DotSkeleton, DotSnackbar, DotSnackbarContainer, DotSnackbarProvider, DotSplitButton, DotStepper, DotSwitch, DotTable, DotTableAction, DotTableActions, DotTablePagination, DotTabs, DotThemeProvider, DotTimePicker, DotTooltip, DotTruncateWithTooltip, DotTypography, avatarColors, checkIfValidDate, lightThemeColors as lightColors, mockScrollIntoView, parseAutoCompleteValue, variables as themeVariables, typographyOptions, useDotCoreApiContext, useDotSnackbarContext };
|