@tamagui/button 2.0.0-rc.9 → 2.0.0
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.cjs +247 -174
- package/dist/cjs/Button.native.js +252 -177
- package/dist/cjs/Button.native.js.map +1 -1
- package/dist/cjs/Button.test.cjs +33 -5
- package/dist/cjs/Button.test.native.js +34 -6
- package/dist/cjs/Button.test.native.js.map +1 -1
- package/dist/cjs/index.cjs +7 -5
- package/dist/cjs/index.native.js +7 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/v1/Button.cjs +221 -212
- package/dist/cjs/v1/Button.native.js +223 -215
- package/dist/cjs/v1/Button.native.js.map +1 -1
- package/dist/cjs/v1/Button.test.cjs +5 -5
- package/dist/cjs/v1/Button.test.native.js +6 -6
- package/dist/cjs/v1/Button.test.native.js.map +1 -1
- package/dist/cjs/v1/index.cjs +7 -5
- package/dist/cjs/v1/index.native.js +7 -5
- package/dist/cjs/v1/index.native.js.map +1 -1
- package/dist/esm/Button.mjs +227 -156
- package/dist/esm/Button.mjs.map +1 -1
- package/dist/esm/Button.native.js +232 -159
- package/dist/esm/Button.native.js.map +1 -1
- package/dist/esm/Button.test.mjs +30 -2
- package/dist/esm/Button.test.mjs.map +1 -1
- package/dist/esm/Button.test.native.js +30 -2
- package/dist/esm/Button.test.native.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -6
- package/dist/esm/v1/Button.mjs +199 -192
- package/dist/esm/v1/Button.mjs.map +1 -1
- package/dist/esm/v1/Button.native.js +200 -194
- package/dist/esm/v1/Button.native.js.map +1 -1
- package/dist/esm/v1/Button.test.mjs +2 -2
- package/dist/esm/v1/Button.test.mjs.map +1 -1
- package/dist/esm/v1/Button.test.native.js +2 -2
- package/dist/esm/v1/Button.test.native.js.map +1 -1
- package/dist/jsx/Button.mjs +227 -156
- package/dist/jsx/Button.mjs.map +1 -1
- package/dist/jsx/Button.native.js +252 -177
- package/dist/jsx/Button.native.js.map +1 -1
- package/dist/jsx/Button.test.mjs +30 -2
- package/dist/jsx/Button.test.mjs.map +1 -1
- package/dist/jsx/Button.test.native.js +34 -6
- package/dist/jsx/Button.test.native.js.map +1 -1
- package/dist/jsx/index.js +1 -1
- package/dist/jsx/index.js.map +1 -6
- package/dist/jsx/index.native.js +7 -5
- package/dist/jsx/v1/Button.mjs +199 -192
- package/dist/jsx/v1/Button.mjs.map +1 -1
- package/dist/jsx/v1/Button.native.js +223 -215
- package/dist/jsx/v1/Button.native.js.map +1 -1
- package/dist/jsx/v1/Button.test.mjs +2 -2
- package/dist/jsx/v1/Button.test.mjs.map +1 -1
- package/dist/jsx/v1/Button.test.native.js +6 -6
- package/dist/jsx/v1/Button.test.native.js.map +1 -1
- package/dist/jsx/v1/index.native.js +7 -5
- package/package.json +14 -13
- package/src/Button.test.tsx +24 -0
- package/src/Button.tsx +129 -25
- package/src/v1/Button.tsx +6 -0
- package/types/Button.d.ts +148 -39
- package/types/Button.d.ts.map +1 -1
- package/types/v1/Button.d.ts +21 -21
- package/types/v1/Button.d.ts.map +1 -1
- package/dist/cjs/Button.js +0 -176
- package/dist/cjs/Button.js.map +0 -6
- package/dist/cjs/Button.test.js +0 -8
- package/dist/cjs/Button.test.js.map +0 -6
- package/dist/cjs/index.js +0 -15
- package/dist/cjs/index.js.map +0 -6
- package/dist/cjs/v1/Button.js +0 -208
- package/dist/cjs/v1/Button.js.map +0 -6
- package/dist/cjs/v1/Button.test.js +0 -8
- package/dist/cjs/v1/Button.test.js.map +0 -6
- package/dist/cjs/v1/index.js +0 -15
- package/dist/cjs/v1/index.js.map +0 -6
- package/dist/esm/Button.js +0 -174
- package/dist/esm/Button.js.map +0 -6
- package/dist/esm/Button.test.js +0 -10
- package/dist/esm/Button.test.js.map +0 -6
- package/dist/esm/v1/Button.js +0 -201
- package/dist/esm/v1/Button.js.map +0 -6
- package/dist/esm/v1/Button.test.js +0 -10
- package/dist/esm/v1/Button.test.js.map +0 -6
- package/dist/esm/v1/index.js +0 -2
- package/dist/esm/v1/index.js.map +0 -6
- package/dist/jsx/Button.js +0 -174
- package/dist/jsx/Button.js.map +0 -6
- package/dist/jsx/Button.test.js +0 -10
- package/dist/jsx/Button.test.js.map +0 -6
- package/dist/jsx/v1/Button.js +0 -201
- package/dist/jsx/v1/Button.js.map +0 -6
- package/dist/jsx/v1/Button.test.js +0 -10
- package/dist/jsx/v1/Button.test.js.map +0 -6
- package/dist/jsx/v1/index.js +0 -2
- package/dist/jsx/v1/index.js.map +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/button",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -20,10 +20,11 @@
|
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./types/index.d.ts",
|
|
22
22
|
"react-native": "./dist/esm/index.native.js",
|
|
23
|
+
"browser": "./dist/esm/index.mjs",
|
|
23
24
|
"module": "./dist/esm/index.mjs",
|
|
24
25
|
"import": "./dist/esm/index.mjs",
|
|
25
26
|
"require": "./dist/cjs/index.cjs",
|
|
26
|
-
"default": "./dist/
|
|
27
|
+
"default": "./dist/esm/index.mjs"
|
|
27
28
|
}
|
|
28
29
|
},
|
|
29
30
|
"publishConfig": {
|
|
@@ -36,19 +37,19 @@
|
|
|
36
37
|
"clean:build": "tamagui-build clean:build"
|
|
37
38
|
},
|
|
38
39
|
"dependencies": {
|
|
39
|
-
"@tamagui/config-default": "2.0.0
|
|
40
|
-
"@tamagui/core": "2.0.0
|
|
41
|
-
"@tamagui/
|
|
42
|
-
"@tamagui/
|
|
43
|
-
"@tamagui/helpers": "2.0.0
|
|
44
|
-
"@tamagui/
|
|
45
|
-
"@tamagui/
|
|
46
|
-
"@tamagui/
|
|
47
|
-
"@tamagui/
|
|
48
|
-
"@tamagui/web": "2.0.0
|
|
40
|
+
"@tamagui/config-default": "2.0.0",
|
|
41
|
+
"@tamagui/core": "2.0.0",
|
|
42
|
+
"@tamagui/get-button-sized": "2.0.0",
|
|
43
|
+
"@tamagui/helpers": "2.0.0",
|
|
44
|
+
"@tamagui/helpers-tamagui": "2.0.0",
|
|
45
|
+
"@tamagui/spacer": "2.0.0",
|
|
46
|
+
"@tamagui/stacks": "2.0.0",
|
|
47
|
+
"@tamagui/text": "2.0.0",
|
|
48
|
+
"@tamagui/font-size": "2.0.0",
|
|
49
|
+
"@tamagui/web": "2.0.0"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "2.0.0
|
|
52
|
+
"@tamagui/build": "2.0.0",
|
|
52
53
|
"react": ">=19",
|
|
53
54
|
"vitest": "4.0.4"
|
|
54
55
|
},
|
package/src/Button.test.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getDefaultTamaguiConfig } from '@tamagui/config-default'
|
|
2
2
|
import { createTamagui } from '@tamagui/core'
|
|
3
3
|
import { describe, expect, test } from 'vitest'
|
|
4
|
+
import { Button } from './Button'
|
|
4
5
|
|
|
5
6
|
const conf = createTamagui(getDefaultTamaguiConfig())
|
|
6
7
|
|
|
@@ -9,6 +10,29 @@ describe('Button', () => {
|
|
|
9
10
|
expect(true).toBeTruthy()
|
|
10
11
|
})
|
|
11
12
|
|
|
13
|
+
// type tests for native button props (issue #3914)
|
|
14
|
+
test('accepts native button html props', () => {
|
|
15
|
+
// these should type check without errors
|
|
16
|
+
const _submitBtn = <Button type="submit">Submit</Button>
|
|
17
|
+
const _resetBtn = <Button type="reset">Reset</Button>
|
|
18
|
+
const _buttonBtn = <Button type="button">Button</Button>
|
|
19
|
+
const _formBtn = (
|
|
20
|
+
<Button
|
|
21
|
+
type="submit"
|
|
22
|
+
form="myForm"
|
|
23
|
+
formAction="/submit"
|
|
24
|
+
formMethod="post"
|
|
25
|
+
formTarget="_blank"
|
|
26
|
+
formNoValidate
|
|
27
|
+
name="submitBtn"
|
|
28
|
+
value="submit"
|
|
29
|
+
>
|
|
30
|
+
Submit
|
|
31
|
+
</Button>
|
|
32
|
+
)
|
|
33
|
+
expect(true).toBeTruthy()
|
|
34
|
+
})
|
|
35
|
+
|
|
12
36
|
// test(`Adapts to a when given accessibilityRole="link"`, async () => {
|
|
13
37
|
// const { container } = render(
|
|
14
38
|
// <TamaguiProvider config={conf} defaultTheme="light">
|
package/src/Button.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getFontSize } from '@tamagui/font-size'
|
|
2
2
|
import { getButtonSized } from '@tamagui/get-button-sized'
|
|
3
|
-
import { getIcon } from '@tamagui/helpers-tamagui'
|
|
3
|
+
import { getIcon, useCurrentColor } from '@tamagui/helpers-tamagui'
|
|
4
4
|
import { ButtonNestingContext, getElevation, themeableVariants } from '@tamagui/stacks'
|
|
5
|
+
import type { TextContextStyles, TextParentStyles } from '@tamagui/text'
|
|
5
6
|
import { SizableText, wrapChildrenInText } from '@tamagui/text'
|
|
6
|
-
import type {
|
|
7
|
+
import type { GetProps, SizeTokens, Token } from '@tamagui/web'
|
|
7
8
|
import {
|
|
8
9
|
createStyledContext,
|
|
9
10
|
getTokenValue,
|
|
@@ -17,16 +18,25 @@ import { useContext } from 'react'
|
|
|
17
18
|
|
|
18
19
|
type ButtonVariant = 'outlined'
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
type ButtonContextStyles = TextContextStyles & {
|
|
21
22
|
size?: SizeTokens
|
|
22
23
|
variant?: ButtonVariant
|
|
23
|
-
color?: ColorTokens | string
|
|
24
24
|
elevation?: SizeTokens | number
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const context = createStyledContext<ButtonContextStyles>({
|
|
26
28
|
size: undefined,
|
|
27
29
|
variant: undefined,
|
|
28
30
|
color: undefined,
|
|
29
31
|
elevation: undefined,
|
|
32
|
+
ellipsis: undefined,
|
|
33
|
+
fontFamily: undefined,
|
|
34
|
+
fontSize: undefined,
|
|
35
|
+
fontStyle: undefined,
|
|
36
|
+
fontWeight: undefined,
|
|
37
|
+
letterSpacing: undefined,
|
|
38
|
+
maxFontSizeMultiplier: undefined,
|
|
39
|
+
textAlign: undefined,
|
|
30
40
|
})
|
|
31
41
|
|
|
32
42
|
const Frame = styled(View, {
|
|
@@ -38,17 +48,26 @@ const Frame = styled(View, {
|
|
|
38
48
|
|
|
39
49
|
variants: {
|
|
40
50
|
unstyled: {
|
|
51
|
+
true: {
|
|
52
|
+
// reset browser <button> defaults
|
|
53
|
+
outlineWidth: 0,
|
|
54
|
+
borderWidth: 0,
|
|
55
|
+
backgroundColor: 'transparent',
|
|
56
|
+
},
|
|
41
57
|
false: {
|
|
42
58
|
size: '$true',
|
|
43
59
|
justifyContent: 'center',
|
|
44
60
|
alignItems: 'center',
|
|
45
61
|
flexWrap: 'nowrap',
|
|
46
62
|
flexDirection: 'row',
|
|
47
|
-
cursor: 'pointer',
|
|
48
63
|
backgroundColor: '$background',
|
|
49
64
|
borderWidth: 1,
|
|
50
65
|
borderColor: 'transparent',
|
|
51
66
|
|
|
67
|
+
'$platform-web': {
|
|
68
|
+
cursor: 'pointer',
|
|
69
|
+
},
|
|
70
|
+
|
|
52
71
|
hoverStyle: {
|
|
53
72
|
backgroundColor: '$backgroundHover',
|
|
54
73
|
borderColor: '$borderColorHover',
|
|
@@ -137,12 +156,15 @@ const Text = styled(SizableText, {
|
|
|
137
156
|
unstyled: {
|
|
138
157
|
false: {
|
|
139
158
|
userSelect: 'none',
|
|
140
|
-
cursor: 'pointer',
|
|
141
159
|
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
142
160
|
flexGrow: 0,
|
|
143
161
|
flexShrink: 1,
|
|
144
162
|
ellipsis: true,
|
|
145
163
|
color: '$color',
|
|
164
|
+
|
|
165
|
+
'$platform-web': {
|
|
166
|
+
cursor: 'pointer',
|
|
167
|
+
},
|
|
146
168
|
},
|
|
147
169
|
},
|
|
148
170
|
} as const,
|
|
@@ -164,6 +186,11 @@ const Icon = (props: {
|
|
|
164
186
|
}
|
|
165
187
|
|
|
166
188
|
const sizeToken = size ?? styledContext.size
|
|
189
|
+
const iconColorProp =
|
|
190
|
+
styledContext.color === 'unset' || typeof styledContext.color === 'number'
|
|
191
|
+
? undefined
|
|
192
|
+
: styledContext.color
|
|
193
|
+
const iconColor = useCurrentColor(iconColorProp)
|
|
167
194
|
|
|
168
195
|
const iconSize =
|
|
169
196
|
(typeof sizeToken === 'number' ? sizeToken * 0.5 : getFontSize(sizeToken as Token)) *
|
|
@@ -171,14 +198,14 @@ const Icon = (props: {
|
|
|
171
198
|
|
|
172
199
|
return getIcon(children, {
|
|
173
200
|
size: iconSize,
|
|
174
|
-
color:
|
|
201
|
+
color: iconColor,
|
|
175
202
|
})
|
|
176
203
|
}
|
|
177
204
|
|
|
178
205
|
export const ButtonContext = createStyledContext<{
|
|
179
206
|
size?: SizeTokens
|
|
180
207
|
variant?: ButtonVariant
|
|
181
|
-
color?:
|
|
208
|
+
color?: ButtonContextStyles['color']
|
|
182
209
|
}>({
|
|
183
210
|
size: undefined,
|
|
184
211
|
variant: undefined,
|
|
@@ -187,11 +214,22 @@ export const ButtonContext = createStyledContext<{
|
|
|
187
214
|
|
|
188
215
|
type IconProp = JSX.Element | FunctionComponent<{ color?: any; size?: any }> | null
|
|
189
216
|
|
|
190
|
-
type ButtonExtraProps = {
|
|
217
|
+
type ButtonExtraProps = TextParentStyles & {
|
|
191
218
|
icon?: IconProp
|
|
192
219
|
iconAfter?: IconProp
|
|
193
220
|
scaleIcon?: number
|
|
194
221
|
iconSize?: SizeTokens
|
|
222
|
+
|
|
223
|
+
// native button html props
|
|
224
|
+
type?: 'submit' | 'reset' | 'button'
|
|
225
|
+
form?: string
|
|
226
|
+
formAction?: string
|
|
227
|
+
formEncType?: string
|
|
228
|
+
formMethod?: string
|
|
229
|
+
formNoValidate?: boolean
|
|
230
|
+
formTarget?: string
|
|
231
|
+
name?: string
|
|
232
|
+
value?: string | readonly string[] | number
|
|
195
233
|
}
|
|
196
234
|
|
|
197
235
|
const ButtonComponent = Frame.styleable<ButtonExtraProps>((propsIn, ref) => {
|
|
@@ -203,11 +241,35 @@ const ButtonComponent = Frame.styleable<ButtonExtraProps>((propsIn, ref) => {
|
|
|
203
241
|
noExpand: true,
|
|
204
242
|
})
|
|
205
243
|
|
|
206
|
-
const {
|
|
244
|
+
const {
|
|
245
|
+
children,
|
|
246
|
+
iconSize,
|
|
247
|
+
icon,
|
|
248
|
+
iconAfter,
|
|
249
|
+
scaleIcon = 1,
|
|
250
|
+
noTextWrap,
|
|
251
|
+
textProps,
|
|
252
|
+
color,
|
|
253
|
+
ellipsis,
|
|
254
|
+
fontFamily,
|
|
255
|
+
fontSize,
|
|
256
|
+
fontStyle,
|
|
257
|
+
fontWeight,
|
|
258
|
+
letterSpacing,
|
|
259
|
+
maxFontSizeMultiplier,
|
|
260
|
+
textAlign,
|
|
261
|
+
...props
|
|
262
|
+
} = processedProps
|
|
207
263
|
|
|
208
264
|
const size = propsIn.size || (propsIn.unstyled ? undefined : '$true')
|
|
209
265
|
|
|
210
266
|
const styledContext = context.useStyledContext()
|
|
267
|
+
const contextColor = color ?? propsIn.color ?? styledContext?.color
|
|
268
|
+
const iconColorProp =
|
|
269
|
+
contextColor === 'unset' || typeof contextColor === 'number'
|
|
270
|
+
? undefined
|
|
271
|
+
: contextColor
|
|
272
|
+
const iconColor = useCurrentColor(iconColorProp)
|
|
211
273
|
const finalSize = iconSize ?? size ?? styledContext?.size
|
|
212
274
|
const iconSizeNumber =
|
|
213
275
|
(typeof finalSize === 'number' ? finalSize * 0.5 : getFontSize(finalSize as Token)) *
|
|
@@ -217,34 +279,76 @@ const ButtonComponent = Frame.styleable<ButtonExtraProps>((propsIn, ref) => {
|
|
|
217
279
|
if (!icon) return null
|
|
218
280
|
return getIcon(icon, {
|
|
219
281
|
size: iconSizeNumber,
|
|
220
|
-
color:
|
|
282
|
+
color: iconColor,
|
|
221
283
|
// No marginLeft or marginRight needed - spacing is handled by the gap property in Frame's size variants
|
|
222
284
|
})
|
|
223
285
|
})
|
|
224
286
|
|
|
225
287
|
const wrappedChildren = wrapChildrenInText(
|
|
226
288
|
Text,
|
|
227
|
-
{
|
|
289
|
+
{
|
|
290
|
+
children,
|
|
291
|
+
color: contextColor,
|
|
292
|
+
ellipsis: ellipsis ?? propsIn.ellipsis ?? styledContext?.ellipsis,
|
|
293
|
+
fontFamily: fontFamily ?? propsIn.fontFamily ?? styledContext?.fontFamily,
|
|
294
|
+
fontSize: fontSize ?? propsIn.fontSize ?? styledContext?.fontSize,
|
|
295
|
+
fontStyle: fontStyle ?? propsIn.fontStyle ?? styledContext?.fontStyle,
|
|
296
|
+
fontWeight: fontWeight ?? propsIn.fontWeight ?? styledContext?.fontWeight,
|
|
297
|
+
letterSpacing:
|
|
298
|
+
letterSpacing ?? propsIn.letterSpacing ?? styledContext?.letterSpacing,
|
|
299
|
+
maxFontSizeMultiplier:
|
|
300
|
+
maxFontSizeMultiplier ??
|
|
301
|
+
propsIn.maxFontSizeMultiplier ??
|
|
302
|
+
styledContext?.maxFontSizeMultiplier,
|
|
303
|
+
noTextWrap: noTextWrap ?? propsIn.noTextWrap,
|
|
304
|
+
textAlign: textAlign ?? propsIn.textAlign ?? styledContext?.textAlign,
|
|
305
|
+
textProps: textProps ?? propsIn.textProps,
|
|
306
|
+
},
|
|
228
307
|
{
|
|
229
308
|
unstyled: process.env.TAMAGUI_HEADLESS === '1',
|
|
230
309
|
size: finalSize ?? styledContext?.size,
|
|
231
310
|
}
|
|
232
311
|
)
|
|
233
312
|
|
|
313
|
+
const textContext: TextContextStyles = {
|
|
314
|
+
color: contextColor,
|
|
315
|
+
ellipsis: ellipsis ?? propsIn.ellipsis ?? styledContext?.ellipsis,
|
|
316
|
+
fontFamily: fontFamily ?? propsIn.fontFamily ?? styledContext?.fontFamily,
|
|
317
|
+
fontSize: fontSize ?? propsIn.fontSize ?? styledContext?.fontSize,
|
|
318
|
+
fontStyle: fontStyle ?? propsIn.fontStyle ?? styledContext?.fontStyle,
|
|
319
|
+
fontWeight: fontWeight ?? propsIn.fontWeight ?? styledContext?.fontWeight,
|
|
320
|
+
letterSpacing: letterSpacing ?? propsIn.letterSpacing ?? styledContext?.letterSpacing,
|
|
321
|
+
maxFontSizeMultiplier:
|
|
322
|
+
maxFontSizeMultiplier ??
|
|
323
|
+
propsIn.maxFontSizeMultiplier ??
|
|
324
|
+
styledContext?.maxFontSizeMultiplier,
|
|
325
|
+
textAlign: textAlign ?? propsIn.textAlign ?? styledContext?.textAlign,
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const buttonContext: ButtonContextStyles = {
|
|
329
|
+
...styledContext,
|
|
330
|
+
...textContext,
|
|
331
|
+
size: props.size ?? propsIn.size ?? styledContext?.size,
|
|
332
|
+
variant: props.variant ?? propsIn.variant ?? styledContext?.variant,
|
|
333
|
+
elevation: props.elevation ?? propsIn.elevation ?? styledContext?.elevation,
|
|
334
|
+
}
|
|
335
|
+
|
|
234
336
|
return (
|
|
235
337
|
<ButtonNestingContext.Provider value={true}>
|
|
236
|
-
<
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
338
|
+
<context.Provider {...buttonContext}>
|
|
339
|
+
<Frame
|
|
340
|
+
ref={ref}
|
|
341
|
+
{...props}
|
|
342
|
+
{...(isNested && { render: 'span' })}
|
|
343
|
+
// pass resolved size to circular variant when no explicit size provided
|
|
344
|
+
{...(props.circular && !propsIn.size && { size })}
|
|
345
|
+
tabIndex={0}
|
|
346
|
+
>
|
|
347
|
+
{themedIcon}
|
|
348
|
+
{wrappedChildren}
|
|
349
|
+
{themedIconAfter}
|
|
350
|
+
</Frame>
|
|
351
|
+
</context.Provider>
|
|
248
352
|
</ButtonNestingContext.Provider>
|
|
249
353
|
)
|
|
250
354
|
})
|
package/src/v1/Button.tsx
CHANGED
|
@@ -85,6 +85,12 @@ const ButtonFrame = styled(ThemeableStack, {
|
|
|
85
85
|
|
|
86
86
|
variants: {
|
|
87
87
|
unstyled: {
|
|
88
|
+
true: {
|
|
89
|
+
// reset browser <button> defaults
|
|
90
|
+
outlineWidth: 0,
|
|
91
|
+
borderWidth: 0,
|
|
92
|
+
backgroundColor: 'transparent',
|
|
93
|
+
},
|
|
88
94
|
false: {
|
|
89
95
|
size: '$true',
|
|
90
96
|
justifyContent: 'center',
|
package/types/Button.d.ts
CHANGED
|
@@ -1,103 +1,212 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { TextContextStyles } from '@tamagui/text';
|
|
2
|
+
import type { GetProps, SizeTokens } from '@tamagui/web';
|
|
2
3
|
import type { FunctionComponent, JSX } from 'react';
|
|
3
4
|
type ButtonVariant = 'outlined';
|
|
5
|
+
type ButtonContextStyles = TextContextStyles & {
|
|
6
|
+
size?: SizeTokens;
|
|
7
|
+
variant?: ButtonVariant;
|
|
8
|
+
elevation?: SizeTokens | number;
|
|
9
|
+
};
|
|
4
10
|
export declare const ButtonContext: import("@tamagui/web").StyledContext<{
|
|
5
11
|
size?: SizeTokens;
|
|
6
12
|
variant?: ButtonVariant;
|
|
7
|
-
color?:
|
|
13
|
+
color?: ButtonContextStyles["color"];
|
|
8
14
|
}>;
|
|
9
15
|
type IconProp = JSX.Element | FunctionComponent<{
|
|
10
16
|
color?: any;
|
|
11
17
|
size?: any;
|
|
12
18
|
}> | null;
|
|
13
|
-
type ButtonExtraProps = {
|
|
14
|
-
icon?: IconProp;
|
|
15
|
-
iconAfter?: IconProp;
|
|
16
|
-
scaleIcon?: number;
|
|
17
|
-
iconSize?: SizeTokens;
|
|
18
|
-
};
|
|
19
19
|
declare const ButtonComponent: import("@tamagui/web").TamaguiComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
20
20
|
size?: number | SizeTokens | undefined;
|
|
21
21
|
variant?: "outlined" | undefined;
|
|
22
|
+
disabled?: boolean | undefined;
|
|
23
|
+
unstyled?: boolean | undefined;
|
|
22
24
|
elevation?: number | SizeTokens | undefined;
|
|
23
25
|
circular?: boolean | undefined;
|
|
24
26
|
chromeless?: boolean | "all" | undefined;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
}>, "form" | "name" | "value" | keyof TextContextStyles | "textProps" | "noTextWrap" | "icon" | "iconAfter" | "scaleIcon" | "iconSize" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & TextContextStyles & {
|
|
28
|
+
textProps?: Partial<import("@tamagui/text").SizableTextProps>;
|
|
29
|
+
noTextWrap?: boolean;
|
|
30
|
+
} & {
|
|
31
|
+
icon?: IconProp;
|
|
32
|
+
iconAfter?: IconProp;
|
|
33
|
+
scaleIcon?: number;
|
|
34
|
+
iconSize?: SizeTokens;
|
|
35
|
+
type?: "submit" | "reset" | "button";
|
|
36
|
+
form?: string;
|
|
37
|
+
formAction?: string;
|
|
38
|
+
formEncType?: string;
|
|
39
|
+
formMethod?: string;
|
|
40
|
+
formNoValidate?: boolean;
|
|
41
|
+
formTarget?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
value?: string | readonly string[] | number;
|
|
44
|
+
}, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps & TextContextStyles & {
|
|
45
|
+
textProps?: Partial<import("@tamagui/text").SizableTextProps>;
|
|
46
|
+
noTextWrap?: boolean;
|
|
47
|
+
} & {
|
|
48
|
+
icon?: IconProp;
|
|
49
|
+
iconAfter?: IconProp;
|
|
50
|
+
scaleIcon?: number;
|
|
51
|
+
iconSize?: SizeTokens;
|
|
52
|
+
type?: "submit" | "reset" | "button";
|
|
53
|
+
form?: string;
|
|
54
|
+
formAction?: string;
|
|
55
|
+
formEncType?: string;
|
|
56
|
+
formMethod?: string;
|
|
57
|
+
formNoValidate?: boolean;
|
|
58
|
+
formTarget?: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
value?: string | readonly string[] | number;
|
|
61
|
+
}, import("@tamagui/web").StackStyleBase, {
|
|
28
62
|
size?: number | SizeTokens | undefined;
|
|
29
63
|
variant?: "outlined" | undefined;
|
|
64
|
+
disabled?: boolean | undefined;
|
|
65
|
+
unstyled?: boolean | undefined;
|
|
30
66
|
elevation?: number | SizeTokens | undefined;
|
|
31
67
|
circular?: boolean | undefined;
|
|
32
68
|
chromeless?: boolean | "all" | undefined;
|
|
33
|
-
disabled?: boolean | undefined;
|
|
34
|
-
unstyled?: boolean | undefined;
|
|
35
69
|
}, import("@tamagui/web").StaticConfigPublic>;
|
|
36
70
|
export declare const Button: import("react").ForwardRefExoticComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
37
71
|
size?: number | SizeTokens | undefined;
|
|
38
72
|
variant?: "outlined" | undefined;
|
|
73
|
+
disabled?: boolean | undefined;
|
|
74
|
+
unstyled?: boolean | undefined;
|
|
39
75
|
elevation?: number | SizeTokens | undefined;
|
|
40
76
|
circular?: boolean | undefined;
|
|
41
77
|
chromeless?: boolean | "all" | undefined;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
78
|
+
}>, "form" | "name" | "value" | keyof TextContextStyles | "textProps" | "noTextWrap" | "icon" | "iconAfter" | "scaleIcon" | "iconSize" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & TextContextStyles & {
|
|
79
|
+
textProps?: Partial<import("@tamagui/text").SizableTextProps>;
|
|
80
|
+
noTextWrap?: boolean;
|
|
81
|
+
} & {
|
|
82
|
+
icon?: IconProp;
|
|
83
|
+
iconAfter?: IconProp;
|
|
84
|
+
scaleIcon?: number;
|
|
85
|
+
iconSize?: SizeTokens;
|
|
86
|
+
type?: "submit" | "reset" | "button";
|
|
87
|
+
form?: string;
|
|
88
|
+
formAction?: string;
|
|
89
|
+
formEncType?: string;
|
|
90
|
+
formMethod?: string;
|
|
91
|
+
formNoValidate?: boolean;
|
|
92
|
+
formTarget?: string;
|
|
93
|
+
name?: string;
|
|
94
|
+
value?: string | readonly string[] | number;
|
|
95
|
+
} & import("react").RefAttributes<import("@tamagui/web").TamaguiElement>> & import("@tamagui/web").StaticComponentObject<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
45
96
|
size?: number | SizeTokens | undefined;
|
|
46
97
|
variant?: "outlined" | undefined;
|
|
98
|
+
disabled?: boolean | undefined;
|
|
99
|
+
unstyled?: boolean | undefined;
|
|
47
100
|
elevation?: number | SizeTokens | undefined;
|
|
48
101
|
circular?: boolean | undefined;
|
|
49
102
|
chromeless?: boolean | "all" | undefined;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
103
|
+
}>, "form" | "name" | "value" | keyof TextContextStyles | "textProps" | "noTextWrap" | "icon" | "iconAfter" | "scaleIcon" | "iconSize" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & TextContextStyles & {
|
|
104
|
+
textProps?: Partial<import("@tamagui/text").SizableTextProps>;
|
|
105
|
+
noTextWrap?: boolean;
|
|
106
|
+
} & {
|
|
107
|
+
icon?: IconProp;
|
|
108
|
+
iconAfter?: IconProp;
|
|
109
|
+
scaleIcon?: number;
|
|
110
|
+
iconSize?: SizeTokens;
|
|
111
|
+
type?: "submit" | "reset" | "button";
|
|
112
|
+
form?: string;
|
|
113
|
+
formAction?: string;
|
|
114
|
+
formEncType?: string;
|
|
115
|
+
formMethod?: string;
|
|
116
|
+
formNoValidate?: boolean;
|
|
117
|
+
formTarget?: string;
|
|
118
|
+
name?: string;
|
|
119
|
+
value?: string | readonly string[] | number;
|
|
120
|
+
}, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps & TextContextStyles & {
|
|
121
|
+
textProps?: Partial<import("@tamagui/text").SizableTextProps>;
|
|
122
|
+
noTextWrap?: boolean;
|
|
123
|
+
} & {
|
|
124
|
+
icon?: IconProp;
|
|
125
|
+
iconAfter?: IconProp;
|
|
126
|
+
scaleIcon?: number;
|
|
127
|
+
iconSize?: SizeTokens;
|
|
128
|
+
type?: "submit" | "reset" | "button";
|
|
129
|
+
form?: string;
|
|
130
|
+
formAction?: string;
|
|
131
|
+
formEncType?: string;
|
|
132
|
+
formMethod?: string;
|
|
133
|
+
formNoValidate?: boolean;
|
|
134
|
+
formTarget?: string;
|
|
135
|
+
name?: string;
|
|
136
|
+
value?: string | readonly string[] | number;
|
|
137
|
+
}, import("@tamagui/web").StackStyleBase, {
|
|
53
138
|
size?: number | SizeTokens | undefined;
|
|
54
139
|
variant?: "outlined" | undefined;
|
|
140
|
+
disabled?: boolean | undefined;
|
|
141
|
+
unstyled?: boolean | undefined;
|
|
55
142
|
elevation?: number | SizeTokens | undefined;
|
|
56
143
|
circular?: boolean | undefined;
|
|
57
144
|
chromeless?: boolean | "all" | undefined;
|
|
58
|
-
disabled?: boolean | undefined;
|
|
59
|
-
unstyled?: boolean | undefined;
|
|
60
145
|
}, import("@tamagui/web").StaticConfigPublic> & Omit<import("@tamagui/web").StaticConfigPublic, "staticConfig" | "styleable"> & {
|
|
61
146
|
__tama: [Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
62
147
|
size?: number | SizeTokens | undefined;
|
|
63
148
|
variant?: "outlined" | undefined;
|
|
149
|
+
disabled?: boolean | undefined;
|
|
150
|
+
unstyled?: boolean | undefined;
|
|
64
151
|
elevation?: number | SizeTokens | undefined;
|
|
65
152
|
circular?: boolean | undefined;
|
|
66
153
|
chromeless?: boolean | "all" | undefined;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
154
|
+
}>, "form" | "name" | "value" | keyof TextContextStyles | "textProps" | "noTextWrap" | "icon" | "iconAfter" | "scaleIcon" | "iconSize" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & TextContextStyles & {
|
|
155
|
+
textProps?: Partial<import("@tamagui/text").SizableTextProps>;
|
|
156
|
+
noTextWrap?: boolean;
|
|
157
|
+
} & {
|
|
158
|
+
icon?: IconProp;
|
|
159
|
+
iconAfter?: IconProp;
|
|
160
|
+
scaleIcon?: number;
|
|
161
|
+
iconSize?: SizeTokens;
|
|
162
|
+
type?: "submit" | "reset" | "button";
|
|
163
|
+
form?: string;
|
|
164
|
+
formAction?: string;
|
|
165
|
+
formEncType?: string;
|
|
166
|
+
formMethod?: string;
|
|
167
|
+
formNoValidate?: boolean;
|
|
168
|
+
formTarget?: string;
|
|
169
|
+
name?: string;
|
|
170
|
+
value?: string | readonly string[] | number;
|
|
171
|
+
}, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps & TextContextStyles & {
|
|
172
|
+
textProps?: Partial<import("@tamagui/text").SizableTextProps>;
|
|
173
|
+
noTextWrap?: boolean;
|
|
174
|
+
} & {
|
|
175
|
+
icon?: IconProp;
|
|
176
|
+
iconAfter?: IconProp;
|
|
177
|
+
scaleIcon?: number;
|
|
178
|
+
iconSize?: SizeTokens;
|
|
179
|
+
type?: "submit" | "reset" | "button";
|
|
180
|
+
form?: string;
|
|
181
|
+
formAction?: string;
|
|
182
|
+
formEncType?: string;
|
|
183
|
+
formMethod?: string;
|
|
184
|
+
formNoValidate?: boolean;
|
|
185
|
+
formTarget?: string;
|
|
186
|
+
name?: string;
|
|
187
|
+
value?: string | readonly string[] | number;
|
|
188
|
+
}, import("@tamagui/web").StackStyleBase, {
|
|
70
189
|
size?: number | SizeTokens | undefined;
|
|
71
190
|
variant?: "outlined" | undefined;
|
|
191
|
+
disabled?: boolean | undefined;
|
|
192
|
+
unstyled?: boolean | undefined;
|
|
72
193
|
elevation?: number | SizeTokens | undefined;
|
|
73
194
|
circular?: boolean | undefined;
|
|
74
195
|
chromeless?: boolean | "all" | undefined;
|
|
75
|
-
disabled?: boolean | undefined;
|
|
76
|
-
unstyled?: boolean | undefined;
|
|
77
196
|
}, import("@tamagui/web").StaticConfigPublic];
|
|
78
197
|
} & {
|
|
79
|
-
Apply: import("react").Provider<{
|
|
80
|
-
size?: SizeTokens;
|
|
81
|
-
variant?: ButtonVariant;
|
|
82
|
-
color?: ColorTokens | string;
|
|
83
|
-
elevation?: SizeTokens | number;
|
|
84
|
-
}> & import("react").ProviderExoticComponent<Partial<{
|
|
85
|
-
size?: SizeTokens;
|
|
86
|
-
variant?: ButtonVariant;
|
|
87
|
-
color?: ColorTokens | string;
|
|
88
|
-
elevation?: SizeTokens | number;
|
|
89
|
-
}> & {
|
|
198
|
+
Apply: import("react").Provider<ButtonContextStyles> & import("react").ProviderExoticComponent<Partial<ButtonContextStyles> & {
|
|
90
199
|
children?: import("react").ReactNode;
|
|
91
200
|
scope?: string;
|
|
92
201
|
}>;
|
|
93
202
|
Frame: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
94
203
|
size?: number | SizeTokens | undefined;
|
|
95
204
|
variant?: "outlined" | undefined;
|
|
205
|
+
disabled?: boolean | undefined;
|
|
206
|
+
unstyled?: boolean | undefined;
|
|
96
207
|
elevation?: number | SizeTokens | undefined;
|
|
97
208
|
circular?: boolean | undefined;
|
|
98
209
|
chromeless?: boolean | "all" | undefined;
|
|
99
|
-
disabled?: boolean | undefined;
|
|
100
|
-
unstyled?: boolean | undefined;
|
|
101
210
|
}, import("@tamagui/web").StaticConfigPublic>;
|
|
102
211
|
Text: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiTextElement, import("@tamagui/web").TextNonStyleProps, import("@tamagui/web").TextStylePropsBase, {
|
|
103
212
|
size?: import("@tamagui/web").FontSizeTokens | undefined;
|
package/types/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"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"}
|