@tamagui/button 1.0.1-rc.1.5 → 1.0.1-rc.10
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/Button.js +21 -22
- package/dist/cjs/Button.js.map +2 -2
- package/dist/esm/Button.js +21 -22
- package/dist/esm/Button.js.map +2 -2
- package/dist/jsx/Button.js +18 -19
- package/dist/jsx/Button.js.map +2 -2
- package/package.json +12 -12
- package/src/Button.tsx +37 -32
- package/types/Button.d.ts +19 -17
package/dist/cjs/Button.js
CHANGED
|
@@ -86,7 +86,7 @@ const ButtonText = (0, import_core.styled)(import_text.SizableText, {
|
|
|
86
86
|
flexShrink: 1,
|
|
87
87
|
ellipse: true
|
|
88
88
|
});
|
|
89
|
-
function useButton(
|
|
89
|
+
function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
90
90
|
const {
|
|
91
91
|
children,
|
|
92
92
|
icon,
|
|
@@ -106,41 +106,40 @@ function useButton(props, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
106
106
|
textAlign,
|
|
107
107
|
textProps,
|
|
108
108
|
...rest
|
|
109
|
-
} =
|
|
109
|
+
} = propsIn;
|
|
110
110
|
const isNested = import_core.isRSC ? false : (0, import_react.useContext)(import_core.ButtonNestingContext);
|
|
111
|
-
const
|
|
112
|
-
const size =
|
|
111
|
+
const propsActive = (0, import_core.useMediaPropsActive)(propsIn);
|
|
112
|
+
const size = propsActive.size || "$4";
|
|
113
113
|
const iconSize = (typeof size === "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon;
|
|
114
114
|
const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color });
|
|
115
115
|
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
116
116
|
const spaceSize = (0, import_core.getVariableValue)(iconSize) * scaleSpace;
|
|
117
|
-
const contents = (0, import_text.wrapChildrenInText)(Text,
|
|
117
|
+
const contents = (0, import_text.wrapChildrenInText)(Text, propsActive);
|
|
118
118
|
const inner = themedIcon || themedIconAfter ? (0, import_core.spacedChildren)({
|
|
119
119
|
space: spaceSize,
|
|
120
120
|
spaceFlex,
|
|
121
121
|
separator,
|
|
122
|
-
direction:
|
|
122
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
123
123
|
children: [themedIcon, contents, themedIconAfter]
|
|
124
124
|
}) : contents;
|
|
125
|
+
const props = {
|
|
126
|
+
...propsActive.disabled && {
|
|
127
|
+
focusable: void 0,
|
|
128
|
+
focusStyle: {
|
|
129
|
+
borderColor: "$background"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
tag: isNested ? "span" : void 0,
|
|
133
|
+
...rest,
|
|
134
|
+
children: import_core.isRSC ? inner : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ButtonNestingContext.Provider, {
|
|
135
|
+
value: true,
|
|
136
|
+
children: inner
|
|
137
|
+
})
|
|
138
|
+
};
|
|
125
139
|
return {
|
|
126
140
|
spaceSize,
|
|
127
141
|
isNested,
|
|
128
|
-
props
|
|
129
|
-
...props.disabled && {
|
|
130
|
-
focusable: void 0,
|
|
131
|
-
focusStyle: {
|
|
132
|
-
borderColor: "$background"
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
...isNested ? {
|
|
136
|
-
tag: "span"
|
|
137
|
-
} : {},
|
|
138
|
-
...rest,
|
|
139
|
-
children: import_core.isRSC ? inner : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ButtonNestingContext.Provider, {
|
|
140
|
-
value: true,
|
|
141
|
-
children: inner
|
|
142
|
-
})
|
|
143
|
-
}
|
|
142
|
+
props
|
|
144
143
|
};
|
|
145
144
|
}
|
|
146
145
|
const ButtonComponent = (0, import_react.forwardRef)(function Button(props, ref) {
|
package/dist/cjs/Button.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n ButtonNestingContext,\n GetProps,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n isRSC,\n spacedChildren,\n styled,\n themeable,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getButtonSized } from '@tamagui/get-button-sized'\nimport { useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport { FunctionComponent, forwardRef, useContext } from 'react'\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSized,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n pointerEvents: 'none',\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n userSelect: 'none',\n cursor: 'pointer',\n // flexGrow 1 leads to inconsistent native style where text pushes to start of view\n flexGrow: 0,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport function useButton(\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import {\n ButtonNestingContext,\n GetProps,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n isRSC,\n spacedChildren,\n styled,\n themeable,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getButtonSized } from '@tamagui/get-button-sized'\nimport { useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport { FunctionComponent, forwardRef, useContext } from 'react'\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSized,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n pointerEvents: 'none',\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n userSelect: 'none',\n cursor: 'pointer',\n // flexGrow 1 leads to inconsistent native style where text pushes to start of view\n flexGrow: 0,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport function useButton(\n propsIn: ButtonProps,\n { Text = ButtonText }: { Text: any } = { Text: ButtonText },\n) {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 0.66,\n separator,\n\n // text props\n color,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n ...rest\n } = propsIn\n\n const isNested = isRSC ? false : useContext(ButtonNestingContext)\n const propsActive = useMediaPropsActive(propsIn)\n const size = propsActive.size || '$4'\n const iconSize =\n (typeof size === 'number' ? size * 0.5 : getFontSize(size)) * scaleIcon\n const getThemedIcon = useGetThemedIcon({ size: iconSize, color })\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)\n const spaceSize = getVariableValue(iconSize) * scaleSpace\n const contents = wrapChildrenInText(Text, propsActive)\n const inner =\n themedIcon || themedIconAfter\n ? spacedChildren({\n // a bit arbitrary but scaling to font size is necessary so long as button does\n space: spaceSize,\n spaceFlex,\n separator,\n direction:\n propsActive.flexDirection === 'column' ||\n propsActive.flexDirection === 'column-reverse'\n ? 'vertical'\n : 'horizontal',\n children: [themedIcon, contents, themedIconAfter],\n })\n : contents\n\n const props = {\n ...(propsActive.disabled && {\n // in rnw - false still has keyboard tabIndex, undefined = not actually focusable\n focusable: undefined,\n // even with tabIndex unset, it will keep focusStyle on web so disable it here\n focusStyle: {\n borderColor: '$background',\n },\n }),\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n tag: isNested ? 'span' : undefined,\n ...rest,\n children: isRSC ? (\n inner\n ) : (\n <ButtonNestingContext.Provider value={true}>\n {inner}\n </ButtonNestingContext.Provider>\n ),\n }\n\n return {\n spaceSize,\n isNested,\n props,\n }\n}\n\nconst ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(\n props,\n ref,\n) {\n const { props: buttonProps } = useButton(props)\n return <ButtonFrame {...buttonProps} ref={ref} />\n})\n\nexport const buttonStaticConfig = {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract button anyway)\n // may be able to remove this entirely, as the compiler / runtime have gotten better\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n}\n\nexport const Button = ButtonFrame.extractable(\n themeable(ButtonComponent, ButtonFrame.staticConfig),\n buttonStaticConfig,\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4LM;AA5LN,kBAWO;AACP,uBAA4B;AAC5B,8BAA+B;AAC/B,6BAAiC;AACjC,oBAA+B;AAC/B,kBAAkE;AAClE,mBAA0D;AAiC1D,MAAM,OAAO;AAEN,MAAM,kBAAc,oBAAO,8BAAgB;AAAA,EAChD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX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
|
package/dist/esm/Button.js
CHANGED
|
@@ -67,7 +67,7 @@ const ButtonText = styled(SizableText, {
|
|
|
67
67
|
flexShrink: 1,
|
|
68
68
|
ellipse: true
|
|
69
69
|
});
|
|
70
|
-
function useButton(
|
|
70
|
+
function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
71
71
|
const {
|
|
72
72
|
children,
|
|
73
73
|
icon,
|
|
@@ -87,41 +87,40 @@ function useButton(props, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
87
87
|
textAlign,
|
|
88
88
|
textProps,
|
|
89
89
|
...rest
|
|
90
|
-
} =
|
|
90
|
+
} = propsIn;
|
|
91
91
|
const isNested = isRSC ? false : useContext(ButtonNestingContext);
|
|
92
|
-
const
|
|
93
|
-
const size =
|
|
92
|
+
const propsActive = useMediaPropsActive(propsIn);
|
|
93
|
+
const size = propsActive.size || "$4";
|
|
94
94
|
const iconSize = (typeof size === "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
95
95
|
const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
|
|
96
96
|
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
97
97
|
const spaceSize = getVariableValue(iconSize) * scaleSpace;
|
|
98
|
-
const contents = wrapChildrenInText(Text,
|
|
98
|
+
const contents = wrapChildrenInText(Text, propsActive);
|
|
99
99
|
const inner = themedIcon || themedIconAfter ? spacedChildren({
|
|
100
100
|
space: spaceSize,
|
|
101
101
|
spaceFlex,
|
|
102
102
|
separator,
|
|
103
|
-
direction:
|
|
103
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
104
104
|
children: [themedIcon, contents, themedIconAfter]
|
|
105
105
|
}) : contents;
|
|
106
|
+
const props = {
|
|
107
|
+
...propsActive.disabled && {
|
|
108
|
+
focusable: void 0,
|
|
109
|
+
focusStyle: {
|
|
110
|
+
borderColor: "$background"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
tag: isNested ? "span" : void 0,
|
|
114
|
+
...rest,
|
|
115
|
+
children: isRSC ? inner : /* @__PURE__ */ jsx(ButtonNestingContext.Provider, {
|
|
116
|
+
value: true,
|
|
117
|
+
children: inner
|
|
118
|
+
})
|
|
119
|
+
};
|
|
106
120
|
return {
|
|
107
121
|
spaceSize,
|
|
108
122
|
isNested,
|
|
109
|
-
props
|
|
110
|
-
...props.disabled && {
|
|
111
|
-
focusable: void 0,
|
|
112
|
-
focusStyle: {
|
|
113
|
-
borderColor: "$background"
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
...isNested ? {
|
|
117
|
-
tag: "span"
|
|
118
|
-
} : {},
|
|
119
|
-
...rest,
|
|
120
|
-
children: isRSC ? inner : /* @__PURE__ */ jsx(ButtonNestingContext.Provider, {
|
|
121
|
-
value: true,
|
|
122
|
-
children: inner
|
|
123
|
-
})
|
|
124
|
-
}
|
|
123
|
+
props
|
|
125
124
|
};
|
|
126
125
|
}
|
|
127
126
|
const ButtonComponent = forwardRef(function Button(props, ref) {
|
package/dist/esm/Button.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n ButtonNestingContext,\n GetProps,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n isRSC,\n spacedChildren,\n styled,\n themeable,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getButtonSized } from '@tamagui/get-button-sized'\nimport { useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport { FunctionComponent, forwardRef, useContext } from 'react'\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSized,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n pointerEvents: 'none',\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n userSelect: 'none',\n cursor: 'pointer',\n // flexGrow 1 leads to inconsistent native style where text pushes to start of view\n flexGrow: 0,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport function useButton(\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import {\n ButtonNestingContext,\n GetProps,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n isRSC,\n spacedChildren,\n styled,\n themeable,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getButtonSized } from '@tamagui/get-button-sized'\nimport { useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport { FunctionComponent, forwardRef, useContext } from 'react'\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSized,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n pointerEvents: 'none',\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n userSelect: 'none',\n cursor: 'pointer',\n // flexGrow 1 leads to inconsistent native style where text pushes to start of view\n flexGrow: 0,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport function useButton(\n propsIn: ButtonProps,\n { Text = ButtonText }: { Text: any } = { Text: ButtonText },\n) {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 0.66,\n separator,\n\n // text props\n color,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n ...rest\n } = propsIn\n\n const isNested = isRSC ? false : useContext(ButtonNestingContext)\n const propsActive = useMediaPropsActive(propsIn)\n const size = propsActive.size || '$4'\n const iconSize =\n (typeof size === 'number' ? size * 0.5 : getFontSize(size)) * scaleIcon\n const getThemedIcon = useGetThemedIcon({ size: iconSize, color })\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)\n const spaceSize = getVariableValue(iconSize) * scaleSpace\n const contents = wrapChildrenInText(Text, propsActive)\n const inner =\n themedIcon || themedIconAfter\n ? spacedChildren({\n // a bit arbitrary but scaling to font size is necessary so long as button does\n space: spaceSize,\n spaceFlex,\n separator,\n direction:\n propsActive.flexDirection === 'column' ||\n propsActive.flexDirection === 'column-reverse'\n ? 'vertical'\n : 'horizontal',\n children: [themedIcon, contents, themedIconAfter],\n })\n : contents\n\n const props = {\n ...(propsActive.disabled && {\n // in rnw - false still has keyboard tabIndex, undefined = not actually focusable\n focusable: undefined,\n // even with tabIndex unset, it will keep focusStyle on web so disable it here\n focusStyle: {\n borderColor: '$background',\n },\n }),\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n tag: isNested ? 'span' : undefined,\n ...rest,\n children: isRSC ? (\n inner\n ) : (\n <ButtonNestingContext.Provider value={true}>\n {inner}\n </ButtonNestingContext.Provider>\n ),\n }\n\n return {\n spaceSize,\n isNested,\n props,\n }\n}\n\nconst ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(\n props,\n ref,\n) {\n const { props: buttonProps } = useButton(props)\n return <ButtonFrame {...buttonProps} ref={ref} />\n})\n\nexport const buttonStaticConfig = {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract button anyway)\n // may be able to remove this entirely, as the compiler / runtime have gotten better\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n}\n\nexport const Button = ButtonFrame.extractable(\n themeable(ButtonComponent, ButtonFrame.staticConfig),\n buttonStaticConfig,\n)\n"],
|
|
5
|
+
"mappings": "AA4LM;AA5LN;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,aAA+B,0BAA0B;AAClE,SAA4B,YAAY,kBAAkB;AAiC1D,MAAM,OAAO;AAEN,MAAM,cAAc,OAAO,gBAAgB;AAAA,EAChD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EAGf,QAAQ;AAAA,EAER,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,IAEA,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,eAAe;AAAA,MACjB;AAAA,IACF;AAA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A,MACf;AAAA,IACF;AAAA,IAEA,KAAK,WAAW,SAAS;AAAA,IACzB,GAAG;AAAA,IACH,UAAU,QACR,QAEA,oBAAC,qBAAqB,UAArB;AAAA,MAA8B,OAAO;AAAA,MACnC;AAAA,KACH;AAAA,EAEJ;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,MAAM,kBAAkB,WAAwC,SAAS,OACvE,OACA,KACA;AACA,QAAM,EAAE,OAAO,YAAY,IAAI,UAAU,KAAK;AAC9C,SAAO,oBAAC;AAAA,IAAa,GAAG;AAAA,IAAa;AAAA,GAAU;AACjD,CAAC;AAEM,MAAM,qBAAqB;AAAA,EAChC,aAAa,oBAAI,IAAI;AAAA,IAGnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEO,MAAMA,UAAS,YAAY;AAAA,EAChC,UAAU,iBAAiB,YAAY,YAAY;AAAA,EACnD;AACF;",
|
|
6
6
|
"names": ["Button"]
|
|
7
7
|
}
|
package/dist/jsx/Button.js
CHANGED
|
@@ -66,7 +66,7 @@ const ButtonText = styled(SizableText, {
|
|
|
66
66
|
flexShrink: 1,
|
|
67
67
|
ellipse: true
|
|
68
68
|
});
|
|
69
|
-
function useButton(
|
|
69
|
+
function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
70
70
|
const {
|
|
71
71
|
children,
|
|
72
72
|
icon,
|
|
@@ -86,38 +86,37 @@ function useButton(props, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
86
86
|
textAlign,
|
|
87
87
|
textProps,
|
|
88
88
|
...rest
|
|
89
|
-
} =
|
|
89
|
+
} = propsIn;
|
|
90
90
|
const isNested = isRSC ? false : useContext(ButtonNestingContext);
|
|
91
|
-
const
|
|
92
|
-
const size =
|
|
91
|
+
const propsActive = useMediaPropsActive(propsIn);
|
|
92
|
+
const size = propsActive.size || "$4";
|
|
93
93
|
const iconSize = (typeof size === "number" ? size * 0.5 : getFontSize(size)) * scaleIcon;
|
|
94
94
|
const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
|
|
95
95
|
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
|
|
96
96
|
const spaceSize = getVariableValue(iconSize) * scaleSpace;
|
|
97
|
-
const contents = wrapChildrenInText(Text,
|
|
97
|
+
const contents = wrapChildrenInText(Text, propsActive);
|
|
98
98
|
const inner = themedIcon || themedIconAfter ? spacedChildren({
|
|
99
99
|
space: spaceSize,
|
|
100
100
|
spaceFlex,
|
|
101
101
|
separator,
|
|
102
|
-
direction:
|
|
102
|
+
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
103
103
|
children: [themedIcon, contents, themedIconAfter]
|
|
104
104
|
}) : contents;
|
|
105
|
+
const props = {
|
|
106
|
+
...propsActive.disabled && {
|
|
107
|
+
focusable: void 0,
|
|
108
|
+
focusStyle: {
|
|
109
|
+
borderColor: "$background"
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
tag: isNested ? "span" : void 0,
|
|
113
|
+
...rest,
|
|
114
|
+
children: isRSC ? inner : <ButtonNestingContext.Provider value={true}>{inner}</ButtonNestingContext.Provider>
|
|
115
|
+
};
|
|
105
116
|
return {
|
|
106
117
|
spaceSize,
|
|
107
118
|
isNested,
|
|
108
|
-
props
|
|
109
|
-
...props.disabled && {
|
|
110
|
-
focusable: void 0,
|
|
111
|
-
focusStyle: {
|
|
112
|
-
borderColor: "$background"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
...isNested ? {
|
|
116
|
-
tag: "span"
|
|
117
|
-
} : {},
|
|
118
|
-
...rest,
|
|
119
|
-
children: isRSC ? inner : <ButtonNestingContext.Provider value={true}>{inner}</ButtonNestingContext.Provider>
|
|
120
|
-
}
|
|
119
|
+
props
|
|
121
120
|
};
|
|
122
121
|
}
|
|
123
122
|
const ButtonComponent = forwardRef(function Button(props, ref) {
|
package/dist/jsx/Button.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n ButtonNestingContext,\n GetProps,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n isRSC,\n spacedChildren,\n styled,\n themeable,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getButtonSized } from '@tamagui/get-button-sized'\nimport { useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport { FunctionComponent, forwardRef, useContext } from 'react'\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSized,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n pointerEvents: 'none',\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n userSelect: 'none',\n cursor: 'pointer',\n // flexGrow 1 leads to inconsistent native style where text pushes to start of view\n flexGrow: 0,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport function useButton(\n
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,aAA+B,0BAA0B;AAClE,SAA4B,YAAY,kBAAkB;AAiC1D,MAAM,OAAO;AAEN,MAAM,cAAc,OAAO,gBAAgB;AAAA,EAChD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,eAAe;AAAA,EAGf,QAAQ;AAAA,EAER,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,YAAY;AAAA,IACV,aAAa;AAAA,EACf;AAAA,EAEA,UAAU;AAAA,IACR,MAAM;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,IAEA,QAAQ;AAAA,MACN,MAAM;AAAA,QACJ,YAAY;AAAA,UACV,iBAAiB;AAAA,QACnB;AAAA,MACF;AAAA,IACF;AAAA,IAEA,UAAU;AAAA,MACR,MAAM;AAAA,QACJ,eAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF;AAAA,EAEA,iBAAiB;AAAA,IACf,MAAM;AAAA,EACR;AACF,CAAC;AAMM,MAAM,aAAa,OAAO,aAAa;AAAA,EAC5C,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAQ;AAAA,EAER,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,SAAS;AACX,CAAC;AAEM,SAAS,UACd,
|
|
4
|
+
"sourcesContent": ["import {\n ButtonNestingContext,\n GetProps,\n TamaguiElement,\n ThemeableProps,\n getVariableValue,\n isRSC,\n spacedChildren,\n styled,\n themeable,\n useMediaPropsActive,\n} from '@tamagui/core'\nimport { getFontSize } from '@tamagui/font-size'\nimport { getButtonSized } from '@tamagui/get-button-sized'\nimport { useGetThemedIcon } from '@tamagui/helpers-tamagui'\nimport { ThemeableStack } from '@tamagui/stacks'\nimport { SizableText, TextParentStyles, wrapChildrenInText } from '@tamagui/text'\nimport { FunctionComponent, forwardRef, useContext } from 'react'\n\ntype ButtonIconProps = { color?: string; size?: number }\ntype IconProp = JSX.Element | FunctionComponent<ButtonIconProps> | null\n\nexport type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &\n GetProps<typeof ButtonFrame> &\n ThemeableProps & {\n /**\n * add icon before, passes color and size automatically if Component\n */\n icon?: IconProp\n /**\n * add icon after, passes color and size automatically if Component\n */\n iconAfter?: IconProp\n /**\n * adjust icon relative to size\n */\n /**\n * default: -1\n */\n scaleIcon?: number\n /**\n * make the spacing elements flex\n */\n spaceFlex?: number | boolean\n /**\n * adjust internal space relative to icon size\n */\n scaleSpace?: number\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n\n // if we wanted this only when pressable = true, we'd need to merge variants?\n cursor: 'pointer',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n\n variants: {\n size: {\n '...size': getButtonSized,\n },\n\n active: {\n true: {\n hoverStyle: {\n backgroundColor: '$background',\n },\n },\n },\n\n disabled: {\n true: {\n pointerEvents: 'none',\n },\n },\n } as const,\n\n defaultVariants: {\n size: '$4',\n },\n})\n\n// see TODO breaking types\n// type x = GetProps<typeof ButtonFrame>\n// type y = x['size']\n\nexport const ButtonText = styled(SizableText, {\n color: '$color',\n userSelect: 'none',\n cursor: 'pointer',\n // flexGrow 1 leads to inconsistent native style where text pushes to start of view\n flexGrow: 0,\n flexShrink: 1,\n ellipse: true,\n})\n\nexport function useButton(\n propsIn: ButtonProps,\n { Text = ButtonText }: { Text: any } = { Text: ButtonText },\n) {\n // careful not to desctructure and re-order props, order is important\n const {\n children,\n icon,\n iconAfter,\n noTextWrap,\n theme: themeName,\n space,\n spaceFlex,\n scaleIcon = 1,\n scaleSpace = 0.66,\n separator,\n\n // text props\n color,\n fontWeight,\n letterSpacing,\n fontSize,\n fontFamily,\n textAlign,\n textProps,\n ...rest\n } = propsIn\n\n const isNested = isRSC ? false : useContext(ButtonNestingContext)\n const propsActive = useMediaPropsActive(propsIn)\n const size = propsActive.size || '$4'\n const iconSize =\n (typeof size === 'number' ? size * 0.5 : getFontSize(size)) * scaleIcon\n const getThemedIcon = useGetThemedIcon({ size: iconSize, color })\n const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)\n const spaceSize = getVariableValue(iconSize) * scaleSpace\n const contents = wrapChildrenInText(Text, propsActive)\n const inner =\n themedIcon || themedIconAfter\n ? spacedChildren({\n // a bit arbitrary but scaling to font size is necessary so long as button does\n space: spaceSize,\n spaceFlex,\n separator,\n direction:\n propsActive.flexDirection === 'column' ||\n propsActive.flexDirection === 'column-reverse'\n ? 'vertical'\n : 'horizontal',\n children: [themedIcon, contents, themedIconAfter],\n })\n : contents\n\n const props = {\n ...(propsActive.disabled && {\n // in rnw - false still has keyboard tabIndex, undefined = not actually focusable\n focusable: undefined,\n // even with tabIndex unset, it will keep focusStyle on web so disable it here\n focusStyle: {\n borderColor: '$background',\n },\n }),\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n tag: isNested ? 'span' : undefined,\n ...rest,\n children: isRSC ? (\n inner\n ) : (\n <ButtonNestingContext.Provider value={true}>\n {inner}\n </ButtonNestingContext.Provider>\n ),\n }\n\n return {\n spaceSize,\n isNested,\n props,\n }\n}\n\nconst ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(\n props,\n ref,\n) {\n const { props: buttonProps } = useButton(props)\n return <ButtonFrame {...buttonProps} ref={ref} />\n})\n\nexport const buttonStaticConfig = {\n inlineProps: new Set([\n // text props go here (can't really optimize them, but we never fully extract button anyway)\n // may be able to remove this entirely, as the compiler / runtime have gotten better\n 'color',\n 'fontWeight',\n 'fontSize',\n 'fontFamily',\n 'letterSpacing',\n 'textAlign',\n ]),\n}\n\nexport const Button = ButtonFrame.extractable(\n themeable(ButtonComponent, ButtonFrame.staticConfig),\n buttonStaticConfig,\n)\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,sBAAsB;AAC/B,SAAS,aAA+B,0BAA0B;AAClE,SAA4B,YAAY,kBAAkB;AAiC1D,MAAM,OAAO;AAEN,MAAM,cAAc,OAAO,gBAAgB;AAAA,EAChD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,aAAa;AAAA,EACb,aAAa;A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
+
"version": "1.0.1-rc.10",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tamagui-build",
|
|
19
19
|
"watch": "tamagui-build --watch",
|
|
20
|
-
"lint": "
|
|
21
|
-
"lint:fix": "
|
|
20
|
+
"lint": "../../node_modules/.bin/rome check src",
|
|
21
|
+
"lint:fix": "../../node_modules/.bin/rome check --apply-suggested src"
|
|
22
22
|
},
|
|
23
23
|
"exports": {
|
|
24
24
|
"./package.json": "./package.json",
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@tamagui/core": "^1.0.1-rc.
|
|
32
|
-
"@tamagui/font-size": "^1.0.1-rc.
|
|
33
|
-
"@tamagui/get-button-sized": "^1.0.1-rc.
|
|
34
|
-
"@tamagui/helpers-tamagui": "^1.0.1-rc.
|
|
31
|
+
"@tamagui/core": "^1.0.1-rc.10",
|
|
32
|
+
"@tamagui/font-size": "^1.0.1-rc.10",
|
|
33
|
+
"@tamagui/get-button-sized": "^1.0.1-rc.10",
|
|
34
|
+
"@tamagui/helpers-tamagui": "^1.0.1-rc.10"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"react": "
|
|
38
|
-
"react-dom": "
|
|
37
|
+
"react": "^18.2.0",
|
|
38
|
+
"react-dom": "^18.2.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "^1.0.1-rc.
|
|
42
|
-
"react": "
|
|
43
|
-
"react-dom": "
|
|
41
|
+
"@tamagui/build": "^1.0.1-rc.10",
|
|
42
|
+
"react": "^18.2.0",
|
|
43
|
+
"react-dom": "^18.2.0"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
package/src/Button.tsx
CHANGED
|
@@ -119,8 +119,8 @@ export const ButtonText = styled(SizableText, {
|
|
|
119
119
|
})
|
|
120
120
|
|
|
121
121
|
export function useButton(
|
|
122
|
-
|
|
123
|
-
{ Text = ButtonText }: { Text: any } = { Text: ButtonText }
|
|
122
|
+
propsIn: ButtonProps,
|
|
123
|
+
{ Text = ButtonText }: { Text: any } = { Text: ButtonText },
|
|
124
124
|
) {
|
|
125
125
|
// careful not to desctructure and re-order props, order is important
|
|
126
126
|
const {
|
|
@@ -144,16 +144,17 @@ export function useButton(
|
|
|
144
144
|
textAlign,
|
|
145
145
|
textProps,
|
|
146
146
|
...rest
|
|
147
|
-
} =
|
|
147
|
+
} = propsIn
|
|
148
148
|
|
|
149
149
|
const isNested = isRSC ? false : useContext(ButtonNestingContext)
|
|
150
|
-
const
|
|
151
|
-
const size =
|
|
152
|
-
const iconSize =
|
|
150
|
+
const propsActive = useMediaPropsActive(propsIn)
|
|
151
|
+
const size = propsActive.size || '$4'
|
|
152
|
+
const iconSize =
|
|
153
|
+
(typeof size === 'number' ? size * 0.5 : getFontSize(size)) * scaleIcon
|
|
153
154
|
const getThemedIcon = useGetThemedIcon({ size: iconSize, color })
|
|
154
155
|
const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)
|
|
155
156
|
const spaceSize = getVariableValue(iconSize) * scaleSpace
|
|
156
|
-
const contents = wrapChildrenInText(Text,
|
|
157
|
+
const contents = wrapChildrenInText(Text, propsActive)
|
|
157
158
|
const inner =
|
|
158
159
|
themedIcon || themedIconAfter
|
|
159
160
|
? spacedChildren({
|
|
@@ -162,42 +163,46 @@ export function useButton(
|
|
|
162
163
|
spaceFlex,
|
|
163
164
|
separator,
|
|
164
165
|
direction:
|
|
165
|
-
|
|
166
|
+
propsActive.flexDirection === 'column' ||
|
|
167
|
+
propsActive.flexDirection === 'column-reverse'
|
|
166
168
|
? 'vertical'
|
|
167
169
|
: 'horizontal',
|
|
168
170
|
children: [themedIcon, contents, themedIconAfter],
|
|
169
171
|
})
|
|
170
172
|
: contents
|
|
171
173
|
|
|
174
|
+
const props = {
|
|
175
|
+
...(propsActive.disabled && {
|
|
176
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
177
|
+
focusable: undefined,
|
|
178
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
179
|
+
focusStyle: {
|
|
180
|
+
borderColor: '$background',
|
|
181
|
+
},
|
|
182
|
+
}),
|
|
183
|
+
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
184
|
+
tag: isNested ? 'span' : undefined,
|
|
185
|
+
...rest,
|
|
186
|
+
children: isRSC ? (
|
|
187
|
+
inner
|
|
188
|
+
) : (
|
|
189
|
+
<ButtonNestingContext.Provider value={true}>
|
|
190
|
+
{inner}
|
|
191
|
+
</ButtonNestingContext.Provider>
|
|
192
|
+
),
|
|
193
|
+
}
|
|
194
|
+
|
|
172
195
|
return {
|
|
173
196
|
spaceSize,
|
|
174
197
|
isNested,
|
|
175
|
-
props
|
|
176
|
-
...(props.disabled && {
|
|
177
|
-
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
178
|
-
focusable: undefined,
|
|
179
|
-
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
180
|
-
focusStyle: {
|
|
181
|
-
borderColor: '$background',
|
|
182
|
-
},
|
|
183
|
-
}),
|
|
184
|
-
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
185
|
-
...(isNested
|
|
186
|
-
? {
|
|
187
|
-
tag: 'span',
|
|
188
|
-
}
|
|
189
|
-
: {}),
|
|
190
|
-
...rest,
|
|
191
|
-
children: isRSC ? (
|
|
192
|
-
inner
|
|
193
|
-
) : (
|
|
194
|
-
<ButtonNestingContext.Provider value={true}>{inner}</ButtonNestingContext.Provider>
|
|
195
|
-
),
|
|
196
|
-
},
|
|
198
|
+
props,
|
|
197
199
|
}
|
|
198
200
|
}
|
|
199
201
|
|
|
200
|
-
const ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(
|
|
202
|
+
const ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(
|
|
203
|
+
props,
|
|
204
|
+
ref,
|
|
205
|
+
) {
|
|
201
206
|
const { props: buttonProps } = useButton(props)
|
|
202
207
|
return <ButtonFrame {...buttonProps} ref={ref} />
|
|
203
208
|
})
|
|
@@ -217,5 +222,5 @@ export const buttonStaticConfig = {
|
|
|
217
222
|
|
|
218
223
|
export const Button = ButtonFrame.extractable(
|
|
219
224
|
themeable(ButtonComponent, ButtonFrame.staticConfig),
|
|
220
|
-
buttonStaticConfig
|
|
225
|
+
buttonStaticConfig,
|
|
221
226
|
)
|
package/types/Button.d.ts
CHANGED
|
@@ -35,7 +35,6 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
|
|
|
35
35
|
readonly fullscreen?: boolean | undefined;
|
|
36
36
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
37
37
|
} & {
|
|
38
|
-
readonly fontFamily?: unknown;
|
|
39
38
|
readonly backgrounded?: boolean | undefined;
|
|
40
39
|
readonly radiused?: boolean | undefined;
|
|
41
40
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -55,7 +54,6 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
|
|
|
55
54
|
readonly fullscreen?: boolean | undefined;
|
|
56
55
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
57
56
|
} & {
|
|
58
|
-
readonly fontFamily?: unknown;
|
|
59
57
|
readonly backgrounded?: boolean | undefined;
|
|
60
58
|
readonly radiused?: boolean | undefined;
|
|
61
59
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -75,7 +73,6 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
|
|
|
75
73
|
readonly fullscreen?: boolean | undefined;
|
|
76
74
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
77
75
|
} & {
|
|
78
|
-
readonly fontFamily?: unknown;
|
|
79
76
|
readonly backgrounded?: boolean | undefined;
|
|
80
77
|
readonly radiused?: boolean | undefined;
|
|
81
78
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -95,7 +92,6 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
|
|
|
95
92
|
readonly fullscreen?: boolean | undefined;
|
|
96
93
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
97
94
|
} & {
|
|
98
|
-
readonly fontFamily?: unknown;
|
|
99
95
|
readonly backgrounded?: boolean | undefined;
|
|
100
96
|
readonly radiused?: boolean | undefined;
|
|
101
97
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -137,7 +133,7 @@ export declare const ButtonText: import("@tamagui/core").TamaguiComponent<(Omit<
|
|
|
137
133
|
} & {
|
|
138
134
|
[x: string]: undefined;
|
|
139
135
|
})>;
|
|
140
|
-
export declare function useButton(
|
|
136
|
+
export declare function useButton(propsIn: ButtonProps, { Text }?: {
|
|
141
137
|
Text: any;
|
|
142
138
|
}): {
|
|
143
139
|
spaceSize: number;
|
|
@@ -180,6 +176,18 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
180
176
|
onTouchEnd?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
181
177
|
onTouchCancel?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
182
178
|
onTouchEndCapture?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
179
|
+
onPointerEnter?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
180
|
+
onPointerEnterCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
181
|
+
onPointerLeave?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
182
|
+
onPointerLeaveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
183
|
+
onPointerMove?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
184
|
+
onPointerMoveCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
185
|
+
onPointerCancel?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
186
|
+
onPointerCancelCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
187
|
+
onPointerDown?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
188
|
+
onPointerDownCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
189
|
+
onPointerUp?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
190
|
+
onPointerUpCapture?: ((event: import("react-native").PointerEvent) => void) | undefined;
|
|
183
191
|
accessible?: boolean | undefined;
|
|
184
192
|
accessibilityActions?: readonly Readonly<{
|
|
185
193
|
name: string;
|
|
@@ -193,9 +201,11 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
193
201
|
accessibilityHint?: string | undefined;
|
|
194
202
|
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
195
203
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
204
|
+
accessibilityLabelledBy?: string | string[] | undefined;
|
|
196
205
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
197
206
|
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
198
207
|
accessibilityElementsHidden?: boolean | undefined;
|
|
208
|
+
accessibilityLanguage?: string | undefined;
|
|
199
209
|
accessibilityViewIsModal?: boolean | undefined;
|
|
200
210
|
onAccessibilityEscape?: (() => void) | undefined;
|
|
201
211
|
onAccessibilityTap?: (() => void) | undefined;
|
|
@@ -231,16 +241,16 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
231
241
|
dangerouslySetInnerHTML?: {
|
|
232
242
|
__html: string;
|
|
233
243
|
} | undefined;
|
|
234
|
-
animation?: import("@tamagui/core").AnimationProp | undefined;
|
|
244
|
+
animation?: import("@tamagui/core").AnimationProp | null | undefined;
|
|
235
245
|
animateOnly?: string[] | undefined;
|
|
236
246
|
debug?: boolean | "verbose" | undefined;
|
|
237
247
|
disabled?: boolean | undefined;
|
|
238
248
|
className?: string | undefined;
|
|
239
249
|
themeShallow?: boolean | undefined;
|
|
240
250
|
id?: string | undefined;
|
|
241
|
-
tag
|
|
251
|
+
tag: string | undefined;
|
|
242
252
|
componentName?: string | undefined;
|
|
243
|
-
forceStyle?: "
|
|
253
|
+
forceStyle?: "focus" | "hover" | "press" | undefined;
|
|
244
254
|
onHoverIn?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
245
255
|
onHoverOut?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
|
|
246
256
|
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
|
|
@@ -372,7 +382,6 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
372
382
|
readonly fullscreen?: boolean | undefined;
|
|
373
383
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
374
384
|
} & {
|
|
375
|
-
readonly fontFamily?: unknown;
|
|
376
385
|
readonly backgrounded?: boolean | undefined;
|
|
377
386
|
readonly radiused?: boolean | undefined;
|
|
378
387
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -393,7 +402,6 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
393
402
|
readonly fullscreen?: boolean | undefined;
|
|
394
403
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
395
404
|
} & {
|
|
396
|
-
readonly fontFamily?: unknown;
|
|
397
405
|
readonly backgrounded?: boolean | undefined;
|
|
398
406
|
readonly radiused?: boolean | undefined;
|
|
399
407
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -414,7 +422,6 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
414
422
|
readonly fullscreen?: boolean | undefined;
|
|
415
423
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
416
424
|
} & {
|
|
417
|
-
readonly fontFamily?: unknown;
|
|
418
425
|
readonly backgrounded?: boolean | undefined;
|
|
419
426
|
readonly radiused?: boolean | undefined;
|
|
420
427
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -435,7 +442,6 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
435
442
|
readonly fullscreen?: boolean | undefined;
|
|
436
443
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
437
444
|
} & {
|
|
438
|
-
readonly fontFamily?: unknown;
|
|
439
445
|
readonly backgrounded?: boolean | undefined;
|
|
440
446
|
readonly radiused?: boolean | undefined;
|
|
441
447
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -456,7 +462,6 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
456
462
|
readonly fullscreen?: boolean | undefined;
|
|
457
463
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
458
464
|
} & {
|
|
459
|
-
readonly fontFamily?: unknown;
|
|
460
465
|
readonly backgrounded?: boolean | undefined;
|
|
461
466
|
readonly radiused?: boolean | undefined;
|
|
462
467
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -474,7 +479,7 @@ export declare function useButton(props: ButtonProps, { Text }?: {
|
|
|
474
479
|
readonly disabled?: boolean | undefined;
|
|
475
480
|
}> | null | undefined;
|
|
476
481
|
themeInverse?: boolean | undefined;
|
|
477
|
-
|
|
482
|
+
themeReset?: boolean | undefined;
|
|
478
483
|
};
|
|
479
484
|
};
|
|
480
485
|
export declare const buttonStaticConfig: {
|
|
@@ -484,7 +489,6 @@ export declare const Button: (props: Omit<Omit<TextParentStyles, "TextComponent"
|
|
|
484
489
|
readonly fullscreen?: boolean | undefined;
|
|
485
490
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
486
491
|
} & {
|
|
487
|
-
readonly fontFamily?: unknown;
|
|
488
492
|
readonly backgrounded?: boolean | undefined;
|
|
489
493
|
readonly radiused?: boolean | undefined;
|
|
490
494
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -504,7 +508,6 @@ export declare const Button: (props: Omit<Omit<TextParentStyles, "TextComponent"
|
|
|
504
508
|
readonly fullscreen?: boolean | undefined;
|
|
505
509
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
506
510
|
} & {
|
|
507
|
-
readonly fontFamily?: unknown;
|
|
508
511
|
readonly backgrounded?: boolean | undefined;
|
|
509
512
|
readonly radiused?: boolean | undefined;
|
|
510
513
|
readonly hoverTheme?: boolean | undefined;
|
|
@@ -524,7 +527,6 @@ export declare const Button: (props: Omit<Omit<TextParentStyles, "TextComponent"
|
|
|
524
527
|
readonly fullscreen?: boolean | undefined;
|
|
525
528
|
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
526
529
|
} & {
|
|
527
|
-
readonly fontFamily?: unknown;
|
|
528
530
|
readonly backgrounded?: boolean | undefined;
|
|
529
531
|
readonly radiused?: boolean | undefined;
|
|
530
532
|
readonly hoverTheme?: boolean | undefined;
|