@tamagui/button 2.0.0-rc.4 → 2.0.0-rc.40
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 +195 -186
- package/dist/cjs/Button.native.js +195 -188
- 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 +215 -212
- package/dist/cjs/v1/Button.native.js +217 -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 +175 -168
- package/dist/esm/Button.mjs.map +1 -1
- package/dist/esm/Button.native.js +175 -170
- 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 +193 -192
- package/dist/esm/v1/Button.mjs.map +1 -1
- package/dist/esm/v1/Button.native.js +194 -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 +175 -168
- package/dist/jsx/Button.mjs.map +1 -1
- package/dist/jsx/Button.native.js +195 -188
- 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 +193 -192
- package/dist/jsx/v1/Button.mjs.map +1 -1
- package/dist/jsx/v1/Button.native.js +217 -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 +15 -18
- package/src/Button.test.tsx +24 -0
- package/src/Button.tsx +16 -3
- package/types/Button.d.ts +9 -0
- package/types/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-rc.
|
|
3
|
+
"version": "2.0.0-rc.40",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"files": [
|
|
@@ -19,15 +19,12 @@
|
|
|
19
19
|
"./package.json": "./package.json",
|
|
20
20
|
".": {
|
|
21
21
|
"types": "./types/index.d.ts",
|
|
22
|
-
"react-native":
|
|
23
|
-
|
|
24
|
-
"import": "./dist/esm/index.native.js",
|
|
25
|
-
"require": "./dist/cjs/index.native.js"
|
|
26
|
-
},
|
|
22
|
+
"react-native": "./dist/esm/index.native.js",
|
|
23
|
+
"browser": "./dist/esm/index.mjs",
|
|
27
24
|
"module": "./dist/esm/index.mjs",
|
|
28
25
|
"import": "./dist/esm/index.mjs",
|
|
29
26
|
"require": "./dist/cjs/index.cjs",
|
|
30
|
-
"default": "./dist/
|
|
27
|
+
"default": "./dist/esm/index.mjs"
|
|
31
28
|
}
|
|
32
29
|
},
|
|
33
30
|
"publishConfig": {
|
|
@@ -40,19 +37,19 @@
|
|
|
40
37
|
"clean:build": "tamagui-build clean:build"
|
|
41
38
|
},
|
|
42
39
|
"dependencies": {
|
|
43
|
-
"@tamagui/config-default": "2.0.0-rc.
|
|
44
|
-
"@tamagui/core": "2.0.0-rc.
|
|
45
|
-
"@tamagui/
|
|
46
|
-
"@tamagui/
|
|
47
|
-
"@tamagui/helpers": "2.0.0-rc.
|
|
48
|
-
"@tamagui/
|
|
49
|
-
"@tamagui/
|
|
50
|
-
"@tamagui/
|
|
51
|
-
"@tamagui/
|
|
52
|
-
"@tamagui/web": "2.0.0-rc.
|
|
40
|
+
"@tamagui/config-default": "2.0.0-rc.40",
|
|
41
|
+
"@tamagui/core": "2.0.0-rc.40",
|
|
42
|
+
"@tamagui/get-button-sized": "2.0.0-rc.40",
|
|
43
|
+
"@tamagui/helpers": "2.0.0-rc.40",
|
|
44
|
+
"@tamagui/helpers-tamagui": "2.0.0-rc.40",
|
|
45
|
+
"@tamagui/spacer": "2.0.0-rc.40",
|
|
46
|
+
"@tamagui/stacks": "2.0.0-rc.40",
|
|
47
|
+
"@tamagui/text": "2.0.0-rc.40",
|
|
48
|
+
"@tamagui/font-size": "2.0.0-rc.40",
|
|
49
|
+
"@tamagui/web": "2.0.0-rc.40"
|
|
53
50
|
},
|
|
54
51
|
"devDependencies": {
|
|
55
|
-
"@tamagui/build": "2.0.0-rc.
|
|
52
|
+
"@tamagui/build": "2.0.0-rc.40",
|
|
56
53
|
"react": ">=19",
|
|
57
54
|
"vitest": "4.0.4"
|
|
58
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,6 +1,6 @@
|
|
|
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
5
|
import { SizableText, wrapChildrenInText } from '@tamagui/text'
|
|
6
6
|
import type { ColorTokens, GetProps, SizeTokens, Token } from '@tamagui/web'
|
|
@@ -164,6 +164,7 @@ const Icon = (props: {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
const sizeToken = size ?? styledContext.size
|
|
167
|
+
const iconColor = useCurrentColor(styledContext.color)
|
|
167
168
|
|
|
168
169
|
const iconSize =
|
|
169
170
|
(typeof sizeToken === 'number' ? sizeToken * 0.5 : getFontSize(sizeToken as Token)) *
|
|
@@ -171,7 +172,7 @@ const Icon = (props: {
|
|
|
171
172
|
|
|
172
173
|
return getIcon(children, {
|
|
173
174
|
size: iconSize,
|
|
174
|
-
color:
|
|
175
|
+
color: iconColor,
|
|
175
176
|
})
|
|
176
177
|
}
|
|
177
178
|
|
|
@@ -192,6 +193,17 @@ type ButtonExtraProps = {
|
|
|
192
193
|
iconAfter?: IconProp
|
|
193
194
|
scaleIcon?: number
|
|
194
195
|
iconSize?: SizeTokens
|
|
196
|
+
|
|
197
|
+
// native button html props
|
|
198
|
+
type?: 'submit' | 'reset' | 'button'
|
|
199
|
+
form?: string
|
|
200
|
+
formAction?: string
|
|
201
|
+
formEncType?: string
|
|
202
|
+
formMethod?: string
|
|
203
|
+
formNoValidate?: boolean
|
|
204
|
+
formTarget?: string
|
|
205
|
+
name?: string
|
|
206
|
+
value?: string | readonly string[] | number
|
|
195
207
|
}
|
|
196
208
|
|
|
197
209
|
const ButtonComponent = Frame.styleable<ButtonExtraProps>((propsIn, ref) => {
|
|
@@ -208,6 +220,7 @@ const ButtonComponent = Frame.styleable<ButtonExtraProps>((propsIn, ref) => {
|
|
|
208
220
|
const size = propsIn.size || (propsIn.unstyled ? undefined : '$true')
|
|
209
221
|
|
|
210
222
|
const styledContext = context.useStyledContext()
|
|
223
|
+
const iconColor = useCurrentColor(styledContext?.color)
|
|
211
224
|
const finalSize = iconSize ?? size ?? styledContext?.size
|
|
212
225
|
const iconSizeNumber =
|
|
213
226
|
(typeof finalSize === 'number' ? finalSize * 0.5 : getFontSize(finalSize as Token)) *
|
|
@@ -217,7 +230,7 @@ const ButtonComponent = Frame.styleable<ButtonExtraProps>((propsIn, ref) => {
|
|
|
217
230
|
if (!icon) return null
|
|
218
231
|
return getIcon(icon, {
|
|
219
232
|
size: iconSizeNumber,
|
|
220
|
-
color:
|
|
233
|
+
color: iconColor,
|
|
221
234
|
// No marginLeft or marginRight needed - spacing is handled by the gap property in Frame's size variants
|
|
222
235
|
})
|
|
223
236
|
})
|
package/types/Button.d.ts
CHANGED
|
@@ -15,6 +15,15 @@ type ButtonExtraProps = {
|
|
|
15
15
|
iconAfter?: IconProp;
|
|
16
16
|
scaleIcon?: number;
|
|
17
17
|
iconSize?: SizeTokens;
|
|
18
|
+
type?: 'submit' | 'reset' | 'button';
|
|
19
|
+
form?: string;
|
|
20
|
+
formAction?: string;
|
|
21
|
+
formEncType?: string;
|
|
22
|
+
formMethod?: string;
|
|
23
|
+
formNoValidate?: boolean;
|
|
24
|
+
formTarget?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
value?: string | readonly string[] | number;
|
|
18
27
|
};
|
|
19
28
|
declare const ButtonComponent: import("@tamagui/web").TamaguiComponent<Omit<import("@tamagui/web").GetFinalProps<import("@tamagui/web").StackNonStyleProps, import("@tamagui/web").StackStyleBase, {
|
|
20
29
|
size?: number | SizeTokens | undefined;
|
package/types/Button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAS,MAAM,cAAc,CAAA;AAS5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGnD,KAAK,aAAa,GAAG,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../src/Button.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAS,MAAM,cAAc,CAAA;AAS5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAGnD,KAAK,aAAa,GAAG,UAAU,CAAA;AAiK/B,eAAO,MAAM,aAAa;WACjB,UAAU;cACP,aAAa;YACf,WAAW,GAAG,MAAM;EAK5B,CAAA;AAEF,KAAK,QAAQ,GAAG,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC;IAAE,KAAK,CAAC,EAAE,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,GAAG,CAAA;C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wnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var Button_exports = {};
|
|
16
|
-
__export(Button_exports, {
|
|
17
|
-
Button: () => Button,
|
|
18
|
-
ButtonContext: () => ButtonContext
|
|
19
|
-
});
|
|
20
|
-
module.exports = __toCommonJS(Button_exports);
|
|
21
|
-
var import_font_size = require("@tamagui/font-size"), import_get_button_sized = require("@tamagui/get-button-sized"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_web = require("@tamagui/web"), import_react = require("react"), import_jsx_runtime = require("react/jsx-runtime");
|
|
22
|
-
const context = (0, import_web.createStyledContext)({
|
|
23
|
-
size: void 0,
|
|
24
|
-
variant: void 0,
|
|
25
|
-
color: void 0,
|
|
26
|
-
elevation: void 0
|
|
27
|
-
}), Frame = (0, import_web.styled)(import_web.View, {
|
|
28
|
-
context,
|
|
29
|
-
name: "Button",
|
|
30
|
-
role: "button",
|
|
31
|
-
render: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button" }),
|
|
32
|
-
tabIndex: 0,
|
|
33
|
-
variants: {
|
|
34
|
-
unstyled: {
|
|
35
|
-
false: {
|
|
36
|
-
size: "$true",
|
|
37
|
-
justifyContent: "center",
|
|
38
|
-
alignItems: "center",
|
|
39
|
-
flexWrap: "nowrap",
|
|
40
|
-
flexDirection: "row",
|
|
41
|
-
cursor: "pointer",
|
|
42
|
-
backgroundColor: "$background",
|
|
43
|
-
borderWidth: 1,
|
|
44
|
-
borderColor: "transparent",
|
|
45
|
-
hoverStyle: {
|
|
46
|
-
backgroundColor: "$backgroundHover",
|
|
47
|
-
borderColor: "$borderColorHover"
|
|
48
|
-
},
|
|
49
|
-
pressStyle: {
|
|
50
|
-
backgroundColor: "$backgroundPress",
|
|
51
|
-
borderColor: "$borderColorHover"
|
|
52
|
-
},
|
|
53
|
-
focusVisibleStyle: {
|
|
54
|
-
outlineColor: "$outlineColor",
|
|
55
|
-
outlineStyle: "solid",
|
|
56
|
-
outlineWidth: 2
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
variant: {
|
|
61
|
-
outlined: process.env.TAMAGUI_HEADLESS === "1" ? {} : {
|
|
62
|
-
backgroundColor: "transparent",
|
|
63
|
-
borderWidth: 1,
|
|
64
|
-
borderColor: "$borderColor",
|
|
65
|
-
hoverStyle: {
|
|
66
|
-
backgroundColor: "transparent",
|
|
67
|
-
borderColor: "$borderColorHover"
|
|
68
|
-
},
|
|
69
|
-
pressStyle: {
|
|
70
|
-
backgroundColor: "transparent",
|
|
71
|
-
borderColor: "$borderColorPress"
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
circular: import_stacks.themeableVariants.circular,
|
|
76
|
-
chromeless: import_stacks.themeableVariants.chromeless,
|
|
77
|
-
size: {
|
|
78
|
-
"...size": (val, extras) => {
|
|
79
|
-
const buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras), gap = (0, import_web.getTokenValue)(val);
|
|
80
|
-
return {
|
|
81
|
-
...buttonStyle,
|
|
82
|
-
gap
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
":number": (val, extras) => {
|
|
86
|
-
const buttonStyle = (0, import_get_button_sized.getButtonSized)(val, extras), gap = val * 0.4;
|
|
87
|
-
return {
|
|
88
|
-
...buttonStyle,
|
|
89
|
-
gap
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
elevation: {
|
|
94
|
-
"...size": import_stacks.getElevation,
|
|
95
|
-
":number": import_stacks.getElevation
|
|
96
|
-
},
|
|
97
|
-
disabled: {
|
|
98
|
-
true: {
|
|
99
|
-
pointerEvents: "none",
|
|
100
|
-
// @ts-ignore
|
|
101
|
-
"aria-disabled": !0
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
defaultVariants: {
|
|
106
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
107
|
-
}
|
|
108
|
-
}), Text = (0, import_web.styled)(import_text.SizableText, {
|
|
109
|
-
context,
|
|
110
|
-
variants: {
|
|
111
|
-
unstyled: {
|
|
112
|
-
false: {
|
|
113
|
-
userSelect: "none",
|
|
114
|
-
cursor: "pointer",
|
|
115
|
-
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
116
|
-
flexGrow: 0,
|
|
117
|
-
flexShrink: 1,
|
|
118
|
-
ellipsis: !0,
|
|
119
|
-
color: "$color"
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
defaultVariants: {
|
|
124
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
125
|
-
}
|
|
126
|
-
}), Icon = (props) => {
|
|
127
|
-
const { children, scaleIcon = 1, size } = props, styledContext = context.useStyledContext();
|
|
128
|
-
if (!styledContext)
|
|
129
|
-
throw new Error("Button.Icon must be used within a Button");
|
|
130
|
-
const sizeToken = size ?? styledContext.size, iconSize = (typeof sizeToken == "number" ? sizeToken * 0.5 : (0, import_font_size.getFontSize)(sizeToken)) * scaleIcon;
|
|
131
|
-
return (0, import_helpers_tamagui.getIcon)(children, {
|
|
132
|
-
size: iconSize,
|
|
133
|
-
color: styledContext.color
|
|
134
|
-
});
|
|
135
|
-
}, ButtonContext = (0, import_web.createStyledContext)({
|
|
136
|
-
size: void 0,
|
|
137
|
-
variant: void 0,
|
|
138
|
-
color: void 0
|
|
139
|
-
}), ButtonComponent = Frame.styleable((propsIn, ref) => {
|
|
140
|
-
const isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext), processedProps = (0, import_web.useProps)(propsIn, {
|
|
141
|
-
noNormalize: !0,
|
|
142
|
-
noExpand: !0
|
|
143
|
-
}), { children, iconSize, icon, iconAfter, scaleIcon = 1, ...props } = processedProps, size = propsIn.size || (propsIn.unstyled ? void 0 : "$true"), styledContext = context.useStyledContext(), finalSize = iconSize ?? size ?? styledContext?.size, iconSizeNumber = (typeof finalSize == "number" ? finalSize * 0.5 : (0, import_font_size.getFontSize)(finalSize)) * scaleIcon, [themedIcon, themedIconAfter] = [icon, iconAfter].map((icon2) => icon2 ? (0, import_helpers_tamagui.getIcon)(icon2, {
|
|
144
|
-
size: iconSizeNumber,
|
|
145
|
-
color: styledContext?.color
|
|
146
|
-
// No marginLeft or marginRight needed - spacing is handled by the gap property in Frame's size variants
|
|
147
|
-
}) : null), wrappedChildren = (0, import_text.wrapChildrenInText)(
|
|
148
|
-
Text,
|
|
149
|
-
{ children },
|
|
150
|
-
{
|
|
151
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
152
|
-
size: finalSize ?? styledContext?.size
|
|
153
|
-
}
|
|
154
|
-
);
|
|
155
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, { value: !0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
156
|
-
Frame,
|
|
157
|
-
{
|
|
158
|
-
ref,
|
|
159
|
-
...props,
|
|
160
|
-
...isNested && { render: "span" },
|
|
161
|
-
...props.circular && !propsIn.size && { size },
|
|
162
|
-
tabIndex: 0,
|
|
163
|
-
children: [
|
|
164
|
-
themedIcon,
|
|
165
|
-
wrappedChildren,
|
|
166
|
-
themedIconAfter
|
|
167
|
-
]
|
|
168
|
-
}
|
|
169
|
-
) });
|
|
170
|
-
}), Button = (0, import_web.withStaticProperties)(ButtonComponent, {
|
|
171
|
-
Apply: context.Provider,
|
|
172
|
-
Frame,
|
|
173
|
-
Text,
|
|
174
|
-
Icon
|
|
175
|
-
});
|
|
176
|
-
//# sourceMappingURL=Button.js.map
|
package/dist/cjs/Button.js.map
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA4B,+BAC5B,0BAA+B,sCAC/B,yBAAwB,qCACxB,gBAAsE,4BACtE,cAAgD,0BAEhD,aAOO,yBAEP,eAA2B,kBAoBjB;AAhBV,MAAM,cAAU,gCAKb;AAAA,EACD,MAAM;AAAA,EACN,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AACb,CAAC,GAEK,YAAQ,mBAAO,iBAAM;AAAA,EACzB;AAAA,EACA,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ,4CAAC,YAAO,MAAK,UAAS;AAAA,EAC9B,UAAU;AAAA,EAEV,UAAU;AAAA,IACR,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,gBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,UAAU;AAAA,QACV,eAAe;AAAA,QACf,QAAQ;AAAA,QACR,iBAAiB;AAAA,QACjB,aAAa;AAAA,QACb,aAAa;AAAA,QAEb,YAAY;AAAA,UACV,iBAAiB;AAAA,UACjB,aAAa;AAAA,QACf;AAAA,QAEA,YAAY;AAAA,UACV,iBAAiB;AAAA,UACjB,aAAa;AAAA,QACf;AAAA,QAEA,mBAAmB;AAAA,UACjB,cAAc;AAAA,UACd,cAAc;AAAA,UACd,cAAc;AA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UAArB,EAA8B,OAAO,IACpC;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACH,GAAI,YAAY,EAAE,QAAQ,OAAO;AAAA,MAEjC,GAAI,MAAM,YAAY,CAAC,QAAQ,QAAQ,EAAE,KAAK;AAAA,MAC/C,UAAU;AAAA,MAET;AAAA;AAAA,QACA;AAAA,QACA;AAAA;AAAA;AAAA,EACH,GACF;AAEJ,CAAC,GAEY,aAAS,iCAAqB,iBAAiB;AAAA,EAC1D,OAAO,QAAQ;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
|
|
5
|
-
"names": ["icon"]
|
|
6
|
-
}
|
package/dist/cjs/Button.test.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var import_config_default = require("@tamagui/config-default"), import_core = require("@tamagui/core"), import_vitest = require("vitest");
|
|
2
|
-
const conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
3
|
-
(0, import_vitest.describe)("Button", () => {
|
|
4
|
-
(0, import_vitest.test)("123", () => {
|
|
5
|
-
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
6
|
-
});
|
|
7
|
-
});
|
|
8
|
-
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/Button.test.tsx"],
|
|
4
|
-
"mappings": "AAAA,4BAAwC,oCACxC,cAA8B,0BAC9B,gBAAuC;AAEvC,MAAM,WAAO,+BAAc,+CAAwB,CAAC;AAAA,IAEpD,wBAAS,UAAU,MAAM;AACvB,0BAAK,OAAO,MAAM;AAChB,8BAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
-
return to;
|
|
10
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
-
var index_exports = {};
|
|
13
|
-
module.exports = __toCommonJS(index_exports);
|
|
14
|
-
__reExport(index_exports, require("./Button"), module.exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
package/dist/cjs/v1/Button.js
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
12
|
-
return to;
|
|
13
|
-
};
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
15
|
-
var Button_exports = {};
|
|
16
|
-
__export(Button_exports, {
|
|
17
|
-
Button: () => Button2,
|
|
18
|
-
ButtonContext: () => ButtonContext,
|
|
19
|
-
ButtonFrame: () => ButtonFrame,
|
|
20
|
-
ButtonIcon: () => ButtonIcon,
|
|
21
|
-
ButtonText: () => ButtonText,
|
|
22
|
-
useButton: () => useButton
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(Button_exports);
|
|
25
|
-
var import_font_size = require("@tamagui/font-size"), import_get_button_sized = require("@tamagui/get-button-sized"), import_helpers = require("@tamagui/helpers"), import_helpers_tamagui = require("@tamagui/helpers-tamagui"), import_stacks = require("@tamagui/stacks"), import_text = require("@tamagui/text"), import_web = require("@tamagui/web"), import_react = require("react"), import_spacer = require("@tamagui/spacer"), import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
-
const ButtonContext = (0, import_web.createStyledContext)({
|
|
27
|
-
// keeping these here means they work with styled() passing down color to text
|
|
28
|
-
color: void 0,
|
|
29
|
-
ellipsis: void 0,
|
|
30
|
-
fontFamily: void 0,
|
|
31
|
-
fontSize: void 0,
|
|
32
|
-
fontStyle: void 0,
|
|
33
|
-
fontWeight: void 0,
|
|
34
|
-
letterSpacing: void 0,
|
|
35
|
-
maxFontSizeMultiplier: void 0,
|
|
36
|
-
size: void 0,
|
|
37
|
-
textAlign: void 0,
|
|
38
|
-
variant: void 0
|
|
39
|
-
}), BUTTON_NAME = "Button", ButtonFrame = (0, import_web.styled)(import_stacks.ThemeableStack, {
|
|
40
|
-
name: BUTTON_NAME,
|
|
41
|
-
render: "button",
|
|
42
|
-
context: ButtonContext,
|
|
43
|
-
role: "button",
|
|
44
|
-
focusable: !0,
|
|
45
|
-
variants: {
|
|
46
|
-
unstyled: {
|
|
47
|
-
false: {
|
|
48
|
-
size: "$true",
|
|
49
|
-
justifyContent: "center",
|
|
50
|
-
alignItems: "center",
|
|
51
|
-
flexWrap: "nowrap",
|
|
52
|
-
flexDirection: "row",
|
|
53
|
-
cursor: "pointer",
|
|
54
|
-
hoverTheme: !0,
|
|
55
|
-
pressTheme: !0,
|
|
56
|
-
backgroundColor: "$background",
|
|
57
|
-
borderWidth: 1,
|
|
58
|
-
borderColor: "transparent",
|
|
59
|
-
focusVisibleStyle: {
|
|
60
|
-
outlineColor: "$outlineColor",
|
|
61
|
-
outlineStyle: "solid",
|
|
62
|
-
outlineWidth: 2
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
variant: {
|
|
67
|
-
outlined: {
|
|
68
|
-
backgroundColor: "transparent",
|
|
69
|
-
borderWidth: 2,
|
|
70
|
-
borderColor: "$borderColor",
|
|
71
|
-
hoverStyle: {
|
|
72
|
-
backgroundColor: "transparent",
|
|
73
|
-
borderColor: "$borderColorHover"
|
|
74
|
-
},
|
|
75
|
-
pressStyle: {
|
|
76
|
-
backgroundColor: "transparent",
|
|
77
|
-
borderColor: "$borderColorPress"
|
|
78
|
-
},
|
|
79
|
-
focusVisibleStyle: {
|
|
80
|
-
backgroundColor: "transparent",
|
|
81
|
-
borderColor: "$borderColorFocus"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
size: {
|
|
86
|
-
"...size": import_get_button_sized.getButtonSized,
|
|
87
|
-
":number": import_get_button_sized.getButtonSized
|
|
88
|
-
},
|
|
89
|
-
disabled: {
|
|
90
|
-
true: {
|
|
91
|
-
pointerEvents: "none"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
defaultVariants: {
|
|
96
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
97
|
-
}
|
|
98
|
-
}), ButtonText = (0, import_web.styled)(import_text.SizableText, {
|
|
99
|
-
name: "Button",
|
|
100
|
-
context: ButtonContext,
|
|
101
|
-
variants: {
|
|
102
|
-
unstyled: {
|
|
103
|
-
false: {
|
|
104
|
-
userSelect: "none",
|
|
105
|
-
cursor: "pointer",
|
|
106
|
-
// flexGrow 1 leads to inconsistent native style where text pushes to start of view
|
|
107
|
-
flexGrow: 0,
|
|
108
|
-
flexShrink: 1,
|
|
109
|
-
ellipsis: !0,
|
|
110
|
-
color: "$color"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
defaultVariants: {
|
|
115
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1"
|
|
116
|
-
}
|
|
117
|
-
}), ButtonIcon = (props) => {
|
|
118
|
-
const { children, scaleIcon = 1 } = props, { size, color } = (0, import_react.useContext)(ButtonContext), iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size)) * scaleIcon;
|
|
119
|
-
return (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color })(children);
|
|
120
|
-
}, ButtonComponent = ButtonFrame.styleable(
|
|
121
|
-
function(props, ref) {
|
|
122
|
-
const { props: buttonProps } = useButton(props);
|
|
123
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ButtonFrame, { "data-disable-theme": !0, ...buttonProps, ref });
|
|
124
|
-
}
|
|
125
|
-
), Button2 = (0, import_helpers.withStaticProperties)(ButtonComponent, {
|
|
126
|
-
Text: ButtonText,
|
|
127
|
-
Icon: ButtonIcon
|
|
128
|
-
});
|
|
129
|
-
function useButton({ textProps, ...propsIn }, { Text = Button2.Text } = { Text: Button2.Text }) {
|
|
130
|
-
const isNested = (0, import_react.useContext)(import_stacks.ButtonNestingContext), propsActive = (0, import_web.useProps)(propsIn, {
|
|
131
|
-
noNormalize: !0,
|
|
132
|
-
noExpand: !0
|
|
133
|
-
}), {
|
|
134
|
-
icon,
|
|
135
|
-
iconAfter,
|
|
136
|
-
gap,
|
|
137
|
-
spaceFlex,
|
|
138
|
-
scaleIcon = 1,
|
|
139
|
-
scaleSpace = 0.66,
|
|
140
|
-
noTextWrap,
|
|
141
|
-
fontFamily,
|
|
142
|
-
fontSize,
|
|
143
|
-
fontWeight,
|
|
144
|
-
fontStyle,
|
|
145
|
-
letterSpacing,
|
|
146
|
-
render,
|
|
147
|
-
ellipsis,
|
|
148
|
-
maxFontSizeMultiplier,
|
|
149
|
-
...restProps
|
|
150
|
-
} = propsActive, size = propsActive.size || (propsActive.unstyled ? void 0 : "$true"), color = propsActive.color, iconSize = (typeof size == "number" ? size * 0.5 : (0, import_font_size.getFontSize)(size, {
|
|
151
|
-
font: fontFamily?.[0] === "$" ? fontFamily : void 0
|
|
152
|
-
})) * scaleIcon, getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({
|
|
153
|
-
size: iconSize,
|
|
154
|
-
color
|
|
155
|
-
}), [themedIcon, themedIconAfter] = [icon, iconAfter].map(getThemedIcon), spaceSize = gap ?? (0, import_web.getVariableValue)(iconSize) * scaleSpace, contents = noTextWrap ? [propsIn.children] : (0, import_text.wrapChildrenInText)(
|
|
156
|
-
Text,
|
|
157
|
-
{
|
|
158
|
-
children: propsIn.children,
|
|
159
|
-
fontFamily,
|
|
160
|
-
fontSize,
|
|
161
|
-
textProps,
|
|
162
|
-
fontWeight,
|
|
163
|
-
fontStyle,
|
|
164
|
-
letterSpacing,
|
|
165
|
-
ellipsis,
|
|
166
|
-
maxFontSizeMultiplier
|
|
167
|
-
},
|
|
168
|
-
Text === ButtonText && propsActive.unstyled !== !0 ? {
|
|
169
|
-
unstyled: process.env.TAMAGUI_HEADLESS === "1",
|
|
170
|
-
size
|
|
171
|
-
} : void 0
|
|
172
|
-
), inner = (0, import_spacer.spacedChildren)({
|
|
173
|
-
// a bit arbitrary but scaling to font size is necessary so long as button does
|
|
174
|
-
space: spaceSize,
|
|
175
|
-
spaceFlex,
|
|
176
|
-
ensureKeys: !0,
|
|
177
|
-
direction: propsActive.flexDirection === "column" || propsActive.flexDirection === "column-reverse" ? "vertical" : "horizontal",
|
|
178
|
-
// for keys to stay the same we keep indices as similar a possible
|
|
179
|
-
// so even if icons are undefined we still pass them
|
|
180
|
-
children: [themedIcon, ...contents, themedIconAfter]
|
|
181
|
-
}), props = {
|
|
182
|
-
size,
|
|
183
|
-
...propsIn.disabled && {
|
|
184
|
-
// in rnw - false still has keyboard tabIndex, undefined = not actually focusable
|
|
185
|
-
focusable: void 0,
|
|
186
|
-
// even with tabIndex unset, it will keep focusVisibleStyle on web so disable it here
|
|
187
|
-
focusVisibleStyle: {
|
|
188
|
-
borderColor: "$background"
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
// fixes SSR issue + DOM nesting issue of not allowing button in button
|
|
192
|
-
render: render ?? (isNested ? "span" : (
|
|
193
|
-
// defaults to <a /> when accessibilityRole = link
|
|
194
|
-
// see https://github.com/tamagui/tamagui/issues/505
|
|
195
|
-
propsActive.accessibilityRole === "link" || propsActive.role === "link" ? "a" : "button"
|
|
196
|
-
)),
|
|
197
|
-
...restProps,
|
|
198
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_stacks.ButtonNestingContext.Provider, { value: !0, children: inner }),
|
|
199
|
-
// forces it to be a runtime pressStyle so it passes through context text colors
|
|
200
|
-
disableClassName: !0
|
|
201
|
-
};
|
|
202
|
-
return {
|
|
203
|
-
spaceSize,
|
|
204
|
-
isNested,
|
|
205
|
-
props
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
//# sourceMappingURL=Button.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/v1/Button.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA4B,+BAC5B,0BAA+B,sCAC/B,iBAAqC,6BACrC,yBAAiC,qCACjC,gBAAqD,4BAErD,cAAgD,0BAEhD,aAAwE,yBAExE,eAA2B,kBAC3B,gBAA+B,4BAiLpB;AA7KJ,MAAM,oBAAgB,gCAO3B;AAA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E,4CAAC,mCAAqB,UAArB,EAA8B,OAAO,IAAO,iBAAM;AAAA;AAAA,IAGrD,kBAAkB;AAAA,EACpB;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
|
|
5
|
-
"names": ["Button"]
|
|
6
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
var import_config_default = require("@tamagui/config-default"), import_core = require("@tamagui/core"), import_vitest = require("vitest");
|
|
2
|
-
const conf = (0, import_core.createTamagui)((0, import_config_default.getDefaultTamaguiConfig)());
|
|
3
|
-
(0, import_vitest.describe)("Button", () => {
|
|
4
|
-
(0, import_vitest.test)("123", () => {
|
|
5
|
-
(0, import_vitest.expect)(!0).toBeTruthy();
|
|
6
|
-
});
|
|
7
|
-
});
|
|
8
|
-
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/v1/Button.test.tsx"],
|
|
4
|
-
"mappings": "AAAA,4BAAwC,oCACxC,cAA8B,0BAC9B,gBAAuC;AAEvC,MAAM,WAAO,+BAAc,+CAAwB,CAAC;AAAA,IAEpD,wBAAS,UAAU,MAAM;AACvB,0BAAK,OAAO,MAAM;AAChB,8BAAO,EAAI,EAAE,WAAW;AAAA,EAC1B,CAAC;AAWH,CAAC;",
|
|
5
|
-
"names": []
|
|
6
|
-
}
|
package/dist/cjs/v1/index.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from == "object" || typeof from == "function")
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
!__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
9
|
-
return to;
|
|
10
|
-
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
11
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
|
|
12
|
-
var v1_exports = {};
|
|
13
|
-
module.exports = __toCommonJS(v1_exports);
|
|
14
|
-
__reExport(v1_exports, require("./Button"), module.exports);
|
|
15
|
-
//# sourceMappingURL=index.js.map
|