@tamagui/button 1.2.3 → 1.2.4

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.
@@ -37,28 +37,31 @@ const NAME = "Button";
37
37
  const ButtonFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
38
38
  name: NAME,
39
39
  tag: "button",
40
- focusable: true,
41
- hoverTheme: true,
42
- pressTheme: true,
43
- backgrounded: true,
44
- borderWidth: 1,
45
- borderColor: "transparent",
46
40
  justifyContent: "center",
47
41
  alignItems: "center",
48
42
  flexWrap: "nowrap",
49
43
  flexDirection: "row",
50
- // if we wanted this only when pressable = true, we'd need to merge variants?
51
44
  cursor: "pointer",
52
- pressStyle: {
53
- borderColor: "transparent"
54
- },
55
- hoverStyle: {
56
- borderColor: "transparent"
57
- },
58
- focusStyle: {
59
- borderColor: "$borderColorFocus"
60
- },
61
45
  variants: {
46
+ defaultStyle: {
47
+ true: {
48
+ focusable: true,
49
+ hoverTheme: true,
50
+ pressTheme: true,
51
+ backgrounded: true,
52
+ borderWidth: 1,
53
+ borderColor: "transparent",
54
+ pressStyle: {
55
+ borderColor: "transparent"
56
+ },
57
+ hoverStyle: {
58
+ borderColor: "transparent"
59
+ },
60
+ focusStyle: {
61
+ borderColor: "$borderColorFocus"
62
+ }
63
+ }
64
+ },
62
65
  size: {
63
66
  "...size": import_get_button_sized.getButtonSized
64
67
  },
@@ -80,14 +83,44 @@ const ButtonFrame = (0, import_core.styled)(import_stacks.ThemeableStack, {
80
83
  }
81
84
  });
82
85
  const ButtonText = (0, import_core.styled)(import_text.SizableText, {
83
- color: "$color",
86
+ name: "ButtonText",
84
87
  userSelect: "none",
85
88
  cursor: "pointer",
86
89
  // flexGrow 1 leads to inconsistent native style where text pushes to start of view
87
90
  flexGrow: 0,
88
91
  flexShrink: 1,
89
- ellipse: true
92
+ ellipse: true,
93
+ variants: {
94
+ defaultStyle: {
95
+ true: {
96
+ color: "$color"
97
+ }
98
+ }
99
+ }
90
100
  });
101
+ const ButtonComponent = (0, import_react.forwardRef)(function Button(props, ref) {
102
+ const {
103
+ props: { unstyled, ...buttonProps }
104
+ } = useButton(props);
105
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, { defaultStyle: !unstyled, ...buttonProps, ref });
106
+ });
107
+ const buttonStaticConfig = {
108
+ inlineProps: /* @__PURE__ */ new Set([
109
+ // text props go here (can't really optimize them, but we never fully extract button anyway)
110
+ // may be able to remove this entirely, as the compiler / runtime have gotten better
111
+ "color",
112
+ "fontWeight",
113
+ "fontSize",
114
+ "fontFamily",
115
+ "letterSpacing",
116
+ "textAlign",
117
+ "unstyled"
118
+ ])
119
+ };
120
+ const Button2 = ButtonFrame.extractable(
121
+ (0, import_core.themeable)(ButtonComponent, ButtonFrame.staticConfig),
122
+ buttonStaticConfig
123
+ );
91
124
  function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
92
125
  const {
93
126
  children,
@@ -117,7 +150,13 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
117
150
  const getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color });
118
151
  const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
119
152
  const spaceSize = propsActive.space ?? (0, import_core.getVariableValue)(iconSize) * scaleSpace;
120
- const contents = (0, import_text.wrapChildrenInText)(Text, propsActive);
153
+ const contents = (0, import_text.wrapChildrenInText)(
154
+ Text,
155
+ propsActive,
156
+ Text === ButtonText ? {
157
+ defaultStyle: !propsIn.unstyled
158
+ } : void 0
159
+ );
121
160
  const inner = (0, import_core.spacedChildren)({
122
161
  // a bit arbitrary but scaling to font size is necessary so long as button does
123
162
  space: spaceSize,
@@ -150,26 +189,6 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
150
189
  props
151
190
  };
152
191
  }
153
- const ButtonComponent = (0, import_react.forwardRef)(function Button(props, ref) {
154
- const { props: buttonProps } = useButton(props);
155
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, { ...buttonProps, ref });
156
- });
157
- const buttonStaticConfig = {
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
161
- "color",
162
- "fontWeight",
163
- "fontSize",
164
- "fontFamily",
165
- "letterSpacing",
166
- "textAlign"
167
- ])
168
- };
169
- const Button2 = ButtonFrame.extractable(
170
- (0, import_core.themeable)(ButtonComponent, ButtonFrame.staticConfig),
171
- buttonStaticConfig
172
- );
173
192
  // Annotate the CommonJS export names for ESM import in node:
