@metamask-previews/design-system-react 0.23.1-preview.620b9f3 → 0.24.0-preview.a0fe3894
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/CHANGELOG.md +9 -1
- package/dist/components/Icon/icons/FlashFilled.cjs +32 -0
- package/dist/components/Icon/icons/FlashFilled.cjs.map +1 -0
- package/dist/components/Icon/icons/FlashFilled.d.cts +4 -0
- package/dist/components/Icon/icons/FlashFilled.d.cts.map +1 -0
- package/dist/components/Icon/icons/FlashFilled.d.mts +4 -0
- package/dist/components/Icon/icons/FlashFilled.d.mts.map +1 -0
- package/dist/components/Icon/icons/FlashFilled.mjs +7 -0
- package/dist/components/Icon/icons/FlashFilled.mjs.map +1 -0
- package/dist/components/Icon/icons/index.cjs +2 -0
- package/dist/components/Icon/icons/index.cjs.map +1 -1
- package/dist/components/Icon/icons/index.d.cts +1 -0
- package/dist/components/Icon/icons/index.d.cts.map +1 -1
- package/dist/components/Icon/icons/index.d.mts +1 -0
- package/dist/components/Icon/icons/index.d.mts.map +1 -1
- package/dist/components/Icon/icons/index.mjs +2 -0
- package/dist/components/Icon/icons/index.mjs.map +1 -1
- package/dist/components/TextField/TextField.cjs +77 -0
- package/dist/components/TextField/TextField.cjs.map +1 -0
- package/dist/components/TextField/TextField.d.cts +324 -0
- package/dist/components/TextField/TextField.d.cts.map +1 -0
- package/dist/components/TextField/TextField.d.mts +324 -0
- package/dist/components/TextField/TextField.d.mts.map +1 -0
- package/dist/components/TextField/TextField.mjs +58 -0
- package/dist/components/TextField/TextField.mjs.map +1 -0
- package/dist/components/TextField/TextField.types.cjs +26 -0
- package/dist/components/TextField/TextField.types.cjs.map +1 -0
- package/dist/components/TextField/TextField.types.d.cts +102 -0
- package/dist/components/TextField/TextField.types.d.cts.map +1 -0
- package/dist/components/TextField/TextField.types.d.mts +102 -0
- package/dist/components/TextField/TextField.types.d.mts.map +1 -0
- package/dist/components/TextField/TextField.types.mjs +23 -0
- package/dist/components/TextField/TextField.types.mjs.map +1 -0
- package/dist/components/TextField/index.cjs +9 -0
- package/dist/components/TextField/index.cjs.map +1 -0
- package/dist/components/TextField/index.d.cts +4 -0
- package/dist/components/TextField/index.d.cts.map +1 -0
- package/dist/components/TextField/index.d.mts +4 -0
- package/dist/components/TextField/index.d.mts.map +1 -0
- package/dist/components/TextField/index.mjs +3 -0
- package/dist/components/TextField/index.mjs.map +1 -0
- package/dist/components/Toast/Toast.cjs +74 -0
- package/dist/components/Toast/Toast.cjs.map +1 -0
- package/dist/components/Toast/Toast.constants.cjs +25 -0
- package/dist/components/Toast/Toast.constants.cjs.map +1 -0
- package/dist/components/Toast/Toast.constants.d.cts +16 -0
- package/dist/components/Toast/Toast.constants.d.cts.map +1 -0
- package/dist/components/Toast/Toast.constants.d.mts +16 -0
- package/dist/components/Toast/Toast.constants.d.mts.map +1 -0
- package/dist/components/Toast/Toast.constants.mjs +20 -0
- package/dist/components/Toast/Toast.constants.mjs.map +1 -0
- package/dist/components/Toast/Toast.d.cts +4 -0
- package/dist/components/Toast/Toast.d.cts.map +1 -0
- package/dist/components/Toast/Toast.d.mts +4 -0
- package/dist/components/Toast/Toast.d.mts.map +1 -0
- package/dist/components/Toast/Toast.mjs +55 -0
- package/dist/components/Toast/Toast.mjs.map +1 -0
- package/dist/components/Toast/Toast.types.cjs +3 -0
- package/dist/components/Toast/Toast.types.cjs.map +1 -0
- package/dist/components/Toast/Toast.types.d.cts +60 -0
- package/dist/components/Toast/Toast.types.d.cts.map +1 -0
- package/dist/components/Toast/Toast.types.d.mts +60 -0
- package/dist/components/Toast/Toast.types.d.mts.map +1 -0
- package/dist/components/Toast/Toast.types.mjs +2 -0
- package/dist/components/Toast/Toast.types.mjs.map +1 -0
- package/dist/components/Toast/Toaster.cjs +174 -0
- package/dist/components/Toast/Toaster.cjs.map +1 -0
- package/dist/components/Toast/Toaster.d.cts +11 -0
- package/dist/components/Toast/Toaster.d.cts.map +1 -0
- package/dist/components/Toast/Toaster.d.mts +11 -0
- package/dist/components/Toast/Toaster.d.mts.map +1 -0
- package/dist/components/Toast/Toaster.mjs +155 -0
- package/dist/components/Toast/Toaster.mjs.map +1 -0
- package/dist/components/Toast/index.cjs +11 -0
- package/dist/components/Toast/index.cjs.map +1 -0
- package/dist/components/Toast/index.d.cts +5 -0
- package/dist/components/Toast/index.d.cts.map +1 -0
- package/dist/components/Toast/index.d.mts +5 -0
- package/dist/components/Toast/index.d.mts.map +1 -0
- package/dist/components/Toast/index.mjs +4 -0
- package/dist/components/Toast/index.mjs.map +1 -0
- package/dist/components/index.cjs +10 -1
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +4 -0
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +4 -0
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +2 -0
- package/dist/components/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { TextFieldPropsShared } from "@metamask-previews/design-system-shared";
|
|
2
|
+
import type { ComponentPropsWithoutRef, Ref } from "react";
|
|
3
|
+
import type { InputProps } from "../Input/Input.types.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* TextField size variants (web-only, ADR-0003).
|
|
6
|
+
*
|
|
7
|
+
* The React Native `TextField` ships a fixed height and intentionally does not
|
|
8
|
+
* expose a size prop, so this const object lives in the web package only.
|
|
9
|
+
*/
|
|
10
|
+
export declare const TextFieldSize: {
|
|
11
|
+
readonly Sm: "sm";
|
|
12
|
+
readonly Md: "md";
|
|
13
|
+
readonly Lg: "lg";
|
|
14
|
+
};
|
|
15
|
+
export type TextFieldSize = (typeof TextFieldSize)[keyof typeof TextFieldSize];
|
|
16
|
+
/**
|
|
17
|
+
* Native input `type` attribute values supported by the web TextField
|
|
18
|
+
* (ADR-0003). React Native consumers use `inputProps.keyboardType` /
|
|
19
|
+
* `inputProps.secureTextEntry` instead, so this is web-only.
|
|
20
|
+
*/
|
|
21
|
+
export declare const TextFieldType: {
|
|
22
|
+
readonly Text: "text";
|
|
23
|
+
readonly Number: "number";
|
|
24
|
+
readonly Password: "password";
|
|
25
|
+
readonly Search: "search";
|
|
26
|
+
};
|
|
27
|
+
export type TextFieldType = (typeof TextFieldType)[keyof typeof TextFieldType];
|
|
28
|
+
type TextFieldInputProps = Omit<InputProps, 'autoFocus' | 'id' | 'isDisabled' | 'isReadOnly' | 'isStateStylesDisabled' | 'maxLength' | 'name' | 'onBlur' | 'onChange' | 'onFocus' | 'placeholder' | 'required' | 'type' | 'value'>;
|
|
29
|
+
export type TextFieldProps = Omit<ComponentPropsWithoutRef<'div'>, 'onBlur' | 'onChange' | 'onFocus' | 'onClick'> & TextFieldPropsShared & {
|
|
30
|
+
/**
|
|
31
|
+
* The size of the text field. Controls the height.
|
|
32
|
+
*
|
|
33
|
+
* @default TextFieldSize.Md
|
|
34
|
+
*/
|
|
35
|
+
size?: TextFieldSize;
|
|
36
|
+
/**
|
|
37
|
+
* The native input `type` attribute.
|
|
38
|
+
*
|
|
39
|
+
* @default TextFieldType.Text
|
|
40
|
+
*/
|
|
41
|
+
type?: TextFieldType;
|
|
42
|
+
/**
|
|
43
|
+
* If true, truncates overflowing input text with an ellipsis.
|
|
44
|
+
*
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
truncate?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Max number of characters to allow.
|
|
50
|
+
*/
|
|
51
|
+
maxLength?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Name attribute of the inner `input` element.
|
|
54
|
+
*/
|
|
55
|
+
name?: string;
|
|
56
|
+
/**
|
|
57
|
+
* `id` of the inner `input` element.
|
|
58
|
+
*/
|
|
59
|
+
id?: string;
|
|
60
|
+
/**
|
|
61
|
+
* If true, the inner input is marked as required.
|
|
62
|
+
*/
|
|
63
|
+
required?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Additional props for the inner `Input`. Do not pass `value`,
|
|
66
|
+
* `placeholder`, `isDisabled`, `isReadOnly`, `onFocus`, `onBlur`,
|
|
67
|
+
* `onChange`, `id`, `name`, `type`, `maxLength`, or `required` here;
|
|
68
|
+
* use the TextField-level props above.
|
|
69
|
+
*/
|
|
70
|
+
inputProps?: TextFieldInputProps;
|
|
71
|
+
/**
|
|
72
|
+
* Ref to the inner `input` element. The component `ref` targets the
|
|
73
|
+
* root `div`.
|
|
74
|
+
*/
|
|
75
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
76
|
+
/**
|
|
77
|
+
* Called when the inner input value changes.
|
|
78
|
+
*/
|
|
79
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
80
|
+
/**
|
|
81
|
+
* Called when the inner input receives focus.
|
|
82
|
+
*/
|
|
83
|
+
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
84
|
+
/**
|
|
85
|
+
* Called when the inner input loses focus.
|
|
86
|
+
*/
|
|
87
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
88
|
+
/**
|
|
89
|
+
* Called when the root container is clicked. Focuses the inner input.
|
|
90
|
+
*/
|
|
91
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
|
|
92
|
+
/**
|
|
93
|
+
* Optional additional CSS classes for the root container.
|
|
94
|
+
*/
|
|
95
|
+
className?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Optional inline styles for the root container.
|
|
98
|
+
*/
|
|
99
|
+
style?: React.CSSProperties;
|
|
100
|
+
};
|
|
101
|
+
export {};
|
|
102
|
+
//# sourceMappingURL=TextField.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.types.d.mts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,gDAAgD;AACpF,OAAO,KAAK,EAAE,wBAAwB,EAAE,GAAG,EAAE,cAAc;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,iCAA6B;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E;;;;GAIG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAE/E,KAAK,mBAAmB,GAAG,IAAI,CAC7B,UAAU,EACR,WAAW,GACX,IAAI,GACJ,YAAY,GACZ,YAAY,GACZ,uBAAuB,GACvB,WAAW,GACX,MAAM,GACN,QAAQ,GACR,UAAU,GACV,SAAS,GACT,aAAa,GACb,UAAU,GACV,MAAM,GACN,OAAO,CACV,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,wBAAwB,CAAC,KAAK,CAAC,EAC/B,QAAQ,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAC9C,GACC,oBAAoB,GAAG;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAChE;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC9D;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC7D;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,cAAc,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextField size variants (web-only, ADR-0003).
|
|
3
|
+
*
|
|
4
|
+
* The React Native `TextField` ships a fixed height and intentionally does not
|
|
5
|
+
* expose a size prop, so this const object lives in the web package only.
|
|
6
|
+
*/
|
|
7
|
+
export const TextFieldSize = {
|
|
8
|
+
Sm: 'sm',
|
|
9
|
+
Md: 'md',
|
|
10
|
+
Lg: 'lg',
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Native input `type` attribute values supported by the web TextField
|
|
14
|
+
* (ADR-0003). React Native consumers use `inputProps.keyboardType` /
|
|
15
|
+
* `inputProps.secureTextEntry` instead, so this is web-only.
|
|
16
|
+
*/
|
|
17
|
+
export const TextFieldType = {
|
|
18
|
+
Text: 'text',
|
|
19
|
+
Number: 'number',
|
|
20
|
+
Password: 'password',
|
|
21
|
+
Search: 'search',
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=TextField.types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.types.mjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACA,CAAC;AAGX;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACR,CAAC","sourcesContent":["import type { TextFieldPropsShared } from '@metamask-previews/design-system-shared';\nimport type { ComponentPropsWithoutRef, Ref } from 'react';\n\nimport type { InputProps } from '../Input/Input.types';\n\n/**\n * TextField size variants (web-only, ADR-0003).\n *\n * The React Native `TextField` ships a fixed height and intentionally does not\n * expose a size prop, so this const object lives in the web package only.\n */\nexport const TextFieldSize = {\n Sm: 'sm',\n Md: 'md',\n Lg: 'lg',\n} as const;\nexport type TextFieldSize = (typeof TextFieldSize)[keyof typeof TextFieldSize];\n\n/**\n * Native input `type` attribute values supported by the web TextField\n * (ADR-0003). React Native consumers use `inputProps.keyboardType` /\n * `inputProps.secureTextEntry` instead, so this is web-only.\n */\nexport const TextFieldType = {\n Text: 'text',\n Number: 'number',\n Password: 'password',\n Search: 'search',\n} as const;\nexport type TextFieldType = (typeof TextFieldType)[keyof typeof TextFieldType];\n\ntype TextFieldInputProps = Omit<\n InputProps,\n | 'autoFocus'\n | 'id'\n | 'isDisabled'\n | 'isReadOnly'\n | 'isStateStylesDisabled'\n | 'maxLength'\n | 'name'\n | 'onBlur'\n | 'onChange'\n | 'onFocus'\n | 'placeholder'\n | 'required'\n | 'type'\n | 'value'\n>;\n\nexport type TextFieldProps = Omit<\n ComponentPropsWithoutRef<'div'>,\n 'onBlur' | 'onChange' | 'onFocus' | 'onClick'\n> &\n TextFieldPropsShared & {\n /**\n * The size of the text field. Controls the height.\n *\n * @default TextFieldSize.Md\n */\n size?: TextFieldSize;\n /**\n * The native input `type` attribute.\n *\n * @default TextFieldType.Text\n */\n type?: TextFieldType;\n /**\n * If true, truncates overflowing input text with an ellipsis.\n *\n * @default true\n */\n truncate?: boolean;\n /**\n * Max number of characters to allow.\n */\n maxLength?: number;\n /**\n * Name attribute of the inner `input` element.\n */\n name?: string;\n /**\n * `id` of the inner `input` element.\n */\n id?: string;\n /**\n * If true, the inner input is marked as required.\n */\n required?: boolean;\n /**\n * Additional props for the inner `Input`. Do not pass `value`,\n * `placeholder`, `isDisabled`, `isReadOnly`, `onFocus`, `onBlur`,\n * `onChange`, `id`, `name`, `type`, `maxLength`, or `required` here;\n * use the TextField-level props above.\n */\n inputProps?: TextFieldInputProps;\n /**\n * Ref to the inner `input` element. The component `ref` targets the\n * root `div`.\n */\n inputRef?: Ref<HTMLInputElement>;\n /**\n * Called when the inner input value changes.\n */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\n /**\n * Called when the inner input receives focus.\n */\n onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;\n /**\n * Called when the inner input loses focus.\n */\n onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;\n /**\n * Called when the root container is clicked. Focuses the inner input.\n */\n onClick?: (event: React.MouseEvent<HTMLDivElement>) => void;\n /**\n * Optional additional CSS classes for the root container.\n */\n className?: string;\n /**\n * Optional inline styles for the root container.\n */\n style?: React.CSSProperties;\n };\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextFieldType = exports.TextFieldSize = exports.TextField = void 0;
|
|
4
|
+
var TextField_1 = require("./TextField.cjs");
|
|
5
|
+
Object.defineProperty(exports, "TextField", { enumerable: true, get: function () { return TextField_1.TextField; } });
|
|
6
|
+
var TextField_types_1 = require("./TextField.types.cjs");
|
|
7
|
+
Object.defineProperty(exports, "TextFieldSize", { enumerable: true, get: function () { return TextField_types_1.TextFieldSize; } });
|
|
8
|
+
Object.defineProperty(exports, "TextFieldType", { enumerable: true, get: function () { return TextField_types_1.TextFieldType; } });
|
|
9
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/TextField/index.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAA/B,sGAAA,SAAS,OAAA;AAClB,yDAAiE;AAAxD,gHAAA,aAAa,OAAA;AAAE,gHAAA,aAAa,OAAA","sourcesContent":["export { TextField } from './TextField';\nexport { TextFieldSize, TextFieldType } from './TextField.types';\nexport type { TextFieldProps } from './TextField.types';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,8BAA0B;AACjE,YAAY,EAAE,cAAc,EAAE,8BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,8BAA0B;AACjE,YAAY,EAAE,cAAc,EAAE,8BAA0B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/TextField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,wBAAoB;AACxC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,8BAA0B","sourcesContent":["export { TextField } from './TextField';\nexport { TextFieldSize, TextFieldType } from './TextField.types';\nexport type { TextFieldProps } from './TextField.types';\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Toast = void 0;
|
|
27
|
+
const design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const types_1 = require("../../types/index.cjs");
|
|
30
|
+
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
31
|
+
const BannerBase_1 = require("../BannerBase/index.cjs");
|
|
32
|
+
const Icon_1 = require("../Icon/index.cjs");
|
|
33
|
+
const Toast_constants_1 = require("./Toast.constants.cjs");
|
|
34
|
+
const renderSeverityAccessory = ({ severity, startAccessory, iconProps, }) => {
|
|
35
|
+
if (startAccessory !== null && startAccessory !== undefined) {
|
|
36
|
+
return startAccessory;
|
|
37
|
+
}
|
|
38
|
+
if (!severity || severity === design_system_shared_1.ToastSeverity.Default) {
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
const { name, color } = Toast_constants_1.TOAST_SEVERITY_ICON_MAP[severity];
|
|
42
|
+
return react_1.default.createElement(Icon_1.Icon, { name: name, color: color, size: types_1.IconSize.Lg, ...iconProps });
|
|
43
|
+
};
|
|
44
|
+
exports.Toast = (0, react_1.forwardRef)(({ actionButtonLabel, actionButtonOnClick, actionButtonProps, className, closeButtonProps, iconProps, onClose, severity = design_system_shared_1.ToastSeverity.Default, startAccessory, ...props }, ref) => {
|
|
45
|
+
// Only pass action props through when both the label and handler are set so
|
|
46
|
+
// BannerBase can keep its action button contract simple.
|
|
47
|
+
const resolvedActionProps = actionButtonLabel && actionButtonOnClick
|
|
48
|
+
? {
|
|
49
|
+
actionButtonLabel,
|
|
50
|
+
actionButtonOnClick,
|
|
51
|
+
actionButtonProps: {
|
|
52
|
+
size: design_system_shared_1.ButtonSize.Sm,
|
|
53
|
+
...actionButtonProps,
|
|
54
|
+
},
|
|
55
|
+
}
|
|
56
|
+
: {};
|
|
57
|
+
// Derive the close button config from the Toast API, keeping the button
|
|
58
|
+
// visible whenever the consumer provides dismiss behavior or overrides.
|
|
59
|
+
const resolvedCloseButtonProps = onClose || closeButtonProps
|
|
60
|
+
? {
|
|
61
|
+
ariaLabel: 'Close toast',
|
|
62
|
+
...closeButtonProps,
|
|
63
|
+
}
|
|
64
|
+
: undefined;
|
|
65
|
+
// Toast reuses BannerBase so the web surface stays aligned with the shared
|
|
66
|
+
// banner layout and the React Native Toast API.
|
|
67
|
+
return (react_1.default.createElement(BannerBase_1.BannerBase, { ref: ref, ...resolvedActionProps, ...props, backgroundColor: design_system_shared_1.BoxBackgroundColor.BackgroundSection, borderColor: design_system_shared_1.BoxBorderColor.BorderMuted, borderWidth: 1, className: (0, tw_merge_1.twMerge)('rounded-xl', className), closeButtonProps: resolvedCloseButtonProps, onClose: onClose ? () => onClose() : undefined, startAccessory: renderSeverityAccessory({
|
|
68
|
+
severity,
|
|
69
|
+
startAccessory,
|
|
70
|
+
iconProps,
|
|
71
|
+
}) }));
|
|
72
|
+
});
|
|
73
|
+
exports.Toast.displayName = 'Toast';
|
|
74
|
+
//# sourceMappingURL=Toast.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.cjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kFAKiD;AACjD,+CAA0C;AAE1C,iDAAuC;AACvC,uDAA+C;AAC/C,wDAA2C;AAC3C,4CAA+B;AAE/B,2DAA4D;AAG5D,MAAM,uBAAuB,GAAG,CAAC,EAC/B,QAAQ,EACR,cAAc,EACd,SAAS,GACqD,EAAE,EAAE;IAClE,IAAI,cAAc,KAAK,IAAI,IAAI,cAAc,KAAK,SAAS,EAAE;QAC3D,OAAO,cAAc,CAAC;KACvB;IAED,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,oCAAa,CAAC,OAAO,EAAE;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,yCAAuB,CAAC,QAAQ,CAAC,CAAC;IAE1D,OAAO,8BAAC,WAAI,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,gBAAQ,CAAC,EAAE,KAAM,SAAS,GAAI,CAAC;AAC9E,CAAC,CAAC;AAEW,QAAA,KAAK,GAAG,IAAA,kBAAU,EAC7B,CACE,EACE,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,QAAQ,GAAG,oCAAa,CAAC,OAAO,EAChC,cAAc,EACd,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,4EAA4E;IAC5E,yDAAyD;IACzD,MAAM,mBAAmB,GACvB,iBAAiB,IAAI,mBAAmB;QACtC,CAAC,CAAC;YACE,iBAAiB;YACjB,mBAAmB;YACnB,iBAAiB,EAAE;gBACjB,IAAI,EAAE,iCAAU,CAAC,EAAE;gBACnB,GAAG,iBAAiB;aACrB;SACF;QACH,CAAC,CAAC,EAAE,CAAC;IAET,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,wBAAwB,GAC5B,OAAO,IAAI,gBAAgB;QACzB,CAAC,CAAC;YACE,SAAS,EAAE,aAAa;YACxB,GAAG,gBAAgB;SACpB;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,2EAA2E;IAC3E,gDAAgD;IAChD,OAAO,CACL,8BAAC,uBAAU,IACT,GAAG,EAAE,GAAG,KACJ,mBAAmB,KACnB,KAAK,EACT,eAAe,EAAE,yCAAkB,CAAC,iBAAiB,EACrD,WAAW,EAAE,qCAAc,CAAC,WAAW,EACvC,WAAW,EAAE,CAAC,EACd,SAAS,EAAE,IAAA,kBAAO,EAAC,YAAY,EAAE,SAAS,CAAC,EAC3C,gBAAgB,EAAE,wBAAwB,EAC1C,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,EAC9C,cAAc,EAAE,uBAAuB,CAAC;YACtC,QAAQ;YACR,cAAc;YACd,SAAS;SACV,CAAC,GACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,aAAK,CAAC,WAAW,GAAG,OAAO,CAAC","sourcesContent":["import {\n BoxBackgroundColor,\n BoxBorderColor,\n ButtonSize,\n ToastSeverity,\n} from '@metamask-previews/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { IconSize } from '../../types';\nimport { twMerge } from '../../utils/tw-merge';\nimport { BannerBase } from '../BannerBase';\nimport { Icon } from '../Icon';\n\nimport { TOAST_SEVERITY_ICON_MAP } from './Toast.constants';\nimport type { ToastProps } from './Toast.types';\n\nconst renderSeverityAccessory = ({\n severity,\n startAccessory,\n iconProps,\n}: Pick<ToastProps, 'severity' | 'startAccessory' | 'iconProps'>) => {\n if (startAccessory !== null && startAccessory !== undefined) {\n return startAccessory;\n }\n\n if (!severity || severity === ToastSeverity.Default) {\n return undefined;\n }\n\n const { name, color } = TOAST_SEVERITY_ICON_MAP[severity];\n\n return <Icon name={name} color={color} size={IconSize.Lg} {...iconProps} />;\n};\n\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(\n (\n {\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps,\n className,\n closeButtonProps,\n iconProps,\n onClose,\n severity = ToastSeverity.Default,\n startAccessory,\n ...props\n },\n ref,\n ) => {\n // Only pass action props through when both the label and handler are set so\n // BannerBase can keep its action button contract simple.\n const resolvedActionProps =\n actionButtonLabel && actionButtonOnClick\n ? {\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps: {\n size: ButtonSize.Sm,\n ...actionButtonProps,\n },\n }\n : {};\n\n // Derive the close button config from the Toast API, keeping the button\n // visible whenever the consumer provides dismiss behavior or overrides.\n const resolvedCloseButtonProps =\n onClose || closeButtonProps\n ? {\n ariaLabel: 'Close toast',\n ...closeButtonProps,\n }\n : undefined;\n\n // Toast reuses BannerBase so the web surface stays aligned with the shared\n // banner layout and the React Native Toast API.\n return (\n <BannerBase\n ref={ref}\n {...resolvedActionProps}\n {...props}\n backgroundColor={BoxBackgroundColor.BackgroundSection}\n borderColor={BoxBorderColor.BorderMuted}\n borderWidth={1}\n className={twMerge('rounded-xl', className)}\n closeButtonProps={resolvedCloseButtonProps}\n onClose={onClose ? () => onClose() : undefined}\n startAccessory={renderSeverityAccessory({\n severity,\n startAccessory,\n iconProps,\n })}\n />\n );\n },\n);\n\nToast.displayName = 'Toast';\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TOAST_SEVERITY_ICON_MAP = exports.TOAST_VISIBILITY_DURATION = exports.TOAST_ANIMATION_DURATION = void 0;
|
|
4
|
+
const design_system_shared_1 = require("@metamask-previews/design-system-shared");
|
|
5
|
+
const types_1 = require("../../types/index.cjs");
|
|
6
|
+
var design_system_shared_2 = require("@metamask-previews/design-system-shared");
|
|
7
|
+
Object.defineProperty(exports, "TOAST_ANIMATION_DURATION", { enumerable: true, get: function () { return design_system_shared_2.TOAST_ANIMATION_DURATION; } });
|
|
8
|
+
Object.defineProperty(exports, "TOAST_VISIBILITY_DURATION", { enumerable: true, get: function () { return design_system_shared_2.TOAST_VISIBILITY_DURATION; } });
|
|
9
|
+
// TODO: Replace this map with a web IconAlert component once the shared
|
|
10
|
+
// alert-icon primitive exists in React.
|
|
11
|
+
exports.TOAST_SEVERITY_ICON_MAP = {
|
|
12
|
+
[design_system_shared_1.ToastSeverity.Success]: {
|
|
13
|
+
name: types_1.IconName.Confirmation,
|
|
14
|
+
color: types_1.IconColor.SuccessDefault,
|
|
15
|
+
},
|
|
16
|
+
[design_system_shared_1.ToastSeverity.Warning]: {
|
|
17
|
+
name: types_1.IconName.Danger,
|
|
18
|
+
color: types_1.IconColor.WarningDefault,
|
|
19
|
+
},
|
|
20
|
+
[design_system_shared_1.ToastSeverity.Danger]: {
|
|
21
|
+
name: types_1.IconName.Danger,
|
|
22
|
+
color: types_1.IconColor.ErrorDefault,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Toast.constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.constants.cjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.constants.ts"],"names":[],"mappings":";;;AAAA,kFAAwE;AAExE,iDAAkD;AAElD,gFAGiD;AAF/C,gIAAA,wBAAwB,OAAA;AACxB,iIAAA,yBAAyB,OAAA;AAG3B,wEAAwE;AACxE,wCAAwC;AAC3B,QAAA,uBAAuB,GAAG;IACrC,CAAC,oCAAa,CAAC,OAAO,CAAC,EAAE;QACvB,IAAI,EAAE,gBAAQ,CAAC,YAAY;QAC3B,KAAK,EAAE,iBAAS,CAAC,cAAc;KAChC;IACD,CAAC,oCAAa,CAAC,OAAO,CAAC,EAAE;QACvB,IAAI,EAAE,gBAAQ,CAAC,MAAM;QACrB,KAAK,EAAE,iBAAS,CAAC,cAAc;KAChC;IACD,CAAC,oCAAa,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,EAAE,gBAAQ,CAAC,MAAM;QACrB,KAAK,EAAE,iBAAS,CAAC,YAAY;KAC9B;CACO,CAAC","sourcesContent":["import { ToastSeverity } from '@metamask-previews/design-system-shared';\n\nimport { IconColor, IconName } from '../../types';\n\nexport {\n TOAST_ANIMATION_DURATION,\n TOAST_VISIBILITY_DURATION,\n} from '@metamask-previews/design-system-shared';\n\n// TODO: Replace this map with a web IconAlert component once the shared\n// alert-icon primitive exists in React.\nexport const TOAST_SEVERITY_ICON_MAP = {\n [ToastSeverity.Success]: {\n name: IconName.Confirmation,\n color: IconColor.SuccessDefault,\n },\n [ToastSeverity.Warning]: {\n name: IconName.Danger,\n color: IconColor.WarningDefault,\n },\n [ToastSeverity.Danger]: {\n name: IconName.Danger,\n color: IconColor.ErrorDefault,\n },\n} as const;\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { TOAST_ANIMATION_DURATION, TOAST_VISIBILITY_DURATION, } from "@metamask-previews/design-system-shared";
|
|
2
|
+
export declare const TOAST_SEVERITY_ICON_MAP: {
|
|
3
|
+
readonly success: {
|
|
4
|
+
readonly name: "Confirmation";
|
|
5
|
+
readonly color: "text-success-default";
|
|
6
|
+
};
|
|
7
|
+
readonly warning: {
|
|
8
|
+
readonly name: "Danger";
|
|
9
|
+
readonly color: "text-warning-default";
|
|
10
|
+
};
|
|
11
|
+
readonly danger: {
|
|
12
|
+
readonly name: "Danger";
|
|
13
|
+
readonly color: "text-error-default";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Toast.constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.constants.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.constants.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAC1B,gDAAgD;AAIjD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;CAa1B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { TOAST_ANIMATION_DURATION, TOAST_VISIBILITY_DURATION, } from "@metamask-previews/design-system-shared";
|
|
2
|
+
export declare const TOAST_SEVERITY_ICON_MAP: {
|
|
3
|
+
readonly success: {
|
|
4
|
+
readonly name: "Confirmation";
|
|
5
|
+
readonly color: "text-success-default";
|
|
6
|
+
};
|
|
7
|
+
readonly warning: {
|
|
8
|
+
readonly name: "Danger";
|
|
9
|
+
readonly color: "text-warning-default";
|
|
10
|
+
};
|
|
11
|
+
readonly danger: {
|
|
12
|
+
readonly name: "Danger";
|
|
13
|
+
readonly color: "text-error-default";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Toast.constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.constants.d.mts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.constants.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,wBAAwB,EACxB,yBAAyB,GAC1B,gDAAgD;AAIjD,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;CAa1B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ToastSeverity } from "@metamask-previews/design-system-shared";
|
|
2
|
+
import { IconColor, IconName } from "../../types/index.mjs";
|
|
3
|
+
export { TOAST_ANIMATION_DURATION, TOAST_VISIBILITY_DURATION } from "@metamask-previews/design-system-shared";
|
|
4
|
+
// TODO: Replace this map with a web IconAlert component once the shared
|
|
5
|
+
// alert-icon primitive exists in React.
|
|
6
|
+
export const TOAST_SEVERITY_ICON_MAP = {
|
|
7
|
+
[ToastSeverity.Success]: {
|
|
8
|
+
name: IconName.Confirmation,
|
|
9
|
+
color: IconColor.SuccessDefault,
|
|
10
|
+
},
|
|
11
|
+
[ToastSeverity.Warning]: {
|
|
12
|
+
name: IconName.Danger,
|
|
13
|
+
color: IconColor.WarningDefault,
|
|
14
|
+
},
|
|
15
|
+
[ToastSeverity.Danger]: {
|
|
16
|
+
name: IconName.Danger,
|
|
17
|
+
color: IconColor.ErrorDefault,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Toast.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.constants.mjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,gDAAgD;AAExE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,8BAAoB;AAElD,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EAC1B,gDAAgD;AAEjD,wEAAwE;AACxE,wCAAwC;AACxC,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,IAAI,EAAE,QAAQ,CAAC,YAAY;QAC3B,KAAK,EAAE,SAAS,CAAC,cAAc;KAChC;IACD,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE;QACvB,IAAI,EAAE,QAAQ,CAAC,MAAM;QACrB,KAAK,EAAE,SAAS,CAAC,cAAc;KAChC;IACD,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,EAAE,QAAQ,CAAC,MAAM;QACrB,KAAK,EAAE,SAAS,CAAC,YAAY;KAC9B;CACO,CAAC","sourcesContent":["import { ToastSeverity } from '@metamask-previews/design-system-shared';\n\nimport { IconColor, IconName } from '../../types';\n\nexport {\n TOAST_ANIMATION_DURATION,\n TOAST_VISIBILITY_DURATION,\n} from '@metamask-previews/design-system-shared';\n\n// TODO: Replace this map with a web IconAlert component once the shared\n// alert-icon primitive exists in React.\nexport const TOAST_SEVERITY_ICON_MAP = {\n [ToastSeverity.Success]: {\n name: IconName.Confirmation,\n color: IconColor.SuccessDefault,\n },\n [ToastSeverity.Warning]: {\n name: IconName.Danger,\n color: IconColor.WarningDefault,\n },\n [ToastSeverity.Danger]: {\n name: IconName.Danger,\n color: IconColor.ErrorDefault,\n },\n} as const;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqB,cAAc;AAQ1C,OAAO,KAAK,EAAE,UAAU,EAAE,0BAAsB;AAoBhD,eAAO,MAAM,KAAK,gGA6DjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.mts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqB,cAAc;AAQ1C,OAAO,KAAK,EAAE,UAAU,EAAE,0BAAsB;AAoBhD,eAAO,MAAM,KAAK,gGA6DjB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
import { BoxBackgroundColor, BoxBorderColor, ButtonSize, ToastSeverity } from "@metamask-previews/design-system-shared";
|
|
8
|
+
import $React, { forwardRef } from "react";
|
|
9
|
+
const React = $importDefault($React);
|
|
10
|
+
import { IconSize } from "../../types/index.mjs";
|
|
11
|
+
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
12
|
+
import { BannerBase } from "../BannerBase/index.mjs";
|
|
13
|
+
import { Icon } from "../Icon/index.mjs";
|
|
14
|
+
import { TOAST_SEVERITY_ICON_MAP } from "./Toast.constants.mjs";
|
|
15
|
+
const renderSeverityAccessory = ({ severity, startAccessory, iconProps, }) => {
|
|
16
|
+
if (startAccessory !== null && startAccessory !== undefined) {
|
|
17
|
+
return startAccessory;
|
|
18
|
+
}
|
|
19
|
+
if (!severity || severity === ToastSeverity.Default) {
|
|
20
|
+
return undefined;
|
|
21
|
+
}
|
|
22
|
+
const { name, color } = TOAST_SEVERITY_ICON_MAP[severity];
|
|
23
|
+
return React.createElement(Icon, { name: name, color: color, size: IconSize.Lg, ...iconProps });
|
|
24
|
+
};
|
|
25
|
+
export const Toast = forwardRef(({ actionButtonLabel, actionButtonOnClick, actionButtonProps, className, closeButtonProps, iconProps, onClose, severity = ToastSeverity.Default, startAccessory, ...props }, ref) => {
|
|
26
|
+
// Only pass action props through when both the label and handler are set so
|
|
27
|
+
// BannerBase can keep its action button contract simple.
|
|
28
|
+
const resolvedActionProps = actionButtonLabel && actionButtonOnClick
|
|
29
|
+
? {
|
|
30
|
+
actionButtonLabel,
|
|
31
|
+
actionButtonOnClick,
|
|
32
|
+
actionButtonProps: {
|
|
33
|
+
size: ButtonSize.Sm,
|
|
34
|
+
...actionButtonProps,
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
: {};
|
|
38
|
+
// Derive the close button config from the Toast API, keeping the button
|
|
39
|
+
// visible whenever the consumer provides dismiss behavior or overrides.
|
|
40
|
+
const resolvedCloseButtonProps = onClose || closeButtonProps
|
|
41
|
+
? {
|
|
42
|
+
ariaLabel: 'Close toast',
|
|
43
|
+
...closeButtonProps,
|
|
44
|
+
}
|
|
45
|
+
: undefined;
|
|
46
|
+
// Toast reuses BannerBase so the web surface stays aligned with the shared
|
|
47
|
+
// banner layout and the React Native Toast API.
|
|
48
|
+
return (React.createElement(BannerBase, { ref: ref, ...resolvedActionProps, ...props, backgroundColor: BoxBackgroundColor.BackgroundSection, borderColor: BoxBorderColor.BorderMuted, borderWidth: 1, className: twMerge('rounded-xl', className), closeButtonProps: resolvedCloseButtonProps, onClose: onClose ? () => onClose() : undefined, startAccessory: renderSeverityAccessory({
|
|
49
|
+
severity,
|
|
50
|
+
startAccessory,
|
|
51
|
+
iconProps,
|
|
52
|
+
}) }));
|
|
53
|
+
});
|
|
54
|
+
Toast.displayName = 'Toast';
|
|
55
|
+
//# sourceMappingURL=Toast.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.mjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,aAAa,EACd,gDAAgD;AACjD,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,QAAQ,EAAE,8BAAoB;AACvC,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAE/B,OAAO,EAAE,uBAAuB,EAAE,8BAA0B;AAG5D,MAAM,uBAAuB,GAAG,CAAC,EAC/B,QAAQ,EACR,cAAc,EACd,SAAS,GACqD,EAAE,EAAE;IAClE,IAAI,cAAc,KAAK,IAAI,IAAI,cAAc,KAAK,SAAS,EAAE;QAC3D,OAAO,cAAc,CAAC;KACvB;IAED,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,aAAa,CAAC,OAAO,EAAE;QACnD,OAAO,SAAS,CAAC;KAClB;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAE1D,OAAO,oBAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,KAAM,SAAS,GAAI,CAAC;AAC9E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG,UAAU,CAC7B,CACE,EACE,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,QAAQ,GAAG,aAAa,CAAC,OAAO,EAChC,cAAc,EACd,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,4EAA4E;IAC5E,yDAAyD;IACzD,MAAM,mBAAmB,GACvB,iBAAiB,IAAI,mBAAmB;QACtC,CAAC,CAAC;YACE,iBAAiB;YACjB,mBAAmB;YACnB,iBAAiB,EAAE;gBACjB,IAAI,EAAE,UAAU,CAAC,EAAE;gBACnB,GAAG,iBAAiB;aACrB;SACF;QACH,CAAC,CAAC,EAAE,CAAC;IAET,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,wBAAwB,GAC5B,OAAO,IAAI,gBAAgB;QACzB,CAAC,CAAC;YACE,SAAS,EAAE,aAAa;YACxB,GAAG,gBAAgB;SACpB;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,2EAA2E;IAC3E,gDAAgD;IAChD,OAAO,CACL,oBAAC,UAAU,IACT,GAAG,EAAE,GAAG,KACJ,mBAAmB,KACnB,KAAK,EACT,eAAe,EAAE,kBAAkB,CAAC,iBAAiB,EACrD,WAAW,EAAE,cAAc,CAAC,WAAW,EACvC,WAAW,EAAE,CAAC,EACd,SAAS,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,CAAC,EAC3C,gBAAgB,EAAE,wBAAwB,EAC1C,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,EAC9C,cAAc,EAAE,uBAAuB,CAAC;YACtC,QAAQ;YACR,cAAc;YACd,SAAS;SACV,CAAC,GACF,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC","sourcesContent":["import {\n BoxBackgroundColor,\n BoxBorderColor,\n ButtonSize,\n ToastSeverity,\n} from '@metamask-previews/design-system-shared';\nimport React, { forwardRef } from 'react';\n\nimport { IconSize } from '../../types';\nimport { twMerge } from '../../utils/tw-merge';\nimport { BannerBase } from '../BannerBase';\nimport { Icon } from '../Icon';\n\nimport { TOAST_SEVERITY_ICON_MAP } from './Toast.constants';\nimport type { ToastProps } from './Toast.types';\n\nconst renderSeverityAccessory = ({\n severity,\n startAccessory,\n iconProps,\n}: Pick<ToastProps, 'severity' | 'startAccessory' | 'iconProps'>) => {\n if (startAccessory !== null && startAccessory !== undefined) {\n return startAccessory;\n }\n\n if (!severity || severity === ToastSeverity.Default) {\n return undefined;\n }\n\n const { name, color } = TOAST_SEVERITY_ICON_MAP[severity];\n\n return <Icon name={name} color={color} size={IconSize.Lg} {...iconProps} />;\n};\n\nexport const Toast = forwardRef<HTMLDivElement, ToastProps>(\n (\n {\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps,\n className,\n closeButtonProps,\n iconProps,\n onClose,\n severity = ToastSeverity.Default,\n startAccessory,\n ...props\n },\n ref,\n ) => {\n // Only pass action props through when both the label and handler are set so\n // BannerBase can keep its action button contract simple.\n const resolvedActionProps =\n actionButtonLabel && actionButtonOnClick\n ? {\n actionButtonLabel,\n actionButtonOnClick,\n actionButtonProps: {\n size: ButtonSize.Sm,\n ...actionButtonProps,\n },\n }\n : {};\n\n // Derive the close button config from the Toast API, keeping the button\n // visible whenever the consumer provides dismiss behavior or overrides.\n const resolvedCloseButtonProps =\n onClose || closeButtonProps\n ? {\n ariaLabel: 'Close toast',\n ...closeButtonProps,\n }\n : undefined;\n\n // Toast reuses BannerBase so the web surface stays aligned with the shared\n // banner layout and the React Native Toast API.\n return (\n <BannerBase\n ref={ref}\n {...resolvedActionProps}\n {...props}\n backgroundColor={BoxBackgroundColor.BackgroundSection}\n borderColor={BoxBorderColor.BorderMuted}\n borderWidth={1}\n className={twMerge('rounded-xl', className)}\n closeButtonProps={resolvedCloseButtonProps}\n onClose={onClose ? () => onClose() : undefined}\n startAccessory={renderSeverityAccessory({\n severity,\n startAccessory,\n iconProps,\n })}\n />\n );\n },\n);\n\nToast.displayName = 'Toast';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.cjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ToastPropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { BannerBaseProps } from '../BannerBase';\nimport type { IconProps } from '../Icon';\n\ntype ToastCloseButtonProps = Omit<\n NonNullable<BannerBaseProps['closeButtonProps']>,\n 'onClick'\n>;\n\n/**\n * Props for the Toast visual component.\n * Extends the platform BannerBase props with severity and an icon override.\n * `onClose` is simplified to `() => void` (no MouseEvent) to align with the\n * React Native API and the imperative `toast()` pattern.\n */\nexport type ToastProps = Omit<BannerBaseProps, 'closeButtonProps' | 'onClose'> &\n ToastPropsShared & {\n /**\n * Optional handler called when the close button is pressed.\n * When provided, a close button is shown.\n */\n onClose?: () => void;\n /**\n * Optional props passed to the severity `Icon`.\n * Only used when `severity` is not `Default` and `startAccessory` is not provided.\n */\n iconProps?: Omit<IconProps, 'name' | 'color'>;\n /**\n * Optional props for the close `ButtonIcon`.\n * `ariaLabel` defaults to `'Close toast'`.\n */\n closeButtonProps?: ToastCloseButtonProps;\n /**\n * Optional test identifier forwarded to the root Toast element.\n */\n 'data-testid'?: string;\n };\n\n/**\n * Options passed to the imperative `toast(...)` API.\n */\nexport type ToastOptions = ToastProps & {\n /**\n * When true the toast stays visible until explicitly dismissed.\n * Defaults to false.\n */\n hasNoTimeout?: boolean;\n};\n\n/**\n * Imperative handle exposed by `<Toaster ref={...} />`.\n */\nexport type ToasterRef = {\n showToast: (options: ToastOptions) => void;\n closeToast: () => void;\n};\n\n/**\n * Props for the `<Toaster />` container component.\n */\nexport type ToasterProps = {\n /**\n * Optional extra CSS classes applied to the fixed outer container.\n */\n className?: string;\n} & Omit<React.HTMLAttributes<HTMLDivElement>, 'style'>;\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ToastPropsShared } from "@metamask-previews/design-system-shared";
|
|
3
|
+
import type { BannerBaseProps } from "../BannerBase/index.cjs";
|
|
4
|
+
import type { IconProps } from "../Icon/index.cjs";
|
|
5
|
+
type ToastCloseButtonProps = Omit<NonNullable<BannerBaseProps['closeButtonProps']>, 'onClick'>;
|
|
6
|
+
/**
|
|
7
|
+
* Props for the Toast visual component.
|
|
8
|
+
* Extends the platform BannerBase props with severity and an icon override.
|
|
9
|
+
* `onClose` is simplified to `() => void` (no MouseEvent) to align with the
|
|
10
|
+
* React Native API and the imperative `toast()` pattern.
|
|
11
|
+
*/
|
|
12
|
+
export type ToastProps = Omit<BannerBaseProps, 'closeButtonProps' | 'onClose'> & ToastPropsShared & {
|
|
13
|
+
/**
|
|
14
|
+
* Optional handler called when the close button is pressed.
|
|
15
|
+
* When provided, a close button is shown.
|
|
16
|
+
*/
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Optional props passed to the severity `Icon`.
|
|
20
|
+
* Only used when `severity` is not `Default` and `startAccessory` is not provided.
|
|
21
|
+
*/
|
|
22
|
+
iconProps?: Omit<IconProps, 'name' | 'color'>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional props for the close `ButtonIcon`.
|
|
25
|
+
* `ariaLabel` defaults to `'Close toast'`.
|
|
26
|
+
*/
|
|
27
|
+
closeButtonProps?: ToastCloseButtonProps;
|
|
28
|
+
/**
|
|
29
|
+
* Optional test identifier forwarded to the root Toast element.
|
|
30
|
+
*/
|
|
31
|
+
'data-testid'?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Options passed to the imperative `toast(...)` API.
|
|
35
|
+
*/
|
|
36
|
+
export type ToastOptions = ToastProps & {
|
|
37
|
+
/**
|
|
38
|
+
* When true the toast stays visible until explicitly dismissed.
|
|
39
|
+
* Defaults to false.
|
|
40
|
+
*/
|
|
41
|
+
hasNoTimeout?: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Imperative handle exposed by `<Toaster ref={...} />`.
|
|
45
|
+
*/
|
|
46
|
+
export type ToasterRef = {
|
|
47
|
+
showToast: (options: ToastOptions) => void;
|
|
48
|
+
closeToast: () => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Props for the `<Toaster />` container component.
|
|
52
|
+
*/
|
|
53
|
+
export type ToasterProps = {
|
|
54
|
+
/**
|
|
55
|
+
* Optional extra CSS classes applied to the fixed outer container.
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'style'>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=Toast.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.d.cts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gDAAgD;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC,KAAK,qBAAqB,GAAG,IAAI,CAC/B,WAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,EAChD,SAAS,CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,kBAAkB,GAAG,SAAS,CAAC,GAC5E,gBAAgB,GAAG;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IAC9C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IACzC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG;IACtC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ToastPropsShared } from "@metamask-previews/design-system-shared";
|
|
3
|
+
import type { BannerBaseProps } from "../BannerBase/index.mjs";
|
|
4
|
+
import type { IconProps } from "../Icon/index.mjs";
|
|
5
|
+
type ToastCloseButtonProps = Omit<NonNullable<BannerBaseProps['closeButtonProps']>, 'onClick'>;
|
|
6
|
+
/**
|
|
7
|
+
* Props for the Toast visual component.
|
|
8
|
+
* Extends the platform BannerBase props with severity and an icon override.
|
|
9
|
+
* `onClose` is simplified to `() => void` (no MouseEvent) to align with the
|
|
10
|
+
* React Native API and the imperative `toast()` pattern.
|
|
11
|
+
*/
|
|
12
|
+
export type ToastProps = Omit<BannerBaseProps, 'closeButtonProps' | 'onClose'> & ToastPropsShared & {
|
|
13
|
+
/**
|
|
14
|
+
* Optional handler called when the close button is pressed.
|
|
15
|
+
* When provided, a close button is shown.
|
|
16
|
+
*/
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* Optional props passed to the severity `Icon`.
|
|
20
|
+
* Only used when `severity` is not `Default` and `startAccessory` is not provided.
|
|
21
|
+
*/
|
|
22
|
+
iconProps?: Omit<IconProps, 'name' | 'color'>;
|
|
23
|
+
/**
|
|
24
|
+
* Optional props for the close `ButtonIcon`.
|
|
25
|
+
* `ariaLabel` defaults to `'Close toast'`.
|
|
26
|
+
*/
|
|
27
|
+
closeButtonProps?: ToastCloseButtonProps;
|
|
28
|
+
/**
|
|
29
|
+
* Optional test identifier forwarded to the root Toast element.
|
|
30
|
+
*/
|
|
31
|
+
'data-testid'?: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Options passed to the imperative `toast(...)` API.
|
|
35
|
+
*/
|
|
36
|
+
export type ToastOptions = ToastProps & {
|
|
37
|
+
/**
|
|
38
|
+
* When true the toast stays visible until explicitly dismissed.
|
|
39
|
+
* Defaults to false.
|
|
40
|
+
*/
|
|
41
|
+
hasNoTimeout?: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Imperative handle exposed by `<Toaster ref={...} />`.
|
|
45
|
+
*/
|
|
46
|
+
export type ToasterRef = {
|
|
47
|
+
showToast: (options: ToastOptions) => void;
|
|
48
|
+
closeToast: () => void;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Props for the `<Toaster />` container component.
|
|
52
|
+
*/
|
|
53
|
+
export type ToasterProps = {
|
|
54
|
+
/**
|
|
55
|
+
* Optional extra CSS classes applied to the fixed outer container.
|
|
56
|
+
*/
|
|
57
|
+
className?: string;
|
|
58
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, 'style'>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=Toast.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.d.mts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gDAAgD;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,gCAAsB;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,0BAAgB;AAEzC,KAAK,qBAAqB,GAAG,IAAI,CAC/B,WAAW,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC,EAChD,SAAS,CACV,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,kBAAkB,GAAG,SAAS,CAAC,GAC5E,gBAAgB,GAAG;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;OAGG;IACH,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;IAC9C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,qBAAqB,CAAC;IACzC;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG;IACtC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.types.mjs","sourceRoot":"","sources":["../../../src/components/Toast/Toast.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ToastPropsShared } from '@metamask-previews/design-system-shared';\n\nimport type { BannerBaseProps } from '../BannerBase';\nimport type { IconProps } from '../Icon';\n\ntype ToastCloseButtonProps = Omit<\n NonNullable<BannerBaseProps['closeButtonProps']>,\n 'onClick'\n>;\n\n/**\n * Props for the Toast visual component.\n * Extends the platform BannerBase props with severity and an icon override.\n * `onClose` is simplified to `() => void` (no MouseEvent) to align with the\n * React Native API and the imperative `toast()` pattern.\n */\nexport type ToastProps = Omit<BannerBaseProps, 'closeButtonProps' | 'onClose'> &\n ToastPropsShared & {\n /**\n * Optional handler called when the close button is pressed.\n * When provided, a close button is shown.\n */\n onClose?: () => void;\n /**\n * Optional props passed to the severity `Icon`.\n * Only used when `severity` is not `Default` and `startAccessory` is not provided.\n */\n iconProps?: Omit<IconProps, 'name' | 'color'>;\n /**\n * Optional props for the close `ButtonIcon`.\n * `ariaLabel` defaults to `'Close toast'`.\n */\n closeButtonProps?: ToastCloseButtonProps;\n /**\n * Optional test identifier forwarded to the root Toast element.\n */\n 'data-testid'?: string;\n };\n\n/**\n * Options passed to the imperative `toast(...)` API.\n */\nexport type ToastOptions = ToastProps & {\n /**\n * When true the toast stays visible until explicitly dismissed.\n * Defaults to false.\n */\n hasNoTimeout?: boolean;\n};\n\n/**\n * Imperative handle exposed by `<Toaster ref={...} />`.\n */\nexport type ToasterRef = {\n showToast: (options: ToastOptions) => void;\n closeToast: () => void;\n};\n\n/**\n * Props for the `<Toaster />` container component.\n */\nexport type ToasterProps = {\n /**\n * Optional extra CSS classes applied to the fixed outer container.\n */\n className?: string;\n} & Omit<React.HTMLAttributes<HTMLDivElement>, 'style'>;\n"]}
|