@tamagui/card 1.0.1-beta.139 → 1.0.1-beta.142
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/Card.js +4 -15
- package/dist/cjs/Card.js.map +2 -2
- package/dist/cjs/index.js +0 -0
- package/dist/cjs/index.js.map +0 -0
- package/dist/esm/Card.js +3 -12
- package/dist/esm/Card.js.map +2 -2
- package/dist/esm/index.js +0 -0
- package/dist/esm/index.js.map +0 -0
- package/dist/jsx/Card.js +5 -13
- package/dist/jsx/Card.js.map +2 -2
- package/dist/jsx/index.js +0 -0
- package/dist/jsx/index.js.map +0 -0
- package/package.json +12 -5
- package/src/Card.tsx +19 -19
- package/types/Card.d.ts +6 -12
- package/types/index.d.ts +0 -0
package/dist/cjs/Card.js
CHANGED
|
@@ -25,19 +25,13 @@ __export(Card_exports, {
|
|
|
25
25
|
CardBackground: () => CardBackground,
|
|
26
26
|
CardFooter: () => CardFooter,
|
|
27
27
|
CardFrame: () => CardFrame,
|
|
28
|
-
CardHeader: () => CardHeader
|
|
29
|
-
createCardScope: () => createCardScope,
|
|
30
|
-
useCardContext: () => useCardContext
|
|
28
|
+
CardHeader: () => CardHeader
|
|
31
29
|
});
|
|
32
30
|
module.exports = __toCommonJS(Card_exports);
|
|
33
31
|
var import_core = require("@tamagui/core");
|
|
34
|
-
var import_create_context = require("@tamagui/create-context");
|
|
35
32
|
var import_stacks = require("@tamagui/stacks");
|
|
36
33
|
var import_react = __toESM(require("react"));
|
|
37
34
|
import_react.default["createElement"];
|
|
38
|
-
const CARD_NAME = "CARD";
|
|
39
|
-
const [createCardContext, createCardScope] = (0, import_create_context.createContextScope)(CARD_NAME);
|
|
40
|
-
const [CardProvider, useCardContext] = createCardContext(CARD_NAME);
|
|
41
35
|
const CardFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
42
36
|
name: "Card",
|
|
43
37
|
backgroundColor: "$background",
|
|
@@ -87,10 +81,7 @@ const CardBackground = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
87
81
|
padding: 0
|
|
88
82
|
});
|
|
89
83
|
const Card = (0, import_core.withStaticProperties)(CardFrame.extractable((0, import_core.themeable)((0, import_react.forwardRef)(({ size, __scopeCard, children, ...props }, ref) => {
|
|
90
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
91
|
-
scope: __scopeCard,
|
|
92
|
-
size
|
|
93
|
-
}, /* @__PURE__ */ import_react.default.createElement(CardFrame, {
|
|
84
|
+
return /* @__PURE__ */ import_react.default.createElement(CardFrame, {
|
|
94
85
|
ref,
|
|
95
86
|
...props
|
|
96
87
|
}, import_react.default.Children.map(children, (child) => {
|
|
@@ -100,7 +91,7 @@ const Card = (0, import_core.withStaticProperties)(CardFrame.extractable((0, imp
|
|
|
100
91
|
});
|
|
101
92
|
}
|
|
102
93
|
return child;
|
|
103
|
-
}))
|
|
94
|
+
}));
|
|
104
95
|
}))), {
|
|
105
96
|
Header: CardHeader,
|
|
106
97
|
Footer: CardFooter,
|
|
@@ -112,8 +103,6 @@ const Card = (0, import_core.withStaticProperties)(CardFrame.extractable((0, imp
|
|
|
112
103
|
CardBackground,
|
|
113
104
|
CardFooter,
|
|
114
105
|
CardFrame,
|
|
115
|
-
CardHeader
|
|
116
|
-
createCardScope,
|
|
117
|
-
useCardContext
|
|
106
|
+
CardHeader
|
|
118
107
|
});
|
|
119
108
|
//# sourceMappingURL=Card.js.map
|
package/dist/cjs/Card.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Card.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n isTamaguiElement,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { ScopedProps, createContextScope } from '@tamagui/create-context'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport React, { cloneElement, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n isTamaguiElement,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { ScopedProps, createContextScope } from '@tamagui/create-context'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport React, { cloneElement, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// const CARD_NAME = 'CARD'\n\n// type CardContextValue = {\n// size?: SizeTokens\n// }\n\n// const [createCardContext, createCardScope] = createContextScope(CARD_NAME)\n// const [CardProvider, useCardContext] = createCardContext<CardContextValue>(CARD_NAME)\n\nexport const CardFrame = styled(ThemeableStack, {\n name: 'Card',\n backgroundColor: '$background',\n position: 'relative',\n overflow: 'hidden',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n borderRadius: tokens.radius[val] ?? val,\n }\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const CardHeader = styled(ThemeableStack, {\n name: 'CardHeader',\n zIndex: 10,\n backgroundColor: 'transparent',\n marginBottom: 'auto',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n padding: tokens.space[val] ?? val,\n }\n },\n },\n },\n})\n\nexport const CardFooter = styled(CardHeader, {\n name: 'CardFooter',\n zIndex: 5,\n flexDirection: 'row',\n marginTop: 'auto',\n marginBottom: 0,\n})\n\nexport const CardBackground = styled(ThemeableStack, {\n name: 'CardBackground',\n zIndex: 0,\n fullscreen: true,\n overflow: 'hidden',\n pointerEvents: 'none',\n padding: 0,\n})\n\nexport type CardHeaderProps = GetProps<typeof CardHeader>\nexport type CardFooterProps = GetProps<typeof CardFooter>\n\nexport type CardProps = GetProps<typeof CardFrame>\n\nexport const Card = withStaticProperties(\n CardFrame.extractable(\n themeable(\n forwardRef<HTMLElement | View, ScopedProps<CardProps, 'Card'>>(\n ({ size, __scopeCard, children, ...props }, ref) => {\n return (\n // <CardProvider scope={__scopeCard} size={size}>\n <CardFrame ref={ref} {...props}>\n {React.Children.map(children, (child) => {\n if (isTamaguiElement(child) && !child.props.size) {\n return cloneElement(child, {\n size,\n })\n }\n return child\n })}\n </CardFrame>\n // </CardProvider>\n )\n }\n )\n )\n ),\n {\n Header: CardHeader,\n Footer: CardFooter,\n Background: CardBackground,\n }\n)\n\n// export { createCardScope, useCardContext }\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAOO;AAEP,oBAA+B;AAC/B,mBAAgD;AAIhD,qBAAM;AAWC,MAAM,YAAY,wBAAO,8BAAgB;AAAA,EAC9C,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,UAAU;AAAA,EAEV,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,aAAa;AAC9B,eAAO;AAAA,UACL,cAAc,OAAO,OAAO,QAAQ;AAAA,QACtC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;AAEM,MAAM,aAAa,wBAAO,8BAAgB;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,cAAc;AAAA,EAEd,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,aAAa;AAC9B,eAAO;AAAA,UACL,SAAS,OAAO,MAAM,QAAQ;AAAA,QAChC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,MAAM,aAAa,wBAAO,YAAY;AAAA,EAC3C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc;AAChB,CAAC;AAEM,MAAM,iBAAiB,wBAAO,8BAAgB;AAAA,EACnD,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EACf,SAAS;AACX,CAAC;AAOM,MAAM,OAAO,sCAClB,UAAU,YACR,2BACE,6BACE,CAAC,EAAE,MAAM,aAAa,aAAa,SAAS,QAAQ;AAClD,SAEE,mDAAC;AAAA,IAAU;AAAA,IAAW,GAAG;AAAA,KACtB,qBAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,QAAI,kCAAiB,KAAK,KAAK,CAAC,MAAM,MAAM,MAAM;AAChD,aAAO,+BAAa,OAAO;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT,CAAC,CACH;AAGJ,CACF,CACF,CACF,GACA;AAAA,EACE,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AACd,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/index.js
CHANGED
|
File without changes
|
package/dist/cjs/index.js.map
CHANGED
|
File without changes
|
package/dist/esm/Card.js
CHANGED
|
@@ -4,13 +4,9 @@ import {
|
|
|
4
4
|
themeable,
|
|
5
5
|
withStaticProperties
|
|
6
6
|
} from "@tamagui/core";
|
|
7
|
-
import { createContextScope } from "@tamagui/create-context";
|
|
8
7
|
import { ThemeableStack } from "@tamagui/stacks";
|
|
9
8
|
import React, { cloneElement, forwardRef } from "react";
|
|
10
9
|
React["createElement"];
|
|
11
|
-
const CARD_NAME = "CARD";
|
|
12
|
-
const [createCardContext, createCardScope] = createContextScope(CARD_NAME);
|
|
13
|
-
const [CardProvider, useCardContext] = createCardContext(CARD_NAME);
|
|
14
10
|
const CardFrame = styled(ThemeableStack, {
|
|
15
11
|
name: "Card",
|
|
16
12
|
backgroundColor: "$background",
|
|
@@ -60,10 +56,7 @@ const CardBackground = styled(ThemeableStack, {
|
|
|
60
56
|
padding: 0
|
|
61
57
|
});
|
|
62
58
|
const Card = withStaticProperties(CardFrame.extractable(themeable(forwardRef(({ size, __scopeCard, children, ...props }, ref) => {
|
|
63
|
-
return /* @__PURE__ */ React.createElement(
|
|
64
|
-
scope: __scopeCard,
|
|
65
|
-
size
|
|
66
|
-
}, /* @__PURE__ */ React.createElement(CardFrame, {
|
|
59
|
+
return /* @__PURE__ */ React.createElement(CardFrame, {
|
|
67
60
|
ref,
|
|
68
61
|
...props
|
|
69
62
|
}, React.Children.map(children, (child) => {
|
|
@@ -73,7 +66,7 @@ const Card = withStaticProperties(CardFrame.extractable(themeable(forwardRef(({
|
|
|
73
66
|
});
|
|
74
67
|
}
|
|
75
68
|
return child;
|
|
76
|
-
}))
|
|
69
|
+
}));
|
|
77
70
|
}))), {
|
|
78
71
|
Header: CardHeader,
|
|
79
72
|
Footer: CardFooter,
|
|
@@ -84,8 +77,6 @@ export {
|
|
|
84
77
|
CardBackground,
|
|
85
78
|
CardFooter,
|
|
86
79
|
CardFrame,
|
|
87
|
-
CardHeader
|
|
88
|
-
createCardScope,
|
|
89
|
-
useCardContext
|
|
80
|
+
CardHeader
|
|
90
81
|
};
|
|
91
82
|
//# sourceMappingURL=Card.js.map
|
package/dist/esm/Card.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Card.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n isTamaguiElement,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { ScopedProps, createContextScope } from '@tamagui/create-context'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport React, { cloneElement, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\
|
|
5
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n isTamaguiElement,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { ScopedProps, createContextScope } from '@tamagui/create-context'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport React, { cloneElement, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// const CARD_NAME = 'CARD'\n\n// type CardContextValue = {\n// size?: SizeTokens\n// }\n\n// const [createCardContext, createCardScope] = createContextScope(CARD_NAME)\n// const [CardProvider, useCardContext] = createCardContext<CardContextValue>(CARD_NAME)\n\nexport const CardFrame = styled(ThemeableStack, {\n name: 'Card',\n backgroundColor: '$background',\n position: 'relative',\n overflow: 'hidden',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n borderRadius: tokens.radius[val] ?? val,\n }\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const CardHeader = styled(ThemeableStack, {\n name: 'CardHeader',\n zIndex: 10,\n backgroundColor: 'transparent',\n marginBottom: 'auto',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n padding: tokens.space[val] ?? val,\n }\n },\n },\n },\n})\n\nexport const CardFooter = styled(CardHeader, {\n name: 'CardFooter',\n zIndex: 5,\n flexDirection: 'row',\n marginTop: 'auto',\n marginBottom: 0,\n})\n\nexport const CardBackground = styled(ThemeableStack, {\n name: 'CardBackground',\n zIndex: 0,\n fullscreen: true,\n overflow: 'hidden',\n pointerEvents: 'none',\n padding: 0,\n})\n\nexport type CardHeaderProps = GetProps<typeof CardHeader>\nexport type CardFooterProps = GetProps<typeof CardFooter>\n\nexport type CardProps = GetProps<typeof CardFrame>\n\nexport const Card = withStaticProperties(\n CardFrame.extractable(\n themeable(\n forwardRef<HTMLElement | View, ScopedProps<CardProps, 'Card'>>(\n ({ size, __scopeCard, children, ...props }, ref) => {\n return (\n // <CardProvider scope={__scopeCard} size={size}>\n <CardFrame ref={ref} {...props}>\n {React.Children.map(children, (child) => {\n if (isTamaguiElement(child) && !child.props.size) {\n return cloneElement(child, {\n size,\n })\n }\n return child\n })}\n </CardFrame>\n // </CardProvider>\n )\n }\n )\n )\n ),\n {\n Header: CardHeader,\n Footer: CardFooter,\n Background: CardBackground,\n }\n)\n\n// export { createCardScope, useCardContext }\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;AACA;AAIA,MAAM;AAWC,MAAM,YAAY,OAAO,gBAAgB;AAAA,EAC9C,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,UAAU;AAAA,EAEV,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,aAAa;AAC9B,eAAO;AAAA,UACL,cAAc,OAAO,OAAO,QAAQ;AAAA,QACtC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;AAEM,MAAM,aAAa,OAAO,gBAAgB;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,cAAc;AAAA,EAEd,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,aAAa;AAC9B,eAAO;AAAA,UACL,SAAS,OAAO,MAAM,QAAQ;AAAA,QAChC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,MAAM,aAAa,OAAO,YAAY;AAAA,EAC3C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc;AAChB,CAAC;AAEM,MAAM,iBAAiB,OAAO,gBAAgB;AAAA,EACnD,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EACf,SAAS;AACX,CAAC;AAOM,MAAM,OAAO,qBAClB,UAAU,YACR,UACE,WACE,CAAC,EAAE,MAAM,aAAa,aAAa,SAAS,QAAQ;AAClD,SAEE,oCAAC;AAAA,IAAU;AAAA,IAAW,GAAG;AAAA,KACtB,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,QAAI,iBAAiB,KAAK,KAAK,CAAC,MAAM,MAAM,MAAM;AAChD,aAAO,aAAa,OAAO;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT,CAAC,CACH;AAGJ,CACF,CACF,CACF,GACA;AAAA,EACE,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AACd,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.js
CHANGED
|
File without changes
|
package/dist/esm/index.js.map
CHANGED
|
File without changes
|
package/dist/jsx/Card.js
CHANGED
|
@@ -4,13 +4,9 @@ import {
|
|
|
4
4
|
themeable,
|
|
5
5
|
withStaticProperties
|
|
6
6
|
} from "@tamagui/core";
|
|
7
|
-
import { createContextScope } from "@tamagui/create-context";
|
|
8
7
|
import { ThemeableStack } from "@tamagui/stacks";
|
|
9
8
|
import React, { cloneElement, forwardRef } from "react";
|
|
10
9
|
React["createElement"];
|
|
11
|
-
const CARD_NAME = "CARD";
|
|
12
|
-
const [createCardContext, createCardScope] = createContextScope(CARD_NAME);
|
|
13
|
-
const [CardProvider, useCardContext] = createCardContext(CARD_NAME);
|
|
14
10
|
const CardFrame = styled(ThemeableStack, {
|
|
15
11
|
name: "Card",
|
|
16
12
|
backgroundColor: "$background",
|
|
@@ -19,9 +15,8 @@ const CardFrame = styled(ThemeableStack, {
|
|
|
19
15
|
variants: {
|
|
20
16
|
size: {
|
|
21
17
|
"...size": (val, { tokens }) => {
|
|
22
|
-
var _a;
|
|
23
18
|
return {
|
|
24
|
-
borderRadius:
|
|
19
|
+
borderRadius: tokens.radius[val] ?? val
|
|
25
20
|
};
|
|
26
21
|
}
|
|
27
22
|
}
|
|
@@ -38,9 +33,8 @@ const CardHeader = styled(ThemeableStack, {
|
|
|
38
33
|
variants: {
|
|
39
34
|
size: {
|
|
40
35
|
"...size": (val, { tokens }) => {
|
|
41
|
-
var _a;
|
|
42
36
|
return {
|
|
43
|
-
padding:
|
|
37
|
+
padding: tokens.space[val] ?? val
|
|
44
38
|
};
|
|
45
39
|
}
|
|
46
40
|
}
|
|
@@ -62,14 +56,14 @@ const CardBackground = styled(ThemeableStack, {
|
|
|
62
56
|
padding: 0
|
|
63
57
|
});
|
|
64
58
|
const Card = withStaticProperties(CardFrame.extractable(themeable(forwardRef(({ size, __scopeCard, children, ...props }, ref) => {
|
|
65
|
-
return <
|
|
59
|
+
return <CardFrame ref={ref} {...props}>{React.Children.map(children, (child) => {
|
|
66
60
|
if (isTamaguiElement(child) && !child.props.size) {
|
|
67
61
|
return cloneElement(child, {
|
|
68
62
|
size
|
|
69
63
|
});
|
|
70
64
|
}
|
|
71
65
|
return child;
|
|
72
|
-
})}</CardFrame
|
|
66
|
+
})}</CardFrame>;
|
|
73
67
|
}))), {
|
|
74
68
|
Header: CardHeader,
|
|
75
69
|
Footer: CardFooter,
|
|
@@ -80,8 +74,6 @@ export {
|
|
|
80
74
|
CardBackground,
|
|
81
75
|
CardFooter,
|
|
82
76
|
CardFrame,
|
|
83
|
-
CardHeader
|
|
84
|
-
createCardScope,
|
|
85
|
-
useCardContext
|
|
77
|
+
CardHeader
|
|
86
78
|
};
|
|
87
79
|
//# sourceMappingURL=Card.js.map
|
package/dist/jsx/Card.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Card.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n isTamaguiElement,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { ScopedProps, createContextScope } from '@tamagui/create-context'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport React, { cloneElement, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\
|
|
5
|
-
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import {\n GetProps,\n SizeTokens,\n isTamaguiElement,\n styled,\n themeable,\n withStaticProperties,\n} from '@tamagui/core'\nimport { ScopedProps, createContextScope } from '@tamagui/create-context'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport React, { cloneElement, forwardRef } from 'react'\nimport { View } from 'react-native'\n\n// bugfix esbuild strips react jsx: 'preserve'\nReact['createElement']\n\n// const CARD_NAME = 'CARD'\n\n// type CardContextValue = {\n// size?: SizeTokens\n// }\n\n// const [createCardContext, createCardScope] = createContextScope(CARD_NAME)\n// const [CardProvider, useCardContext] = createCardContext<CardContextValue>(CARD_NAME)\n\nexport const CardFrame = styled(ThemeableStack, {\n name: 'Card',\n backgroundColor: '$background',\n position: 'relative',\n overflow: 'hidden',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n borderRadius: tokens.radius[val] ?? val,\n }\n },\n },\n },\n\n defaultVariants: {\n size: '$4',\n },\n})\n\nexport const CardHeader = styled(ThemeableStack, {\n name: 'CardHeader',\n zIndex: 10,\n backgroundColor: 'transparent',\n marginBottom: 'auto',\n\n variants: {\n size: {\n '...size': (val, { tokens }) => {\n return {\n padding: tokens.space[val] ?? val,\n }\n },\n },\n },\n})\n\nexport const CardFooter = styled(CardHeader, {\n name: 'CardFooter',\n zIndex: 5,\n flexDirection: 'row',\n marginTop: 'auto',\n marginBottom: 0,\n})\n\nexport const CardBackground = styled(ThemeableStack, {\n name: 'CardBackground',\n zIndex: 0,\n fullscreen: true,\n overflow: 'hidden',\n pointerEvents: 'none',\n padding: 0,\n})\n\nexport type CardHeaderProps = GetProps<typeof CardHeader>\nexport type CardFooterProps = GetProps<typeof CardFooter>\n\nexport type CardProps = GetProps<typeof CardFrame>\n\nexport const Card = withStaticProperties(\n CardFrame.extractable(\n themeable(\n forwardRef<HTMLElement | View, ScopedProps<CardProps, 'Card'>>(\n ({ size, __scopeCard, children, ...props }, ref) => {\n return (\n // <CardProvider scope={__scopeCard} size={size}>\n <CardFrame ref={ref} {...props}>\n {React.Children.map(children, (child) => {\n if (isTamaguiElement(child) && !child.props.size) {\n return cloneElement(child, {\n size,\n })\n }\n return child\n })}\n </CardFrame>\n // </CardProvider>\n )\n }\n )\n )\n ),\n {\n Header: CardHeader,\n Footer: CardFooter,\n Background: CardBackground,\n }\n)\n\n// export { createCardScope, useCardContext }\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASA;AACA;AAIA,MAAM;AAWC,MAAM,YAAY,OAAO,gBAAgB;AAAA,EAC9C,MAAM;AAAA,EACN,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,UAAU;AAAA,EAEV,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,aAAa;AAC9B,eAAO;AAAA,UACL,cAAc,OAAO,OAAO,QAAQ;AAAA,QACtC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;AAEM,MAAM,aAAa,OAAO,gBAAgB;AAAA,EAC/C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,cAAc;AAAA,EAEd,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW,CAAC,KAAK,EAAE,aAAa;AAC9B,eAAO;AAAA,UACL,SAAS,OAAO,MAAM,QAAQ;AAAA,QAChC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF,CAAC;AAEM,MAAM,aAAa,OAAO,YAAY;AAAA,EAC3C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,eAAe;AAAA,EACf,WAAW;AAAA,EACX,cAAc;AAChB,CAAC;AAEM,MAAM,iBAAiB,OAAO,gBAAgB;AAAA,EACnD,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EACf,SAAS;AACX,CAAC;AAOM,MAAM,OAAO,qBAClB,UAAU,YACR,UACE,WACE,CAAC,EAAE,MAAM,aAAa,aAAa,SAAS,QAAQ;AAClD,SAEE,CAAC,UAAU,KAAK,SAAS,QACtB,MAAM,SAAS,IAAI,UAAU,CAAC,UAAU;AACvC,QAAI,iBAAiB,KAAK,KAAK,CAAC,MAAM,MAAM,MAAM;AAChD,aAAO,aAAa,OAAO;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AACA,WAAO;AAAA,EACT,CAAC,EACH,EATC;AAYL,CACF,CACF,CACF,GACA;AAAA,EACE,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AACd,CACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/jsx/index.js
CHANGED
|
File without changes
|
package/dist/jsx/index.js.map
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/card",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.142",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -22,10 +22,17 @@
|
|
|
22
22
|
"clean": "tamagui-build clean",
|
|
23
23
|
"clean:build": "tamagui-build clean:build"
|
|
24
24
|
},
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"import": "./dist/esm/index.js",
|
|
29
|
+
"require": "./dist/cjs/index.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
25
32
|
"dependencies": {
|
|
26
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
27
|
-
"@tamagui/create-context": "^1.0.1-beta.
|
|
28
|
-
"@tamagui/stacks": "^1.0.1-beta.
|
|
33
|
+
"@tamagui/core": "^1.0.1-beta.142",
|
|
34
|
+
"@tamagui/create-context": "^1.0.1-beta.142",
|
|
35
|
+
"@tamagui/stacks": "^1.0.1-beta.142"
|
|
29
36
|
},
|
|
30
37
|
"peerDependencies": {
|
|
31
38
|
"react": "*",
|
|
@@ -33,7 +40,7 @@
|
|
|
33
40
|
"react-native": "*"
|
|
34
41
|
},
|
|
35
42
|
"devDependencies": {
|
|
36
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
43
|
+
"@tamagui/build": "^1.0.1-beta.142",
|
|
37
44
|
"@types/react-native": "^0.69.2",
|
|
38
45
|
"react": "*",
|
|
39
46
|
"react-dom": "*",
|
package/src/Card.tsx
CHANGED
|
@@ -14,14 +14,14 @@ import { View } from 'react-native'
|
|
|
14
14
|
// bugfix esbuild strips react jsx: 'preserve'
|
|
15
15
|
React['createElement']
|
|
16
16
|
|
|
17
|
-
const CARD_NAME = 'CARD'
|
|
17
|
+
// const CARD_NAME = 'CARD'
|
|
18
18
|
|
|
19
|
-
type CardContextValue = {
|
|
20
|
-
|
|
21
|
-
}
|
|
19
|
+
// type CardContextValue = {
|
|
20
|
+
// size?: SizeTokens
|
|
21
|
+
// }
|
|
22
22
|
|
|
23
|
-
const [createCardContext, createCardScope] = createContextScope(CARD_NAME)
|
|
24
|
-
const [CardProvider, useCardContext] = createCardContext<CardContextValue>(CARD_NAME)
|
|
23
|
+
// const [createCardContext, createCardScope] = createContextScope(CARD_NAME)
|
|
24
|
+
// const [CardProvider, useCardContext] = createCardContext<CardContextValue>(CARD_NAME)
|
|
25
25
|
|
|
26
26
|
export const CardFrame = styled(ThemeableStack, {
|
|
27
27
|
name: 'Card',
|
|
@@ -89,18 +89,18 @@ export const Card = withStaticProperties(
|
|
|
89
89
|
forwardRef<HTMLElement | View, ScopedProps<CardProps, 'Card'>>(
|
|
90
90
|
({ size, __scopeCard, children, ...props }, ref) => {
|
|
91
91
|
return (
|
|
92
|
-
<CardProvider scope={__scopeCard} size={size}>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
</CardProvider>
|
|
92
|
+
// <CardProvider scope={__scopeCard} size={size}>
|
|
93
|
+
<CardFrame ref={ref} {...props}>
|
|
94
|
+
{React.Children.map(children, (child) => {
|
|
95
|
+
if (isTamaguiElement(child) && !child.props.size) {
|
|
96
|
+
return cloneElement(child, {
|
|
97
|
+
size,
|
|
98
|
+
})
|
|
99
|
+
}
|
|
100
|
+
return child
|
|
101
|
+
})}
|
|
102
|
+
</CardFrame>
|
|
103
|
+
// </CardProvider>
|
|
104
104
|
)
|
|
105
105
|
}
|
|
106
106
|
)
|
|
@@ -113,4 +113,4 @@ export const Card = withStaticProperties(
|
|
|
113
113
|
}
|
|
114
114
|
)
|
|
115
115
|
|
|
116
|
-
export { createCardScope, useCardContext }
|
|
116
|
+
// export { createCardScope, useCardContext }
|
package/types/Card.d.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { GetProps, SizeTokens } from '@tamagui/core';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { View } from 'react-native';
|
|
4
|
-
declare type CardContextValue = {
|
|
5
|
-
size?: SizeTokens;
|
|
6
|
-
};
|
|
7
|
-
declare const createCardScope: import("@tamagui/create-context").CreateScope;
|
|
8
|
-
declare const useCardContext: (consumerName: string, scope: import("@tamagui/create-context").Scope<CardContextValue | undefined>) => CardContextValue;
|
|
9
4
|
export declare const CardFrame: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
10
5
|
readonly fullscreen?: boolean | undefined;
|
|
11
6
|
readonly elevation?: SizeTokens | undefined;
|
|
@@ -290,7 +285,7 @@ export declare const CardFooter: import("@tamagui/core").TamaguiComponent<(Omit<
|
|
|
290
285
|
export declare const CardBackground: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
291
286
|
readonly fullscreen?: boolean | undefined;
|
|
292
287
|
readonly elevation?: SizeTokens | undefined;
|
|
293
|
-
}, "
|
|
288
|
+
}, "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered" | "transparent" | "backgrounded" | "radiused" | "padded" | "chromeless"> & {
|
|
294
289
|
fontFamily?: unknown;
|
|
295
290
|
backgrounded?: boolean | undefined;
|
|
296
291
|
radiused?: boolean | undefined;
|
|
@@ -306,7 +301,7 @@ export declare const CardBackground: import("@tamagui/core").TamaguiComponent<(O
|
|
|
306
301
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
307
302
|
readonly fullscreen?: boolean | undefined;
|
|
308
303
|
readonly elevation?: SizeTokens | undefined;
|
|
309
|
-
}, "
|
|
304
|
+
}, "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered" | "transparent" | "backgrounded" | "radiused" | "padded" | "chromeless"> & {
|
|
310
305
|
fontFamily?: unknown;
|
|
311
306
|
backgrounded?: boolean | undefined;
|
|
312
307
|
radiused?: boolean | undefined;
|
|
@@ -322,7 +317,7 @@ export declare const CardBackground: import("@tamagui/core").TamaguiComponent<(O
|
|
|
322
317
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
323
318
|
readonly fullscreen?: boolean | undefined;
|
|
324
319
|
readonly elevation?: SizeTokens | undefined;
|
|
325
|
-
}, "
|
|
320
|
+
}, "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered" | "transparent" | "backgrounded" | "radiused" | "padded" | "chromeless"> & {
|
|
326
321
|
fontFamily?: unknown;
|
|
327
322
|
backgrounded?: boolean | undefined;
|
|
328
323
|
radiused?: boolean | undefined;
|
|
@@ -682,7 +677,7 @@ export declare const Card: ((props: Omit<Omit<import("react-native").ViewProps,
|
|
|
682
677
|
Background: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
683
678
|
readonly fullscreen?: boolean | undefined;
|
|
684
679
|
readonly elevation?: SizeTokens | undefined;
|
|
685
|
-
}, "
|
|
680
|
+
}, "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered" | "transparent" | "backgrounded" | "radiused" | "padded" | "chromeless"> & {
|
|
686
681
|
fontFamily?: unknown;
|
|
687
682
|
backgrounded?: boolean | undefined;
|
|
688
683
|
radiused?: boolean | undefined;
|
|
@@ -698,7 +693,7 @@ export declare const Card: ((props: Omit<Omit<import("react-native").ViewProps,
|
|
|
698
693
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
699
694
|
readonly fullscreen?: boolean | undefined;
|
|
700
695
|
readonly elevation?: SizeTokens | undefined;
|
|
701
|
-
}, "
|
|
696
|
+
}, "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered" | "transparent" | "backgrounded" | "radiused" | "padded" | "chromeless"> & {
|
|
702
697
|
fontFamily?: unknown;
|
|
703
698
|
backgrounded?: boolean | undefined;
|
|
704
699
|
radiused?: boolean | undefined;
|
|
@@ -714,7 +709,7 @@ export declare const Card: ((props: Omit<Omit<import("react-native").ViewProps,
|
|
|
714
709
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{
|
|
715
710
|
readonly fullscreen?: boolean | undefined;
|
|
716
711
|
readonly elevation?: SizeTokens | undefined;
|
|
717
|
-
}, "
|
|
712
|
+
}, "fontFamily" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered" | "transparent" | "backgrounded" | "radiused" | "padded" | "chromeless"> & {
|
|
718
713
|
fontFamily?: unknown;
|
|
719
714
|
backgrounded?: boolean | undefined;
|
|
720
715
|
radiused?: boolean | undefined;
|
|
@@ -801,5 +796,4 @@ export declare const Card: ((props: Omit<Omit<import("react-native").ViewProps,
|
|
|
801
796
|
[x: string]: undefined;
|
|
802
797
|
})>;
|
|
803
798
|
};
|
|
804
|
-
export { createCardScope, useCardContext };
|
|
805
799
|
//# sourceMappingURL=Card.d.ts.map
|
package/types/index.d.ts
CHANGED
|
File without changes
|