@tamagui/button-next 1.105.2
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/LICENSE +21 -0
- package/dist/cjs/Button.js +122 -0
- package/dist/cjs/Button.js.map +6 -0
- package/dist/cjs/Button.native.js +127 -0
- package/dist/cjs/Button.native.js.map +6 -0
- package/dist/cjs/Button.test.js +8 -0
- package/dist/cjs/Button.test.js.map +6 -0
- package/dist/cjs/Button.test.native.js +8 -0
- package/dist/cjs/Button.test.native.js.map +6 -0
- package/dist/cjs/createButton.js +41 -0
- package/dist/cjs/createButton.js.map +6 -0
- package/dist/cjs/createButton.native.js +45 -0
- package/dist/cjs/createButton.native.js.map +6 -0
- package/dist/cjs/index.js +15 -0
- package/dist/cjs/index.js.map +6 -0
- package/dist/cjs/index.native.js +20 -0
- package/dist/cjs/index.native.js.map +6 -0
- package/dist/esm/Button.js +109 -0
- package/dist/esm/Button.js.map +6 -0
- package/dist/esm/Button.mjs +110 -0
- package/dist/esm/Button.mjs.map +1 -0
- package/dist/esm/Button.native.js +109 -0
- package/dist/esm/Button.native.js.map +6 -0
- package/dist/esm/Button.test.js +10 -0
- package/dist/esm/Button.test.js.map +6 -0
- package/dist/esm/Button.test.mjs +10 -0
- package/dist/esm/Button.test.mjs.map +1 -0
- package/dist/esm/Button.test.native.js +10 -0
- package/dist/esm/Button.test.native.js.map +6 -0
- package/dist/esm/createButton.js +26 -0
- package/dist/esm/createButton.js.map +6 -0
- package/dist/esm/createButton.mjs +28 -0
- package/dist/esm/createButton.mjs.map +1 -0
- package/dist/esm/createButton.native.js +26 -0
- package/dist/esm/createButton.native.js.map +6 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +6 -0
- package/dist/esm/index.mjs +2 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +2 -0
- package/dist/esm/index.native.js.map +6 -0
- package/dist/jsx/Button.js +109 -0
- package/dist/jsx/Button.js.map +6 -0
- package/dist/jsx/Button.mjs +110 -0
- package/dist/jsx/Button.mjs.map +1 -0
- package/dist/jsx/Button.native.js +109 -0
- package/dist/jsx/Button.native.js.map +6 -0
- package/dist/jsx/Button.test.js +10 -0
- package/dist/jsx/Button.test.js.map +6 -0
- package/dist/jsx/Button.test.mjs +10 -0
- package/dist/jsx/Button.test.mjs.map +1 -0
- package/dist/jsx/Button.test.native.js +10 -0
- package/dist/jsx/Button.test.native.js.map +6 -0
- package/dist/jsx/createButton.js +26 -0
- package/dist/jsx/createButton.js.map +6 -0
- package/dist/jsx/createButton.mjs +28 -0
- package/dist/jsx/createButton.mjs.map +1 -0
- package/dist/jsx/createButton.native.js +26 -0
- package/dist/jsx/createButton.native.js.map +6 -0
- package/dist/jsx/index.js +2 -0
- package/dist/jsx/index.js.map +6 -0
- package/dist/jsx/index.mjs +2 -0
- package/dist/jsx/index.mjs.map +1 -0
- package/dist/jsx/index.native.js +2 -0
- package/dist/jsx/index.native.js.map +6 -0
- package/package.json +52 -0
- package/src/Button.test.tsx +21 -0
- package/src/Button.tsx +134 -0
- package/src/createButton.tsx +42 -0
- package/src/index.ts +1 -0
- package/types/Button.d.ts +43 -0
- package/types/Button.d.ts.map +1 -0
- package/types/Button.test.d.ts +2 -0
- package/types/Button.test.d.ts.map +1 -0
- package/types/createButton.d.ts +18 -0
- package/types/createButton.d.ts.map +1 -0
- package/types/index.d.ts +2 -0
- package/types/index.d.ts.map +1 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { getButtonSized } from "@tamagui/get-button-sized";
|
|
2
|
+
import { SizableText } from "@tamagui/text";
|
|
3
|
+
import { createStyledContext, styled, View } from "@tamagui/web";
|
|
4
|
+
import { createButton } from "./createButton";
|
|
5
|
+
var Frame = styled(View, {
|
|
6
|
+
variants: {
|
|
7
|
+
unstyled: {
|
|
8
|
+
false: {
|
|
9
|
+
size: "$true",
|
|
10
|
+
justifyContent: "center",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
flexWrap: "nowrap",
|
|
13
|
+
flexDirection: "row",
|
|
14
|
+
cursor: "pointer",
|
|
15
|
+
hoverTheme: !0,
|
|
16
|
+
pressTheme: !0,
|
|
17
|
+
backgrounded: !0,
|
|
18
|
+
borderWidth: 1,
|
|
19
|
+
borderColor: "transparent",
|
|
20
|
+
focusVisibleStyle: {
|
|
21
|
+
outlineColor: "$outlineColor",
|
|
22
|
+
outlineStyle: "solid",
|
|
23
|
+
outlineWidth: 2
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
variant: {
|
|
28
|
+
outlined: {
|
|
29
|
+
backgroundColor: "transparent",
|
|
30
|
+
borderWidth: 2,
|
|
31
|
+
borderColor: "$borderColor",
|
|
32
|
+
hoverStyle: {
|
|
33
|
+
backgroundColor: "transparent",
|
|
34
|
+
borderColor: "$borderColorHover"
|
|
35
|
+
},
|
|
36
|
+
pressStyle: {
|
|
37
|
+
backgroundColor: "transparent",
|
|
38
|
+
borderColor: "$borderColorPress"
|
|
39
|
+
},
|
|
40
|
+
focusVisibleStyle: {
|
|
41
|
+
backgroundColor: "transparent",
|
|
42
|
+
borderColor: "$borderColorFocus"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
size: {
|
|
47
|
+
"...size": getButtonSized,
|
|
48
|
+
":number": getButtonSized
|
|
49
|
+
},
|
|
50
|
+
disabled: {
|
|
51
|
+
true: {
|
|
52
|
+
pointerEvents: "none"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
58
|
+
}
|
|
59
|
+
}), Text = styled(SizableText, {
|
|
60
|
+
variants: {
|
|
61
|
+
unstyled: {
|
|
62
|
+
false: {
|
|
63
|
+
userSelect: "none",
|
|
64
|
+
cursor: "pointer",
|
|
65
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
66
|
+
flexGrow: 0,
|
|
67
|
+
flexShrink: 1,
|
|
68
|
+
ellipse: !0,
|
|
69
|
+
color: "$color"
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
defaultVariants: {
|
|
74
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
75
|
+
}
|
|
76
|
+
}), Icon = styled(SizableText, {
|
|
77
|
+
variants: {
|
|
78
|
+
unstyled: {
|
|
79
|
+
false: {
|
|
80
|
+
userSelect: "none",
|
|
81
|
+
cursor: "pointer",
|
|
82
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
83
|
+
flexGrow: 0,
|
|
84
|
+
flexShrink: 1,
|
|
85
|
+
ellipse: !0,
|
|
86
|
+
color: "$color"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
92
|
+
}
|
|
93
|
+
}), ButtonContext = createStyledContext({
|
|
94
|
+
size: void 0,
|
|
95
|
+
variant: void 0
|
|
96
|
+
}), Button = createButton({
|
|
97
|
+
Frame,
|
|
98
|
+
Text,
|
|
99
|
+
Icon,
|
|
100
|
+
defaultVariants: {
|
|
101
|
+
size: void 0,
|
|
102
|
+
variant: void 0
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
export {
|
|
106
|
+
Button,
|
|
107
|
+
ButtonContext
|
|
108
|
+
};
|
|
109
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/button-next/src/Button.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,sBAAsB;AAC/B,SAASC,mBAAmB;AAE5B,SAASC,qBAAqBC,QAAQC,YAAY;AAClD,SAASC,oBAAoB;AAM7B,IAAMC,QAAQH,OAAOC,MAAM;EACzBG,UAAU;IACRC,UAAU;MACRC,OAAO;QACLC,MAAM;QACNC,gBAAgB;QAChBC,YAAY;QACZC,UAAU;QACVC,eAAe;QACfC,QAAQ;QACRC,YAAY;QACZC,YAAY;QACZC,cAAc;QACdC,aAAa;QACbC,aAAa;QAEbC,mBAAmB;UACjBC,cAAc;UACdC,cAAc;UACdC,cAAc;QAChB;MACF;IACF;IAEAC,SAAS;MACPC,UAAU;QACRC,iBAAiB;QACjBR,aAAa;QACbC,aAAa;QAEbQ,YAAY;UACVD,iBAAiB;UACjBP,aAAa;QACf;QAEAS,YAAY;UACVF,iBAAiB;UACjBP,aAAa;QACf;QAEAC,mBAAmB;UACjBM,iBAAiB;UACjBP,aAAa;QACf;MACF;IACF;IAEAV,MAAM;MACJ,WAAWV;MACX,WAAWA;IACb;IAEA8B,UAAU;MACRC,MAAM;QACJC,eAAe;MACjB;IACF;EACF;EAEAC,iBAAiB;IACfzB,UAAU0B,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAEMC,OAAOlC,OAAOF,aAAa;EAC/BM,UAAU;IACRC,UAAU;MACRC,OAAO;QACL6B,YAAY;QACZvB,QAAQ;;QAERwB,UAAU;QACVC,YAAY;QACZC,SAAS;QACTC,OAAO;MACT;IACF;EACF;EAEAT,iBAAiB;IACfzB,UAAU0B,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAEMO,OAAOxC,OAAOF,aAAa;EAC/BM,UAAU;IACRC,UAAU;MACRC,OAAO;QACL6B,YAAY;QACZvB,QAAQ;;QAERwB,UAAU;QACVC,YAAY;QACZC,SAAS;QACTC,OAAO;MACT;IACF;EACF;EAEAT,iBAAiB;IACfzB,UAAU0B,QAAQC,IAAIC,qBAAqB;EAC7C;AACF,CAAA,GAEaQ,gBAAgB1C,oBAG1B;EACDQ,MAAMmC;EACNpB,SAASoB;AACX,CAAA,GAEaC,SAASzC,aAGnB;EACDC;EACA+B;EACAM;EACAV,iBAAiB;IACfvB,MAAMmC;IACNpB,SAASoB;EACX;AACF,CAAA;",
|
|
5
|
+
"names": ["getButtonSized", "SizableText", "createStyledContext", "styled", "View", "createButton", "Frame", "variants", "unstyled", "false", "size", "justifyContent", "alignItems", "flexWrap", "flexDirection", "cursor", "hoverTheme", "pressTheme", "backgrounded", "borderWidth", "borderColor", "focusVisibleStyle", "outlineColor", "outlineStyle", "outlineWidth", "variant", "outlined", "backgroundColor", "hoverStyle", "pressStyle", "disabled", "true", "pointerEvents", "defaultVariants", "process", "env", "TAMAGUI_HEADLESS", "Text", "userSelect", "flexGrow", "flexShrink", "ellipse", "color", "Icon", "ButtonContext", "undefined", "Button"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
2
|
+
import { createTamagui } from "@tamagui/core";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
const conf = createTamagui(getDefaultTamaguiConfig());
|
|
5
|
+
describe("Button", () => {
|
|
6
|
+
test("123", () => {
|
|
7
|
+
expect(!0).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC,SAAS,qBAAqB;AAC9B,SAAS,UAAU,QAAQ,YAAY;AAEvC,MAAM,OAAO,cAAc,wBAAwB,CAAC;AAEpD,SAAS,UAAU,MAAM;AACvB,OAAK,OAAO,MAAM;AAChB,WAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
2
|
+
import { createTamagui } from "@tamagui/core";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
const conf = createTamagui(getDefaultTamaguiConfig());
|
|
5
|
+
describe("Button", () => {
|
|
6
|
+
test("123", () => {
|
|
7
|
+
expect(!0).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=Button.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getDefaultTamaguiConfig","createTamagui","describe","expect","test","conf","toBeTruthy"],"sources":["../../src/Button.test.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,uBAAA,QAA+B;AACxC,SAASC,aAAA,QAAqB;AAC9B,SAASC,QAAA,EAAUC,MAAA,EAAQC,IAAA,QAAY;AAEvC,MAAMC,IAAA,GAAOJ,aAAA,CAAcD,uBAAA,CAAwB,CAAC;AAEpDE,QAAA,CAAS,UAAU,MAAM;EACvBE,IAAA,CAAK,OAAO,MAAM;IAChBD,MAAA,CAAO,EAAI,EAAEG,UAAA,CAAW;EAC1B,CAAC;AAWH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getDefaultTamaguiConfig } from "@tamagui/config-default";
|
|
2
|
+
import { createTamagui } from "@tamagui/core";
|
|
3
|
+
import { describe, expect, test } from "vitest";
|
|
4
|
+
var conf = createTamagui(getDefaultTamaguiConfig());
|
|
5
|
+
describe("Button", function() {
|
|
6
|
+
test("123", function() {
|
|
7
|
+
expect(!0).toBeTruthy();
|
|
8
|
+
});
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=Button.test.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/button-next/src/Button.test.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,+BAA+B;AACxC,SAASC,qBAAqB;AAC9B,SAASC,UAAUC,QAAQC,YAAY;AAEvC,IAAMC,OAAOJ,cAAcD,wBAAAA,CAAAA;AAE3BE,SAAS,UAAU,WAAA;AACjBE,OAAM,OAAM,WAAA;AACVD,WAAO,EAAA,EAAMG,WAAU;EACzB,CAAA;AAWF,CAAA;",
|
|
5
|
+
"names": ["getDefaultTamaguiConfig", "createTamagui", "describe", "expect", "test", "conf", "toBeTruthy"]
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { withStaticProperties } from "@tamagui/helpers";
|
|
2
|
+
import { createStyledContext, styled } from "@tamagui/web";
|
|
3
|
+
const createButton = (options) => {
|
|
4
|
+
const context = createStyledContext(options.defaultVariants), name = options.name ?? "button", Frame = styled(options.Frame, {
|
|
5
|
+
context,
|
|
6
|
+
name,
|
|
7
|
+
group: name,
|
|
8
|
+
role: "button",
|
|
9
|
+
tag: "button"
|
|
10
|
+
}), Icon = styled(options.Icon, {
|
|
11
|
+
name,
|
|
12
|
+
context
|
|
13
|
+
}), Text = styled(options.Text, {
|
|
14
|
+
name,
|
|
15
|
+
context
|
|
16
|
+
});
|
|
17
|
+
return withStaticProperties(Frame, {
|
|
18
|
+
Apply: context.Provider,
|
|
19
|
+
Text,
|
|
20
|
+
Icon
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
createButton
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=createButton.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/createButton.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAAS,4BAA4B;AAMrC,SAAS,qBAAqB,cAAc;AAErC,MAAM,eAAe,CAAuC,YAM7D;AACJ,QAAM,UAAU,oBAAoB,QAAQ,eAAe,GACrD,OAAO,QAAQ,QAAQ,UAEvB,QAAQ,OAAO,QAAQ,OAAO;AAAA,IAClC;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP,MAAM;AAAA,IACN,KAAK;AAAA,EACP,CAAC,GAEK,OAAO,OAAO,QAAQ,MAAM;AAAA,IAChC;AAAA,IACA;AAAA,EACF,CAAC,GAEK,OAAO,OAAO,QAAQ,MAAM;AAAA,IAChC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,qBAAqB,OAAO;AAAA,IACjC,OAAO,QAAQ;AAAA,IACf;AAAA,IACA;AAAA,EACF,CAAC;AACH;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { withStaticProperties } from "@tamagui/helpers";
|
|
2
|
+
import { createStyledContext, styled } from "@tamagui/web";
|
|
3
|
+
const createButton = options => {
|
|
4
|
+
const context = createStyledContext(options.defaultVariants),
|
|
5
|
+
name = options.name ?? "button",
|
|
6
|
+
Frame = styled(options.Frame, {
|
|
7
|
+
context,
|
|
8
|
+
name,
|
|
9
|
+
group: name,
|
|
10
|
+
role: "button",
|
|
11
|
+
tag: "button"
|
|
12
|
+
}),
|
|
13
|
+
Icon = styled(options.Icon, {
|
|
14
|
+
name,
|
|
15
|
+
context
|
|
16
|
+
}),
|
|
17
|
+
Text = styled(options.Text, {
|
|
18
|
+
name,
|
|
19
|
+
context
|
|
20
|
+
});
|
|
21
|
+
return withStaticProperties(Frame, {
|
|
22
|
+
Apply: context.Provider,
|
|
23
|
+
Text,
|
|
24
|
+
Icon
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export { createButton };
|
|
28
|
+
//# sourceMappingURL=createButton.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["withStaticProperties","createStyledContext","styled","createButton","options","context","defaultVariants","name","Frame","group","role","tag","Icon","Text","Apply","Provider"],"sources":["../../src/createButton.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAASA,oBAAA,QAA4B;AAMrC,SAASC,mBAAA,EAAqBC,MAAA,QAAc;AAErC,MAAMC,YAAA,GAAsDC,OAAA,IAM7D;EACJ,MAAMC,OAAA,GAAUJ,mBAAA,CAAoBG,OAAA,CAAQE,eAAe;IACrDC,IAAA,GAAOH,OAAA,CAAQG,IAAA,IAAQ;IAEvBC,KAAA,GAAQN,MAAA,CAAOE,OAAA,CAAQI,KAAA,EAAO;MAClCH,OAAA;MACAE,IAAA;MACAE,KAAA,EAAOF,IAAA;MACPG,IAAA,EAAM;MACNC,GAAA,EAAK;IACP,CAAC;IAEKC,IAAA,GAAOV,MAAA,CAAOE,OAAA,CAAQQ,IAAA,EAAM;MAChCL,IAAA;MACAF;IACF,CAAC;IAEKQ,IAAA,GAAOX,MAAA,CAAOE,OAAA,CAAQS,IAAA,EAAM;MAChCN,IAAA;MACAF;IACF,CAAC;EAED,OAAOL,oBAAA,CAAqBQ,KAAA,EAAO;IACjCM,KAAA,EAAOT,OAAA,CAAQU,QAAA;IACfF,IAAA;IACAD;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { withStaticProperties } from "@tamagui/helpers";
|
|
2
|
+
import { createStyledContext, styled } from "@tamagui/web";
|
|
3
|
+
var createButton = function(options) {
|
|
4
|
+
var context = createStyledContext(options.defaultVariants), _options_name, name = (_options_name = options.name) !== null && _options_name !== void 0 ? _options_name : "button", Frame = styled(options.Frame, {
|
|
5
|
+
context,
|
|
6
|
+
name,
|
|
7
|
+
group: name,
|
|
8
|
+
role: "button",
|
|
9
|
+
tag: "button"
|
|
10
|
+
}), Icon = styled(options.Icon, {
|
|
11
|
+
name,
|
|
12
|
+
context
|
|
13
|
+
}), Text = styled(options.Text, {
|
|
14
|
+
name,
|
|
15
|
+
context
|
|
16
|
+
});
|
|
17
|
+
return withStaticProperties(Frame, {
|
|
18
|
+
Apply: context.Provider,
|
|
19
|
+
Text,
|
|
20
|
+
Icon
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
createButton
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=createButton.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Users/n8/tamagui/code/ui/button-next/src/createButton.tsx"],
|
|
4
|
+
"mappings": "AAAA,SAASA,4BAA4B;AAMrC,SAASC,qBAAqBC,cAAc;AAErC,IAAMC,eAAe,SAAuCC,SAAAA;AAOjE,MAAMC,UAAUJ,oBAAoBG,QAAQE,eAAe,GAC9CF,eAAPG,QAAOH,gBAAAA,QAAQG,UAAI,QAAZH,kBAAAA,SAAAA,gBAAgB,UAEvBI,QAAQN,OAAOE,QAAQI,OAAO;IAClCH;IACAE;IACAE,OAAOF;IACPG,MAAM;IACNC,KAAK;EACP,CAAA,GAEMC,OAAOV,OAAOE,QAAQQ,MAAM;IAChCL;IACAF;EACF,CAAA,GAEMQ,OAAOX,OAAOE,QAAQS,MAAM;IAChCN;IACAF;EACF,CAAA;AAEA,SAAOL,qBAAqBQ,OAAO;IACjCM,OAAOT,QAAQU;IACfF;IACAD;EACF,CAAA;AACF;",
|
|
5
|
+
"names": ["withStaticProperties", "createStyledContext", "styled", "createButton", "options", "context", "defaultVariants", "name", "Frame", "group", "role", "tag", "Icon", "Text", "Apply", "Provider"]
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc","ignoreList":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tamagui/button-next",
|
|
3
|
+
"version": "1.105.2",
|
|
4
|
+
"sideEffects": [
|
|
5
|
+
"*.css"
|
|
6
|
+
],
|
|
7
|
+
"source": "src/index.ts",
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"main": "dist/cjs",
|
|
10
|
+
"module": "dist/esm",
|
|
11
|
+
"module:jsx": "dist/jsx",
|
|
12
|
+
"files": [
|
|
13
|
+
"src",
|
|
14
|
+
"types",
|
|
15
|
+
"dist"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tamagui-build",
|
|
19
|
+
"watch": "tamagui-build --watch",
|
|
20
|
+
"lint": "npx biome check src",
|
|
21
|
+
"lint:fix": "npx biome check --apply-unsafe src",
|
|
22
|
+
"clean": "tamagui-build clean",
|
|
23
|
+
"clean:build": "tamagui-build clean:build"
|
|
24
|
+
},
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"react-native": "./dist/cjs/index.native.js",
|
|
29
|
+
"types": "./types/index.d.ts",
|
|
30
|
+
"import": "./dist/esm/index.mjs",
|
|
31
|
+
"require": "./dist/cjs/index.js"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@tamagui/get-button-sized": "1.105.2",
|
|
36
|
+
"@tamagui/stacks": "1.105.2",
|
|
37
|
+
"@tamagui/text": "1.105.2",
|
|
38
|
+
"@tamagui/web": "1.105.2"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@tamagui/build": "1.105.2",
|
|
42
|
+
"react": "^18.2.0",
|
|
43
|
+
"vitest": "^0.34.3"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": "*"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getDefaultTamaguiConfig } from '@tamagui/config-default'
|
|
2
|
+
import { createTamagui } from '@tamagui/core'
|
|
3
|
+
import { describe, expect, test } from 'vitest'
|
|
4
|
+
|
|
5
|
+
const conf = createTamagui(getDefaultTamaguiConfig())
|
|
6
|
+
|
|
7
|
+
describe('Button', () => {
|
|
8
|
+
test(`123`, () => {
|
|
9
|
+
expect(true).toBeTruthy()
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
// test(`Adapts to a when given accessibilityRole="link"`, async () => {
|
|
13
|
+
// const { container } = render(
|
|
14
|
+
// <TamaguiProvider config={conf} defaultTheme="light">
|
|
15
|
+
// <Button href="http://google.com" accessibilityRole="link" />
|
|
16
|
+
// </TamaguiProvider>
|
|
17
|
+
// )
|
|
18
|
+
|
|
19
|
+
// expect(container.firstChild).toMatchSnapshot()
|
|
20
|
+
// })
|
|
21
|
+
})
|
package/src/Button.tsx
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { getButtonSized } from '@tamagui/get-button-sized'
|
|
2
|
+
import { SizableText } from '@tamagui/text'
|
|
3
|
+
import type { GetProps, SizeTokens } from '@tamagui/web'
|
|
4
|
+
import { createStyledContext, styled, View } from '@tamagui/web'
|
|
5
|
+
import { createButton } from './createButton'
|
|
6
|
+
|
|
7
|
+
type ButtonVariant = 'outlined'
|
|
8
|
+
|
|
9
|
+
export type ButtonProps = GetProps<typeof Frame>
|
|
10
|
+
|
|
11
|
+
const Frame = styled(View, {
|
|
12
|
+
variants: {
|
|
13
|
+
unstyled: {
|
|
14
|
+
false: {
|
|
15
|
+
size: '$true',
|
|
16
|
+
justifyContent: 'center',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
flexWrap: 'nowrap',
|
|
19
|
+
flexDirection: 'row',
|
|
20
|
+
cursor: 'pointer',
|
|
21
|
+
hoverTheme: true,
|
|
22
|
+
pressTheme: true,
|
|
23
|
+
backgrounded: true,
|
|
24
|
+
borderWidth: 1,
|
|
25
|
+
borderColor: 'transparent',
|
|
26
|
+
|
|
27
|
+
focusVisibleStyle: {
|
|
28
|
+
outlineColor: '$outlineColor',
|
|
29
|
+
outlineStyle: 'solid',
|
|
30
|
+
outlineWidth: 2,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
variant: {
|
|
36
|
+
outlined: {
|
|
37
|
+
backgroundColor: 'transparent',
|
|
38
|
+
borderWidth: 2,
|
|
39
|
+
borderColor: '$borderColor',
|
|
40
|
+
|
|
41
|
+
hoverStyle: {
|
|
42
|
+
backgroundColor: 'transparent',
|
|
43
|
+
borderColor: '$borderColorHover',
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
pressStyle: {
|
|
47
|
+
backgroundColor: 'transparent',
|
|
48
|
+
borderColor: '$borderColorPress',
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
focusVisibleStyle: {
|
|
52
|
+
backgroundColor: 'transparent',
|
|
53
|
+
borderColor: '$borderColorFocus',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
size: {
|
|
59
|
+
'...size': getButtonSized,
|
|
60
|
+
':number': getButtonSized,
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
disabled: {
|
|
64
|
+
true: {
|
|
65
|
+
pointerEvents: 'none',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
} as const,
|
|
69
|
+
|
|
70
|
+
defaultVariants: {
|
|
71
|
+
unstyled: process.env.TAMAGUI_HEADLESS === '1',
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
const Text = styled(SizableText, {
|
|
76
|
+
variants: {
|
|
77
|
+
unstyled: {
|
|
78
|
+
false: {
|
|
79
|
+
userSelect: 'none',
|
|
80
|
+
cursor: 'pointer',
|
|
81
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
82
|
+
flexGrow: 0,
|
|
83
|
+
flexShrink: 1,
|
|
84
|
+
ellipse: true,
|
|
85
|
+
color: '$color',
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
} as const,
|
|
89
|
+
|
|
90
|
+
defaultVariants: {
|
|
91
|
+
unstyled: process.env.TAMAGUI_HEADLESS === '1',
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
const Icon = styled(SizableText, {
|
|
96
|
+
variants: {
|
|
97
|
+
unstyled: {
|
|
98
|
+
false: {
|
|
99
|
+
userSelect: 'none',
|
|
100
|
+
cursor: 'pointer',
|
|
101
|
+
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
102
|
+
flexGrow: 0,
|
|
103
|
+
flexShrink: 1,
|
|
104
|
+
ellipse: true,
|
|
105
|
+
color: '$color',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
} as const,
|
|
109
|
+
|
|
110
|
+
defaultVariants: {
|
|
111
|
+
unstyled: process.env.TAMAGUI_HEADLESS === '1',
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
export const ButtonContext = createStyledContext<{
|
|
116
|
+
size?: SizeTokens
|
|
117
|
+
variant?: ButtonVariant
|
|
118
|
+
}>({
|
|
119
|
+
size: undefined,
|
|
120
|
+
variant: undefined,
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
export const Button = createButton<{
|
|
124
|
+
size?: SizeTokens
|
|
125
|
+
variant?: ButtonVariant
|
|
126
|
+
}>({
|
|
127
|
+
Frame,
|
|
128
|
+
Text,
|
|
129
|
+
Icon,
|
|
130
|
+
defaultVariants: {
|
|
131
|
+
size: undefined,
|
|
132
|
+
variant: undefined,
|
|
133
|
+
},
|
|
134
|
+
})
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { withStaticProperties } from '@tamagui/helpers'
|
|
2
|
+
import type {
|
|
3
|
+
TamaguiComponentExpectingVariants,
|
|
4
|
+
TextProps,
|
|
5
|
+
ViewProps,
|
|
6
|
+
} from '@tamagui/web'
|
|
7
|
+
import { createStyledContext, styled } from '@tamagui/web'
|
|
8
|
+
|
|
9
|
+
export const createButton = <Variants extends Record<string, any>>(options: {
|
|
10
|
+
Frame: TamaguiComponentExpectingVariants<ViewProps, Variants>
|
|
11
|
+
Text: TamaguiComponentExpectingVariants<TextProps, Variants>
|
|
12
|
+
Icon: TamaguiComponentExpectingVariants<TextProps, Variants>
|
|
13
|
+
defaultVariants?: { [Key in keyof Variants]: Variants[Key] | undefined }
|
|
14
|
+
name?: string
|
|
15
|
+
}) => {
|
|
16
|
+
const context = createStyledContext(options.defaultVariants)
|
|
17
|
+
const name = options.name ?? 'button'
|
|
18
|
+
|
|
19
|
+
const Frame = styled(options.Frame, {
|
|
20
|
+
context,
|
|
21
|
+
name,
|
|
22
|
+
group: name as any,
|
|
23
|
+
role: 'button',
|
|
24
|
+
tag: 'button',
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
const Icon = styled(options.Icon, {
|
|
28
|
+
name,
|
|
29
|
+
context,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
const Text = styled(options.Text, {
|
|
33
|
+
name,
|
|
34
|
+
context,
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
return withStaticProperties(Frame, {
|
|
38
|
+
Apply: context.Provider,
|
|
39
|
+
Text,
|
|
40
|
+
Icon,
|
|
41
|
+
})
|
|
42
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Button'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GetProps, SizeTokens } from '@tamagui/web';
|
|
2
|
+
type ButtonVariant = 'outlined';
|
|
3
|
+
export type ButtonProps = GetProps<typeof Frame>;
|
|
4
|
+
declare const Frame: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").TamaguiElement, import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
5
|
+
size?: number | SizeTokens | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
unstyled?: boolean | undefined;
|
|
8
|
+
variant?: "outlined" | undefined;
|
|
9
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
10
|
+
export declare const ButtonContext: import("@tamagui/web").StyledContext<{
|
|
11
|
+
size?: SizeTokens;
|
|
12
|
+
variant?: ButtonVariant;
|
|
13
|
+
}>;
|
|
14
|
+
export declare const Button: import("react").ForwardRefExoticComponent<import("@tamagui/web").GetFinalProps<any, any, {
|
|
15
|
+
size?: SizeTokens;
|
|
16
|
+
variant?: ButtonVariant;
|
|
17
|
+
}> & import("react").RefAttributes<any>> & import("@tamagui/web").StaticComponentObject<import("@tamagui/web").TamaDefer, any, any, any, {
|
|
18
|
+
size?: SizeTokens;
|
|
19
|
+
variant?: ButtonVariant;
|
|
20
|
+
}, import("@tamagui/web").StaticConfigPublic> & Omit<import("@tamagui/web").StaticConfigPublic, "staticConfig" | "extractable" | "styleable"> & {
|
|
21
|
+
__tama: [import("@tamagui/web").TamaDefer, any, any, any, {
|
|
22
|
+
size?: SizeTokens;
|
|
23
|
+
variant?: ButtonVariant;
|
|
24
|
+
}, import("@tamagui/web").StaticConfigPublic];
|
|
25
|
+
} & {
|
|
26
|
+
Apply: import("react").ProviderExoticComponent<Partial<{
|
|
27
|
+
size?: SizeTokens;
|
|
28
|
+
variant?: ButtonVariant;
|
|
29
|
+
}> & {
|
|
30
|
+
children?: import("react").ReactNode;
|
|
31
|
+
scope?: string;
|
|
32
|
+
}>;
|
|
33
|
+
Text: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, any, any, any, {
|
|
34
|
+
size?: SizeTokens;
|
|
35
|
+
variant?: ButtonVariant;
|
|
36
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
37
|
+
Icon: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, any, any, any, {
|
|
38
|
+
size?: SizeTokens;
|
|
39
|
+
variant?: ButtonVariant;
|
|
40
|
+
}, import("@tamagui/web").StaticConfigPublic>;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
43
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAIxD,KAAK,aAAa,GAAG,UAAU,CAAA;AAE/B,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAA;AAEhD,QAAA,MAAM,KAAK;;;;;6CA8DT,CAAA;AA0CF,eAAO,MAAM,aAAa;WACjB,UAAU;cACP,aAAa;EAIvB,CAAA;AAEF,eAAO,MAAM,MAAM;WACV,UAAU;cACP,aAAa;;WADhB,UAAU;cACP,aAAa;;;eADhB,UAAU;kBACP,aAAa;;;;eADhB,UAAU;kBACP,aAAa;;;;;;eADhB,UAAU;kBACP,aAAa;;;eADhB,UAAU;kBACP,aAAa;;CASvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.test.d.ts","sourceRoot":"","sources":["../src/Button.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TamaguiComponentExpectingVariants, TextProps, ViewProps } from '@tamagui/web';
|
|
2
|
+
export declare const createButton: <Variants extends Record<string, any>>(options: {
|
|
3
|
+
Frame: TamaguiComponentExpectingVariants<ViewProps, Variants>;
|
|
4
|
+
Text: TamaguiComponentExpectingVariants<TextProps, Variants>;
|
|
5
|
+
Icon: TamaguiComponentExpectingVariants<TextProps, Variants>;
|
|
6
|
+
defaultVariants?: { [Key in keyof Variants]: Variants[Key] | undefined; };
|
|
7
|
+
name?: string;
|
|
8
|
+
}) => import("react").ForwardRefExoticComponent<import("@tamagui/web").GetFinalProps<any, any, Variants> & import("react").RefAttributes<import("@tamagui/web").GetRef<TamaguiComponentExpectingVariants<import("@tamagui/web").StackProps, Variants>>>> & import("@tamagui/web").StaticComponentObject<import("@tamagui/web").TamaDefer, import("@tamagui/web").GetRef<TamaguiComponentExpectingVariants<import("@tamagui/web").StackProps, Variants>>, any, any, Variants, import("@tamagui/web").StaticConfigPublic> & Omit<import("@tamagui/web").StaticConfigPublic, "staticConfig" | "extractable" | "styleable"> & {
|
|
9
|
+
__tama: [import("@tamagui/web").TamaDefer, import("@tamagui/web").GetRef<TamaguiComponentExpectingVariants<import("@tamagui/web").StackProps, Variants>>, any, any, Variants, import("@tamagui/web").StaticConfigPublic];
|
|
10
|
+
} & {
|
|
11
|
+
Apply: import("react").ProviderExoticComponent<Partial<{ [Key in keyof Variants]: Variants[Key] | undefined; }> & {
|
|
12
|
+
children?: import("react").ReactNode;
|
|
13
|
+
scope?: string;
|
|
14
|
+
}>;
|
|
15
|
+
Text: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").GetRef<TamaguiComponentExpectingVariants<TextProps, Variants>>, any, any, Variants, import("@tamagui/web").StaticConfigPublic>;
|
|
16
|
+
Icon: import("@tamagui/web").TamaguiComponent<import("@tamagui/web").TamaDefer, import("@tamagui/web").GetRef<TamaguiComponentExpectingVariants<TextProps, Variants>>, any, any, Variants, import("@tamagui/web").StaticConfigPublic>;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=createButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createButton.d.ts","sourceRoot":"","sources":["../src/createButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,iCAAiC,EACjC,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAA;AAGrB,eAAO,MAAM,YAAY,GAAI,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,WAAW;IAC1E,KAAK,EAAE,iCAAiC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC7D,IAAI,EAAE,iCAAiC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC5D,IAAI,EAAE,iCAAiC,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;IAC5D,eAAe,CAAC,EAAE,GAAG,GAAqB,IAAd,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,SAAS,GAAE,CAAA;IACxE,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;;;8DAFsB,GAAG;;;;;;CA6BzB,CAAA"}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|