@tamagui/stacks 1.0.1-beta.21 → 1.0.1-beta.210
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 +11 -65
- package/dist/cjs/SizableStack.js.map +2 -2
- package/dist/cjs/Stacks.js +43 -32
- package/dist/cjs/Stacks.js.map +3 -3
- package/dist/cjs/ThemeableStack.js +69 -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 +128 -0
- package/dist/cjs/variants.js.map +7 -0
- package/dist/esm/SizableStack.js +12 -67
- package/dist/esm/SizableStack.js.map +2 -2
- package/dist/esm/Stacks.js +41 -33
- package/dist/esm/Stacks.js.map +3 -3
- package/dist/esm/ThemeableStack.js +54 -0
- package/dist/esm/ThemeableStack.js.map +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/esm/variants.js +97 -0
- package/dist/esm/variants.js.map +7 -0
- package/dist/jsx/.tamagui-dynamic-eval-SizableStack.js.js +23 -0
- package/dist/jsx/SizableStack.js +13 -67
- package/dist/jsx/SizableStack.js.map +7 -0
- package/dist/jsx/Stacks.js +42 -33
- package/dist/jsx/Stacks.js.map +7 -0
- package/dist/jsx/ThemeableStack.js +54 -0
- package/dist/jsx/ThemeableStack.js.map +7 -0
- package/dist/jsx/index.js +2 -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 +12 -6
- package/src/SizableStack.tsx +30 -0
- package/src/Stacks.tsx +94 -0
- package/src/ThemeableStack.tsx +61 -0
- package/src/index.ts +3 -0
- package/src/variants.tsx +98 -0
- package/types/SizableStack.d.ts +47 -51
- package/types/Stacks.d.ts +54 -50
- package/types/ThemeableStack.d.ts +68 -0
- package/types/index.d.ts +1 -0
- package/types/variants.d.ts +285 -0
- package/types/SizableStack.d.ts.map +0 -1
- package/types/Stacks.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
package/dist/cjs/SizableStack.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -21,79 +22,24 @@ __export(SizableStack_exports, {
|
|
|
21
22
|
});
|
|
22
23
|
module.exports = __toCommonJS(SizableStack_exports);
|
|
23
24
|
var import_core = require("@tamagui/core");
|
|
25
|
+
var import_get_button_sized = require("@tamagui/get-button-sized");
|
|
24
26
|
var import_Stacks = require("./Stacks");
|
|
25
|
-
|
|
27
|
+
var import_variants = require("./variants");
|
|
28
|
+
const SizableStack = (0, import_core.styled)(import_Stacks.YStack, {
|
|
26
29
|
name: "SizableStack",
|
|
27
30
|
backgroundColor: "$background",
|
|
28
31
|
flexDirection: "row",
|
|
29
32
|
flexShrink: 1,
|
|
30
33
|
variants: {
|
|
31
34
|
fontFamily: () => ({}),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
false: {
|
|
40
|
-
hoverStyle: {
|
|
41
|
-
backgroundColor: "$background",
|
|
42
|
-
borderColor: "$borderColor"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
pressable: {
|
|
47
|
-
true: {
|
|
48
|
-
pressStyle: {
|
|
49
|
-
backgroundColor: "$backgroundPress",
|
|
50
|
-
borderColor: "$borderColorPress"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
false: {
|
|
54
|
-
pressStyle: {
|
|
55
|
-
backgroundColor: "$background",
|
|
56
|
-
borderColor: "$borderColor"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
focusable: {
|
|
61
|
-
true: {
|
|
62
|
-
focusStyle: {
|
|
63
|
-
backgroundColor: "$backgroundFocus",
|
|
64
|
-
borderColor: "$borderColorFocus"
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
bordered: {
|
|
69
|
-
true: {
|
|
70
|
-
borderWidth: 1,
|
|
71
|
-
borderColor: "$borderColor"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
35
|
+
hoverTheme: import_variants.hoverTheme,
|
|
36
|
+
pressTheme: import_variants.pressTheme,
|
|
37
|
+
focusTheme: import_variants.focusTheme,
|
|
38
|
+
circular: import_variants.circular,
|
|
39
|
+
elevate: import_variants.elevate,
|
|
40
|
+
bordered: import_variants.bordered,
|
|
74
41
|
size: {
|
|
75
|
-
"...size":
|
|
76
|
-
},
|
|
77
|
-
disabled: {
|
|
78
|
-
true: {
|
|
79
|
-
opacity: 0.45,
|
|
80
|
-
backgroundColor: "$background",
|
|
81
|
-
hoverStyle: {
|
|
82
|
-
backgroundColor: "$background"
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
transparent: {
|
|
87
|
-
true: {
|
|
88
|
-
backgroundColor: "transparent"
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
chromeless: {
|
|
92
|
-
true: {
|
|
93
|
-
backgroundColor: "transparent",
|
|
94
|
-
borderColor: "transparent",
|
|
95
|
-
shadowColor: "transparent"
|
|
96
|
-
}
|
|
42
|
+
"...size": import_get_button_sized.getButtonSized
|
|
97
43
|
}
|
|
98
44
|
}
|
|
99
45
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SizableStack.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps,
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\nimport { getButtonSized } from '@tamagui/get-button-sized'\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': getButtonSized,\n },\n } as const,\n})\n\nexport type SizableStackProps = GetProps<typeof SizableStack>\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AACjC,8BAA+B;AAE/B,oBAAuB;AACvB,sBAAgF;AAEzE,MAAM,mBAAe,oBAAO,sBAAQ;AAAA,EACzC,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EAEZ,UAAU;AAAA,IAER,YAAY,OAAO,CAAC;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
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/Stacks.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
6
|
var __export = (target, all) => {
|
|
7
7
|
for (var name in all)
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -21,16 +21,19 @@ __export(Stacks_exports, {
|
|
|
21
21
|
XStack: () => XStack,
|
|
22
22
|
YStack: () => YStack,
|
|
23
23
|
ZStack: () => ZStack,
|
|
24
|
+
getElevation: () => getElevation,
|
|
24
25
|
getSizedElevation: () => getSizedElevation
|
|
25
26
|
});
|
|
26
27
|
module.exports = __toCommonJS(Stacks_exports);
|
|
27
28
|
var import_core = require("@tamagui/core");
|
|
28
|
-
const getElevation =
|
|
29
|
+
const getElevation = (size, extras) => {
|
|
30
|
+
if (!size)
|
|
31
|
+
return;
|
|
29
32
|
const { tokens } = extras;
|
|
30
33
|
const token = tokens.size[size];
|
|
31
34
|
const sizeNum = (0, import_core.isVariable)(token) ? +token.val : size;
|
|
32
35
|
return getSizedElevation(sizeNum, extras);
|
|
33
|
-
}
|
|
36
|
+
};
|
|
34
37
|
const fullscreenStyle = {
|
|
35
38
|
position: "absolute",
|
|
36
39
|
top: 0,
|
|
@@ -38,45 +41,52 @@ const fullscreenStyle = {
|
|
|
38
41
|
right: 0,
|
|
39
42
|
bottom: 0
|
|
40
43
|
};
|
|
44
|
+
const variants = {
|
|
45
|
+
fullscreen: {
|
|
46
|
+
true: fullscreenStyle
|
|
47
|
+
},
|
|
48
|
+
elevation: {
|
|
49
|
+
"...size": getElevation
|
|
50
|
+
}
|
|
51
|
+
};
|
|
41
52
|
const YStack = (0, import_core.styled)(import_core.Stack, {
|
|
42
53
|
flexDirection: "column",
|
|
43
54
|
name: "YStack",
|
|
44
|
-
variants
|
|
45
|
-
fullscreen: {
|
|
46
|
-
true: fullscreenStyle
|
|
47
|
-
},
|
|
48
|
-
elevation: {
|
|
49
|
-
"...size": getElevation
|
|
50
|
-
}
|
|
51
|
-
}
|
|
55
|
+
variants
|
|
52
56
|
});
|
|
53
57
|
const XStack = (0, import_core.styled)(import_core.Stack, {
|
|
54
58
|
flexDirection: "row",
|
|
55
59
|
name: "XStack",
|
|
56
|
-
variants
|
|
57
|
-
fullscreen: {
|
|
58
|
-
true: fullscreenStyle
|
|
59
|
-
},
|
|
60
|
-
elevation: {
|
|
61
|
-
"...size": getElevation
|
|
62
|
-
}
|
|
63
|
-
}
|
|
60
|
+
variants
|
|
64
61
|
});
|
|
65
|
-
const ZStack = (0, import_core.styled)(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
const ZStack = (0, import_core.styled)(
|
|
63
|
+
YStack,
|
|
64
|
+
{
|
|
65
|
+
name: "ZStack",
|
|
66
|
+
position: "relative"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
neverFlatten: true,
|
|
70
|
+
isZStack: true
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
const getSizedElevation = (val, { theme, tokens }) => {
|
|
74
|
+
let num = 0;
|
|
75
|
+
if (val === true) {
|
|
74
76
|
const val2 = (0, import_core.getVariableValue)(tokens.size["true"]);
|
|
75
77
|
if (typeof val2 === "number") {
|
|
76
|
-
|
|
78
|
+
num = val2;
|
|
79
|
+
} else {
|
|
80
|
+
num = 10;
|
|
77
81
|
}
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
} else {
|
|
83
|
+
num = +val;
|
|
84
|
+
}
|
|
85
|
+
if (process.env.NODE_ENV === "development") {
|
|
86
|
+
if (num !== null && isNaN(num)) {
|
|
87
|
+
console.warn("NaN shadow", num, val);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
80
90
|
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)];
|
|
81
91
|
const shadow = {
|
|
82
92
|
shadowColor: theme.shadowColor,
|
|
@@ -84,12 +94,13 @@ const getSizedElevation = /* @__PURE__ */ __name((val, { theme, tokens }) => {
|
|
|
84
94
|
shadowOffset: { height, width: 0 }
|
|
85
95
|
};
|
|
86
96
|
return shadow;
|
|
87
|
-
}
|
|
97
|
+
};
|
|
88
98
|
// Annotate the CommonJS export names for ESM import in node:
|
|
89
99
|
0 && (module.exports = {
|
|
90
100
|
XStack,
|
|
91
101
|
YStack,
|
|
92
102
|
ZStack,
|
|
103
|
+
getElevation,
|
|
93
104
|
getSizedElevation
|
|
94
105
|
});
|
|
95
106
|
//# 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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAUO;
|
|
6
|
-
"names": []
|
|
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 (num !== null && isNaN(num)) {\n // eslint-disable-next-line no-console\n console.warn('NaN shadow', num, val)\n }\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,OAAO,IAAI;AACnB,QAAM,QAAQ,OAAO,KAAK;AAC1B,QAAM,cAAW,wBAAW,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,aAAS,oBAAO,mBAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,aAAS,oBAAO,mBAAO;AAAA,EAClC,eAAe;AAAA,EACf,MAAM;AAAA,EACN;AACF,CAAC;AAEM,MAAM,aAAS;AAAA,EACpB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,cAAc;AAAA,IACd,UAAU;AAAA,EACZ;AACF;AAEO,MAAM,oBAAoB,CAC/B,KACA,EAAE,OAAO,OAAO,MACb;AACH,MAAI,MAAM;AACV,MAAI,QAAQ,MAAM;AAChB,UAAMA,WAAM,8BAAiB,OAAO,KAAK,OAAO;AAChD,QAAI,OAAOA,SAAQ,UAAU;AAC3B,YAAMA;AAAA,IACR,OAAO;AACL,YAAM;AAAA,IACR;AAAA,EACF,OAAO;AACL,UAAM,CAAC;AAAA,EACT;AACA,MAAI,QAAQ,IAAI,aAAa,eAAe;AAC1C,QAAI,QAAQ,QAAQ,MAAM,GAAG,GAAG;AAE9B,cAAQ,KAAK,cAAc,KAAK,GAAG;AAAA,IACrC;AAAA,EACF;AACA,QAAM,CAAC,QAAQ,YAAY,IAAI,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
|
+
"names": ["val"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ThemeableStack_exports = {};
|
|
20
|
+
__export(ThemeableStack_exports, {
|
|
21
|
+
ThemeableStack: () => ThemeableStack
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ThemeableStack_exports);
|
|
24
|
+
var import_core = require("@tamagui/core");
|
|
25
|
+
var import_Stacks = require("./Stacks");
|
|
26
|
+
var import_variants = require("./variants");
|
|
27
|
+
const chromelessStyle = {
|
|
28
|
+
backgroundColor: "transparent",
|
|
29
|
+
borderColor: "transparent",
|
|
30
|
+
shadowColor: "transparent"
|
|
31
|
+
};
|
|
32
|
+
const ThemeableStack = (0, import_core.styled)(import_Stacks.YStack, {
|
|
33
|
+
name: "SizableStack",
|
|
34
|
+
variants: {
|
|
35
|
+
fontFamily: () => ({}),
|
|
36
|
+
backgrounded: {
|
|
37
|
+
true: {
|
|
38
|
+
backgroundColor: "$background"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
radiused: import_variants.radiused,
|
|
42
|
+
hoverTheme: import_variants.hoverTheme,
|
|
43
|
+
pressTheme: import_variants.pressTheme,
|
|
44
|
+
focusTheme: import_variants.focusTheme,
|
|
45
|
+
circular: import_variants.circular,
|
|
46
|
+
padded: import_variants.padded,
|
|
47
|
+
elevate: import_variants.elevate,
|
|
48
|
+
bordered: import_variants.bordered,
|
|
49
|
+
transparent: {
|
|
50
|
+
true: {
|
|
51
|
+
backgroundColor: "transparent"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
chromeless: {
|
|
55
|
+
true: chromelessStyle,
|
|
56
|
+
all: {
|
|
57
|
+
...chromelessStyle,
|
|
58
|
+
hoverStyle: chromelessStyle,
|
|
59
|
+
pressStyle: chromelessStyle,
|
|
60
|
+
focusStyle: chromelessStyle
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
ThemeableStack
|
|
68
|
+
});
|
|
69
|
+
//# 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\nconst chromelessStyle = {\n backgroundColor: 'transparent',\n borderColor: 'transparent',\n shadowColor: 'transparent',\n}\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: chromelessStyle,\n all: {\n ...chromelessStyle,\n hoverStyle: chromelessStyle,\n pressStyle: chromelessStyle,\n focusStyle: chromelessStyle,\n },\n },\n } as const,\n})\n\nexport type ThemeableStackProps = GetProps<typeof ThemeableStack>\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiC;AAEjC,oBAAuB;AACvB,sBASO;AAEP,MAAM,kBAAkB;AAAA,EACtB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,aAAa;AACf;AAEO,MAAM,qBAAiB,oBAAO,sBAAQ;AAAA,EAC3C,MAAM;AAAA,EAEN,UAAU;AAAA,IAER,YAAY,OAAO,CAAC;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,MACN,KAAK;AAAA,QACH,GAAG;AAAA,QACH,YAAY;AAAA,QACZ,YAAY;AAAA,QACZ,YAAY;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -16,4 +17,5 @@ var src_exports = {};
|
|
|
16
17
|
module.exports = __toCommonJS(src_exports);
|
|
17
18
|
__reExport(src_exports, require("./Stacks"), module.exports);
|
|
18
19
|
__reExport(src_exports, require("./SizableStack"), module.exports);
|
|
20
|
+
__reExport(src_exports, require("./ThemeableStack"), module.exports);
|
|
19
21
|
//# 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'\nexport * from './SizableStack'\n"],
|
|
5
|
-
"mappings": "
|
|
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,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var variants_exports = {};
|
|
20
|
+
__export(variants_exports, {
|
|
21
|
+
bordered: () => bordered,
|
|
22
|
+
circular: () => circular,
|
|
23
|
+
elevate: () => elevate,
|
|
24
|
+
focusTheme: () => focusTheme,
|
|
25
|
+
hoverTheme: () => hoverTheme,
|
|
26
|
+
padded: () => padded,
|
|
27
|
+
pressTheme: () => pressTheme,
|
|
28
|
+
radiused: () => radiused
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(variants_exports);
|
|
31
|
+
var import_Stacks = require("./Stacks");
|
|
32
|
+
const elevate = {
|
|
33
|
+
true: (_, extras) => {
|
|
34
|
+
return (0, import_Stacks.getElevation)(extras.props["size"], extras);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const bordered = (val, { props }) => {
|
|
38
|
+
return {
|
|
39
|
+
borderWidth: typeof val === "number" ? val : 1,
|
|
40
|
+
borderColor: "$borderColor",
|
|
41
|
+
...props.hoverTheme && {
|
|
42
|
+
hoverStyle: {
|
|
43
|
+
borderColor: "$borderColorHover"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
...props.pressTheme && {
|
|
47
|
+
pressStyle: {
|
|
48
|
+
borderColor: "$borderColorPress"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
...props.focusTheme && {
|
|
52
|
+
focusStyle: {
|
|
53
|
+
borderColor: "$borderColorFocus"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const padded = {
|
|
59
|
+
true: (_, extras) => {
|
|
60
|
+
const { tokens, props } = extras;
|
|
61
|
+
return {
|
|
62
|
+
padding: tokens.space[props.size] || tokens.space["$4"]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const radiused = {
|
|
67
|
+
true: (_, extras) => {
|
|
68
|
+
const { tokens, props } = extras;
|
|
69
|
+
return {
|
|
70
|
+
borderRadius: tokens.radius[props.size] || tokens.radius["$4"]
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const circular = {
|
|
75
|
+
true: (_, { props, tokens }) => {
|
|
76
|
+
const size = tokens.size[props.size];
|
|
77
|
+
return {
|
|
78
|
+
width: size,
|
|
79
|
+
height: size,
|
|
80
|
+
maxWidth: size,
|
|
81
|
+
maxHeight: size,
|
|
82
|
+
minWidth: size,
|
|
83
|
+
minHeight: size,
|
|
84
|
+
borderRadius: 1e5,
|
|
85
|
+
paddingVertical: 0,
|
|
86
|
+
paddingHorizontal: 0
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
const hoverTheme = {
|
|
91
|
+
true: {
|
|
92
|
+
hoverStyle: {
|
|
93
|
+
backgroundColor: "$backgroundHover",
|
|
94
|
+
borderColor: "$borderColorHover"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
false: {}
|
|
98
|
+
};
|
|
99
|
+
const pressTheme = {
|
|
100
|
+
true: {
|
|
101
|
+
pressStyle: {
|
|
102
|
+
backgroundColor: "$backgroundPress",
|
|
103
|
+
borderColor: "$borderColorPress"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
false: {}
|
|
107
|
+
};
|
|
108
|
+
const focusTheme = {
|
|
109
|
+
true: {
|
|
110
|
+
focusStyle: {
|
|
111
|
+
backgroundColor: "$backgroundFocus",
|
|
112
|
+
borderColor: "$borderColorFocus"
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
false: {}
|
|
116
|
+
};
|
|
117
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
+
0 && (module.exports = {
|
|
119
|
+
bordered,
|
|
120
|
+
circular,
|
|
121
|
+
elevate,
|
|
122
|
+
focusTheme,
|
|
123
|
+
hoverTheme,
|
|
124
|
+
padded,
|
|
125
|
+
pressTheme,
|
|
126
|
+
radiused
|
|
127
|
+
});
|
|
128
|
+
//# 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,eAAO,4BAAa,OAAO,MAAM,SAAS,MAAM;AAAA,EAClD;AACF;AAEO,MAAM,WAAW,CAAC,KAAuB,EAAE,MAAM,MAAM;AAC5D,SAAO;AAAA,IAEL,aAAa,OAAO,QAAQ,WAAW,MAAM;AAAA,IAC7C,aAAa;AAAA,IAEb,GAAI,MAAM,cAAc;AAAA,MACtB,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IAEA,GAAI,MAAM,cAAc;AAAA,MACtB,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IAEA,GAAI,MAAM,cAAc;AAAA,MACtB,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,EACF;AACF;AAEO,MAAM,SAAS;AAAA,EACpB,MAAM,CAAC,GAAG,WAAW;AACnB,UAAM,EAAE,QAAQ,MAAM,IAAI;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,MAAM,IAAI;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,OAAO,MAAM;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
|
+
}
|
package/dist/esm/SizableStack.js
CHANGED
|
@@ -1,77 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { styled } from "@tamagui/core";
|
|
2
|
+
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
3
|
+
import { YStack } from "./Stacks";
|
|
4
|
+
import { bordered, circular, elevate, focusTheme, hoverTheme, pressTheme } from "./variants";
|
|
5
|
+
const SizableStack = styled(YStack, {
|
|
4
6
|
name: "SizableStack",
|
|
5
7
|
backgroundColor: "$background",
|
|
6
8
|
flexDirection: "row",
|
|
7
9
|
flexShrink: 1,
|
|
8
10
|
variants: {
|
|
9
11
|
fontFamily: () => ({}),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
false: {
|
|
18
|
-
hoverStyle: {
|
|
19
|
-
backgroundColor: "$background",
|
|
20
|
-
borderColor: "$borderColor"
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
pressable: {
|
|
25
|
-
true: {
|
|
26
|
-
pressStyle: {
|
|
27
|
-
backgroundColor: "$backgroundPress",
|
|
28
|
-
borderColor: "$borderColorPress"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
false: {
|
|
32
|
-
pressStyle: {
|
|
33
|
-
backgroundColor: "$background",
|
|
34
|
-
borderColor: "$borderColor"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
focusable: {
|
|
39
|
-
true: {
|
|
40
|
-
focusStyle: {
|
|
41
|
-
backgroundColor: "$backgroundFocus",
|
|
42
|
-
borderColor: "$borderColorFocus"
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
bordered: {
|
|
47
|
-
true: {
|
|
48
|
-
borderWidth: 1,
|
|
49
|
-
borderColor: "$borderColor"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
12
|
+
hoverTheme,
|
|
13
|
+
pressTheme,
|
|
14
|
+
focusTheme,
|
|
15
|
+
circular,
|
|
16
|
+
elevate,
|
|
17
|
+
bordered,
|
|
52
18
|
size: {
|
|
53
|
-
"...size":
|
|
54
|
-
},
|
|
55
|
-
disabled: {
|
|
56
|
-
true: {
|
|
57
|
-
opacity: 0.45,
|
|
58
|
-
backgroundColor: "$background",
|
|
59
|
-
hoverStyle: {
|
|
60
|
-
backgroundColor: "$background"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
transparent: {
|
|
65
|
-
true: {
|
|
66
|
-
backgroundColor: "transparent"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
chromeless: {
|
|
70
|
-
true: {
|
|
71
|
-
backgroundColor: "transparent",
|
|
72
|
-
borderColor: "transparent",
|
|
73
|
-
shadowColor: "transparent"
|
|
74
|
-
}
|
|
19
|
+
"...size": getButtonSized
|
|
75
20
|
}
|
|
76
21
|
}
|
|
77
22
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/SizableStack.tsx"],
|
|
4
|
-
"sourcesContent": ["import { GetProps,
|
|
5
|
-
"mappings": "AAAA
|
|
4
|
+
"sourcesContent": ["import { GetProps, styled } from '@tamagui/core'\nimport { getButtonSized } from '@tamagui/get-button-sized'\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': getButtonSized,\n },\n } as const,\n})\n\nexport type SizableStackProps = GetProps<typeof SizableStack>\n"],
|
|
5
|
+
"mappings": "AAAA,SAAmB,cAAc;AACjC,SAAS,sBAAsB;AAE/B,SAAS,cAAc;AACvB,SAAS,UAAU,UAAU,SAAS,YAAY,YAAY,kBAAkB;AAEzE,MAAM,eAAe,OAAO,QAAQ;AAAA,EACzC,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,YAAY;AAAA,EAEZ,UAAU;AAAA,IAER,YAAY,OAAO,CAAC;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
6
|
"names": []
|
|
7
7
|
}
|