@metamask/design-system-react 0.24.0 → 0.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/CHANGELOG.md +35 -1
- package/dist/components/AvatarBase/AvatarBase.cjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.cjs.map +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs +1 -1
- package/dist/components/AvatarBase/AvatarBase.mjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.cjs.map +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs +1 -1
- package/dist/components/AvatarFavicon/AvatarFavicon.mjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.constants.cjs +2 -2
- package/dist/components/AvatarIcon/AvatarIcon.constants.cjs.map +1 -1
- package/dist/components/AvatarIcon/AvatarIcon.constants.mjs +2 -2
- package/dist/components/AvatarIcon/AvatarIcon.constants.mjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs +2 -3
- package/dist/components/AvatarNetwork/AvatarNetwork.cjs.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.cts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.d.mts.map +1 -1
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs +2 -3
- package/dist/components/AvatarNetwork/AvatarNetwork.mjs.map +1 -1
- package/dist/components/AvatarNetwork/index.cjs +2 -2
- package/dist/components/AvatarNetwork/index.cjs.map +1 -1
- package/dist/components/AvatarNetwork/index.d.cts +1 -1
- package/dist/components/AvatarNetwork/index.d.cts.map +1 -1
- package/dist/components/AvatarNetwork/index.d.mts +1 -1
- package/dist/components/AvatarNetwork/index.d.mts.map +1 -1
- package/dist/components/AvatarNetwork/index.mjs +1 -1
- package/dist/components/AvatarNetwork/index.mjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.cjs +2 -2
- package/dist/components/AvatarToken/AvatarToken.cjs.map +1 -1
- package/dist/components/AvatarToken/AvatarToken.mjs +2 -2
- package/dist/components/AvatarToken/AvatarToken.mjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.cjs +1 -2
- package/dist/components/BannerAlert/BannerAlert.cjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.cjs +8 -9
- package/dist/components/BannerAlert/BannerAlert.constants.cjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.d.cts +1 -2
- package/dist/components/BannerAlert/BannerAlert.constants.d.cts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.d.mts +1 -2
- package/dist/components/BannerAlert/BannerAlert.constants.d.mts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.constants.mjs +1 -2
- package/dist/components/BannerAlert/BannerAlert.constants.mjs.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.d.cts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.d.mts.map +1 -1
- package/dist/components/BannerAlert/BannerAlert.mjs +1 -2
- package/dist/components/BannerAlert/BannerAlert.mjs.map +1 -1
- package/dist/components/FormTextField/FormTextField.cjs +38 -0
- package/dist/components/FormTextField/FormTextField.cjs.map +1 -0
- package/dist/components/FormTextField/FormTextField.d.cts +4 -0
- package/dist/components/FormTextField/FormTextField.d.cts.map +1 -0
- package/dist/components/FormTextField/FormTextField.d.mts +4 -0
- package/dist/components/FormTextField/FormTextField.d.mts.map +1 -0
- package/dist/components/FormTextField/FormTextField.mjs +19 -0
- package/dist/components/FormTextField/FormTextField.mjs.map +1 -0
- package/dist/components/FormTextField/FormTextField.types.cjs +3 -0
- package/dist/components/FormTextField/FormTextField.types.cjs.map +1 -0
- package/dist/components/FormTextField/FormTextField.types.d.cts +50 -0
- package/dist/components/FormTextField/FormTextField.types.d.cts.map +1 -0
- package/dist/components/FormTextField/FormTextField.types.d.mts +50 -0
- package/dist/components/FormTextField/FormTextField.types.d.mts.map +1 -0
- package/dist/components/FormTextField/FormTextField.types.mjs +2 -0
- package/dist/components/FormTextField/FormTextField.types.mjs.map +1 -0
- package/dist/components/FormTextField/index.cjs +6 -0
- package/dist/components/FormTextField/index.cjs.map +1 -0
- package/dist/components/FormTextField/index.d.cts +3 -0
- package/dist/components/FormTextField/index.d.cts.map +1 -0
- package/dist/components/FormTextField/index.d.mts +3 -0
- package/dist/components/FormTextField/index.d.mts.map +1 -0
- package/dist/components/FormTextField/index.mjs +2 -0
- package/dist/components/FormTextField/index.mjs.map +1 -0
- package/dist/components/Icon/Icon.cjs +2 -2
- package/dist/components/Icon/Icon.cjs.map +1 -1
- package/dist/components/Icon/Icon.constants.cjs +6 -6
- package/dist/components/Icon/Icon.constants.cjs.map +1 -1
- package/dist/components/Icon/Icon.constants.d.cts +1 -1
- package/dist/components/Icon/Icon.constants.d.cts.map +1 -1
- package/dist/components/Icon/Icon.constants.d.mts +1 -1
- package/dist/components/Icon/Icon.constants.d.mts.map +1 -1
- package/dist/components/Icon/Icon.constants.mjs +1 -1
- package/dist/components/Icon/Icon.constants.mjs.map +1 -1
- package/dist/components/Icon/Icon.d.cts.map +1 -1
- package/dist/components/Icon/Icon.d.mts.map +1 -1
- package/dist/components/Icon/Icon.mjs +1 -1
- package/dist/components/Icon/Icon.mjs.map +1 -1
- package/dist/components/Icon/index.cjs +4 -4
- package/dist/components/Icon/index.cjs.map +1 -1
- package/dist/components/Icon/index.d.cts +1 -1
- package/dist/components/Icon/index.d.cts.map +1 -1
- package/dist/components/Icon/index.d.mts +1 -1
- package/dist/components/Icon/index.d.mts.map +1 -1
- package/dist/components/Icon/index.mjs +1 -1
- package/dist/components/Icon/index.mjs.map +1 -1
- package/dist/components/Popover/Popover.cjs +129 -0
- package/dist/components/Popover/Popover.cjs.map +1 -0
- package/dist/components/Popover/Popover.constants.cjs +28 -0
- package/dist/components/Popover/Popover.constants.cjs.map +1 -0
- package/dist/components/Popover/Popover.constants.d.cts +12 -0
- package/dist/components/Popover/Popover.constants.d.cts.map +1 -0
- package/dist/components/Popover/Popover.constants.d.mts +12 -0
- package/dist/components/Popover/Popover.constants.d.mts.map +1 -0
- package/dist/components/Popover/Popover.constants.mjs +25 -0
- package/dist/components/Popover/Popover.constants.mjs.map +1 -0
- package/dist/components/Popover/Popover.d.cts +4 -0
- package/dist/components/Popover/Popover.d.cts.map +1 -0
- package/dist/components/Popover/Popover.d.mts +4 -0
- package/dist/components/Popover/Popover.d.mts.map +1 -0
- package/dist/components/Popover/Popover.mjs +110 -0
- package/dist/components/Popover/Popover.mjs.map +1 -0
- package/dist/components/Popover/Popover.types.cjs +33 -0
- package/dist/components/Popover/Popover.types.cjs.map +1 -0
- package/dist/components/Popover/Popover.types.d.cts +128 -0
- package/dist/components/Popover/Popover.types.d.cts.map +1 -0
- package/dist/components/Popover/Popover.types.d.mts +128 -0
- package/dist/components/Popover/Popover.types.d.mts.map +1 -0
- package/dist/components/Popover/Popover.types.mjs +30 -0
- package/dist/components/Popover/Popover.types.mjs.map +1 -0
- package/dist/components/Popover/index.cjs +9 -0
- package/dist/components/Popover/index.cjs.map +1 -0
- package/dist/components/Popover/index.d.cts +4 -0
- package/dist/components/Popover/index.d.cts.map +1 -0
- package/dist/components/Popover/index.d.mts +4 -0
- package/dist/components/Popover/index.d.mts.map +1 -0
- package/dist/components/Popover/index.mjs +3 -0
- package/dist/components/Popover/index.mjs.map +1 -0
- package/dist/components/Tag/Tag.cjs +51 -0
- package/dist/components/Tag/Tag.cjs.map +1 -0
- package/dist/components/Tag/Tag.constants.cjs +26 -0
- package/dist/components/Tag/Tag.constants.cjs.map +1 -0
- package/dist/components/Tag/Tag.constants.d.cts +5 -0
- package/dist/components/Tag/Tag.constants.d.cts.map +1 -0
- package/dist/components/Tag/Tag.constants.d.mts +5 -0
- package/dist/components/Tag/Tag.constants.d.mts.map +1 -0
- package/dist/components/Tag/Tag.constants.mjs +23 -0
- package/dist/components/Tag/Tag.constants.mjs.map +1 -0
- package/dist/components/Tag/Tag.d.cts +4 -0
- package/dist/components/Tag/Tag.d.cts.map +1 -0
- package/dist/components/Tag/Tag.d.mts +4 -0
- package/dist/components/Tag/Tag.d.mts.map +1 -0
- package/dist/components/Tag/Tag.mjs +32 -0
- package/dist/components/Tag/Tag.mjs.map +1 -0
- package/dist/components/Tag/Tag.types.cjs +3 -0
- package/dist/components/Tag/Tag.types.cjs.map +1 -0
- package/dist/components/Tag/Tag.types.d.cts +31 -0
- package/dist/components/Tag/Tag.types.d.cts.map +1 -0
- package/dist/components/Tag/Tag.types.d.mts +31 -0
- package/dist/components/Tag/Tag.types.d.mts.map +1 -0
- package/dist/components/Tag/Tag.types.mjs +2 -0
- package/dist/components/Tag/Tag.types.mjs.map +1 -0
- package/dist/components/Tag/index.cjs +8 -0
- package/dist/components/Tag/index.cjs.map +1 -0
- package/dist/components/Tag/index.d.cts +4 -0
- package/dist/components/Tag/index.d.cts.map +1 -0
- package/dist/components/Tag/index.d.mts +4 -0
- package/dist/components/Tag/index.d.mts.map +1 -0
- package/dist/components/Tag/index.mjs +3 -0
- package/dist/components/Tag/index.mjs.map +1 -0
- package/dist/components/TextArea/TextArea.cjs +37 -0
- package/dist/components/TextArea/TextArea.cjs.map +1 -0
- package/dist/components/TextArea/TextArea.constants.cjs +35 -0
- package/dist/components/TextArea/TextArea.constants.cjs.map +1 -0
- package/dist/components/TextArea/TextArea.constants.d.cts +28 -0
- package/dist/components/TextArea/TextArea.constants.d.cts.map +1 -0
- package/dist/components/TextArea/TextArea.constants.d.mts +28 -0
- package/dist/components/TextArea/TextArea.constants.d.mts.map +1 -0
- package/dist/components/TextArea/TextArea.constants.mjs +32 -0
- package/dist/components/TextArea/TextArea.constants.mjs.map +1 -0
- package/dist/components/TextArea/TextArea.d.cts +9 -0
- package/dist/components/TextArea/TextArea.d.cts.map +1 -0
- package/dist/components/TextArea/TextArea.d.mts +9 -0
- package/dist/components/TextArea/TextArea.d.mts.map +1 -0
- package/dist/components/TextArea/TextArea.mjs +18 -0
- package/dist/components/TextArea/TextArea.mjs.map +1 -0
- package/dist/components/TextArea/TextArea.types.cjs +3 -0
- package/dist/components/TextArea/TextArea.types.cjs.map +1 -0
- package/dist/components/TextArea/TextArea.types.d.cts +33 -0
- package/dist/components/TextArea/TextArea.types.d.cts.map +1 -0
- package/dist/components/TextArea/TextArea.types.d.mts +33 -0
- package/dist/components/TextArea/TextArea.types.d.mts.map +1 -0
- package/dist/components/TextArea/TextArea.types.mjs +2 -0
- package/dist/components/TextArea/TextArea.types.mjs.map +1 -0
- package/dist/components/TextArea/index.cjs +8 -0
- package/dist/components/TextArea/index.cjs.map +1 -0
- package/dist/components/TextArea/index.d.cts +4 -0
- package/dist/components/TextArea/index.d.cts.map +1 -0
- package/dist/components/TextArea/index.d.mts +4 -0
- package/dist/components/TextArea/index.d.mts.map +1 -0
- package/dist/components/TextArea/index.mjs +3 -0
- package/dist/components/TextArea/index.mjs.map +1 -0
- package/dist/components/TextButton/TextButton.cjs +7 -28
- package/dist/components/TextButton/TextButton.cjs.map +1 -1
- package/dist/components/TextButton/TextButton.d.cts.map +1 -1
- package/dist/components/TextButton/TextButton.d.mts.map +1 -1
- package/dist/components/TextButton/TextButton.mjs +7 -28
- package/dist/components/TextButton/TextButton.mjs.map +1 -1
- package/dist/components/TextButton/TextButton.types.cjs.map +1 -1
- package/dist/components/TextButton/TextButton.types.d.cts +9 -25
- package/dist/components/TextButton/TextButton.types.d.cts.map +1 -1
- package/dist/components/TextButton/TextButton.types.d.mts +9 -25
- package/dist/components/TextButton/TextButton.types.d.mts.map +1 -1
- package/dist/components/TextButton/TextButton.types.mjs.map +1 -1
- package/dist/components/TextButton/index.cjs +1 -3
- package/dist/components/TextButton/index.cjs.map +1 -1
- package/dist/components/TextButton/index.d.cts +0 -1
- package/dist/components/TextButton/index.d.cts.map +1 -1
- package/dist/components/TextButton/index.d.mts +0 -1
- package/dist/components/TextButton/index.d.mts.map +1 -1
- package/dist/components/TextButton/index.mjs +0 -1
- package/dist/components/TextButton/index.mjs.map +1 -1
- package/dist/components/TextFieldSearch/TextFieldSearch.cjs +40 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.cjs.map +1 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts +6 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.d.cts.map +1 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts +6 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.d.mts.map +1 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.mjs +21 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.mjs.map +1 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.cjs +3 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.cjs.map +1 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.d.cts +17 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.d.cts.map +1 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.d.mts +17 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.d.mts.map +1 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.mjs +2 -0
- package/dist/components/TextFieldSearch/TextFieldSearch.types.mjs.map +1 -0
- package/dist/components/TextFieldSearch/index.cjs +6 -0
- package/dist/components/TextFieldSearch/index.cjs.map +1 -0
- package/dist/components/TextFieldSearch/index.d.cts +3 -0
- package/dist/components/TextFieldSearch/index.d.cts.map +1 -0
- package/dist/components/TextFieldSearch/index.d.mts +3 -0
- package/dist/components/TextFieldSearch/index.d.mts.map +1 -0
- package/dist/components/TextFieldSearch/index.mjs +2 -0
- package/dist/components/TextFieldSearch/index.mjs.map +1 -0
- package/dist/components/Toast/Toast.cjs +73 -0
- package/dist/components/Toast/Toast.cjs.map +1 -0
- package/dist/components/Toast/Toast.constants.cjs +24 -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 +19 -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 +54 -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 +210 -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 +191 -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 +21 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +13 -1
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +13 -1
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +7 -1
- package/dist/components/index.mjs.map +1 -1
- package/dist/types/index.cjs +2 -23
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +1 -14
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +1 -14
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +1 -15
- package/dist/types/index.mjs.map +1 -1
- package/package.json +7 -5
- package/dist/components/TextButton/TextButton.constants.cjs +0 -12
- package/dist/components/TextButton/TextButton.constants.cjs.map +0 -1
- package/dist/components/TextButton/TextButton.constants.d.cts +0 -4
- package/dist/components/TextButton/TextButton.constants.d.cts.map +0 -1
- package/dist/components/TextButton/TextButton.constants.d.mts +0 -4
- package/dist/components/TextButton/TextButton.constants.d.mts.map +0 -1
- package/dist/components/TextButton/TextButton.constants.mjs +0 -9
- package/dist/components/TextButton/TextButton.constants.mjs.map +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
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.TextArea = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
29
|
+
const TextArea_constants_1 = require("./TextArea.constants.cjs");
|
|
30
|
+
exports.TextArea = (0, react_1.forwardRef)(({ value, placeholder, autoFocus = false, isDisabled = false, isReadOnly = false, isError = false, onBlur, onChange, onFocus, resize = TextArea_constants_1.TextAreaResize.None, className, ...props }, ref) => {
|
|
31
|
+
const textAreaClassName = (0, tw_merge_1.twMerge)('m-0 block min-h-24 w-full rounded-lg border bg-muted px-4 py-3 text-default outline-none transition-colors', 'text-s-body-md font-regular leading-s-body-md tracking-s-body-md md:text-l-body-md md:leading-l-body-md md:tracking-l-body-md', 'placeholder:text-alternative', TextArea_constants_1.CLASSMAP_TEXTAREA_RESIZE[resize], 'border-muted', isDisabled && 'cursor-not-allowed border-muted opacity-50', !isDisabled && isError && 'border-error-default', !isDisabled &&
|
|
32
|
+
!isError &&
|
|
33
|
+
'focus:border-default read-only:focus:border-muted', className);
|
|
34
|
+
return (react_1.default.createElement("textarea", { ...props, ref: ref, value: value, placeholder: placeholder, className: textAreaClassName, disabled: isDisabled, readOnly: isReadOnly, autoFocus: autoFocus, "aria-invalid": isError || undefined, onChange: onChange, onFocus: onFocus, onBlur: onBlur }));
|
|
35
|
+
});
|
|
36
|
+
exports.TextArea.displayName = 'TextArea';
|
|
37
|
+
//# sourceMappingURL=TextArea.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.cjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,uDAA+C;AAE/C,iEAAgF;AAGnE,QAAA,QAAQ,GAAG,IAAA,kBAAU,EAChC,CACE,EACE,KAAK,EACL,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,GAAG,mCAAc,CAAC,IAAI,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,iBAAiB,GAAG,IAAA,kBAAO,EAC/B,4GAA4G,EAC5G,+HAA+H,EAC/H,8BAA8B,EAC9B,6CAAwB,CAAC,MAAM,CAAC,EAChC,cAAc,EACd,UAAU,IAAI,4CAA4C,EAC1D,CAAC,UAAU,IAAI,OAAO,IAAI,sBAAsB,EAChD,CAAC,UAAU;QACT,CAAC,OAAO;QACR,mDAAmD,EACrD,SAAS,CACV,CAAC;IAEF,OAAO,CACL,+CACM,KAAK,EACT,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,SAAS,kBACN,OAAO,IAAI,SAAS,EAClC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\n\nimport { CLASSMAP_TEXTAREA_RESIZE, TextAreaResize } from './TextArea.constants';\nimport type { TextAreaProps } from './TextArea.types';\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n value,\n placeholder,\n autoFocus = false,\n isDisabled = false,\n isReadOnly = false,\n isError = false,\n onBlur,\n onChange,\n onFocus,\n resize = TextAreaResize.None,\n className,\n ...props\n },\n ref,\n ) => {\n const textAreaClassName = twMerge(\n 'm-0 block min-h-24 w-full rounded-lg border bg-muted px-4 py-3 text-default outline-none transition-colors',\n 'text-s-body-md font-regular leading-s-body-md tracking-s-body-md md:text-l-body-md md:leading-l-body-md md:tracking-l-body-md',\n 'placeholder:text-alternative',\n CLASSMAP_TEXTAREA_RESIZE[resize],\n 'border-muted',\n isDisabled && 'cursor-not-allowed border-muted opacity-50',\n !isDisabled && isError && 'border-error-default',\n !isDisabled &&\n !isError &&\n 'focus:border-default read-only:focus:border-muted',\n className,\n );\n\n return (\n <textarea\n {...props}\n ref={ref}\n value={value}\n placeholder={placeholder}\n className={textAreaClassName}\n disabled={isDisabled}\n readOnly={isReadOnly}\n autoFocus={autoFocus}\n aria-invalid={isError || undefined}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n />\n );\n },\n);\n\nTextArea.displayName = 'TextArea';\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLASSMAP_TEXTAREA_RESIZE = exports.TextAreaResize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* TextAreaResize - resize
|
|
6
|
+
* Controls the resize behavior of the textarea element.
|
|
7
|
+
*/
|
|
8
|
+
exports.TextAreaResize = {
|
|
9
|
+
/**
|
|
10
|
+
* The textarea cannot be resized.
|
|
11
|
+
*/
|
|
12
|
+
None: 'none',
|
|
13
|
+
/**
|
|
14
|
+
* The textarea can be resized both horizontally and vertically.
|
|
15
|
+
*/
|
|
16
|
+
Both: 'both',
|
|
17
|
+
/**
|
|
18
|
+
* The textarea can only be resized horizontally.
|
|
19
|
+
*/
|
|
20
|
+
Horizontal: 'horizontal',
|
|
21
|
+
/**
|
|
22
|
+
* The textarea can only be resized vertically.
|
|
23
|
+
*/
|
|
24
|
+
Vertical: 'vertical',
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Maps TextAreaResize values to Tailwind CSS resize classes.
|
|
28
|
+
*/
|
|
29
|
+
exports.CLASSMAP_TEXTAREA_RESIZE = {
|
|
30
|
+
[exports.TextAreaResize.None]: 'resize-none',
|
|
31
|
+
[exports.TextAreaResize.Both]: 'resize',
|
|
32
|
+
[exports.TextAreaResize.Horizontal]: 'resize-x',
|
|
33
|
+
[exports.TextAreaResize.Vertical]: 'resize-y',
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=TextArea.constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.constants.cjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.constants.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,cAAc,GAAG;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,UAAU,EAAE,YAAY;IACxB;;OAEG;IACH,QAAQ,EAAE,UAAU;CACZ,CAAC;AAIX;;GAEG;AACU,QAAA,wBAAwB,GAAmC;IACtE,CAAC,sBAAc,CAAC,IAAI,CAAC,EAAE,aAAa;IACpC,CAAC,sBAAc,CAAC,IAAI,CAAC,EAAE,QAAQ;IAC/B,CAAC,sBAAc,CAAC,UAAU,CAAC,EAAE,UAAU;IACvC,CAAC,sBAAc,CAAC,QAAQ,CAAC,EAAE,UAAU;CACtC,CAAC","sourcesContent":["/**\n * TextAreaResize - resize\n * Controls the resize behavior of the textarea element.\n */\nexport const TextAreaResize = {\n /**\n * The textarea cannot be resized.\n */\n None: 'none',\n /**\n * The textarea can be resized both horizontally and vertically.\n */\n Both: 'both',\n /**\n * The textarea can only be resized horizontally.\n */\n Horizontal: 'horizontal',\n /**\n * The textarea can only be resized vertically.\n */\n Vertical: 'vertical',\n} as const;\nexport type TextAreaResize =\n (typeof TextAreaResize)[keyof typeof TextAreaResize];\n\n/**\n * Maps TextAreaResize values to Tailwind CSS resize classes.\n */\nexport const CLASSMAP_TEXTAREA_RESIZE: Record<TextAreaResize, string> = {\n [TextAreaResize.None]: 'resize-none',\n [TextAreaResize.Both]: 'resize',\n [TextAreaResize.Horizontal]: 'resize-x',\n [TextAreaResize.Vertical]: 'resize-y',\n};\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextAreaResize - resize
|
|
3
|
+
* Controls the resize behavior of the textarea element.
|
|
4
|
+
*/
|
|
5
|
+
export declare const TextAreaResize: {
|
|
6
|
+
/**
|
|
7
|
+
* The textarea cannot be resized.
|
|
8
|
+
*/
|
|
9
|
+
readonly None: "none";
|
|
10
|
+
/**
|
|
11
|
+
* The textarea can be resized both horizontally and vertically.
|
|
12
|
+
*/
|
|
13
|
+
readonly Both: "both";
|
|
14
|
+
/**
|
|
15
|
+
* The textarea can only be resized horizontally.
|
|
16
|
+
*/
|
|
17
|
+
readonly Horizontal: "horizontal";
|
|
18
|
+
/**
|
|
19
|
+
* The textarea can only be resized vertically.
|
|
20
|
+
*/
|
|
21
|
+
readonly Vertical: "vertical";
|
|
22
|
+
};
|
|
23
|
+
export type TextAreaResize = (typeof TextAreaResize)[keyof typeof TextAreaResize];
|
|
24
|
+
/**
|
|
25
|
+
* Maps TextAreaResize values to Tailwind CSS resize classes.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CLASSMAP_TEXTAREA_RESIZE: Record<TextAreaResize, string>;
|
|
28
|
+
//# sourceMappingURL=TextArea.constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.constants.d.cts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AACX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAKnE,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextAreaResize - resize
|
|
3
|
+
* Controls the resize behavior of the textarea element.
|
|
4
|
+
*/
|
|
5
|
+
export declare const TextAreaResize: {
|
|
6
|
+
/**
|
|
7
|
+
* The textarea cannot be resized.
|
|
8
|
+
*/
|
|
9
|
+
readonly None: "none";
|
|
10
|
+
/**
|
|
11
|
+
* The textarea can be resized both horizontally and vertically.
|
|
12
|
+
*/
|
|
13
|
+
readonly Both: "both";
|
|
14
|
+
/**
|
|
15
|
+
* The textarea can only be resized horizontally.
|
|
16
|
+
*/
|
|
17
|
+
readonly Horizontal: "horizontal";
|
|
18
|
+
/**
|
|
19
|
+
* The textarea can only be resized vertically.
|
|
20
|
+
*/
|
|
21
|
+
readonly Vertical: "vertical";
|
|
22
|
+
};
|
|
23
|
+
export type TextAreaResize = (typeof TextAreaResize)[keyof typeof TextAreaResize];
|
|
24
|
+
/**
|
|
25
|
+
* Maps TextAreaResize values to Tailwind CSS resize classes.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CLASSMAP_TEXTAREA_RESIZE: Record<TextAreaResize, string>;
|
|
28
|
+
//# sourceMappingURL=TextArea.constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.constants.d.mts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;CAEK,CAAC;AACX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEvD;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAKnE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextAreaResize - resize
|
|
3
|
+
* Controls the resize behavior of the textarea element.
|
|
4
|
+
*/
|
|
5
|
+
export const TextAreaResize = {
|
|
6
|
+
/**
|
|
7
|
+
* The textarea cannot be resized.
|
|
8
|
+
*/
|
|
9
|
+
None: 'none',
|
|
10
|
+
/**
|
|
11
|
+
* The textarea can be resized both horizontally and vertically.
|
|
12
|
+
*/
|
|
13
|
+
Both: 'both',
|
|
14
|
+
/**
|
|
15
|
+
* The textarea can only be resized horizontally.
|
|
16
|
+
*/
|
|
17
|
+
Horizontal: 'horizontal',
|
|
18
|
+
/**
|
|
19
|
+
* The textarea can only be resized vertically.
|
|
20
|
+
*/
|
|
21
|
+
Vertical: 'vertical',
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Maps TextAreaResize values to Tailwind CSS resize classes.
|
|
25
|
+
*/
|
|
26
|
+
export const CLASSMAP_TEXTAREA_RESIZE = {
|
|
27
|
+
[TextAreaResize.None]: 'resize-none',
|
|
28
|
+
[TextAreaResize.Both]: 'resize',
|
|
29
|
+
[TextAreaResize.Horizontal]: 'resize-x',
|
|
30
|
+
[TextAreaResize.Vertical]: 'resize-y',
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=TextArea.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.constants.mjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,IAAI,EAAE,MAAM;IACZ;;OAEG;IACH,UAAU,EAAE,YAAY;IACxB;;OAEG;IACH,QAAQ,EAAE,UAAU;CACZ,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAmC;IACtE,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,aAAa;IACpC,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,QAAQ;IAC/B,CAAC,cAAc,CAAC,UAAU,CAAC,EAAE,UAAU;IACvC,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU;CACtC,CAAC","sourcesContent":["/**\n * TextAreaResize - resize\n * Controls the resize behavior of the textarea element.\n */\nexport const TextAreaResize = {\n /**\n * The textarea cannot be resized.\n */\n None: 'none',\n /**\n * The textarea can be resized both horizontally and vertically.\n */\n Both: 'both',\n /**\n * The textarea can only be resized horizontally.\n */\n Horizontal: 'horizontal',\n /**\n * The textarea can only be resized vertically.\n */\n Vertical: 'vertical',\n} as const;\nexport type TextAreaResize =\n (typeof TextAreaResize)[keyof typeof TextAreaResize];\n\n/**\n * Maps TextAreaResize values to Tailwind CSS resize classes.\n */\nexport const CLASSMAP_TEXTAREA_RESIZE: Record<TextAreaResize, string> = {\n [TextAreaResize.None]: 'resize-none',\n [TextAreaResize.Both]: 'resize',\n [TextAreaResize.Horizontal]: 'resize-x',\n [TextAreaResize.Vertical]: 'resize-y',\n};\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextAreaResize } from "./TextArea.constants.cjs";
|
|
3
|
+
export declare const TextArea: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "value" | "disabled" | "placeholder" | "readOnly" | "defaultValue" | "autoFocus" | "onFocus" | "onBlur" | "onChange"> & Omit<import("@metamask/design-system-shared").TextAreaPropsShared, "textVariant"> & {
|
|
4
|
+
resize?: TextAreaResize | undefined;
|
|
5
|
+
onChange?: ((event: React.ChangeEvent<HTMLTextAreaElement, Element>) => void) | undefined;
|
|
6
|
+
onFocus?: ((event: React.FocusEvent<HTMLTextAreaElement, Element>) => void) | undefined;
|
|
7
|
+
onBlur?: ((event: React.FocusEvent<HTMLTextAreaElement, Element>) => void) | undefined;
|
|
8
|
+
} & React.RefAttributes<HTMLTextAreaElement>>;
|
|
9
|
+
//# sourceMappingURL=TextArea.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.d.cts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,cAAc;AAI1C,OAAO,EAA4B,cAAc,EAAE,iCAA6B;AAGhF,eAAO,MAAM,QAAQ;;;;;6CAiDpB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TextAreaResize } from "./TextArea.constants.mjs";
|
|
3
|
+
export declare const TextArea: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement>, "ref">, "value" | "disabled" | "placeholder" | "readOnly" | "defaultValue" | "autoFocus" | "onFocus" | "onBlur" | "onChange"> & Omit<import("@metamask/design-system-shared").TextAreaPropsShared, "textVariant"> & {
|
|
4
|
+
resize?: TextAreaResize | undefined;
|
|
5
|
+
onChange?: ((event: React.ChangeEvent<HTMLTextAreaElement, Element>) => void) | undefined;
|
|
6
|
+
onFocus?: ((event: React.FocusEvent<HTMLTextAreaElement, Element>) => void) | undefined;
|
|
7
|
+
onBlur?: ((event: React.FocusEvent<HTMLTextAreaElement, Element>) => void) | undefined;
|
|
8
|
+
} & React.RefAttributes<HTMLTextAreaElement>>;
|
|
9
|
+
//# sourceMappingURL=TextArea.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.d.mts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,cAAc;AAI1C,OAAO,EAA4B,cAAc,EAAE,iCAA6B;AAGhF,eAAO,MAAM,QAAQ;;;;;6CAiDpB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
import $React, { forwardRef } from "react";
|
|
8
|
+
const React = $importDefault($React);
|
|
9
|
+
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
10
|
+
import { CLASSMAP_TEXTAREA_RESIZE, TextAreaResize } from "./TextArea.constants.mjs";
|
|
11
|
+
export const TextArea = forwardRef(({ value, placeholder, autoFocus = false, isDisabled = false, isReadOnly = false, isError = false, onBlur, onChange, onFocus, resize = TextAreaResize.None, className, ...props }, ref) => {
|
|
12
|
+
const textAreaClassName = twMerge('m-0 block min-h-24 w-full rounded-lg border bg-muted px-4 py-3 text-default outline-none transition-colors', 'text-s-body-md font-regular leading-s-body-md tracking-s-body-md md:text-l-body-md md:leading-l-body-md md:tracking-l-body-md', 'placeholder:text-alternative', CLASSMAP_TEXTAREA_RESIZE[resize], 'border-muted', isDisabled && 'cursor-not-allowed border-muted opacity-50', !isDisabled && isError && 'border-error-default', !isDisabled &&
|
|
13
|
+
!isError &&
|
|
14
|
+
'focus:border-default read-only:focus:border-muted', className);
|
|
15
|
+
return (React.createElement("textarea", { ...props, ref: ref, value: value, placeholder: placeholder, className: textAreaClassName, disabled: isDisabled, readOnly: isReadOnly, autoFocus: autoFocus, "aria-invalid": isError || undefined, onChange: onChange, onFocus: onFocus, onBlur: onBlur }));
|
|
16
|
+
});
|
|
17
|
+
TextArea.displayName = 'TextArea';
|
|
18
|
+
//# sourceMappingURL=TextArea.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.mjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAE/C,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,iCAA6B;AAGhF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAChC,CACE,EACE,KAAK,EACL,WAAW,EACX,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,KAAK,EAClB,UAAU,GAAG,KAAK,EAClB,OAAO,GAAG,KAAK,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,MAAM,GAAG,cAAc,CAAC,IAAI,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,iBAAiB,GAAG,OAAO,CAC/B,4GAA4G,EAC5G,+HAA+H,EAC/H,8BAA8B,EAC9B,wBAAwB,CAAC,MAAM,CAAC,EAChC,cAAc,EACd,UAAU,IAAI,4CAA4C,EAC1D,CAAC,UAAU,IAAI,OAAO,IAAI,sBAAsB,EAChD,CAAC,UAAU;QACT,CAAC,OAAO;QACR,mDAAmD,EACrD,SAAS,CACV,CAAC;IAEF,OAAO,CACL,qCACM,KAAK,EACT,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,iBAAiB,EAC5B,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,SAAS,kBACN,OAAO,IAAI,SAAS,EAClC,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\n\nimport { CLASSMAP_TEXTAREA_RESIZE, TextAreaResize } from './TextArea.constants';\nimport type { TextAreaProps } from './TextArea.types';\n\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(\n (\n {\n value,\n placeholder,\n autoFocus = false,\n isDisabled = false,\n isReadOnly = false,\n isError = false,\n onBlur,\n onChange,\n onFocus,\n resize = TextAreaResize.None,\n className,\n ...props\n },\n ref,\n ) => {\n const textAreaClassName = twMerge(\n 'm-0 block min-h-24 w-full rounded-lg border bg-muted px-4 py-3 text-default outline-none transition-colors',\n 'text-s-body-md font-regular leading-s-body-md tracking-s-body-md md:text-l-body-md md:leading-l-body-md md:tracking-l-body-md',\n 'placeholder:text-alternative',\n CLASSMAP_TEXTAREA_RESIZE[resize],\n 'border-muted',\n isDisabled && 'cursor-not-allowed border-muted opacity-50',\n !isDisabled && isError && 'border-error-default',\n !isDisabled &&\n !isError &&\n 'focus:border-default read-only:focus:border-muted',\n className,\n );\n\n return (\n <textarea\n {...props}\n ref={ref}\n value={value}\n placeholder={placeholder}\n className={textAreaClassName}\n disabled={isDisabled}\n readOnly={isReadOnly}\n autoFocus={autoFocus}\n aria-invalid={isError || undefined}\n onChange={onChange}\n onFocus={onFocus}\n onBlur={onBlur}\n />\n );\n },\n);\n\nTextArea.displayName = 'TextArea';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.types.cjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextAreaPropsShared } from '@metamask/design-system-shared';\nimport type { ChangeEvent, ComponentPropsWithoutRef, FocusEvent } from 'react';\n\nimport type { TextAreaResize } from './TextArea.constants';\n\n/**\n * TextArea component props (React platform-specific)\n * Extends shared props from @metamask/design-system-shared with React-specific platform concerns\n */\nexport type TextAreaProps = Omit<\n ComponentPropsWithoutRef<'textarea'>,\n | 'autoFocus'\n | 'defaultValue'\n | 'disabled'\n | 'onBlur'\n | 'onChange'\n | 'onFocus'\n | 'placeholder'\n | 'readOnly'\n | 'value'\n> &\n Omit<TextAreaPropsShared, 'textVariant'> & {\n /**\n * Optional prop to control the resize behavior of the textarea.\n * Possible values:\n * - TextAreaResize.None\n * - TextAreaResize.Both\n * - TextAreaResize.Horizontal\n * - TextAreaResize.Vertical\n *\n * @default TextAreaResize.None\n */\n resize?: TextAreaResize;\n /**\n * Called when the textarea value changes.\n */\n onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;\n /**\n * Called when the textarea receives focus.\n */\n onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n /**\n * Called when the textarea loses focus.\n */\n onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n };\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TextAreaPropsShared } from "@metamask/design-system-shared";
|
|
2
|
+
import type { ChangeEvent, ComponentPropsWithoutRef, FocusEvent } from "react";
|
|
3
|
+
import type { TextAreaResize } from "./TextArea.constants.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* TextArea component props (React platform-specific)
|
|
6
|
+
* Extends shared props from @metamask/design-system-shared with React-specific platform concerns
|
|
7
|
+
*/
|
|
8
|
+
export type TextAreaProps = Omit<ComponentPropsWithoutRef<'textarea'>, 'autoFocus' | 'defaultValue' | 'disabled' | 'onBlur' | 'onChange' | 'onFocus' | 'placeholder' | 'readOnly' | 'value'> & Omit<TextAreaPropsShared, 'textVariant'> & {
|
|
9
|
+
/**
|
|
10
|
+
* Optional prop to control the resize behavior of the textarea.
|
|
11
|
+
* Possible values:
|
|
12
|
+
* - TextAreaResize.None
|
|
13
|
+
* - TextAreaResize.Both
|
|
14
|
+
* - TextAreaResize.Horizontal
|
|
15
|
+
* - TextAreaResize.Vertical
|
|
16
|
+
*
|
|
17
|
+
* @default TextAreaResize.None
|
|
18
|
+
*/
|
|
19
|
+
resize?: TextAreaResize;
|
|
20
|
+
/**
|
|
21
|
+
* Called when the textarea value changes.
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Called when the textarea receives focus.
|
|
26
|
+
*/
|
|
27
|
+
onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Called when the textarea loses focus.
|
|
30
|
+
*/
|
|
31
|
+
onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=TextArea.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.types.d.cts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,uCAAuC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,UAAU,EAAE,cAAc;AAE/E,OAAO,KAAK,EAAE,cAAc,EAAE,iCAA6B;AAE3D;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,wBAAwB,CAAC,UAAU,CAAC,EAClC,WAAW,GACX,cAAc,GACd,UAAU,GACV,QAAQ,GACR,UAAU,GACV,SAAS,GACT,aAAa,GACb,UAAU,GACV,OAAO,CACV,GACC,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,GAAG;IACzC;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC7D;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC3D;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CAC3D,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { TextAreaPropsShared } from "@metamask/design-system-shared";
|
|
2
|
+
import type { ChangeEvent, ComponentPropsWithoutRef, FocusEvent } from "react";
|
|
3
|
+
import type { TextAreaResize } from "./TextArea.constants.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* TextArea component props (React platform-specific)
|
|
6
|
+
* Extends shared props from @metamask/design-system-shared with React-specific platform concerns
|
|
7
|
+
*/
|
|
8
|
+
export type TextAreaProps = Omit<ComponentPropsWithoutRef<'textarea'>, 'autoFocus' | 'defaultValue' | 'disabled' | 'onBlur' | 'onChange' | 'onFocus' | 'placeholder' | 'readOnly' | 'value'> & Omit<TextAreaPropsShared, 'textVariant'> & {
|
|
9
|
+
/**
|
|
10
|
+
* Optional prop to control the resize behavior of the textarea.
|
|
11
|
+
* Possible values:
|
|
12
|
+
* - TextAreaResize.None
|
|
13
|
+
* - TextAreaResize.Both
|
|
14
|
+
* - TextAreaResize.Horizontal
|
|
15
|
+
* - TextAreaResize.Vertical
|
|
16
|
+
*
|
|
17
|
+
* @default TextAreaResize.None
|
|
18
|
+
*/
|
|
19
|
+
resize?: TextAreaResize;
|
|
20
|
+
/**
|
|
21
|
+
* Called when the textarea value changes.
|
|
22
|
+
*/
|
|
23
|
+
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Called when the textarea receives focus.
|
|
26
|
+
*/
|
|
27
|
+
onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;
|
|
28
|
+
/**
|
|
29
|
+
* Called when the textarea loses focus.
|
|
30
|
+
*/
|
|
31
|
+
onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=TextArea.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.types.d.mts","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,uCAAuC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,UAAU,EAAE,cAAc;AAE/E,OAAO,KAAK,EAAE,cAAc,EAAE,iCAA6B;AAE3D;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAC9B,wBAAwB,CAAC,UAAU,CAAC,EAClC,WAAW,GACX,cAAc,GACd,UAAU,GACV,QAAQ,GACR,UAAU,GACV,SAAS,GACT,aAAa,GACb,UAAU,GACV,OAAO,CACV,GACC,IAAI,CAAC,mBAAmB,EAAE,aAAa,CAAC,GAAG;IACzC;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC7D;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;IAC3D;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,mBAAmB,CAAC,KAAK,IAAI,CAAC;CAC3D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea.types.mjs","sourceRoot":"","sources":["../../../src/components/TextArea/TextArea.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextAreaPropsShared } from '@metamask/design-system-shared';\nimport type { ChangeEvent, ComponentPropsWithoutRef, FocusEvent } from 'react';\n\nimport type { TextAreaResize } from './TextArea.constants';\n\n/**\n * TextArea component props (React platform-specific)\n * Extends shared props from @metamask/design-system-shared with React-specific platform concerns\n */\nexport type TextAreaProps = Omit<\n ComponentPropsWithoutRef<'textarea'>,\n | 'autoFocus'\n | 'defaultValue'\n | 'disabled'\n | 'onBlur'\n | 'onChange'\n | 'onFocus'\n | 'placeholder'\n | 'readOnly'\n | 'value'\n> &\n Omit<TextAreaPropsShared, 'textVariant'> & {\n /**\n * Optional prop to control the resize behavior of the textarea.\n * Possible values:\n * - TextAreaResize.None\n * - TextAreaResize.Both\n * - TextAreaResize.Horizontal\n * - TextAreaResize.Vertical\n *\n * @default TextAreaResize.None\n */\n resize?: TextAreaResize;\n /**\n * Called when the textarea value changes.\n */\n onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;\n /**\n * Called when the textarea receives focus.\n */\n onFocus?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n /**\n * Called when the textarea loses focus.\n */\n onBlur?: (event: FocusEvent<HTMLTextAreaElement>) => void;\n };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextArea = exports.TextAreaResize = void 0;
|
|
4
|
+
var TextArea_constants_1 = require("./TextArea.constants.cjs");
|
|
5
|
+
Object.defineProperty(exports, "TextAreaResize", { enumerable: true, get: function () { return TextArea_constants_1.TextAreaResize; } });
|
|
6
|
+
var TextArea_1 = require("./TextArea.cjs");
|
|
7
|
+
Object.defineProperty(exports, "TextArea", { enumerable: true, get: function () { return TextArea_1.TextArea; } });
|
|
8
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/TextArea/index.ts"],"names":[],"mappings":";;;AAAA,+DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,2CAAsC;AAA7B,oGAAA,QAAQ,OAAA","sourcesContent":["export { TextAreaResize } from './TextArea.constants';\nexport { TextArea } from './TextArea';\nexport type { TextAreaProps } from './TextArea.types';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/TextArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iCAA6B;AACtD,OAAO,EAAE,QAAQ,EAAE,uBAAmB;AACtC,YAAY,EAAE,aAAa,EAAE,6BAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/TextArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iCAA6B;AACtD,OAAO,EAAE,QAAQ,EAAE,uBAAmB;AACtC,YAAY,EAAE,aAAa,EAAE,6BAAyB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/TextArea/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iCAA6B;AACtD,OAAO,EAAE,QAAQ,EAAE,uBAAmB","sourcesContent":["export { TextAreaResize } from './TextArea.constants';\nexport { TextArea } from './TextArea';\nexport type { TextAreaProps } from './TextArea.types';\n"]}
|
|
@@ -24,36 +24,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.TextButton = void 0;
|
|
27
|
+
const design_system_shared_1 = require("@metamask/design-system-shared");
|
|
28
|
+
const react_slot_1 = require("@radix-ui/react-slot");
|
|
27
29
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const types_1 = require("../../types/index.cjs");
|
|
29
30
|
const tw_merge_1 = require("../../utils/tw-merge.cjs");
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
'h-auto rounded-none bg-transparent px-0', 'transform-none transition-none active:scale-100',
|
|
36
|
-
// Default text button styles
|
|
37
|
-
!isInverse && 'text-primary-default',
|
|
38
|
-
// Inverse styles
|
|
39
|
-
isInverse && 'text-primary-inverse',
|
|
40
|
-
// Hover/Active states - only applied when interactive
|
|
41
|
-
!isDisabled && [
|
|
42
|
-
!isInverse && [
|
|
43
|
-
'hover:text-primary-default-hover hover:underline hover:decoration-primary-default-hover hover:decoration-2 hover:underline-offset-4',
|
|
44
|
-
'active:text-primary-default-pressed active:decoration-primary-default-pressed',
|
|
45
|
-
],
|
|
46
|
-
isInverse && [
|
|
47
|
-
'hover:text-primary-inverse hover:underline hover:decoration-primary-inverse hover:decoration-2 hover:underline-offset-4',
|
|
48
|
-
'active:text-primary-inverse active:decoration-primary-inverse',
|
|
49
|
-
],
|
|
50
|
-
],
|
|
51
|
-
// Disabled styles
|
|
52
|
-
isDisabled && ['opacity-50', 'cursor-not-allowed'], className);
|
|
53
|
-
return (react_1.default.createElement(ButtonBase_1.ButtonBase, { ref: ref, className: mergedClassName, isDisabled: isDisabled, textProps: {
|
|
54
|
-
variant: TextButton_constants_1.MAP_TEXTBUTTON_SIZE_TEXTVARIANT[size],
|
|
55
|
-
...textProps,
|
|
56
|
-
}, ...props }));
|
|
31
|
+
const Text_1 = require("../Text/index.cjs");
|
|
32
|
+
exports.TextButton = (0, react_1.forwardRef)(({ children, className, variant = design_system_shared_1.TextVariant.BodyMd, fontWeight = design_system_shared_1.FontWeight.Medium, fontFamily, fontStyle, textTransform, textAlign, overflowWrap, ellipsis, style, onClick, asChild, type = 'button', ...rest }, ref) => {
|
|
33
|
+
const mergedClassName = (0, tw_merge_1.twMerge)('inline cursor-pointer appearance-none border-0 bg-transparent p-0 text-primary-default', 'hover:text-primary-default-hover hover:underline hover:decoration-primary-default-hover hover:decoration-2 hover:underline-offset-4', 'active:text-primary-default-pressed active:decoration-primary-default-pressed', className);
|
|
34
|
+
const textButtonContent = asChild ? (react_1.default.createElement(react_slot_1.Slot, { ref: ref, onClick: onClick, ...rest }, children)) : (react_1.default.createElement("button", { ref: ref, type: type, onClick: onClick, ...rest }, children));
|
|
35
|
+
return (react_1.default.createElement(Text_1.Text, { asChild: true, variant: variant, fontWeight: fontWeight, fontFamily: fontFamily, fontStyle: fontStyle, textTransform: textTransform, textAlign: textAlign, overflowWrap: overflowWrap, ellipsis: ellipsis, color: design_system_shared_1.TextColor.PrimaryDefault, className: mergedClassName, style: style }, textButtonContent));
|
|
57
36
|
});
|
|
58
37
|
exports.TextButton.displayName = 'TextButton';
|
|
59
38
|
//# sourceMappingURL=TextButton.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.cjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA0C;AAE1C,
|
|
1
|
+
{"version":3,"file":"TextButton.cjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAIwC;AACxC,qDAA4C;AAC5C,+CAA0C;AAE1C,uDAA+C;AAC/C,4CAA+B;AAIlB,QAAA,UAAU,GAAG,IAAA,kBAAU,EAClC,CACE,EACE,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,kCAAW,CAAC,MAAM,EAC5B,UAAU,GAAG,iCAAU,CAAC,MAAM,EAC9B,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GAAG,IAAA,kBAAO,EAC7B,wFAAwF,EACxF,qIAAqI,EACrI,+EAA+E,EAC/E,SAAS,CACV,CAAC;IAEF,MAAM,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CAClC,8BAAC,iBAAI,IAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,KAAM,IAAI,IACvC,QAAQ,CACJ,CACR,CAAC,CAAC,CAAC,CACF,0CAAQ,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,KAAM,IAAI,IACrD,QAAQ,CACF,CACV,CAAC;IAEF,OAAO,CACL,8BAAC,WAAI,IACH,OAAO,QACP,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,gCAAS,CAAC,cAAc,EAC/B,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,KAAK,IAEX,iBAAiB,CACb,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,kBAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import {\n FontWeight,\n TextColor,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Text } from '../Text';\n\nimport type { TextButtonProps } from './TextButton.types';\n\nexport const TextButton = forwardRef<HTMLButtonElement, TextButtonProps>(\n (\n {\n children,\n className,\n variant = TextVariant.BodyMd,\n fontWeight = FontWeight.Medium,\n fontFamily,\n fontStyle,\n textTransform,\n textAlign,\n overflowWrap,\n ellipsis,\n style,\n onClick,\n asChild,\n type = 'button',\n ...rest\n },\n ref,\n ) => {\n const mergedClassName = twMerge(\n 'inline cursor-pointer appearance-none border-0 bg-transparent p-0 text-primary-default',\n 'hover:text-primary-default-hover hover:underline hover:decoration-primary-default-hover hover:decoration-2 hover:underline-offset-4',\n 'active:text-primary-default-pressed active:decoration-primary-default-pressed',\n className,\n );\n\n const textButtonContent = asChild ? (\n <Slot ref={ref} onClick={onClick} {...rest}>\n {children}\n </Slot>\n ) : (\n <button ref={ref} type={type} onClick={onClick} {...rest}>\n {children}\n </button>\n );\n\n return (\n <Text\n asChild\n variant={variant}\n fontWeight={fontWeight}\n fontFamily={fontFamily}\n fontStyle={fontStyle}\n textTransform={textTransform}\n textAlign={textAlign}\n overflowWrap={overflowWrap}\n ellipsis={ellipsis}\n color={TextColor.PrimaryDefault}\n className={mergedClassName}\n style={style}\n >\n {textButtonContent}\n </Text>\n );\n },\n);\n\nTextButton.displayName = 'TextButton';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.d.cts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextButton.d.cts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqB,cAAc;AAK1C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,wGAyDtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.d.mts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextButton.d.mts","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAqB,cAAc;AAK1C,OAAO,KAAK,EAAE,eAAe,EAAE,+BAA2B;AAE1D,eAAO,MAAM,UAAU,wGAyDtB,CAAC"}
|
|
@@ -4,37 +4,16 @@ function $importDefault(module) {
|
|
|
4
4
|
}
|
|
5
5
|
return module;
|
|
6
6
|
}
|
|
7
|
+
import { FontWeight, TextColor, TextVariant } from "@metamask/design-system-shared";
|
|
8
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
9
|
import $React, { forwardRef } from "react";
|
|
8
10
|
const React = $importDefault($React);
|
|
9
|
-
import { TextButtonSize } from "../../types/index.mjs";
|
|
10
11
|
import { twMerge } from "../../utils/tw-merge.mjs";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
'h-auto rounded-none bg-transparent px-0', 'transform-none transition-none active:scale-100',
|
|
17
|
-
// Default text button styles
|
|
18
|
-
!isInverse && 'text-primary-default',
|
|
19
|
-
// Inverse styles
|
|
20
|
-
isInverse && 'text-primary-inverse',
|
|
21
|
-
// Hover/Active states - only applied when interactive
|
|
22
|
-
!isDisabled && [
|
|
23
|
-
!isInverse && [
|
|
24
|
-
'hover:text-primary-default-hover hover:underline hover:decoration-primary-default-hover hover:decoration-2 hover:underline-offset-4',
|
|
25
|
-
'active:text-primary-default-pressed active:decoration-primary-default-pressed',
|
|
26
|
-
],
|
|
27
|
-
isInverse && [
|
|
28
|
-
'hover:text-primary-inverse hover:underline hover:decoration-primary-inverse hover:decoration-2 hover:underline-offset-4',
|
|
29
|
-
'active:text-primary-inverse active:decoration-primary-inverse',
|
|
30
|
-
],
|
|
31
|
-
],
|
|
32
|
-
// Disabled styles
|
|
33
|
-
isDisabled && ['opacity-50', 'cursor-not-allowed'], className);
|
|
34
|
-
return (React.createElement(ButtonBase, { ref: ref, className: mergedClassName, isDisabled: isDisabled, textProps: {
|
|
35
|
-
variant: MAP_TEXTBUTTON_SIZE_TEXTVARIANT[size],
|
|
36
|
-
...textProps,
|
|
37
|
-
}, ...props }));
|
|
12
|
+
import { Text } from "../Text/index.mjs";
|
|
13
|
+
export const TextButton = forwardRef(({ children, className, variant = TextVariant.BodyMd, fontWeight = FontWeight.Medium, fontFamily, fontStyle, textTransform, textAlign, overflowWrap, ellipsis, style, onClick, asChild, type = 'button', ...rest }, ref) => {
|
|
14
|
+
const mergedClassName = twMerge('inline cursor-pointer appearance-none border-0 bg-transparent p-0 text-primary-default', 'hover:text-primary-default-hover hover:underline hover:decoration-primary-default-hover hover:decoration-2 hover:underline-offset-4', 'active:text-primary-default-pressed active:decoration-primary-default-pressed', className);
|
|
15
|
+
const textButtonContent = asChild ? (React.createElement(Slot, { ref: ref, onClick: onClick, ...rest }, children)) : (React.createElement("button", { ref: ref, type: type, onClick: onClick, ...rest }, children));
|
|
16
|
+
return (React.createElement(Text, { asChild: true, variant: variant, fontWeight: fontWeight, fontFamily: fontFamily, fontStyle: fontStyle, textTransform: textTransform, textAlign: textAlign, overflowWrap: overflowWrap, ellipsis: ellipsis, color: TextColor.PrimaryDefault, className: mergedClassName, style: style }, textButtonContent));
|
|
38
17
|
});
|
|
39
18
|
TextButton.displayName = 'TextButton';
|
|
40
19
|
//# sourceMappingURL=TextButton.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.mjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"TextButton.mjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,WAAW,EACZ,uCAAuC;AACxC,OAAO,EAAE,IAAI,EAAE,6BAA6B;AAC5C,OAAO,QAAO,EAAE,UAAU,EAAE,cAAc;;AAE1C,OAAO,EAAE,OAAO,EAAE,iCAA6B;AAC/C,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAI/B,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,WAAW,CAAC,MAAM,EAC5B,UAAU,GAAG,UAAU,CAAC,MAAM,EAC9B,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,OAAO,EACP,IAAI,GAAG,QAAQ,EACf,GAAG,IAAI,EACR,EACD,GAAG,EACH,EAAE;IACF,MAAM,eAAe,GAAG,OAAO,CAC7B,wFAAwF,EACxF,qIAAqI,EACrI,+EAA+E,EAC/E,SAAS,CACV,CAAC;IAEF,MAAM,iBAAiB,GAAG,OAAO,CAAC,CAAC,CAAC,CAClC,oBAAC,IAAI,IAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,KAAM,IAAI,IACvC,QAAQ,CACJ,CACR,CAAC,CAAC,CAAC,CACF,gCAAQ,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,KAAM,IAAI,IACrD,QAAQ,CACF,CACV,CAAC;IAEF,OAAO,CACL,oBAAC,IAAI,IACH,OAAO,QACP,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,YAAY,EAAE,YAAY,EAC1B,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,SAAS,CAAC,cAAc,EAC/B,SAAS,EAAE,eAAe,EAC1B,KAAK,EAAE,KAAK,IAEX,iBAAiB,CACb,CACR,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC","sourcesContent":["import {\n FontWeight,\n TextColor,\n TextVariant,\n} from '@metamask/design-system-shared';\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { forwardRef } from 'react';\n\nimport { twMerge } from '../../utils/tw-merge';\nimport { Text } from '../Text';\n\nimport type { TextButtonProps } from './TextButton.types';\n\nexport const TextButton = forwardRef<HTMLButtonElement, TextButtonProps>(\n (\n {\n children,\n className,\n variant = TextVariant.BodyMd,\n fontWeight = FontWeight.Medium,\n fontFamily,\n fontStyle,\n textTransform,\n textAlign,\n overflowWrap,\n ellipsis,\n style,\n onClick,\n asChild,\n type = 'button',\n ...rest\n },\n ref,\n ) => {\n const mergedClassName = twMerge(\n 'inline cursor-pointer appearance-none border-0 bg-transparent p-0 text-primary-default',\n 'hover:text-primary-default-hover hover:underline hover:decoration-primary-default-hover hover:decoration-2 hover:underline-offset-4',\n 'active:text-primary-default-pressed active:decoration-primary-default-pressed',\n className,\n );\n\n const textButtonContent = asChild ? (\n <Slot ref={ref} onClick={onClick} {...rest}>\n {children}\n </Slot>\n ) : (\n <button ref={ref} type={type} onClick={onClick} {...rest}>\n {children}\n </button>\n );\n\n return (\n <Text\n asChild\n variant={variant}\n fontWeight={fontWeight}\n fontFamily={fontFamily}\n fontStyle={fontStyle}\n textTransform={textTransform}\n textAlign={textAlign}\n overflowWrap={overflowWrap}\n ellipsis={ellipsis}\n color={TextColor.PrimaryDefault}\n className={mergedClassName}\n style={style}\n >\n {textButtonContent}\n </Text>\n );\n },\n);\n\nTextButton.displayName = 'TextButton';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextButton.types.cjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"TextButton.types.cjs","sourceRoot":"","sources":["../../../src/components/TextButton/TextButton.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextButtonPropsShared } from '@metamask/design-system-shared';\nimport type { ComponentProps } from 'react';\n\nimport type { TextProps } from '../Text';\n\nexport type TextButtonProps = TextButtonPropsShared &\n Omit<TextProps, 'asChild' | 'children' | 'color'> &\n Omit<\n ComponentProps<'button'>,\n 'children' | 'color' | 'disabled' | 'onClick'\n > & {\n /**\n * Called when the user clicks the label. Primary interaction for this control.\n */\n onClick?: ComponentProps<'button'>['onClick'];\n /**\n * Optional boolean that determines if the component should merge its props onto its immediate child\n * instead of rendering a button element.\n *\n * @default false\n */\n asChild?: boolean;\n };\n"]}
|