@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.
Files changed (33) hide show
  1. package/.gitattributes +5 -0
  2. package/README.md +3 -1
  3. package/package.json +15 -14
  4. package/src/components/Badge/Badge.stories.tsx +175 -126
  5. package/src/components/Badge/Badge.test.tsx +20 -29
  6. package/src/components/Badge/Badge.tsx +44 -57
  7. package/src/components/Badge/Badge.types.tsx +18 -9
  8. package/src/components/Badge/badgeClassNames.tsx +40 -19
  9. package/src/components/Card/templates/HorizontalCardTemplate.tsx +5 -5
  10. package/src/components/Card/templates/VerticalCardTemplate.tsx +5 -5
  11. package/src/components/CounterButton/CounterButton.stories.tsx +91 -0
  12. package/src/components/CounterButton/CounterButton.tsx +100 -0
  13. package/src/components/CounterButton/CounterButton.types.ts +12 -0
  14. package/src/components/FormButton/FormButton.stories.tsx +282 -67
  15. package/src/components/FormButton/FormButton.test.tsx +4 -4
  16. package/src/components/FormButton/FormButton.tsx +45 -67
  17. package/src/components/FormButton/FormButton.types.ts +8 -7
  18. package/src/components/Header/Header.stories.tsx +20 -23
  19. package/src/components/Header/Header.test.tsx +0 -1
  20. package/src/components/Hero/Hero.tsx +3 -3
  21. package/src/components/Icon/Icon.stories.tsx +12 -12
  22. package/src/components/Icon/Icon.test.tsx +3 -3
  23. package/src/components/Icon/Icon.tsx +9 -9
  24. package/src/components/Image/Image.tsx +10 -12
  25. package/src/components/Image/declarations.d.ts +24 -0
  26. package/src/components/Input/Input.stories.tsx +116 -253
  27. package/src/components/Input/Input.test.tsx +4 -4
  28. package/src/components/Input/Input.tsx +5 -7
  29. package/src/components/Nav/DUMMYNAVDATA.json +1 -1
  30. package/src/components/Page/ViewPageTemplate.stories.tsx +77 -80
  31. package/src/components/Text/Text.stories.tsx +21 -31
  32. package/src/components/Text/Text.tsx +12 -63
  33. package/src/components/Text/Text.types.ts +4 -4
