@tamagui/stacks 1.0.0-canary.204 → 1.0.1-beta.102
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/SizableStack.js +48 -0
- package/dist/cjs/SizableStack.js.map +7 -0
- package/dist/cjs/Stacks.js +30 -25
- package/dist/cjs/Stacks.js.map +2 -2
- package/dist/cjs/ThemeableSizableStack.js +70 -0
- package/dist/cjs/ThemeableSizableStack.js.map +7 -0
- package/dist/cjs/ThemeableStack.js +61 -0
- package/dist/cjs/ThemeableStack.js.map +7 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/variants.js +138 -0
- package/dist/cjs/variants.js.map +7 -0
- package/dist/esm/SizableStack.js +25 -0
- package/dist/esm/SizableStack.js.map +7 -0
- package/dist/esm/Stacks.js +29 -26
- package/dist/esm/Stacks.js.map +2 -2
- package/dist/esm/ThemeableSizableStack.js +47 -0
- package/dist/esm/ThemeableSizableStack.js.map +7 -0
- package/dist/esm/ThemeableStack.js +47 -0
- package/dist/esm/ThemeableStack.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/variants.js +110 -0
- package/dist/esm/variants.js.map +7 -0
- package/dist/jsx/SizableStack.js +25 -0
- package/dist/jsx/SizableStack.js.map +7 -0
- package/dist/jsx/Stacks.js +30 -26
- package/dist/jsx/Stacks.js.map +7 -0
- package/dist/jsx/ThemeableSizableStack.js +46 -0
- package/dist/jsx/ThemeableStack.js +47 -0
- package/dist/jsx/ThemeableStack.js.map +7 -0
- package/dist/jsx/index.js +3 -0
- package/dist/jsx/index.js.map +7 -0
- package/dist/jsx/variants.js +97 -0
- package/dist/jsx/variants.js.map +7 -0
- package/package.json +9 -6
- package/src/SizableStack.tsx +29 -0
- package/src/Stacks.tsx +91 -0
- package/src/ThemeableStack.tsx +53 -0
- package/src/index.ts +3 -0
- package/src/variants.tsx +98 -0
- package/types/SizableStack.d.ts +52 -0
- package/types/SizableStack.d.ts.map +1 -0
- package/types/Stacks.d.ts +34 -33
- package/types/Stacks.d.ts.map +1 -1
- package/types/ThemeableSizableStack.d.ts +68 -0
- package/types/ThemeableSizableStack.d.ts.map +1 -0
- package/types/ThemeableStack.d.ts +68 -0
- package/types/ThemeableStack.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -1
- package/types/variants.d.ts +269 -0
- package/types/variants.d.ts.map +1 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var SizableStack_exports = {};
|
|
19
|
+
__export(SizableStack_exports, {
|
|
20
|
+
SizableStack: () => SizableStack
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(SizableStack_exports);
|
|
23
|
+
var import_core = require("@tamagui/core");
|
|
24
|
+
var import_Stacks = require("./Stacks");
|
|
25
|
+
var import_variants = require("./variants");
|
|
26
|
+
const SizableStack = (0, import_core.styled)(import_Stacks.YStack, {
|
|
27
|
+
name: "SizableStack",
|
|
28
|
+
backgroundColor: "$background",
|
|
29
|
+
flexDirection: "row",
|
|
30
|
+
flexShrink: 1,
|
|
31
|
+
variants: {
|
|
32
|
+
fontFamily: () => ({}),
|
|
33
|
+
hoverTheme: import_variants.hoverTheme,
|
|
34
|
+
pressTheme: import_variants.pressTheme,
|
|
35
|
+
focusTheme: import_variants.focusTheme,
|
|
36
|
+
circular: import_variants.circular,
|
|
37
|
+
elevate: import_variants.elevate,
|
|
38
|
+
bordered: import_variants.bordered,
|
|
39
|
+
size: {
|
|
40
|
+
"...size": import_core.getButtonSize
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {
|
|
46
|
+
SizableStack
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=SizableStack.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/SizableStack.tsx"],
|
|
4
|
+
"sourcesContent": ["import { GetProps, getButtonSize, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks'\nimport { bordered, circular, elevate, focusTheme, hoverTheme, pressTheme } from './variants'\n\nexport const SizableStack = styled(YStack, {\n name: 'SizableStack',\n backgroundColor: '$background',\n flexDirection: 'row',\n flexShrink: 1,\n\n variants: {\n // allows the type to come in for use in size\n fontFamily: () => ({}),\n\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n elevate,\n bordered,\n\n size: {\n '...size': getButtonSize,\n },\n },\n})\n\nexport type SizableStackProps = GetProps<typeof SizableStack>\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEhD,oBAAuB;AACvB,sBAAgF;AAEzE,MAAM,eAAe,wBAAO,sBAAQ;AAAA,EACzC,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EAEZ,UAAU;AAAA,IAER,YAAY,MAAO,EAAC;AAAA,IAEpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,EACF;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/Stacks.js
CHANGED
|
@@ -2,7 +2,6 @@ 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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
5
|
var __export = (target, all) => {
|
|
7
6
|
for (var name in all)
|
|
8
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -21,16 +20,19 @@ __export(Stacks_exports, {
|
|
|
21
20
|
XStack: () => XStack,
|
|
22
21
|
YStack: () => YStack,
|
|
23
22
|
ZStack: () => ZStack,
|
|
23
|
+
getElevation: () => getElevation,
|
|
24
24
|
getSizedElevation: () => getSizedElevation
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(Stacks_exports);
|
|
27
27
|
var import_core = require("@tamagui/core");
|
|
28
|
-
const getElevation =
|
|
28
|
+
const getElevation = (size, extras) => {
|
|
29
|
+
if (!size)
|
|
30
|
+
return;
|
|
29
31
|
const { tokens } = extras;
|
|
30
32
|
const token = tokens.size[size];
|
|
31
33
|
const sizeNum = (0, import_core.isVariable)(token) ? +token.val : size;
|
|
32
34
|
return getSizedElevation(sizeNum, extras);
|
|
33
|
-
}
|
|
35
|
+
};
|
|
34
36
|
const fullscreenStyle = {
|
|
35
37
|
position: "absolute",
|
|
36
38
|
top: 0,
|
|
@@ -38,29 +40,23 @@ const fullscreenStyle = {
|
|
|
38
40
|
right: 0,
|
|
39
41
|
bottom: 0
|
|
40
42
|
};
|
|
43
|
+
const variants = {
|
|
44
|
+
fullscreen: {
|
|
45
|
+
true: fullscreenStyle
|
|
46
|
+
},
|
|
47
|
+
elevation: {
|
|
48
|
+
"...size": getElevation
|
|
49
|
+
}
|
|
50
|
+
};
|
|
41
51
|
const YStack = (0, import_core.styled)(import_core.Stack, {
|
|
42
52
|
flexDirection: "column",
|
|
43
53
|
name: "YStack",
|
|
44
|
-
variants
|
|
45
|
-
fullscreen: {
|
|
46
|
-
true: fullscreenStyle
|
|
47
|
-
},
|
|
48
|
-
elevation: {
|
|
49
|
-
"...size": getElevation
|
|
50
|
-
}
|
|
51
|
-
}
|
|
54
|
+
variants
|
|
52
55
|
});
|
|
53
56
|
const XStack = (0, import_core.styled)(import_core.Stack, {
|
|
54
57
|
flexDirection: "row",
|
|
55
58
|
name: "XStack",
|
|
56
|
-
variants
|
|
57
|
-
fullscreen: {
|
|
58
|
-
true: fullscreenStyle
|
|
59
|
-
},
|
|
60
|
-
elevation: {
|
|
61
|
-
"...size": getElevation
|
|
62
|
-
}
|
|
63
|
-
}
|
|
59
|
+
variants
|
|
64
60
|
});
|
|
65
61
|
const ZStack = (0, import_core.styled)(YStack, {
|
|
66
62
|
name: "ZStack",
|
|
@@ -69,14 +65,22 @@ const ZStack = (0, import_core.styled)(YStack, {
|
|
|
69
65
|
neverFlatten: true,
|
|
70
66
|
isZStack: true
|
|
71
67
|
});
|
|
72
|
-
const getSizedElevation =
|
|
73
|
-
|
|
68
|
+
const getSizedElevation = (val, { theme, tokens }) => {
|
|
69
|
+
let num = 0;
|
|
70
|
+
if (val === true) {
|
|
74
71
|
const val2 = (0, import_core.getVariableValue)(tokens.size["true"]);
|
|
75
72
|
if (typeof val2 === "number") {
|
|
76
|
-
|
|
73
|
+
num = val2;
|
|
74
|
+
} else {
|
|
75
|
+
num = 10;
|
|
77
76
|
}
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
} else {
|
|
78
|
+
num = +val;
|
|
79
|
+
}
|
|
80
|
+
if (process.env.NODE_ENV === "development") {
|
|
81
|
+
if (isNaN(num))
|
|
82
|
+
console.warn("NaN shadow", num, val);
|
|
83
|
+
}
|
|
80
84
|
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
81
85
|
const shadow = {
|
|
82
86
|
shadowColor: theme.shadowColor,
|
|
@@ -84,12 +88,13 @@ const getSizedElevation = /* @__PURE__ */ __name((val, { theme, tokens }) => {
|
|
|
84
88
|
shadowOffset: { height, width: 0 }
|
|
85
89
|
};
|
|
86
90
|
return shadow;
|
|
87
|
-
}
|
|
91
|
+
};
|
|
88
92
|
// Annotate the CommonJS export names for ESM import in node:
|
|
89
93
|
0 && (module.exports = {
|
|
90
94
|
XStack,
|
|
91
95
|
YStack,
|
|
92
96
|
ZStack,
|
|
97
|
+
getElevation,
|
|
93
98
|
getSizedElevation
|
|
94
99
|
});
|
|
95
100
|
//# sourceMappingURL=Stacks.js.map
|
package/dist/cjs/Stacks.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Stacks.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n SizeVariantSpreadFunction,\n Stack,\n StackProps,\n VariantSpreadExtras,\n getVariableValue,\n isVariable,\n styled,\n} from '@tamagui/core'\n\nexport type YStackProps = GetProps<typeof YStack>\nexport type XStackProps =
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n SizeVariantSpreadFunction,\n Stack,\n StackProps,\n VariantSpreadExtras,\n getVariableValue,\n isVariable,\n styled,\n} from '@tamagui/core'\n\nexport type YStackProps = GetProps<typeof YStack>\nexport type XStackProps = YStackProps\nexport type ZStackProps = YStackProps\n\nexport const getElevation: SizeVariantSpreadFunction<StackProps> = (size, extras) => {\n if (!size) return\n const { tokens } = extras\n const token = tokens.size[size]\n const sizeNum = (isVariable(token) ? +token.val : size) as number\n return getSizedElevation(sizeNum, extras)\n}\n\nconst fullscreenStyle = {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n} as const\n\nconst variants = {\n fullscreen: {\n true: fullscreenStyle,\n },\n elevation: {\n '...size': getElevation,\n },\n} as const\n\nexport const YStack = styled(Stack, {\n flexDirection: 'column',\n name: 'YStack',\n variants,\n})\n\nexport const XStack = styled(Stack, {\n flexDirection: 'row',\n name: 'XStack',\n variants,\n})\n\nexport const ZStack = styled(\n YStack,\n {\n name: 'ZStack',\n position: 'relative',\n },\n {\n neverFlatten: true,\n isZStack: true,\n }\n)\n\nexport const getSizedElevation = (\n val: SizeTokens | number | boolean,\n { theme, tokens }: VariantSpreadExtras<any>\n) => {\n let num = 0\n if (val === true) {\n const val = getVariableValue(tokens.size['true'])\n if (typeof val === 'number') {\n num = val\n } else {\n num = 10\n }\n } else {\n num = +val\n }\n if (process.env.NODE_ENV === 'development') {\n if (isNaN(num)) console.warn('NaN shadow', num, val)\n }\n const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)]\n const shadow = {\n shadowColor: theme.shadowColor,\n shadowRadius,\n shadowOffset: { height, width: 0 },\n }\n return shadow\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAUO;AAMA,MAAM,eAAsD,CAAC,MAAM,WAAW;AACnF,MAAI,CAAC;AAAM;AACX,QAAM,EAAE,WAAW;AACnB,QAAM,QAAQ,OAAO,KAAK;AAC1B,QAAM,UAAW,4BAAW,KAAK,IAAI,CAAC,MAAM,MAAM;AAClD,SAAO,kBAAkB,SAAS,MAAM;AAC1C;AAEA,MAAM,kBAAkB;AAAA,EACtB,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AACV;AAEA,MAAM,WAAW;AAAA,EACf,YAAY;AAAA,IACV,MAAM;AAAA,EACR;AAAA,EACA,WAAW;AAAA,IACT,WAAW;AAAA,EACb;AACF;AAEO,MAAM,SAAS,wBAAO,mBAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,SAAS,wBAAO,mBAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,SAAS,wBACpB,QACA;AAAA,EACE,MAAM;AAAA,EACN,UAAU;AACZ,GACA;AAAA,EACE,cAAc;AAAA,EACd,UAAU;AACZ,CACF;AAEO,MAAM,oBAAoB,CAC/B,KACA,EAAE,OAAO,aACN;AACH,MAAI,MAAM;AACV,MAAI,QAAQ,MAAM;AAChB,UAAM,OAAM,kCAAiB,OAAO,KAAK,OAAO;AAChD,QAAI,OAAO,SAAQ,UAAU;AAC3B,YAAM;AAAA,IACR,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF,OAAO;AACL,UAAM,CAAC;AAAA,EACT;AACA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,MAAM,GAAG;AAAG,cAAQ,KAAK,cAAc,KAAK,GAAG;AAAA,EACrD;AACA,QAAM,CAAC,QAAQ,gBAAgB,CAAC,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,KAAK,MAAM,MAAM,IAAI,CAAC,CAAC;AAChF,QAAM,SAAS;AAAA,IACb,aAAa,MAAM;AAAA,IACnB;AAAA,IACA,cAAc,EAAE,QAAQ,OAAO,EAAE;AAAA,EACnC;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var ThemeableSizableStack_exports = {};
|
|
19
|
+
__export(ThemeableSizableStack_exports, {
|
|
20
|
+
ThemeableSizableStack: () => ThemeableSizableStack
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(ThemeableSizableStack_exports);
|
|
23
|
+
var import_core = require("@tamagui/core");
|
|
24
|
+
var import_Stacks = require("./Stacks");
|
|
25
|
+
var import_variants = require("./variants");
|
|
26
|
+
const ThemeableSizableStack = (0, import_core.styled)(import_Stacks.YStack, {
|
|
27
|
+
name: "SizableStack",
|
|
28
|
+
backgroundColor: "$background",
|
|
29
|
+
flexDirection: "row",
|
|
30
|
+
flexShrink: 1,
|
|
31
|
+
variants: {
|
|
32
|
+
fontFamily: () => ({}),
|
|
33
|
+
hoverable: import_variants.hoverable,
|
|
34
|
+
pressable: import_variants.pressable,
|
|
35
|
+
focusable: import_variants.focusable,
|
|
36
|
+
circular: import_variants.circular,
|
|
37
|
+
pad: import_variants.pad,
|
|
38
|
+
elevate: import_variants.elevate,
|
|
39
|
+
bordered: import_variants.bordered,
|
|
40
|
+
size: {
|
|
41
|
+
"...size": import_core.getButtonSize
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
true: {
|
|
45
|
+
opacity: 0.45,
|
|
46
|
+
backgroundColor: "$background",
|
|
47
|
+
hoverStyle: {
|
|
48
|
+
backgroundColor: "$background"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
transparent: {
|
|
53
|
+
true: {
|
|
54
|
+
backgroundColor: "transparent"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
chromeless: {
|
|
58
|
+
true: {
|
|
59
|
+
backgroundColor: "transparent",
|
|
60
|
+
borderColor: "transparent",
|
|
61
|
+
shadowColor: "transparent"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
ThemeableSizableStack
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=ThemeableSizableStack.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ThemeableSizableStack.tsx"],
|
|
4
|
+
"sourcesContent": ["import { GetProps, getButtonSize, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks'\nimport { bordered, circular, elevate, focusable, hoverable, pad, pressable } from './variants'\n\nexport const ThemeableSizableStack = styled(YStack, {\n name: 'SizableStack',\n backgroundColor: '$background',\n flexDirection: 'row',\n flexShrink: 1,\n\n variants: {\n // allows the type to come in for use in size\n fontFamily: () => ({}),\n\n hoverable,\n pressable,\n focusable,\n circular,\n pad,\n elevate,\n bordered,\n\n size: {\n '...size': getButtonSize,\n },\n\n disabled: {\n true: {\n // pointerEvents: 'none',\n opacity: 0.45,\n backgroundColor: '$background',\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n },\n },\n },\n})\n\nexport type ThemeableSizableStackProps = GetProps<typeof ThemeableSizableStack>\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgD;AAEhD,oBAAuB;AACvB,sBAAkF;AAE3E,MAAM,wBAAwB,wBAAO,sBAAQ;AAAA,EAClD,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EAEZ,UAAU;AAAA,IAER,YAAY,MAAO,EAAC;AAAA,IAEpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,IAEA,UAAU;AAAA,MACR,MAAM;AAAA,QAEJ,SAAS;AAAA,QACT,iBAAiB;AAAA,QACjB,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,iBAAiB;AAAA,QACjB,aAAa;AAAA,QACb,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var ThemeableStack_exports = {};
|
|
19
|
+
__export(ThemeableStack_exports, {
|
|
20
|
+
ThemeableStack: () => ThemeableStack
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(ThemeableStack_exports);
|
|
23
|
+
var import_core = require("@tamagui/core");
|
|
24
|
+
var import_Stacks = require("./Stacks");
|
|
25
|
+
var import_variants = require("./variants");
|
|
26
|
+
const ThemeableStack = (0, import_core.styled)(import_Stacks.YStack, {
|
|
27
|
+
name: "SizableStack",
|
|
28
|
+
variants: {
|
|
29
|
+
fontFamily: () => ({}),
|
|
30
|
+
backgrounded: {
|
|
31
|
+
true: {
|
|
32
|
+
backgroundColor: "$background"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
radiused: import_variants.radiused,
|
|
36
|
+
hoverTheme: import_variants.hoverTheme,
|
|
37
|
+
pressTheme: import_variants.pressTheme,
|
|
38
|
+
focusTheme: import_variants.focusTheme,
|
|
39
|
+
circular: import_variants.circular,
|
|
40
|
+
padded: import_variants.padded,
|
|
41
|
+
elevate: import_variants.elevate,
|
|
42
|
+
bordered: import_variants.bordered,
|
|
43
|
+
transparent: {
|
|
44
|
+
true: {
|
|
45
|
+
backgroundColor: "transparent"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
chromeless: {
|
|
49
|
+
true: {
|
|
50
|
+
backgroundColor: "transparent",
|
|
51
|
+
borderColor: "transparent",
|
|
52
|
+
shadowColor: "transparent"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
58
|
+
0 && (module.exports = {
|
|
59
|
+
ThemeableStack
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=ThemeableStack.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/ThemeableStack.tsx"],
|
|
4
|
+
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks'\nimport {\n bordered,\n circular,\n elevate,\n focusTheme,\n hoverTheme,\n padded,\n pressTheme,\n radiused,\n} from './variants'\n\nexport const ThemeableStack = styled(YStack, {\n name: 'SizableStack',\n\n variants: {\n // allows the type to come in for use in size\n fontFamily: () => ({}),\n\n backgrounded: {\n true: {\n backgroundColor: '$background',\n },\n },\n\n radiused,\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n padded,\n elevate,\n bordered,\n\n transparent: {\n true: {\n backgroundColor: 'transparent',\n },\n },\n\n chromeless: {\n true: {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n },\n },\n },\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAEjC,oBAAuB;AACvB,sBASO;AAEA,MAAM,iBAAiB,wBAAO,sBAAQ;AAAA,EAC3C,MAAM;AAAA,EAEN,UAAU;AAAA,IAER,YAAY,MAAO,EAAC;AAAA,IAEpB,cAAc;AAAA,MACZ,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,aAAa;AAAA,MACX,MAAM;AAAA,QACJ,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IAEA,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,iBAAiB;AAAA,QACjB,aAAa;AAAA,QACb,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -15,4 +15,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
15
15
|
var src_exports = {};
|
|
16
16
|
module.exports = __toCommonJS(src_exports);
|
|
17
17
|
__reExport(src_exports, require("./Stacks"), module.exports);
|
|
18
|
+
__reExport(src_exports, require("./SizableStack"), module.exports);
|
|
19
|
+
__reExport(src_exports, require("./ThemeableStack"), module.exports);
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './Stacks'\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;",
|
|
4
|
+
"sourcesContent": ["export * from './Stacks'\nexport * from './SizableStack'\nexport * from './ThemeableStack'\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,qBAAd;AACA,wBAAc,2BADd;AAEA,wBAAc,6BAFd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
var variants_exports = {};
|
|
33
|
+
__export(variants_exports, {
|
|
34
|
+
bordered: () => bordered,
|
|
35
|
+
circular: () => circular,
|
|
36
|
+
elevate: () => elevate,
|
|
37
|
+
focusTheme: () => focusTheme,
|
|
38
|
+
hoverTheme: () => hoverTheme,
|
|
39
|
+
padded: () => padded,
|
|
40
|
+
pressTheme: () => pressTheme,
|
|
41
|
+
radiused: () => radiused
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(variants_exports);
|
|
44
|
+
var import_Stacks = require("./Stacks");
|
|
45
|
+
const elevate = {
|
|
46
|
+
true: (_, extras) => {
|
|
47
|
+
return (0, import_Stacks.getElevation)(extras.props["size"], extras);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const bordered = (val, { props }) => {
|
|
51
|
+
return __spreadValues(__spreadValues(__spreadValues({
|
|
52
|
+
borderWidth: typeof val === "number" ? val : 1,
|
|
53
|
+
borderColor: "$borderColor"
|
|
54
|
+
}, props.hoverTheme && {
|
|
55
|
+
hoverStyle: {
|
|
56
|
+
borderColor: "$borderColorHover"
|
|
57
|
+
}
|
|
58
|
+
}), props.pressTheme && {
|
|
59
|
+
pressStyle: {
|
|
60
|
+
borderColor: "$borderColorPress"
|
|
61
|
+
}
|
|
62
|
+
}), props.focusTheme && {
|
|
63
|
+
focusStyle: {
|
|
64
|
+
borderColor: "$borderColorFocus"
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
const padded = {
|
|
69
|
+
true: (_, extras) => {
|
|
70
|
+
const { tokens, props } = extras;
|
|
71
|
+
return {
|
|
72
|
+
padding: tokens.space[props.size] || tokens.space["$4"]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const radiused = {
|
|
77
|
+
true: (_, extras) => {
|
|
78
|
+
const { tokens, props } = extras;
|
|
79
|
+
return {
|
|
80
|
+
borderRadius: tokens.radius[props.size] || tokens.radius["$4"]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const circular = {
|
|
85
|
+
true: (_, { props, tokens }) => {
|
|
86
|
+
const size = tokens.size[props.size];
|
|
87
|
+
return {
|
|
88
|
+
width: size,
|
|
89
|
+
height: size,
|
|
90
|
+
maxWidth: size,
|
|
91
|
+
maxHeight: size,
|
|
92
|
+
minWidth: size,
|
|
93
|
+
minHeight: size,
|
|
94
|
+
borderRadius: 1e5,
|
|
95
|
+
paddingVertical: 0,
|
|
96
|
+
paddingHorizontal: 0
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const hoverTheme = {
|
|
101
|
+
true: {
|
|
102
|
+
hoverStyle: {
|
|
103
|
+
backgroundColor: "$backgroundHover",
|
|
104
|
+
borderColor: "$borderColorHover"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
false: {}
|
|
108
|
+
};
|
|
109
|
+
const pressTheme = {
|
|
110
|
+
true: {
|
|
111
|
+
pressStyle: {
|
|
112
|
+
backgroundColor: "$backgroundPress",
|
|
113
|
+
borderColor: "$borderColorPress"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
false: {}
|
|
117
|
+
};
|
|
118
|
+
const focusTheme = {
|
|
119
|
+
true: {
|
|
120
|
+
focusStyle: {
|
|
121
|
+
backgroundColor: "$backgroundFocus",
|
|
122
|
+
borderColor: "$borderColorFocus"
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
false: {}
|
|
126
|
+
};
|
|
127
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
128
|
+
0 && (module.exports = {
|
|
129
|
+
bordered,
|
|
130
|
+
circular,
|
|
131
|
+
elevate,
|
|
132
|
+
focusTheme,
|
|
133
|
+
hoverTheme,
|
|
134
|
+
padded,
|
|
135
|
+
pressTheme,
|
|
136
|
+
radiused
|
|
137
|
+
});
|
|
138
|
+
//# sourceMappingURL=variants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/variants.tsx"],
|
|
4
|
+
"sourcesContent": ["import { getElevation } from './Stacks'\n\nexport const elevate = {\n true: (_: boolean, extras: any) => {\n return getElevation(extras.props['size'], extras)\n },\n}\n\nexport const bordered = (val: boolean | number, { props }) => {\n return {\n // TODO size it with size in '...size'\n borderWidth: typeof val === 'number' ? val : 1,\n borderColor: '$borderColor',\n\n ...(props.hoverTheme && {\n hoverStyle: {\n borderColor: '$borderColorHover',\n },\n }),\n\n ...(props.pressTheme && {\n pressStyle: {\n borderColor: '$borderColorPress',\n },\n }),\n\n ...(props.focusTheme && {\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n }),\n }\n}\n\nexport const padded = {\n true: (_, extras) => {\n const { tokens, props } = extras\n return {\n padding: tokens.space[props.size] || tokens.space['$4'],\n }\n },\n}\n\nexport const radiused = {\n true: (_, extras) => {\n const { tokens, props } = extras\n return {\n borderRadius: tokens.radius[props.size] || tokens.radius['$4'],\n }\n },\n}\n\nexport const circular = {\n true: (_, { props, tokens }) => {\n const size = tokens.size[props.size]\n return {\n width: size,\n height: size,\n maxWidth: size,\n maxHeight: size,\n minWidth: size,\n minHeight: size,\n borderRadius: 100_000,\n paddingVertical: 0,\n paddingHorizontal: 0,\n }\n },\n}\n\nexport const hoverTheme = {\n true: {\n hoverStyle: {\n backgroundColor: '$backgroundHover',\n borderColor: '$borderColorHover',\n },\n },\n false: {},\n}\n\nexport const pressTheme = {\n true: {\n pressStyle: {\n backgroundColor: '$backgroundPress',\n borderColor: '$borderColorPress',\n },\n },\n false: {},\n}\n\nexport const focusTheme = {\n true: {\n focusStyle: {\n backgroundColor: '$backgroundFocus',\n borderColor: '$borderColorFocus',\n },\n },\n false: {},\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA6B;AAEtB,MAAM,UAAU;AAAA,EACrB,MAAM,CAAC,GAAY,WAAgB;AACjC,WAAO,gCAAa,OAAO,MAAM,SAAS,MAAM;AAAA,EAClD;AACF;AAEO,MAAM,WAAW,CAAC,KAAuB,EAAE,YAAY;AAC5D,SAAO;AAAA,IAEL,aAAa,OAAO,QAAQ,WAAW,MAAM;AAAA,IAC7C,aAAa;AAAA,KAET,MAAM,cAAc;AAAA,IACtB,YAAY;AAAA,MACV,aAAa;AAAA,IACf;AAAA,EACF,IAEI,MAAM,cAAc;AAAA,IACtB,YAAY;AAAA,MACV,aAAa;AAAA,IACf;AAAA,EACF,IAEI,MAAM,cAAc;AAAA,IACtB,YAAY;AAAA,MACV,aAAa;AAAA,IACf;AAAA,EACF;AAEJ;AAEO,MAAM,SAAS;AAAA,EACpB,MAAM,CAAC,GAAG,WAAW;AACnB,UAAM,EAAE,QAAQ,UAAU;AAC1B,WAAO;AAAA,MACL,SAAS,OAAO,MAAM,MAAM,SAAS,OAAO,MAAM;AAAA,IACpD;AAAA,EACF;AACF;AAEO,MAAM,WAAW;AAAA,EACtB,MAAM,CAAC,GAAG,WAAW;AACnB,UAAM,EAAE,QAAQ,UAAU;AAC1B,WAAO;AAAA,MACL,cAAc,OAAO,OAAO,MAAM,SAAS,OAAO,OAAO;AAAA,IAC3D;AAAA,EACF;AACF;AAEO,MAAM,WAAW;AAAA,EACtB,MAAM,CAAC,GAAG,EAAE,OAAO,aAAa;AAC9B,UAAM,OAAO,OAAO,KAAK,MAAM;AAC/B,WAAO;AAAA,MACL,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,UAAU;AAAA,MACV,WAAW;AAAA,MACX,UAAU;AAAA,MACV,WAAW;AAAA,MACX,cAAc;AAAA,MACd,iBAAiB;AAAA,MACjB,mBAAmB;AAAA,IACrB;AAAA,EACF;AACF;AAEO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,OAAO,CAAC;AACV;AAEO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,OAAO,CAAC;AACV;AAEO,MAAM,aAAa;AAAA,EACxB,MAAM;AAAA,IACJ,YAAY;AAAA,MACV,iBAAiB;AAAA,MACjB,aAAa;AAAA,IACf;AAAA,EACF;AAAA,EACA,OAAO,CAAC;AACV;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getButtonSize, styled } from "@tamagui/core";
|
|
2
|
+
import { YStack } from "./Stacks";
|
|
3
|
+
import { bordered, circular, elevate, focusTheme, hoverTheme, pressTheme } from "./variants";
|
|
4
|
+
const SizableStack = styled(YStack, {
|
|
5
|
+
name: "SizableStack",
|
|
6
|
+
backgroundColor: "$background",
|
|
7
|
+
flexDirection: "row",
|
|
8
|
+
flexShrink: 1,
|
|
9
|
+
variants: {
|
|
10
|
+
fontFamily: () => ({}),
|
|
11
|
+
hoverTheme,
|
|
12
|
+
pressTheme,
|
|
13
|
+
focusTheme,
|
|
14
|
+
circular,
|
|
15
|
+
elevate,
|
|
16
|
+
bordered,
|
|
17
|
+
size: {
|
|
18
|
+
"...size": getButtonSize
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
export {
|
|
23
|
+
SizableStack
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=SizableStack.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/SizableStack.tsx"],
|
|
4
|
+
"sourcesContent": ["import { GetProps, getButtonSize, styled } from '@tamagui/core'\n\nimport { YStack } from './Stacks'\nimport { bordered, circular, elevate, focusTheme, hoverTheme, pressTheme } from './variants'\n\nexport const SizableStack = styled(YStack, {\n name: 'SizableStack',\n backgroundColor: '$background',\n flexDirection: 'row',\n flexShrink: 1,\n\n variants: {\n // allows the type to come in for use in size\n fontFamily: () => ({}),\n\n hoverTheme,\n pressTheme,\n focusTheme,\n circular,\n elevate,\n bordered,\n\n size: {\n '...size': getButtonSize,\n },\n },\n})\n\nexport type SizableStackProps = GetProps<typeof SizableStack>\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AACA;AAEO,MAAM,eAAe,OAAO,QAAQ;AAAA,EACzC,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EAEZ,UAAU;AAAA,IAER,YAAY,MAAO,EAAC;AAAA,IAEpB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAEA,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,EACF;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/Stacks.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import {
|
|
4
2
|
Stack,
|
|
5
3
|
getVariableValue,
|
|
6
4
|
isVariable,
|
|
7
5
|
styled
|
|
8
6
|
} from "@tamagui/core";
|
|
9
|
-
const getElevation =
|
|
7
|
+
const getElevation = (size, extras) => {
|
|
8
|
+
if (!size)
|
|
9
|
+
return;
|
|
10
10
|
const { tokens } = extras;
|
|
11
11
|
const token = tokens.size[size];
|
|
12
12
|
const sizeNum = isVariable(token) ? +token.val : size;
|
|
13
13
|
return getSizedElevation(sizeNum, extras);
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
const fullscreenStyle = {
|
|
16
16
|
position: "absolute",
|
|
17
17
|
top: 0,
|
|
@@ -19,29 +19,23 @@ const fullscreenStyle = {
|
|
|
19
19
|
right: 0,
|
|
20
20
|
bottom: 0
|
|
21
21
|
};
|
|
22
|
+
const variants = {
|
|
23
|
+
fullscreen: {
|
|
24
|
+
true: fullscreenStyle
|
|
25
|
+
},
|
|
26
|
+
elevation: {
|
|
27
|
+
"...size": getElevation
|
|
28
|
+
}
|
|
29
|
+
};
|
|
22
30
|
const YStack = styled(Stack, {
|
|
23
31
|
flexDirection: "column",
|
|
24
32
|
name: "YStack",
|
|
25
|
-
variants
|
|
26
|
-
fullscreen: {
|
|
27
|
-
true: fullscreenStyle
|
|
28
|
-
},
|
|
29
|
-
elevation: {
|
|
30
|
-
"...size": getElevation
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
+
variants
|
|
33
34
|
});
|
|
34
35
|
const XStack = styled(Stack, {
|
|
35
36
|
flexDirection: "row",
|
|
36
37
|
name: "XStack",
|
|
37
|
-
variants
|
|
38
|
-
fullscreen: {
|
|
39
|
-
true: fullscreenStyle
|
|
40
|
-
},
|
|
41
|
-
elevation: {
|
|
42
|
-
"...size": getElevation
|
|
43
|
-
}
|
|
44
|
-
}
|
|
38
|
+
variants
|
|
45
39
|
});
|
|
46
40
|
const ZStack = styled(YStack, {
|
|
47
41
|
name: "ZStack",
|
|
@@ -50,14 +44,22 @@ const ZStack = styled(YStack, {
|
|
|
50
44
|
neverFlatten: true,
|
|
51
45
|
isZStack: true
|
|
52
46
|
});
|
|
53
|
-
const getSizedElevation =
|
|
54
|
-
|
|
47
|
+
const getSizedElevation = (val, { theme, tokens }) => {
|
|
48
|
+
let num = 0;
|
|
49
|
+
if (val === true) {
|
|
55
50
|
const val2 = getVariableValue(tokens.size["true"]);
|
|
56
51
|
if (typeof val2 === "number") {
|
|
57
|
-
|
|
52
|
+
num = val2;
|
|
53
|
+
} else {
|
|
54
|
+
num = 10;
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
} else {
|
|
57
|
+
num = +val;
|
|
58
|
+
}
|
|
59
|
+
if (process.env.NODE_ENV === "development") {
|
|
60
|
+
if (isNaN(num))
|
|
61
|
+
console.warn("NaN shadow", num, val);
|
|
62
|
+
}
|
|
61
63
|
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
62
64
|
const shadow = {
|
|
63
65
|
shadowColor: theme.shadowColor,
|
|
@@ -65,11 +67,12 @@ const getSizedElevation = /* @__PURE__ */ __name((val, { theme, tokens }) => {
|
|
|
65
67
|
shadowOffset: { height, width: 0 }
|
|
66
68
|
};
|
|
67
69
|
return shadow;
|
|
68
|
-
}
|
|
70
|
+
};
|
|
69
71
|
export {
|
|
70
72
|
XStack,
|
|
71
73
|
YStack,
|
|
72
74
|
ZStack,
|
|
75
|
+
getElevation,
|
|
73
76
|
getSizedElevation
|
|
74
77
|
};
|
|
75
78
|
//# sourceMappingURL=Stacks.js.map
|