@tamagui/button 1.1.8 → 1.1.9
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 +15 -9
- package/dist/cjs/Button.js.map +1 -1
- package/dist/esm/Button.js +15 -9
- package/dist/esm/Button.js.map +1 -1
- package/dist/jsx/Button.js +13 -1
- package/dist/jsx/Button.js.map +1 -1
- package/package.json +6 -6
package/dist/cjs/Button.js
CHANGED
|
@@ -47,6 +47,7 @@ const ButtonFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
|
|
|
47
47
|
alignItems: "center",
|
|
48
48
|
flexWrap: "nowrap",
|
|
49
49
|
flexDirection: "row",
|
|
50
|
+
// if we wanted this only when pressable = true, we'd need to merge variants?
|
|
50
51
|
cursor: "pointer",
|
|
51
52
|
pressStyle: {
|
|
52
53
|
borderColor: "transparent"
|
|
@@ -82,6 +83,7 @@ const ButtonText = (0, import_core.styled)(import_text.SizableText, {
|
|
|
82
83
|
color: "$color",
|
|
83
84
|
userSelect: "none",
|
|
84
85
|
cursor: "pointer",
|
|
86
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
85
87
|
flexGrow: 0,
|
|
86
88
|
flexShrink: 1,
|
|
87
89
|
ellipse: true
|
|
@@ -98,6 +100,7 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
98
100
|
scaleIcon = 1,
|
|
99
101
|
scaleSpace = 0.66,
|
|
100
102
|
separator,
|
|
103
|
+
// text props
|
|
101
104
|
color,
|
|
102
105
|
fontWeight,
|
|
103
106
|
letterSpacing,
|
|
@@ -116,26 +119,30 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
116
119
|
const spaceSize = propsActive.space ?? (0, import_core.getVariableValue)(iconSize) * scaleSpace;
|
|
117
120
|
const contents = (0, import_text.wrapChildrenInText)(Text, propsActive);
|
|
118
121
|
const inner = (0, import_core.spacedChildren)({
|
|
122
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
119
123
|
space: spaceSize,
|
|
120
124
|
spaceFlex,
|
|
121
125
|
separator,
|
|
122
126
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
123
127
|
children: [themedIcon, ...contents, themedIconAfter]
|
|
124
128
|
});
|
|
125
|
-
const tag = isNested ? "span" :
|
|
129
|
+
const tag = isNested ? "span" : (
|
|
130
|
+
// defaults to <a /> when accessibilityRole = link
|
|
131
|
+
// see https://github.com/tamagui/tamagui/issues/505
|
|
132
|
+
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
133
|
+
);
|
|
126
134
|
const props = {
|
|
127
135
|
...propsActive.disabled && {
|
|
136
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
128
137
|
focusable: void 0,
|
|
138
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
129
139
|
focusStyle: {
|
|
130
140
|
borderColor: "$background"
|
|
131
141
|
}
|
|
132
142
|
},
|
|
133
143
|
tag,
|
|
134
144
|
...rest,
|
|
135
|
-
children: import_core.isRSC ? inner : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ButtonNestingContext.Provider, {
|
|
136
|
-
value: true,
|
|
137
|
-
children: inner
|
|
138
|
-
})
|
|
145
|
+
children: import_core.isRSC ? inner : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core.ButtonNestingContext.Provider, { value: true, children: inner })
|
|
139
146
|
};
|
|
140
147
|
return {
|
|
141
148
|
spaceSize,
|
|
@@ -145,13 +152,12 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
145
152
|
}
|
|
146
153
|
const ButtonComponent = (0, import_react.forwardRef)(function Button(props, ref) {
|
|
147
154
|
const { props: buttonProps } = useButton(props);
|
|
148
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, {
|
|
149
|
-
...buttonProps,
|
|
150
|
-
ref
|
|
151
|
-
});
|
|
155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, { ...buttonProps, ref });
|
|
152
156
|
});
|
|
153
157
|
const buttonStaticConfig = {
|
|
154
158
|
inlineProps: /* @__PURE__ */ new Set([
|
|
159
|
+
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
160
|
+
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
155
161
|
"color",
|
|
156
162
|
"fontWeight",
|
|
157
163
|
"fontSize",
|
package/dist/cjs/Button.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
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: '$true',\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 || '$true'\n const iconSize = (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 = propsActive.space ?? getVariableValue(iconSize) * scaleSpace\n const contents = wrapChildrenInText(Text, propsActive)\n const inner = 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\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n const tag = isNested\n ? 'span'\n : // defaults to <a /> when accessibilityRole = link\n // see https://github.com/tamagui/tamagui/issues/505\n propsIn.accessibilityRole === 'link'\n ? 'a'\n : undefined\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 tag,\n ...rest,\n children: isRSC ? (\n inner\n ) : (\n <ButtonNestingContext.Provider value={true}>{inner}</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;AAgMM;AAhMN,kBAWO;AACP,uBAA4B;AAC5B,8BAA+B;AAC/B,6BAAiC;AACjC,oBAA+B;AAC/B,kBAAkE;AAClE,mBAA0D;AAiC1D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M,EAAE,OAAO,YAAY,IAAI,UAAU,KAAK;AAC9C,SAAO,4CAAC,eAAa,GAAG,aAAa,KAAU;AACjD,CAAC;AAEM,MAAM,qBAAqB;AAAA,EAChC,aAAa,oBAAI,IAAI;AAAA;AAAA;AAAA,IAGnB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;AAEO,MAAMA,UAAS,YAAY;AAAA,MAChC,uBAAU,iBAAiB,YAAY,YAAY;AAAA,EACnD;AACF;",
|
|
6
6
|
"names": ["Button"]
|
|
7
7
|
}
|
package/dist/esm/Button.js
CHANGED
|
@@ -28,6 +28,7 @@ const ButtonFrame = styled(ThemeableStack, {
|
|
|
28
28
|
alignItems: "center",
|
|
29
29
|
flexWrap: "nowrap",
|
|
30
30
|
flexDirection: "row",
|
|
31
|
+
// if we wanted this only when pressable = true, we'd need to merge variants?
|
|
31
32
|
cursor: "pointer",
|
|
32
33
|
pressStyle: {
|
|
33
34
|
borderColor: "transparent"
|
|
@@ -63,6 +64,7 @@ const ButtonText = styled(SizableText, {
|
|
|
63
64
|
color: "$color",
|
|
64
65
|
userSelect: "none",
|
|
65
66
|
cursor: "pointer",
|
|
67
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
66
68
|
flexGrow: 0,
|
|
67
69
|
flexShrink: 1,
|
|
68
70
|
ellipse: true
|
|
@@ -79,6 +81,7 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
79
81
|
scaleIcon = 1,
|
|
80
82
|
scaleSpace = 0.66,
|
|
81
83
|
separator,
|
|
84
|
+
// text props
|
|
82
85
|
color,
|
|
83
86
|
fontWeight,
|
|
84
87
|
letterSpacing,
|
|
@@ -97,26 +100,30 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
97
100
|
const spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace;
|
|
98
101
|
const contents = wrapChildrenInText(Text, propsActive);
|
|
99
102
|
const inner = spacedChildren({
|
|
103
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
100
104
|
space: spaceSize,
|
|
101
105
|
spaceFlex,
|
|
102
106
|
separator,
|
|
103
107
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
104
108
|
children: [themedIcon, ...contents, themedIconAfter]
|
|
105
109
|
});
|
|
106
|
-
const tag = isNested ? "span" :
|
|
110
|
+
const tag = isNested ? "span" : (
|
|
111
|
+
// defaults to <a /> when accessibilityRole = link
|
|
112
|
+
// see https://github.com/tamagui/tamagui/issues/505
|
|
113
|
+
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
114
|
+
);
|
|
107
115
|
const props = {
|
|
108
116
|
...propsActive.disabled && {
|
|
117
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
109
118
|
focusable: void 0,
|
|
119
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
110
120
|
focusStyle: {
|
|
111
121
|
borderColor: "$background"
|
|
112
122
|
}
|
|
113
123
|
},
|
|
114
124
|
tag,
|
|
115
125
|
...rest,
|
|
116
|
-
children: isRSC ? inner : /* @__PURE__ */ jsx(ButtonNestingContext.Provider, {
|
|
117
|
-
value: true,
|
|
118
|
-
children: inner
|
|
119
|
-
})
|
|
126
|
+
children: isRSC ? inner : /* @__PURE__ */ jsx(ButtonNestingContext.Provider, { value: true, children: inner })
|
|
120
127
|
};
|
|
121
128
|
return {
|
|
122
129
|
spaceSize,
|
|
@@ -126,13 +133,12 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
126
133
|
}
|
|
127
134
|
const ButtonComponent = forwardRef(function Button(props, ref) {
|
|
128
135
|
const { props: buttonProps } = useButton(props);
|
|
129
|
-
return /* @__PURE__ */ jsx(ButtonFrame, {
|
|
130
|
-
...buttonProps,
|
|
131
|
-
ref
|
|
132
|
-
});
|
|
136
|
+
return /* @__PURE__ */ jsx(ButtonFrame, { ...buttonProps, ref });
|
|
133
137
|
});
|
|
134
138
|
const buttonStaticConfig = {
|
|
135
139
|
inlineProps: /* @__PURE__ */ new Set([
|
|
140
|
+
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
141
|
+
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
136
142
|
"color",
|
|
137
143
|
"fontWeight",
|
|
138
144
|
"fontSize",
|
package/dist/esm/Button.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
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: '$true',\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 || '$true'\n const iconSize = (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 = propsActive.space ?? getVariableValue(iconSize) * scaleSpace\n const contents = wrapChildrenInText(Text, propsActive)\n const inner = 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\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n const tag = isNested\n ? 'span'\n : // defaults to <a /> when accessibilityRole = link\n // see https://github.com/tamagui/tamagui/issues/505\n propsIn.accessibilityRole === 'link'\n ? 'a'\n : undefined\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 tag,\n ...rest,\n children: isRSC ? (\n inner\n ) : (\n <ButtonNestingContext.Provider value={true}>{inner}</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": "AAgMM;AAhMN;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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AAM,EAAE,OAAO,YAAY,IAAI,UAAU,KAAK;AAC9C,SAAO,oBAAC,eAAa,GAAG,aAAa,KAAU;AACjD,CAAC;AAEM,MAAM,qBAAqB;AAAA,EAChC,aAAa,oBAAI,IAAI;AAAA;AAAA;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
|
@@ -27,6 +27,7 @@ const ButtonFrame = styled(ThemeableStack, {
|
|
|
27
27
|
alignItems: "center",
|
|
28
28
|
flexWrap: "nowrap",
|
|
29
29
|
flexDirection: "row",
|
|
30
|
+
// if we wanted this only when pressable = true, we'd need to merge variants?
|
|
30
31
|
cursor: "pointer",
|
|
31
32
|
pressStyle: {
|
|
32
33
|
borderColor: "transparent"
|
|
@@ -62,6 +63,7 @@ const ButtonText = styled(SizableText, {
|
|
|
62
63
|
color: "$color",
|
|
63
64
|
userSelect: "none",
|
|
64
65
|
cursor: "pointer",
|
|
66
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
65
67
|
flexGrow: 0,
|
|
66
68
|
flexShrink: 1,
|
|
67
69
|
ellipse: true
|
|
@@ -78,6 +80,7 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
78
80
|
scaleIcon = 1,
|
|
79
81
|
scaleSpace = 0.66,
|
|
80
82
|
separator,
|
|
83
|
+
// text props
|
|
81
84
|
color,
|
|
82
85
|
fontWeight,
|
|
83
86
|
letterSpacing,
|
|
@@ -96,16 +99,23 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
|
|
|
96
99
|
const spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace;
|
|
97
100
|
const contents = wrapChildrenInText(Text, propsActive);
|
|
98
101
|
const inner = spacedChildren({
|
|
102
|
+
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
99
103
|
space: spaceSize,
|
|
100
104
|
spaceFlex,
|
|
101
105
|
separator,
|
|
102
106
|
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
103
107
|
children: [themedIcon, ...contents, themedIconAfter]
|
|
104
108
|
});
|
|
105
|
-
const tag = isNested ? "span" :
|
|
109
|
+
const tag = isNested ? "span" : (
|
|
110
|
+
// defaults to <a /> when accessibilityRole = link
|
|
111
|
+
// see https://github.com/tamagui/tamagui/issues/505
|
|
112
|
+
propsIn.accessibilityRole === "link" ? "a" : void 0
|
|
113
|
+
);
|
|
106
114
|
const props = {
|
|
107
115
|
...propsActive.disabled && {
|
|
116
|
+
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
108
117
|
focusable: void 0,
|
|
118
|
+
// even with tabIndex unset, it will keep focusStyle on web so disable it here
|
|
109
119
|
focusStyle: {
|
|
110
120
|
borderColor: "$background"
|
|
111
121
|
}
|
|
@@ -126,6 +136,8 @@ const ButtonComponent = forwardRef(function Button(props, ref) {
|
|
|
126
136
|
});
|
|
127
137
|
const buttonStaticConfig = {
|
|
128
138
|
inlineProps: /* @__PURE__ */ new Set([
|
|
139
|
+
// text props go here (can't really optimize them, but we never fully extract button anyway)
|
|
140
|
+
// may be able to remove this entirely, as the compiler / runtime have gotten better
|
|
129
141
|
"color",
|
|
130
142
|
"fontWeight",
|
|
131
143
|
"fontSize",
|
package/dist/jsx/Button.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Button.tsx"],
|
|
4
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: '$true',\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 || '$true'\n const iconSize = (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 = propsActive.space ?? getVariableValue(iconSize) * scaleSpace\n const contents = wrapChildrenInText(Text, propsActive)\n const inner = 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\n // fixes SSR issue + DOM nesting issue of not allowing button in button\n const tag = isNested\n ? 'span'\n : // defaults to <a /> when accessibilityRole = link\n // see https://github.com/tamagui/tamagui/issues/505\n propsIn.accessibilityRole === 'link'\n ? 'a'\n : undefined\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 tag,\n ...rest,\n children: isRSC ? (\n inner\n ) : (\n <ButtonNestingContext.Provider value={true}>{inner}</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;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;A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WAAW,mBAAmB,MAAM,WAAW;AACrD,QAAM,QAAQ,eAAe;AAAA;AAAA,IAE3B,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA,WACE,YAAY,kBAAkB,YAC9B,YAAY,kBAAkB,mBAC1B,aACA;AAAA,IACN,UAAU,CAAC,YAAY,GAAG,UAAU,eAAe;AAAA,EACrD,CAAC;AAGD,QAAM,MAAM,WACR;AAAA;AAAA;AAAA,IAGF,QAAQ,sBAAsB,SAC5B,MACA;AAAA;AAEJ,QAAM,QAAQ;AAAA,IACZ,GAAI,YAAY,YAAY;AAAA;AAAA,MAE1B,WAAW;AAAA;AAAA,MAEX,YAAY;AAAA,QACV,aAAa;AAAA,MACf;AAAA,IACF;AAAA,IACA;AAAA,IACA,GAAG;AAAA,IACH,UAAU,QACR,QAEA,CAAC,qBAAqB,SAAS,OAAO,OAAO,MAAM,EAAlD,qBAAqB;AAAA,EAE1B;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,CAAC,gBAAgB,aAAa,KAAK,KAAK;AACjD,CAAC;AAEM,MAAM,qBAAqB;AAAA,EAChC,aAAa,oBAAI,IAAI;AAAA;AAAA;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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/button",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -29,17 +29,17 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tamagui/core": "^1.1.
|
|
33
|
-
"@tamagui/font-size": "^1.1.
|
|
34
|
-
"@tamagui/get-button-sized": "^1.1.
|
|
35
|
-
"@tamagui/helpers-tamagui": "^1.1.
|
|
32
|
+
"@tamagui/core": "^1.1.9",
|
|
33
|
+
"@tamagui/font-size": "^1.1.9",
|
|
34
|
+
"@tamagui/get-button-sized": "^1.1.9",
|
|
35
|
+
"@tamagui/helpers-tamagui": "^1.1.9"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": "*",
|
|
39
39
|
"react-dom": "*"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@tamagui/build": "^1.1.
|
|
42
|
+
"@tamagui/build": "^1.1.9",
|
|
43
43
|
"react": "^18.2.0",
|
|
44
44
|
"react-dom": "^18.2.0",
|
|
45
45
|
"vitest": "^0.26.3"
|