@@ -156,7 +156,6 @@ Default.args = {
156
156
  to="#"
157
157
  hoverColor="blue"
158
158
  borderColor="none"
159
- tagStyle={false}
160
159
  mobileIcon={<FontAwesomeIcon icon={faSquarePhone} />}
161
160
  mobileIconLabel="Contact Us"
162
161
  onClick={() => alert("Redirect to Contact Us page")}
@@ -171,17 +170,17 @@ Default.args = {
171
170
  text={
172
171
  <>
173
172
  <Text
174
- size="sm"
175
- color="primary"
176
- fontFamily="serif"
173
+ size="text-sm"
174
+ color="text-black"
175
+ fontFamily="font-serif"
177
176
  text="Contact Us"
178
177
  tag="h2"
179
178
  additionalClasses="pl-2 pb-0 font-bold"
180
179
  />
181
180
  <Text
182
- size="xs"
183
- color="primary"
184
- fontFamily="serif"
181
+ size="text-xs"
182
+ color="text-black"
183
+ fontFamily="font-serif"
185
184
  text="1-800-800-8000"
186
185
  tag="p"
187
186
  additionalClasses="pl-2 pt-0"
@@ -227,7 +226,7 @@ Default.args = {
227
226
  button={
228
227
  <FormButton
229
228
  icon={getFontAwesomeIcon("search")}
230
- color="blue"
229
+ backgroundColor="blue"
231
230
  fontColor="white"
232
231
  hoverBackground="black"
233
232
  hoverFontColor="white"
@@ -321,7 +320,6 @@ Compass.args = {
321
320
  color="green"
322
321
  hoverColor="green"
323
322
  borderColor="none"
324
- tagStyle={false}
325
323
  mobileIcon={<FontAwesomeIcon icon={faSquarePhone} />}
326
324
  mobileIconLabel="Contact Us"
327
325
  onClick={() => alert("Redirect to Contact Us page")}
@@ -336,17 +334,17 @@ Compass.args = {
336
334
  text={
337
335
  <>
338
336
  <Text
339
- size="sm"
340
- color="primary"
341
- fontFamily="serif"
337
+ size="text-sm"
338
+ color="text-teal-700"
339
+ fontFamily="font-serif"
342
340
  text="Contact Us"
343
341
  tag="h2"
344
342
  additionalClasses="pl-2 pb-0 font-bold"
345
343
  />
346
344
  <Text
347
- size="xs"
348
- color="primary"
349
- fontFamily="serif"
345
+ size="text-xs"
346
+ color="text-teal-700"
347
+ fontFamily="font-serif"
350
348
  text="1-800-800-8000"
351
349
  tag="p"
352
350
  additionalClasses="pl-2 pt-0"
@@ -401,7 +399,7 @@ Compass.args = {
401
399
  button={
402
400
  <FormButton
403
401
  icon={getFontAwesomeIcon("search")}
404
- color="green"
402
+ backgroundColor="green"
405
403
  hoverBackground="black"
406
404
  hoverFontColor="white"
407
405
  additionalClasses="h-full w-8 justify-center"
@@ -453,7 +451,6 @@ NoSearchOrBadge.args = {
453
451
  color="green"
454
452
  hoverColor="green"
455
453
  borderColor="none"
456
- tagStyle={false}
457
454
  mobileIcon={<FontAwesomeIcon icon={faSquarePhone} />}
458
455
  mobileIconLabel="Contact Us"
459
456
  onClick={() => alert("Redirect to Contact Us page")}
@@ -468,17 +465,17 @@ NoSearchOrBadge.args = {
468
465
  text={
469
466
  <>
470
467
  <Text
471
- size="sm"
472
- color="primary"
473
- fontFamily="serif"
468
+ size="text-sm"
469
+ color="text-black"
470
+ fontFamily="font-serif"
474
471
  text="Contact Us"
475
472
  tag="h2"
476
473
  additionalClasses="pl-2 pb-0 font-bold"
477
474
  />
478
475
  <Text
479
- size="xs"
480
- color="primary"
481
- fontFamily="serif"
476
+ size="text-xs"
477
+ color="text-black"
478
+ fontFamily="font-serif"
482
479
  text="1-800-800-8000"
483
480
  tag="p"
484
481
  additionalClasses="pl-2 pt-0"
@@ -53,7 +53,6 @@ describe("<Header /> with all props (badge, icons, input, logo)", () => {
53
53
  color="green"
54
54
  hoverColor="green"
55
55
  borderColor="none"
56
- tagStyle={false}
57
56
  mobileIcon={getFontAwesomeIcon("phone")}
58
57
  mobileIconLabel="Contact Us"
59
58
  onClick={() => alert("Redirect to Contact Us page")}
@@ -18,9 +18,9 @@ const Hero: React.FC<HeroTypes> = ({
18
18
  src = "../../../assets/heroImage.png",
19
19
  text = (
20
20
  <Text
21
- size="xl"
22
- color="white"
23
- fontFamily="serif"
21
+ size="text-xl"
22
+ color="text-white"
23
+ fontFamily="font-serif"
24
24
  text="This is a test heading!"
25
25
  tag="h1"
26
26
  />
@@ -129,9 +129,9 @@ Profile.args = {
129
129
  indicatorNumber: "0",
130
130
  text: (
131
131
  <Text
132
- size="md"
133
- color="primary"
134
- fontFamily="serif"
132
+ size="text-md"
133
+ color="text-black"
134
+ fontFamily="font-serif"
135
135
  text="Profile"
136
136
  tag="h2"
137
137
  additionalClasses="p-0"
@@ -154,9 +154,9 @@ Support.args = {
154
154
  indicatorSize: "lg",
155
155
  text: (
156
156
  <Text
157
- size="md"
158
- color="primary"
159
- fontFamily="serif"
157
+ size="text-md"
158
+ color="text-black"
159
+ fontFamily="font-serif"
160
160
  text="Support"
161
161
  tag="h2"
162
162
  additionalClasses="p-0"
@@ -178,9 +178,9 @@ Messages.args = {
178
178
  indicatorSize: "sm",
179
179
  text: (
180
180
  <Text
181
- size="md"
182
- color="primary"
183
- fontFamily="serif"
181
+ size="text-md"
182
+ color="text-black"
183
+ fontFamily="font-serif"
184
184
  text="Messages"
185
185
  tag="h2"
186
186
  additionalClasses="p-0"
@@ -201,9 +201,9 @@ Cart.args = {
201
201
  indicatorSize: "lg",
202
202
  text: (
203
203
  <Text
204
- size="md"
205
- color="primary"
206
- fontFamily="serif"
204
+ size="text-md"
205
+ color="text-black"
206
+ fontFamily="font-serif"
207
207
  text="Cart"
208
208
  tag="h2"
209
209
  additionalClasses="p-0"
@@ -17,9 +17,9 @@ describe("<Icon /> Profile", () => {
17
17
  hoverColor="green"
18
18
  text={
19
19
  <Text
20
- size="md"
21
- color="green"
22
- fontFamily="serif"
20
+ size="text-md"
21
+ color="text-green"
22
+ fontFamily="font-serif"
23
23
  text="Profile"
24
24
  tag="h2"
25
25
  />
@@ -63,7 +63,7 @@ const Icon: React.FC<IconTypes> = ({
63
63
  );
64
64
  let indicatorSizeClasses = getIndicatorSizeClasses(indicatorSize);
65
65
  let indicatorColorClasses = getIndicatorColorClasses(iconColor);
66
- let borderClasses = getBorderClasses(iconColor, iconBorder);
66
+ let borderClasses = getBorderClasses(iconColor, iconBorder as "none" | "border" | undefined);
67
67
 
68
68
  let isIndicatorRedCircle = indicatorSize === "sm";
69
69
 
@@ -114,8 +114,8 @@ const Icon: React.FC<IconTypes> = ({
114
114
  {icon}
115
115
  </span>
116
116
  {indicatorNumber &&
117
- parseInt(indicatorNumber) !== 0 &&
118
- !isIndicatorRedCircle ? (
117
+ parseInt(indicatorNumber) !== 0 &&
118
+ !isIndicatorRedCircle ? (
119
119
  <div
120
120
  className="indicator"
121
121
  data-testid="indicator"
@@ -130,8 +130,8 @@ const Icon: React.FC<IconTypes> = ({
130
130
  </div>
131
131
  ) : null}
132
132
  {isIndicatorRedCircle &&
133
- indicatorNumber &&
134
- parseInt(indicatorNumber) !== 0 ? (
133
+ indicatorNumber &&
134
+ parseInt(indicatorNumber) !== 0 ? (
135
135
  <div
136
136
  className="indicator"
137
137
  data-testid="indicator"
@@ -169,8 +169,8 @@ const Icon: React.FC<IconTypes> = ({
169
169
  {icon}
170
170
  </span>
171
171
  {indicatorNumber &&
172
- parseInt(indicatorNumber) !== 0 &&
173
- !isIndicatorRedCircle ? (
172
+ parseInt(indicatorNumber) !== 0 &&
173
+ !isIndicatorRedCircle ? (
174
174
  <div
175
175
  className="indicator"
176
176
  data-testid="indicator"
@@ -185,8 +185,8 @@ const Icon: React.FC<IconTypes> = ({
185
185
  </div>
186
186
  ) : null}
187
187
  {isIndicatorRedCircle &&
188
- indicatorNumber &&
189
- parseInt(indicatorNumber) !== 0 ? (
188
+ indicatorNumber &&
189
+ parseInt(indicatorNumber) !== 0 ? (
190
190
  <div
191
191
  className="indicator"
192
192
  data-testid="indicator"
@@ -1,31 +1,29 @@
1
- import React, { Children, ReactNode } from "react";
1
+ import React, { Children, ReactNode, CSSProperties } from "react";
2
2
  import heroImage from "../../../assets/heroImage.png";
3
3
  import imageNotFound from "../../../assets/placeholder-no-image-available.png";
4
- import { CSSProperties } from "react";
5
- import { ImageTypes } from ".";
4
+ import { ImageTypes } from "./Image.types";
6
5
 
7
6
  const Image: React.FC<ImageTypes> = ({
8
7
  src = heroImage,
9
8
  alt = "",
10
9
  background = true,
11
- additionalClasses,
10
+ additionalClasses = "",
12
11
  children,
13
- textAlignment,
12
+ textAlignment = "text-left",
14
13
  }) => {
15
14
  const effectiveSrc = typeof src === "string" ? src : imageNotFound;
16
- const effectiveAlt =
17
- effectiveSrc === imageNotFound ? "Image not found." : alt;
15
+ const effectiveAlt = effectiveSrc === imageNotFound ? "Image not found." : alt;
18
16
 
19
17
  let heroImg: CSSProperties = {
20
18
  backgroundImage: `url(${effectiveSrc})`,
21
19
  };
22
20
 
23
- const defaultBgClasses = `bg-no-repeat bg-cover w-full min-h-72 p-4 flex ${textAlignment} `;
21
+ const defaultBgClasses = `bg-no-repeat bg-cover w-full min-h-72 p-4 flex ${textAlignment}`;
24
22
 
25
23
  if (background) {
26
24
  return (
27
25
  <div
28
- role={effectiveAlt != "" ? "img" : undefined}
26
+ role={effectiveAlt ? "img" : undefined}
29
27
  data-testid="image-background-hero"
30
28
  aria-label={effectiveAlt || undefined}
31
29
  className={`${defaultBgClasses} ${additionalClasses}`}
@@ -37,9 +35,9 @@ const Image: React.FC<ImageTypes> = ({
37
35
  } else {
38
36
  return (
39
37
  <img
40
- src={`${effectiveSrc}`}
41
- alt={alt}
42
- className={`${additionalClasses}`}
38
+ src={effectiveSrc}
39
+ alt={effectiveAlt}
40
+ className={additionalClasses}
43
41
  data-testid="image"
44
42
  />
45
43
  );
@@ -0,0 +1,24 @@
1
+ declare module "*.png" {
2
+ const value: string;
3
+ export default value;
4
+ }
5
+
6
+ declare module "*.jpg" {
7
+ const value: string;
8
+ export default value;
9
+ }
10
+
11
+ declare module "*.jpeg" {
12
+ const value: string;
13
+ export default value;
14
+ }
15
+
16
+ declare module "*.gif" {
17
+ const value: string;
18
+ export default value;
19
+ }
20
+
21
+ declare module "*.svg" {
22
+ const value: string;
23
+ export default value;
24
+ }