@digital-ai/dot-components 2.22.0 → 2.23.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/index.esm.js +226 -181
- package/package.json +2 -1
- package/src/lib/components/input-form-fields/InputText.d.ts +6 -1
- package/src/lib/components/snackbar/Snackbar.d.ts +5 -3
- package/src/lib/components/snackbar/SnackbarProvider.d.ts +9 -5
- package/src/lib/components/table/TableCell.d.ts +1 -1
- package/src/lib/components/table/index.d.ts +1 -1
- package/src/lib/components/table/utils/helpers.d.ts +8 -0
package/index.esm.js
CHANGED
|
@@ -8,8 +8,11 @@ import { createTheme, ThemeProvider, useTheme } from '@mui/material/styles';
|
|
|
8
8
|
import jwt_decode from 'jwt-decode';
|
|
9
9
|
import { useDropzone } from 'react-dropzone';
|
|
10
10
|
import GridLayout, { WidthProvider } from 'react-grid-layout';
|
|
11
|
+
import dayjs from 'dayjs';
|
|
12
|
+
import updateLocale from 'dayjs/plugin/updateLocale';
|
|
11
13
|
import { DatePicker, PickersDay, LocalizationProvider, TimePicker } from '@mui/x-date-pickers';
|
|
12
14
|
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
15
|
+
import utc from 'dayjs/plugin/utc';
|
|
13
16
|
|
|
14
17
|
class ApiError extends Error {
|
|
15
18
|
constructor(response, message) {
|
|
@@ -249,7 +252,7 @@ const StyledTextField = styled(TextField).withConfig({
|
|
|
249
252
|
})(["", ""], ({
|
|
250
253
|
theme,
|
|
251
254
|
InputProps
|
|
252
|
-
}) => css(["&.", "{.MuiInputBase-root{margin-bottom:0;}.MuiInputBase-input{box-sizing:content-box;}.MuiOutlinedInput-input{padding:", ";}.MuiInputBase-inputSizeSmall{padding-top:10.5px;padding-bottom:10.5px;&:not(textarea){height:19px;}}.MuiInputBase-inputMultiline{padding:0;}&.", " .MuiInputBase-root,.MuiInputBase-root.Mui-disabled{", ";}}.dot-select,.dot-input{&.", ",&.Mui-disabled{", ";}}&.", " .", "{margin-right:", ";}&.", ",&.", "{.", "{color:", ";p{font-size:", "px;margin:0;}.dot-icon i{margin-top:-2px;}}.MuiInputLabel-root.Mui-error{color:", ";}.MuiInputBase-root{background:", ";margin-bottom:0;}.MuiInputBase-inputSizeSmall:not(textarea){height:19px;padding-top:10.5px;padding-bottom:10.5px;}select.dot-select{padding-left:", ";}.MuiSelect-select:focus:not(.", "){background-color:transparent;}.MuiSelect-icon{right:", ";}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.", " .dot-icon{color:", ";}}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.", " .dot-icon{color:", ";}}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.", " .dot-icon{color:", ";}}.MuiOutlinedInput-adornedStart{padding-left:12px;&.", " .", "{border-color:", ";}}.MuiInputBase-inputAdornedStart{padding-left:12px;}.MuiInputBase-inputAdornedEnd{padding-right:12px;}.MuiFormHelperText-root{", ";}}"], rootClassName$15, InputProps.startAdornment ? `18px 12px 18px 0px` : `18px 12px`, readOnlyClassName$1, readOnlyStyles(theme), readOnlyClassName$1, readOnlyStyles(theme), rootSelectClassName, adornmentIconClassName, theme.spacing(2), rootSelectClassName, rootClassName$15, adornmentIconClassName, theme.palette.figma.icon.black, theme.typography.body2.fontSize, theme.palette.figma.typography.black, theme.palette.figma.neutral.normal, theme.spacing(1.5), readOnlyClassName$1, InputProps.endAdornment ? `44px` : `12px`, successClassName, theme.palette.figma.success.normal, adornmentIconClassName, theme.palette.figma.success.normal, errorClassName, theme.palette.figma.destructive.normal, adornmentIconClassName, theme.palette.figma.destructive.normal, warningClassName, theme.palette.figma.warning.normal, adornmentIconClassName, theme.palette.figma.warning.normal, warningClassName, fieldsetClassName, theme.palette.figma.warning.normal, formHelperTextRootStyles(theme)));
|
|
255
|
+
}) => css(["&.", "{.MuiInputBase-root{margin-bottom:0;}.MuiInputBase-input{box-sizing:content-box;}.MuiOutlinedInput-input{padding:", ";}.MuiInputBase-inputSizeSmall{padding-top:10.5px;padding-bottom:10.5px;&:not(textarea){height:19px;}}.MuiInputBase-inputMultiline{padding:0;}&.", " .MuiInputBase-root,.MuiInputBase-root.Mui-disabled{", ";}.MuiInputBase-adornedEnd .clear-icon-button.hidden{visibility:hidden;}}.dot-select,.dot-input{&.", ",&.Mui-disabled{", ";}}&.", " .", "{margin-right:", ";}&.", ",&.", "{.", "{color:", ";p{font-size:", "px;margin:0;}.dot-icon i{margin-top:-2px;}}.MuiInputLabel-root.Mui-error{color:", ";}.MuiInputBase-root{background:", ";margin-bottom:0;}.MuiInputBase-inputSizeSmall:not(textarea){height:19px;padding-top:10.5px;padding-bottom:10.5px;}select.dot-select{padding-left:", ";}.MuiSelect-select:focus:not(.", "){background-color:transparent;}.MuiSelect-icon{right:", ";}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.", " .dot-icon{color:", ";}}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.", " .dot-icon{color:", ";}}&.", "{.MuiOutlinedInput-notchedOutline{border-color:", ";}.", " .dot-icon{color:", ";}}.MuiOutlinedInput-adornedStart{padding-left:12px;&.", " .", "{border-color:", ";}}.MuiInputBase-inputAdornedStart{padding-left:12px;}.MuiInputBase-inputAdornedEnd{padding-right:12px;}.MuiFormHelperText-root{", ";}}"], rootClassName$15, InputProps.startAdornment ? `18px 12px 18px 0px` : `18px 12px`, readOnlyClassName$1, readOnlyStyles(theme), readOnlyClassName$1, readOnlyStyles(theme), rootSelectClassName, adornmentIconClassName, theme.spacing(2), rootSelectClassName, rootClassName$15, adornmentIconClassName, theme.palette.figma.icon.black, theme.typography.body2.fontSize, theme.palette.figma.typography.black, theme.palette.figma.neutral.normal, theme.spacing(1.5), readOnlyClassName$1, InputProps.endAdornment ? `44px` : `12px`, successClassName, theme.palette.figma.success.normal, adornmentIconClassName, theme.palette.figma.success.normal, errorClassName, theme.palette.figma.destructive.normal, adornmentIconClassName, theme.palette.figma.destructive.normal, warningClassName, theme.palette.figma.warning.normal, adornmentIconClassName, theme.palette.figma.warning.normal, warningClassName, fieldsetClassName, theme.palette.figma.warning.normal, formHelperTextRootStyles(theme)));
|
|
253
256
|
|
|
254
257
|
const rootClassName$14 = 'dot-action-toolbar';
|
|
255
258
|
const StyledToolbar = styled(Toolbar).withConfig({
|
|
@@ -3281,6 +3284,94 @@ const DotList = ({
|
|
|
3281
3284
|
});
|
|
3282
3285
|
};
|
|
3283
3286
|
|
|
3287
|
+
const rootClassName$R = 'dot-copy-button';
|
|
3288
|
+
const StyledCopyButton = styled.span.withConfig({
|
|
3289
|
+
displayName: "CopyButtonstyles__StyledCopyButton",
|
|
3290
|
+
componentId: "sc-18ff0u-0"
|
|
3291
|
+
})(["", ""], ({
|
|
3292
|
+
theme
|
|
3293
|
+
}) => css(["&.", " .copied-to-clipboard{color:", ";&.MuiIcon-fontSizeSmall.button-size-small{padding:4px;}&.MuiIcon-fontSizeMedium.button-size-small{padding:3px;}&.MuiIcon-fontSizeSmall.button-size-medium{padding:11px;}&.MuiIcon-fontSizeMedium.button-size-medium{padding:10px;}}"], rootClassName$R, theme.palette.figma.success.normal));
|
|
3294
|
+
|
|
3295
|
+
const DotCopyButton = ({
|
|
3296
|
+
ariaLabel: _ariaLabel = 'Copy to clipboard',
|
|
3297
|
+
ariaRole: _ariaRole = 'button',
|
|
3298
|
+
className,
|
|
3299
|
+
color: _color = 'inherit',
|
|
3300
|
+
copiedTooltip: _copiedTooltip = 'Copied!',
|
|
3301
|
+
copyTooltip: _copyTooltip = 'Copy to clipboard',
|
|
3302
|
+
'data-testid': dataTestId = 'dot-copy-button',
|
|
3303
|
+
disabled: _disabled = false,
|
|
3304
|
+
disableRipple: _disableRipple = false,
|
|
3305
|
+
iconId: _iconId = 'duplicate',
|
|
3306
|
+
iconSize: _iconSize = 'small',
|
|
3307
|
+
onClick: _onClick = null,
|
|
3308
|
+
shape: _shape = 'circle',
|
|
3309
|
+
showCopiedIcon: _showCopiedIcon = true,
|
|
3310
|
+
size: _size = 'small',
|
|
3311
|
+
tooltip,
|
|
3312
|
+
value
|
|
3313
|
+
}) => {
|
|
3314
|
+
const [timedShowCopiedIcon, setTimedShowCopiedIcon] = useState(false);
|
|
3315
|
+
const [timedDisabled, setTimedDisabled] = useState(false);
|
|
3316
|
+
// To keep backward compatibility if tooltip is not set, use copyTooltip
|
|
3317
|
+
if (!tooltip) {
|
|
3318
|
+
tooltip = _copyTooltip;
|
|
3319
|
+
}
|
|
3320
|
+
const copyToClipboard = useCallback(() => {
|
|
3321
|
+
// The check for navigator.clipboard.writeText is because this function is
|
|
3322
|
+
// only supported in secure contexts (https). This will always be the case in
|
|
3323
|
+
// production but not when running locally.
|
|
3324
|
+
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
|
3325
|
+
console.warn('Copy to clipboard is only supported in secure context (https)', value);
|
|
3326
|
+
} else {
|
|
3327
|
+
navigator.clipboard.writeText(value);
|
|
3328
|
+
}
|
|
3329
|
+
}, [value]);
|
|
3330
|
+
const copy = useCallback(event => {
|
|
3331
|
+
copyToClipboard();
|
|
3332
|
+
if (_showCopiedIcon) {
|
|
3333
|
+
setTimedShowCopiedIcon(true);
|
|
3334
|
+
setTimeout(function () {
|
|
3335
|
+
setTimedShowCopiedIcon(false);
|
|
3336
|
+
}, 3000);
|
|
3337
|
+
} else if (!_disabled) {
|
|
3338
|
+
setTimedDisabled(true);
|
|
3339
|
+
setTimeout(function () {
|
|
3340
|
+
setTimedDisabled(false);
|
|
3341
|
+
}, 3000);
|
|
3342
|
+
}
|
|
3343
|
+
if (_onClick) {
|
|
3344
|
+
return _onClick(event);
|
|
3345
|
+
}
|
|
3346
|
+
return false;
|
|
3347
|
+
}, [value, _showCopiedIcon, _disabled, _onClick]);
|
|
3348
|
+
return jsxs(StyledCopyButton, {
|
|
3349
|
+
className: rootClassName$R,
|
|
3350
|
+
"data-testid": dataTestId,
|
|
3351
|
+
children: [!timedShowCopiedIcon && jsx(DotIconButton, {
|
|
3352
|
+
ariaLabel: _ariaLabel,
|
|
3353
|
+
ariaRole: _ariaRole,
|
|
3354
|
+
className: className,
|
|
3355
|
+
color: _color,
|
|
3356
|
+
"data-testid": `${dataTestId}-button`,
|
|
3357
|
+
disabled: _disabled || timedDisabled,
|
|
3358
|
+
disableRipple: _disableRipple,
|
|
3359
|
+
iconId: _iconId,
|
|
3360
|
+
iconSize: _iconSize,
|
|
3361
|
+
onClick: copy,
|
|
3362
|
+
shape: _shape,
|
|
3363
|
+
size: _size,
|
|
3364
|
+
tooltip: tooltip
|
|
3365
|
+
}), timedShowCopiedIcon && jsx(DotIcon, {
|
|
3366
|
+
className: `copied-to-clipboard button-size-${_size}`,
|
|
3367
|
+
"data-testid": `${dataTestId}-icon`,
|
|
3368
|
+
fontSize: _iconSize,
|
|
3369
|
+
iconId: "check-solid",
|
|
3370
|
+
tooltip: _copiedTooltip
|
|
3371
|
+
})]
|
|
3372
|
+
});
|
|
3373
|
+
};
|
|
3374
|
+
|
|
3284
3375
|
const DotInputLabel = ({
|
|
3285
3376
|
'data-testid': dataTestId,
|
|
3286
3377
|
disabled: _disabled = false,
|
|
@@ -3335,8 +3426,8 @@ const EndAdornment = ({
|
|
|
3335
3426
|
children: styledAdornment
|
|
3336
3427
|
}) : styledAdornment;
|
|
3337
3428
|
};
|
|
3338
|
-
const getInitialState = value => ({
|
|
3339
|
-
inputValue: value || ''
|
|
3429
|
+
const getInitialState = (value, defaultValue) => ({
|
|
3430
|
+
inputValue: value || defaultValue || ''
|
|
3340
3431
|
});
|
|
3341
3432
|
const DotInputText = ({
|
|
3342
3433
|
autoComplete: _autoComplete = 'off',
|
|
@@ -3365,6 +3456,7 @@ const DotInputText = ({
|
|
|
3365
3456
|
name,
|
|
3366
3457
|
onBlur,
|
|
3367
3458
|
onChange,
|
|
3459
|
+
onClear,
|
|
3368
3460
|
onFocus,
|
|
3369
3461
|
onKeyDown,
|
|
3370
3462
|
onMouseUp,
|
|
@@ -3384,14 +3476,13 @@ const DotInputText = ({
|
|
|
3384
3476
|
const hasWarning = !_error && _warning && warningClassName;
|
|
3385
3477
|
const hasSuccess = !_error && !_warning && success && successClassName;
|
|
3386
3478
|
const hasEndAdornmentIcon = endIcon || _error || hasWarning || hasSuccess;
|
|
3387
|
-
|
|
3388
|
-
const
|
|
3479
|
+
const internalInputRef = useRef(null);
|
|
3480
|
+
const textFieldInputRef = inputRef || internalInputRef;
|
|
3481
|
+
const [inputTextState, setInputTextState] = useState(getInitialState(value));
|
|
3389
3482
|
const rootStyles = useStylesWithRootClass(rootClassName$15, hasError, hasWarning, hasSuccess, _readOnly && readOnlyClassName$1);
|
|
3390
|
-
// Used to control text value from the consumer component
|
|
3391
|
-
// when debounce feature is enabled
|
|
3392
3483
|
useEffect(() => {
|
|
3393
|
-
if (
|
|
3394
|
-
setInputTextState(getInitialState(value));
|
|
3484
|
+
if (value !== inputTextState.inputValue) {
|
|
3485
|
+
setInputTextState(getInitialState(value, defaultValue));
|
|
3395
3486
|
}
|
|
3396
3487
|
}, [value]);
|
|
3397
3488
|
// Improve performance by avoiding callback execution
|
|
@@ -3406,17 +3497,21 @@ const DotInputText = ({
|
|
|
3406
3497
|
return () => clearTimeout(handler);
|
|
3407
3498
|
}, [inputTextState]);
|
|
3408
3499
|
const handleChange = e => {
|
|
3409
|
-
|
|
3410
|
-
// so that we can set initial state via 'value' prop (if needed)
|
|
3411
|
-
hasDebounce ? setInputTextState({
|
|
3500
|
+
setInputTextState({
|
|
3412
3501
|
changeEvent: e,
|
|
3413
3502
|
inputValue: e.target.value
|
|
3414
|
-
})
|
|
3503
|
+
});
|
|
3504
|
+
!hasDebounce && (onChange === null || onChange === void 0 ? void 0 : onChange(e));
|
|
3505
|
+
};
|
|
3506
|
+
const handleClearButtonClick = () => {
|
|
3507
|
+
setInputTextState({
|
|
3508
|
+
inputValue: ''
|
|
3509
|
+
});
|
|
3510
|
+
if ('current' in textFieldInputRef) {
|
|
3511
|
+
textFieldInputRef.current.focus();
|
|
3512
|
+
}
|
|
3513
|
+
onClear();
|
|
3415
3514
|
};
|
|
3416
|
-
const inputTextValue = hasDebounce ? inputTextState.inputValue : value;
|
|
3417
|
-
// Don't use default value when debounce feature is enabled because
|
|
3418
|
-
// in that case component is controlled
|
|
3419
|
-
const defaultInputValue = hasDebounce ? undefined : defaultValue;
|
|
3420
3515
|
const startAdornmentIcon = () => {
|
|
3421
3516
|
if (!startIcon) return null;
|
|
3422
3517
|
return jsx(StyledAdornment, {
|
|
@@ -3437,6 +3532,27 @@ const DotInputText = ({
|
|
|
3437
3532
|
warning: _warning
|
|
3438
3533
|
});
|
|
3439
3534
|
};
|
|
3535
|
+
const getClearIconButton = () => {
|
|
3536
|
+
if (!onClear) return null;
|
|
3537
|
+
const clearIconButtonClasses = useStylesWithRootClass('clear-icon-button', inputTextState.inputValue === '' ? 'hidden' : '');
|
|
3538
|
+
return jsx(DotIconButton, {
|
|
3539
|
+
className: clearIconButtonClasses,
|
|
3540
|
+
"data-testid": dataTestId && `${dataTestId}-clear-btn`,
|
|
3541
|
+
iconId: "close",
|
|
3542
|
+
size: "small",
|
|
3543
|
+
onClick: handleClearButtonClick
|
|
3544
|
+
});
|
|
3545
|
+
};
|
|
3546
|
+
const getEndAdornment = () => {
|
|
3547
|
+
const iconOrText = endAdornmentIconOrText();
|
|
3548
|
+
const clearIconButton = getClearIconButton();
|
|
3549
|
+
if (iconOrText || clearIconButton) {
|
|
3550
|
+
return jsxs(Fragment, {
|
|
3551
|
+
children: [iconOrText, clearIconButton]
|
|
3552
|
+
});
|
|
3553
|
+
}
|
|
3554
|
+
return null;
|
|
3555
|
+
};
|
|
3440
3556
|
const wrapperClassName = useStylesWithRootClass(_fullWidth !== false ? 'dot-input-text--fullwidth' : '', className);
|
|
3441
3557
|
const inputClassName = useStylesWithRootClass('dot-input', _readOnly && readOnlyClassName$1);
|
|
3442
3558
|
return jsxs(StyledTextFieldContainer, {
|
|
@@ -3450,7 +3566,7 @@ const DotInputText = ({
|
|
|
3450
3566
|
}), jsx(StyledTextField, {
|
|
3451
3567
|
InputProps: {
|
|
3452
3568
|
startAdornment: startAdornmentIcon(),
|
|
3453
|
-
endAdornment:
|
|
3569
|
+
endAdornment: getEndAdornment()
|
|
3454
3570
|
},
|
|
3455
3571
|
"aria-label": name || label,
|
|
3456
3572
|
autoComplete: _autoComplete,
|
|
@@ -3458,7 +3574,6 @@ const DotInputText = ({
|
|
|
3458
3574
|
classes: {
|
|
3459
3575
|
root: rootStyles
|
|
3460
3576
|
},
|
|
3461
|
-
defaultValue: defaultInputValue,
|
|
3462
3577
|
disabled: _disabled,
|
|
3463
3578
|
error: _error,
|
|
3464
3579
|
fullWidth: _fullWidth,
|
|
@@ -3477,14 +3592,14 @@ const DotInputText = ({
|
|
|
3477
3592
|
readOnly: _readOnly,
|
|
3478
3593
|
tabIndex: 0
|
|
3479
3594
|
},
|
|
3480
|
-
inputRef:
|
|
3595
|
+
inputRef: textFieldInputRef,
|
|
3481
3596
|
label: persistentLabel ? null : label,
|
|
3482
3597
|
maxRows: _multiline ? maxRows : null,
|
|
3483
3598
|
minRows: _multiline ? minRows : null,
|
|
3484
3599
|
multiline: _multiline,
|
|
3485
3600
|
name: name,
|
|
3486
3601
|
onBlur: onBlur,
|
|
3487
|
-
onChange:
|
|
3602
|
+
onChange: handleChange,
|
|
3488
3603
|
onFocus: onFocus,
|
|
3489
3604
|
onKeyDown: onKeyDown,
|
|
3490
3605
|
onMouseUp: onMouseUp,
|
|
@@ -3493,17 +3608,17 @@ const DotInputText = ({
|
|
|
3493
3608
|
role: "textbox",
|
|
3494
3609
|
size: _size,
|
|
3495
3610
|
type: _type,
|
|
3496
|
-
value:
|
|
3611
|
+
value: inputTextState.inputValue,
|
|
3497
3612
|
variant: "outlined"
|
|
3498
3613
|
})]
|
|
3499
3614
|
});
|
|
3500
3615
|
};
|
|
3501
3616
|
|
|
3502
|
-
const rootClassName$
|
|
3617
|
+
const rootClassName$Q = 'dot-search-input';
|
|
3503
3618
|
const StyledSearchInput = styled.span.withConfig({
|
|
3504
3619
|
displayName: "SearchInputstyles__StyledSearchInput",
|
|
3505
3620
|
componentId: "qlwzku-0"
|
|
3506
|
-
})(["", ""], () => css(["&.", "{}"], rootClassName$
|
|
3621
|
+
})(["", ""], () => css(["&.", "{}"], rootClassName$Q));
|
|
3507
3622
|
|
|
3508
3623
|
function SearchInput({
|
|
3509
3624
|
'data-testid': dataTestId,
|
|
@@ -3517,7 +3632,7 @@ function SearchInput({
|
|
|
3517
3632
|
tooltip = null,
|
|
3518
3633
|
value
|
|
3519
3634
|
}) {
|
|
3520
|
-
const rootClasses = useStylesWithRootClass(rootClassName$
|
|
3635
|
+
const rootClasses = useStylesWithRootClass(rootClassName$Q, className);
|
|
3521
3636
|
const [searchText, setSearchText] = useState(value);
|
|
3522
3637
|
let previousSearchText = '';
|
|
3523
3638
|
const handleChange = useCallback(event => {
|
|
@@ -3568,94 +3683,6 @@ function SearchInput({
|
|
|
3568
3683
|
});
|
|
3569
3684
|
}
|
|
3570
3685
|
|
|
3571
|
-
const rootClassName$Q = 'dot-copy-button';
|
|
3572
|
-
const StyledCopyButton = styled.span.withConfig({
|
|
3573
|
-
displayName: "CopyButtonstyles__StyledCopyButton",
|
|
3574
|
-
componentId: "sc-18ff0u-0"
|
|
3575
|
-
})(["", ""], ({
|
|
3576
|
-
theme
|
|
3577
|
-
}) => css(["&.", " .copied-to-clipboard{color:", ";}"], rootClassName$Q, theme.palette.figma.success.normal));
|
|
3578
|
-
|
|
3579
|
-
const DotCopyButton = ({
|
|
3580
|
-
ariaLabel: _ariaLabel = 'Copy to clipboard',
|
|
3581
|
-
ariaRole: _ariaRole = 'button',
|
|
3582
|
-
className,
|
|
3583
|
-
color: _color = 'inherit',
|
|
3584
|
-
copiedTooltip: _copiedTooltip = 'Copied!',
|
|
3585
|
-
copyTooltip: _copyTooltip = 'Copy to clipboard',
|
|
3586
|
-
'data-testid': dataTestId = 'dot-copy-button',
|
|
3587
|
-
disabled: _disabled = false,
|
|
3588
|
-
disableRipple: _disableRipple = false,
|
|
3589
|
-
iconId: _iconId = 'duplicate',
|
|
3590
|
-
iconSize: _iconSize = 'small',
|
|
3591
|
-
onClick: _onClick = null,
|
|
3592
|
-
shape: _shape = 'circle',
|
|
3593
|
-
showCopiedIcon: _showCopiedIcon = true,
|
|
3594
|
-
size: _size = 'small',
|
|
3595
|
-
tooltip,
|
|
3596
|
-
value
|
|
3597
|
-
}) => {
|
|
3598
|
-
const [timedShowCopiedIcon, setTimedShowCopiedIcon] = useState(false);
|
|
3599
|
-
const [timedDisabled, setTimedDisabled] = useState(false);
|
|
3600
|
-
// To keep backward compatibility if tooltip is not set, use copyTooltip
|
|
3601
|
-
if (!tooltip) {
|
|
3602
|
-
tooltip = _copyTooltip;
|
|
3603
|
-
}
|
|
3604
|
-
const copyToClipboard = useCallback(() => {
|
|
3605
|
-
// The check for navigator.clipboard.writeText is because this function is
|
|
3606
|
-
// only supported in secure contexts (https). This will always be the case in
|
|
3607
|
-
// production but not when running locally.
|
|
3608
|
-
if (!navigator.clipboard || !navigator.clipboard.writeText) {
|
|
3609
|
-
console.warn('Copy to clipboard is only supported in secure context (https)', value);
|
|
3610
|
-
} else {
|
|
3611
|
-
navigator.clipboard.writeText(value);
|
|
3612
|
-
}
|
|
3613
|
-
}, [value]);
|
|
3614
|
-
const copy = useCallback(event => {
|
|
3615
|
-
copyToClipboard();
|
|
3616
|
-
if (_showCopiedIcon) {
|
|
3617
|
-
setTimedShowCopiedIcon(true);
|
|
3618
|
-
setTimeout(function () {
|
|
3619
|
-
setTimedShowCopiedIcon(false);
|
|
3620
|
-
}, 3000);
|
|
3621
|
-
} else if (!_disabled) {
|
|
3622
|
-
setTimedDisabled(true);
|
|
3623
|
-
setTimeout(function () {
|
|
3624
|
-
setTimedDisabled(false);
|
|
3625
|
-
}, 3000);
|
|
3626
|
-
}
|
|
3627
|
-
if (_onClick) {
|
|
3628
|
-
return _onClick(event);
|
|
3629
|
-
}
|
|
3630
|
-
return false;
|
|
3631
|
-
}, [value, _showCopiedIcon, _disabled, _onClick]);
|
|
3632
|
-
return jsxs(StyledCopyButton, {
|
|
3633
|
-
className: rootClassName$Q,
|
|
3634
|
-
"data-testid": dataTestId,
|
|
3635
|
-
children: [!timedShowCopiedIcon && jsx(DotIconButton, {
|
|
3636
|
-
ariaLabel: _ariaLabel,
|
|
3637
|
-
ariaRole: _ariaRole,
|
|
3638
|
-
className: className,
|
|
3639
|
-
color: _color,
|
|
3640
|
-
"data-testid": `${dataTestId}-button`,
|
|
3641
|
-
disabled: _disabled || timedDisabled,
|
|
3642
|
-
disableRipple: _disableRipple,
|
|
3643
|
-
iconId: _iconId,
|
|
3644
|
-
iconSize: _iconSize,
|
|
3645
|
-
onClick: copy,
|
|
3646
|
-
shape: _shape,
|
|
3647
|
-
size: _size,
|
|
3648
|
-
tooltip: tooltip
|
|
3649
|
-
}), timedShowCopiedIcon && jsx(DotIcon, {
|
|
3650
|
-
className: "copied-to-clipboard",
|
|
3651
|
-
"data-testid": `${dataTestId}-icon`,
|
|
3652
|
-
fontSize: "small",
|
|
3653
|
-
iconId: "check-solid",
|
|
3654
|
-
tooltip: _copiedTooltip
|
|
3655
|
-
})]
|
|
3656
|
-
});
|
|
3657
|
-
};
|
|
3658
|
-
|
|
3659
3686
|
var img$6 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M12.4332 16.3533V14.8333H11.5665V16.3533L10.7432 15.8933L9.85651 16.4033L11.9998 17.6366L14.1932 16.3733L13.3332 15.8766L12.4332 16.3533Z' fill='white'/%3e%3cpath d='M7.99328 10.1866L9.24661 10.9132L9.67995 10.1399L8.36995 9.4299L9.09328 9.01657V8.03323L7.11328 9.18323L7.11661 11.5532L7.99328 11.0566V10.1866Z' fill='white'/%3e%3cpath d='M14.6934 10.9133L15.9934 10.1733L15.99 11.0566L16.8867 11.5599V9.1766L14.81 7.98993L14.7767 8.9566L15.6167 9.45326L14.29 10.0799L14.6934 10.9133Z' fill='white'/%3e%3cpath d='M16.8801 12.5435L16.0001 12.0402V12.0935V13.7068L12.4167 11.6868V7.61015L13.9667 8.49015V7.51682L12.0001 6.35349L9.95006 7.52348V8.52348L11.4967 7.63015V11.6868L8.00006 13.8168V12.0202L7.12006 12.5235V14.8202L8.96672 15.8502L9.86672 15.3335L8.40006 14.5268L12.0001 12.4368L15.5567 14.5035L14.1301 15.3268L15.0567 15.8701L16.8701 14.8268L16.8801 12.5435Z' fill='white'/%3e%3c/svg%3e";
|
|
3660
3687
|
|
|
3661
3688
|
var img$5 = "data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20Z' fill='%23279FEA'/%3e%3cpath d='M14.1867 11.2667L12.1634 10.0833L10.1367 11.2667V13.62L12.1634 14.7867L14.1867 13.62V11.2667Z' fill='white'/%3e%3cpath d='M8.43666 12.0001L7.47333 11.1501V15.1667L10.41 16.8367V15.7034L8.43666 14.5401V12.0001Z' fill='white'/%3e%3cpath d='M15.8965 12V14.5833L13.9632 15.7033V16.9367L16.8532 15.1533V11.0967L15.8965 12Z' fill='white'/%3e%3cpath d='M12.1565 8.13333L14.7165 9.61333L15.4165 8.89L12.1565 7L8.87988 8.90667L9.57988 9.63333L12.1565 8.13333Z' fill='white'/%3e%3c/svg%3e";
|
|
@@ -5514,7 +5541,7 @@ const StyledToggleButtonGroup = styled(ToggleButtonGroup).withConfig({
|
|
|
5514
5541
|
componentId: "sc-1oh4ljv-0"
|
|
5515
5542
|
})(["", ""], ({
|
|
5516
5543
|
theme
|
|
5517
|
-
}) => css(["&.", "{button:not(.MuiToggleButton-sizeLarge):not(.MuiToggleButton-sizeSmall){height:", ";.dot-icon{width:", ";}}.dot-icon{color:", ";display:flex;+ p{margin-left:", ";}i{height:auto;}}.dot-typography{margin-bottom:0;}.MuiToggleButton-label{color:", ";p{margin-bottom:0;}}.MuiToggleButtonGroup-groupedHorizontal{border:1px solid ", ";border-radius:0;}.dot-tooltip{&:first-child .MuiToggleButtonGroup-groupedHorizontal{border-top-left-radius:4px;border-bottom-left-radius:4px;margin-left:0;}&:last-child .MuiToggleButtonGroup-groupedHorizontal{border-top-right-radius:4px;border-bottom-right-radius:4px;margin-right:0;}&:not(:first-child) .MuiToggleButtonGroup-groupedHorizontal{margin-left:-1px;}}& > .MuiToggleButtonGroup-groupedHorizontal{:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px;margin-left:0;}:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px;margin-right:0;}}}.MuiButtonBase-root{&.Mui-disabled{background:", ";.dot-typography{color:", ";}.dot-icon{color:", ";}}&.Mui-selected{
|
|
5544
|
+
}) => css(["&.", "{button:not(.MuiToggleButton-sizeLarge):not(.MuiToggleButton-sizeSmall){height:", ";.dot-icon{width:", ";}}.dot-icon{color:", ";display:flex;+ p{margin-left:", ";}i{height:auto;}}.dot-typography{margin-bottom:0;}.MuiToggleButton-label{color:", ";p{margin-bottom:0;}}.MuiToggleButtonGroup-groupedHorizontal{border:1px solid ", ";border-radius:0;}.dot-tooltip{&:first-child .MuiToggleButtonGroup-groupedHorizontal{border-top-left-radius:4px;border-bottom-left-radius:4px;margin-left:0;}&:last-child .MuiToggleButtonGroup-groupedHorizontal{border-top-right-radius:4px;border-bottom-right-radius:4px;margin-right:0;}&:not(:first-child) .MuiToggleButtonGroup-groupedHorizontal{margin-left:-1px;}}& > .MuiToggleButtonGroup-groupedHorizontal{:first-child{border-top-left-radius:4px;border-bottom-left-radius:4px;margin-left:0;}:last-child{border-top-right-radius:4px;border-bottom-right-radius:4px;margin-right:0;}}}button.MuiButtonBase-root.MuiToggleButton-root{&:not(.Mui-disabled):not(.Mui-selected){background-color:", ";}&.Mui-disabled{background-color:", ";.dot-typography{color:", ";}.dot-icon{color:", ";}}&.Mui-selected{background-color:", ";.dot-icon,.dot-typography{color:", ";}}}"], rootClassName$G, theme.spacing(5), theme.spacing(2), theme.palette.figma.icon.black, theme.spacing(1), theme.palette.figma.typography.black, theme.palette.figma.border.defaultButton, theme.palette.figma.neutral.normal, theme.palette.figma.disabled.normal, theme.palette.figma.typography.gray, theme.palette.figma.icon.disabled, theme.palette.figma.toggleTabs.bckg, theme.palette.figma.toggleTabs.text));
|
|
5518
5545
|
|
|
5519
5546
|
const DotButtonToggle = ({
|
|
5520
5547
|
ariaLabel,
|
|
@@ -7969,6 +7996,7 @@ const DotSnackbar = ({
|
|
|
7969
7996
|
children,
|
|
7970
7997
|
className,
|
|
7971
7998
|
'data-testid': dataTestId,
|
|
7999
|
+
hideOnClickAway: _hideOnClickAway = true,
|
|
7972
8000
|
onClose,
|
|
7973
8001
|
open,
|
|
7974
8002
|
severity,
|
|
@@ -7980,6 +8008,11 @@ const DotSnackbar = ({
|
|
|
7980
8008
|
action
|
|
7981
8009
|
});
|
|
7982
8010
|
const rootClasses = useStylesWithRootClass(rootClassName$m, className);
|
|
8011
|
+
const handleSnackbarClose = reason => {
|
|
8012
|
+
if (_hideOnClickAway || !_hideOnClickAway && reason !== 'clickaway') {
|
|
8013
|
+
onClose();
|
|
8014
|
+
}
|
|
8015
|
+
};
|
|
7983
8016
|
return jsx(StyledSnackbar, {
|
|
7984
8017
|
anchorOrigin: _anchorOrigin,
|
|
7985
8018
|
"aria-label": ariaLabel,
|
|
@@ -7988,7 +8021,7 @@ const DotSnackbar = ({
|
|
|
7988
8021
|
root: rootClasses
|
|
7989
8022
|
},
|
|
7990
8023
|
"data-testid": dataTestId,
|
|
7991
|
-
onClose:
|
|
8024
|
+
onClose: (_e, r) => handleSnackbarClose(r),
|
|
7992
8025
|
open: open,
|
|
7993
8026
|
severity: severity,
|
|
7994
8027
|
children: jsx(Alert, {
|
|
@@ -8017,7 +8050,9 @@ const DotSnackbarContext = /*#__PURE__*/createContext({
|
|
|
8017
8050
|
enqueueMessage: (_message, _severity) => null,
|
|
8018
8051
|
removeMessage: _id => null
|
|
8019
8052
|
});
|
|
8020
|
-
const DotSnackbarContainer = (
|
|
8053
|
+
const DotSnackbarContainer = ({
|
|
8054
|
+
hideOnClickAway
|
|
8055
|
+
}) => {
|
|
8021
8056
|
const {
|
|
8022
8057
|
alerts,
|
|
8023
8058
|
removeMessage
|
|
@@ -8034,6 +8069,7 @@ const DotSnackbarContainer = () => {
|
|
|
8034
8069
|
"data-testid": rootClassName$l,
|
|
8035
8070
|
children: alerts.slice().reverse().map(alert => {
|
|
8036
8071
|
return jsx(DotSnackbar, {
|
|
8072
|
+
hideOnClickAway: hideOnClickAway,
|
|
8037
8073
|
onClose: handleClose(alert.id),
|
|
8038
8074
|
open: alert.open,
|
|
8039
8075
|
severity: alert.severity,
|
|
@@ -8044,7 +8080,8 @@ const DotSnackbarContainer = () => {
|
|
|
8044
8080
|
});
|
|
8045
8081
|
};
|
|
8046
8082
|
const DotSnackbarProvider = ({
|
|
8047
|
-
children
|
|
8083
|
+
children,
|
|
8084
|
+
hideOnClickAway: _hideOnClickAway = true
|
|
8048
8085
|
}) => {
|
|
8049
8086
|
const [alerts, setAlerts] = useState([]);
|
|
8050
8087
|
function enqueueMessage(message, severity) {
|
|
@@ -8058,6 +8095,7 @@ const DotSnackbarProvider = ({
|
|
|
8058
8095
|
setAlerts(prevState => {
|
|
8059
8096
|
return [...prevState, Object.assign({}, queue)];
|
|
8060
8097
|
});
|
|
8098
|
+
return id;
|
|
8061
8099
|
}
|
|
8062
8100
|
const removeMessage = id => {
|
|
8063
8101
|
setAlerts(prev => {
|
|
@@ -8076,7 +8114,9 @@ const DotSnackbarProvider = ({
|
|
|
8076
8114
|
const memoizedValues = useMemo(() => DotSnackbarValues, [alerts]);
|
|
8077
8115
|
return jsxs(DotSnackbarContext.Provider, {
|
|
8078
8116
|
value: memoizedValues,
|
|
8079
|
-
children: [jsx(DotSnackbarContainer, {
|
|
8117
|
+
children: [jsx(DotSnackbarContainer, {
|
|
8118
|
+
hideOnClickAway: _hideOnClickAway
|
|
8119
|
+
}), children]
|
|
8080
8120
|
});
|
|
8081
8121
|
};
|
|
8082
8122
|
const useDotSnackbarContext = () => {
|
|
@@ -8555,6 +8595,65 @@ value, typographyVariant) => {
|
|
|
8555
8595
|
}
|
|
8556
8596
|
return value;
|
|
8557
8597
|
};
|
|
8598
|
+
const renderAvatarWithTextCell = avatarWithText => {
|
|
8599
|
+
const {
|
|
8600
|
+
avatarIcon,
|
|
8601
|
+
avatarImageSrc,
|
|
8602
|
+
mainText,
|
|
8603
|
+
secondaryText
|
|
8604
|
+
} = avatarWithText;
|
|
8605
|
+
return jsxs("div", {
|
|
8606
|
+
className: "cell-avatar-with-text",
|
|
8607
|
+
children: [(avatarImageSrc || avatarIcon) && jsx(DotAvatar, {
|
|
8608
|
+
alt: mainText,
|
|
8609
|
+
className: "cell-avatar",
|
|
8610
|
+
"data-testid": "cell-avatar",
|
|
8611
|
+
iconId: avatarIcon,
|
|
8612
|
+
imageSrc: avatarImageSrc,
|
|
8613
|
+
size: "small",
|
|
8614
|
+
type: avatarImageSrc ? 'image' : 'icon'
|
|
8615
|
+
}), jsxs("div", {
|
|
8616
|
+
className: "cell-text",
|
|
8617
|
+
children: [jsx(DotTypography, {
|
|
8618
|
+
variant: "body1",
|
|
8619
|
+
children: mainText
|
|
8620
|
+
}), secondaryText && jsx(DotTypography, {
|
|
8621
|
+
"data-testid": "cell-secondary-text",
|
|
8622
|
+
variant: "body2",
|
|
8623
|
+
children: secondaryText
|
|
8624
|
+
})]
|
|
8625
|
+
})]
|
|
8626
|
+
});
|
|
8627
|
+
};
|
|
8628
|
+
const renderInlineEditCell = inlineEdit => {
|
|
8629
|
+
return jsx(DotInlineEdit, Object.assign({}, inlineEdit, {
|
|
8630
|
+
ariaLabel: "inline edit cell",
|
|
8631
|
+
className: `inline-edit-cell ${inlineEdit.className ? inlineEdit.className : ''}`
|
|
8632
|
+
}));
|
|
8633
|
+
};
|
|
8634
|
+
const getValuesForSort = (a, b, orderBy) => {
|
|
8635
|
+
var _a, _b, _c, _d;
|
|
8636
|
+
let valueA;
|
|
8637
|
+
let valueB;
|
|
8638
|
+
if (((_a = a.rowData[orderBy]) === null || _a === void 0 ? void 0 : _a.mainText) && ((_b = b.rowData[orderBy]) === null || _b === void 0 ? void 0 : _b.mainText)) {
|
|
8639
|
+
// use mainText value for sort in case when data for the table cell is passed with AvatarWithTextCell
|
|
8640
|
+
valueA = a.rowData[orderBy].mainText;
|
|
8641
|
+
valueB = b.rowData[orderBy].mainText;
|
|
8642
|
+
} else if (((_c = a.rowData[orderBy]) === null || _c === void 0 ? void 0 : _c.name) && ((_d = b.rowData[orderBy]) === null || _d === void 0 ? void 0 : _d.name)) {
|
|
8643
|
+
// name is the only required prop from InlineEditProps, so if it is there, the cell is considered as inline edit cell
|
|
8644
|
+
// use value from inline edit for sort in case when data for the table cell is passed with InlineEditProps
|
|
8645
|
+
// if value is not defined, then treat it as empty string
|
|
8646
|
+
valueA = a.rowData[orderBy].value || '';
|
|
8647
|
+
valueB = b.rowData[orderBy].value || '';
|
|
8648
|
+
} else {
|
|
8649
|
+
valueA = a.rowData[orderBy];
|
|
8650
|
+
valueB = b.rowData[orderBy];
|
|
8651
|
+
}
|
|
8652
|
+
return {
|
|
8653
|
+
valueA,
|
|
8654
|
+
valueB
|
|
8655
|
+
};
|
|
8656
|
+
};
|
|
8558
8657
|
// If maxHeight is provided, make this the max height for the
|
|
8559
8658
|
// table container. If it is not provided but stickyHeader is true,
|
|
8560
8659
|
// calculate a max height based on screen size.
|
|
@@ -8627,7 +8726,7 @@ const StyledTableCell = styled(TableCell).withConfig({
|
|
|
8627
8726
|
componentId: "e84k25-0"
|
|
8628
8727
|
})(["", ""], ({
|
|
8629
8728
|
theme
|
|
8630
|
-
}) => css(["&.", "{padding-top:0;padding-bottom:0;&.actionItems,&.noWrap p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}&.actionItems{max-width:0;text-align:right;text-overflow:clip;}&.noWrap p{max-width:calc(100% - 1px);}.action-cell-wrapper{width:100%;}.cell-avatar-with-text{display:flex;align-items:center;.cell-avatar{margin-right:", ";}.cell-text{width:100%;}}}"], rootClassName$f, theme.spacing(1)));
|
|
8729
|
+
}) => css(["&.", "{padding-top:0;padding-bottom:0;&.actionItems,&.noWrap p{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}&.actionItems{max-width:0;text-align:right;text-overflow:clip;}&.noWrap p{max-width:calc(100% - 1px);}.action-cell-wrapper{width:100%;}.cell-avatar-with-text{display:flex;align-items:center;.cell-avatar{margin-right:", ";}.cell-text{width:100%;}}.inline-edit-cell{input{background-color:", ";}.dot-view-mode:not(.dot-read-only):hover{background-color:", ";}}}"], rootClassName$f, theme.spacing(1), theme.palette.figma.background.level0.bckgWhiteBlack, theme.palette.figma.neutral.active));
|
|
8631
8730
|
|
|
8632
8731
|
/**
|
|
8633
8732
|
* A wrapper component around the TableCell component from @material-ui.
|
|
@@ -8702,34 +8801,10 @@ const DotBodyCell = ({
|
|
|
8702
8801
|
});
|
|
8703
8802
|
}
|
|
8704
8803
|
if (value === null || value === void 0 ? void 0 : value.mainText) {
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
secondaryText
|
|
8710
|
-
} = value;
|
|
8711
|
-
return jsxs("div", {
|
|
8712
|
-
className: "cell-avatar-with-text",
|
|
8713
|
-
children: [(avatarImageSrc || avatarIcon) && jsx(DotAvatar, {
|
|
8714
|
-
alt: mainText,
|
|
8715
|
-
className: "cell-avatar",
|
|
8716
|
-
"data-testid": "cell-avatar",
|
|
8717
|
-
iconId: avatarIcon,
|
|
8718
|
-
imageSrc: avatarImageSrc,
|
|
8719
|
-
size: "small",
|
|
8720
|
-
type: avatarImageSrc ? 'image' : 'icon'
|
|
8721
|
-
}), jsxs("div", {
|
|
8722
|
-
className: "cell-text",
|
|
8723
|
-
children: [jsx(DotTypography, {
|
|
8724
|
-
variant: "body1",
|
|
8725
|
-
children: mainText
|
|
8726
|
-
}), secondaryText && jsx(DotTypography, {
|
|
8727
|
-
"data-testid": "cell-secondary-text",
|
|
8728
|
-
variant: "body2",
|
|
8729
|
-
children: secondaryText
|
|
8730
|
-
})]
|
|
8731
|
-
})]
|
|
8732
|
-
});
|
|
8804
|
+
return renderAvatarWithTextCell(value);
|
|
8805
|
+
}
|
|
8806
|
+
if (value === null || value === void 0 ? void 0 : value.name) {
|
|
8807
|
+
return renderInlineEditCell(value);
|
|
8733
8808
|
}
|
|
8734
8809
|
return getFormattedTableCellValue(value, typography);
|
|
8735
8810
|
};
|
|
@@ -9355,14 +9430,10 @@ const DotTableSelectionToolbar = ({
|
|
|
9355
9430
|
};
|
|
9356
9431
|
|
|
9357
9432
|
const sortComparator = (a, b, orderBy) => {
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
// use mainText value for sort in case when data for the table cell is of type CustomCellDataWrapper
|
|
9363
|
-
valueA = a.rowData[orderBy].mainText;
|
|
9364
|
-
valueB = b.rowData[orderBy].mainText;
|
|
9365
|
-
}
|
|
9433
|
+
const {
|
|
9434
|
+
valueA,
|
|
9435
|
+
valueB
|
|
9436
|
+
} = getValuesForSort(a, b, orderBy);
|
|
9366
9437
|
if (valueB < valueA) {
|
|
9367
9438
|
return -1;
|
|
9368
9439
|
}
|
|
@@ -10279,16 +10350,6 @@ var DatePickerKeydownContext;
|
|
|
10279
10350
|
DatePickerKeydownContext[DatePickerKeydownContext["Popper"] = 2] = "Popper";
|
|
10280
10351
|
})(DatePickerKeydownContext || (DatePickerKeydownContext = {}));
|
|
10281
10352
|
|
|
10282
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
10283
|
-
|
|
10284
|
-
var dayjs_min = {exports: {}};
|
|
10285
|
-
|
|
10286
|
-
(function (module, exports) {
|
|
10287
|
-
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",c="month",f="quarter",h="year",d="date",l="Invalid Date",$=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,M={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return "["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},v={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,c),s=n-i<0,u=e.clone().add(r+(s?-1:1),c);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:c,y:h,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},g="en",D={};D[g]=M;var p="$isDayjsObject",S=function(t){return t instanceof _||!(!t||!t[p])},w=function t(e,n,r){var i;if(!e)return g;if("string"==typeof e){var s=e.toLowerCase();D[s]&&(i=s),n&&(D[s]=n,i=s);var u=e.split("-");if(!i&&u.length>1)return t(u[0])}else {var a=e.name;D[a]=e,i=a;}return !r&&i&&(g=i),i||!r&&g},O=function(t,e){if(S(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},b=v;b.l=w,b.i=S,b.w=function(t,e){return O(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=w(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[p]=!0;}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(b.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match($);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return b},m.isValid=function(){return !(this.$d.toString()===l)},m.isSame=function(t,e){var n=O(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return O(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<O(t)},m.$g=function(t,e,n){return b.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!b.u(e)||e,f=b.p(t),l=function(t,e){var i=b.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},$=function(t,e){return b.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,v="set"+(this.$u?"UTC":"");switch(f){case h:return r?l(1,0):l(31,11);case c:return r?l(1,M):l(0,M+1);case o:var g=this.$locale().weekStart||0,D=(y<g?y+7:y)-g;return l(r?m-D:m+(6-D),M);case a:case d:return $(v+"Hours",0);case u:return $(v+"Minutes",1);case s:return $(v+"Seconds",2);case i:return $(v+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=b.p(t),f="set"+(this.$u?"UTC":""),l=(n={},n[a]=f+"Date",n[d]=f+"Date",n[c]=f+"Month",n[h]=f+"FullYear",n[u]=f+"Hours",n[s]=f+"Minutes",n[i]=f+"Seconds",n[r]=f+"Milliseconds",n)[o],$=o===a?this.$D+(e-this.$W):e;if(o===c||o===h){var y=this.clone().set(d,1);y.$d[l]($),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else l&&this.$d[l]($);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[b.p(t)]()},m.add=function(r,f){var d,l=this;r=Number(r);var $=b.p(f),y=function(t){var e=O(l);return b.w(e.date(e.date()+Math.round(t*r)),l)};if($===c)return this.set(c,this.$M+r);if($===h)return this.set(h,this.$y+r);if($===a)return y(1);if($===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[$]||1,m=this.$d.getTime()+r*M;return b.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||l;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=b.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,c=n.months,f=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return b.s(s%12||12,t,"0")},$=f||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(y,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return b.s(e.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,c,3);case"MMMM":return h(c,a);case"D":return e.$D;case"DD":return b.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,o,2);case"ddd":return h(n.weekdaysShort,e.$W,o,3);case"dddd":return o[e.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return $(s,u,!0);case"A":return $(s,u,!1);case"m":return String(u);case"mm":return b.s(u,2,"0");case"s":return String(e.$s);case"ss":return b.s(e.$s,2,"0");case"SSS":return b.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,l){var $,y=this,M=b.p(d),m=O(r),v=(m.utcOffset()-this.utcOffset())*e,g=this-m,D=function(){return b.m(y,m)};switch(M){case h:$=D()/12;break;case c:$=D();break;case f:$=D()/3;break;case o:$=(g-v)/6048e5;break;case a:$=(g-v)/864e5;break;case u:$=g/n;break;case s:$=g/e;break;case i:$=g/t;break;default:$=g;}return l?$:b.a($)},m.daysInMonth=function(){return this.endOf(c).$D},m.$locale=function(){return D[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=w(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return b.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),k=_.prototype;return O.prototype=k,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",c],["$y",h],["$D",d]].forEach((function(t){k[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),O.extend=function(t,e){return t.$i||(t(e,_,O),t.$i=!0),O},O.locale=w,O.isDayjs=S,O.unix=function(t){return O(1e3*t)},O.en=D[g],O.Ls=D,O.p={},O}));
|
|
10288
|
-
}(dayjs_min));
|
|
10289
|
-
|
|
10290
|
-
var dayjs = dayjs_min.exports;
|
|
10291
|
-
|
|
10292
10353
|
/** This returns a `boolean` indicating whether the Day.js object contains a valid date or not. */
|
|
10293
10354
|
const checkIfValidDate = (date, format) => dayjs(date, format, true).isValid();
|
|
10294
10355
|
const getContextEnumBasedOnTarget = (event, inputElement, contextEnum) => {
|
|
@@ -10302,14 +10363,6 @@ const getContextEnumBasedOnTarget = (event, inputElement, contextEnum) => {
|
|
|
10302
10363
|
return currentContextEnum;
|
|
10303
10364
|
};
|
|
10304
10365
|
|
|
10305
|
-
var updateLocale$1 = {exports: {}};
|
|
10306
|
-
|
|
10307
|
-
(function (module, exports) {
|
|
10308
|
-
!function(e,n){module.exports=n();}(commonjsGlobal,(function(){return function(e,n,t){t.updateLocale=function(e,n){var o=t.Ls[e];if(o)return (n?Object.keys(n):[]).forEach((function(e){o[e]=n[e];})),o};}}));
|
|
10309
|
-
}(updateLocale$1));
|
|
10310
|
-
|
|
10311
|
-
var updateLocale = updateLocale$1.exports;
|
|
10312
|
-
|
|
10313
10366
|
const rootClassName$2 = 'dot-date-picker';
|
|
10314
10367
|
const popperClassName = 'dot-date-picker-popper';
|
|
10315
10368
|
const containerClassName$1 = 'dot-date-picker-container';
|
|
@@ -10532,14 +10585,6 @@ const mockScrollIntoView = scrollIntoViewMock => {
|
|
|
10532
10585
|
window.HTMLElement.prototype.scrollIntoView = scrollIntoViewMock;
|
|
10533
10586
|
};
|
|
10534
10587
|
|
|
10535
|
-
var utc$1 = {exports: {}};
|
|
10536
|
-
|
|
10537
|
-
(function (module, exports) {
|
|
10538
|
-
!function(t,i){module.exports=i();}(commonjsGlobal,(function(){var t="minute",i=/[+-]\d\d(?::?\d\d)?/g,e=/([+-]|\d\d)/g;return function(s,f,n){var u=f.prototype;n.utc=function(t){var i={date:t,utc:!0,args:arguments};return new f(i)},u.utc=function(i){var e=n(this.toDate(),{locale:this.$L,utc:!0});return i?e.add(this.utcOffset(),t):e},u.local=function(){return n(this.toDate(),{locale:this.$L,utc:!1})};var o=u.parse;u.parse=function(t){t.utc&&(this.$u=!0),this.$utils().u(t.$offset)||(this.$offset=t.$offset),o.call(this,t);};var r=u.init;u.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds();}else r.call(this);};var a=u.utcOffset;u.utcOffset=function(s,f){var n=this.$utils().u;if(n(s))return this.$u?0:n(this.$offset)?a.call(this):this.$offset;if("string"==typeof s&&(s=function(t){void 0===t&&(t="");var s=t.match(i);if(!s)return null;var f=(""+s[0]).match(e)||["-",0,0],n=f[0],u=60*+f[1]+ +f[2];return 0===u?0:"+"===n?u:-u}(s),null===s))return this;var u=Math.abs(s)<=16?60*s:s,o=this;if(f)return o.$offset=u,o.$u=0===s,o;if(0!==s){var r=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(o=this.local().add(u+r,t)).$offset=u,o.$x.$localOffset=r;}else o=this.utc();return o};var h=u.format;u.format=function(t){var i=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return h.call(this,i)},u.valueOf=function(){var t=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*t},u.isUTC=function(){return !!this.$u},u.toISOString=function(){return this.toDate().toISOString()},u.toString=function(){return this.toDate().toUTCString()};var l=u.toDate;u.toDate=function(t){return "s"===t&&this.$offset?n(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():l.call(this)};var c=u.diff;u.diff=function(t,i,e){if(t&&this.$u===t.$u)return c.call(this,t,i,e);var s=this.local(),f=n(t).local();return c.call(s,f,i,e)};}}));
|
|
10539
|
-
}(utc$1));
|
|
10540
|
-
|
|
10541
|
-
var utc = utc$1.exports;
|
|
10542
|
-
|
|
10543
10588
|
const getDayjsUtcDate = (value, timeFormat) => dayjs.utc(value, timeFormat);
|
|
10544
10589
|
const createNumbersArray = (length, offset) => Array.from({
|
|
10545
10590
|
length
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digital-ai/dot-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE.md>",
|
|
6
6
|
"contributors": [
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@emotion/styled": "^11.10.4",
|
|
45
45
|
"@mui/material": "^5.2.5",
|
|
46
46
|
"@mui/x-date-pickers": "^6.0.1",
|
|
47
|
+
"dayjs": "^1.11.10",
|
|
47
48
|
"jwt-decode": "^3.1.2",
|
|
48
49
|
"react-dropzone": "^11.4.2",
|
|
49
50
|
"react-grid-layout": "^1.3.4",
|
|
@@ -17,6 +17,11 @@ export interface InputTextProps extends InputProps {
|
|
|
17
17
|
minRows?: number;
|
|
18
18
|
/** if multiline it wil render multiple lines */
|
|
19
19
|
multiline?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* If this callback is provided, a clear button will be rendered at the end of the input field.
|
|
22
|
+
* The specified handler will be invoked when the user clicks the clear button.
|
|
23
|
+
*/
|
|
24
|
+
onClear?: () => void;
|
|
20
25
|
/** Placeholder text always displayed inside the input field */
|
|
21
26
|
placeholder?: string;
|
|
22
27
|
/** value of the InputText */
|
|
@@ -31,4 +36,4 @@ export interface EndIconProps {
|
|
|
31
36
|
success?: boolean;
|
|
32
37
|
warning?: boolean;
|
|
33
38
|
}
|
|
34
|
-
export declare const DotInputText: ({ autoComplete, autoFocus, className, defaultValue, "data-testid": dataTestId, disabled, error, endAdornmentTooltip, fullWidth, hasDebounce, helperText, endIcon, endText, id, inputRef, label, max, maxLength, maxRows, min, minLength, minRows, multiline, name, onBlur, onChange, onFocus, onKeyDown, onMouseUp, persistentLabel, placeholder, readOnly, required, shrink, startIcon, size, success, type, value, warning, }: InputTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const DotInputText: ({ autoComplete, autoFocus, className, defaultValue, "data-testid": dataTestId, disabled, error, endAdornmentTooltip, fullWidth, hasDebounce, helperText, endIcon, endText, id, inputRef, label, max, maxLength, maxRows, min, minLength, minRows, multiline, name, onBlur, onChange, onClear, onFocus, onKeyDown, onMouseUp, persistentLabel, placeholder, readOnly, required, shrink, startIcon, size, success, type, value, warning, }: InputTextProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,15 +7,17 @@ export interface SnackbarProps extends CommonProps {
|
|
|
7
7
|
action?: ReactNode;
|
|
8
8
|
/** The anchor of the Snackbar. On smaller screens, the component grows to occupy all the available width, the horizontal alignment is ignored. */
|
|
9
9
|
anchorOrigin?: SnackbarOrigin;
|
|
10
|
-
/** The message the user sees once the alert displays */
|
|
10
|
+
/** The message the user sees once the alert displays. */
|
|
11
11
|
children: ReactNode;
|
|
12
|
+
/** If false, then snackbar does not close when clicking away. True by default. */
|
|
13
|
+
hideOnClickAway?: boolean;
|
|
12
14
|
/** A callback to handle closing the alert. */
|
|
13
15
|
onClose?: () => void;
|
|
14
16
|
/** Boolean value to switch between opening and closing the alert. */
|
|
15
17
|
open: boolean;
|
|
16
18
|
/** An alert level, indicating the importance of the message. */
|
|
17
19
|
severity: SnackbarSeverity;
|
|
18
|
-
/** Width of the encapsulated Alert component */
|
|
20
|
+
/** Width of the encapsulated Alert component. */
|
|
19
21
|
width?: string;
|
|
20
22
|
}
|
|
21
|
-
export declare const DotSnackbar: ({ action, anchorOrigin, ariaLabel, children, className, "data-testid": dataTestId, onClose, open, severity, width, }: SnackbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const DotSnackbar: ({ action, anchorOrigin, ariaLabel, children, className, "data-testid": dataTestId, hideOnClickAway, onClose, open, severity, width, }: SnackbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,16 +6,20 @@ declare const initialState: {
|
|
|
6
6
|
severity: string;
|
|
7
7
|
id: string;
|
|
8
8
|
}[];
|
|
9
|
-
interface SnackbarProviderProps {
|
|
10
|
-
/** The components or string that load inside
|
|
9
|
+
export interface SnackbarProviderProps {
|
|
10
|
+
/** The components or string that load inside the snackbar provider. */
|
|
11
11
|
children: ReactNode;
|
|
12
|
+
hideOnClickAway?: boolean;
|
|
13
|
+
}
|
|
14
|
+
interface SnackbarContainerProps {
|
|
15
|
+
hideOnClickAway?: boolean;
|
|
12
16
|
}
|
|
13
17
|
interface DotSnackbarProps {
|
|
14
18
|
alerts: typeof initialState;
|
|
15
|
-
enqueueMessage: (message:
|
|
19
|
+
enqueueMessage: (message: ReactNode, severity: SnackbarSeverity) => string;
|
|
16
20
|
removeMessage: (id: string) => void;
|
|
17
21
|
}
|
|
18
|
-
export declare const DotSnackbarContainer: () => import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export declare const DotSnackbarProvider: ({ children }: SnackbarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const DotSnackbarContainer: ({ hideOnClickAway, }: SnackbarContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export declare const DotSnackbarProvider: ({ children, hideOnClickAway, }: SnackbarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
24
|
export declare const useDotSnackbarContext: () => DotSnackbarProps;
|
|
21
25
|
export {};
|
|
@@ -2,7 +2,7 @@ import { CSSProperties, ReactNode } from 'react';
|
|
|
2
2
|
import { CommonProps } from '../CommonProps';
|
|
3
3
|
import { TypographyVariant } from '../typography/Typography';
|
|
4
4
|
export type TextAlignment = 'center' | 'inherit' | 'justify' | 'left' | 'right';
|
|
5
|
-
export interface
|
|
5
|
+
export interface AvatarWithTextCell {
|
|
6
6
|
avatarIcon?: string;
|
|
7
7
|
avatarImageSrc?: string;
|
|
8
8
|
mainText: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { DotColumnHeader, TableRowProps } from './utils/interfaces';
|
|
2
2
|
export type { TableActionProps } from './TableAction';
|
|
3
3
|
export type { TableActionsProps } from './TableActions';
|
|
4
|
-
export type {
|
|
4
|
+
export type { AvatarWithTextCell, TextAlignment } from './TableCell';
|
|
5
5
|
export type { TableDataWithPagination } from './TableDataWithPagination';
|
|
6
6
|
export type { SortDirection } from './TableHeaderCell';
|
|
7
7
|
export type { RowsPerPageOption } from './TablePagination';
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TypographyVariant } from '../../typography/Typography';
|
|
3
3
|
import { TableRowProps } from './interfaces';
|
|
4
|
+
import { AvatarWithTextCell } from '../TableCell';
|
|
5
|
+
import { InlineEditProps } from '../../inline-edit';
|
|
4
6
|
export declare const getFormattedTableCellValue: (value: any, typographyVariant: TypographyVariant) => ReactNode;
|
|
7
|
+
export declare const renderAvatarWithTextCell: (avatarWithText: AvatarWithTextCell) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const renderInlineEditCell: (inlineEdit: InlineEditProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const getValuesForSort: (a: TableRowProps, b: TableRowProps, orderBy: string) => {
|
|
10
|
+
valueA: any;
|
|
11
|
+
valueB: any;
|
|
12
|
+
};
|
|
5
13
|
export declare const getContainerMaxHeightStyle: (stickyHeader?: boolean, maxHeight?: string) => string;
|
|
6
14
|
export declare const getSelectedRowIds: (id: string, isChecked: boolean, selectedIds: string[]) => string[];
|
|
7
15
|
export declare const getBulkSelectedRowIds: (isChecked: boolean, selectedIds: string[], pageData: TableRowProps[]) => string[];
|