@tamagui/stacks 1.0.1-beta.18 → 1.0.1-beta.181
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 +10 -65
- package/dist/cjs/SizableStack.js.map +2 -2
- package/dist/cjs/Stacks.js +42 -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 +10 -66
- package/dist/esm/SizableStack.js.map +2 -2
- package/dist/esm/Stacks.js +40 -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/SizableStack.js +11 -66
- package/dist/jsx/SizableStack.js.map +7 -0
- package/dist/jsx/Stacks.js +41 -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 +11 -6
- package/src/SizableStack.tsx +29 -0
- package/src/Stacks.tsx +91 -0
- package/src/ThemeableStack.tsx +60 -0
- package/src/index.ts +3 -0
- package/src/variants.tsx +98 -0
- package/types/SizableStack.d.ts +44 -48
- package/types/Stacks.d.ts +42 -38
- package/types/ThemeableStack.d.ts +68 -0
- package/types/index.d.ts +1 -0
- package/types/variants.d.ts +271 -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
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { getElevation } from "./Stacks";
|
|
2
|
+
const elevate = {
|
|
3
|
+
true: (_, extras) => {
|
|
4
|
+
return getElevation(extras.props["size"], extras);
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
const bordered = (val, { props }) => {
|
|
8
|
+
return {
|
|
9
|
+
borderWidth: typeof val === "number" ? val : 1,
|
|
10
|
+
borderColor: "$borderColor",
|
|
11
|
+
...props.hoverTheme && {
|
|
12
|
+
hoverStyle: {
|
|
13
|
+
borderColor: "$borderColorHover"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
...props.pressTheme && {
|
|
17
|
+
pressStyle: {
|
|
18
|
+
borderColor: "$borderColorPress"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
...props.focusTheme && {
|
|
22
|
+
focusStyle: {
|
|
23
|
+
borderColor: "$borderColorFocus"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const padded = {
|
|
29
|
+
true: (_, extras) => {
|
|
30
|
+
const { tokens, props } = extras;
|
|
31
|
+
return {
|
|
32
|
+
padding: tokens.space[props.size] || tokens.space["$4"]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const radiused = {
|
|
37
|
+
true: (_, extras) => {
|
|
38
|
+
const { tokens, props } = extras;
|
|
39
|
+
return {
|
|
40
|
+
borderRadius: tokens.radius[props.size] || tokens.radius["$4"]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const circular = {
|
|
45
|
+
true: (_, { props, tokens }) => {
|
|
46
|
+
const size = tokens.size[props.size];
|
|
47
|
+
return {
|
|
48
|
+
width: size,
|
|
49
|
+
height: size,
|
|
50
|
+
maxWidth: size,
|
|
51
|
+
maxHeight: size,
|
|
52
|
+
minWidth: size,
|
|
53
|
+
minHeight: size,
|
|
54
|
+
borderRadius: 1e5,
|
|
55
|
+
paddingVertical: 0,
|
|
56
|
+
paddingHorizontal: 0
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const hoverTheme = {
|
|
61
|
+
true: {
|
|
62
|
+
hoverStyle: {
|
|
63
|
+
backgroundColor: "$backgroundHover",
|
|
64
|
+
borderColor: "$borderColorHover"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
false: {}
|
|
68
|
+
};
|
|
69
|
+
const pressTheme = {
|
|
70
|
+
true: {
|
|
71
|
+
pressStyle: {
|
|
72
|
+
backgroundColor: "$backgroundPress",
|
|
73
|
+
borderColor: "$borderColorPress"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
false: {}
|
|
77
|
+
};
|
|
78
|
+
const focusTheme = {
|
|
79
|
+
true: {
|
|
80
|
+
focusStyle: {
|
|
81
|
+
backgroundColor: "$backgroundFocus",
|
|
82
|
+
borderColor: "$borderColorFocus"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
false: {}
|
|
86
|
+
};
|
|
87
|
+
export {
|
|
88
|
+
bordered,
|
|
89
|
+
circular,
|
|
90
|
+
elevate,
|
|
91
|
+
focusTheme,
|
|
92
|
+
hoverTheme,
|
|
93
|
+
padded,
|
|
94
|
+
pressTheme,
|
|
95
|
+
radiused
|
|
96
|
+
};
|
|
97
|
+
//# 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,SAAS,oBAAoB;AAEtB,MAAM,UAAU;AAAA,EACrB,MAAM,CAAC,GAAY,WAAgB;AACjC,WAAO,aAAa,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/package.json
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/stacks",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
4
|
-
"sideEffects":
|
|
3
|
+
"version": "1.0.1-beta.181",
|
|
4
|
+
"sideEffects": [
|
|
5
|
+
"*.css"
|
|
6
|
+
],
|
|
5
7
|
"source": "src/index.ts",
|
|
6
|
-
"
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
7
9
|
"main": "dist/cjs",
|
|
8
10
|
"module": "dist/esm",
|
|
9
11
|
"module:jsx": "dist/jsx",
|
|
10
12
|
"files": [
|
|
13
|
+
"src",
|
|
11
14
|
"types",
|
|
12
15
|
"dist"
|
|
13
16
|
],
|
|
14
17
|
"scripts": {
|
|
15
18
|
"build": "tamagui-build",
|
|
16
|
-
"watch": "tamagui-build --watch"
|
|
19
|
+
"watch": "tamagui-build --watch",
|
|
20
|
+
"lint": "eslint",
|
|
21
|
+
"lint:fix": "yarn lint --fix"
|
|
17
22
|
},
|
|
18
23
|
"dependencies": {
|
|
19
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
24
|
+
"@tamagui/core": "^1.0.1-beta.181"
|
|
20
25
|
},
|
|
21
26
|
"peerDependencies": {
|
|
22
27
|
"react": "*",
|
|
23
28
|
"react-dom": "*"
|
|
24
29
|
},
|
|
25
30
|
"devDependencies": {
|
|
26
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
31
|
+
"@tamagui/build": "^1.0.1-beta.181",
|
|
27
32
|
"react": "*",
|
|
28
33
|
"react-dom": "*"
|
|
29
34
|
},
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GetProps, getButtonSize, styled } from '@tamagui/core'
|
|
2
|
+
|
|
3
|
+
import { YStack } from './Stacks'
|
|
4
|
+
import { bordered, circular, elevate, focusTheme, hoverTheme, pressTheme } from './variants'
|
|
5
|
+
|
|
6
|
+
export const SizableStack = styled(YStack, {
|
|
7
|
+
name: 'SizableStack',
|
|
8
|
+
backgroundColor: '$background',
|
|
9
|
+
flexDirection: 'row',
|
|
10
|
+
flexShrink: 1,
|
|
11
|
+
|
|
12
|
+
variants: {
|
|
13
|
+
// allows the type to come in for use in size
|
|
14
|
+
fontFamily: () => ({}),
|
|
15
|
+
|
|
16
|
+
hoverTheme,
|
|
17
|
+
pressTheme,
|
|
18
|
+
focusTheme,
|
|
19
|
+
circular,
|
|
20
|
+
elevate,
|
|
21
|
+
bordered,
|
|
22
|
+
|
|
23
|
+
size: {
|
|
24
|
+
'...size': getButtonSize,
|
|
25
|
+
},
|
|
26
|
+
} as const,
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export type SizableStackProps = GetProps<typeof SizableStack>
|
package/src/Stacks.tsx
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {
|
|
2
|
+
GetProps,
|
|
3
|
+
SizeTokens,
|
|
4
|
+
SizeVariantSpreadFunction,
|
|
5
|
+
Stack,
|
|
6
|
+
StackProps,
|
|
7
|
+
VariantSpreadExtras,
|
|
8
|
+
getVariableValue,
|
|
9
|
+
isVariable,
|
|
10
|
+
styled,
|
|
11
|
+
} from '@tamagui/core'
|
|
12
|
+
|
|
13
|
+
export type YStackProps = GetProps<typeof YStack>
|
|
14
|
+
export type XStackProps = YStackProps
|
|
15
|
+
export type ZStackProps = YStackProps
|
|
16
|
+
|
|
17
|
+
export const getElevation: SizeVariantSpreadFunction<StackProps> = (size, extras) => {
|
|
18
|
+
if (!size) return
|
|
19
|
+
const { tokens } = extras
|
|
20
|
+
const token = tokens.size[size]
|
|
21
|
+
const sizeNum = (isVariable(token) ? +token.val : size) as number
|
|
22
|
+
return getSizedElevation(sizeNum, extras)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const fullscreenStyle = {
|
|
26
|
+
position: 'absolute',
|
|
27
|
+
top: 0,
|
|
28
|
+
left: 0,
|
|
29
|
+
right: 0,
|
|
30
|
+
bottom: 0,
|
|
31
|
+
} as const
|
|
32
|
+
|
|
33
|
+
const variants = {
|
|
34
|
+
fullscreen: {
|
|
35
|
+
true: fullscreenStyle,
|
|
36
|
+
},
|
|
37
|
+
elevation: {
|
|
38
|
+
'...size': getElevation,
|
|
39
|
+
},
|
|
40
|
+
} as const
|
|
41
|
+
|
|
42
|
+
export const YStack = styled(Stack, {
|
|
43
|
+
flexDirection: 'column',
|
|
44
|
+
name: 'YStack',
|
|
45
|
+
variants,
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
export const XStack = styled(Stack, {
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
name: 'XStack',
|
|
51
|
+
variants,
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
export const ZStack = styled(
|
|
55
|
+
YStack,
|
|
56
|
+
{
|
|
57
|
+
name: 'ZStack',
|
|
58
|
+
position: 'relative',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
neverFlatten: true,
|
|
62
|
+
isZStack: true,
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
export const getSizedElevation = (
|
|
67
|
+
val: SizeTokens | number | boolean,
|
|
68
|
+
{ theme, tokens }: VariantSpreadExtras<any>
|
|
69
|
+
) => {
|
|
70
|
+
let num = 0
|
|
71
|
+
if (val === true) {
|
|
72
|
+
const val = getVariableValue(tokens.size['true'])
|
|
73
|
+
if (typeof val === 'number') {
|
|
74
|
+
num = val
|
|
75
|
+
} else {
|
|
76
|
+
num = 10
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
num = +val
|
|
80
|
+
}
|
|
81
|
+
if (process.env.NODE_ENV === 'development') {
|
|
82
|
+
if (isNaN(num)) console.warn('NaN shadow', num, val)
|
|
83
|
+
}
|
|
84
|
+
const [height, shadowRadius] = [Math.round(num / 4 + 1), Math.round(num / 2 + 2)]
|
|
85
|
+
const shadow = {
|
|
86
|
+
shadowColor: theme.shadowColor,
|
|
87
|
+
shadowRadius,
|
|
88
|
+
shadowOffset: { height, width: 0 },
|
|
89
|
+
}
|
|
90
|
+
return shadow
|
|
91
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { GetProps, styled } from '@tamagui/core'
|
|
2
|
+
|
|
3
|
+
import { YStack } from './Stacks'
|
|
4
|
+
import {
|
|
5
|
+
bordered,
|
|
6
|
+
circular,
|
|
7
|
+
elevate,
|
|
8
|
+
focusTheme,
|
|
9
|
+
hoverTheme,
|
|
10
|
+
padded,
|
|
11
|
+
pressTheme,
|
|
12
|
+
radiused,
|
|
13
|
+
} from './variants'
|
|
14
|
+
|
|
15
|
+
const chromelessStyle = {
|
|
16
|
+
backgroundColor: 'transparent',
|
|
17
|
+
borderColor: 'transparent',
|
|
18
|
+
shadowColor: 'transparent',
|
|
19
|
+
}
|
|
20
|
+
export const ThemeableStack = styled(YStack, {
|
|
21
|
+
name: 'SizableStack',
|
|
22
|
+
|
|
23
|
+
variants: {
|
|
24
|
+
// allows the type to come in for use in size
|
|
25
|
+
fontFamily: () => ({}),
|
|
26
|
+
|
|
27
|
+
backgrounded: {
|
|
28
|
+
true: {
|
|
29
|
+
backgroundColor: '$background',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
radiused,
|
|
34
|
+
hoverTheme,
|
|
35
|
+
pressTheme,
|
|
36
|
+
focusTheme,
|
|
37
|
+
circular,
|
|
38
|
+
padded,
|
|
39
|
+
elevate,
|
|
40
|
+
bordered,
|
|
41
|
+
|
|
42
|
+
transparent: {
|
|
43
|
+
true: {
|
|
44
|
+
backgroundColor: 'transparent',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
chromeless: {
|
|
49
|
+
true: chromelessStyle,
|
|
50
|
+
all: {
|
|
51
|
+
...chromelessStyle,
|
|
52
|
+
hoverStyle: chromelessStyle,
|
|
53
|
+
pressStyle: chromelessStyle,
|
|
54
|
+
focusStyle: chromelessStyle,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
} as const,
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
export type ThemeableStackProps = GetProps<typeof ThemeableStack>
|
package/src/index.ts
ADDED
package/src/variants.tsx
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { getElevation } from './Stacks'
|
|
2
|
+
|
|
3
|
+
export const elevate = {
|
|
4
|
+
true: (_: boolean, extras: any) => {
|
|
5
|
+
return getElevation(extras.props['size'], extras)
|
|
6
|
+
},
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const bordered = (val: boolean | number, { props }) => {
|
|
10
|
+
return {
|
|
11
|
+
// TODO size it with size in '...size'
|
|
12
|
+
borderWidth: typeof val === 'number' ? val : 1,
|
|
13
|
+
borderColor: '$borderColor',
|
|
14
|
+
|
|
15
|
+
...(props.hoverTheme && {
|
|
16
|
+
hoverStyle: {
|
|
17
|
+
borderColor: '$borderColorHover',
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
|
|
21
|
+
...(props.pressTheme && {
|
|
22
|
+
pressStyle: {
|
|
23
|
+
borderColor: '$borderColorPress',
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
|
|
27
|
+
...(props.focusTheme && {
|
|
28
|
+
focusStyle: {
|
|
29
|
+
borderColor: '$borderColorFocus',
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const padded = {
|
|
36
|
+
true: (_, extras) => {
|
|
37
|
+
const { tokens, props } = extras
|
|
38
|
+
return {
|
|
39
|
+
padding: tokens.space[props.size] || tokens.space['$4'],
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const radiused = {
|
|
45
|
+
true: (_, extras) => {
|
|
46
|
+
const { tokens, props } = extras
|
|
47
|
+
return {
|
|
48
|
+
borderRadius: tokens.radius[props.size] || tokens.radius['$4'],
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const circular = {
|
|
54
|
+
true: (_, { props, tokens }) => {
|
|
55
|
+
const size = tokens.size[props.size]
|
|
56
|
+
return {
|
|
57
|
+
width: size,
|
|
58
|
+
height: size,
|
|
59
|
+
maxWidth: size,
|
|
60
|
+
maxHeight: size,
|
|
61
|
+
minWidth: size,
|
|
62
|
+
minHeight: size,
|
|
63
|
+
borderRadius: 100_000,
|
|
64
|
+
paddingVertical: 0,
|
|
65
|
+
paddingHorizontal: 0,
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const hoverTheme = {
|
|
71
|
+
true: {
|
|
72
|
+
hoverStyle: {
|
|
73
|
+
backgroundColor: '$backgroundHover',
|
|
74
|
+
borderColor: '$borderColorHover',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
false: {},
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const pressTheme = {
|
|
81
|
+
true: {
|
|
82
|
+
pressStyle: {
|
|
83
|
+
backgroundColor: '$backgroundPress',
|
|
84
|
+
borderColor: '$borderColorPress',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
false: {},
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export const focusTheme = {
|
|
91
|
+
true: {
|
|
92
|
+
focusStyle: {
|
|
93
|
+
backgroundColor: '$backgroundFocus',
|
|
94
|
+
borderColor: '$borderColorFocus',
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
false: {},
|
|
98
|
+
}
|
package/types/SizableStack.d.ts
CHANGED
|
@@ -1,56 +1,52 @@
|
|
|
1
1
|
import { GetProps } from '@tamagui/core';
|
|
2
2
|
export declare const SizableStack: 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<{
|
|
3
|
-
fullscreen?: boolean | undefined;
|
|
4
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
5
|
-
}, "
|
|
6
|
-
fontFamily?: unknown;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
chromeless?: boolean | undefined;
|
|
3
|
+
readonly fullscreen?: boolean | undefined;
|
|
4
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
5
|
+
}, "fontFamily" | "size" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered"> & {
|
|
6
|
+
readonly fontFamily?: unknown;
|
|
7
|
+
readonly hoverTheme?: boolean | undefined;
|
|
8
|
+
readonly pressTheme?: boolean | undefined;
|
|
9
|
+
readonly focusTheme?: boolean | undefined;
|
|
10
|
+
readonly circular?: boolean | undefined;
|
|
11
|
+
readonly elevate?: boolean | undefined;
|
|
12
|
+
readonly bordered?: number | boolean | undefined;
|
|
13
|
+
readonly size?: import("@tamagui/core").SizeTokens | undefined;
|
|
15
14
|
} & 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<{
|
|
16
|
-
fullscreen?: boolean | undefined;
|
|
17
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
18
|
-
}, "
|
|
19
|
-
fontFamily?: unknown;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
chromeless?: boolean | undefined;
|
|
15
|
+
readonly fullscreen?: boolean | undefined;
|
|
16
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
17
|
+
}, "fontFamily" | "size" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered"> & {
|
|
18
|
+
readonly fontFamily?: unknown;
|
|
19
|
+
readonly hoverTheme?: boolean | undefined;
|
|
20
|
+
readonly pressTheme?: boolean | undefined;
|
|
21
|
+
readonly focusTheme?: boolean | undefined;
|
|
22
|
+
readonly circular?: boolean | undefined;
|
|
23
|
+
readonly elevate?: boolean | undefined;
|
|
24
|
+
readonly bordered?: number | boolean | undefined;
|
|
25
|
+
readonly size?: import("@tamagui/core").SizeTokens | undefined;
|
|
28
26
|
}>> & 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<{
|
|
29
|
-
fullscreen?: boolean | undefined;
|
|
30
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
31
|
-
}, "
|
|
32
|
-
fontFamily?: unknown;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
27
|
+
readonly fullscreen?: boolean | undefined;
|
|
28
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
29
|
+
}, "fontFamily" | "size" | "hoverTheme" | "pressTheme" | "focusTheme" | "circular" | "elevate" | "bordered"> & {
|
|
30
|
+
readonly fontFamily?: unknown;
|
|
31
|
+
readonly hoverTheme?: boolean | undefined;
|
|
32
|
+
readonly pressTheme?: boolean | undefined;
|
|
33
|
+
readonly focusTheme?: boolean | undefined;
|
|
34
|
+
readonly circular?: boolean | undefined;
|
|
35
|
+
readonly elevate?: boolean | undefined;
|
|
36
|
+
readonly bordered?: number | boolean | undefined;
|
|
37
|
+
readonly size?: import("@tamagui/core").SizeTokens | undefined;
|
|
38
|
+
}>>, import("@tamagui/core").TamaguiElement, import("@tamagui/core").StackPropsBase, {
|
|
39
|
+
readonly fullscreen?: boolean | undefined;
|
|
40
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
44
41
|
} & {
|
|
45
|
-
fontFamily?: unknown;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
chromeless?: boolean | undefined;
|
|
42
|
+
readonly fontFamily?: unknown;
|
|
43
|
+
readonly hoverTheme?: boolean | undefined;
|
|
44
|
+
readonly pressTheme?: boolean | undefined;
|
|
45
|
+
readonly focusTheme?: boolean | undefined;
|
|
46
|
+
readonly circular?: boolean | undefined;
|
|
47
|
+
readonly elevate?: boolean | undefined;
|
|
48
|
+
readonly bordered?: number | boolean | undefined;
|
|
49
|
+
readonly size?: import("@tamagui/core").SizeTokens | undefined;
|
|
54
50
|
}>;
|
|
55
51
|
export declare type SizableStackProps = GetProps<typeof SizableStack>;
|
|
56
52
|
//# sourceMappingURL=SizableStack.d.ts.map
|
package/types/Stacks.d.ts
CHANGED
|
@@ -1,65 +1,69 @@
|
|
|
1
|
-
import { GetProps, SizeTokens, VariantSpreadExtras } from '@tamagui/core';
|
|
1
|
+
import { GetProps, SizeTokens, SizeVariantSpreadFunction, StackProps, VariantSpreadExtras } from '@tamagui/core';
|
|
2
2
|
export declare type YStackProps = GetProps<typeof YStack>;
|
|
3
|
-
export declare type XStackProps =
|
|
4
|
-
export declare type ZStackProps =
|
|
3
|
+
export declare type XStackProps = YStackProps;
|
|
4
|
+
export declare type ZStackProps = YStackProps;
|
|
5
|
+
export declare const getElevation: SizeVariantSpreadFunction<StackProps>;
|
|
5
6
|
export declare const YStack: 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<{}, "elevation" | "fullscreen"> & {
|
|
6
|
-
fullscreen?: boolean | undefined;
|
|
7
|
-
elevation?: SizeTokens | undefined;
|
|
7
|
+
readonly fullscreen?: boolean | undefined;
|
|
8
|
+
readonly elevation?: SizeTokens | undefined;
|
|
8
9
|
} & 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<{}, "elevation" | "fullscreen"> & {
|
|
9
|
-
fullscreen?: boolean | undefined;
|
|
10
|
-
elevation?: SizeTokens | undefined;
|
|
10
|
+
readonly fullscreen?: boolean | undefined;
|
|
11
|
+
readonly elevation?: SizeTokens | undefined;
|
|
11
12
|
}>> & 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<{}, "elevation" | "fullscreen"> & {
|
|
12
|
-
fullscreen?: boolean | undefined;
|
|
13
|
-
elevation?: SizeTokens | undefined;
|
|
14
|
-
}>>,
|
|
15
|
-
fullscreen?: boolean | undefined;
|
|
16
|
-
elevation?: SizeTokens | undefined;
|
|
13
|
+
readonly fullscreen?: boolean | undefined;
|
|
14
|
+
readonly elevation?: SizeTokens | undefined;
|
|
15
|
+
}>>, import("@tamagui/core").TamaguiElement, import("@tamagui/core").StackPropsBase, {
|
|
16
|
+
readonly fullscreen?: boolean | undefined;
|
|
17
|
+
readonly elevation?: SizeTokens | undefined;
|
|
17
18
|
}>;
|
|
18
19
|
export declare const XStack: 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<{}, "elevation" | "fullscreen"> & {
|
|
19
|
-
fullscreen?: boolean | undefined;
|
|
20
|
-
elevation?: SizeTokens | undefined;
|
|
20
|
+
readonly fullscreen?: boolean | undefined;
|
|
21
|
+
readonly elevation?: SizeTokens | undefined;
|
|
21
22
|
} & 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<{}, "elevation" | "fullscreen"> & {
|
|
22
|
-
fullscreen?: boolean | undefined;
|
|
23
|
-
elevation?: SizeTokens | undefined;
|
|
23
|
+
readonly fullscreen?: boolean | undefined;
|
|
24
|
+
readonly elevation?: SizeTokens | undefined;
|
|
24
25
|
}>> & 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<{}, "elevation" | "fullscreen"> & {
|
|
25
|
-
fullscreen?: boolean | undefined;
|
|
26
|
-
elevation?: SizeTokens | undefined;
|
|
27
|
-
}>>,
|
|
28
|
-
fullscreen?: boolean | undefined;
|
|
29
|
-
elevation?: SizeTokens | undefined;
|
|
26
|
+
readonly fullscreen?: boolean | undefined;
|
|
27
|
+
readonly elevation?: SizeTokens | undefined;
|
|
28
|
+
}>>, import("@tamagui/core").TamaguiElement, import("@tamagui/core").StackPropsBase, {
|
|
29
|
+
readonly fullscreen?: boolean | undefined;
|
|
30
|
+
readonly elevation?: SizeTokens | undefined;
|
|
30
31
|
}>;
|
|
31
32
|
export declare const ZStack: 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<{}, "elevation" | "fullscreen"> & {
|
|
32
|
-
fullscreen?: boolean | undefined;
|
|
33
|
-
elevation?: SizeTokens | undefined;
|
|
33
|
+
readonly fullscreen?: boolean | undefined;
|
|
34
|
+
readonly elevation?: SizeTokens | undefined;
|
|
34
35
|
} & 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<{}, "elevation" | "fullscreen"> & {
|
|
35
|
-
fullscreen?: boolean | undefined;
|
|
36
|
-
elevation?: SizeTokens | undefined;
|
|
36
|
+
readonly fullscreen?: boolean | undefined;
|
|
37
|
+
readonly elevation?: SizeTokens | undefined;
|
|
37
38
|
}>> & 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<{}, "elevation" | "fullscreen"> & {
|
|
38
|
-
fullscreen?: boolean | undefined;
|
|
39
|
-
elevation?: SizeTokens | undefined;
|
|
39
|
+
readonly fullscreen?: boolean | undefined;
|
|
40
|
+
readonly elevation?: SizeTokens | undefined;
|
|
40
41
|
}>>) | (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<{
|
|
41
|
-
fullscreen?: boolean | undefined;
|
|
42
|
-
elevation?: SizeTokens | undefined;
|
|
42
|
+
readonly fullscreen?: boolean | undefined;
|
|
43
|
+
readonly elevation?: SizeTokens | undefined;
|
|
43
44
|
}, string | number> & {
|
|
44
45
|
[x: string]: undefined;
|
|
45
46
|
} & 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<{
|
|
46
|
-
fullscreen?: boolean | undefined;
|
|
47
|
-
elevation?: SizeTokens | undefined;
|
|
47
|
+
readonly fullscreen?: boolean | undefined;
|
|
48
|
+
readonly elevation?: SizeTokens | undefined;
|
|
48
49
|
}, string | number> & {
|
|
49
50
|
[x: string]: undefined;
|
|
50
51
|
}>> & 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<{
|
|
51
|
-
fullscreen?: boolean | undefined;
|
|
52
|
-
elevation?: SizeTokens | undefined;
|
|
52
|
+
readonly fullscreen?: boolean | undefined;
|
|
53
|
+
readonly elevation?: SizeTokens | undefined;
|
|
53
54
|
}, string | number> & {
|
|
54
55
|
[x: string]: undefined;
|
|
55
|
-
}>>),
|
|
56
|
-
fullscreen?: boolean | undefined;
|
|
57
|
-
elevation?: SizeTokens | undefined;
|
|
58
|
-
}
|
|
56
|
+
}>>), import("@tamagui/core").TamaguiElement, import("@tamagui/core").StackPropsBase, {
|
|
57
|
+
readonly fullscreen?: boolean | undefined;
|
|
58
|
+
readonly elevation?: SizeTokens | undefined;
|
|
59
|
+
} | ({
|
|
60
|
+
readonly fullscreen?: boolean | undefined;
|
|
61
|
+
readonly elevation?: SizeTokens | undefined;
|
|
62
|
+
} & {
|
|
59
63
|
[x: string]: undefined;
|
|
60
64
|
})>;
|
|
61
65
|
export declare const getSizedElevation: (val: SizeTokens | number | boolean, { theme, tokens }: VariantSpreadExtras<any>) => {
|
|
62
|
-
shadowColor: import("@tamagui/core").
|
|
66
|
+
shadowColor: import("@tamagui/core").Variable<any> | undefined;
|
|
63
67
|
shadowRadius: number;
|
|
64
68
|
shadowOffset: {
|
|
65
69
|
height: number;
|