@evo-web/react 0.0.1 → 0.0.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/dist/evo-button/button-cell.d.ts +8 -0
- package/dist/evo-button/button-cell.d.ts.map +1 -0
- package/dist/evo-button/button-cell.js +15 -0
- package/dist/evo-button/button-cell.js.map +1 -0
- package/dist/evo-button/button.d.ts +6 -0
- package/dist/evo-button/button.d.ts.map +1 -0
- package/dist/evo-button/button.js +50 -0
- package/dist/evo-button/button.js.map +1 -0
- package/dist/evo-button/index.d.ts +4 -0
- package/dist/evo-button/index.d.ts.map +1 -0
- package/{src/evo-button/types.ts → dist/evo-button/types.d.ts} +17 -22
- package/dist/evo-button/types.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/package.json +4 -1
- package/.prettierignore +0 -3
- package/.storybook/main.js +0 -32
- package/.storybook/manager-head.html +0 -6
- package/.storybook/manager.ts +0 -4
- package/.storybook/preview.tsx +0 -50
- package/.storybook/theme.ts +0 -17
- package/.storybook/vite.config.js +0 -3
- package/CHANGELOG.md +0 -11
- package/eslint.config.js +0 -53
- package/src/evo-button/button-cell.tsx +0 -21
- package/src/evo-button/button.stories.tsx +0 -113
- package/src/evo-button/button.tsx +0 -138
- package/src/evo-button/index.ts +0 -10
- package/src/evo-button/test/__snapshots__/test.server.tsx.snap +0 -83
- package/src/evo-button/test/test.browser.tsx +0 -298
- package/src/evo-button/test/test.server.tsx +0 -245
- package/src/index.ts +0 -9
- package/test.setup.ts +0 -7
- package/tsconfig.json +0 -21
- package/tsconfig.prod.json +0 -5
- package/vite.config.js +0 -88
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { it, expect, describe } from "vitest";
|
|
2
|
-
import { renderToString } from "react-dom/server";
|
|
3
|
-
import { EvoButton } from "../button";
|
|
4
|
-
import { EvoButtonCell } from "../button-cell";
|
|
5
|
-
import type { Priority, Size, Variant, Split, BodyState } from "../types";
|
|
6
|
-
|
|
7
|
-
describe("EvoButton SSR", () => {
|
|
8
|
-
it.each<Priority>(["primary", "secondary", "tertiary", "none"])(
|
|
9
|
-
"should render button with priority=%s",
|
|
10
|
-
(priority) => {
|
|
11
|
-
expect(
|
|
12
|
-
renderToString(<EvoButton priority={priority}>Button</EvoButton>),
|
|
13
|
-
).toMatchSnapshot();
|
|
14
|
-
},
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
it.each<Size>(["large", "small"])(
|
|
18
|
-
"should render button with size=%s",
|
|
19
|
-
(size) => {
|
|
20
|
-
expect(
|
|
21
|
-
renderToString(<EvoButton size={size}>Button</EvoButton>),
|
|
22
|
-
).toMatchSnapshot();
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
it.each<Variant>(["standard", "destructive", "form"])(
|
|
27
|
-
"should render button with variant=%s",
|
|
28
|
-
(variant) => {
|
|
29
|
-
expect(
|
|
30
|
-
renderToString(<EvoButton variant={variant}>Button</EvoButton>),
|
|
31
|
-
).toMatchSnapshot();
|
|
32
|
-
},
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
it.each<Split>(["start", "end"])(
|
|
36
|
-
"should render button with split=%s",
|
|
37
|
-
(split) => {
|
|
38
|
-
expect(
|
|
39
|
-
renderToString(
|
|
40
|
-
<EvoButton split={split} priority="primary">
|
|
41
|
-
Button
|
|
42
|
-
</EvoButton>,
|
|
43
|
-
),
|
|
44
|
-
).toMatchSnapshot();
|
|
45
|
-
},
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
it.each<BodyState>(["loading", "expand"])(
|
|
49
|
-
"should render button with bodyState=%s",
|
|
50
|
-
(bodyState) => {
|
|
51
|
-
expect(
|
|
52
|
-
renderToString(<EvoButton bodyState={bodyState}>Button</EvoButton>),
|
|
53
|
-
).toMatchSnapshot();
|
|
54
|
-
},
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
it.each<boolean>([false, true])(
|
|
58
|
-
"should render button with fluid=%s",
|
|
59
|
-
(fluid) => {
|
|
60
|
-
expect(
|
|
61
|
-
renderToString(<EvoButton fluid={fluid}>Button</EvoButton>),
|
|
62
|
-
).toMatchSnapshot();
|
|
63
|
-
},
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
it.each<boolean>([false, true])(
|
|
67
|
-
"should render button with disabled=%s",
|
|
68
|
-
(disabled) => {
|
|
69
|
-
expect(
|
|
70
|
-
renderToString(<EvoButton disabled={disabled}>Button</EvoButton>),
|
|
71
|
-
).toMatchSnapshot();
|
|
72
|
-
},
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
it.each<boolean>([false, true])(
|
|
76
|
-
"should render button with partiallyDisabled=%s",
|
|
77
|
-
(partiallyDisabled) => {
|
|
78
|
-
expect(
|
|
79
|
-
renderToString(
|
|
80
|
-
<EvoButton partiallyDisabled={partiallyDisabled}>Button</EvoButton>,
|
|
81
|
-
),
|
|
82
|
-
).toMatchSnapshot();
|
|
83
|
-
},
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
it.each<boolean>([false, true])(
|
|
87
|
-
"should render button with transparent=%s",
|
|
88
|
-
(transparent) => {
|
|
89
|
-
expect(
|
|
90
|
-
renderToString(<EvoButton transparent={transparent}>Button</EvoButton>),
|
|
91
|
-
).toMatchSnapshot();
|
|
92
|
-
},
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
it.each<boolean>([false, true])(
|
|
96
|
-
"should render button with borderless=%s",
|
|
97
|
-
(borderless) => {
|
|
98
|
-
expect(
|
|
99
|
-
renderToString(<EvoButton borderless={borderless}>Button</EvoButton>),
|
|
100
|
-
).toMatchSnapshot();
|
|
101
|
-
},
|
|
102
|
-
);
|
|
103
|
-
|
|
104
|
-
it.each<boolean>([false, true])(
|
|
105
|
-
"should render button with truncate=%s",
|
|
106
|
-
(truncate) => {
|
|
107
|
-
expect(
|
|
108
|
-
renderToString(<EvoButton truncate={truncate}>Button</EvoButton>),
|
|
109
|
-
).toMatchSnapshot();
|
|
110
|
-
},
|
|
111
|
-
);
|
|
112
|
-
|
|
113
|
-
it.each<boolean>([false, true])(
|
|
114
|
-
"should render button with fixedHeight=%s",
|
|
115
|
-
(fixedHeight) => {
|
|
116
|
-
expect(
|
|
117
|
-
renderToString(<EvoButton fixedHeight={fixedHeight}>Button</EvoButton>),
|
|
118
|
-
).toMatchSnapshot();
|
|
119
|
-
},
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
it("should render defaults", () => {
|
|
123
|
-
expect(
|
|
124
|
-
renderToString(<EvoButton>Default Button</EvoButton>),
|
|
125
|
-
).toMatchSnapshot();
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it("should render with id override", () => {
|
|
129
|
-
expect(
|
|
130
|
-
renderToString(<EvoButton id="test">Button</EvoButton>),
|
|
131
|
-
).toMatchSnapshot();
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it("should render with type override", () => {
|
|
135
|
-
expect(
|
|
136
|
-
renderToString(<EvoButton type="submit">Submit</EvoButton>),
|
|
137
|
-
).toMatchSnapshot();
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
it("should render fake version (anchor)", () => {
|
|
141
|
-
expect(
|
|
142
|
-
renderToString(
|
|
143
|
-
<EvoButton
|
|
144
|
-
href="https://ebay.com"
|
|
145
|
-
size="large"
|
|
146
|
-
priority="primary"
|
|
147
|
-
aria-label="fake button"
|
|
148
|
-
>
|
|
149
|
-
Link Button
|
|
150
|
-
</EvoButton>,
|
|
151
|
-
),
|
|
152
|
-
).toMatchSnapshot();
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it("should render disabled link without href", () => {
|
|
156
|
-
expect(
|
|
157
|
-
renderToString(
|
|
158
|
-
<EvoButton href="https://ebay.com" disabled>
|
|
159
|
-
Disabled Link
|
|
160
|
-
</EvoButton>,
|
|
161
|
-
),
|
|
162
|
-
).toMatchSnapshot();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it("should render large truncated button", () => {
|
|
166
|
-
expect(
|
|
167
|
-
renderToString(
|
|
168
|
-
<EvoButton truncate size="large">
|
|
169
|
-
Large Truncated
|
|
170
|
-
</EvoButton>,
|
|
171
|
-
),
|
|
172
|
-
).toMatchSnapshot();
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it("should render large fixed-height button", () => {
|
|
176
|
-
expect(
|
|
177
|
-
renderToString(
|
|
178
|
-
<EvoButton fixedHeight size="large">
|
|
179
|
-
Large Fixed Height
|
|
180
|
-
</EvoButton>,
|
|
181
|
-
),
|
|
182
|
-
).toMatchSnapshot();
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it("should render form variant with expand", () => {
|
|
186
|
-
expect(
|
|
187
|
-
renderToString(
|
|
188
|
-
<EvoButton variant="form" bodyState="expand">
|
|
189
|
-
Form Expand
|
|
190
|
-
</EvoButton>,
|
|
191
|
-
),
|
|
192
|
-
).toMatchSnapshot();
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it("should render destructive primary large", () => {
|
|
196
|
-
expect(
|
|
197
|
-
renderToString(
|
|
198
|
-
<EvoButton variant="destructive" priority="primary" size="large">
|
|
199
|
-
Delete
|
|
200
|
-
</EvoButton>,
|
|
201
|
-
),
|
|
202
|
-
).toMatchSnapshot();
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it("should render with custom className", () => {
|
|
206
|
-
expect(
|
|
207
|
-
renderToString(<EvoButton className="custom-class">Button</EvoButton>),
|
|
208
|
-
).toMatchSnapshot();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it("should render with aria-label", () => {
|
|
212
|
-
expect(
|
|
213
|
-
renderToString(<EvoButton aria-label="Submit form">Submit</EvoButton>),
|
|
214
|
-
).toMatchSnapshot();
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it("should render with data attributes", () => {
|
|
218
|
-
expect(
|
|
219
|
-
renderToString(<EvoButton data-testid="button">Button</EvoButton>),
|
|
220
|
-
).toMatchSnapshot();
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it("should render with ButtonCell", () => {
|
|
224
|
-
expect(
|
|
225
|
-
renderToString(
|
|
226
|
-
<EvoButton>
|
|
227
|
-
<EvoButtonCell style={{ justifyContent: "space-between" }}>
|
|
228
|
-
<span>Left</span>
|
|
229
|
-
<span>Right</span>
|
|
230
|
-
</EvoButtonCell>
|
|
231
|
-
</EvoButton>,
|
|
232
|
-
),
|
|
233
|
-
).toMatchSnapshot();
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
it("should render combined: primary large fluid", () => {
|
|
237
|
-
expect(
|
|
238
|
-
renderToString(
|
|
239
|
-
<EvoButton priority="primary" size="large" fluid>
|
|
240
|
-
Combined
|
|
241
|
-
</EvoButton>,
|
|
242
|
-
),
|
|
243
|
-
).toMatchSnapshot();
|
|
244
|
-
});
|
|
245
|
-
});
|
package/src/index.ts
DELETED
package/test.setup.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import "vitest-browser-react";
|
|
2
|
-
import "@ebay/skin/dist/tokens/evo-core.css";
|
|
3
|
-
import "@ebay/skin/dist/tokens/evo-light.css";
|
|
4
|
-
import "@ebay/skin/dist/tokens/evo-dark.css";
|
|
5
|
-
import "@ebay/skin/dist/global/global.css";
|
|
6
|
-
import "@ebay/skin/dist/utility/utility.css";
|
|
7
|
-
import "@ebay/skin/marketsans";
|
package/tsconfig.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"jsx": "react-jsx",
|
|
9
|
-
"moduleResolution": "bundler",
|
|
10
|
-
"isolatedModules": true,
|
|
11
|
-
"moduleDetection": "force",
|
|
12
|
-
"declaration": true,
|
|
13
|
-
"outDir": "./dist",
|
|
14
|
-
"strict": true,
|
|
15
|
-
"allowSyntheticDefaultImports": true,
|
|
16
|
-
"noUnusedLocals": true,
|
|
17
|
-
"noUnusedParameters": true,
|
|
18
|
-
"noFallthroughCasesInSwitch": true
|
|
19
|
-
},
|
|
20
|
-
"include": ["./**/*"]
|
|
21
|
-
}
|
package/tsconfig.prod.json
DELETED
package/vite.config.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import react from "@vitejs/plugin-react";
|
|
3
|
-
import { nodeExternals } from "rollup-plugin-node-externals";
|
|
4
|
-
import typescript from "@rollup/plugin-typescript";
|
|
5
|
-
import { playwright } from "@vitest/browser-playwright";
|
|
6
|
-
|
|
7
|
-
const isCI = !!process.env.CI;
|
|
8
|
-
|
|
9
|
-
export default defineConfig({
|
|
10
|
-
plugins: [
|
|
11
|
-
react(),
|
|
12
|
-
nodeExternals({
|
|
13
|
-
// Externalize peer dependencies but bundle makeup-js libraries
|
|
14
|
-
include: [/^makeup-/],
|
|
15
|
-
}),
|
|
16
|
-
],
|
|
17
|
-
build: {
|
|
18
|
-
lib: {
|
|
19
|
-
entry: "./src/index.ts",
|
|
20
|
-
formats: ["es"],
|
|
21
|
-
},
|
|
22
|
-
rollupOptions: {
|
|
23
|
-
output: {
|
|
24
|
-
preserveModules: true,
|
|
25
|
-
preserveModulesRoot: "src",
|
|
26
|
-
entryFileNames: "[name].js",
|
|
27
|
-
banner: `"use client";\n`,
|
|
28
|
-
},
|
|
29
|
-
plugins: [
|
|
30
|
-
typescript({
|
|
31
|
-
// We use a different tsconfig for building so vite doesn't generate types for tests,
|
|
32
|
-
// but we still want to have typescript checking for test files.
|
|
33
|
-
tsconfig: "./tsconfig.prod.json",
|
|
34
|
-
declaration: true,
|
|
35
|
-
declarationMap: true,
|
|
36
|
-
outDir: "./dist",
|
|
37
|
-
}),
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
sourcemap: true,
|
|
41
|
-
minify: false,
|
|
42
|
-
target: "es2020",
|
|
43
|
-
},
|
|
44
|
-
test: {
|
|
45
|
-
globals: true,
|
|
46
|
-
pool: "forks",
|
|
47
|
-
coverage: {
|
|
48
|
-
enabled: isCI,
|
|
49
|
-
provider: "v8",
|
|
50
|
-
reporter: ["json-summary", "html", "cobertura", "lcov"],
|
|
51
|
-
include: ["src/**/*.{ts,tsx}"],
|
|
52
|
-
exclude: [
|
|
53
|
-
"src/**/test/**",
|
|
54
|
-
"src/**/*.stories.tsx",
|
|
55
|
-
"src/**/*.d.ts",
|
|
56
|
-
"src/index.ts",
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
projects: [
|
|
60
|
-
{
|
|
61
|
-
extends: true,
|
|
62
|
-
test: {
|
|
63
|
-
name: "browser",
|
|
64
|
-
setupFiles: ["./test.setup.ts"],
|
|
65
|
-
browser: {
|
|
66
|
-
enabled: true,
|
|
67
|
-
provider: playwright(),
|
|
68
|
-
headless: true,
|
|
69
|
-
instances: [
|
|
70
|
-
{
|
|
71
|
-
browser: "chromium",
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
},
|
|
75
|
-
include: ["src/**/test.browser.{ts,tsx}"],
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
extends: true,
|
|
80
|
-
test: {
|
|
81
|
-
name: "server",
|
|
82
|
-
environment: "node",
|
|
83
|
-
include: ["src/**/test.server.{ts,tsx}"],
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
});
|