@agilant/toga-blox 1.0.5 → 1.0.7
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/.gitattributes +5 -0
- package/README.md +3 -1
- package/package.json +15 -14
- package/src/components/Badge/Badge.stories.tsx +175 -126
- package/src/components/Badge/Badge.test.tsx +20 -29
- package/src/components/Badge/Badge.tsx +44 -57
- package/src/components/Badge/Badge.types.tsx +18 -9
- package/src/components/Badge/badgeClassNames.tsx +40 -19
- package/src/components/Card/templates/HorizontalCardTemplate.tsx +5 -5
- package/src/components/Card/templates/VerticalCardTemplate.tsx +5 -5
- package/src/components/CounterButton/CounterButton.stories.tsx +91 -0
- package/src/components/CounterButton/CounterButton.tsx +100 -0
- package/src/components/CounterButton/CounterButton.types.ts +12 -0
- package/src/components/FormButton/FormButton.stories.tsx +282 -67
- package/src/components/FormButton/FormButton.test.tsx +4 -4
- package/src/components/FormButton/FormButton.tsx +45 -67
- package/src/components/FormButton/FormButton.types.ts +8 -7
- package/src/components/Header/Header.stories.tsx +20 -23
- package/src/components/Header/Header.test.tsx +0 -1
- package/src/components/Hero/Hero.tsx +3 -3
- package/src/components/Icon/Icon.stories.tsx +12 -12
- package/src/components/Icon/Icon.test.tsx +3 -3
- package/src/components/Icon/Icon.tsx +9 -9
- package/src/components/Image/Image.tsx +10 -12
- package/src/components/Image/declarations.d.ts +24 -0
- package/src/components/Input/Input.stories.tsx +116 -253
- package/src/components/Input/Input.test.tsx +4 -4
- package/src/components/Input/Input.tsx +5 -7
- package/src/components/Nav/DUMMYNAVDATA.json +1 -1
- package/src/components/Page/ViewPageTemplate.stories.tsx +77 -80
- package/src/components/Text/Text.stories.tsx +21 -31
- package/src/components/Text/Text.tsx +12 -63
- package/src/components/Text/Text.types.ts +4 -4
package/.gitattributes
ADDED
package/README.md
CHANGED
|
@@ -23,7 +23,9 @@ Install Docker from Docker's official website.
|
|
|
23
23
|
|
|
24
24
|
Once Docker is installed, use the following commands to manage the Docker containers:
|
|
25
25
|
|
|
26
|
-
build the Docker images: docker-compose build
|
|
26
|
+
build the Docker images: docker-compose build --no-cache
|
|
27
|
+
|
|
28
|
+
install the required packages using the docker: docker-compose run --rm ui npm install
|
|
27
29
|
|
|
28
30
|
To start the services: docker-compose up
|
|
29
31
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agilant/toga-blox",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.7",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -17,22 +17,23 @@
|
|
|
17
17
|
"author": "",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"
|
|
20
|
+
"@emotion/is-prop-valid": "^1.1.3",
|
|
21
21
|
"@storybook/addon-docs": "^7.6.6",
|
|
22
22
|
"@storybook/addon-viewport": "^7.6.10",
|
|
23
|
+
"@tanstack/react-virtual": "^3.1.3",
|
|
24
|
+
"@tanstack/virtual-core": "^3.1.3",
|
|
23
25
|
"classnames": "^2.5.1",
|
|
26
|
+
"daisyui": "^3",
|
|
27
|
+
"esbuild-wasm": "^0.23.0",
|
|
28
|
+
"framer-motion": "^11.0.8",
|
|
24
29
|
"react": "^18.2.0",
|
|
25
30
|
"react-dom": "^18.2.0",
|
|
26
|
-
"
|
|
27
|
-
"tslib": "^2.3.0",
|
|
28
|
-
"@emotion/is-prop-valid": "^1.1.3",
|
|
29
|
-
"@tanstack/virtual-core": "^3.1.3",
|
|
30
|
-
"@tanstack/react-virtual": "^3.1.3"
|
|
31
|
+
"tslib": "^2.3.0"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@fortawesome/fontawesome-svg-core": "^6.5.1",
|
|
34
|
-
"@fortawesome/free-solid-svg-icons": "^6.5.
|
|
35
|
-
"@fortawesome/react-fontawesome": "^0.2.
|
|
35
|
+
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
|
36
|
+
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
36
37
|
"@storybook/addon-a11y": "^7.6.8",
|
|
37
38
|
"@storybook/addon-essentials": "^7.6.6",
|
|
38
39
|
"@storybook/addon-interactions": "^7.6.6",
|
|
@@ -42,8 +43,8 @@
|
|
|
42
43
|
"@storybook/react": "^7.6.6",
|
|
43
44
|
"@storybook/react-vite": "^7.6.6",
|
|
44
45
|
"@storybook/test": "^7.6.6",
|
|
45
|
-
"@testing-library/jest-dom": "^6.
|
|
46
|
-
"@testing-library/react": "^14.1
|
|
46
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
47
|
+
"@testing-library/react": "^14.3.1",
|
|
47
48
|
"@testing-library/user-event": "^14.5.2",
|
|
48
49
|
"@types/react-router-dom": "^5.3.3",
|
|
49
50
|
"@vitejs/plugin-react": "^4.2.1",
|
|
@@ -59,12 +60,12 @@
|
|
|
59
60
|
"typescript": "^5.3.3",
|
|
60
61
|
"vite": "^4.5.1",
|
|
61
62
|
"vite-tsconfig-paths": "^4.2.2",
|
|
62
|
-
"vitest": "^1.
|
|
63
|
+
"vitest": "^1.6.0"
|
|
63
64
|
},
|
|
64
65
|
"peerDependencies": {
|
|
65
66
|
"@fortawesome/fontawesome-svg-core": "^1.2.35",
|
|
66
|
-
"@fortawesome/free-solid-svg-icons": "^5.
|
|
67
|
-
"@fortawesome/react-fontawesome": "^0.
|
|
67
|
+
"@fortawesome/free-solid-svg-icons": "^6.5.2",
|
|
68
|
+
"@fortawesome/react-fontawesome": "^0.2.2",
|
|
68
69
|
"react-router-dom": "^5.2.0"
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -2,7 +2,6 @@ import { Meta, StoryFn } from "@storybook/react";
|
|
|
2
2
|
import Text from "../Text/Text";
|
|
3
3
|
import Badge from "./Badge";
|
|
4
4
|
import { BadgeTypes } from "./Badge.types";
|
|
5
|
-
import Image from "../Image/Image";
|
|
6
5
|
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
7
6
|
|
|
8
7
|
export default {
|
|
@@ -10,12 +9,35 @@ export default {
|
|
|
10
9
|
component: Badge,
|
|
11
10
|
argTypes: {
|
|
12
11
|
badgeSize: {
|
|
13
|
-
control: "
|
|
12
|
+
control: "none",
|
|
14
13
|
options: ["small", "medium", "large"],
|
|
15
|
-
|
|
14
|
+
table: {
|
|
15
|
+
disable: true,
|
|
16
|
+
},
|
|
17
|
+
description:
|
|
18
|
+
"The size of the badge (small, medium, or large). *Storybook prop only.",
|
|
19
|
+
},
|
|
20
|
+
width: {
|
|
21
|
+
control: "none",
|
|
22
|
+
table: {
|
|
23
|
+
disable: true,
|
|
24
|
+
},
|
|
25
|
+
description:
|
|
26
|
+
"Custom width for the badge. Use Tailwind CSS width classes.",
|
|
27
|
+
},
|
|
28
|
+
height: {
|
|
29
|
+
control: "none",
|
|
30
|
+
table: {
|
|
31
|
+
disable: true,
|
|
32
|
+
},
|
|
33
|
+
description:
|
|
34
|
+
"Custom height for the badge. Use Tailwind CSS height classes.",
|
|
16
35
|
},
|
|
17
36
|
color: {
|
|
18
|
-
control: "
|
|
37
|
+
control: "none",
|
|
38
|
+
table: {
|
|
39
|
+
disable: true,
|
|
40
|
+
},
|
|
19
41
|
options: [
|
|
20
42
|
"red",
|
|
21
43
|
"blue",
|
|
@@ -26,10 +48,11 @@ export default {
|
|
|
26
48
|
"purple",
|
|
27
49
|
"none",
|
|
28
50
|
],
|
|
29
|
-
description:
|
|
51
|
+
description:
|
|
52
|
+
"The background color of the badge. Use Tailwind CSS color classes. *Storybook prop only.",
|
|
30
53
|
},
|
|
31
54
|
borderColor: {
|
|
32
|
-
control: "
|
|
55
|
+
control: "none",
|
|
33
56
|
options: [
|
|
34
57
|
"red",
|
|
35
58
|
"blue",
|
|
@@ -39,20 +62,25 @@ export default {
|
|
|
39
62
|
"purple",
|
|
40
63
|
"none",
|
|
41
64
|
],
|
|
42
|
-
description:
|
|
65
|
+
description:
|
|
66
|
+
"The color of the badge's border. Use Tailwind CSS color classes.",
|
|
43
67
|
},
|
|
44
68
|
fontColor: {
|
|
45
|
-
control: "
|
|
46
|
-
|
|
47
|
-
|
|
69
|
+
control: "none",
|
|
70
|
+
table: {
|
|
71
|
+
disable: true,
|
|
72
|
+
},
|
|
73
|
+
description:
|
|
74
|
+
"The text color on the badge. Use Tailwind CSS color classes. *Storybook prop only.",
|
|
48
75
|
},
|
|
49
76
|
hoverColor: {
|
|
50
|
-
control: "
|
|
77
|
+
control: "none",
|
|
51
78
|
options: ["red", "green", "blue", "orange", "purple", "none"],
|
|
52
|
-
description:
|
|
79
|
+
description:
|
|
80
|
+
"The background color of the badge when hovered. Use Tailwind CSS color classes.",
|
|
53
81
|
},
|
|
54
82
|
cursorPointer: {
|
|
55
|
-
control: "
|
|
83
|
+
control: "none",
|
|
56
84
|
description: "Whether the badge should have a pointer cursor.",
|
|
57
85
|
},
|
|
58
86
|
image: {
|
|
@@ -61,15 +89,6 @@ export default {
|
|
|
61
89
|
},
|
|
62
90
|
description: "The image to display in the badge.",
|
|
63
91
|
},
|
|
64
|
-
tagStyle: {
|
|
65
|
-
control: "boolean",
|
|
66
|
-
description: "Whether the badge is a tag style.",
|
|
67
|
-
},
|
|
68
|
-
tagStyleIconColor: {
|
|
69
|
-
control: "select",
|
|
70
|
-
options: ["red", "blue", "green", "orange", "purple", "black"],
|
|
71
|
-
description: "The color of the icon for tag style.",
|
|
72
|
-
},
|
|
73
92
|
to: {
|
|
74
93
|
table: {
|
|
75
94
|
disable: true,
|
|
@@ -80,24 +99,27 @@ export default {
|
|
|
80
99
|
table: {
|
|
81
100
|
disable: true,
|
|
82
101
|
},
|
|
83
|
-
description: "The text to display
|
|
102
|
+
description: "The text to display inside the badge.",
|
|
84
103
|
},
|
|
85
104
|
hasMobileStyle: {
|
|
86
|
-
control: "
|
|
87
|
-
description:
|
|
105
|
+
control: "none",
|
|
106
|
+
description:
|
|
107
|
+
"Whether the badge uses responsive styles for mobile view.",
|
|
88
108
|
},
|
|
89
|
-
|
|
90
109
|
mobileIcon: {
|
|
91
110
|
table: {
|
|
92
111
|
disable: true,
|
|
93
112
|
},
|
|
113
|
+
control: "none",
|
|
94
114
|
description:
|
|
95
|
-
"The icon to display in the badge when on mobile
|
|
115
|
+
"The icon to display in the badge when viewed on mobile.",
|
|
96
116
|
},
|
|
97
117
|
mobileIconLabel: {
|
|
98
118
|
table: {
|
|
99
119
|
disable: true,
|
|
100
120
|
},
|
|
121
|
+
control: "none",
|
|
122
|
+
description: "Aria-label for the mobile icon.",
|
|
101
123
|
},
|
|
102
124
|
href: {
|
|
103
125
|
table: {
|
|
@@ -113,6 +135,7 @@ export default {
|
|
|
113
135
|
table: {
|
|
114
136
|
disable: true,
|
|
115
137
|
},
|
|
138
|
+
description: "The icon to display in the badge.",
|
|
116
139
|
},
|
|
117
140
|
as: {
|
|
118
141
|
table: {
|
|
@@ -128,12 +151,87 @@ export default {
|
|
|
128
151
|
table: {
|
|
129
152
|
disable: true,
|
|
130
153
|
},
|
|
154
|
+
description: "Test ID for the badge component.",
|
|
131
155
|
},
|
|
132
156
|
onClick: {
|
|
133
157
|
table: {
|
|
134
158
|
disable: true,
|
|
135
159
|
},
|
|
136
160
|
},
|
|
161
|
+
textSize: {
|
|
162
|
+
control: "none",
|
|
163
|
+
options: [
|
|
164
|
+
"text-xs",
|
|
165
|
+
"text-sm",
|
|
166
|
+
"text-base",
|
|
167
|
+
"text-lg",
|
|
168
|
+
"text-xl",
|
|
169
|
+
"text-2xl",
|
|
170
|
+
"text-3xl",
|
|
171
|
+
"text-4xl",
|
|
172
|
+
"text-5xl",
|
|
173
|
+
"text-6xl",
|
|
174
|
+
],
|
|
175
|
+
table: {
|
|
176
|
+
disable: true,
|
|
177
|
+
},
|
|
178
|
+
description:
|
|
179
|
+
"The size of the text inside the badge. Use Tailwind CSS text size classes.",
|
|
180
|
+
},
|
|
181
|
+
borderWidth: {
|
|
182
|
+
control: "none",
|
|
183
|
+
description:
|
|
184
|
+
"The width of the badge's border. Use Tailwind CSS width classes.",
|
|
185
|
+
},
|
|
186
|
+
borderHoverColor: {
|
|
187
|
+
control: "none",
|
|
188
|
+
description:
|
|
189
|
+
"The border color of the badge when hovered. Use Tailwind CSS color classes.",
|
|
190
|
+
},
|
|
191
|
+
iconSize: {
|
|
192
|
+
control: "none",
|
|
193
|
+
description:
|
|
194
|
+
"The size of the icon inside the badge. Use Tailwind CSS size classes.",
|
|
195
|
+
},
|
|
196
|
+
hasLeftIcon: {
|
|
197
|
+
control: "none",
|
|
198
|
+
description:
|
|
199
|
+
"Whether the badge should display an icon on the left side.",
|
|
200
|
+
},
|
|
201
|
+
hasRightIcon: {
|
|
202
|
+
control: "none",
|
|
203
|
+
description:
|
|
204
|
+
"Whether the badge should display an icon on the right side.",
|
|
205
|
+
},
|
|
206
|
+
style: {
|
|
207
|
+
table: {
|
|
208
|
+
disable: true,
|
|
209
|
+
},
|
|
210
|
+
control: "none",
|
|
211
|
+
description: "Custom inline styles for the badge component.",
|
|
212
|
+
},
|
|
213
|
+
badgeContainerClasses: {
|
|
214
|
+
control: "none",
|
|
215
|
+
description:
|
|
216
|
+
"Additional classes for the badge container for custom styling. Provide a string with Tailwind CSS classes.",
|
|
217
|
+
},
|
|
218
|
+
backgroundColor: {
|
|
219
|
+
control: "none",
|
|
220
|
+
description:
|
|
221
|
+
"The background color of the badge. Use Tailwind CSS color classes.",
|
|
222
|
+
},
|
|
223
|
+
borderRadius: {
|
|
224
|
+
control: "none",
|
|
225
|
+
description:
|
|
226
|
+
"The border radius of the badge. Use Tailwind CSS border radius classes.",
|
|
227
|
+
},
|
|
228
|
+
iconOrder: {
|
|
229
|
+
control: "none",
|
|
230
|
+
table: {
|
|
231
|
+
disable: true,
|
|
232
|
+
},
|
|
233
|
+
description: "The order of the icon in the badge.",
|
|
234
|
+
},
|
|
137
235
|
},
|
|
138
236
|
tags: ["autodocs"],
|
|
139
237
|
parameters: {
|
|
@@ -146,139 +244,90 @@ const Template: StoryFn<BadgeTypes> = (args) => <Badge {...args} />;
|
|
|
146
244
|
export const Default = Template.bind({});
|
|
147
245
|
Default.args = {
|
|
148
246
|
type: "span",
|
|
149
|
-
color: "red",
|
|
150
|
-
borderColor: "red",
|
|
151
|
-
hoverColor: "none",
|
|
152
|
-
badgeSize: "large",
|
|
153
247
|
cursorPointer: false,
|
|
154
|
-
tagStyle: false,
|
|
155
248
|
hasMobileStyle: true,
|
|
156
|
-
|
|
157
|
-
mobileIconLabel: "
|
|
158
|
-
|
|
249
|
+
backgroundColor: "bg-[#DBEAFE]",
|
|
250
|
+
mobileIconLabel: "Default Badge",
|
|
251
|
+
borderColor: "",
|
|
252
|
+
borderRadius: "rounded",
|
|
253
|
+
badgeContainerClasses: "px-3 py-1",
|
|
159
254
|
text: (
|
|
160
255
|
<Text
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
text="Priority"
|
|
256
|
+
color="text-black"
|
|
257
|
+
fontFamily="font-serif"
|
|
258
|
+
text="Required"
|
|
165
259
|
tag="p"
|
|
166
260
|
additionalClasses="font-bold"
|
|
261
|
+
size="text-sm"
|
|
167
262
|
/>
|
|
168
263
|
),
|
|
169
264
|
};
|
|
170
265
|
|
|
171
|
-
export const
|
|
172
|
-
|
|
266
|
+
export const BadgeWithLeftIcon = Template.bind({});
|
|
267
|
+
BadgeWithLeftIcon.args = {
|
|
173
268
|
type: "span",
|
|
174
|
-
color: "purple",
|
|
175
|
-
borderColor: "purple",
|
|
176
|
-
hoverColor: "none",
|
|
177
|
-
badgeSize: "large",
|
|
178
269
|
cursorPointer: false,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
270
|
+
hasMobileStyle: true,
|
|
271
|
+
mobileIconLabel: "Complete",
|
|
272
|
+
backgroundColor: "bg-[#DAF8E6]",
|
|
273
|
+
borderRadius: "rounded",
|
|
274
|
+
badgeContainerClasses: "px-3 py-[3px]",
|
|
275
|
+
mobileIcon: getFontAwesomeIcon("check"),
|
|
184
276
|
text: (
|
|
185
277
|
<Text
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
text="Processing"
|
|
278
|
+
color="text-black"
|
|
279
|
+
fontFamily="font-serif"
|
|
280
|
+
text="Complete"
|
|
190
281
|
tag="p"
|
|
191
|
-
|
|
282
|
+
size="text-sm"
|
|
192
283
|
/>
|
|
193
284
|
),
|
|
285
|
+
icon: getFontAwesomeIcon("check"),
|
|
286
|
+
hasLeftIcon: true,
|
|
287
|
+
iconSize: "text-sm pr-2",
|
|
194
288
|
};
|
|
195
289
|
|
|
196
|
-
export const
|
|
197
|
-
|
|
290
|
+
export const BadgeWithRightIcon = Template.bind({});
|
|
291
|
+
BadgeWithRightIcon.args = {
|
|
198
292
|
type: "span",
|
|
199
|
-
color: "green",
|
|
200
|
-
hoverColor: "none",
|
|
201
|
-
borderColor: "green",
|
|
202
|
-
badgeSize: "large",
|
|
203
293
|
cursorPointer: false,
|
|
204
|
-
tagStyle: false,
|
|
205
294
|
hasMobileStyle: true,
|
|
295
|
+
mobileIconLabel: "Incomplete",
|
|
296
|
+
backgroundColor: "bg-red-100",
|
|
297
|
+
borderRadius: "rounded",
|
|
298
|
+
badgeContainerClasses: "px-3 py-[3px]",
|
|
206
299
|
mobileIcon: getFontAwesomeIcon("check"),
|
|
207
|
-
mobileIconLabel: "Complete",
|
|
208
300
|
text: (
|
|
209
301
|
<Text
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
text="Complete"
|
|
302
|
+
color="text-black"
|
|
303
|
+
fontFamily="font-serif"
|
|
304
|
+
text="Incomplete"
|
|
214
305
|
tag="p"
|
|
306
|
+
size="text-sm"
|
|
215
307
|
/>
|
|
216
308
|
),
|
|
217
|
-
icon: getFontAwesomeIcon("
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
export const PillStyle = Template.bind({});
|
|
221
|
-
PillStyle.args = {
|
|
222
|
-
type: "href",
|
|
223
|
-
href: "#",
|
|
224
|
-
color: "blue",
|
|
225
|
-
hoverColor: "blue",
|
|
226
|
-
borderColor: "none",
|
|
227
|
-
tagStyle: false,
|
|
228
|
-
hasMobileStyle: true,
|
|
229
|
-
mobileIcon: getFontAwesomeIcon("phone"),
|
|
230
|
-
mobileIconLabel: "Contact Us",
|
|
231
|
-
text: (
|
|
232
|
-
<>
|
|
233
|
-
<Text
|
|
234
|
-
size="md"
|
|
235
|
-
color="primary"
|
|
236
|
-
fontFamily="serif"
|
|
237
|
-
text="Contact Us"
|
|
238
|
-
tag="h2"
|
|
239
|
-
additionalClasses="pl-2 pb-0 font-bold"
|
|
240
|
-
/>
|
|
241
|
-
<Text
|
|
242
|
-
size="md"
|
|
243
|
-
color="primary"
|
|
244
|
-
fontFamily="serif"
|
|
245
|
-
text="1-800-800-8000"
|
|
246
|
-
tag="p"
|
|
247
|
-
additionalClasses="pl-2 pt-0"
|
|
248
|
-
/>
|
|
249
|
-
</>
|
|
250
|
-
),
|
|
251
|
-
image: (
|
|
252
|
-
<Image
|
|
253
|
-
src="../../../assets/contact-image.png"
|
|
254
|
-
alt=""
|
|
255
|
-
background={false}
|
|
256
|
-
additionalClasses="flex justify-center w-12 h-12 max-md:hidden"
|
|
257
|
-
/>
|
|
258
|
-
),
|
|
309
|
+
icon: getFontAwesomeIcon("Xmark"),
|
|
310
|
+
hasRightIcon: true,
|
|
311
|
+
iconSize: "text-sm pl-2",
|
|
259
312
|
};
|
|
260
313
|
|
|
261
|
-
export const
|
|
262
|
-
|
|
263
|
-
type: "span",
|
|
264
|
-
color: "white",
|
|
265
|
-
hoverColor: "none",
|
|
266
|
-
borderColor: "red",
|
|
267
|
-
badgeSize: "large",
|
|
268
|
-
tagStyle: true,
|
|
269
|
-
tagStyleIconColor: "red",
|
|
314
|
+
export const CommerceBadge = Template.bind({});
|
|
315
|
+
CommerceBadge.args = {
|
|
270
316
|
cursorPointer: false,
|
|
271
|
-
hasMobileStyle:
|
|
272
|
-
|
|
273
|
-
|
|
317
|
+
hasMobileStyle: false,
|
|
318
|
+
mobileIconLabel: "Commerce Badge",
|
|
319
|
+
backgroundColor: "bg-[#DAF8E6]",
|
|
320
|
+
borderColor: "",
|
|
321
|
+
|
|
322
|
+
borderRadius: "rounded",
|
|
274
323
|
text: (
|
|
275
324
|
<Text
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
text="Damaged"
|
|
325
|
+
color="text-black"
|
|
326
|
+
fontFamily="font-serif"
|
|
327
|
+
text="In Stock"
|
|
280
328
|
tag="p"
|
|
329
|
+
size="text-sm"
|
|
281
330
|
/>
|
|
282
331
|
),
|
|
283
|
-
|
|
332
|
+
badgeContainerClasses: "px-3 py-[3px]",
|
|
284
333
|
};
|
|
@@ -23,10 +23,10 @@ describe("<Badge />", () => {
|
|
|
23
23
|
mobileIconLabel="Priority"
|
|
24
24
|
text={
|
|
25
25
|
<Text
|
|
26
|
-
size="md"
|
|
27
|
-
color="black"
|
|
26
|
+
size="text-md"
|
|
27
|
+
color="text-black"
|
|
28
28
|
text="Priority"
|
|
29
|
-
fontFamily="serif"
|
|
29
|
+
fontFamily="font-serif"
|
|
30
30
|
tag="h2"
|
|
31
31
|
additionalClasses="font-bold"
|
|
32
32
|
/>
|
|
@@ -46,14 +46,13 @@ describe("<Badge />", () => {
|
|
|
46
46
|
|
|
47
47
|
test("has correct background color", () => {
|
|
48
48
|
const badge = screen.getByTestId("priority-badge");
|
|
49
|
-
expect(badge).toHaveClass("bg-red
|
|
49
|
+
expect(badge).toHaveClass("bg-red");
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
test("has correct border color", () => {
|
|
53
53
|
const badge = screen.getByTestId("priority-badge");
|
|
54
|
-
expect(badge).toHaveClass("border-red
|
|
54
|
+
expect(badge).toHaveClass("border-red");
|
|
55
55
|
});
|
|
56
|
-
|
|
57
56
|
});
|
|
58
57
|
|
|
59
58
|
describe("<Badge /> with icon", () => {
|
|
@@ -66,17 +65,16 @@ describe("<Badge /> with icon", () => {
|
|
|
66
65
|
hoverColor="none"
|
|
67
66
|
badgeSize="large"
|
|
68
67
|
testId="icon-badge"
|
|
69
|
-
tagStyle={false}
|
|
70
68
|
cursorPointer={false}
|
|
71
69
|
icon={<FontAwesomeIcon icon={faCheck} />}
|
|
72
70
|
mobileIcon={<FontAwesomeIcon icon={faCheck} />}
|
|
73
71
|
mobileIconLabel="Complete"
|
|
74
72
|
text={
|
|
75
73
|
<Text
|
|
76
|
-
size="md"
|
|
77
|
-
color="black"
|
|
74
|
+
size="text-md"
|
|
75
|
+
color="text-black"
|
|
78
76
|
text="Complete"
|
|
79
|
-
fontFamily="serif"
|
|
77
|
+
fontFamily="font-serif"
|
|
80
78
|
tag="h2"
|
|
81
79
|
additionalClasses="font-bold"
|
|
82
80
|
/>
|
|
@@ -96,19 +94,18 @@ describe("<Badge /> with icon", () => {
|
|
|
96
94
|
|
|
97
95
|
test("has correct background color", () => {
|
|
98
96
|
const badge = screen.getByTestId("icon-badge");
|
|
99
|
-
expect(badge).toHaveClass("bg-
|
|
97
|
+
expect(badge).toHaveClass("bg-green");
|
|
100
98
|
});
|
|
101
99
|
|
|
102
100
|
test("has correct border color", () => {
|
|
103
101
|
const badge = screen.getByTestId("icon-badge");
|
|
104
|
-
expect(badge).toHaveClass("border-
|
|
102
|
+
expect(badge).toHaveClass("border-green");
|
|
105
103
|
});
|
|
106
104
|
|
|
107
105
|
test("has correct icon", () => {
|
|
108
106
|
const icon = screen.getByTestId("badge-icon");
|
|
109
107
|
expect(icon).toBeInTheDocument();
|
|
110
108
|
});
|
|
111
|
-
|
|
112
109
|
});
|
|
113
110
|
|
|
114
111
|
describe("<Badge /> with pill style", () => {
|
|
@@ -116,12 +113,11 @@ describe("<Badge /> with pill style", () => {
|
|
|
116
113
|
render(
|
|
117
114
|
<Badge
|
|
118
115
|
type="href"
|
|
119
|
-
|
|
116
|
+
href="#"
|
|
120
117
|
color="blue"
|
|
121
118
|
borderColor="none"
|
|
122
119
|
hoverColor="blue"
|
|
123
120
|
testId="pill-badge"
|
|
124
|
-
tagStyle={false}
|
|
125
121
|
cursorPointer={false}
|
|
126
122
|
icon={<FontAwesomeIcon icon={faCheck} />}
|
|
127
123
|
mobileIcon={<FontAwesomeIcon icon={faCheck} />}
|
|
@@ -129,17 +125,17 @@ describe("<Badge /> with pill style", () => {
|
|
|
129
125
|
text={
|
|
130
126
|
<>
|
|
131
127
|
<Text
|
|
132
|
-
size="md"
|
|
133
|
-
color="
|
|
134
|
-
fontFamily="serif"
|
|
128
|
+
size="text-md"
|
|
129
|
+
color="text-black"
|
|
130
|
+
fontFamily="font-serif"
|
|
135
131
|
text="Contact Us"
|
|
136
132
|
tag="h2"
|
|
137
133
|
additionalClasses="pl-2 pb-0 font-bold"
|
|
138
134
|
/>
|
|
139
135
|
<Text
|
|
140
|
-
size="md"
|
|
141
|
-
color="
|
|
142
|
-
fontFamily="serif"
|
|
136
|
+
size="text-md"
|
|
137
|
+
color="text-black"
|
|
138
|
+
fontFamily="font-serif"
|
|
143
139
|
text="1-800-800-8000"
|
|
144
140
|
tag="p"
|
|
145
141
|
additionalClasses="pl-2 pt-0"
|
|
@@ -165,21 +161,16 @@ describe("<Badge /> with pill style", () => {
|
|
|
165
161
|
|
|
166
162
|
test("has correct text", () => {
|
|
167
163
|
expect(screen.getByTestId("badge-text")).toHaveTextContent("Contact Us");
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
test("has correct text", () => {
|
|
171
|
-
expect(screen.getByTestId("badge-text")).toHaveTextContent(
|
|
172
|
-
"1-800-800-8000"
|
|
173
|
-
);
|
|
164
|
+
expect(screen.getByTestId("badge-text")).toHaveTextContent("1-800-800-8000");
|
|
174
165
|
});
|
|
175
166
|
|
|
176
167
|
test("has correct background color", () => {
|
|
177
168
|
const pill = screen.getByTestId("pill-badge");
|
|
178
|
-
expect(pill).toHaveClass("bg-blue
|
|
169
|
+
expect(pill).toHaveClass("bg-blue");
|
|
179
170
|
});
|
|
180
171
|
|
|
181
172
|
test("has correct image", () => {
|
|
182
|
-
const pillImage = screen.
|
|
173
|
+
const pillImage = screen.getByAltText("");
|
|
183
174
|
expect(pillImage).toBeInTheDocument();
|
|
184
175
|
});
|
|
185
176
|
});
|