174
193
  0 && (module.exports = {
175
194
  Button,
@@ -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: '$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,oB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a,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;",
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 * @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 *\n */\n unstyled?: boolean\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n cursor: 'pointer',\n\n variants: {\n defaultStyle: {\n true: {\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n },\n },\n\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\nexport const ButtonText = styled(SizableText, {\n name: 'ButtonText',\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 variants: {\n defaultStyle: {\n true: {\n color: '$color',\n },\n },\n },\n})\n\nconst ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(\n props,\n ref\n) {\n const {\n props: { unstyled, ...buttonProps },\n } = useButton(props)\n return <ButtonFrame defaultStyle={!unstyled} {...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 'unstyled',\n ]),\n}\n\nexport const Button = ButtonFrame.extractable(\n themeable(ButtonComponent, ButtonFrame.staticConfig),\n buttonStaticConfig\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(\n Text,\n propsActive,\n Text === ButtonText\n ? {\n defaultStyle: !propsIn.unstyled,\n }\n : undefined\n )\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyIS;AAzIT,kBAWO;AACP,uBAA4B;AAC5B,8BAA+B;AAC/B,6BAAiC;AACjC,oBAA+B;AAC/B,kBAAkE;AAClE,mBAA0D;AAoC1D,MAAM,OAAO;AAEN,MAAM,kBAAc,oBAAO,8BAAgB;AAAA,EAChD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,UAAU;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EJ,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,oBACR,QAEA,4CAAC,iCAAqB,UAArB,EAA8B,OAAO,MAAO,iBAAM;AAAA,EAEvD;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": ["Button"]
7
7
  }
@@ -18,28 +18,31 @@ const NAME = "Button";
18
18
  const ButtonFrame = styled(ThemeableStack, {
19
19
  name: NAME,
20
20
  tag: "button",
21
- focusable: true,
22
- hoverTheme: true,
23
- pressTheme: true,
24
- backgrounded: true,
25
- borderWidth: 1,
26
- borderColor: "transparent",
27
21
  justifyContent: "center",
28
22
  alignItems: "center",
29
23
  flexWrap: "nowrap",
30
24
  flexDirection: "row",
31
- // if we wanted this only when pressable = true, we'd need to merge variants?
32
25
  cursor: "pointer",
33
- pressStyle: {
34
- borderColor: "transparent"
35
- },
36
- hoverStyle: {
37
- borderColor: "transparent"
38
- },
39
- focusStyle: {
40
- borderColor: "$borderColorFocus"
41
- },
42
26
  variants: {
27
+ defaultStyle: {
28
+ true: {
29
+ focusable: true,
30
+ hoverTheme: true,
31
+ pressTheme: true,
32
+ backgrounded: true,
33
+ borderWidth: 1,
34
+ borderColor: "transparent",
35
+ pressStyle: {
36
+ borderColor: "transparent"
37
+ },
38
+ hoverStyle: {
39
+ borderColor: "transparent"
40
+ },
41
+ focusStyle: {
42
+ borderColor: "$borderColorFocus"
43
+ }
44
+ }
45
+ },
43
46
  size: {
44
47
  "...size": getButtonSized
45
48
  },
@@ -61,14 +64,44 @@ const ButtonFrame = styled(ThemeableStack, {
61
64
  }
62
65
  });
63
66
  const ButtonText = styled(SizableText, {
64
- color: "$color",
67
+ name: "ButtonText",
65
68
  userSelect: "none",
66
69
  cursor: "pointer",
67
70
  // flexGrow 1 leads to inconsistent native style where text pushes to start of view
68
71
  flexGrow: 0,
69
72
  flexShrink: 1,
70
- ellipse: true
73
+ ellipse: true,
74
+ variants: {
75
+ defaultStyle: {
76
+ true: {
77
+ color: "$color"
78
+ }
79
+ }
80
+ }
71
81
  });
82
+ const ButtonComponent = forwardRef(function Button(props, ref) {
83
+ const {
84
+ props: { unstyled, ...buttonProps }
85
+ } = useButton(props);
86
+ return /* @__PURE__ */ jsx(ButtonFrame, { defaultStyle: !unstyled, ...buttonProps, ref });
87
+ });
88
+ const buttonStaticConfig = {
89
+ inlineProps: /* @__PURE__ */ new Set([
90
+ // text props go here (can't really optimize them, but we never fully extract button anyway)
91
+ // may be able to remove this entirely, as the compiler / runtime have gotten better
92
+ "color",
93
+ "fontWeight",
94
+ "fontSize",
95
+ "fontFamily",
96
+ "letterSpacing",
97
+ "textAlign",
98
+ "unstyled"
99
+ ])
100
+ };
101
+ const Button2 = ButtonFrame.extractable(
102
+ themeable(ButtonComponent, ButtonFrame.staticConfig),
103
+ buttonStaticConfig
104
+ );
72
105
  function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
73
106
  const {
74
107
  children,
@@ -98,7 +131,13 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
98
131
  const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
99
132
  const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
100
133
  const spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace;
101
- const contents = wrapChildrenInText(Text, propsActive);
134
+ const contents = wrapChildrenInText(
135
+ Text,
136
+ propsActive,
137
+ Text === ButtonText ? {
138
+ defaultStyle: !propsIn.unstyled
139
+ } : void 0
140
+ );
102
141
  const inner = spacedChildren({
103
142
  // a bit arbitrary but scaling to font size is necessary so long as button does
104
143
  space: spaceSize,
@@ -131,26 +170,6 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
131
170
  props
132
171
  };
133
172
  }
134
- const ButtonComponent = forwardRef(function Button(props, ref) {
135
- const { props: buttonProps } = useButton(props);
136
- return /* @__PURE__ */ jsx(ButtonFrame, { ...buttonProps, ref });
137
- });
138
- const buttonStaticConfig = {
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
142
- "color",
143
- "fontWeight",
144
- "fontSize",
145
- "fontFamily",
146
- "letterSpacing",
147
- "textAlign"
148
- ])
149
- };
150
- const Button2 = ButtonFrame.extractable(
151
- themeable(ButtonComponent, ButtonFrame.staticConfig),
152
- buttonStaticConfig
153
- );
154
173
  export {
155
174
  Button2 as Button,
156
175
  ButtonFrame,
@@ -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: '$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,sBA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AAU;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;",
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 * @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 *\n */\n unstyled?: boolean\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n cursor: 'pointer',\n\n variants: {\n defaultStyle: {\n true: {\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n },\n },\n\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\nexport const ButtonText = styled(SizableText, {\n name: 'ButtonText',\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 variants: {\n defaultStyle: {\n true: {\n color: '$color',\n },\n },\n },\n})\n\nconst ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(\n props,\n ref\n) {\n const {\n props: { unstyled, ...buttonProps },\n } = useButton(props)\n return <ButtonFrame defaultStyle={!unstyled} {...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 'unstyled',\n ]),\n}\n\nexport const Button = ButtonFrame.extractable(\n themeable(ButtonComponent, ButtonFrame.staticConfig),\n buttonStaticConfig\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(\n Text,\n propsActive,\n Text === ButtonText\n ? {\n defaultStyle: !propsIn.unstyled,\n }\n : undefined\n )\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"],
5
+ "mappings": "AAyIS;AAzIT;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;AAoC1D,MAAM,OAAO;AAEN,MAAM,cAAc,OAAO,gBAAgB;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,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,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,MAAO,iBAAM;AAAA,EAEvD;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": ["Button"]
7
7
  }
@@ -17,28 +17,31 @@ const NAME = "Button";
17
17
  const ButtonFrame = styled(ThemeableStack, {
18
18
  name: NAME,
19
19
  tag: "button",
20
- focusable: true,
21
- hoverTheme: true,
22
- pressTheme: true,
23
- backgrounded: true,
24
- borderWidth: 1,
25
- borderColor: "transparent",
26
20
  justifyContent: "center",
27
21
  alignItems: "center",
28
22
  flexWrap: "nowrap",
29
23
  flexDirection: "row",
30
- // if we wanted this only when pressable = true, we'd need to merge variants?
31
24
  cursor: "pointer",
32
- pressStyle: {
33
- borderColor: "transparent"
34
- },
35
- hoverStyle: {
36
- borderColor: "transparent"
37
- },
38
- focusStyle: {
39
- borderColor: "$borderColorFocus"
40
- },
41
25
  variants: {
26
+ defaultStyle: {
27
+ true: {
28
+ focusable: true,
29
+ hoverTheme: true,
30
+ pressTheme: true,
31
+ backgrounded: true,
32
+ borderWidth: 1,
33
+ borderColor: "transparent",
34
+ pressStyle: {
35
+ borderColor: "transparent"
36
+ },
37
+ hoverStyle: {
38
+ borderColor: "transparent"
39
+ },
40
+ focusStyle: {
41
+ borderColor: "$borderColorFocus"
42
+ }
43
+ }
44
+ },
42
45
  size: {
43
46
  "...size": getButtonSized
44
47
  },
@@ -60,14 +63,44 @@ const ButtonFrame = styled(ThemeableStack, {
60
63
  }
61
64
  });
62
65
  const ButtonText = styled(SizableText, {
63
- color: "$color",
66
+ name: "ButtonText",
64
67
  userSelect: "none",
65
68
  cursor: "pointer",
66
69
  // flexGrow 1 leads to inconsistent native style where text pushes to start of view
67
70
  flexGrow: 0,
68
71
  flexShrink: 1,
69
- ellipse: true
72
+ ellipse: true,
73
+ variants: {
74
+ defaultStyle: {
75
+ true: {
76
+ color: "$color"
77
+ }
78
+ }
79
+ }
70
80
  });
81
+ const ButtonComponent = forwardRef(function Button(props, ref) {
82
+ const {
83
+ props: { unstyled, ...buttonProps }
84
+ } = useButton(props);
85
+ return <ButtonFrame defaultStyle={!unstyled} {...buttonProps} ref={ref} />;
86
+ });
87
+ const buttonStaticConfig = {
88
+ inlineProps: /* @__PURE__ */ new Set([
89
+ // text props go here (can't really optimize them, but we never fully extract button anyway)
90
+ // may be able to remove this entirely, as the compiler / runtime have gotten better
91
+ "color",
92
+ "fontWeight",
93
+ "fontSize",
94
+ "fontFamily",
95
+ "letterSpacing",
96
+ "textAlign",
97
+ "unstyled"
98
+ ])
99
+ };
100
+ const Button2 = ButtonFrame.extractable(
101
+ themeable(ButtonComponent, ButtonFrame.staticConfig),
102
+ buttonStaticConfig
103
+ );
71
104
  function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
72
105
  const {
73
106
  children,
@@ -97,7 +130,13 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
97
130
  const getThemedIcon = useGetThemedIcon({ size: iconSize, color });
98
131
  const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon);
99
132
  const spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace;
100
- const contents = wrapChildrenInText(Text, propsActive);
133
+ const contents = wrapChildrenInText(
134
+ Text,
135
+ propsActive,
136
+ Text === ButtonText ? {
137
+ defaultStyle: !propsIn.unstyled
138
+ } : void 0
139
+ );
101
140
  const inner = spacedChildren({
102
141
  // a bit arbitrary but scaling to font size is necessary so long as button does
103
142
  space: spaceSize,
@@ -130,26 +169,6 @@ function useButton(propsIn, { Text = ButtonText } = { Text: ButtonText }) {
130
169
  props
131
170
  };
132
171
  }
133
- const ButtonComponent = forwardRef(function Button(props, ref) {
134
- const { props: buttonProps } = useButton(props);
135
- return <ButtonFrame {...buttonProps} ref={ref} />;
136
- });
137
- const buttonStaticConfig = {
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
141
- "color",
142
- "fontWeight",
143
- "fontSize",
144
- "fontFamily",
145
- "letterSpacing",
146
- "textAlign"
147
- ])
148
- };
149
- const Button2 = ButtonFrame.extractable(
150
- themeable(ButtonComponent, ButtonFrame.staticConfig),
151
- buttonStaticConfig
152
- );
153
172
  export {
154
173
  Button2 as Button,
155
174
  ButtonFrame,
@@ -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: '$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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U,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;",
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 * @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 *\n */\n unstyled?: boolean\n }\n\nconst NAME = 'Button'\n\nexport const ButtonFrame = styled(ThemeableStack, {\n name: NAME,\n tag: 'button',\n justifyContent: 'center',\n alignItems: 'center',\n flexWrap: 'nowrap',\n flexDirection: 'row',\n cursor: 'pointer',\n\n variants: {\n defaultStyle: {\n true: {\n focusable: true,\n hoverTheme: true,\n pressTheme: true,\n backgrounded: true,\n borderWidth: 1,\n borderColor: 'transparent',\n\n pressStyle: {\n borderColor: 'transparent',\n },\n\n hoverStyle: {\n borderColor: 'transparent',\n },\n\n focusStyle: {\n borderColor: '$borderColorFocus',\n },\n },\n },\n\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\nexport const ButtonText = styled(SizableText, {\n name: 'ButtonText',\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 variants: {\n defaultStyle: {\n true: {\n color: '$color',\n },\n },\n },\n})\n\nconst ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(\n props,\n ref\n) {\n const {\n props: { unstyled, ...buttonProps },\n } = useButton(props)\n return <ButtonFrame defaultStyle={!unstyled} {...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 'unstyled',\n ]),\n}\n\nexport const Button = ButtonFrame.extractable(\n themeable(ButtonComponent, ButtonFrame.staticConfig),\n buttonStaticConfig\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(\n Text,\n propsActive,\n Text === ButtonText\n ? {\n defaultStyle: !propsIn.unstyled,\n }\n : undefined\n )\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"],
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;AAoC1D,MAA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AAG,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;",
6
6
  "names": ["Button"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/button",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "sideEffects": [
5
5
  "*.css"
6
6
  ],
@@ -29,17 +29,17 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@tamagui/core": "^1.2.3",
33
- "@tamagui/font-size": "^1.2.3",
34
- "@tamagui/get-button-sized": "^1.2.3",
35
- "@tamagui/helpers-tamagui": "^1.2.3"
32
+ "@tamagui/core": "^1.2.4",
33
+ "@tamagui/font-size": "^1.2.4",
34
+ "@tamagui/get-button-sized": "^1.2.4",
35
+ "@tamagui/helpers-tamagui": "^1.2.4"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": "*",
39
39
  "react-dom": "*"
40
40
  },
41
41
  "devDependencies": {
42
- "@tamagui/build": "^1.2.3",
42
+ "@tamagui/build": "^1.2.4",
43
43
  "react": "^18.2.0",
44
44
  "react-dom": "^18.2.0",
45
45
  "vitest": "^0.26.3"
package/src/Button.tsx CHANGED
@@ -33,9 +33,8 @@ export type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &
33
33
  iconAfter?: IconProp
34
34
  /**
35
35
  * adjust icon relative to size
36
- */
37
- /**
38
- * default: -1
36
+ *
37
+ * @default 1
39
38
  */
40
39
  scaleIcon?: number
41
40
  /**
@@ -46,6 +45,10 @@ export type ButtonProps = Omit<TextParentStyles, 'TextComponent'> &
46
45
  * adjust internal space relative to icon size
47
46
  */
48
47
  scaleSpace?: number
48
+ /**
49
+ *
50
+ */
51
+ unstyled?: boolean
49
52
  }
50
53
 
51
54
  const NAME = 'Button'
@@ -53,33 +56,36 @@ const NAME = 'Button'
53
56
  export const ButtonFrame = styled(ThemeableStack, {
54
57
  name: NAME,
55
58
  tag: 'button',
56
- focusable: true,
57
- hoverTheme: true,
58
- pressTheme: true,
59
- backgrounded: true,
60
- borderWidth: 1,
61
- borderColor: 'transparent',
62
59
  justifyContent: 'center',
63
60
  alignItems: 'center',
64
61
  flexWrap: 'nowrap',
65
62
  flexDirection: 'row',
66
-
67
- // if we wanted this only when pressable = true, we'd need to merge variants?
68
63
  cursor: 'pointer',
69
64
 
70
- pressStyle: {
71
- borderColor: 'transparent',
72
- },
65
+ variants: {
66
+ defaultStyle: {
67
+ true: {
68
+ focusable: true,
69
+ hoverTheme: true,
70
+ pressTheme: true,
71
+ backgrounded: true,
72
+ borderWidth: 1,
73
+ borderColor: 'transparent',
74
+
75
+ pressStyle: {
76
+ borderColor: 'transparent',
77
+ },
73
78
 
74
- hoverStyle: {
75
- borderColor: 'transparent',
76
- },
79
+ hoverStyle: {
80
+ borderColor: 'transparent',
81
+ },
77
82
 
78
- focusStyle: {
79
- borderColor: '$borderColorFocus',
80
- },
83
+ focusStyle: {
84
+ borderColor: '$borderColorFocus',
85
+ },
86
+ },
87
+ },
81
88
 
82
- variants: {
83
89
  size: {
84
90
  '...size': getButtonSized,
85
91
  },
@@ -104,20 +110,53 @@ export const ButtonFrame = styled(ThemeableStack, {
104
110
  },
105
111
  })
106
112
 
107
- // see TODO breaking types
108
- // type x = GetProps<typeof ButtonFrame>
109
- // type y = x['size']
110
-
111
113
  export const ButtonText = styled(SizableText, {
112
- color: '$color',
114
+ name: 'ButtonText',
113
115
  userSelect: 'none',
114
116
  cursor: 'pointer',
115
117
  // flexGrow 1 leads to inconsistent native style where text pushes to start of view
116
118
  flexGrow: 0,
117
119
  flexShrink: 1,
118
120
  ellipse: true,
121
+
122
+ variants: {
123
+ defaultStyle: {
124
+ true: {
125
+ color: '$color',
126
+ },
127
+ },
128
+ },
129
+ })
130
+
131
+ const ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(
132
+ props,
133
+ ref
134
+ ) {
135
+ const {
136
+ props: { unstyled, ...buttonProps },
137
+ } = useButton(props)
138
+ return <ButtonFrame defaultStyle={!unstyled} {...buttonProps} ref={ref} />
119
139
  })
120
140
 
141
+ export const buttonStaticConfig = {
142
+ inlineProps: new Set([
143
+ // text props go here (can't really optimize them, but we never fully extract button anyway)
144
+ // may be able to remove this entirely, as the compiler / runtime have gotten better
145
+ 'color',
146
+ 'fontWeight',
147
+ 'fontSize',
148
+ 'fontFamily',
149
+ 'letterSpacing',
150
+ 'textAlign',
151
+ 'unstyled',
152
+ ]),
153
+ }
154
+
155
+ export const Button = ButtonFrame.extractable(
156
+ themeable(ButtonComponent, ButtonFrame.staticConfig),
157
+ buttonStaticConfig
158
+ )
159
+
121
160
  export function useButton(
122
161
  propsIn: ButtonProps,
123
162
  { Text = ButtonText }: { Text: any } = { Text: ButtonText }
@@ -153,7 +192,15 @@ export function useButton(
153
192
  const getThemedIcon = useGetThemedIcon({ size: iconSize, color })
154
193
  const [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon)
155
194
  const spaceSize = propsActive.space ?? getVariableValue(iconSize) * scaleSpace
156
- const contents = wrapChildrenInText(Text, propsActive)
195
+ const contents = wrapChildrenInText(
196
+ Text,
197
+ propsActive,
198
+ Text === ButtonText
199
+ ? {
200
+ defaultStyle: !propsIn.unstyled,
201
+ }
202
+ : undefined
203
+ )
157
204
  const inner = spacedChildren({
158
205
  // a bit arbitrary but scaling to font size is necessary so long as button does
159
206
  space: spaceSize,
@@ -200,29 +247,3 @@ export function useButton(
200
247
  props,
201
248
  }
202
249
  }
203
-
204
- const ButtonComponent = forwardRef<TamaguiElement, ButtonProps>(function Button(
205
- props,
206
- ref
207
- ) {
208
- const { props: buttonProps } = useButton(props)
209
- return <ButtonFrame {...buttonProps} ref={ref} />
210
- })
211
-
212
- export const buttonStaticConfig = {
213
- inlineProps: new Set([
214
- // text props go here (can't really optimize them, but we never fully extract button anyway)
215
- // may be able to remove this entirely, as the compiler / runtime have gotten better
216
- 'color',
217
- 'fontWeight',
218
- 'fontSize',
219
- 'fontFamily',
220
- 'letterSpacing',
221
- 'textAlign',
222
- ]),
223
- }
224
-
225
- export const Button = ButtonFrame.extractable(
226
- themeable(ButtonComponent, ButtonFrame.staticConfig),
227
- buttonStaticConfig
228
- )
package/types/Button.d.ts CHANGED
@@ -17,9 +17,8 @@ export type ButtonProps = Omit<TextParentStyles, 'TextComponent'> & GetProps<typ
17
17
  iconAfter?: IconProp;
18
18
  /**
19
19
  * adjust icon relative to size
20
- */
21
- /**
22
- * default: -1
20
+ *
21
+ * @default 1
23
22
  */
24
23
  scaleIcon?: number;
25
24
  /**
@@ -30,6 +29,10 @@ export type ButtonProps = Omit<TextParentStyles, 'TextComponent'> & GetProps<typ
30
29
  * adjust internal space relative to icon size
31
30
  */
32
31
  scaleSpace?: number;
32
+ /**
33
+ *
34
+ */
35
+ unstyled?: boolean;
33
36
  };
34
37
  export declare const ButtonFrame: 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<{
35
38
  readonly fullscreen?: boolean | undefined;
@@ -46,7 +49,8 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
46
49
  readonly bordered?: number | boolean | undefined;
47
50
  readonly transparent?: boolean | undefined;
48
51
  readonly chromeless?: boolean | "all" | undefined;
49
- }, "disabled" | "size" | "active"> & {
52
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
53
+ readonly defaultStyle?: boolean | undefined;
50
54
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
51
55
  readonly active?: boolean | undefined;
52
56
  readonly disabled?: boolean | undefined;
@@ -65,7 +69,8 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
65
69
  readonly bordered?: number | boolean | undefined;
66
70
  readonly transparent?: boolean | undefined;
67
71
  readonly chromeless?: boolean | "all" | undefined;
68
- }, "disabled" | "size" | "active"> & {
72
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
73
+ readonly defaultStyle?: boolean | undefined;
69
74
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
70
75
  readonly active?: boolean | undefined;
71
76
  readonly disabled?: boolean | undefined;
@@ -84,7 +89,8 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
84
89
  readonly bordered?: number | boolean | undefined;
85
90
  readonly transparent?: boolean | undefined;
86
91
  readonly chromeless?: boolean | "all" | undefined;
87
- }, "disabled" | "size" | "active"> & {
92
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
93
+ readonly defaultStyle?: boolean | undefined;
88
94
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
89
95
  readonly active?: boolean | undefined;
90
96
  readonly disabled?: boolean | undefined;
@@ -104,35 +110,119 @@ export declare const ButtonFrame: import("@tamagui/core").TamaguiComponent<Omit<
104
110
  readonly transparent?: boolean | undefined;
105
111
  readonly chromeless?: boolean | "all" | undefined;
106
112
  } & {
113
+ readonly defaultStyle?: boolean | undefined;
107
114
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
108
115
  readonly active?: boolean | undefined;
109
116
  readonly disabled?: boolean | undefined;
110
117
  }>;
111
- export declare const ButtonText: import("@tamagui/core").TamaguiComponent<(Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
112
- readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
113
- } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
114
- readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
115
- }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{}, "size"> & {
118
+ export declare const ButtonText: import("@tamagui/core").TamaguiComponent<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
116
119
  readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
117
- }>>) | (Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
118
- readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
119
- }, string | number> & {
120
- [x: string]: undefined;
120
+ }, "defaultStyle"> & {
121
+ defaultStyle?: boolean | undefined;
121
122
  } & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
122
123
  readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
123
- }, string | number> & {
124
- [x: string]: undefined;
124
+ }, "defaultStyle"> & {
125
+ defaultStyle?: boolean | undefined;
125
126
  }>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").TextProps, "children"> & import("@tamagui/core").RNWTextProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").TextStylePropsBase>> & Omit<{
126
127
  readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
127
- }, string | number> & {
128
- [x: string]: undefined;
129
- }>>), TamaguiElement, import("@tamagui/core").TextPropsBase, {
130
- readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
131
- } | ({
128
+ }, "defaultStyle"> & {
129
+ defaultStyle?: boolean | undefined;
130
+ }>>, TamaguiElement, import("@tamagui/core").TextPropsBase, {
132
131
  readonly size?: import("@tamagui/core").FontSizeTokens | undefined;
133
132
  } & {
134
- [x: string]: undefined;
135
- })>;
133
+ defaultStyle?: boolean | undefined;
134
+ }>;
135
+ export declare const buttonStaticConfig: {
136
+ inlineProps: Set<string>;
137
+ };
138
+ export declare const Button: (props: Omit<Omit<TextParentStyles, "TextComponent"> & 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<{
139
+ readonly fullscreen?: boolean | undefined;
140
+ readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
141
+ } & {
142
+ readonly backgrounded?: boolean | undefined;
143
+ readonly radiused?: boolean | undefined;
144
+ readonly hoverTheme?: boolean | undefined;
145
+ readonly pressTheme?: boolean | undefined;
146
+ readonly focusTheme?: boolean | undefined;
147
+ readonly circular?: boolean | undefined;
148
+ readonly padded?: boolean | undefined;
149
+ readonly elevate?: boolean | undefined;
150
+ readonly bordered?: number | boolean | undefined;
151
+ readonly transparent?: boolean | undefined;
152
+ readonly chromeless?: boolean | "all" | undefined;
153
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
154
+ readonly defaultStyle?: boolean | undefined;
155
+ readonly size?: import("@tamagui/core").SizeTokens | undefined;
156
+ readonly active?: boolean | undefined;
157
+ readonly disabled?: boolean | undefined;
158
+ } & 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<{
159
+ readonly fullscreen?: boolean | undefined;
160
+ readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
161
+ } & {
162
+ readonly backgrounded?: boolean | undefined;
163
+ readonly radiused?: boolean | undefined;
164
+ readonly hoverTheme?: boolean | undefined;
165
+ readonly pressTheme?: boolean | undefined;
166
+ readonly focusTheme?: boolean | undefined;
167
+ readonly circular?: boolean | undefined;
168
+ readonly padded?: boolean | undefined;
169
+ readonly elevate?: boolean | undefined;
170
+ readonly bordered?: number | boolean | undefined;
171
+ readonly transparent?: boolean | undefined;
172
+ readonly chromeless?: boolean | "all" | undefined;
173
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
174
+ readonly defaultStyle?: boolean | undefined;
175
+ readonly size?: import("@tamagui/core").SizeTokens | undefined;
176
+ readonly active?: boolean | undefined;
177
+ readonly disabled?: boolean | undefined;
178
+ }>> & 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<{
179
+ readonly fullscreen?: boolean | undefined;
180
+ readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
181
+ } & {
182
+ readonly backgrounded?: boolean | undefined;
183
+ readonly radiused?: boolean | undefined;
184
+ readonly hoverTheme?: boolean | undefined;
185
+ readonly pressTheme?: boolean | undefined;
186
+ readonly focusTheme?: boolean | undefined;
187
+ readonly circular?: boolean | undefined;
188
+ readonly padded?: boolean | undefined;
189
+ readonly elevate?: boolean | undefined;
190
+ readonly bordered?: number | boolean | undefined;
191
+ readonly transparent?: boolean | undefined;
192
+ readonly chromeless?: boolean | "all" | undefined;
193
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
194
+ readonly defaultStyle?: boolean | undefined;
195
+ readonly size?: import("@tamagui/core").SizeTokens | undefined;
196
+ readonly active?: boolean | undefined;
197
+ readonly disabled?: boolean | undefined;
198
+ }>> & ThemeableProps & {
199
+ /**
200
+ * add icon before, passes color and size automatically if Component
201
+ */
202
+ icon?: IconProp | undefined;
203
+ /**
204
+ * add icon after, passes color and size automatically if Component
205
+ */
206
+ iconAfter?: IconProp | undefined;
207
+ /**
208
+ * adjust icon relative to size
209
+ *
210
+ * @default 1
211
+ */
212
+ scaleIcon?: number | undefined;
213
+ /**
214
+ * make the spacing elements flex
215
+ */
216
+ spaceFlex?: number | boolean | undefined;
217
+ /**
218
+ * adjust internal space relative to icon size
219
+ */
220
+ scaleSpace?: number | undefined;
221
+ /**
222
+ *
223
+ */
224
+ unstyled?: boolean | undefined;
225
+ } & import("react").RefAttributes<TamaguiElement>, "theme" | "themeInverse"> & ThemeableProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
136
226
  export declare function useButton(propsIn: ButtonProps, { Text }?: {
137
227
  Text: any;
138
228
  }): {
@@ -196,6 +286,8 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
196
286
  accessibilityLabel?: string | undefined;
197
287
  accessibilityRole?: "none" | "button" | "link" | "search" | "image" | "keyboardkey" | "text" | "adjustable" | "imagebutton" | "header" | "summary" | "list" | undefined; /**
198
288
  * adjust icon relative to size
289
+ *
290
+ * @default 1
199
291
  */
200
292
  accessibilityState?: import("react-native").AccessibilityState | undefined;
201
293
  accessibilityHint?: string | undefined;
@@ -215,14 +307,9 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
215
307
  target?: any;
216
308
  rel?: any;
217
309
  download?: any;
218
- /**
219
- * default: -1
220
- */
221
310
  href?: string | undefined;
222
311
  hrefAttrs?: {
223
- target?: "top" | "_blank" | "_self" | "_top" | "blank" | "self" | undefined; /**
224
- * make the spacing elements flex
225
- */
312
+ target?: "top" | "_blank" | "_self" | "_top" | "blank" | "self" | undefined;
226
313
  rel?: string | undefined;
227
314
  download?: boolean | undefined;
228
315
  } | undefined;
@@ -241,7 +328,9 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
241
328
  dangerouslySetInnerHTML?: {
242
329
  __html: string;
243
330
  } | undefined;
244
- animation?: import("@tamagui/core").AnimationProp | null | undefined;
331
+ animation?: import("@tamagui/core").AnimationProp | null | undefined; /**
332
+ * adjust internal space relative to icon size
333
+ */
245
334
  animateOnly?: string[] | undefined;
246
335
  debug?: boolean | "verbose" | undefined;
247
336
  disabled?: boolean | undefined;
@@ -256,27 +345,27 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
256
345
  onPress?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
257
346
  onPressIn?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
258
347
  onPressOut?: ((event: import("react-native").GestureResponderEvent) => void) | null | undefined;
259
- backgroundColor?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ColorTokens | import("react-native").OpaqueColorValue | undefined;
260
- borderBottomColor?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ColorTokens | import("react-native").OpaqueColorValue | undefined;
261
- borderBottomEndRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
262
- borderBottomLeftRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
263
- borderBottomRightRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
264
- borderBottomStartRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
348
+ backgroundColor?: import("@tamagui/core").ColorTokens | import("@tamagui/core").ThemeValueFallback | import("react-native").OpaqueColorValue | undefined;
349
+ borderBottomColor?: import("@tamagui/core").ColorTokens | import("@tamagui/core").ThemeValueFallback | import("react-native").OpaqueColorValue | undefined;
350
+ borderBottomEndRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
351
+ borderBottomLeftRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
352
+ borderBottomRightRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
353
+ borderBottomStartRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
265
354
  borderBottomWidth?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
266
- borderColor?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ColorTokens | import("react-native").OpaqueColorValue | undefined;
355
+ borderColor?: import("@tamagui/core").ColorTokens | import("@tamagui/core").ThemeValueFallback | import("react-native").OpaqueColorValue | undefined;
267
356
  borderEndColor?: import("react-native").ColorValue | undefined;
268
- borderLeftColor?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ColorTokens | import("react-native").OpaqueColorValue | undefined;
357
+ borderLeftColor?: import("@tamagui/core").ColorTokens | import("@tamagui/core").ThemeValueFallback | import("react-native").OpaqueColorValue | undefined;
269
358
  borderLeftWidth?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
270
- borderRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
271
- borderRightColor?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ColorTokens | import("react-native").OpaqueColorValue | undefined;
359
+ borderRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
360
+ borderRightColor?: import("@tamagui/core").ColorTokens | import("@tamagui/core").ThemeValueFallback | import("react-native").OpaqueColorValue | undefined;
272
361
  borderRightWidth?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
273
362
  borderStartColor?: import("react-native").ColorValue | undefined;
274
363
  borderStyle?: "solid" | "dotted" | "dashed" | undefined;
275
- borderTopColor?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ColorTokens | import("react-native").OpaqueColorValue | undefined;
276
- borderTopEndRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
277
- borderTopLeftRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
278
- borderTopRightRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
279
- borderTopStartRadius?: import("@tamagui/core").RadiusTokens | import("@tamagui/core").ThemeValueFallback | undefined;
364
+ borderTopColor?: import("@tamagui/core").ColorTokens | import("@tamagui/core").ThemeValueFallback | import("react-native").OpaqueColorValue | undefined;
365
+ borderTopEndRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
366
+ borderTopLeftRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
367
+ borderTopRightRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
368
+ borderTopStartRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").RadiusTokens | undefined;
280
369
  borderTopWidth?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
281
370
  borderWidth?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
282
371
  opacity?: number | undefined;
@@ -294,7 +383,7 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
294
383
  flexGrow?: number | undefined;
295
384
  flexShrink?: number | undefined;
296
385
  flexWrap?: "nowrap" | "wrap" | "wrap-reverse" | undefined;
297
- height?: import("@tamagui/core").SizeTokens | import("@tamagui/core").ThemeValueFallback | undefined;
386
+ height?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SizeTokens | undefined;
298
387
  justifyContent?: "center" | "flex-start" | "flex-end" | "space-between" | "space-around" | "space-evenly" | undefined;
299
388
  left?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
300
389
  margin?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
@@ -306,10 +395,10 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
306
395
  marginStart?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
307
396
  marginTop?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
308
397
  marginVertical?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
309
- maxHeight?: import("@tamagui/core").SizeTokens | import("@tamagui/core").ThemeValueFallback | undefined;
310
- maxWidth?: import("@tamagui/core").SizeTokens | import("@tamagui/core").ThemeValueFallback | undefined;
311
- minHeight?: import("@tamagui/core").SizeTokens | import("@tamagui/core").ThemeValueFallback | undefined;
312
- minWidth?: import("@tamagui/core").SizeTokens | import("@tamagui/core").ThemeValueFallback | undefined;
398
+ maxHeight?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SizeTokens | undefined;
399
+ maxWidth?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SizeTokens | undefined;
400
+ minHeight?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SizeTokens | undefined;
401
+ minWidth?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SizeTokens | undefined;
313
402
  overflow?: "visible" | "hidden" | "scroll" | undefined;
314
403
  padding?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
315
404
  paddingBottom?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
@@ -324,10 +413,10 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
324
413
  right?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
325
414
  start?: string | number | undefined;
326
415
  top?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SpaceTokens | undefined;
327
- width?: import("@tamagui/core").SizeTokens | import("@tamagui/core").ThemeValueFallback | undefined;
416
+ width?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SizeTokens | undefined;
328
417
  zIndex?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ZIndexTokens | undefined;
329
418
  direction?: "inherit" | "ltr" | "rtl" | undefined;
330
- shadowColor?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").ColorTokens | import("react-native").OpaqueColorValue | undefined;
419
+ shadowColor?: import("@tamagui/core").ColorTokens | import("@tamagui/core").ThemeValueFallback | import("react-native").OpaqueColorValue | undefined;
331
420
  shadowOffset?: import("@tamagui/core").ThemeValueFallback | {
332
421
  width: import("@tamagui/core").SpaceTokens;
333
422
  height: import("@tamagui/core").SpaceTokens;
@@ -336,7 +425,7 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
336
425
  height: number;
337
426
  } | undefined;
338
427
  shadowOpacity?: number | undefined;
339
- shadowRadius?: import("@tamagui/core").SizeTokens | import("@tamagui/core").ThemeValueFallback | undefined;
428
+ shadowRadius?: import("@tamagui/core").ThemeValueFallback | import("@tamagui/core").SizeTokens | undefined;
340
429
  transform?: (import("react-native").PerpectiveTransform | import("react-native").RotateTransform | import("react-native").RotateXTransform | import("react-native").RotateYTransform | import("react-native").RotateZTransform | import("react-native").ScaleTransform | import("react-native").ScaleXTransform | import("react-native").ScaleYTransform | import("react-native").TranslateXTransform | import("react-native").TranslateYTransform | import("react-native").SkewXTransform | import("react-native").SkewYTransform | import("react-native").MatrixTransform)[] | undefined;
341
430
  transformMatrix?: number[] | undefined;
342
431
  rotation?: number | undefined;
@@ -378,6 +467,7 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
378
467
  padded?: boolean | undefined;
379
468
  chromeless?: boolean | "all" | undefined;
380
469
  fullscreen?: boolean | undefined;
470
+ defaultStyle?: boolean | undefined;
381
471
  size?: import("@tamagui/core").SizeTokens | undefined;
382
472
  active?: boolean | undefined;
383
473
  hoverStyle?: 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<{
@@ -395,7 +485,8 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
395
485
  readonly bordered?: number | boolean | undefined;
396
486
  readonly transparent?: boolean | undefined;
397
487
  readonly chromeless?: boolean | "all" | undefined;
398
- }, "disabled" | "size" | "active"> & {
488
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
489
+ readonly defaultStyle?: boolean | undefined;
399
490
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
400
491
  readonly active?: boolean | undefined;
401
492
  readonly disabled?: boolean | undefined;
@@ -415,7 +506,8 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
415
506
  readonly bordered?: number | boolean | undefined;
416
507
  readonly transparent?: boolean | undefined;
417
508
  readonly chromeless?: boolean | "all" | undefined;
418
- }, "disabled" | "size" | "active"> & {
509
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
510
+ readonly defaultStyle?: boolean | undefined;
419
511
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
420
512
  readonly active?: boolean | undefined;
421
513
  readonly disabled?: boolean | undefined;
@@ -435,7 +527,8 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
435
527
  readonly bordered?: number | boolean | undefined;
436
528
  readonly transparent?: boolean | undefined;
437
529
  readonly chromeless?: boolean | "all" | undefined;
438
- }, "disabled" | "size" | "active"> & {
530
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
531
+ readonly defaultStyle?: boolean | undefined;
439
532
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
440
533
  readonly active?: boolean | undefined;
441
534
  readonly disabled?: boolean | undefined;
@@ -455,7 +548,8 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
455
548
  readonly bordered?: number | boolean | undefined;
456
549
  readonly transparent?: boolean | undefined;
457
550
  readonly chromeless?: boolean | "all" | undefined;
458
- }, "disabled" | "size" | "active"> & {
551
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
552
+ readonly defaultStyle?: boolean | undefined;
459
553
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
460
554
  readonly active?: boolean | undefined;
461
555
  readonly disabled?: boolean | undefined;
@@ -475,99 +569,19 @@ export declare function useButton(propsIn: ButtonProps, { Text }?: {
475
569
  readonly bordered?: number | boolean | undefined;
476
570
  readonly transparent?: boolean | undefined;
477
571
  readonly chromeless?: boolean | "all" | undefined;
478
- }, "disabled" | "size" | "active"> & {
572
+ }, "disabled" | "size" | "defaultStyle" | "active"> & {
573
+ readonly defaultStyle?: boolean | undefined;
479
574
  readonly size?: import("@tamagui/core").SizeTokens | undefined;
480
575
  readonly active?: boolean | undefined;
481
576
  readonly disabled?: boolean | undefined;
482
577
  }> | null | undefined;
483
578
  themeInverse?: boolean | undefined;
484
579
  themeReset?: boolean | undefined;
580
+ /**
581
+ *
582
+ */
583
+ unstyled?: boolean | undefined;
485
584
  };
486
585
  };
487
- export declare const buttonStaticConfig: {
488
- inlineProps: Set<string>;
489
- };
490
- export declare const Button: (props: Omit<Omit<TextParentStyles, "TextComponent"> & 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<{
491
- readonly fullscreen?: boolean | undefined;
492
- readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
493
- } & {
494
- readonly backgrounded?: boolean | undefined;
495
- readonly radiused?: boolean | undefined;
496
- readonly hoverTheme?: boolean | undefined;
497
- readonly pressTheme?: boolean | undefined;
498
- readonly focusTheme?: boolean | undefined;
499
- readonly circular?: boolean | undefined;
500
- readonly padded?: boolean | undefined;
501
- readonly elevate?: boolean | undefined;
502
- readonly bordered?: number | boolean | undefined;
503
- readonly transparent?: boolean | undefined;
504
- readonly chromeless?: boolean | "all" | undefined;
505
- }, "disabled" | "size" | "active"> & {
506
- readonly size?: import("@tamagui/core").SizeTokens | undefined;
507
- readonly active?: boolean | undefined;
508
- readonly disabled?: boolean | undefined;
509
- } & 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<{
510
- readonly fullscreen?: boolean | undefined;
511
- readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
512
- } & {
513
- readonly backgrounded?: boolean | undefined;
514
- readonly radiused?: boolean | undefined;
515
- readonly hoverTheme?: boolean | undefined;
516
- readonly pressTheme?: boolean | undefined;
517
- readonly focusTheme?: boolean | undefined;
518
- readonly circular?: boolean | undefined;
519
- readonly padded?: boolean | undefined;
520
- readonly elevate?: boolean | undefined;
521
- readonly bordered?: number | boolean | undefined;
522
- readonly transparent?: boolean | undefined;
523
- readonly chromeless?: boolean | "all" | undefined;
524
- }, "disabled" | "size" | "active"> & {
525
- readonly size?: import("@tamagui/core").SizeTokens | undefined;
526
- readonly active?: boolean | undefined;
527
- readonly disabled?: boolean | undefined;
528
- }>> & 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<{
529
- readonly fullscreen?: boolean | undefined;
530
- readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
531
- } & {
532
- readonly backgrounded?: boolean | undefined;
533
- readonly radiused?: boolean | undefined;
534
- readonly hoverTheme?: boolean | undefined;
535
- readonly pressTheme?: boolean | undefined;
536
- readonly focusTheme?: boolean | undefined;
537
- readonly circular?: boolean | undefined;
538
- readonly padded?: boolean | undefined;
539
- readonly elevate?: boolean | undefined;
540
- readonly bordered?: number | boolean | undefined;
541
- readonly transparent?: boolean | undefined;
542
- readonly chromeless?: boolean | "all" | undefined;
543
- }, "disabled" | "size" | "active"> & {
544
- readonly size?: import("@tamagui/core").SizeTokens | undefined;
545
- readonly active?: boolean | undefined;
546
- readonly disabled?: boolean | undefined;
547
- }>> & ThemeableProps & {
548
- /**
549
- * add icon before, passes color and size automatically if Component
550
- */
551
- icon?: IconProp | undefined;
552
- /**
553
- * add icon after, passes color and size automatically if Component
554
- */
555
- iconAfter?: IconProp | undefined;
556
- /**
557
- * adjust icon relative to size
558
- */
559
- /**
560
- * default: -1
561
- */
562
- scaleIcon?: number | undefined;
563
- /**
564
- * make the spacing elements flex
565
- */
566
- spaceFlex?: number | boolean | undefined;
567
- /**
568
- * adjust internal space relative to icon size
569
- */
570
- scaleSpace?: number | undefined;
571
- } & import("react").RefAttributes<TamaguiElement>, "theme" | "themeInverse"> & ThemeableProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
572
586
  export {};
573
587
  //# sourceMappingURL=Button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,cAAc,EACd,cAAc,EAOf,MAAM,eAAe,CAAA;AAKtB,OAAO,EAAe,gBAAgB,EAAsB,MAAM,eAAe,CAAA;AACjF,OAAO,EAAE,iBAAiB,EAA0B,MAAM,OAAO,CAAA;AAEjE,KAAK,eAAe,GAAG;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AACxD,KAAK,QAAQ,GAAG,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC,eAAe,CAAC,GAAG,IAAI,CAAA;AAEvE,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,EAAE,eAAe,CAAC,GAC/D,QAAQ,CAAC,OAAO,WAAW,CAAC,GAC5B,cAAc,GAAG;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAA;IACpB;;OAEG;IACH;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH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