@metamask/design-system-react-native 0.8.0 → 0.10.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 +30 -1
- package/dist/components/ActionListItem/ActionListItem.cjs +86 -0
- package/dist/components/ActionListItem/ActionListItem.cjs.map +1 -0
- package/dist/components/ActionListItem/ActionListItem.d.cts +4 -0
- package/dist/components/ActionListItem/ActionListItem.d.cts.map +1 -0
- package/dist/components/ActionListItem/ActionListItem.d.mts +4 -0
- package/dist/components/ActionListItem/ActionListItem.d.mts.map +1 -0
- package/dist/components/ActionListItem/ActionListItem.mjs +66 -0
- package/dist/components/ActionListItem/ActionListItem.mjs.map +1 -0
- package/dist/components/ActionListItem/ActionListItem.types.cjs +3 -0
- package/dist/components/ActionListItem/ActionListItem.types.cjs.map +1 -0
- package/dist/components/ActionListItem/ActionListItem.types.d.cts +73 -0
- package/dist/components/ActionListItem/ActionListItem.types.d.cts.map +1 -0
- package/dist/components/ActionListItem/ActionListItem.types.d.mts +73 -0
- package/dist/components/ActionListItem/ActionListItem.types.d.mts.map +1 -0
- package/dist/components/ActionListItem/ActionListItem.types.mjs +2 -0
- package/dist/components/ActionListItem/ActionListItem.types.mjs.map +1 -0
- package/dist/components/ActionListItem/index.cjs +6 -0
- package/dist/components/ActionListItem/index.cjs.map +1 -0
- package/dist/components/ActionListItem/index.d.cts +3 -0
- package/dist/components/ActionListItem/index.d.cts.map +1 -0
- package/dist/components/ActionListItem/index.d.mts +3 -0
- package/dist/components/ActionListItem/index.d.mts.map +1 -0
- package/dist/components/ActionListItem/index.mjs +2 -0
- package/dist/components/ActionListItem/index.mjs.map +1 -0
- package/dist/components/BadgeCount/BadgeCount.cjs +3 -3
- package/dist/components/BadgeCount/BadgeCount.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.cjs +6 -10
- package/dist/components/BadgeCount/BadgeCount.constants.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.d.cts +1 -2
- package/dist/components/BadgeCount/BadgeCount.constants.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.d.mts +1 -2
- package/dist/components/BadgeCount/BadgeCount.constants.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.constants.mjs +3 -7
- package/dist/components/BadgeCount/BadgeCount.constants.mjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.mjs +3 -3
- package/dist/components/BadgeCount/BadgeCount.mjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.cjs.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.cts +5 -22
- package/dist/components/BadgeCount/BadgeCount.types.d.cts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.d.mts +5 -22
- package/dist/components/BadgeCount/BadgeCount.types.d.mts.map +1 -1
- package/dist/components/BadgeCount/BadgeCount.types.mjs.map +1 -1
- package/dist/components/BadgeCount/index.cjs +2 -2
- package/dist/components/BadgeCount/index.cjs.map +1 -1
- package/dist/components/BadgeCount/index.d.cts +1 -1
- package/dist/components/BadgeCount/index.d.cts.map +1 -1
- package/dist/components/BadgeCount/index.d.mts +1 -1
- package/dist/components/BadgeCount/index.d.mts.map +1 -1
- package/dist/components/BadgeCount/index.mjs +1 -1
- package/dist/components/BadgeCount/index.mjs.map +1 -1
- package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs +27 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.cjs +15 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.cjs.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.cts +7 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.cts.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.mts +7 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.mts.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.mjs +12 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.mjs.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.d.cts +4 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.d.cts.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.d.mts +4 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.d.mts.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs +27 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.cjs +14 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.cjs.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.cts +50 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.cts.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.mts +50 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.mts.map +1 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.mjs +11 -0
- package/dist/components/BottomSheetHeader/BottomSheetHeader.types.mjs.map +1 -0
- package/dist/components/BottomSheetHeader/index.cjs +8 -0
- package/dist/components/BottomSheetHeader/index.cjs.map +1 -0
- package/dist/components/BottomSheetHeader/index.d.cts +4 -0
- package/dist/components/BottomSheetHeader/index.d.cts.map +1 -0
- package/dist/components/BottomSheetHeader/index.d.mts +4 -0
- package/dist/components/BottomSheetHeader/index.d.mts.map +1 -0
- package/dist/components/BottomSheetHeader/index.mjs +3 -0
- package/dist/components/BottomSheetHeader/index.mjs.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.cjs +37 -0
- package/dist/components/ButtonHero/ButtonHero.cjs.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.d.cts +13 -0
- package/dist/components/ButtonHero/ButtonHero.d.cts.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.d.mts +13 -0
- package/dist/components/ButtonHero/ButtonHero.d.mts.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.mjs +37 -0
- package/dist/components/ButtonHero/ButtonHero.mjs.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.types.cjs +3 -0
- package/dist/components/ButtonHero/ButtonHero.types.cjs.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.types.d.cts +3 -0
- package/dist/components/ButtonHero/ButtonHero.types.d.cts.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.types.d.mts +3 -0
- package/dist/components/ButtonHero/ButtonHero.types.d.mts.map +1 -0
- package/dist/components/ButtonHero/ButtonHero.types.mjs +2 -0
- package/dist/components/ButtonHero/ButtonHero.types.mjs.map +1 -0
- package/dist/components/ButtonHero/index.cjs +8 -0
- package/dist/components/ButtonHero/index.cjs.map +1 -0
- package/dist/components/ButtonHero/index.d.cts +4 -0
- package/dist/components/ButtonHero/index.d.cts.map +1 -0
- package/dist/components/ButtonHero/index.d.mts +4 -0
- package/dist/components/ButtonHero/index.d.mts.map +1 -0
- package/dist/components/ButtonHero/index.mjs +3 -0
- package/dist/components/ButtonHero/index.mjs.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.cjs +64 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.cjs.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.cjs +17 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.cjs.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.d.cts +5 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.d.cts.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.d.mts +5 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.d.mts.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.mjs +14 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.constants.mjs.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.d.cts +4 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.d.cts.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.d.mts +4 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.d.mts.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.mjs +44 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.mjs.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.cjs +18 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.cjs.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.d.cts +30 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.d.cts.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.d.mts +30 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.d.mts.map +1 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.mjs +15 -0
- package/dist/components/ButtonSemantic/ButtonSemantic.types.mjs.map +1 -0
- package/dist/components/ButtonSemantic/index.cjs +8 -0
- package/dist/components/ButtonSemantic/index.cjs.map +1 -0
- package/dist/components/ButtonSemantic/index.d.cts +4 -0
- package/dist/components/ButtonSemantic/index.d.cts.map +1 -0
- package/dist/components/ButtonSemantic/index.d.mts +4 -0
- package/dist/components/ButtonSemantic/index.d.mts.map +1 -0
- package/dist/components/ButtonSemantic/index.mjs +3 -0
- package/dist/components/ButtonSemantic/index.mjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.cjs +17 -8
- package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.constants.cjs +15 -0
- package/dist/components/HeaderBase/HeaderBase.constants.cjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.constants.d.cts +7 -0
- package/dist/components/HeaderBase/HeaderBase.constants.d.cts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.constants.d.mts +7 -0
- package/dist/components/HeaderBase/HeaderBase.constants.d.mts.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.constants.mjs +12 -0
- package/dist/components/HeaderBase/HeaderBase.constants.mjs.map +1 -0
- package/dist/components/HeaderBase/HeaderBase.d.cts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.d.mts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.mjs +18 -9
- package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.cjs +12 -0
- package/dist/components/HeaderBase/HeaderBase.types.cjs.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.cts +16 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.cts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.d.mts +16 -0
- package/dist/components/HeaderBase/HeaderBase.types.d.mts.map +1 -1
- package/dist/components/HeaderBase/HeaderBase.types.mjs +11 -1
- package/dist/components/HeaderBase/HeaderBase.types.mjs.map +1 -1
- package/dist/components/HeaderBase/index.cjs +3 -1
- package/dist/components/HeaderBase/index.cjs.map +1 -1
- package/dist/components/HeaderBase/index.d.cts +1 -0
- package/dist/components/HeaderBase/index.d.cts.map +1 -1
- package/dist/components/HeaderBase/index.d.mts +1 -0
- package/dist/components/HeaderBase/index.d.mts.map +1 -1
- package/dist/components/HeaderBase/index.mjs +1 -0
- package/dist/components/HeaderBase/index.mjs.map +1 -1
- package/dist/components/SensitiveText/SensitiveText.cjs +47 -0
- package/dist/components/SensitiveText/SensitiveText.cjs.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.constants.cjs +14 -0
- package/dist/components/SensitiveText/SensitiveText.constants.cjs.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.constants.d.cts +11 -0
- package/dist/components/SensitiveText/SensitiveText.constants.d.cts.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.constants.d.mts +11 -0
- package/dist/components/SensitiveText/SensitiveText.constants.d.mts.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.constants.mjs +11 -0
- package/dist/components/SensitiveText/SensitiveText.constants.mjs.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.d.cts +4 -0
- package/dist/components/SensitiveText/SensitiveText.d.cts.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.d.mts +4 -0
- package/dist/components/SensitiveText/SensitiveText.d.mts.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.mjs +27 -0
- package/dist/components/SensitiveText/SensitiveText.mjs.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.types.cjs +3 -0
- package/dist/components/SensitiveText/SensitiveText.types.cjs.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.types.d.cts +38 -0
- package/dist/components/SensitiveText/SensitiveText.types.d.cts.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.types.d.mts +38 -0
- package/dist/components/SensitiveText/SensitiveText.types.d.mts.map +1 -0
- package/dist/components/SensitiveText/SensitiveText.types.mjs +2 -0
- package/dist/components/SensitiveText/SensitiveText.types.mjs.map +1 -0
- package/dist/components/SensitiveText/index.cjs +8 -0
- package/dist/components/SensitiveText/index.cjs.map +1 -0
- package/dist/components/SensitiveText/index.d.cts +4 -0
- package/dist/components/SensitiveText/index.d.cts.map +1 -0
- package/dist/components/SensitiveText/index.d.mts +4 -0
- package/dist/components/SensitiveText/index.d.mts.map +1 -0
- package/dist/components/SensitiveText/index.mjs +3 -0
- package/dist/components/SensitiveText/index.mjs.map +1 -0
- package/dist/components/TextField/TextField.cjs +42 -0
- package/dist/components/TextField/TextField.cjs.map +1 -0
- package/dist/components/TextField/TextField.constants.cjs +13 -0
- package/dist/components/TextField/TextField.constants.cjs.map +1 -0
- package/dist/components/TextField/TextField.constants.d.cts +6 -0
- package/dist/components/TextField/TextField.constants.d.cts.map +1 -0
- package/dist/components/TextField/TextField.constants.d.mts +6 -0
- package/dist/components/TextField/TextField.constants.d.mts.map +1 -0
- package/dist/components/TextField/TextField.constants.mjs +10 -0
- package/dist/components/TextField/TextField.constants.mjs.map +1 -0
- package/dist/components/TextField/TextField.d.cts +12 -0
- package/dist/components/TextField/TextField.d.cts.map +1 -0
- package/dist/components/TextField/TextField.d.mts +12 -0
- package/dist/components/TextField/TextField.d.mts.map +1 -0
- package/dist/components/TextField/TextField.mjs +39 -0
- package/dist/components/TextField/TextField.mjs.map +1 -0
- package/dist/components/TextField/TextField.types.cjs +13 -0
- package/dist/components/TextField/TextField.types.cjs.map +1 -0
- package/dist/components/TextField/TextField.types.d.cts +49 -0
- package/dist/components/TextField/TextField.types.d.cts.map +1 -0
- package/dist/components/TextField/TextField.types.d.mts +49 -0
- package/dist/components/TextField/TextField.types.d.mts.map +1 -0
- package/dist/components/TextField/TextField.types.mjs +10 -0
- package/dist/components/TextField/TextField.types.mjs.map +1 -0
- package/dist/components/TextField/index.cjs +8 -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/index.cjs +17 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +11 -1
- package/dist/components/index.d.cts.map +1 -1
- package/dist/components/index.d.mts +11 -1
- package/dist/components/index.d.mts.map +1 -1
- package/dist/components/index.mjs +6 -1
- package/dist/components/index.mjs.map +1 -1
- package/dist/types/index.cjs +2 -16
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +1 -13
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.mts +1 -13
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.mjs +1 -14
- package/dist/types/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensitiveText.d.cts","sourceRoot":"","sources":["../../../src/components/SensitiveText/SensitiveText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,cAAc;AAKvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,kCAA8B;AAOhE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqBtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensitiveText.d.mts","sourceRoot":"","sources":["../../../src/components/SensitiveText/SensitiveText.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,cAAc;AAKvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,kCAA8B;AAOhE,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAqBtD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function $importDefault(module) {
|
|
2
|
+
if (module?.__esModule) {
|
|
3
|
+
return module.default;
|
|
4
|
+
}
|
|
5
|
+
return module;
|
|
6
|
+
}
|
|
7
|
+
import $React, { useMemo } from "react";
|
|
8
|
+
const React = $importDefault($React);
|
|
9
|
+
import { Text } from "../Text/index.mjs";
|
|
10
|
+
import { SensitiveTextLength } from "./SensitiveText.constants.mjs";
|
|
11
|
+
const isValidLength = (value) => {
|
|
12
|
+
const num = Number(value);
|
|
13
|
+
return !Number.isNaN(num) && num > 0;
|
|
14
|
+
};
|
|
15
|
+
export const SensitiveText = ({ isHidden = false, length = SensitiveTextLength.Short, children, ...props }) => {
|
|
16
|
+
const fallback = useMemo(() => {
|
|
17
|
+
let resolvedLength = length;
|
|
18
|
+
if (!(length in SensitiveTextLength) && !isValidLength(length)) {
|
|
19
|
+
console.warn(`Invalid length provided: ${length}. Falling back to Short.`);
|
|
20
|
+
resolvedLength = SensitiveTextLength.Short;
|
|
21
|
+
}
|
|
22
|
+
const numLength = Number(resolvedLength);
|
|
23
|
+
return '•'.repeat(Number.isNaN(numLength) ? 0 : numLength);
|
|
24
|
+
}, [length]);
|
|
25
|
+
return <Text {...props}>{isHidden ? fallback : children}</Text>;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=SensitiveText.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensitiveText.mjs","sourceRoot":"","sources":["../../../src/components/SensitiveText/SensitiveText.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,OAAO,EAAE,cAAc;;AAEvC,OAAO,EAAE,IAAI,EAAE,0BAAgB;AAE/B,OAAO,EAAE,mBAAmB,EAAE,sCAAkC;AAGhE,MAAM,aAAa,GAAG,CAAC,KAAa,EAAW,EAAE;IAC/C,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,mBAAmB,CAAC,KAAK,EAClC,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,EAAE;QAC5B,IAAI,cAAc,GAAG,MAAM,CAAC;QAE5B,IAAI,CAAC,CAAC,MAAM,IAAI,mBAAmB,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;YAC9D,OAAO,CAAC,IAAI,CACV,4BAA4B,MAAM,0BAA0B,CAC7D,CAAC;YACF,cAAc,GAAG,mBAAmB,CAAC,KAAK,CAAC;SAC5C;QAED,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;QACzC,OAAO,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC,CAAC","sourcesContent":["import React, { useMemo } from 'react';\n\nimport { Text } from '../Text';\n\nimport { SensitiveTextLength } from './SensitiveText.constants';\nimport type { SensitiveTextProps } from './SensitiveText.types';\n\nconst isValidLength = (value: string): boolean => {\n const num = Number(value);\n return !Number.isNaN(num) && num > 0;\n};\n\nexport const SensitiveText: React.FC<SensitiveTextProps> = ({\n isHidden = false,\n length = SensitiveTextLength.Short,\n children,\n ...props\n}) => {\n const fallback = useMemo(() => {\n let resolvedLength = length;\n\n if (!(length in SensitiveTextLength) && !isValidLength(length)) {\n console.warn(\n `Invalid length provided: ${length}. Falling back to Short.`,\n );\n resolvedLength = SensitiveTextLength.Short;\n }\n\n const numLength = Number(resolvedLength);\n return '•'.repeat(Number.isNaN(numLength) ? 0 : numLength);\n }, [length]);\n\n return <Text {...props}>{isHidden ? fallback : children}</Text>;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensitiveText.types.cjs","sourceRoot":"","sources":["../../../src/components/SensitiveText/SensitiveText.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextProps } from '../Text/Text.types';\n\nimport type { SensitiveTextLength } from './SensitiveText.constants';\n\n/**\n * Type for SensitiveTextLength values.\n */\nexport type SensitiveTextLengthType =\n (typeof SensitiveTextLength)[keyof typeof SensitiveTextLength];\n\n/**\n * Type for custom length values.\n */\nexport type CustomLength = string;\n\n/**\n * SensitiveText component props.\n *\n * Extends TextProps to inherit all Text component properties\n * including variant, color, fontWeight, twClassName, and standard\n * React Native TextProps such as testID and accessibilityLabel.\n */\nexport type SensitiveTextProps = {\n /**\n * Whether the text content should be hidden.\n * When true, content is replaced with bullet characters.\n *\n * @default false\n */\n isHidden?: boolean;\n /**\n * The number of bullet characters to display when hidden.\n * Can be a predefined SensitiveTextLength or a custom numeric string.\n *\n * @default SensitiveTextLength.Short\n */\n length?: SensitiveTextLengthType | CustomLength;\n /**\n * The text content to display or hide.\n */\n children: React.ReactNode;\n} & TextProps;\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { TextProps } from "../Text/Text.types.cjs";
|
|
2
|
+
import type { SensitiveTextLength } from "./SensitiveText.constants.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* Type for SensitiveTextLength values.
|
|
5
|
+
*/
|
|
6
|
+
export type SensitiveTextLengthType = (typeof SensitiveTextLength)[keyof typeof SensitiveTextLength];
|
|
7
|
+
/**
|
|
8
|
+
* Type for custom length values.
|
|
9
|
+
*/
|
|
10
|
+
export type CustomLength = string;
|
|
11
|
+
/**
|
|
12
|
+
* SensitiveText component props.
|
|
13
|
+
*
|
|
14
|
+
* Extends TextProps to inherit all Text component properties
|
|
15
|
+
* including variant, color, fontWeight, twClassName, and standard
|
|
16
|
+
* React Native TextProps such as testID and accessibilityLabel.
|
|
17
|
+
*/
|
|
18
|
+
export type SensitiveTextProps = {
|
|
19
|
+
/**
|
|
20
|
+
* Whether the text content should be hidden.
|
|
21
|
+
* When true, content is replaced with bullet characters.
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
isHidden?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The number of bullet characters to display when hidden.
|
|
28
|
+
* Can be a predefined SensitiveTextLength or a custom numeric string.
|
|
29
|
+
*
|
|
30
|
+
* @default SensitiveTextLength.Short
|
|
31
|
+
*/
|
|
32
|
+
length?: SensitiveTextLengthType | CustomLength;
|
|
33
|
+
/**
|
|
34
|
+
* The text content to display or hide.
|
|
35
|
+
*/
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
} & TextProps;
|
|
38
|
+
//# sourceMappingURL=SensitiveText.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensitiveText.types.d.cts","sourceRoot":"","sources":["../../../src/components/SensitiveText/SensitiveText.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,sCAAkC;AAErE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,uBAAuB,GAAG,YAAY,CAAC;IAChD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { TextProps } from "../Text/Text.types.mjs";
|
|
2
|
+
import type { SensitiveTextLength } from "./SensitiveText.constants.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Type for SensitiveTextLength values.
|
|
5
|
+
*/
|
|
6
|
+
export type SensitiveTextLengthType = (typeof SensitiveTextLength)[keyof typeof SensitiveTextLength];
|
|
7
|
+
/**
|
|
8
|
+
* Type for custom length values.
|
|
9
|
+
*/
|
|
10
|
+
export type CustomLength = string;
|
|
11
|
+
/**
|
|
12
|
+
* SensitiveText component props.
|
|
13
|
+
*
|
|
14
|
+
* Extends TextProps to inherit all Text component properties
|
|
15
|
+
* including variant, color, fontWeight, twClassName, and standard
|
|
16
|
+
* React Native TextProps such as testID and accessibilityLabel.
|
|
17
|
+
*/
|
|
18
|
+
export type SensitiveTextProps = {
|
|
19
|
+
/**
|
|
20
|
+
* Whether the text content should be hidden.
|
|
21
|
+
* When true, content is replaced with bullet characters.
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
isHidden?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The number of bullet characters to display when hidden.
|
|
28
|
+
* Can be a predefined SensitiveTextLength or a custom numeric string.
|
|
29
|
+
*
|
|
30
|
+
* @default SensitiveTextLength.Short
|
|
31
|
+
*/
|
|
32
|
+
length?: SensitiveTextLengthType | CustomLength;
|
|
33
|
+
/**
|
|
34
|
+
* The text content to display or hide.
|
|
35
|
+
*/
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
} & TextProps;
|
|
38
|
+
//# sourceMappingURL=SensitiveText.types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensitiveText.types.d.mts","sourceRoot":"","sources":["../../../src/components/SensitiveText/SensitiveText.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,sCAAkC;AAErE;;GAEG;AACH,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,uBAAuB,GAAG,YAAY,CAAC;IAChD;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,GAAG,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SensitiveText.types.mjs","sourceRoot":"","sources":["../../../src/components/SensitiveText/SensitiveText.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TextProps } from '../Text/Text.types';\n\nimport type { SensitiveTextLength } from './SensitiveText.constants';\n\n/**\n * Type for SensitiveTextLength values.\n */\nexport type SensitiveTextLengthType =\n (typeof SensitiveTextLength)[keyof typeof SensitiveTextLength];\n\n/**\n * Type for custom length values.\n */\nexport type CustomLength = string;\n\n/**\n * SensitiveText component props.\n *\n * Extends TextProps to inherit all Text component properties\n * including variant, color, fontWeight, twClassName, and standard\n * React Native TextProps such as testID and accessibilityLabel.\n */\nexport type SensitiveTextProps = {\n /**\n * Whether the text content should be hidden.\n * When true, content is replaced with bullet characters.\n *\n * @default false\n */\n isHidden?: boolean;\n /**\n * The number of bullet characters to display when hidden.\n * Can be a predefined SensitiveTextLength or a custom numeric string.\n *\n * @default SensitiveTextLength.Short\n */\n length?: SensitiveTextLengthType | CustomLength;\n /**\n * The text content to display or hide.\n */\n children: React.ReactNode;\n} & TextProps;\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SensitiveTextLength = exports.SensitiveText = void 0;
|
|
4
|
+
var SensitiveText_1 = require("./SensitiveText.cjs");
|
|
5
|
+
Object.defineProperty(exports, "SensitiveText", { enumerable: true, get: function () { return SensitiveText_1.SensitiveText; } });
|
|
6
|
+
var SensitiveText_constants_1 = require("./SensitiveText.constants.cjs");
|
|
7
|
+
Object.defineProperty(exports, "SensitiveTextLength", { enumerable: true, get: function () { return SensitiveText_constants_1.SensitiveTextLength; } });
|
|
8
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/components/SensitiveText/index.ts"],"names":[],"mappings":";;;AAAA,qDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,yEAAgE;AAAvD,8HAAA,mBAAmB,OAAA","sourcesContent":["export { SensitiveText } from './SensitiveText';\nexport { SensitiveTextLength } from './SensitiveText.constants';\nexport type { SensitiveTextProps } from './SensitiveText.types';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/SensitiveText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAChD,OAAO,EAAE,mBAAmB,EAAE,sCAAkC;AAChE,YAAY,EAAE,kBAAkB,EAAE,kCAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/components/SensitiveText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAChD,OAAO,EAAE,mBAAmB,EAAE,sCAAkC;AAChE,YAAY,EAAE,kBAAkB,EAAE,kCAA8B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/components/SensitiveText/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,4BAAwB;AAChD,OAAO,EAAE,mBAAmB,EAAE,sCAAkC","sourcesContent":["export { SensitiveText } from './SensitiveText';\nexport { SensitiveTextLength } from './SensitiveText.constants';\nexport type { SensitiveTextProps } from './SensitiveText.types';\n"]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextField = void 0;
|
|
4
|
+
const design_system_twrnc_preset_1 = require("@metamask/design-system-twrnc-preset");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_native_1 = require("react-native/index.js");
|
|
7
|
+
const types_1 = require("../../types/index.cjs");
|
|
8
|
+
const Input_1 = require("../Input/index.cjs");
|
|
9
|
+
const TextField_constants_1 = require("./TextField.constants.cjs");
|
|
10
|
+
const TextField_types_1 = require("./TextField.types.cjs");
|
|
11
|
+
exports.TextField = (0, react_1.forwardRef)(({ style, size = TextField_types_1.TextFieldSize.Md, startAccessory, endAccessory, isError = false, inputElement, isDisabled = false, autoFocus = false, twClassName, onBlur, onFocus, testID, ...props }, ref) => {
|
|
12
|
+
const [isFocused, setIsFocused] = (0, react_1.useState)(autoFocus);
|
|
13
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
14
|
+
const tw = (0, design_system_twrnc_preset_1.useTailwind)();
|
|
15
|
+
(0, react_1.useImperativeHandle)(ref, () => inputRef.current, []);
|
|
16
|
+
const containerStyle = (0, react_1.useMemo)(() => tw.style('flex-row', 'items-center', 'rounded-lg', TextField_constants_1.TWCLASSMAP_TEXTFIELD_SIZE[size], 'border', 'px-4', 'bg-default', 'border-default', isError && 'border-error-default', !isDisabled && isFocused && 'border-primary-default', isDisabled && 'opacity-50', twClassName), [size, isError, isFocused, isDisabled, twClassName, tw]);
|
|
17
|
+
const onBlurHandler = (0, react_1.useCallback)((e) => {
|
|
18
|
+
if (!isDisabled) {
|
|
19
|
+
setIsFocused(false);
|
|
20
|
+
onBlur?.(e);
|
|
21
|
+
}
|
|
22
|
+
}, [isDisabled, onBlur]);
|
|
23
|
+
const onFocusHandler = (0, react_1.useCallback)((e) => {
|
|
24
|
+
if (!isDisabled) {
|
|
25
|
+
setIsFocused(true);
|
|
26
|
+
onFocus?.(e);
|
|
27
|
+
}
|
|
28
|
+
}, [isDisabled, onFocus]);
|
|
29
|
+
const onPressHandler = (0, react_1.useCallback)(() => {
|
|
30
|
+
if (!isDisabled && inputRef.current) {
|
|
31
|
+
inputRef.current.focus();
|
|
32
|
+
}
|
|
33
|
+
}, [isDisabled]);
|
|
34
|
+
return (<react_native_1.Pressable testID={testID} style={[containerStyle, style]} onPress={onPressHandler} accessible={false}>
|
|
35
|
+
{startAccessory && (<react_native_1.View style={tw.style('mr-2')}>{startAccessory}</react_native_1.View>)}
|
|
36
|
+
<react_native_1.View style={tw.style('flex-1')}>
|
|
37
|
+
{inputElement ?? (<Input_1.Input {...props} ref={inputRef} textVariant={types_1.TextVariant.BodyMd} isDisabled={isDisabled} autoFocus={autoFocus} onBlur={onBlurHandler} onFocus={onFocusHandler} isStateStylesDisabled twClassName="bg-transparent border-0"/>)}
|
|
38
|
+
</react_native_1.View>
|
|
39
|
+
{endAccessory && <react_native_1.View style={tw.style('ml-2')}>{endAccessory}</react_native_1.View>}
|
|
40
|
+
</react_native_1.Pressable>);
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=TextField.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.cjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"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","sourcesContent":["import { useTailwind } from '@metamask/design-system-twrnc-preset';\nimport {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Pressable, TextInput, View } from 'react-native';\n\nimport { TextVariant } from '../../types';\nimport { Input } from '../Input';\n\nimport { TWCLASSMAP_TEXTFIELD_SIZE } from './TextField.constants';\nimport { TextFieldSize } from './TextField.types';\nimport type { TextFieldProps } from './TextField.types';\n\nexport const TextField = forwardRef<TextInput, TextFieldProps>(\n (\n {\n style,\n size = TextFieldSize.Md,\n startAccessory,\n endAccessory,\n isError = false,\n inputElement,\n isDisabled = false,\n autoFocus = false,\n twClassName,\n onBlur,\n onFocus,\n testID,\n ...props\n },\n ref,\n ) => {\n const [isFocused, setIsFocused] = useState(autoFocus);\n const inputRef = useRef<TextInput>(null);\n const tw = useTailwind();\n\n useImperativeHandle<TextInput | null, TextInput | null>(\n ref,\n () => inputRef.current,\n [],\n );\n\n const containerStyle = useMemo(\n () =>\n tw.style(\n 'flex-row',\n 'items-center',\n 'rounded-lg',\n TWCLASSMAP_TEXTFIELD_SIZE[size],\n 'border',\n 'px-4',\n 'bg-default',\n 'border-default',\n isError && 'border-error-default',\n !isDisabled && isFocused && 'border-primary-default',\n isDisabled && 'opacity-50',\n twClassName,\n ),\n [size, isError, isFocused, isDisabled, twClassName, tw],\n );\n\n const onBlurHandler = useCallback(\n (e: Parameters<NonNullable<TextFieldProps['onBlur']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(false);\n onBlur?.(e);\n }\n },\n [isDisabled, onBlur],\n );\n\n const onFocusHandler = useCallback(\n (e: Parameters<NonNullable<TextFieldProps['onFocus']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(true);\n onFocus?.(e);\n }\n },\n [isDisabled, onFocus],\n );\n\n const onPressHandler = useCallback(() => {\n if (!isDisabled && inputRef.current) {\n inputRef.current.focus();\n }\n }, [isDisabled]);\n\n return (\n <Pressable\n testID={testID}\n style={[containerStyle, style]}\n onPress={onPressHandler}\n accessible={false}\n >\n {startAccessory && (\n <View style={tw.style('mr-2')}>{startAccessory}</View>\n )}\n <View style={tw.style('flex-1')}>\n {inputElement ?? (\n <Input\n {...props}\n ref={inputRef}\n textVariant={TextVariant.BodyMd}\n isDisabled={isDisabled}\n autoFocus={autoFocus}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n isStateStylesDisabled\n twClassName=\"bg-transparent border-0\"\n />\n )}\n </View>\n {endAccessory && <View style={tw.style('ml-2')}>{endAccessory}</View>}\n </Pressable>\n );\n },\n);\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TWCLASSMAP_TEXTFIELD_SIZE = void 0;
|
|
4
|
+
const TextField_types_1 = require("./TextField.types.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Tailwind class map for TextField sizes.
|
|
7
|
+
*/
|
|
8
|
+
exports.TWCLASSMAP_TEXTFIELD_SIZE = {
|
|
9
|
+
[TextField_types_1.TextFieldSize.Sm]: 'h-8',
|
|
10
|
+
[TextField_types_1.TextFieldSize.Md]: 'h-10',
|
|
11
|
+
[TextField_types_1.TextFieldSize.Lg]: 'h-12',
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=TextField.constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.constants.cjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.constants.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAElD;;GAEG;AACU,QAAA,yBAAyB,GAAkC;IACtE,CAAC,+BAAa,CAAC,EAAE,CAAC,EAAE,KAAK;IACzB,CAAC,+BAAa,CAAC,EAAE,CAAC,EAAE,MAAM;IAC1B,CAAC,+BAAa,CAAC,EAAE,CAAC,EAAE,MAAM;CAC3B,CAAC","sourcesContent":["import { TextFieldSize } from './TextField.types';\n\n/**\n * Tailwind class map for TextField sizes.\n */\nexport const TWCLASSMAP_TEXTFIELD_SIZE: Record<TextFieldSize, string> = {\n [TextFieldSize.Sm]: 'h-8',\n [TextFieldSize.Md]: 'h-10',\n [TextFieldSize.Lg]: 'h-12',\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.constants.d.cts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,8BAA0B;AAElD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAInE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.constants.d.mts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,8BAA0B;AAElD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAInE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TextFieldSize } from "./TextField.types.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Tailwind class map for TextField sizes.
|
|
4
|
+
*/
|
|
5
|
+
export const TWCLASSMAP_TEXTFIELD_SIZE = {
|
|
6
|
+
[TextFieldSize.Sm]: 'h-8',
|
|
7
|
+
[TextFieldSize.Md]: 'h-10',
|
|
8
|
+
[TextFieldSize.Lg]: 'h-12',
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=TextField.constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.constants.mjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,8BAA0B;AAElD;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAkC;IACtE,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,KAAK;IACzB,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,MAAM;IAC1B,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,MAAM;CAC3B,CAAC","sourcesContent":["import { TextFieldSize } from './TextField.types';\n\n/**\n * Tailwind class map for TextField sizes.\n */\nexport const TWCLASSMAP_TEXTFIELD_SIZE: Record<TextFieldSize, string> = {\n [TextFieldSize.Sm]: 'h-8',\n [TextFieldSize.Md]: 'h-10',\n [TextFieldSize.Lg]: 'h-12',\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TextInput } from "react-native/index.js";
|
|
2
|
+
import { TextFieldSize } from "./TextField.types.cjs";
|
|
3
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<Omit<import("../Input/index.cjs").InputProps, "style" | "textVariant" | "isStateStylesDisabled"> & {
|
|
4
|
+
size?: TextFieldSize | undefined;
|
|
5
|
+
startAccessory?: import("react").ReactNode;
|
|
6
|
+
endAccessory?: import("react").ReactNode;
|
|
7
|
+
isError?: boolean | undefined;
|
|
8
|
+
inputElement?: import("react").ReactNode;
|
|
9
|
+
twClassName?: string | undefined;
|
|
10
|
+
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
11
|
+
} & import("react").RefAttributes<TextInput>>;
|
|
12
|
+
//# sourceMappingURL=TextField.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.cts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AASA,OAAO,EAAa,SAAS,EAAQ,8BAAqB;AAM1D,OAAO,EAAE,aAAa,EAAE,8BAA0B;AAGlD,eAAO,MAAM,SAAS;;;;;;;;6CAuGrB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { TextInput } from "react-native/index.js";
|
|
2
|
+
import { TextFieldSize } from "./TextField.types.mjs";
|
|
3
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<Omit<import("../Input/index.mjs").InputProps, "style" | "textVariant" | "isStateStylesDisabled"> & {
|
|
4
|
+
size?: TextFieldSize | undefined;
|
|
5
|
+
startAccessory?: import("react").ReactNode;
|
|
6
|
+
endAccessory?: import("react").ReactNode;
|
|
7
|
+
isError?: boolean | undefined;
|
|
8
|
+
inputElement?: import("react").ReactNode;
|
|
9
|
+
twClassName?: string | undefined;
|
|
10
|
+
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
11
|
+
} & import("react").RefAttributes<TextInput>>;
|
|
12
|
+
//# sourceMappingURL=TextField.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.d.mts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AASA,OAAO,EAAa,SAAS,EAAQ,8BAAqB;AAM1D,OAAO,EAAE,aAAa,EAAE,8BAA0B;AAGlD,eAAO,MAAM,SAAS;;;;;;;;6CAuGrB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useTailwind } from "@metamask/design-system-twrnc-preset";
|
|
2
|
+
import { forwardRef, useCallback, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { Pressable, TextInput, View } from "react-native/index.js";
|
|
4
|
+
import { TextVariant } from "../../types/index.mjs";
|
|
5
|
+
import { Input } from "../Input/index.mjs";
|
|
6
|
+
import { TWCLASSMAP_TEXTFIELD_SIZE } from "./TextField.constants.mjs";
|
|
7
|
+
import { TextFieldSize } from "./TextField.types.mjs";
|
|
8
|
+
export const TextField = forwardRef(({ style, size = TextFieldSize.Md, startAccessory, endAccessory, isError = false, inputElement, isDisabled = false, autoFocus = false, twClassName, onBlur, onFocus, testID, ...props }, ref) => {
|
|
9
|
+
const [isFocused, setIsFocused] = useState(autoFocus);
|
|
10
|
+
const inputRef = useRef(null);
|
|
11
|
+
const tw = useTailwind();
|
|
12
|
+
useImperativeHandle(ref, () => inputRef.current, []);
|
|
13
|
+
const containerStyle = useMemo(() => tw.style('flex-row', 'items-center', 'rounded-lg', TWCLASSMAP_TEXTFIELD_SIZE[size], 'border', 'px-4', 'bg-default', 'border-default', isError && 'border-error-default', !isDisabled && isFocused && 'border-primary-default', isDisabled && 'opacity-50', twClassName), [size, isError, isFocused, isDisabled, twClassName, tw]);
|
|
14
|
+
const onBlurHandler = useCallback((e) => {
|
|
15
|
+
if (!isDisabled) {
|
|
16
|
+
setIsFocused(false);
|
|
17
|
+
onBlur?.(e);
|
|
18
|
+
}
|
|
19
|
+
}, [isDisabled, onBlur]);
|
|
20
|
+
const onFocusHandler = useCallback((e) => {
|
|
21
|
+
if (!isDisabled) {
|
|
22
|
+
setIsFocused(true);
|
|
23
|
+
onFocus?.(e);
|
|
24
|
+
}
|
|
25
|
+
}, [isDisabled, onFocus]);
|
|
26
|
+
const onPressHandler = useCallback(() => {
|
|
27
|
+
if (!isDisabled && inputRef.current) {
|
|
28
|
+
inputRef.current.focus();
|
|
29
|
+
}
|
|
30
|
+
}, [isDisabled]);
|
|
31
|
+
return (<Pressable testID={testID} style={[containerStyle, style]} onPress={onPressHandler} accessible={false}>
|
|
32
|
+
{startAccessory && (<View style={tw.style('mr-2')}>{startAccessory}</View>)}
|
|
33
|
+
<View style={tw.style('flex-1')}>
|
|
34
|
+
{inputElement ?? (<Input {...props} ref={inputRef} textVariant={TextVariant.BodyMd} isDisabled={isDisabled} autoFocus={autoFocus} onBlur={onBlurHandler} onFocus={onFocusHandler} isStateStylesDisabled twClassName="bg-transparent border-0"/>)}
|
|
35
|
+
</View>
|
|
36
|
+
{endAccessory && <View style={tw.style('ml-2')}>{endAccessory}</View>}
|
|
37
|
+
</Pressable>);
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=TextField.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.mjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,6CAA6C;AACnE,OAAO,EACL,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,MAAM,EACN,QAAQ,EACT,cAAc;AACf,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,8BAAqB;AAE1D,OAAO,EAAE,WAAW,EAAE,8BAAoB;AAC1C,OAAO,EAAE,KAAK,EAAE,2BAAiB;AAEjC,OAAO,EAAE,yBAAyB,EAAE,kCAA8B;AAClE,OAAO,EAAE,aAAa,EAAE,8BAA0B;AAGlD,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CACjC,CACE,EACE,KAAK,EACL,IAAI,GAAG,aAAa,CAAC,EAAE,EACvB,cAAc,EACd,YAAY,EACZ,OAAO,GAAG,KAAK,EACf,YAAY,EACZ,UAAU,GAAG,KAAK,EAClB,SAAS,GAAG,KAAK,EACjB,WAAW,EACX,MAAM,EACN,OAAO,EACP,MAAM,EACN,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,MAAM,CAAY,IAAI,CAAC,CAAC;IACzC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,mBAAmB,CACjB,GAAG,EACH,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EACtB,EAAE,CACH,CAAC;IAEF,MAAM,cAAc,GAAG,OAAO,CAC5B,GAAG,EAAE,CACH,EAAE,CAAC,KAAK,CACN,UAAU,EACV,cAAc,EACd,YAAY,EACZ,yBAAyB,CAAC,IAAI,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,OAAO,IAAI,sBAAsB,EACjC,CAAC,UAAU,IAAI,SAAS,IAAI,wBAAwB,EACpD,UAAU,IAAI,YAAY,EAC1B,WAAW,CACZ,EACH,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,CAAC,CACxD,CAAC;IAEF,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,CAAuD,EAAE,EAAE;QAC1D,IAAI,CAAC,UAAU,EAAE;YACf,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;SACb;IACH,CAAC,EACD,CAAC,UAAU,EAAE,MAAM,CAAC,CACrB,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,CAAwD,EAAE,EAAE;QAC3D,IAAI,CAAC,UAAU,EAAE;YACf,YAAY,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;SACd;IACH,CAAC,EACD,CAAC,UAAU,EAAE,OAAO,CAAC,CACtB,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE;QACtC,IAAI,CAAC,UAAU,IAAI,QAAQ,CAAC,OAAO,EAAE;YACnC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;SAC1B;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,OAAO,CACL,CAAC,SAAS,CACR,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,CAC/B,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,UAAU,CAAC,CAAC,KAAK,CAAC,CAElB;QAAA,CAAC,cAAc,IAAI,CACjB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CACvD,CACD;QAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAC9B;UAAA,CAAC,YAAY,IAAI,CACf,CAAC,KAAK,CACJ,IAAI,KAAK,CAAC,CACV,GAAG,CAAC,CAAC,QAAQ,CAAC,CACd,WAAW,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAChC,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,SAAS,CAAC,CAAC,SAAS,CAAC,CACrB,MAAM,CAAC,CAAC,aAAa,CAAC,CACtB,OAAO,CAAC,CAAC,cAAc,CAAC,CACxB,qBAAqB,CACrB,WAAW,CAAC,yBAAyB,EACrC,CACH,CACH;QAAA,EAAE,IAAI,CACN;QAAA,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,CACvE;MAAA,EAAE,SAAS,CAAC,CACb,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { useTailwind } from '@metamask/design-system-twrnc-preset';\nimport {\n forwardRef,\n useCallback,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Pressable, TextInput, View } from 'react-native';\n\nimport { TextVariant } from '../../types';\nimport { Input } from '../Input';\n\nimport { TWCLASSMAP_TEXTFIELD_SIZE } from './TextField.constants';\nimport { TextFieldSize } from './TextField.types';\nimport type { TextFieldProps } from './TextField.types';\n\nexport const TextField = forwardRef<TextInput, TextFieldProps>(\n (\n {\n style,\n size = TextFieldSize.Md,\n startAccessory,\n endAccessory,\n isError = false,\n inputElement,\n isDisabled = false,\n autoFocus = false,\n twClassName,\n onBlur,\n onFocus,\n testID,\n ...props\n },\n ref,\n ) => {\n const [isFocused, setIsFocused] = useState(autoFocus);\n const inputRef = useRef<TextInput>(null);\n const tw = useTailwind();\n\n useImperativeHandle<TextInput | null, TextInput | null>(\n ref,\n () => inputRef.current,\n [],\n );\n\n const containerStyle = useMemo(\n () =>\n tw.style(\n 'flex-row',\n 'items-center',\n 'rounded-lg',\n TWCLASSMAP_TEXTFIELD_SIZE[size],\n 'border',\n 'px-4',\n 'bg-default',\n 'border-default',\n isError && 'border-error-default',\n !isDisabled && isFocused && 'border-primary-default',\n isDisabled && 'opacity-50',\n twClassName,\n ),\n [size, isError, isFocused, isDisabled, twClassName, tw],\n );\n\n const onBlurHandler = useCallback(\n (e: Parameters<NonNullable<TextFieldProps['onBlur']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(false);\n onBlur?.(e);\n }\n },\n [isDisabled, onBlur],\n );\n\n const onFocusHandler = useCallback(\n (e: Parameters<NonNullable<TextFieldProps['onFocus']>>[0]) => {\n if (!isDisabled) {\n setIsFocused(true);\n onFocus?.(e);\n }\n },\n [isDisabled, onFocus],\n );\n\n const onPressHandler = useCallback(() => {\n if (!isDisabled && inputRef.current) {\n inputRef.current.focus();\n }\n }, [isDisabled]);\n\n return (\n <Pressable\n testID={testID}\n style={[containerStyle, style]}\n onPress={onPressHandler}\n accessible={false}\n >\n {startAccessory && (\n <View style={tw.style('mr-2')}>{startAccessory}</View>\n )}\n <View style={tw.style('flex-1')}>\n {inputElement ?? (\n <Input\n {...props}\n ref={inputRef}\n textVariant={TextVariant.BodyMd}\n isDisabled={isDisabled}\n autoFocus={autoFocus}\n onBlur={onBlurHandler}\n onFocus={onFocusHandler}\n isStateStylesDisabled\n twClassName=\"bg-transparent border-0\"\n />\n )}\n </View>\n {endAccessory && <View style={tw.style('ml-2')}>{endAccessory}</View>}\n </Pressable>\n );\n },\n);\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TextFieldSize = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* TextFieldSize enum.
|
|
6
|
+
*/
|
|
7
|
+
var TextFieldSize;
|
|
8
|
+
(function (TextFieldSize) {
|
|
9
|
+
TextFieldSize["Sm"] = "sm";
|
|
10
|
+
TextFieldSize["Md"] = "md";
|
|
11
|
+
TextFieldSize["Lg"] = "lg";
|
|
12
|
+
})(TextFieldSize || (exports.TextFieldSize = TextFieldSize = {}));
|
|
13
|
+
//# sourceMappingURL=TextField.types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.types.cjs","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,0BAAS,CAAA;IACT,0BAAS,CAAA;AACX,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB","sourcesContent":["import type { ReactNode } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport type { InputProps } from '../Input/Input.types';\n\n/**\n * TextFieldSize enum.\n */\nexport enum TextFieldSize {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n}\n\n/**\n * TextField component props.\n */\nexport type TextFieldProps = Omit<\n InputProps,\n 'textVariant' | 'isStateStylesDisabled' | 'style'\n> & {\n /**\n * Optional prop for size of the TextField.\n *\n * @default TextFieldSize.Md\n */\n size?: TextFieldSize;\n /**\n * Optional content to display before the Input.\n */\n startAccessory?: ReactNode;\n /**\n * Optional content to display after the Input.\n */\n endAccessory?: ReactNode;\n /**\n * Optional boolean to show the error state.\n *\n * @default false\n */\n isError?: boolean;\n /**\n * Optional prop to replace the default Input with a custom element.\n */\n inputElement?: ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n /**\n * Optional prop to customize the container style.\n */\n style?: StyleProp<ViewStyle>;\n};\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native/index.js";
|
|
3
|
+
import type { InputProps } from "../Input/Input.types.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* TextFieldSize enum.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum TextFieldSize {
|
|
8
|
+
Sm = "sm",
|
|
9
|
+
Md = "md",
|
|
10
|
+
Lg = "lg"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* TextField component props.
|
|
14
|
+
*/
|
|
15
|
+
export type TextFieldProps = Omit<InputProps, 'textVariant' | 'isStateStylesDisabled' | 'style'> & {
|
|
16
|
+
/**
|
|
17
|
+
* Optional prop for size of the TextField.
|
|
18
|
+
*
|
|
19
|
+
* @default TextFieldSize.Md
|
|
20
|
+
*/
|
|
21
|
+
size?: TextFieldSize;
|
|
22
|
+
/**
|
|
23
|
+
* Optional content to display before the Input.
|
|
24
|
+
*/
|
|
25
|
+
startAccessory?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Optional content to display after the Input.
|
|
28
|
+
*/
|
|
29
|
+
endAccessory?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Optional boolean to show the error state.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
isError?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional prop to replace the default Input with a custom element.
|
|
38
|
+
*/
|
|
39
|
+
inputElement?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Optional prop to add twrnc overriding classNames.
|
|
42
|
+
*/
|
|
43
|
+
twClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional prop to customize the container style.
|
|
46
|
+
*/
|
|
47
|
+
style?: StyleProp<ViewStyle>;
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=TextField.types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextField.types.d.cts","sourceRoot":"","sources":["../../../src/components/TextField/TextField.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,8BAAqB;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,iCAA6B;AAEvD;;GAEG;AACH,oBAAY,aAAa;IACvB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,UAAU,EACV,aAAa,GAAG,uBAAuB,GAAG,OAAO,CAClD,GAAG;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { StyleProp, ViewStyle } from "react-native/index.js";
|
|
3
|
+
import type { InputProps } from "../Input/Input.types.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* TextFieldSize enum.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum TextFieldSize {
|
|
8
|
+
Sm = "sm",
|
|
9
|
+
Md = "md",
|
|
10
|
+
Lg = "lg"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* TextField component props.
|
|
14
|
+
*/
|
|
15
|
+
export type TextFieldProps = Omit<InputProps, 'textVariant' | 'isStateStylesDisabled' | 'style'> & {
|
|
16
|
+
/**
|
|
17
|
+
* Optional prop for size of the TextField.
|
|
18
|
+
*
|
|
19
|
+
* @default TextFieldSize.Md
|
|
20
|
+
*/
|
|
21
|
+
size?: TextFieldSize;
|
|
22
|
+
/**
|
|
23
|
+
* Optional content to display before the Input.
|
|
24
|
+
*/
|
|
25
|
+
startAccessory?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Optional content to display after the Input.
|
|
28
|
+
*/
|
|
29
|
+
endAccessory?: ReactNode;
|
|
30
|
+
/**
|
|
31
|
+
* Optional boolean to show the error state.
|
|
32
|
+
*
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
isError?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Optional prop to replace the default Input with a custom element.
|
|
38
|
+
*/
|
|
39
|
+
inputElement?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Optional prop to add twrnc overriding classNames.
|
|
42
|
+
*/
|
|
43
|
+
twClassName?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Optional prop to customize the container style.
|
|
46
|
+
*/
|
|
47
|
+
style?: StyleProp<ViewStyle>;
|
|
48
|
+
};
|
|
49
|
+
//# 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,SAAS,EAAE,cAAc;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,8BAAqB;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,iCAA6B;AAEvD;;GAEG;AACH,oBAAY,aAAa;IACvB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAC/B,UAAU,EACV,aAAa,GAAG,uBAAuB,GAAG,OAAO,CAClD,GAAG;IACF;;;;OAIG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TextFieldSize enum.
|
|
3
|
+
*/
|
|
4
|
+
export var TextFieldSize;
|
|
5
|
+
(function (TextFieldSize) {
|
|
6
|
+
TextFieldSize["Sm"] = "sm";
|
|
7
|
+
TextFieldSize["Md"] = "md";
|
|
8
|
+
TextFieldSize["Lg"] = "lg";
|
|
9
|
+
})(TextFieldSize || (TextFieldSize = {}));
|
|
10
|
+
//# 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;;GAEG;AACH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,0BAAS,CAAA;IACT,0BAAS,CAAA;AACX,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB","sourcesContent":["import type { ReactNode } from 'react';\nimport type { StyleProp, ViewStyle } from 'react-native';\n\nimport type { InputProps } from '../Input/Input.types';\n\n/**\n * TextFieldSize enum.\n */\nexport enum TextFieldSize {\n Sm = 'sm',\n Md = 'md',\n Lg = 'lg',\n}\n\n/**\n * TextField component props.\n */\nexport type TextFieldProps = Omit<\n InputProps,\n 'textVariant' | 'isStateStylesDisabled' | 'style'\n> & {\n /**\n * Optional prop for size of the TextField.\n *\n * @default TextFieldSize.Md\n */\n size?: TextFieldSize;\n /**\n * Optional content to display before the Input.\n */\n startAccessory?: ReactNode;\n /**\n * Optional content to display after the Input.\n */\n endAccessory?: ReactNode;\n /**\n * Optional boolean to show the error state.\n *\n * @default false\n */\n isError?: boolean;\n /**\n * Optional prop to replace the default Input with a custom element.\n */\n inputElement?: ReactNode;\n /**\n * Optional prop to add twrnc overriding classNames.\n */\n twClassName?: string;\n /**\n * Optional prop to customize the container style.\n */\n style?: StyleProp<ViewStyle>;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
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
|
+
//# 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,yDAAkD;AAAzC,gHAAA,aAAa,OAAA","sourcesContent":["export { TextField } from './TextField';\nexport { TextFieldSize } 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,8BAA0B;AAClD,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,8BAA0B;AAClD,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,8BAA0B","sourcesContent":["export { TextField } from './TextField';\nexport { TextFieldSize } from './TextField.types';\nexport type { TextFieldProps } from './TextField.types';\n"]}
|