@tamagui/input 1.141.5 → 1.143.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/dist/cjs/index.cjs +13 -2
- package/dist/cjs/index.js +9 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +12 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/shared.cjs +9 -2
- package/dist/cjs/shared.js +9 -2
- package/dist/cjs/shared.js.map +1 -1
- package/dist/cjs/shared.native.js +9 -2
- package/dist/cjs/shared.native.js.map +1 -1
- package/dist/cjs/v1/Input.cjs +190 -0
- package/dist/cjs/v1/Input.js +171 -0
- package/dist/cjs/v1/Input.js.map +6 -0
- package/dist/cjs/v1/Input.native.js +138 -0
- package/dist/cjs/v1/Input.native.js.map +1 -0
- package/dist/cjs/v1/TextArea.cjs +50 -0
- package/dist/cjs/v1/TextArea.js +43 -0
- package/dist/cjs/v1/TextArea.js.map +6 -0
- package/dist/cjs/v1/TextArea.native.js +53 -0
- package/dist/cjs/v1/TextArea.native.js.map +1 -0
- package/dist/cjs/v1/index.cjs +19 -0
- package/dist/cjs/v1/index.js +16 -0
- package/dist/cjs/v1/index.js.map +6 -0
- package/dist/cjs/v1/index.native.js +22 -0
- package/dist/cjs/v1/index.native.js.map +1 -0
- package/dist/cjs/v1/types.cjs +16 -0
- package/dist/cjs/v1/types.js +14 -0
- package/dist/cjs/v1/types.js.map +6 -0
- package/dist/cjs/v1/types.native.js +19 -0
- package/dist/cjs/v1/types.native.js.map +1 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +2 -0
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/shared.js +9 -2
- package/dist/esm/shared.js.map +1 -1
- package/dist/esm/shared.mjs +9 -2
- package/dist/esm/shared.mjs.map +1 -1
- package/dist/esm/shared.native.js +9 -2
- package/dist/esm/shared.native.js.map +1 -1
- package/dist/esm/v1/Input.js +151 -0
- package/dist/esm/v1/Input.js.map +6 -0
- package/dist/esm/v1/Input.mjs +156 -0
- package/dist/esm/v1/Input.mjs.map +1 -0
- package/dist/esm/v1/Input.native.js +101 -0
- package/dist/esm/v1/Input.native.js.map +1 -0
- package/dist/esm/v1/TextArea.js +29 -0
- package/dist/esm/v1/TextArea.js.map +6 -0
- package/dist/esm/v1/TextArea.mjs +27 -0
- package/dist/esm/v1/TextArea.mjs.map +1 -0
- package/dist/esm/v1/TextArea.native.js +27 -0
- package/dist/esm/v1/TextArea.native.js.map +1 -0
- package/dist/esm/v1/index.js +3 -0
- package/dist/esm/v1/index.js.map +6 -0
- package/dist/esm/v1/index.mjs +3 -0
- package/dist/esm/v1/index.mjs.map +1 -0
- package/dist/esm/v1/index.native.js +3 -0
- package/dist/esm/v1/index.native.js.map +1 -0
- package/dist/esm/v1/types.js +1 -0
- package/dist/esm/v1/types.js.map +6 -0
- package/dist/esm/v1/types.mjs +2 -0
- package/dist/esm/v1/types.mjs.map +1 -0
- package/dist/esm/v1/types.native.js +2 -0
- package/dist/esm/v1/types.native.js.map +1 -0
- package/dist/jsx/index.js +5 -0
- package/dist/jsx/index.js.map +1 -1
- package/dist/jsx/index.mjs +2 -0
- package/dist/jsx/index.mjs.map +1 -1
- package/dist/jsx/index.native.js +12 -1
- package/dist/jsx/index.native.js.map +1 -1
- package/dist/jsx/shared.js +9 -2
- package/dist/jsx/shared.js.map +1 -1
- package/dist/jsx/shared.mjs +9 -2
- package/dist/jsx/shared.mjs.map +1 -1
- package/dist/jsx/shared.native.js +9 -2
- package/dist/jsx/shared.native.js.map +1 -1
- package/dist/jsx/v1/Input.js +151 -0
- package/dist/jsx/v1/Input.js.map +6 -0
- package/dist/jsx/v1/Input.mjs +156 -0
- package/dist/jsx/v1/Input.mjs.map +1 -0
- package/dist/jsx/v1/Input.native.js +138 -0
- package/dist/jsx/v1/Input.native.js.map +1 -0
- package/dist/jsx/v1/TextArea.js +29 -0
- package/dist/jsx/v1/TextArea.js.map +6 -0
- package/dist/jsx/v1/TextArea.mjs +27 -0
- package/dist/jsx/v1/TextArea.mjs.map +1 -0
- package/dist/jsx/v1/TextArea.native.js +53 -0
- package/dist/jsx/v1/TextArea.native.js.map +1 -0
- package/dist/jsx/v1/index.js +3 -0
- package/dist/jsx/v1/index.js.map +6 -0
- package/dist/jsx/v1/index.mjs +3 -0
- package/dist/jsx/v1/index.mjs.map +1 -0
- package/dist/jsx/v1/index.native.js +22 -0
- package/dist/jsx/v1/index.native.js.map +1 -0
- package/dist/jsx/v1/types.js +1 -0
- package/dist/jsx/v1/types.js.map +6 -0
- package/dist/jsx/v1/types.mjs +2 -0
- package/dist/jsx/v1/types.mjs.map +1 -0
- package/dist/jsx/v1/types.native.js +19 -0
- package/dist/jsx/v1/types.native.js.map +1 -0
- package/package.json +13 -13
- package/src/index.ts +1 -0
- package/src/shared.tsx +15 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/shared.d.ts.map +1 -1
- package/types/v1/Input.d.ts.map +1 -0
- package/types/v1/Input.native.d.ts.map +1 -0
- package/types/v1/TextArea.d.ts.map +1 -0
- package/types/v1/index.d.ts.map +1 -0
- package/types/v1/types.d.ts.map +1 -0
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,7 +2,13 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: !0
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
__copyProps = (to, from, except, desc) => {
|
|
6
12
|
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
7
13
|
get: () => from[key],
|
|
8
14
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -14,6 +20,11 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
14
20
|
value: !0
|
|
15
21
|
}), mod);
|
|
16
22
|
var index_exports = {};
|
|
23
|
+
__export(index_exports, {
|
|
24
|
+
inputSizeVariant: () => import_shared.inputSizeVariant,
|
|
25
|
+
textAreaSizeVariant: () => import_shared.textAreaSizeVariant
|
|
26
|
+
});
|
|
17
27
|
module.exports = __toCommonJS(index_exports);
|
|
18
28
|
__reExport(index_exports, require("./Input.cjs"), module.exports);
|
|
19
|
-
__reExport(index_exports, require("./TextArea.cjs"), module.exports);
|
|
29
|
+
__reExport(index_exports, require("./TextArea.cjs"), module.exports);
|
|
30
|
+
var import_shared = require("./shared.cjs");
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,7 +2,10 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
6
9
|
if (from && typeof from == "object" || typeof from == "function")
|
|
7
10
|
for (let key of __getOwnPropNames(from))
|
|
8
11
|
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
@@ -10,7 +13,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
10
13
|
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
14
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
15
|
var index_exports = {};
|
|
16
|
+
__export(index_exports, {
|
|
17
|
+
inputSizeVariant: () => import_shared.inputSizeVariant,
|
|
18
|
+
textAreaSizeVariant: () => import_shared.textAreaSizeVariant
|
|
19
|
+
});
|
|
13
20
|
module.exports = __toCommonJS(index_exports);
|
|
14
21
|
__reExport(index_exports, require("./Input"), module.exports);
|
|
15
22
|
__reExport(index_exports, require("./TextArea"), module.exports);
|
|
23
|
+
var import_shared = require("./shared");
|
|
16
24
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
package/dist/cjs/index.native.js
CHANGED
|
@@ -4,7 +4,13 @@ var __defProp = Object.defineProperty;
|
|
|
4
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
8
14
|
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
9
15
|
get: () => from[key],
|
|
10
16
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -16,7 +22,12 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
16
22
|
value: !0
|
|
17
23
|
}), mod);
|
|
18
24
|
var index_exports = {};
|
|
25
|
+
__export(index_exports, {
|
|
26
|
+
inputSizeVariant: () => import_shared.inputSizeVariant,
|
|
27
|
+
textAreaSizeVariant: () => import_shared.textAreaSizeVariant
|
|
28
|
+
});
|
|
19
29
|
module.exports = __toCommonJS(index_exports);
|
|
20
30
|
__reExport(index_exports, require("./Input.native.js"), module.exports);
|
|
21
31
|
__reExport(index_exports, require("./TextArea.native.js"), module.exports);
|
|
32
|
+
var import_shared = require("./shared.native.js");
|
|
22
33
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","index_exports","__export","inputSizeVariant","import_shared","textAreaSizeVariant","module","exports","__reExport","require"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,aAAA;AAAAC,QAAA,CAAAD,aAAA;EAAAE,gBAAA,EAAAA,CAAA,KAAAC,aAAA,CAAAD,gBAAA;EAAAE,mBAAA,EAAAA,CAAA,KAAAD,aAAA,CAAAC;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAX,YAAc,CAAAK,aAAA;AACdO,UAAA,CAAAP,aAAA,EAAcQ,OAAA,uBAAAH,MADd,CAAAC,OAAA;AAEAC,UAAA,CAAAP,aAAsD,EAAAQ,OAAA,0BAAAH,MAAA,CAAAC,OAAA","ignoreList":[]}
|
package/dist/cjs/shared.cjs
CHANGED
|
@@ -60,7 +60,7 @@ const defaultStyles = {
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
inputSizeVariant = (val = "$true", extras) => {
|
|
63
|
-
if (extras.props.multiline || extras.props.numberOfLines > 1) return textAreaSizeVariant(val, extras);
|
|
63
|
+
if (extras.props.tag === "textarea" || extras.props.rows > 1 || extras.props.multiline || extras.props.numberOfLines > 1) return textAreaSizeVariant(val, extras);
|
|
64
64
|
const buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras),
|
|
65
65
|
paddingHorizontal = (0, import_get_token.getSpace)(val, {
|
|
66
66
|
shift: -1,
|
|
@@ -70,7 +70,14 @@ const defaultStyles = {
|
|
|
70
70
|
return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight, {
|
|
71
71
|
...fontStyle,
|
|
72
72
|
...buttonStyles,
|
|
73
|
-
paddingHorizontal
|
|
73
|
+
paddingHorizontal,
|
|
74
|
+
// Android fixes: reset padding and center text vertically (skip if unstyled)
|
|
75
|
+
...(!import_core2.isWeb && !extras.props.unstyled && {
|
|
76
|
+
textAlignVertical: "center",
|
|
77
|
+
paddingVertical: 0,
|
|
78
|
+
paddingTop: 0,
|
|
79
|
+
paddingBottom: 0
|
|
80
|
+
})
|
|
74
81
|
};
|
|
75
82
|
},
|
|
76
83
|
textAreaSizeVariant = (val = "$true", extras) => {
|
package/dist/cjs/shared.js
CHANGED
|
@@ -49,7 +49,7 @@ const defaultStyles = {
|
|
|
49
49
|
outlineStyle: "solid"
|
|
50
50
|
}
|
|
51
51
|
}, inputSizeVariant = (val = "$true", extras) => {
|
|
52
|
-
if (extras.props.multiline || extras.props.numberOfLines > 1)
|
|
52
|
+
if (extras.props.tag === "textarea" || extras.props.rows > 1 || extras.props.multiline || extras.props.numberOfLines > 1)
|
|
53
53
|
return textAreaSizeVariant(val, extras);
|
|
54
54
|
const buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras), paddingHorizontal = (0, import_get_token.getSpace)(val, {
|
|
55
55
|
shift: -1,
|
|
@@ -58,7 +58,14 @@ const defaultStyles = {
|
|
|
58
58
|
return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight, {
|
|
59
59
|
...fontStyle,
|
|
60
60
|
...buttonStyles,
|
|
61
|
-
paddingHorizontal
|
|
61
|
+
paddingHorizontal,
|
|
62
|
+
// Android fixes: reset padding and center text vertically (skip if unstyled)
|
|
63
|
+
...!import_core2.isWeb && !extras.props.unstyled && {
|
|
64
|
+
textAlignVertical: "center",
|
|
65
|
+
paddingVertical: 0,
|
|
66
|
+
paddingTop: 0,
|
|
67
|
+
paddingBottom: 0
|
|
68
|
+
}
|
|
62
69
|
};
|
|
63
70
|
}, textAreaSizeVariant = (val = "$true", extras) => {
|
|
64
71
|
const { props } = extras, buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras), fontStyle = (0, import_get_font_sized.getFontSized)(val, extras), lines = props.rows ?? props.numberOfLines, height = typeof lines == "number" ? lines * (0, import_core2.getVariableValue)(fontStyle.lineHeight) : "auto", paddingVertical = (0, import_get_token.getSpace)(val, {
|
package/dist/cjs/shared.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/shared.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB,0BACrBA,eAAwC,0BACxC,0BAA+B,sCAC/B,wBAA6B,oCAC7B,mBAAyB;AAElB,MAAM,gBAAgB;AAAA,EAC3B,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,cAAc;AAAA,EACd,OAAO;AAAA,EAEP,GAAI,qBACA;AAAA,IACE,UAAU;AAAA,EACZ,IACA;AAAA,IACE,WAAW;AAAA,EACb;AAAA,EAEJ,aAAa;AAAA,EACb,iBAAiB;AAAA;AAAA,EAGjB,UAAU;AAAA,EAEV,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,mBAAmB;AAAA,IACjB,cAAc;AAAA,IACd,cAAc;AAAA,IACd,cAAc;AAAA,EAChB;AACF,GAEa,mBAAmD,CAC9D,MAAM,SACN,WACG;
|
|
4
|
+
"mappings":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AE,MAAM,IAAI,QACZ,mBAAe,wCAAe,KAAK,MAAM,GACzC,gBAAY,oCAAa,KAAY,MAAM,GAC3C,QAAQ,MAAM,QAAQ,MAAM,eAC5B,SACJ,OAAO,SAAU,WAAW,YAAQ,+BAAiB,UAAU,UAAU,IAAI,QACzE,sBAAkB,2BAAS,KAAK;AAAA,IACpC,OAAO;AAAA,IACP,QAAQ,CAAC,CAAC;AAAA,EACZ,CAAC,GACK,wBAAoB,2BAAS,KAAK;AAAA,IACtC,OAAO;AAAA,IACP,QAAQ,CAAC,CAAC;AAAA,EACZ,CAAC;AACD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF,GACa,aAAa,SAEb,aAAa;AAAA,EACxB;AAAA,IACE,MAAM;AAAA,IACN,KAAK;AAAA,IACL,UAAU;AAAA,MACR,UAAU;AAAA,QACR,OAAO;AAAA,MACT;AAAA,MAEA,MAAM;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MAEA,UAAU;AAAA,QACR,MAAM,CAAC;AAAA,MACT;AAAA,IACF;AAAA,IAEA,iBAAiB;AAAA,MACf,UAAU,QAAQ,IAAI,qBAAqB;AAAA,IAC7C;AAAA,EACF;AAAA,EAEA;AAAA,IACE,SAAS;AAAA,IACT,QAAQ;AAAA,MACN,sBAAsB;AAAA,MACtB,gBAAgB;AAAA,IAClB;AAAA,IAEA,aAAa,iBAAK,aAAa;AAAA,EACjC;AACF;",
|
|
5
5
|
"names": ["import_core"]
|
|
6
6
|
}
|
|
@@ -64,7 +64,7 @@ var import_core = require("@tamagui/core"),
|
|
|
64
64
|
inputSizeVariant = function () {
|
|
65
65
|
var val = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "$true",
|
|
66
66
|
extras = arguments.length > 1 ? arguments[1] : void 0;
|
|
67
|
-
if (extras.props.multiline || extras.props.numberOfLines > 1) return textAreaSizeVariant(val, extras);
|
|
67
|
+
if (extras.props.tag === "textarea" || extras.props.rows > 1 || extras.props.multiline || extras.props.numberOfLines > 1) return textAreaSizeVariant(val, extras);
|
|
68
68
|
var buttonStyles = (0, import_get_button_sized.getButtonSized)(val, extras),
|
|
69
69
|
paddingHorizontal = (0, import_get_token.getSpace)(val, {
|
|
70
70
|
shift: -1,
|
|
@@ -74,7 +74,14 @@ var import_core = require("@tamagui/core"),
|
|
|
74
74
|
return !import_core2.isWeb && fontStyle && delete fontStyle.lineHeight, {
|
|
75
75
|
...fontStyle,
|
|
76
76
|
...buttonStyles,
|
|
77
|
-
paddingHorizontal
|
|
77
|
+
paddingHorizontal,
|
|
78
|
+
// Android fixes: reset padding and center text vertically (skip if unstyled)
|
|
79
|
+
...(!import_core2.isWeb && !extras.props.unstyled && {
|
|
80
|
+
textAlignVertical: "center",
|
|
81
|
+
paddingVertical: 0,
|
|
82
|
+
paddingTop: 0,
|
|
83
|
+
paddingBottom: 0
|
|
84
|
+
})
|
|
78
85
|
};
|
|
79
86
|
},
|
|
80
87
|
textAreaSizeVariant = function () {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","shared_exports","__export","INPUT_NAME","defaultStyles","inputSizeVariant","styledBody","textAreaSizeVariant","module","exports","import_core","require","import_core2","import_get_button_sized","import_get_font_sized","import_get_token","size","fontFamily","borderWidth","outlineWidth","color","isWeb","tabIndex","focusable","borderColor","backgroundColor","minWidth","hoverStyle","focusStyle","focusVisibleStyle","outlineColor","outlineStyle","val","arguments","length","extras","props","multiline","numberOfLines","buttonStyles","getButtonSized","paddingHorizontal","getSpace","shift","bounds","fontStyle","getFontSized","lineHeight","
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","shared_exports","__export","INPUT_NAME","defaultStyles","inputSizeVariant","styledBody","textAreaSizeVariant","module","exports","import_core","require","import_core2","import_get_button_sized","import_get_font_sized","import_get_token","size","fontFamily","borderWidth","outlineWidth","color","isWeb","tabIndex","focusable","borderColor","backgroundColor","minWidth","hoverStyle","focusStyle","focusVisibleStyle","outlineColor","outlineStyle","val","arguments","length","extras","props","tag","rows","multiline","numberOfLines","buttonStyles","getButtonSized","paddingHorizontal","getSpace","shift","bounds","fontStyle","getFontSized","lineHeight","unstyled","textAlignVertical","paddingVertical","paddingTop","paddingBottom","_props_rows","lines","height","getVariableValue","name","variants","false","disabled","true","defaultVariants","process","env","TAMAGUI_HEADLESS","isInput"],"sources":["../../src/shared.tsx"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,cAAA;AAAAC,QAAA,CAAAD,cAAA;EAAAE,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,aAAA,EAAAA,CAAA,KAAAA,aAAA;EAAAC,gBAAA,EAAAA,CAAA,KAAAA,gBAAA;EAAAC,UAAA,EAAAA,CAAA,KAAAA,UAAA;EAAAC,mBAAA,EAAAA,CAAA,KAAAA;AAAA;AACAC,MAAA,CAAAC,OAAA,GAAAb,YAAqB,CAAAK,cACrB;AAKO,IAAAS,WAAM,GAAAC,OAAgB;EAAAC,YAAA,GAAAD,OAAA;EAAAE,uBAAA,GAAAF,OAAA;EAAAG,qBAAA,GAAAH,OAAA;EAAAI,gBAAA,GAAAJ,OAAA;EAAAP,aAAA;IAC3BY,IAAA,EAAM;IACNC,UAAA,EAAY;IACZC,WAAA,EAAa;IACbC,YAAA,EAAc;IACdC,KAAA,EAAO;IAEP,IAAIR,YAAA,CAAAS,KAAA,GACA;MACEC,QAAA,EAAU;IACZ,IACA;MACEC,SAAA,EAAW;IACb;IAEJC,WAAA,EAAa;IACbC,eAAA,EAAiB;IAAA;IAGjBC,QAAA,EAAU;IAEVC,UAAA,EAAY;MACVH,WAAA,EAAa;IACf;IAEAI,UAAA,EAAY;MACVJ,WAAA,EAAa;IACf;I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MAAA,IAAAD,MAAA;MAAAM,YAAA,OAAA5B,uBAAA,CAAA6B,cAAA,EAAAV,GAAA,EAAAG,MAAA;MAAAY,SAAA,OAAAjC,qBAAA,CAAAkC,YAAA,EAAAhB,GAAA,EAAAG,MAAA;MAAAoB,WAAA;MAAAC,KAAA,IAAAD,WAAA,GAAAnB,KAAA,CAAAE,IAAA,cAAAiB,WAAA,cAAAA,WAAA,GAAAnB,KAAA,CAAAI,aAAA;MAAAiB,MAAA,UAAAD,KAAA,eAAAA,KAAA,OAAA5C,YAAA,CAAA8C,gBAAA,EAAAX,SAAA,CAAAE,UAAA;MAAAG,eAAA,OAAArC,gBAAA,CAAA6B,QAAA,EAAAZ,GAAA;QACtCa,KAAA,EAAO;QACPC,MAAA,EAAQ,CACT;MACM,EACL;MAAAH,iBAAG,OAAA5B,gBAAA,CAAA6B,QAAA,EAAAZ,GAAA;QACHa,KAAG;QACHC,MAAA,GACA;MAEF;IACF,OACa;MAGX,GAAAL,YAAA;MACE,GAAAM,SAAM;MACNK,eAAK;MACLT,iBAAU;MAAAc;IACE;EACD;EAAAtD,UACT;EAAAG,UAAA;IAEMqD,IACJ,EAAAxD,UAAW;IAAAkC,GACb;IAAAuB,QAEA;MAAUV,QACF,EAAC;QACTW,KAAA,EAAAzD;MACF;MAEAY,IAAA;QACE,SAAU,EAAAX;MACZ;MACFyD,QAAA;QAEAC,IAAA;MACE;IACA;IAAQC,eACN;MACAd,QAAA,EAAAe,OAAgB,CAAAC,GAAA,CAAAC,gBAAA;IAClB;EAAA,GAGF;IACFC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var Input_exports = {};
|
|
33
|
+
__export(Input_exports, {
|
|
34
|
+
Input: () => Input
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(Input_exports);
|
|
37
|
+
var import_core = require("@tamagui/core"),
|
|
38
|
+
import_focusable = require("@tamagui/focusable"),
|
|
39
|
+
import_react = __toESM(require("react"), 1),
|
|
40
|
+
import_shared = require("../shared.cjs"),
|
|
41
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styledBody[0], import_shared.styledBody[1]),
|
|
43
|
+
Input = StyledInput.styleable((inProps, forwardedRef) => {
|
|
44
|
+
const {
|
|
45
|
+
// some of destructed props are just to avoid passing them to ...rest because they are not in web.
|
|
46
|
+
allowFontScaling,
|
|
47
|
+
selectTextOnFocus,
|
|
48
|
+
showSoftInputOnFocus,
|
|
49
|
+
textContentType,
|
|
50
|
+
passwordRules,
|
|
51
|
+
textBreakStrategy,
|
|
52
|
+
underlineColorAndroid,
|
|
53
|
+
selection,
|
|
54
|
+
lineBreakStrategyIOS,
|
|
55
|
+
returnKeyLabel,
|
|
56
|
+
disabled,
|
|
57
|
+
onSubmitEditing,
|
|
58
|
+
caretHidden,
|
|
59
|
+
clearButtonMode,
|
|
60
|
+
clearTextOnFocus,
|
|
61
|
+
contextMenuHidden,
|
|
62
|
+
dataDetectorTypes,
|
|
63
|
+
id,
|
|
64
|
+
enablesReturnKeyAutomatically,
|
|
65
|
+
importantForAutofill,
|
|
66
|
+
inlineImageLeft,
|
|
67
|
+
inlineImagePadding,
|
|
68
|
+
inputAccessoryViewID,
|
|
69
|
+
keyboardAppearance,
|
|
70
|
+
keyboardType,
|
|
71
|
+
cursorColor,
|
|
72
|
+
disableFullscreenUI,
|
|
73
|
+
editable,
|
|
74
|
+
maxFontSizeMultiplier,
|
|
75
|
+
multiline,
|
|
76
|
+
numberOfLines,
|
|
77
|
+
onChangeText,
|
|
78
|
+
onContentSizeChange,
|
|
79
|
+
onEndEditing,
|
|
80
|
+
onScroll,
|
|
81
|
+
onSelectionChange,
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
caretColor,
|
|
84
|
+
placeholderTextColor,
|
|
85
|
+
blurOnSubmit,
|
|
86
|
+
enterKeyHint,
|
|
87
|
+
returnKeyType,
|
|
88
|
+
rejectResponderTermination,
|
|
89
|
+
scrollEnabled,
|
|
90
|
+
secureTextEntry,
|
|
91
|
+
selectionColor,
|
|
92
|
+
inputMode,
|
|
93
|
+
...rest
|
|
94
|
+
} = inProps,
|
|
95
|
+
ref = import_react.default.useRef(null),
|
|
96
|
+
theme = (0, import_core.useTheme)(),
|
|
97
|
+
composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref),
|
|
98
|
+
_onSelectionChange = (0, import_core.useEvent)(() => {
|
|
99
|
+
const start = ref.current?.selectionStart ?? 0,
|
|
100
|
+
end = ref.current?.selectionEnd ?? 0;
|
|
101
|
+
onSelectionChange?.({
|
|
102
|
+
nativeEvent: {
|
|
103
|
+
selection: {
|
|
104
|
+
end,
|
|
105
|
+
start
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
import_react.default.useEffect(() => {
|
|
111
|
+
if (onSelectionChange) return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
|
|
112
|
+
ref.current?.removeEventListener("selectionchange", _onSelectionChange);
|
|
113
|
+
};
|
|
114
|
+
}, []), import_react.default.useEffect(() => {
|
|
115
|
+
selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
|
|
116
|
+
}, [selection?.start, selection?.end]);
|
|
117
|
+
const finalProps = {
|
|
118
|
+
...rest,
|
|
119
|
+
disabled,
|
|
120
|
+
caretColor,
|
|
121
|
+
id,
|
|
122
|
+
enterKeyHint,
|
|
123
|
+
type: (() => {
|
|
124
|
+
if (rest?.type) return rest.type;
|
|
125
|
+
if (secureTextEntry) return "password";
|
|
126
|
+
switch (keyboardType) {
|
|
127
|
+
case "number-pad":
|
|
128
|
+
case "numeric":
|
|
129
|
+
return "number";
|
|
130
|
+
case "email-address":
|
|
131
|
+
return "email";
|
|
132
|
+
case "phone-pad":
|
|
133
|
+
return "tel";
|
|
134
|
+
case "url":
|
|
135
|
+
return "url";
|
|
136
|
+
default:
|
|
137
|
+
return "text";
|
|
138
|
+
}
|
|
139
|
+
})(),
|
|
140
|
+
inputMode: (() => {
|
|
141
|
+
switch (keyboardType) {
|
|
142
|
+
case "number-pad":
|
|
143
|
+
case "numeric":
|
|
144
|
+
return "numeric";
|
|
145
|
+
case "decimal-pad":
|
|
146
|
+
return "decimal";
|
|
147
|
+
case "email-address":
|
|
148
|
+
return "email";
|
|
149
|
+
case "phone-pad":
|
|
150
|
+
return "tel";
|
|
151
|
+
case "url":
|
|
152
|
+
return "url";
|
|
153
|
+
default:
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
})(),
|
|
157
|
+
style: {
|
|
158
|
+
...rest.style,
|
|
159
|
+
...(placeholderTextColor && {
|
|
160
|
+
"--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
|
|
161
|
+
}),
|
|
162
|
+
...(selectionColor && {
|
|
163
|
+
"--selectionColor": theme[selectionColor]?.variable || selectionColor
|
|
164
|
+
})
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
return import_react.default.useEffect(() => {
|
|
168
|
+
if (id && !disabled) return (0, import_focusable.registerFocusable)(id, {
|
|
169
|
+
focusAndSelect: () => {
|
|
170
|
+
ref.current?.focus();
|
|
171
|
+
},
|
|
172
|
+
focus: () => {}
|
|
173
|
+
});
|
|
174
|
+
}, [id, disabled]), /* @__PURE__ */(0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, {
|
|
175
|
+
children: [/* @__PURE__ */(0, import_jsx_runtime.jsx)("style", {
|
|
176
|
+
children: `
|
|
177
|
+
input::selection, textarea::selection {
|
|
178
|
+
background-color: var(--selectionBackground) !important;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
input::placeholder, textarea::placeholder {
|
|
182
|
+
color: var(--placeholderColor) !important;
|
|
183
|
+
}
|
|
184
|
+
`
|
|
185
|
+
}), /* @__PURE__ */(0, import_jsx_runtime.jsx)(StyledInput, {
|
|
186
|
+
ref: composedRefs,
|
|
187
|
+
...finalProps
|
|
188
|
+
})]
|
|
189
|
+
});
|
|
190
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
9
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function")
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
return to;
|
|
14
|
+
};
|
|
15
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
16
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
17
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
18
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
19
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
|
21
|
+
mod
|
|
22
|
+
)), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
23
|
+
var Input_exports = {};
|
|
24
|
+
__export(Input_exports, {
|
|
25
|
+
Input: () => Input
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(Input_exports);
|
|
28
|
+
var import_core = require("@tamagui/core"), import_focusable = require("@tamagui/focusable"), import_react = __toESM(require("react"), 1), import_shared = require("../shared"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
|
+
const StyledInput = (0, import_core.styled)(import_core.View, import_shared.styledBody[0], import_shared.styledBody[1]), Input = StyledInput.styleable((inProps, forwardedRef) => {
|
|
30
|
+
const {
|
|
31
|
+
// some of destructed props are just to avoid passing them to ...rest because they are not in web.
|
|
32
|
+
allowFontScaling,
|
|
33
|
+
selectTextOnFocus,
|
|
34
|
+
showSoftInputOnFocus,
|
|
35
|
+
textContentType,
|
|
36
|
+
passwordRules,
|
|
37
|
+
textBreakStrategy,
|
|
38
|
+
underlineColorAndroid,
|
|
39
|
+
selection,
|
|
40
|
+
lineBreakStrategyIOS,
|
|
41
|
+
returnKeyLabel,
|
|
42
|
+
disabled,
|
|
43
|
+
onSubmitEditing,
|
|
44
|
+
caretHidden,
|
|
45
|
+
clearButtonMode,
|
|
46
|
+
clearTextOnFocus,
|
|
47
|
+
contextMenuHidden,
|
|
48
|
+
dataDetectorTypes,
|
|
49
|
+
id,
|
|
50
|
+
enablesReturnKeyAutomatically,
|
|
51
|
+
importantForAutofill,
|
|
52
|
+
inlineImageLeft,
|
|
53
|
+
inlineImagePadding,
|
|
54
|
+
inputAccessoryViewID,
|
|
55
|
+
keyboardAppearance,
|
|
56
|
+
keyboardType,
|
|
57
|
+
cursorColor,
|
|
58
|
+
disableFullscreenUI,
|
|
59
|
+
editable,
|
|
60
|
+
maxFontSizeMultiplier,
|
|
61
|
+
multiline,
|
|
62
|
+
numberOfLines,
|
|
63
|
+
onChangeText,
|
|
64
|
+
onContentSizeChange,
|
|
65
|
+
onEndEditing,
|
|
66
|
+
onScroll,
|
|
67
|
+
onSelectionChange,
|
|
68
|
+
// @ts-ignore
|
|
69
|
+
caretColor,
|
|
70
|
+
placeholderTextColor,
|
|
71
|
+
blurOnSubmit,
|
|
72
|
+
enterKeyHint,
|
|
73
|
+
returnKeyType,
|
|
74
|
+
rejectResponderTermination,
|
|
75
|
+
scrollEnabled,
|
|
76
|
+
secureTextEntry,
|
|
77
|
+
selectionColor,
|
|
78
|
+
inputMode,
|
|
79
|
+
...rest
|
|
80
|
+
} = inProps, ref = import_react.default.useRef(null), theme = (0, import_core.useTheme)(), composedRefs = (0, import_core.useComposedRefs)(forwardedRef, ref), _onSelectionChange = (0, import_core.useEvent)(() => {
|
|
81
|
+
const start = ref.current?.selectionStart ?? 0, end = ref.current?.selectionEnd ?? 0;
|
|
82
|
+
onSelectionChange?.({
|
|
83
|
+
nativeEvent: {
|
|
84
|
+
selection: {
|
|
85
|
+
end,
|
|
86
|
+
start
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
import_react.default.useEffect(() => {
|
|
92
|
+
if (onSelectionChange)
|
|
93
|
+
return ref.current?.addEventListener("selectionchange", _onSelectionChange), () => {
|
|
94
|
+
ref.current?.removeEventListener("selectionchange", _onSelectionChange);
|
|
95
|
+
};
|
|
96
|
+
}, []), import_react.default.useEffect(() => {
|
|
97
|
+
selection && ref.current?.setSelectionRange(selection.start || null, selection.end || null);
|
|
98
|
+
}, [selection?.start, selection?.end]);
|
|
99
|
+
const finalProps = {
|
|
100
|
+
...rest,
|
|
101
|
+
disabled,
|
|
102
|
+
caretColor,
|
|
103
|
+
id,
|
|
104
|
+
enterKeyHint,
|
|
105
|
+
type: (() => {
|
|
106
|
+
if (rest?.type) return rest.type;
|
|
107
|
+
if (secureTextEntry) return "password";
|
|
108
|
+
switch (keyboardType) {
|
|
109
|
+
case "number-pad":
|
|
110
|
+
case "numeric":
|
|
111
|
+
return "number";
|
|
112
|
+
case "email-address":
|
|
113
|
+
return "email";
|
|
114
|
+
case "phone-pad":
|
|
115
|
+
return "tel";
|
|
116
|
+
case "url":
|
|
117
|
+
return "url";
|
|
118
|
+
default:
|
|
119
|
+
return "text";
|
|
120
|
+
}
|
|
121
|
+
})(),
|
|
122
|
+
inputMode: (() => {
|
|
123
|
+
switch (keyboardType) {
|
|
124
|
+
case "number-pad":
|
|
125
|
+
case "numeric":
|
|
126
|
+
return "numeric";
|
|
127
|
+
case "decimal-pad":
|
|
128
|
+
return "decimal";
|
|
129
|
+
case "email-address":
|
|
130
|
+
return "email";
|
|
131
|
+
case "phone-pad":
|
|
132
|
+
return "tel";
|
|
133
|
+
case "url":
|
|
134
|
+
return "url";
|
|
135
|
+
default:
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
})(),
|
|
139
|
+
style: {
|
|
140
|
+
...rest.style,
|
|
141
|
+
...placeholderTextColor && {
|
|
142
|
+
"--placeholderColor": theme[placeholderTextColor]?.variable || placeholderTextColor
|
|
143
|
+
},
|
|
144
|
+
...selectionColor && {
|
|
145
|
+
"--selectionColor": theme[selectionColor]?.variable || selectionColor
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return import_react.default.useEffect(() => {
|
|
150
|
+
if (id && !disabled)
|
|
151
|
+
return (0, import_focusable.registerFocusable)(id, {
|
|
152
|
+
focusAndSelect: () => {
|
|
153
|
+
ref.current?.focus();
|
|
154
|
+
},
|
|
155
|
+
focus: () => {
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}, [id, disabled]), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: `
|
|
160
|
+
input::selection, textarea::selection {
|
|
161
|
+
background-color: var(--selectionBackground) !important;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
input::placeholder, textarea::placeholder {
|
|
165
|
+
color: var(--placeholderColor) !important;
|
|
166
|
+
}
|
|
167
|
+
` }),
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StyledInput, { ref: composedRefs, ...finalProps })
|
|
169
|
+
] });
|
|
170
|
+
});
|
|
171
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/v1/Input.tsx"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAkE,0BAClE,mBAAkC,+BAClC,eAAwE,8BACxE,gBAA2B,sBAyKvB;AAtKJ,MAAM,kBAAc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