@agilant/toga-blox 1.0.8 → 1.0.9
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/assets/cable.jpg +0 -0
- package/assets/card-1.jpg +0 -0
- package/assets/cat-logo.png +0 -0
- package/assets/item.jpg +0 -0
- package/assets/map.png +0 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +953 -0
- package/coverage/coverage-final.json +74 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +551 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/coverage/toga-blox-npm/index.html +131 -0
- package/coverage/toga-blox-npm/postcss.config.js.html +103 -0
- package/coverage/toga-blox-npm/src/components/Badge/Badge.stories.tsx.html +793 -0
- package/coverage/toga-blox-npm/src/components/Badge/Badge.tsx.html +247 -0
- package/coverage/toga-blox-npm/src/components/Badge/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Card/Card.stories.tsx.html +787 -0
- package/coverage/toga-blox-npm/src/components/Card/Card.tsx.html +163 -0
- package/coverage/toga-blox-npm/src/components/Card/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CategoryCardTemplate.tsx.html +343 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CompassCardTemplate.tsx.html +259 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/CounterContentCardTemplate.tsx.html +685 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/HorizontalCardTemplate.tsx.html +637 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/ItemCardTemplate.tsx.html +550 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/KitContentCardTemplate.tsx.html +469 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/ShippingAddressCardTemplate.tsx.html +418 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/VerticalCardTemplate.tsx.html +592 -0
- package/coverage/toga-blox-npm/src/components/Card/templates/index.html +221 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.stories.tsx.html +358 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/CounterButton.tsx.html +385 -0
- package/coverage/toga-blox-npm/src/components/CounterButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Description/Description.stories.tsx.html +286 -0
- package/coverage/toga-blox-npm/src/components/Description/Description.tsx.html +124 -0
- package/coverage/toga-blox-npm/src/components/Description/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.stories.tsx.html +676 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/DropDownIconButton.tsx.html +346 -0
- package/coverage/toga-blox-npm/src/components/DropDownIconButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Footer/ContactInfoItem.tsx.html +139 -0
- package/coverage/toga-blox-npm/src/components/Footer/Footer.stories.tsx.html +934 -0
- package/coverage/toga-blox-npm/src/components/Footer/Footer.tsx.html +373 -0
- package/coverage/toga-blox-npm/src/components/Footer/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.stories.tsx.html +952 -0
- package/coverage/toga-blox-npm/src/components/FormButton/FormButton.tsx.html +343 -0
- package/coverage/toga-blox-npm/src/components/FormButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.stories.tsx.html +376 -0
- package/coverage/toga-blox-npm/src/components/GenericList/GenericList.tsx.html +520 -0
- package/coverage/toga-blox-npm/src/components/GenericList/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DummyDataList.tsx.html +154 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/DynamicIconList.tsx.html +250 -0
- package/coverage/toga-blox-npm/src/components/GenericList/templates/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.stories.tsx.html +325 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/GetSupport.tsx.html +262 -0
- package/coverage/toga-blox-npm/src/components/GetSupport/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/Hamburger.stories.tsx.html +760 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/HamburgerButton.tsx.html +232 -0
- package/coverage/toga-blox-npm/src/components/HamburgerButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Header/Header.stories.tsx.html +1633 -0
- package/coverage/toga-blox-npm/src/components/Header/Header.tsx.html +814 -0
- package/coverage/toga-blox-npm/src/components/Header/headerContext.tsx.html +460 -0
- package/coverage/toga-blox-npm/src/components/Header/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/Hero/Hero.stories.tsx.html +289 -0
- package/coverage/toga-blox-npm/src/components/Hero/Hero.tsx.html +259 -0
- package/coverage/toga-blox-npm/src/components/Hero/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.stories.tsx.html +673 -0
- package/coverage/toga-blox-npm/src/components/IconButton/IconButton.tsx.html +313 -0
- package/coverage/toga-blox-npm/src/components/IconButton/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Image/Image.stories.tsx.html +322 -0
- package/coverage/toga-blox-npm/src/components/Image/Image.tsx.html +226 -0
- package/coverage/toga-blox-npm/src/components/Image/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Input/Input.stories.tsx.html +1621 -0
- package/coverage/toga-blox-npm/src/components/Input/Input.tsx.html +568 -0
- package/coverage/toga-blox-npm/src/components/Input/InputMemoTypes.tsx.html +181 -0
- package/coverage/toga-blox-npm/src/components/Input/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/MobileMenu/MobileMenu.tsx.html +208 -0
- package/coverage/toga-blox-npm/src/components/MobileMenu/index.html +116 -0
- package/coverage/toga-blox-npm/src/components/Nav/Nav.stories.tsx.html +628 -0
- package/coverage/toga-blox-npm/src/components/Nav/Nav.tsx.html +622 -0
- package/coverage/toga-blox-npm/src/components/Nav/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Page/TableDataDummy.tsx.html +733 -0
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.stories.tsx.html +1714 -0
- package/coverage/toga-blox-npm/src/components/Page/ViewPageTemplate.tsx.html +115 -0
- package/coverage/toga-blox-npm/src/components/Page/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.stories.tsx.html +433 -0
- package/coverage/toga-blox-npm/src/components/PageSection/PageSection.tsx.html +121 -0
- package/coverage/toga-blox-npm/src/components/PageSection/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.stories.tsx.html +517 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/SearchInput.tsx.html +325 -0
- package/coverage/toga-blox-npm/src/components/SearchInput/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Slider/Slider.stories.tsx.html +349 -0
- package/coverage/toga-blox-npm/src/components/Slider/Slider.tsx.html +502 -0
- package/coverage/toga-blox-npm/src/components/Slider/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AdminSubmenu.tsx.html +136 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenu.tsx.html +253 -0
- package/coverage/toga-blox-npm/src/components/Submenus/AlertSubmenuItem.tsx.html +202 -0
- package/coverage/toga-blox-npm/src/components/Submenus/index.html +146 -0
- package/coverage/toga-blox-npm/src/components/Text/Text.stories.tsx.html +235 -0
- package/coverage/toga-blox-npm/src/components/Text/Text.tsx.html +172 -0
- package/coverage/toga-blox-npm/src/components/Text/index.html +131 -0
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.stories.tsx.html +445 -0
- package/coverage/toga-blox-npm/src/components/Toaster/Toaster.tsx.html +301 -0
- package/coverage/toga-blox-npm/src/components/Toaster/index.html +131 -0
- package/coverage/toga-blox-npm/src/hoc/styling/index.html +116 -0
- package/coverage/toga-blox-npm/src/hoc/styling/withStoryBook.tsx.html +142 -0
- package/coverage/toga-blox-npm/src/userHoc/index.html +116 -0
- package/coverage/toga-blox-npm/src/userHoc/withMemo.tsx.html +145 -0
- package/coverage/toga-blox-npm/src/utils/assertTagName.tsx.html +106 -0
- package/coverage/toga-blox-npm/src/utils/generateAccordionItem.tsx.html +373 -0
- package/coverage/toga-blox-npm/src/utils/generateFooterContacts.tsx.html +295 -0
- package/coverage/toga-blox-npm/src/utils/generateNavMenu.tsx.html +247 -0
- package/coverage/toga-blox-npm/src/utils/generateSocialList.tsx.html +187 -0
- package/coverage/toga-blox-npm/src/utils/getFontAwesomeIcon.tsx.html +145 -0
- package/coverage/toga-blox-npm/src/utils/index.html +206 -0
- package/coverage/toga-blox-npm/src/utils/inputValidation.tsx.html +163 -0
- package/coverage/toga-blox-npm/tailwind.config.js.html +205 -0
- package/declarations.d.ts +1 -1
- package/package.json +5 -6
- package/src/components/Badge/Badge.stories.tsx +110 -207
- package/src/components/Badge/Badge.test.tsx +40 -41
- package/src/components/Badge/Badge.tsx +29 -99
- package/src/components/Badge/Badge.types.tsx +12 -23
- package/src/components/Card/Card.stories.tsx +166 -22
- package/src/components/Card/Card.test.tsx +3 -3
- package/src/components/Card/Card.tsx +12 -16
- package/src/components/Card/DUMMYPRODUCTDATA.json +381 -225
- package/src/components/Card/templates/CategoryCardTemplate.tsx +86 -0
- package/src/components/Card/templates/CompassCardTemplate.tsx +1 -1
- package/src/components/Card/templates/CounterContentCardTemplate.tsx +200 -0
- package/src/components/Card/templates/ItemCardTemplate.tsx +155 -0
- package/src/components/Card/templates/KitContentCardTemplate.tsx +128 -0
- package/src/components/Card/templates/ShippingAddressCardTemplate.tsx +111 -0
- package/src/components/Card/templates/VerticalCardTemplate.tsx +100 -85
- package/src/components/CounterButton/CounterButton.tsx +1 -1
- package/src/components/Description/Description.stories.tsx +67 -0
- package/src/components/Description/Description.tsx +13 -0
- package/src/components/Description/Description.types.ts +9 -0
- package/src/components/DropDownIconButton/DropDownIconButton.stories.tsx +197 -0
- package/src/components/DropDownIconButton/DropDownIconButton.test.tsx +90 -0
- package/src/components/DropDownIconButton/DropDownIconButton.tsx +87 -0
- package/src/components/DropDownIconButton/DropDownIconButton.types.ts +21 -0
- package/src/components/DropDownIconButton/index.ts +2 -0
- package/src/components/Footer/ContactInfoItem.tsx +8 -10
- package/src/components/Footer/Footer.stories.tsx +13 -22
- package/src/components/Footer/Footer.tsx +25 -88
- package/src/components/Footer/Footer.types.tsx +2 -2
- package/src/components/FormButton/FormButton.stories.tsx +101 -226
- package/src/components/FormButton/FormButton.test.tsx +1 -1
- package/src/components/FormButton/FormButton.tsx +34 -42
- package/src/components/FormButton/FormButton.types.ts +7 -13
- package/src/components/GenericList/GenericList.stories.tsx +5 -12
- package/src/components/GenericList/GenericList.tsx +91 -92
- package/src/components/GenericList/templates/DynamicIconList.tsx +45 -64
- package/src/components/GetSupport/GetSupport.stories.tsx +80 -0
- package/src/components/GetSupport/GetSupport.test.tsx +62 -0
- package/src/components/GetSupport/GetSupport.tsx +59 -0
- package/src/components/GetSupport/GetSupport.types.ts +11 -0
- package/src/components/HamburgerButton/Hamburger.stories.tsx +225 -0
- package/src/components/HamburgerButton/HamburgerButton.tsx +37 -56
- package/src/components/HamburgerButton/HamburgerButton.types.tsx +2 -1
- package/src/components/Header/Header.stories.tsx +3 -5
- package/src/components/Header/Header.tsx +37 -83
- package/src/components/Hero/Hero.stories.tsx +1 -2
- package/src/components/IconButton/IconButton.stories.tsx +196 -0
- package/src/components/{Icon/Icon.test.tsx → IconButton/IconButton.test.tsx} +3 -4
- package/src/components/IconButton/IconButton.tsx +76 -0
- package/src/components/IconButton/IconButton.types.ts +28 -0
- package/src/components/IconButton/index.ts +2 -0
- package/src/components/Image/Image.tsx +1 -1
- package/src/components/Input/Input.stories.tsx +10 -12
- package/src/components/Input/Input.test.tsx +2 -3
- package/src/components/Input/Input.tsx +41 -104
- package/src/components/MobileMenu/MobileMenu.types.tsx +0 -2
- package/src/components/Nav/DUMMYNAVDATA.json +4 -4
- package/src/components/Nav/Nav.tsx +49 -112
- package/src/components/Nav/Nav.types.tsx +14 -2
- package/src/components/Page/ViewPageTemplate.stories.tsx +2 -2
- package/src/components/Page/ViewPageTemplate.test.tsx +1 -1
- package/src/components/Page/ViewPageTemplate.types.ts +1 -1
- package/src/components/PageSection/PageSection.stories.tsx +3 -1
- package/src/components/PageSection/PageSections.test.tsx +2 -1
- package/src/components/SearchInput/SearchInput.stories.tsx +144 -0
- package/src/components/SearchInput/SearchInput.tsx +81 -0
- package/src/components/SearchInput/SearchInput.types.ts +28 -0
- package/src/components/Slider/Slider.stories.tsx +88 -0
- package/src/components/Slider/Slider.tsx +139 -0
- package/src/components/Slider/Slider.types.ts +21 -0
- package/src/components/Submenus/AdminSubmenu.tsx +17 -0
- package/src/components/Submenus/AlertSubmenu.tsx +56 -0
- package/src/components/Submenus/AlertSubmenuItem.tsx +39 -0
- package/src/components/Submenus/types.tsx +32 -0
- package/src/components/Toaster/Toaster.stories.tsx +4 -6
- package/src/components/Toaster/Toaster.test.tsx +3 -4
- package/src/components/Toaster/Toaster.tsx +9 -17
- package/src/components/Toaster/Toaster.types.ts +2 -2
- package/src/utils/assertTagName.tsx +1 -1
- package/src/utils/generateAccordionItem.tsx +7 -13
- package/src/utils/generateFooterContacts.tsx +4 -9
- package/src/utils/getFontAwesomeIcon.tsx +8 -13
- package/tailwind.config.js +11 -3
- package/src/components/Badge/badgeClassNames.tsx +0 -173
- package/src/components/Card/cardClassNames.ts +0 -49
- package/src/components/Footer/footerClassNames.tsx +0 -57
- package/src/components/FormButton/formButtonClassNames.tsx +0 -153
- package/src/components/GenericList/genericListClassNames.tsx +0 -8
- package/src/components/Header/headerClassNames.tsx +0 -50
- package/src/components/Icon/Icon.stories.tsx +0 -227
- package/src/components/Icon/Icon.tsx +0 -208
- package/src/components/Icon/Icon.types.ts +0 -24
- package/src/components/Icon/iconClassNames.ts +0 -79
- package/src/components/Icon/index.ts +0 -2
- package/src/components/Input/inputClassNames.tsx +0 -169
- package/src/components/Nav/navClassNames.tsx +0 -192
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Meta, StoryFn } from "@storybook/react";
|
|
2
2
|
import FormButton from "./FormButton";
|
|
3
|
-
import type {
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { faBoxes, faClipboardList, faTags, faPlusSquare, faCoffee, faTrash, faArrowRight } from "@fortawesome/free-solid-svg-icons";
|
|
3
|
+
import type { FormButtonProps } from "./FormButton.types";
|
|
6
4
|
import Text from "../Text/Text";
|
|
5
|
+
import { getFontAwesomeIcon } from "../../utils/getFontAwesomeIcon";
|
|
7
6
|
|
|
8
7
|
export default {
|
|
9
8
|
title: "Components/FormButton",
|
|
@@ -13,239 +12,132 @@ export default {
|
|
|
13
12
|
table: {
|
|
14
13
|
disable: true,
|
|
15
14
|
},
|
|
16
|
-
},
|
|
17
|
-
text: {
|
|
18
15
|
control: "none",
|
|
19
|
-
description:
|
|
20
|
-
"The main text displayed on the button. Passed through the Text component. Text component controls styles of text",
|
|
21
16
|
},
|
|
22
|
-
|
|
17
|
+
text: {
|
|
23
18
|
control: "none",
|
|
24
|
-
|
|
25
|
-
table: {
|
|
26
|
-
disable: true,
|
|
27
|
-
},
|
|
28
|
-
description:
|
|
29
|
-
"The font weight of the button text. *Storybook prop only.",
|
|
19
|
+
description: "The main text displayed on the button.",
|
|
30
20
|
},
|
|
31
21
|
fontFamily: {
|
|
32
22
|
control: "none",
|
|
33
|
-
|
|
34
|
-
table: {
|
|
35
|
-
disable: true,
|
|
36
|
-
},
|
|
37
|
-
description:
|
|
38
|
-
"The font family of the button text. *Storybook prop only.",
|
|
23
|
+
description: "The font family of the button text.",
|
|
39
24
|
},
|
|
40
25
|
backgroundColor: {
|
|
41
26
|
control: "none",
|
|
42
|
-
|
|
43
|
-
"bg-blue-600",
|
|
44
|
-
"bg-green-600",
|
|
45
|
-
"bg-gray-600",
|
|
46
|
-
"bg-transparent",
|
|
47
|
-
],
|
|
48
|
-
description:
|
|
49
|
-
"The background color of the button. Use Tailwind CSS color classes.",
|
|
50
|
-
},
|
|
51
|
-
fontColor: {
|
|
52
|
-
control: "none",
|
|
53
|
-
options: ["text-white", "text-black"],
|
|
54
|
-
table: {
|
|
55
|
-
disable: true,
|
|
56
|
-
},
|
|
57
|
-
description:
|
|
58
|
-
"The text color of the button. Use Tailwind CSS color classes. *Storybook prop only.",
|
|
59
|
-
},
|
|
60
|
-
size: {
|
|
61
|
-
control: "none",
|
|
62
|
-
options: ["text-xs", "text-sm", "text-md", "text-lg", "text-xl"],
|
|
63
|
-
table: {
|
|
64
|
-
disable: true,
|
|
65
|
-
},
|
|
66
|
-
description:
|
|
67
|
-
"The size of the text on the button. Use Tailwind CSS text size classes. *Storybook prop only.",
|
|
27
|
+
description: "The background color of the button. Use Tailwind CSS color classes.",
|
|
68
28
|
},
|
|
69
29
|
borderColor: {
|
|
70
30
|
control: "none",
|
|
71
|
-
|
|
72
|
-
"border-blue-600",
|
|
73
|
-
"border-green-600",
|
|
74
|
-
"border-gray-600",
|
|
75
|
-
"border-none",
|
|
76
|
-
],
|
|
77
|
-
description:
|
|
78
|
-
"The color of the border of the button. Use Tailwind CSS border color classes.",
|
|
31
|
+
description: "The color of the border of the button. Use Tailwind CSS border color classes.",
|
|
79
32
|
},
|
|
80
33
|
shape: {
|
|
81
34
|
control: "none",
|
|
82
|
-
|
|
83
|
-
"rounded-none",
|
|
84
|
-
"rounded-md",
|
|
85
|
-
"rounded-full",
|
|
86
|
-
"border-b-6 border-b-black",
|
|
87
|
-
],
|
|
88
|
-
description:
|
|
89
|
-
"The shape of the button. Use Tailwind CSS border radius classes.",
|
|
35
|
+
description: "The shape of the button. Use Tailwind CSS border radius classes.",
|
|
90
36
|
},
|
|
91
37
|
hoverBackground: {
|
|
92
38
|
control: "none",
|
|
93
|
-
|
|
94
|
-
"hover:bg-blue-700",
|
|
95
|
-
"hover:bg-green-700",
|
|
96
|
-
"hover:bg-gray-700",
|
|
97
|
-
"hover:bg-transparent",
|
|
98
|
-
],
|
|
99
|
-
description:
|
|
100
|
-
"The background color of the button on hover. Use Tailwind CSS color classes.",
|
|
101
|
-
},
|
|
102
|
-
hoverBorderColor: {
|
|
103
|
-
control: "none",
|
|
104
|
-
options: [
|
|
105
|
-
"hover:border-blue-700",
|
|
106
|
-
"hover:border-green-700",
|
|
107
|
-
"hover:border-gray-700",
|
|
108
|
-
"hover:border-transparent",
|
|
109
|
-
],
|
|
110
|
-
description:
|
|
111
|
-
"The border color of the button on hover. Use Tailwind CSS border color classes.",
|
|
39
|
+
description: "The background color of the button on hover. Use Tailwind CSS color classes.",
|
|
112
40
|
},
|
|
113
41
|
hoverFontColor: {
|
|
114
42
|
control: "none",
|
|
115
|
-
|
|
116
|
-
"hover:text-blue-700",
|
|
117
|
-
"hover:text-green-700",
|
|
118
|
-
"hover:text-gray-700",
|
|
119
|
-
"hover:text-black",
|
|
120
|
-
],
|
|
121
|
-
description:
|
|
122
|
-
"The text color of the button on hover. Use Tailwind CSS color classes.",
|
|
43
|
+
description: "The text color of the button on hover. Use Tailwind CSS color classes.",
|
|
123
44
|
},
|
|
124
45
|
hoverUnderline: {
|
|
125
46
|
control: "none",
|
|
126
47
|
description: "Whether the text is underlined on hover.",
|
|
127
48
|
},
|
|
128
|
-
|
|
49
|
+
hoverBorderColor: {
|
|
129
50
|
control: "none",
|
|
130
|
-
description: "
|
|
51
|
+
description: "The border color of the button on hover. Use Tailwind CSS border color classes.",
|
|
131
52
|
},
|
|
132
|
-
|
|
133
|
-
table: {
|
|
134
|
-
disable: true,
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
color: {
|
|
138
|
-
table: {
|
|
139
|
-
disable: true,
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
as: {
|
|
143
|
-
table: {
|
|
144
|
-
disable: true,
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
buttonWide: {
|
|
148
|
-
table: {
|
|
149
|
-
disable: true,
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
iconOrder: {
|
|
53
|
+
isDisabled: {
|
|
153
54
|
control: "none",
|
|
154
|
-
|
|
155
|
-
table: {
|
|
156
|
-
disable: true,
|
|
157
|
-
},
|
|
158
|
-
description:
|
|
159
|
-
"The order of the icon in the button. *Storybook prop only.",
|
|
160
|
-
},
|
|
161
|
-
type: {
|
|
162
|
-
table: {
|
|
163
|
-
disable: true,
|
|
164
|
-
},
|
|
55
|
+
description: "Whether the button is disabled and cannot be clicked.",
|
|
165
56
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
},
|
|
57
|
+
hasShadow: {
|
|
58
|
+
control: "none",
|
|
59
|
+
description: "Tailwind CSS class to add a shadow to the button.",
|
|
170
60
|
},
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
},
|
|
61
|
+
customWidth: {
|
|
62
|
+
control: "none",
|
|
63
|
+
description: "Custom width for the button. Can be a Tailwind CSS class.",
|
|
175
64
|
},
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
},
|
|
65
|
+
customHeight: {
|
|
66
|
+
control: "none",
|
|
67
|
+
description: "Custom height for the button. Can be a Tailwind CSS class.",
|
|
180
68
|
},
|
|
181
69
|
additionalClasses: {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
},
|
|
70
|
+
control: "none",
|
|
71
|
+
description: "Additional Tailwind CSS classes to apply to the button.",
|
|
185
72
|
},
|
|
186
|
-
|
|
73
|
+
icon: {
|
|
187
74
|
control: "none",
|
|
188
|
-
description:
|
|
189
|
-
"Whether the button is disabled and cannot be clicked.",
|
|
75
|
+
description: "An optional icon element to display inside the button.",
|
|
190
76
|
},
|
|
191
|
-
|
|
77
|
+
iconClasses: {
|
|
192
78
|
control: "none",
|
|
193
|
-
description: "
|
|
79
|
+
description: "Classes for styling the icon inside the button.",
|
|
194
80
|
},
|
|
195
|
-
|
|
81
|
+
as: {
|
|
196
82
|
control: "none",
|
|
197
|
-
description: "
|
|
83
|
+
description: "Defines the type of element to render, such as a 'button', 'a', or a React Router 'Link'.",
|
|
198
84
|
},
|
|
199
|
-
|
|
85
|
+
href: {
|
|
86
|
+
control: "none",
|
|
87
|
+
description: "If 'as' is 'a', this specifies the 'href' for an anchor element.",
|
|
88
|
+
},
|
|
89
|
+
to: {
|
|
200
90
|
control: "none",
|
|
201
|
-
description: "
|
|
91
|
+
description: "If 'as' is 'Link', this specifies the 'to' prop for React Router 'Link'.",
|
|
202
92
|
},
|
|
203
93
|
},
|
|
204
|
-
tags: [
|
|
94
|
+
tags: ['autodocs'],
|
|
205
95
|
parameters: {
|
|
96
|
+
docs: {
|
|
97
|
+
description: {
|
|
98
|
+
component: "The `FormButton` component is a versatile button component that supports different types of elements like `button`, `a`, and `Link` from React Router. It's highly customizable with Tailwind CSS classes."
|
|
99
|
+
},
|
|
100
|
+
},
|
|
206
101
|
layout: "centered",
|
|
207
102
|
},
|
|
208
103
|
} as Meta;
|
|
209
104
|
|
|
210
|
-
const Template: StoryFn<
|
|
105
|
+
const Template: StoryFn<FormButtonProps> = (args) => <FormButton {...args} />;
|
|
211
106
|
|
|
212
107
|
export const Default = Template.bind({});
|
|
213
108
|
Default.args = {
|
|
214
109
|
text: "Default Button",
|
|
215
110
|
backgroundColor: "bg-blue-600",
|
|
216
|
-
|
|
111
|
+
fontFamily: "font-sans",
|
|
217
112
|
borderColor: "border-none",
|
|
218
113
|
shape: "rounded-md",
|
|
219
|
-
hoverBackground: "bg-blue-700",
|
|
220
|
-
hoverFontColor: "text-black",
|
|
221
|
-
hoverBorderColor: "border-blue-700",
|
|
222
|
-
hoverUnderline: false,
|
|
114
|
+
hoverBackground: "hover:bg-blue-700",
|
|
115
|
+
hoverFontColor: "hover:text-black",
|
|
223
116
|
onClick: () => alert("Button clicked!"),
|
|
224
117
|
additionalClasses: "p-2",
|
|
225
118
|
};
|
|
226
119
|
|
|
227
120
|
export const Compass = Template.bind({});
|
|
228
121
|
Compass.args = {
|
|
229
|
-
text: <Text size=
|
|
122
|
+
text: <Text size="" color="" text="Compass Button" fontFamily="" />,
|
|
230
123
|
backgroundColor: "bg-green-400",
|
|
231
|
-
|
|
124
|
+
fontFamily: "font-sans",
|
|
232
125
|
shape: "rounded-md",
|
|
233
126
|
borderColor: "border-none",
|
|
234
|
-
hoverBackground: "bg-green-700",
|
|
235
|
-
hoverFontColor: "text-white",
|
|
236
|
-
hoverBorderColor: "border-green-900",
|
|
127
|
+
hoverBackground: "hover:bg-green-700",
|
|
128
|
+
hoverFontColor: "hover:text-white",
|
|
129
|
+
hoverBorderColor: "hover:border-green-900",
|
|
237
130
|
hoverUnderline: false,
|
|
238
131
|
onClick: () => alert("Button clicked!"),
|
|
239
132
|
as: "a",
|
|
133
|
+
href: "#",
|
|
240
134
|
additionalClasses: "p-2",
|
|
241
135
|
};
|
|
242
136
|
|
|
243
137
|
export const Disabled = Template.bind({});
|
|
244
138
|
Disabled.args = {
|
|
245
139
|
...Default.args,
|
|
246
|
-
text:
|
|
247
|
-
<Text size={""} color={""} text={"Disabled Button"} fontFamily={""} />
|
|
248
|
-
),
|
|
140
|
+
text: <Text size="" color="" text="Disabled Button" fontFamily="" />,
|
|
249
141
|
isDisabled: true,
|
|
250
142
|
};
|
|
251
143
|
|
|
@@ -254,74 +146,67 @@ WithIcon.args = {
|
|
|
254
146
|
...Default.args,
|
|
255
147
|
text: (
|
|
256
148
|
<Text
|
|
257
|
-
size=
|
|
258
|
-
color=
|
|
259
|
-
text=
|
|
260
|
-
fontFamily=
|
|
149
|
+
size=""
|
|
150
|
+
color=""
|
|
151
|
+
text="Button with icon"
|
|
152
|
+
fontFamily=""
|
|
261
153
|
additionalClasses="pl-2"
|
|
262
154
|
/>
|
|
263
155
|
),
|
|
264
|
-
icon:
|
|
156
|
+
icon: getFontAwesomeIcon("coffee"),
|
|
265
157
|
shape: "rounded-none",
|
|
266
158
|
hoverUnderline: false,
|
|
267
159
|
onClick: () => alert("Button clicked!"),
|
|
160
|
+
iconClasses: "pl-2",
|
|
268
161
|
};
|
|
269
162
|
|
|
270
163
|
export const IconOnly = Template.bind({});
|
|
271
164
|
IconOnly.args = {
|
|
272
|
-
|
|
165
|
+
fontFamily: "font-sans",
|
|
273
166
|
shape: "rounded",
|
|
274
|
-
hoverBackground: "bg-
|
|
275
|
-
hoverFontColor: "text-white",
|
|
276
|
-
hoverBorderColor: "border-blue-700",
|
|
167
|
+
hoverBackground: "hover:bg-gray-100",
|
|
277
168
|
hoverUnderline: false,
|
|
278
|
-
icon:
|
|
279
|
-
additionalClasses: "px-4 py-3 bg-gray-50",
|
|
169
|
+
icon: getFontAwesomeIcon("trash"),
|
|
170
|
+
additionalClasses: "flex justify-center items-center px-4 py-3 bg-gray-50",
|
|
280
171
|
onClick: () => alert("Icon button clicked!"),
|
|
281
172
|
};
|
|
282
173
|
|
|
283
174
|
export const ClearCartButton = Template.bind({});
|
|
284
175
|
ClearCartButton.args = {
|
|
285
|
-
text: <Text size=
|
|
286
|
-
|
|
287
|
-
size: "text-md",
|
|
176
|
+
text: <Text size="" color="" text="Clear Cart" fontFamily="" />,
|
|
177
|
+
fontFamily: "font-sans",
|
|
288
178
|
shape: "rounded-md",
|
|
289
|
-
hoverBackground: "bg-
|
|
290
|
-
hoverFontColor: "text-
|
|
291
|
-
hoverBorderColor: "border-red-700",
|
|
179
|
+
hoverBackground: "hover:bg-gray-100",
|
|
180
|
+
hoverFontColor: "hover:text-black",
|
|
181
|
+
hoverBorderColor: "hover:border-red-700",
|
|
292
182
|
hoverUnderline: false,
|
|
293
|
-
icon:
|
|
294
|
-
|
|
295
|
-
additionalClasses:
|
|
296
|
-
"px-5 py-6 bg-gray-50 border-red-500 gap-2",
|
|
183
|
+
icon: getFontAwesomeIcon("trash"),
|
|
184
|
+
iconClasses: "order-first",
|
|
185
|
+
additionalClasses: "px-5 py-6 bg-gray-50 border-red-500 gap-2",
|
|
297
186
|
onClick: () => alert("Cart Cleared!"),
|
|
298
187
|
};
|
|
299
188
|
|
|
300
189
|
export const RightIconButton = Template.bind({});
|
|
301
190
|
RightIconButton.args = {
|
|
302
|
-
text:
|
|
303
|
-
|
|
304
|
-
),
|
|
305
|
-
backgroundColor: "bg-gray-700",
|
|
191
|
+
text: <Text size="" color="text-white" text="Next" fontFamily="" />,
|
|
192
|
+
backgroundColor: "bg-gray-500",
|
|
306
193
|
shape: "rounded-md",
|
|
307
|
-
hoverBackground: "bg-
|
|
308
|
-
hoverFontColor: "text-white",
|
|
309
|
-
hoverBorderColor: "border-blue-700",
|
|
194
|
+
hoverBackground: "hover:bg-gray-700",
|
|
195
|
+
hoverFontColor: "hover:text-white",
|
|
196
|
+
hoverBorderColor: "hover:border-blue-700",
|
|
310
197
|
hoverUnderline: false,
|
|
311
|
-
icon:
|
|
312
|
-
additionalClasses:
|
|
313
|
-
|
|
314
|
-
onClick: () => alert("
|
|
198
|
+
icon: getFontAwesomeIcon("arrow-right"),
|
|
199
|
+
additionalClasses: "px-6 py-3 flex-row-reverse",
|
|
200
|
+
iconClasses: "ml-2",
|
|
201
|
+
onClick: () => alert("Next clicked!"),
|
|
315
202
|
};
|
|
316
203
|
|
|
204
|
+
|
|
317
205
|
export const ConfirmRequestButton = Template.bind({});
|
|
318
206
|
ConfirmRequestButton.args = {
|
|
319
|
-
text:
|
|
320
|
-
<Text size={""} color={""} text={"CONFIRM REQUEST"} fontFamily={""} />
|
|
321
|
-
),
|
|
207
|
+
text: <Text size="" color="" text="CONFIRM REQUEST" fontFamily="" />,
|
|
322
208
|
backgroundColor: "bg-[#9ca3af]",
|
|
323
|
-
|
|
324
|
-
size: "text-md",
|
|
209
|
+
fontFamily: "font-sans",
|
|
325
210
|
borderColor: "border-none",
|
|
326
211
|
shape: "rounded-md",
|
|
327
212
|
hoverUnderline: false,
|
|
@@ -337,33 +222,28 @@ FourButtonsRow.decorators = [
|
|
|
337
222
|
<FormButton
|
|
338
223
|
text="All"
|
|
339
224
|
backgroundColor="bg-teal-600"
|
|
340
|
-
|
|
341
|
-
size="text-md"
|
|
225
|
+
fontFamily="font-sans"
|
|
342
226
|
borderColor="border-gray-200"
|
|
343
227
|
shape="rounded-none"
|
|
344
|
-
hoverBackground="bg-teal-600"
|
|
345
|
-
hoverFontColor="text-black"
|
|
346
|
-
hoverBorderColor="border-none"
|
|
347
228
|
hoverUnderline={false}
|
|
348
|
-
additionalClasses="py-2 px-4"
|
|
229
|
+
additionalClasses="py-2 px-4 text-white"
|
|
349
230
|
onClick={() => alert("All clicked!")}
|
|
350
231
|
/>
|
|
351
232
|
|
|
352
233
|
<FormButton
|
|
353
234
|
text={
|
|
354
235
|
<>
|
|
355
|
-
|
|
236
|
+
{getFontAwesomeIcon("boxes", "mr-2")}
|
|
356
237
|
Bundles
|
|
357
238
|
</>
|
|
358
239
|
}
|
|
359
240
|
backgroundColor="bg-white"
|
|
360
|
-
|
|
361
|
-
size="text-md"
|
|
241
|
+
fontFamily="font-sans"
|
|
362
242
|
borderColor="border-gray-200"
|
|
363
243
|
shape="rounded-none"
|
|
364
|
-
hoverBackground="bg-teal-600"
|
|
365
|
-
hoverFontColor="text-
|
|
366
|
-
hoverBorderColor="border-none"
|
|
244
|
+
hoverBackground="hover:bg-teal-600"
|
|
245
|
+
hoverFontColor="hover:text-white"
|
|
246
|
+
hoverBorderColor="hover:border-none"
|
|
367
247
|
hoverUnderline={false}
|
|
368
248
|
additionalClasses="py-2 px-4"
|
|
369
249
|
onClick={() => alert("Bundles clicked!")}
|
|
@@ -371,21 +251,17 @@ FourButtonsRow.decorators = [
|
|
|
371
251
|
<FormButton
|
|
372
252
|
text={
|
|
373
253
|
<>
|
|
374
|
-
|
|
375
|
-
icon={faClipboardList}
|
|
376
|
-
className="mr-2"
|
|
377
|
-
/>{" "}
|
|
254
|
+
{getFontAwesomeIcon("clipboard", "mr-2")}
|
|
378
255
|
Categories
|
|
379
256
|
</>
|
|
380
257
|
}
|
|
381
258
|
backgroundColor="bg-white"
|
|
382
|
-
|
|
383
|
-
size="text-md"
|
|
259
|
+
fontFamily="font-sans"
|
|
384
260
|
borderColor="border-gray-200"
|
|
385
261
|
shape="rounded-none"
|
|
386
|
-
hoverBackground="bg-teal-600"
|
|
387
|
-
hoverFontColor="text-
|
|
388
|
-
hoverBorderColor="border-none"
|
|
262
|
+
hoverBackground="hover:bg-teal-600"
|
|
263
|
+
hoverFontColor="hover:text-white"
|
|
264
|
+
hoverBorderColor="hover:border-none"
|
|
389
265
|
hoverUnderline={false}
|
|
390
266
|
additionalClasses="py-2 px-4"
|
|
391
267
|
onClick={() => alert("Categories clicked!")}
|
|
@@ -393,18 +269,17 @@ FourButtonsRow.decorators = [
|
|
|
393
269
|
<FormButton
|
|
394
270
|
text={
|
|
395
271
|
<>
|
|
396
|
-
|
|
272
|
+
{getFontAwesomeIcon("plus", "mr-2")}
|
|
397
273
|
Custom Categories
|
|
398
274
|
</>
|
|
399
275
|
}
|
|
400
276
|
backgroundColor="bg-white"
|
|
401
|
-
|
|
402
|
-
size="text-md"
|
|
277
|
+
fontFamily="font-sans"
|
|
403
278
|
borderColor="border-gray-200"
|
|
404
279
|
shape="rounded-none"
|
|
405
|
-
hoverBackground="bg-teal-600"
|
|
406
|
-
hoverFontColor="text-
|
|
407
|
-
hoverBorderColor="border-none"
|
|
280
|
+
hoverBackground="hover:bg-teal-600"
|
|
281
|
+
hoverFontColor="hover:text-white"
|
|
282
|
+
hoverBorderColor="hover:border-none"
|
|
408
283
|
hoverUnderline={false}
|
|
409
284
|
additionalClasses="py-2 px-4"
|
|
410
285
|
onClick={() => alert("Custom Categories clicked!")}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { render, screen, fireEvent } from "@testing-library/react";
|
|
2
|
-
import { describe, expect,
|
|
2
|
+
import { describe, expect, test, vi } from "vitest";
|
|
3
3
|
import Button from "./FormButton";
|
|
4
4
|
import { MemoryRouter } from "react-router-dom";
|
|
5
5
|
|
|
@@ -1,61 +1,53 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
3
|
-
import type { ButtonTypes } from "./FormButton.types";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { FormButtonProps } from "./FormButton.types";
|
|
4
3
|
|
|
5
|
-
const FormButton: React.FC<
|
|
4
|
+
const FormButton: React.FC<FormButtonProps> = ({
|
|
6
5
|
onClick,
|
|
7
6
|
text,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
backgroundColor = "bg-blue-600",
|
|
11
|
-
fontColor = "text-white",
|
|
12
|
-
size = "text-md",
|
|
7
|
+
fontFamily,
|
|
8
|
+
backgroundColor,
|
|
13
9
|
customWidth,
|
|
14
10
|
customHeight,
|
|
15
|
-
shape
|
|
16
|
-
borderColor
|
|
11
|
+
shape,
|
|
12
|
+
borderColor,
|
|
17
13
|
icon,
|
|
18
|
-
|
|
19
|
-
additionalClasses = "",
|
|
14
|
+
additionalClasses,
|
|
20
15
|
type = "button",
|
|
21
16
|
to,
|
|
22
17
|
href,
|
|
23
|
-
tooltip,
|
|
24
18
|
isDisabled = false,
|
|
25
19
|
hasShadow,
|
|
26
20
|
as: Element = "button",
|
|
27
|
-
hoverBackground
|
|
28
|
-
hoverFontColor
|
|
21
|
+
hoverBackground,
|
|
22
|
+
hoverFontColor,
|
|
29
23
|
hoverUnderline = false,
|
|
30
|
-
hoverBorderColor
|
|
24
|
+
hoverBorderColor,
|
|
25
|
+
iconClasses,
|
|
31
26
|
...props
|
|
32
27
|
}) => {
|
|
33
28
|
const baseFormButtonClasses = "flex items-center justify-center";
|
|
34
29
|
const hoverClasses = !isDisabled
|
|
35
|
-
?
|
|
36
|
-
} hover:${hoverBorderColor}`
|
|
30
|
+
? `${hoverBackground} ${hoverFontColor} ${hoverUnderline ? "underline underline-offset-4" : ""} ${hoverBorderColor}`
|
|
37
31
|
: "";
|
|
38
|
-
const buttonColorClasses = `${backgroundColor} ${
|
|
32
|
+
const buttonColorClasses = `${backgroundColor} ${borderColor}`;
|
|
39
33
|
const cursorClasses = isDisabled
|
|
40
34
|
? "cursor-not-allowed opacity-50"
|
|
41
35
|
: "cursor-pointer";
|
|
42
|
-
const textStyleClasses = `${
|
|
36
|
+
const textStyleClasses = `${fontFamily}`;
|
|
43
37
|
const buttonShapeClasses = shape;
|
|
44
|
-
const iconClasses =
|
|
45
|
-
iconOrder === "first" ? "order-first" : "order-last pl-2";
|
|
46
38
|
|
|
47
39
|
const buttonClasses = `
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
${baseFormButtonClasses}
|
|
41
|
+
${buttonColorClasses}
|
|
42
|
+
${buttonShapeClasses}
|
|
43
|
+
${textStyleClasses}
|
|
44
|
+
${hoverClasses}
|
|
45
|
+
${cursorClasses}
|
|
46
|
+
${hasShadow ? "shadow-md" : ""}
|
|
47
|
+
${customWidth}
|
|
48
|
+
${customHeight}
|
|
49
|
+
${additionalClasses}
|
|
50
|
+
`.trim();
|
|
59
51
|
|
|
60
52
|
const handleClick = (
|
|
61
53
|
e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>
|
|
@@ -70,21 +62,21 @@ const FormButton: React.FC<ButtonTypes> = ({
|
|
|
70
62
|
const baseProps = {
|
|
71
63
|
className: buttonClasses,
|
|
72
64
|
onClick: handleClick,
|
|
73
|
-
type: type,
|
|
74
65
|
"aria-disabled": isDisabled ? "true" : "false",
|
|
75
|
-
"data-tooltip": tooltip,
|
|
76
66
|
};
|
|
77
67
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
let ElementProps: React.ComponentProps<any> = { ...baseProps };
|
|
69
|
+
|
|
70
|
+
if (Element === "a" && href) {
|
|
71
|
+
ElementProps = { ...baseProps, href };
|
|
82
72
|
} else if (Element === "button") {
|
|
83
|
-
|
|
73
|
+
ElementProps = { ...baseProps, type };
|
|
74
|
+
} else {
|
|
75
|
+
ElementProps = { ...baseProps };
|
|
84
76
|
}
|
|
85
77
|
|
|
86
78
|
return (
|
|
87
|
-
<Element {...props}>
|
|
79
|
+
<Element {...ElementProps} {...props}>
|
|
88
80
|
{icon && <span className={iconClasses}>{icon}</span>}
|
|
89
81
|
{text}
|
|
90
82
|
</Element>
|
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
import React, { ElementType } from "react";
|
|
2
2
|
|
|
3
|
-
export interface
|
|
3
|
+
export interface FormButtonProps {
|
|
4
4
|
onClick?: (
|
|
5
5
|
e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>
|
|
6
6
|
) => void;
|
|
7
7
|
text?: string | JSX.Element;
|
|
8
|
+
fontFamily?: string;
|
|
8
9
|
backgroundColor?: string;
|
|
9
10
|
borderColor?: string;
|
|
10
|
-
fontFamily?: "sans" | "mono" | "serif" | string;
|
|
11
11
|
customWidth?: string;
|
|
12
12
|
customHeight?: string;
|
|
13
|
-
shape?:
|
|
13
|
+
shape?: string;
|
|
14
14
|
icon?: JSX.Element | null;
|
|
15
|
-
|
|
15
|
+
additionalClasses?: string;
|
|
16
|
+
type?: "button" | "submit" | "reset";
|
|
16
17
|
to?: string;
|
|
17
18
|
href?: string;
|
|
18
|
-
tooltip?: string;
|
|
19
|
-
additionalClasses?: string;
|
|
20
19
|
isDisabled?: boolean;
|
|
21
20
|
hasShadow?: string;
|
|
22
|
-
as?: ElementType;
|
|
21
|
+
as?: ElementType | string;
|
|
23
22
|
hoverBackground?: string;
|
|
24
23
|
hoverFontColor?: string;
|
|
25
24
|
hoverUnderline?: boolean;
|
|
26
25
|
hoverBorderColor?: string;
|
|
27
|
-
|
|
28
|
-
// STORYBOOK PROPS
|
|
29
|
-
size?: "xs" | "sm" | "md" | "lg" | "xl" | string;
|
|
30
|
-
textStyle?: "thin" | "light" | "normal" | "semibold" | "bold";
|
|
31
|
-
iconOrder?: "first" | "last";
|
|
32
|
-
fontColor?: string;
|
|
26
|
+
iconClasses?: string;
|
|
33
27
|
}
|