@digital-ai/dot-components 2.25.2 → 2.26.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
CHANGED
|
@@ -7042,6 +7042,20 @@ const StyledToggleButtonGroup = styled(ToggleButtonGroup)`
|
|
|
7042
7042
|
}
|
|
7043
7043
|
}
|
|
7044
7044
|
|
|
7045
|
+
.toggle-button-badge {
|
|
7046
|
+
align-items: center;
|
|
7047
|
+
gap: ${theme.spacing(1)};
|
|
7048
|
+
|
|
7049
|
+
.dot-typography {
|
|
7050
|
+
margin-left: 0;
|
|
7051
|
+
}
|
|
7052
|
+
|
|
7053
|
+
.MuiBadge-badge {
|
|
7054
|
+
position: static;
|
|
7055
|
+
transform: none;
|
|
7056
|
+
}
|
|
7057
|
+
}
|
|
7058
|
+
|
|
7045
7059
|
.dot-typography {
|
|
7046
7060
|
margin-bottom: 0;
|
|
7047
7061
|
}
|
|
@@ -7134,6 +7148,7 @@ const DotButtonToggle = ({
|
|
|
7134
7148
|
const rootClasses = useStylesWithRootClass(rootClassName$G, className);
|
|
7135
7149
|
const renderToggleButton = ({
|
|
7136
7150
|
ariaLabel: optionAriaLabel,
|
|
7151
|
+
badgeContent: optionBadgeContent,
|
|
7137
7152
|
className: optionClassName,
|
|
7138
7153
|
disabled: optionDisabled,
|
|
7139
7154
|
iconId: optionIconId,
|
|
@@ -7150,14 +7165,25 @@ const DotButtonToggle = ({
|
|
|
7150
7165
|
key,
|
|
7151
7166
|
value: optionValue
|
|
7152
7167
|
};
|
|
7153
|
-
const
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7168
|
+
const getChildren = () => {
|
|
7169
|
+
if (!optionIconId && !optionText) return;
|
|
7170
|
+
const optionTextTypography = jsxs(Fragment, {
|
|
7171
|
+
children: [optionIconId && jsx(DotIcon, {
|
|
7172
|
+
className: "dot-toggle-icon",
|
|
7173
|
+
iconId: optionIconId
|
|
7174
|
+
}), optionText && jsx(DotTypography, {
|
|
7175
|
+
children: optionText
|
|
7176
|
+
})]
|
|
7177
|
+
});
|
|
7178
|
+
return optionBadgeContent && !isNaN(optionBadgeContent) && optionBadgeContent > 0 && optionText ? jsx(DotBadge, {
|
|
7179
|
+
"data-testid": dataTestId && `${dataTestId}-badge`,
|
|
7180
|
+
className: "toggle-button-badge",
|
|
7181
|
+
badgeContent: optionBadgeContent,
|
|
7182
|
+
variant: "standard",
|
|
7183
|
+
children: optionTextTypography
|
|
7184
|
+
}) : optionTextTypography;
|
|
7185
|
+
};
|
|
7186
|
+
const children = getChildren();
|
|
7161
7187
|
return optionTooltip ? jsx(TooltipToggleButton, Object.assign({}, commonProps, {
|
|
7162
7188
|
CustomTooltipProps: {
|
|
7163
7189
|
title: optionTooltip
|
|
@@ -10126,6 +10152,7 @@ const StyledSnackbar = styled(Snackbar)`
|
|
|
10126
10152
|
}
|
|
10127
10153
|
.MuiAlert-message {
|
|
10128
10154
|
padding: 13px 0px;
|
|
10155
|
+
word-break: break-word;
|
|
10129
10156
|
}
|
|
10130
10157
|
&.MuiSnackbar-anchorOriginTopRight{
|
|
10131
10158
|
top: 0px;
|
|
@@ -10183,6 +10210,7 @@ const DotSnackbar = ({
|
|
|
10183
10210
|
action,
|
|
10184
10211
|
anchorOrigin = DEFAULT_ANCHOR_ORIGIN,
|
|
10185
10212
|
ariaLabel,
|
|
10213
|
+
autoHideDuration,
|
|
10186
10214
|
children,
|
|
10187
10215
|
className,
|
|
10188
10216
|
'data-testid': dataTestId,
|
|
@@ -10192,7 +10220,7 @@ const DotSnackbar = ({
|
|
|
10192
10220
|
severity,
|
|
10193
10221
|
width
|
|
10194
10222
|
}) => {
|
|
10195
|
-
const
|
|
10223
|
+
const calculatedAutoHideDuration = autoHideDuration === null || autoHideDuration > 0 ? autoHideDuration : addAutoHideDuration(severity);
|
|
10196
10224
|
checkForConflictingEventHandlers({
|
|
10197
10225
|
onClose,
|
|
10198
10226
|
action
|
|
@@ -10206,7 +10234,7 @@ const DotSnackbar = ({
|
|
|
10206
10234
|
return jsx(StyledSnackbar, {
|
|
10207
10235
|
anchorOrigin: anchorOrigin,
|
|
10208
10236
|
"aria-label": ariaLabel,
|
|
10209
|
-
autoHideDuration:
|
|
10237
|
+
autoHideDuration: calculatedAutoHideDuration,
|
|
10210
10238
|
classes: {
|
|
10211
10239
|
root: rootClasses
|
|
10212
10240
|
},
|
|
@@ -10247,7 +10275,7 @@ const StyledSnackbarContainer = styled.div`
|
|
|
10247
10275
|
|
|
10248
10276
|
const DotSnackbarContext = createContext({
|
|
10249
10277
|
alerts: [],
|
|
10250
|
-
enqueueMessage: (_message, _severity) => null,
|
|
10278
|
+
enqueueMessage: (_message, _severity, _autoHideDuration) => null,
|
|
10251
10279
|
removeMessage: _id => null
|
|
10252
10280
|
});
|
|
10253
10281
|
const DotSnackbarContainer = ({
|
|
@@ -10269,6 +10297,7 @@ const DotSnackbarContainer = ({
|
|
|
10269
10297
|
"data-testid": rootClassName$l,
|
|
10270
10298
|
children: alerts.slice().reverse().map(alert => {
|
|
10271
10299
|
return jsx(DotSnackbar, {
|
|
10300
|
+
autoHideDuration: alert.autoHideDuration,
|
|
10272
10301
|
hideOnClickAway: hideOnClickAway,
|
|
10273
10302
|
onClose: handleClose(alert.id),
|
|
10274
10303
|
open: alert.open,
|
|
@@ -10284,13 +10313,14 @@ const DotSnackbarProvider = ({
|
|
|
10284
10313
|
hideOnClickAway = true
|
|
10285
10314
|
}) => {
|
|
10286
10315
|
const [alerts, setAlerts] = useState([]);
|
|
10287
|
-
function enqueueMessage(message, severity) {
|
|
10316
|
+
function enqueueMessage(message, severity, autoHideDuration) {
|
|
10288
10317
|
const id = CreateUUID();
|
|
10289
10318
|
const queue = {
|
|
10290
10319
|
id,
|
|
10291
10320
|
message,
|
|
10292
10321
|
severity,
|
|
10293
|
-
open: true
|
|
10322
|
+
open: true,
|
|
10323
|
+
autoHideDuration
|
|
10294
10324
|
};
|
|
10295
10325
|
setAlerts(prevState => {
|
|
10296
10326
|
return [...prevState, Object.assign({}, queue)];
|
package/index.esm.mjs
CHANGED
|
@@ -7042,6 +7042,20 @@ const StyledToggleButtonGroup = styled(ToggleButtonGroup)`
|
|
|
7042
7042
|
}
|
|
7043
7043
|
}
|
|
7044
7044
|
|
|
7045
|
+
.toggle-button-badge {
|
|
7046
|
+
align-items: center;
|
|
7047
|
+
gap: ${theme.spacing(1)};
|
|
7048
|
+
|
|
7049
|
+
.dot-typography {
|
|
7050
|
+
margin-left: 0;
|
|
7051
|
+
}
|
|
7052
|
+
|
|
7053
|
+
.MuiBadge-badge {
|
|
7054
|
+
position: static;
|
|
7055
|
+
transform: none;
|
|
7056
|
+
}
|
|
7057
|
+
}
|
|
7058
|
+
|
|
7045
7059
|
.dot-typography {
|
|
7046
7060
|
margin-bottom: 0;
|
|
7047
7061
|
}
|
|
@@ -7134,6 +7148,7 @@ const DotButtonToggle = ({
|
|
|
7134
7148
|
const rootClasses = useStylesWithRootClass(rootClassName$G, className);
|
|
7135
7149
|
const renderToggleButton = ({
|
|
7136
7150
|
ariaLabel: optionAriaLabel,
|
|
7151
|
+
badgeContent: optionBadgeContent,
|
|
7137
7152
|
className: optionClassName,
|
|
7138
7153
|
disabled: optionDisabled,
|
|
7139
7154
|
iconId: optionIconId,
|
|
@@ -7150,14 +7165,25 @@ const DotButtonToggle = ({
|
|
|
7150
7165
|
key,
|
|
7151
7166
|
value: optionValue
|
|
7152
7167
|
};
|
|
7153
|
-
const
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7168
|
+
const getChildren = () => {
|
|
7169
|
+
if (!optionIconId && !optionText) return;
|
|
7170
|
+
const optionTextTypography = jsxs(Fragment, {
|
|
7171
|
+
children: [optionIconId && jsx(DotIcon, {
|
|
7172
|
+
className: "dot-toggle-icon",
|
|
7173
|
+
iconId: optionIconId
|
|
7174
|
+
}), optionText && jsx(DotTypography, {
|
|
7175
|
+
children: optionText
|
|
7176
|
+
})]
|
|
7177
|
+
});
|
|
7178
|
+
return optionBadgeContent && !isNaN(optionBadgeContent) && optionBadgeContent > 0 && optionText ? jsx(DotBadge, {
|
|
7179
|
+
"data-testid": dataTestId && `${dataTestId}-badge`,
|
|
7180
|
+
className: "toggle-button-badge",
|
|
7181
|
+
badgeContent: optionBadgeContent,
|
|
7182
|
+
variant: "standard",
|
|
7183
|
+
children: optionTextTypography
|
|
7184
|
+
}) : optionTextTypography;
|
|
7185
|
+
};
|
|
7186
|
+
const children = getChildren();
|
|
7161
7187
|
return optionTooltip ? jsx(TooltipToggleButton, Object.assign({}, commonProps, {
|
|
7162
7188
|
CustomTooltipProps: {
|
|
7163
7189
|
title: optionTooltip
|
|
@@ -10126,6 +10152,7 @@ const StyledSnackbar = styled(Snackbar)`
|
|
|
10126
10152
|
}
|
|
10127
10153
|
.MuiAlert-message {
|
|
10128
10154
|
padding: 13px 0px;
|
|
10155
|
+
word-break: break-word;
|
|
10129
10156
|
}
|
|
10130
10157
|
&.MuiSnackbar-anchorOriginTopRight{
|
|
10131
10158
|
top: 0px;
|
|
@@ -10183,6 +10210,7 @@ const DotSnackbar = ({
|
|
|
10183
10210
|
action,
|
|
10184
10211
|
anchorOrigin = DEFAULT_ANCHOR_ORIGIN,
|
|
10185
10212
|
ariaLabel,
|
|
10213
|
+
autoHideDuration,
|
|
10186
10214
|
children,
|
|
10187
10215
|
className,
|
|
10188
10216
|
'data-testid': dataTestId,
|
|
@@ -10192,7 +10220,7 @@ const DotSnackbar = ({
|
|
|
10192
10220
|
severity,
|
|
10193
10221
|
width
|
|
10194
10222
|
}) => {
|
|
10195
|
-
const
|
|
10223
|
+
const calculatedAutoHideDuration = autoHideDuration === null || autoHideDuration > 0 ? autoHideDuration : addAutoHideDuration(severity);
|
|
10196
10224
|
checkForConflictingEventHandlers({
|
|
10197
10225
|
onClose,
|
|
10198
10226
|
action
|
|
@@ -10206,7 +10234,7 @@ const DotSnackbar = ({
|
|
|
10206
10234
|
return jsx(StyledSnackbar, {
|
|
10207
10235
|
anchorOrigin: anchorOrigin,
|
|
10208
10236
|
"aria-label": ariaLabel,
|
|
10209
|
-
autoHideDuration:
|
|
10237
|
+
autoHideDuration: calculatedAutoHideDuration,
|
|
10210
10238
|
classes: {
|
|
10211
10239
|
root: rootClasses
|
|
10212
10240
|
},
|
|
@@ -10247,7 +10275,7 @@ const StyledSnackbarContainer = styled.div`
|
|
|
10247
10275
|
|
|
10248
10276
|
const DotSnackbarContext = createContext({
|
|
10249
10277
|
alerts: [],
|
|
10250
|
-
enqueueMessage: (_message, _severity) => null,
|
|
10278
|
+
enqueueMessage: (_message, _severity, _autoHideDuration) => null,
|
|
10251
10279
|
removeMessage: _id => null
|
|
10252
10280
|
});
|
|
10253
10281
|
const DotSnackbarContainer = ({
|
|
@@ -10269,6 +10297,7 @@ const DotSnackbarContainer = ({
|
|
|
10269
10297
|
"data-testid": rootClassName$l,
|
|
10270
10298
|
children: alerts.slice().reverse().map(alert => {
|
|
10271
10299
|
return jsx(DotSnackbar, {
|
|
10300
|
+
autoHideDuration: alert.autoHideDuration,
|
|
10272
10301
|
hideOnClickAway: hideOnClickAway,
|
|
10273
10302
|
onClose: handleClose(alert.id),
|
|
10274
10303
|
open: alert.open,
|
|
@@ -10284,13 +10313,14 @@ const DotSnackbarProvider = ({
|
|
|
10284
10313
|
hideOnClickAway = true
|
|
10285
10314
|
}) => {
|
|
10286
10315
|
const [alerts, setAlerts] = useState([]);
|
|
10287
|
-
function enqueueMessage(message, severity) {
|
|
10316
|
+
function enqueueMessage(message, severity, autoHideDuration) {
|
|
10288
10317
|
const id = CreateUUID();
|
|
10289
10318
|
const queue = {
|
|
10290
10319
|
id,
|
|
10291
10320
|
message,
|
|
10292
10321
|
severity,
|
|
10293
|
-
open: true
|
|
10322
|
+
open: true,
|
|
10323
|
+
autoHideDuration
|
|
10294
10324
|
};
|
|
10295
10325
|
setAlerts(prevState => {
|
|
10296
10326
|
return [...prevState, Object.assign({}, queue)];
|
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ export type ButtonToggleOrientation = 'horizontal' | 'vertical';
|
|
|
5
5
|
export type ButtonToggleValue = ButtonToggleSingleValue | Array<ButtonToggleSingleValue>;
|
|
6
6
|
export interface ButtonToggleOption extends CommonProps {
|
|
7
7
|
ariaLabel: string;
|
|
8
|
+
badgeContent?: number;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
iconId?: string;
|
|
10
11
|
text?: string;
|
|
@@ -7,6 +7,8 @@ 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 number of milliseconds to wait before automatically closing the snackbar. If null is passed, then the snackbar never automatically closes. If the prop is not passed at all, then snackbars close after 10 seconds (except error snackbar which never closes automatically). */
|
|
11
|
+
autoHideDuration?: number | null;
|
|
10
12
|
/** The message the user sees once the alert displays. */
|
|
11
13
|
children: ReactNode;
|
|
12
14
|
/** If false, then snackbar does not close when clicking away. True by default. */
|
|
@@ -20,4 +22,4 @@ export interface SnackbarProps extends CommonProps {
|
|
|
20
22
|
/** Width of the encapsulated Alert component. */
|
|
21
23
|
width?: string;
|
|
22
24
|
}
|
|
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;
|
|
25
|
+
export declare const DotSnackbar: ({ action, anchorOrigin, ariaLabel, autoHideDuration, children, className, "data-testid": dataTestId, hideOnClickAway, onClose, open, severity, width, }: SnackbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,6 +5,7 @@ declare const initialState: {
|
|
|
5
5
|
open: boolean;
|
|
6
6
|
severity: string;
|
|
7
7
|
id: string;
|
|
8
|
+
autoHideDuration: number;
|
|
8
9
|
}[];
|
|
9
10
|
export interface SnackbarProviderProps {
|
|
10
11
|
/** The components or string that load inside the snackbar provider. */
|
|
@@ -16,9 +17,10 @@ interface SnackbarContainerProps {
|
|
|
16
17
|
}
|
|
17
18
|
interface DotSnackbarProps {
|
|
18
19
|
alerts: typeof initialState;
|
|
19
|
-
enqueueMessage: (message: ReactNode, severity: SnackbarSeverity) => string;
|
|
20
|
+
enqueueMessage: (message: ReactNode, severity: SnackbarSeverity, autoHideDuration?: number | null) => string;
|
|
20
21
|
removeMessage: (id: string) => void;
|
|
21
22
|
}
|
|
23
|
+
export declare const DotSnackbarContext: import("react").Context<DotSnackbarProps>;
|
|
22
24
|
export declare const DotSnackbarContainer: ({ hideOnClickAway, }: SnackbarContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
export declare const DotSnackbarProvider: ({ children, hideOnClickAway, }: SnackbarProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
26
|
export declare const useDotSnackbarContext: () => DotSnackbarProps;
|