sy-ui-lib 1.0.0
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/README.md +89 -0
- package/dist/components/AdminBetSlip/AdminBetSlip.component.d.ts +32 -0
- package/dist/components/AdminBetSlip/AdminBetSlip.stories.d.ts +8 -0
- package/dist/components/AdminBetSlip/AdminBetSlip.types.d.ts +50 -0
- package/dist/components/AdminBetSlip/index.d.ts +3 -0
- package/dist/components/Avatar/Avatar.component.d.ts +18 -0
- package/dist/components/Avatar/Avatar.stories.d.ts +6 -0
- package/dist/components/Avatar/Avatar.types.d.ts +13 -0
- package/dist/components/Avatar/index.d.ts +3 -0
- package/dist/components/BannerCard/BannerCard.component.d.ts +3 -0
- package/dist/components/BannerCard/BannerCard.stories.d.ts +6 -0
- package/dist/components/BannerCard/BannerCard.types.d.ts +12 -0
- package/dist/components/BannerCard/index.d.ts +3 -0
- package/dist/components/BetSlip/BetSlip.component.d.ts +88 -0
- package/dist/components/BetSlip/BetSlip.stories.d.ts +13 -0
- package/dist/components/BetSlip/BetSlip.types.d.ts +51 -0
- package/dist/components/BetSlip/index.d.ts +3 -0
- package/dist/components/BetSlipModal/BetSlipModal.component.d.ts +24 -0
- package/dist/components/BetSlipModal/BetSlipModal.stories.d.ts +11 -0
- package/dist/components/BetSlipModal/BetSlipModal.types.d.ts +8 -0
- package/dist/components/BetSlipModal/index.d.ts +3 -0
- package/dist/components/Button/Button.component.d.ts +33 -0
- package/dist/components/Button/Button.stories.d.ts +18 -0
- package/dist/components/Button/Button.types.d.ts +29 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Checkbox/Checkbox.component.d.ts +27 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +12 -0
- package/dist/components/Checkbox/Checkbox.types.d.ts +16 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Chip/Chip.component.d.ts +21 -0
- package/dist/components/Chip/Chip.stories.d.ts +51 -0
- package/dist/components/Chip/Chip.types.d.ts +22 -0
- package/dist/components/Chip/index.d.ts +3 -0
- package/dist/components/Colors/Colors.component.d.ts +2 -0
- package/dist/components/Colors/Colors.stories.d.ts +6 -0
- package/dist/components/CommonMarketHeader/CommonMarketHeader.component.d.ts +3 -0
- package/dist/components/CommonMarketHeader/CommonMarketHeader.stories.d.ts +17 -0
- package/dist/components/CommonMarketHeader/CommonMarketHeader.types.d.ts +35 -0
- package/dist/components/CommonMarketHeader/index.d.ts +3 -0
- package/dist/components/CommonMarketRow/CommonMarketRow.component.d.ts +4 -0
- package/dist/components/CommonMarketRow/CommonMarketRow.stories.d.ts +9 -0
- package/dist/components/CommonMarketRow/CommonMarketRow.types.d.ts +151 -0
- package/dist/components/CommonMarketRow/CommonOddButton.component.d.ts +132 -0
- package/dist/components/CommonMarketRow/FancyOddsRow.component.d.ts +3 -0
- package/dist/components/CommonMarketRow/LayeredOddsRow.component.d.ts +3 -0
- package/dist/components/CommonMarketRow/PairOddsRow.component.d.ts +3 -0
- package/dist/components/CommonMarketRow/index.d.ts +3 -0
- package/dist/components/DatePicker/DatePicker.component.d.ts +28 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts +10 -0
- package/dist/components/DatePicker/DatePicker.types.d.ts +33 -0
- package/dist/components/DatePicker/index.d.ts +3 -0
- package/dist/components/Dropdown/Dropdown.component.d.ts +38 -0
- package/dist/components/Dropdown/Dropdown.stories.d.ts +10 -0
- package/dist/components/Dropdown/Dropdown.types.d.ts +26 -0
- package/dist/components/Dropdown/index.d.ts +3 -0
- package/dist/components/EventCard/EventCard.component.d.ts +48 -0
- package/dist/components/EventCard/EventCard.stories.d.ts +6 -0
- package/dist/components/EventCard/EventCard.types.d.ts +44 -0
- package/dist/components/EventCard/index.d.ts +3 -0
- package/dist/components/EventDisplayCard/EventDisplayCard.component.d.ts +24 -0
- package/dist/components/EventDisplayCard/EventDisplayCard.stories.d.ts +8 -0
- package/dist/components/EventDisplayCard/EventDisplayCard.types.d.ts +10 -0
- package/dist/components/EventDisplayCard/index.d.ts +3 -0
- package/dist/components/EventInfoCard/EventInfoCard.component.d.ts +38 -0
- package/dist/components/EventInfoCard/EventInfoCard.stories.d.ts +6 -0
- package/dist/components/EventInfoCard/EventInfoCard.types.d.ts +19 -0
- package/dist/components/EventInfoCard/index.d.ts +3 -0
- package/dist/components/FileUploader/FileUploader.component.d.ts +55 -0
- package/dist/components/FileUploader/FileUploader.stories.d.ts +8 -0
- package/dist/components/FileUploader/FileUploader.types.d.ts +23 -0
- package/dist/components/FileUploader/index.d.ts +3 -0
- package/dist/components/FlashNotification/FlashNotification.component.d.ts +34 -0
- package/dist/components/FlashNotification/FlashNotification.stories.d.ts +9 -0
- package/dist/components/FlashNotification/FlashNotification.types.d.ts +13 -0
- package/dist/components/FlashNotification/index.d.ts +3 -0
- package/dist/components/Icon/Icon.component.d.ts +20 -0
- package/dist/components/Icon/Icon.types.d.ts +43 -0
- package/dist/components/Icon/SvgIcons.d.ts +80 -0
- package/dist/components/Icon/index.d.ts +3 -0
- package/dist/components/ImageCard/ImageCard.component.d.ts +22 -0
- package/dist/components/ImageCard/ImageCard.stories.d.ts +9 -0
- package/dist/components/ImageCard/ImageCard.types.d.ts +8 -0
- package/dist/components/ImageCard/index.d.ts +3 -0
- package/dist/components/InputField/InputField.component.d.ts +28 -0
- package/dist/components/InputField/InputField.stories.d.ts +10 -0
- package/dist/components/InputField/InputField.types.d.ts +33 -0
- package/dist/components/InputField/index.d.ts +3 -0
- package/dist/components/Loader/Loader.component.d.ts +18 -0
- package/dist/components/Loader/Loader.stories.d.ts +14 -0
- package/dist/components/Loader/Loader.types.d.ts +8 -0
- package/dist/components/Loader/index.d.ts +3 -0
- package/dist/components/MaintenancePage/MaintenancePage.component.d.ts +37 -0
- package/dist/components/MaintenancePage/MaintenancePage.stories.d.ts +10 -0
- package/dist/components/MaintenancePage/MaintenancePage.types.d.ts +14 -0
- package/dist/components/MaintenancePage/index.d.ts +3 -0
- package/dist/components/Menu/Menu.component.d.ts +21 -0
- package/dist/components/Menu/Menu.stories.d.ts +7 -0
- package/dist/components/Menu/Menu.types.d.ts +24 -0
- package/dist/components/Menu/index.d.ts +3 -0
- package/dist/components/Modal/Modal.component.d.ts +39 -0
- package/dist/components/Modal/Modal.stories.d.ts +11 -0
- package/dist/components/Modal/Modal.types.d.ts +20 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.component.d.ts +22 -0
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.stories.d.ts +10 -0
- package/dist/components/MultiSelectDropdown/MultiSelectDropdown.types.d.ts +22 -0
- package/dist/components/MultiSelectDropdown/index.d.ts +3 -0
- package/dist/components/NotFoundPage/NotFoundPage.component.d.ts +48 -0
- package/dist/components/NotFoundPage/NotFoundPage.stories.d.ts +11 -0
- package/dist/components/NotFoundPage/NotFoundPage.types.d.ts +13 -0
- package/dist/components/NotFoundPage/index.d.ts +3 -0
- package/dist/components/NotificationBanner/NotificationBanner.component.d.ts +39 -0
- package/dist/components/NotificationBanner/NotificationBanner.stories.d.ts +6 -0
- package/dist/components/NotificationBanner/NotificationBanner.types.d.ts +44 -0
- package/dist/components/NotificationBanner/index.d.ts +3 -0
- package/dist/components/NullState/NullState.component.d.ts +25 -0
- package/dist/components/NullState/NullState.stories.d.ts +14 -0
- package/dist/components/NullState/NullState.types.d.ts +22 -0
- package/dist/components/NullState/index.d.ts +3 -0
- package/dist/components/Pagination/Pagination.component.d.ts +23 -0
- package/dist/components/Pagination/Pagination.stories.d.ts +7 -0
- package/dist/components/Pagination/Pagination.types.d.ts +14 -0
- package/dist/components/Pagination/index.d.ts +3 -0
- package/dist/components/PasswordFieldGroup/PasswordFieldGroup.component.d.ts +28 -0
- package/dist/components/PasswordFieldGroup/PasswordFieldGroup.stories.d.ts +8 -0
- package/dist/components/PasswordFieldGroup/PasswordFieldGroup.types.d.ts +21 -0
- package/dist/components/PasswordFieldGroup/index.d.ts +3 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.component.d.ts +38 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.stories.d.ts +8 -0
- package/dist/components/PhoneNumberInput/PhoneNumberInput.types.d.ts +6 -0
- package/dist/components/PhoneNumberInput/index.d.ts +3 -0
- package/dist/components/ProgressBar/ProgressBar.component.d.ts +22 -0
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +9 -0
- package/dist/components/ProgressBar/ProgressBar.types.d.ts +12 -0
- package/dist/components/ProgressBar/index.d.ts +3 -0
- package/dist/components/RadioButton/RadioButton.component.d.ts +15 -0
- package/dist/components/RadioButton/RadioButton.stories.d.ts +8 -0
- package/dist/components/RadioButton/RadioButton.types.d.ts +31 -0
- package/dist/components/RadioButton/index.d.ts +3 -0
- package/dist/components/SearchBar/SearchBar.component.d.ts +18 -0
- package/dist/components/SearchBar/SearchBar.stories.d.ts +8 -0
- package/dist/components/SearchBar/SearchBar.types.d.ts +11 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/Skeleton/Skeleton.component.d.ts +29 -0
- package/dist/components/Skeleton/Skeleton.stories.d.ts +6 -0
- package/dist/components/Skeleton/Skeleton.types.d.ts +26 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/SnackBar/SnackBar.component.d.ts +47 -0
- package/dist/components/SnackBar/SnackBar.stories.d.ts +8 -0
- package/dist/components/SnackBar/SnackBar.types.d.ts +41 -0
- package/dist/components/SnackBar/SnackBarQueue.d.ts +9 -0
- package/dist/components/SnackBar/SnackbarFetcher.d.ts +34 -0
- package/dist/components/SnackBar/SnackbarProvider.d.ts +25 -0
- package/dist/components/SnackBar/index.d.ts +4 -0
- package/dist/components/StatsList/StatsList.component.d.ts +34 -0
- package/dist/components/StatsList/StatsList.stories.d.ts +11 -0
- package/dist/components/StatsList/StatsList.types.d.ts +39 -0
- package/dist/components/StatsList/index.d.ts +3 -0
- package/dist/components/StatusDisplayCard/StatusDisplayCard.component.d.ts +20 -0
- package/dist/components/StatusDisplayCard/StatusDisplayCard.stories.d.ts +30 -0
- package/dist/components/StatusDisplayCard/StatusDisplayCard.types.d.ts +17 -0
- package/dist/components/StatusDisplayCard/index.d.ts +3 -0
- package/dist/components/Svgs/LoaderSvg.d.ts +2 -0
- package/dist/components/Svgs/NotFoundSvg.d.ts +2 -0
- package/dist/components/Svgs/NullStateAdminSvg.d.ts +2 -0
- package/dist/components/Svgs/NullStateUserSvg.d.ts +2 -0
- package/dist/components/Svgs/UnderMaintenanceSvg.d.ts +2 -0
- package/dist/components/Svgs/index.d.ts +6 -0
- package/dist/components/Swiper/Swiper.component.d.ts +37 -0
- package/dist/components/Swiper/Swiper.stories.d.ts +32 -0
- package/dist/components/Swiper/Swiper.types.d.ts +46 -0
- package/dist/components/Swiper/index.d.ts +3 -0
- package/dist/components/TabList/TabList.component.d.ts +37 -0
- package/dist/components/TabList/TabList.stories.d.ts +16 -0
- package/dist/components/TabList/TabList.types.d.ts +27 -0
- package/dist/components/TabList/index.d.ts +3 -0
- package/dist/components/Table/Table.component.d.ts +47 -0
- package/dist/components/Table/Table.stories.d.ts +25 -0
- package/dist/components/Table/Table.types.d.ts +28 -0
- package/dist/components/Table/index.d.ts +3 -0
- package/dist/components/TimePicker/TimePicker.component.d.ts +22 -0
- package/dist/components/TimePicker/TimePicker.stories.d.ts +8 -0
- package/dist/components/TimePicker/TimePicker.types.d.ts +22 -0
- package/dist/components/TimePicker/index.d.ts +3 -0
- package/dist/components/TitleBar/TitleBar.component.d.ts +22 -0
- package/dist/components/TitleBar/TitleBar.stories.d.ts +8 -0
- package/dist/components/TitleBar/TitleBar.types.d.ts +10 -0
- package/dist/components/TitleBar/index.d.ts +3 -0
- package/dist/components/Toggle/Toggle.component.d.ts +22 -0
- package/dist/components/Toggle/Toggle.stories.d.ts +8 -0
- package/dist/components/Toggle/Toggle.types.d.ts +8 -0
- package/dist/components/Toggle/index.d.ts +3 -0
- package/dist/components/Tooltip/Tooltip.component.d.ts +19 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +10 -0
- package/dist/components/Tooltip/Tooltip.types.d.ts +11 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/TooltipExt/TooltipExt.component.d.ts +23 -0
- package/dist/components/TooltipExt/TooltipExt.stories.d.ts +19 -0
- package/dist/components/TooltipExt/TooltipExt.types.d.ts +11 -0
- package/dist/components/TooltipExt/index.d.ts +3 -0
- package/dist/components/Typography/Typography.component.d.ts +24 -0
- package/dist/components/Typography/Typography.stories.d.ts +8 -0
- package/dist/components/Typography/Typography.types.d.ts +54 -0
- package/dist/components/Typography/index.d.ts +3 -0
- package/dist/components/UserBetSlip/UserBetSlip.component.d.ts +45 -0
- package/dist/components/UserBetSlip/UserBetSlip.stories.d.ts +9 -0
- package/dist/components/UserBetSlip/UserBetSlip.types.d.ts +56 -0
- package/dist/components/UserBetSlip/index.d.ts +3 -0
- package/dist/components/WalletInfo/WalletInfo.component.d.ts +59 -0
- package/dist/components/WalletInfo/WalletInfo.stories.d.ts +7 -0
- package/dist/components/WalletInfo/WalletInfo.types.d.ts +25 -0
- package/dist/components/WalletInfo/index.d.ts +3 -0
- package/dist/components/ZIndex/ZIndex.component.d.ts +2 -0
- package/dist/components/ZIndex/ZIndex.stories.d.ts +5 -0
- package/dist/components/ZIndex/index.d.ts +2 -0
- package/dist/components/index.d.ts +50 -0
- package/dist/fonts/roboto-v48-latin-100.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-200.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-300.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-500.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-600.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-700.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-800.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-900.woff2 +0 -0
- package/dist/fonts/roboto-v48-latin-regular.woff2 +0 -0
- package/dist/images/404_Error_image.png +0 -0
- package/dist/images/female_avatar.png +0 -0
- package/dist/images/image_card.png +0 -0
- package/dist/images/loader.png +0 -0
- package/dist/images/male_avatar.png +0 -0
- package/dist/images/null_state_admin.png +0 -0
- package/dist/images/null_state_user.png +0 -0
- package/dist/images/under_maintenance.png +0 -0
- package/dist/index.cjs +59 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +15014 -0
- package/dist/utils/commonFunctionality/commonFunctionality.d.ts +13 -0
- package/dist/utils/commonFunctionality/commonFunctionality.types.d.ts +3 -0
- package/dist/utils/commonFunctionality/index.d.ts +2 -0
- package/dist/utils/constants.d.ts +44 -0
- package/dist/utils/countryCodes.d.ts +6 -0
- package/dist/utils/paginationUtils.d.ts +10 -0
- package/dist/utils/useScreenSize.d.ts +3 -0
- package/dist/vite-env.d.ts +1 -0
- package/package.json +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# SK UI Library
|
|
2
|
+
|
|
3
|
+
This project is the **UI component library**, built with modern frontend tools and practices. It is a reusable and scalable library developed using **React**, **TypeScript**, **Vite**, **Storybook**, **Biome** and **Husky**..
|
|
4
|
+
|
|
5
|
+
All user interfaces within SK projects will be built using these standardized and tested components to ensure design consistency, reusability, and developer efficiency.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 🛠️ Tech Stack
|
|
10
|
+
|
|
11
|
+
- **React** – Component-based UI
|
|
12
|
+
- **TypeScript** – Type safety and enhanced development experience
|
|
13
|
+
- **Vite** – Fast development build tool
|
|
14
|
+
- **Storybook** – Component-driven development environment
|
|
15
|
+
- **Biome** – Linting, formatting, and code quality enforcement
|
|
16
|
+
- **Husky** – Git hooks management to enforce code quality checks pre-commit
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Format and Lint using Biome
|
|
21
|
+
|
|
22
|
+
To ensure formatting on save and import sorting, configure Biome in your editor (e.g., in VSCode, add the Biome extension and set it as the default formatter).----
|
|
23
|
+
|
|
24
|
+
### Pre-commit Validation with Husky
|
|
25
|
+
As part of our development workflow, Husky enforces code quality by running automated checks before every commit. These checks ensure that only well-formatted, type-safe, and secure code is committed to the repository.
|
|
26
|
+
|
|
27
|
+
The following validations are run in order:
|
|
28
|
+
|
|
29
|
+
Biome Lint Check
|
|
30
|
+
Ensures that your code follows formatting and linting rules defined in biome.json. If issues are found, Biome will attempt to auto-fix them. If it cannot, the commit will be blocked until the issues are resolved.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
echo "Running Biome lint check..."
|
|
34
|
+
npx biome check --write
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
TypeScript Type Check
|
|
38
|
+
Verifies that your code has no type errors using the TypeScript compiler. This ensures that runtime errors caused by type mismatches are caught early.
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
echo "Running type check..."
|
|
42
|
+
npx tsc --noEmit
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Security Audit with npm
|
|
46
|
+
Runs npm audit to detect known vulnerabilities in your dependencies. If any moderate or higher severity issues are found, the commit is blocked until resolved.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
echo "Running npm audit (security check)..."
|
|
50
|
+
npm audit --audit-level=moderate
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
These checks are defined in .husky/pre-commit and run automatically—no manual steps are needed. This helps maintain a secure, stable, and high-quality codebase across the team.
|
|
54
|
+
|
|
55
|
+
### Biome extension setup in VS Code
|
|
56
|
+
|
|
57
|
+
To enable automatic code formatting and linting with Biome in VS Code, install the **Biome** extension (published by `biomejs`) from the Extensions Marketplace. Then, update your VS Code `settings.json` to set Biome as the default formatter for JavaScript, TypeScript, and JSON files. Also, enable `editor.formatOnSave` to apply formatting automatically on every save. This setup helps enforce consistent code style and import sorting across the project.
|
|
58
|
+
|
|
59
|
+
----
|
|
60
|
+
### Folder structure
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
.
|
|
64
|
+
├── .husky/ #Pre-Commit Hook
|
|
65
|
+
├── .storybook/ # Storybook configuration
|
|
66
|
+
│ ├── main.ts
|
|
67
|
+
│ └── preview.ts
|
|
68
|
+
├── .vscode/ # Editor settings
|
|
69
|
+
│ └── settings.json
|
|
70
|
+
├── src/ # Source files
|
|
71
|
+
│ ├── components/
|
|
72
|
+
│ │ └── Button/
|
|
73
|
+
│ │ ├──── Button.component.tsx
|
|
74
|
+
│ │ └──── Button.stories.tsx
|
|
75
|
+
│ ├── App.css
|
|
76
|
+
│ └── vite-env.d.ts
|
|
77
|
+
├── .gitignore
|
|
78
|
+
├── .nvmrc
|
|
79
|
+
├── biome.json # Formatter config
|
|
80
|
+
├── eslint.config.js # Linting config
|
|
81
|
+
├── index.html
|
|
82
|
+
├── package.json
|
|
83
|
+
├── package-lock.json
|
|
84
|
+
├── tsconfig.json
|
|
85
|
+
├── tsconfig.app.json
|
|
86
|
+
├── tsconfig.node.json
|
|
87
|
+
├── vite.config.ts
|
|
88
|
+
└── README.md
|
|
89
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AdminBetSlipProps } from './AdminBetSlip.types';
|
|
2
|
+
/**
|
|
3
|
+
* AdminBetSlip component renders a list of grouped bet slips with details like type, time, reference, odds, stakes, and profits.
|
|
4
|
+
* It displays each group with a title and separates individual slips using borders for clarity.
|
|
5
|
+
*
|
|
6
|
+
* @param {AdminBetSlipProps} props - Contains grouped bet slip data to render.
|
|
7
|
+
* @returns {JSX.Element} The structured layout of all bet slips.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const betSlipData = [
|
|
11
|
+
* {
|
|
12
|
+
* title: "Premier League Bets",
|
|
13
|
+
* betSlipDetails: [
|
|
14
|
+
* {
|
|
15
|
+
* subTitle: "Match 1 - Team A vs Team B",
|
|
16
|
+
* type: "Back",
|
|
17
|
+
* time: { title: "Time:", value: "2025-09-08 14:30" },
|
|
18
|
+
* reference: { title: "Ref:", value: "REF12345" },
|
|
19
|
+
* oddsDetails: [
|
|
20
|
+
* { title: "Runs/Odds", value: "2.5/1.80" },
|
|
21
|
+
* { title: "Stakes", value: 100 },
|
|
22
|
+
* { title: "Profits", value: 80, color: true }
|
|
23
|
+
* ]
|
|
24
|
+
* }
|
|
25
|
+
* ]
|
|
26
|
+
* }
|
|
27
|
+
* ];
|
|
28
|
+
*
|
|
29
|
+
* <AdminBetSlip betSlipData={betSlipData} />
|
|
30
|
+
*/
|
|
31
|
+
declare const AdminBetSlip: React.FC<AdminBetSlipProps>;
|
|
32
|
+
export default AdminBetSlip;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite/*';
|
|
2
|
+
import { default as AdminBetSlip } from './AdminBetSlip.component';
|
|
3
|
+
declare const meta: Meta<typeof AdminBetSlip>;
|
|
4
|
+
/** Type alias for the story object of AdminBetSlip */
|
|
5
|
+
type Story = StoryObj<typeof AdminBetSlip>;
|
|
6
|
+
/** Default story configuration for AdminBetSlip */
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export default meta;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Types of bets allowed */
|
|
2
|
+
export type BetType = "Back" | "Lay";
|
|
3
|
+
/** Represents a title and its corresponding value (e.g., time or reference) */
|
|
4
|
+
export interface TimeAndRef {
|
|
5
|
+
/** Label for the field */
|
|
6
|
+
title: string;
|
|
7
|
+
/** Value associated with the label */
|
|
8
|
+
value: string;
|
|
9
|
+
}
|
|
10
|
+
/** Details for a particular odds entry */
|
|
11
|
+
export interface OddsDetails {
|
|
12
|
+
/** Title of the odds field */
|
|
13
|
+
title: string;
|
|
14
|
+
/** Value of the odds, can be a number or string */
|
|
15
|
+
value: string | number;
|
|
16
|
+
/** Optional flag to apply color styling */
|
|
17
|
+
color?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** Defines a key mapping for odds-related data */
|
|
20
|
+
export interface OddsKeys {
|
|
21
|
+
/** Title of the odds key */
|
|
22
|
+
title: string;
|
|
23
|
+
/** Identifier for the odds key */
|
|
24
|
+
key: string;
|
|
25
|
+
}
|
|
26
|
+
/** Details of a single bet slip entry */
|
|
27
|
+
export interface BetSlipDetails {
|
|
28
|
+
/** Subtitle or description of the bet */
|
|
29
|
+
subTitle: string;
|
|
30
|
+
/** Bet type: 'Back' or 'Lay' */
|
|
31
|
+
type: BetType;
|
|
32
|
+
/** Time information with title and value */
|
|
33
|
+
time: TimeAndRef;
|
|
34
|
+
/** Reference information with title and value */
|
|
35
|
+
reference: TimeAndRef;
|
|
36
|
+
/** List of odds-related details */
|
|
37
|
+
oddsDetails: OddsDetails[];
|
|
38
|
+
}
|
|
39
|
+
/** Data structure for admin view containing multiple bet slips */
|
|
40
|
+
export interface AdminBetSlipData {
|
|
41
|
+
/** Group or category title */
|
|
42
|
+
title: string;
|
|
43
|
+
/** Array of bet slip details */
|
|
44
|
+
betSlipDetails: BetSlipDetails[];
|
|
45
|
+
}
|
|
46
|
+
/** Props for the AdminBetSlip component */
|
|
47
|
+
export interface AdminBetSlipProps {
|
|
48
|
+
/** Array of grouped bet slip data */
|
|
49
|
+
betSlipData: AdminBetSlipData[];
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AvatarProps } from './Avatar.types';
|
|
2
|
+
/**
|
|
3
|
+
* Avatar Component
|
|
4
|
+
*
|
|
5
|
+
* Renders a user avatar with optional fallback initials.
|
|
6
|
+
* Can be used to display profile pictures throughout the app.
|
|
7
|
+
*
|
|
8
|
+
* Props:
|
|
9
|
+
* @param {string} src URL of the avatar image.
|
|
10
|
+
* @param {string} alt Alt text for the image (accessibility).
|
|
11
|
+
* @param {"sm" | "md" | "lg"} size Size of the avatar.
|
|
12
|
+
* @param {string} fallbackText Text to show if image fails to load (initials).
|
|
13
|
+
*
|
|
14
|
+
* Example usage:
|
|
15
|
+
* <Avatar src="/user.jpg" alt="John Doe" fallbackText="JD" size="md" />
|
|
16
|
+
*/
|
|
17
|
+
declare const Avatar: React.FC<AvatarProps>;
|
|
18
|
+
export default Avatar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Props associated with Avatar component*/
|
|
2
|
+
export type AvatarProps = {
|
|
3
|
+
/** URL of the avatar image */
|
|
4
|
+
src?: string;
|
|
5
|
+
/** Alt text for the image (accessibility). */
|
|
6
|
+
alt?: string;
|
|
7
|
+
/** Size of the avatar */
|
|
8
|
+
size?: "sm" | "md" | "lg";
|
|
9
|
+
/** Text to show if image fails to load
|
|
10
|
+
* (Give us the name we will convert it to initials)
|
|
11
|
+
*/
|
|
12
|
+
fallbackText: string;
|
|
13
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { default as BannerCard } from './BannerCard.component';
|
|
3
|
+
declare const meta: Meta<typeof BannerCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof BannerCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ButtonProps, IconProps } from '..';
|
|
2
|
+
/** Props for BannerCard component */
|
|
3
|
+
export interface BannerCardProps {
|
|
4
|
+
/** Title text displayed on the banner */
|
|
5
|
+
title: string;
|
|
6
|
+
/** Background image URL for the banner */
|
|
7
|
+
image: string;
|
|
8
|
+
/** Optional button configuration shown on the banner */
|
|
9
|
+
buttonProps?: ButtonProps;
|
|
10
|
+
/** Optional icon configuration displayed next to the title */
|
|
11
|
+
iconProps?: IconProps;
|
|
12
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { BetSlipProps } from './BetSlip.types';
|
|
2
|
+
/**
|
|
3
|
+
* BetSlip Component
|
|
4
|
+
*
|
|
5
|
+
* A UI component for placing bets (Back / Lay / "Yes"/ "No"/ "Even"/"Odd).
|
|
6
|
+
* Displays bet info, odds, stake input, quick amount buttons,
|
|
7
|
+
* min/max bet info, P&L calculation, and customizable footer actions.
|
|
8
|
+
*
|
|
9
|
+
* Props:
|
|
10
|
+
* @param {"Back" | "Lay" | "Yes" | "No" | "Even" | "Odd"} betSlipVariant Controls the bet slip style (background/border colors). Options: "back" (Bet For) | "lay" (Bet Against).
|
|
11
|
+
* @param {string} slipTitle Main heading text (shown in the top bar).
|
|
12
|
+
* @param {object} betDetails Object containing the title and description of the bet.
|
|
13
|
+
* @param {string} betDetails.betTitle Title of the bet (e.g., Match name).
|
|
14
|
+
* @param {string} betDetails.betDescription Description of the bet (e.g., Market type).
|
|
15
|
+
* @param {number[]} betButtonAmounts List of quick-select stake amounts (e.g., [100, 500, 1000, 5000]).
|
|
16
|
+
* @param {number} defaultStake Initial stake value displayed in the stake input.
|
|
17
|
+
* @param {number} [defaultOdds] Odds value (displayed in input, defaults can be numeric/string).
|
|
18
|
+
* @param {object} minBet Object containing the minimum allowed bet value and its title.
|
|
19
|
+
* @param {string} minBet.title Label displayed for the minimum bet section (e.g., "Min Bet").
|
|
20
|
+
* @param {number} minBet.amount Minimum allowed bet value.
|
|
21
|
+
* @param {string} minBet.errorMessage Error message for validation failure.
|
|
22
|
+
* @param {object} [maxBet] Optional maximum allowed stake.
|
|
23
|
+
* @param {string} maxBet.title Label displayed for max bet (e.g., "Max Bet").
|
|
24
|
+
* @param {number} maxBet.amount Maximum stake allowed.
|
|
25
|
+
* @param {string} maxBet.errorMessage Error message for validation failure.
|
|
26
|
+
* @param {object} betSlipLabels Labels for the input fields, which are displayed in the second bar.
|
|
27
|
+
* @param {string} betSlipLabels.stakeTitle Title for the stake input field.
|
|
28
|
+
* @param {string} betSlipLabels.oddsTitle Title for the odds input field.
|
|
29
|
+
* @param {string} betSlipLabels.pLValueTitle Title for the profit and loss (P&L) input field.
|
|
30
|
+
* @param {string} errorMessage error message describing what went wrong
|
|
31
|
+
* @param {ButtonProps[]} footerCTA Array of button configurations (e.g., Cancel, Place Bet).
|
|
32
|
+
* @param {string} footerCTA.text Text of the button.
|
|
33
|
+
* @param {string} footerCTA.variant Variant style of the button (e.g., "primary", "outline").
|
|
34
|
+
* @param {function} footerCTA.onClick Function triggered when the button is clicked.
|
|
35
|
+
* @param {string} footerCTA.size Size of the button (e.g., "small", "large").
|
|
36
|
+
* @param {string} [footerCTA.type] Type of the button (e.g., "submit").
|
|
37
|
+
* @param {function} handleBetPlacement Function triggered when the bet is placed or bet is submitted.
|
|
38
|
+
* @param {function} onClose Callback function triggered when the bet slip is closed.
|
|
39
|
+
* @param {number} pLValue Profit and loss value (displayed in the input area).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* <BetSlip
|
|
43
|
+
* betSlipVariant="back"
|
|
44
|
+
* slipTitle="Back (Bet For)"
|
|
45
|
+
* betDetails={{
|
|
46
|
+
* betTitle: "Sri Lanka vs Bangladesh",
|
|
47
|
+
* betDescription: "The Draw Match Odds"
|
|
48
|
+
* }}
|
|
49
|
+
* betButtonAmounts={[100, 500, 1000, 5000]}
|
|
50
|
+
* defaultStake={500}
|
|
51
|
+
* defaultOdds={1.25}
|
|
52
|
+
* minBet={{
|
|
53
|
+
* amount: 100,
|
|
54
|
+
* title: "Min Bet",
|
|
55
|
+
* errorMessage: "Minimum bet allowed is 100"
|
|
56
|
+
* }}
|
|
57
|
+
* maxBet={{
|
|
58
|
+
* amount: 5000,
|
|
59
|
+
* title: "Max Bet",
|
|
60
|
+
* errorMessage: "Maximum bet allowed is 5000"
|
|
61
|
+
* }}
|
|
62
|
+
* betSlipLabels={{
|
|
63
|
+
* stakeTitle: "Stake",
|
|
64
|
+
* oddsTitle: "Odds",
|
|
65
|
+
* pLValueTitle: "P&L"
|
|
66
|
+
* }}
|
|
67
|
+
* handleBetPlacement={() => console.log("Bet placed")}
|
|
68
|
+
* footerCTA={[
|
|
69
|
+
* {
|
|
70
|
+
* text: "Cancel",
|
|
71
|
+
* variant: "outline",
|
|
72
|
+
* onClick: () => console.log("Bet Slip Closed"),
|
|
73
|
+
* size: "small"
|
|
74
|
+
* },
|
|
75
|
+
* {
|
|
76
|
+
* text: "Place Bet",
|
|
77
|
+
* variant: "primary",
|
|
78
|
+
* onClick: () => console.log("Placing Bet"),
|
|
79
|
+
* size: "small",
|
|
80
|
+
* type: "submit"
|
|
81
|
+
* }
|
|
82
|
+
* ]}
|
|
83
|
+
* onClose={() => console.log("Closed")}
|
|
84
|
+
* pLValue={0}
|
|
85
|
+
* />
|
|
86
|
+
*/
|
|
87
|
+
declare const BetSlip: React.FC<BetSlipProps>;
|
|
88
|
+
export default BetSlip;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { default as BetSlip } from './BetSlip.component';
|
|
3
|
+
declare const meta: Meta<typeof BetSlip>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof BetSlip>;
|
|
6
|
+
/** Basic Back BetSlip */
|
|
7
|
+
export declare const BasicBetSlip: Story;
|
|
8
|
+
/** Lay Variant */
|
|
9
|
+
export declare const LayBetSlip: Story;
|
|
10
|
+
/** Basic Lay BetSlip with error message*/
|
|
11
|
+
export declare const BasicBetSlipWithErrorMsg: Story;
|
|
12
|
+
/** Custom Stake Example */
|
|
13
|
+
export declare const CustomStakeBetSlip: Story;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ButtonProps } from '../Button';
|
|
2
|
+
/** Types of bet slip variants */
|
|
3
|
+
export type BetSlipVariantType = "Back" | "Lay" | "Yes" | "No" | "Even" | "Odd";
|
|
4
|
+
export interface BetSlipPlacementData {
|
|
5
|
+
stake: number;
|
|
6
|
+
odds: number;
|
|
7
|
+
}
|
|
8
|
+
/** Props for BetSlip component*/
|
|
9
|
+
export interface BetSlipProps {
|
|
10
|
+
/** Variant of bet slip (back or lay) */
|
|
11
|
+
betSlipVariant: BetSlipVariantType;
|
|
12
|
+
/** Heading shown at the top (main header) */
|
|
13
|
+
slipTitle: string;
|
|
14
|
+
/** Title and the description of the bet */
|
|
15
|
+
betDetails: {
|
|
16
|
+
betTitle: string;
|
|
17
|
+
betDescription: string;
|
|
18
|
+
};
|
|
19
|
+
/** List of quick-select stake amounts (e.g., ["100", "500", "1000"]) */
|
|
20
|
+
betButtonAmounts: number[];
|
|
21
|
+
/** Default stake value shown in the input */
|
|
22
|
+
defaultStake: number;
|
|
23
|
+
/** Odds value for the bet (optional, defaults can be provided in component) */
|
|
24
|
+
defaultOdds: number;
|
|
25
|
+
/** Projected PL value*/
|
|
26
|
+
projectedPL: number;
|
|
27
|
+
/** Minimum allowed bet amount and title*/
|
|
28
|
+
minBet: {
|
|
29
|
+
title: string;
|
|
30
|
+
amount: number;
|
|
31
|
+
errorMessage: string;
|
|
32
|
+
};
|
|
33
|
+
/** Maximum allowed bet amount and title (optional) */
|
|
34
|
+
maxBet?: {
|
|
35
|
+
title: string;
|
|
36
|
+
amount: number;
|
|
37
|
+
errorMessage: string;
|
|
38
|
+
};
|
|
39
|
+
/** headers for the input fields */
|
|
40
|
+
betSlipLabels: {
|
|
41
|
+
stakeTitle: string;
|
|
42
|
+
oddsTitle: string;
|
|
43
|
+
pLValueTitle: string;
|
|
44
|
+
};
|
|
45
|
+
/** Optional error message describing what went wrong */
|
|
46
|
+
errorMessage?: string;
|
|
47
|
+
/** Optional list of footer call-to-action buttons. */
|
|
48
|
+
footerCTA: ButtonProps[];
|
|
49
|
+
/** handle BetSlipPlacementData */
|
|
50
|
+
handleBetPlacement: (data: BetSlipPlacementData) => void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BetSlipModalProps } from './BetSlipModal.types';
|
|
2
|
+
/**
|
|
3
|
+
* BetSlipModal
|
|
4
|
+
*
|
|
5
|
+
* Modal wrapper around the BetSlip component.
|
|
6
|
+
* Allows users to enter stake and odds, view profit/loss,
|
|
7
|
+
* and place or clear a bet.
|
|
8
|
+
*
|
|
9
|
+
* @param isOpen - Controls modal visibility (true = open, false = closed)
|
|
10
|
+
* @param onClose - Callback triggered when user closes the modal
|
|
11
|
+
* @param betSlipVariant - Variant of bet slip ("back" | "lay")
|
|
12
|
+
* @param slipTitle - Heading displayed in the modal header
|
|
13
|
+
* @param betSlipLabels - Labels for odds, stake, and P&L fields
|
|
14
|
+
* @param betDetails - Bet title and description details
|
|
15
|
+
* @param betButtonAmounts - Quick-add stake button values
|
|
16
|
+
* @param defaultStake - Initial stake value shown in the input
|
|
17
|
+
* @param defaultOdds - Initial odds value shown in the input
|
|
18
|
+
* @param minBet - Minimum allowed bet configuration and validation message
|
|
19
|
+
* @param maxBet - Maximum allowed bet configuration and validation message (optional)
|
|
20
|
+
* @param footerCTA - Footer call-to-action buttons (e.g. Place Bet)
|
|
21
|
+
* @param handleBetPlacement - Callback fired when stake or odds changes
|
|
22
|
+
*/
|
|
23
|
+
declare const BetSlipModal: React.FC<BetSlipModalProps>;
|
|
24
|
+
export default BetSlipModal;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { BetSlipModal } from '..';
|
|
3
|
+
declare const meta: Meta<typeof BetSlipModal>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof BetSlipModal>;
|
|
6
|
+
export declare const BackBet: Story;
|
|
7
|
+
export declare const LayBet: Story;
|
|
8
|
+
export declare const YesBet: Story;
|
|
9
|
+
export declare const NoBet: Story;
|
|
10
|
+
export declare const OddBet: Story;
|
|
11
|
+
export declare const EvenBet: Story;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BetSlipProps } from '..';
|
|
2
|
+
/** Props associated with Modal component */
|
|
3
|
+
export interface BetSlipModalProps extends BetSlipProps {
|
|
4
|
+
/** Controls modal visibility (true = open) */
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/** method use to close the modal by click on cancel and cross icon button */
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonProps } from './Button.types';
|
|
3
|
+
/**
|
|
4
|
+
* Button Component
|
|
5
|
+
*
|
|
6
|
+
* A flexible and reusable button component that supports:
|
|
7
|
+
* - Text, icon, and avatar combinations
|
|
8
|
+
* - Multiple size and variant styles
|
|
9
|
+
* - Disabled state
|
|
10
|
+
* - Full-width option independent of size
|
|
11
|
+
* - Customizable icon and text color
|
|
12
|
+
*
|
|
13
|
+
* Props:
|
|
14
|
+
* @param {ButtonSize} [size="medium"] – Controls the padding and size of the button.
|
|
15
|
+
* @param {ButtonVariant} [variant="primary"] – Visual style of the button (e.g., primary, ghost, danger).
|
|
16
|
+
* @param {string} [text] – Optional text content displayed in the button.
|
|
17
|
+
* @param {boolean} [disabled=false] – Whether the button is disabled.
|
|
18
|
+
* @param {IconName} [iconName] – Optional icon to display.
|
|
19
|
+
* @param {AvatarProps} [avatarProps] – Optional avatar to show beside the text/icon.
|
|
20
|
+
* @param {function} [onClick] – Callback function triggered on button click.
|
|
21
|
+
* @param {string} [iconPosition] - icon position when both icon and text are present.
|
|
22
|
+
* @param {boolean} [isLoading] - shown loader and disable button if true.
|
|
23
|
+
* @param {Color} [textColor] - Optional custom text color for the button text (applies to both icon and text). Overrides the default color based on variant.
|
|
24
|
+
* @param {boolean} [fullWidth=false] - If true, the button will stretch to fill the width of its container.
|
|
25
|
+
*
|
|
26
|
+
* Example usage:
|
|
27
|
+
* <Button text="Submit" variant="success" iconName="check" iconPosition="left" isLoading={true} />
|
|
28
|
+
* <Button avatarProps={{ src: "/user.png" }} text="Profile" />
|
|
29
|
+
* <Button iconName="edit" size="small" textColor="primary"/>
|
|
30
|
+
* <Button text="Save" size="large" fullWidth />
|
|
31
|
+
*/
|
|
32
|
+
declare const Button: React.FC<ButtonProps>;
|
|
33
|
+
export default Button;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { default as Button } from './Button.component';
|
|
3
|
+
declare const meta: Meta<typeof Button>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Button>;
|
|
6
|
+
export declare const Primary: Story;
|
|
7
|
+
export declare const Secondary: Story;
|
|
8
|
+
export declare const Ghost: Story;
|
|
9
|
+
export declare const Danger: Story;
|
|
10
|
+
export declare const Success: Story;
|
|
11
|
+
export declare const Outline: Story;
|
|
12
|
+
export declare const IconOnlyOutlineButton: Story;
|
|
13
|
+
export declare const TextWithIcon: Story;
|
|
14
|
+
export declare const TextWithLeftIcon: Story;
|
|
15
|
+
export declare const LoadingButton: Story;
|
|
16
|
+
export declare const TextWithAvatar: Story;
|
|
17
|
+
export declare const DisabledButton: Story;
|
|
18
|
+
export declare const FullWidthButton: Story;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AvatarProps } from '../Avatar/Avatar.types';
|
|
2
|
+
import { IconName } from '../Icon/Icon.types';
|
|
3
|
+
import { TypoColor } from '../Typography/Typography.types';
|
|
4
|
+
export type ButtonVariant = "primary" | "secondary" | "ghost" | "danger" | "success" | "outline";
|
|
5
|
+
export type ButtonSize = "extraSmall" | "small" | "medium" | "large";
|
|
6
|
+
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
7
|
+
/** Size of the button*/
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
/** Visual style of the button*/
|
|
10
|
+
variant?: ButtonVariant;
|
|
11
|
+
/** Text to show inside the button*/
|
|
12
|
+
text?: string;
|
|
13
|
+
/** To disable the button*/
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Name of the icon to display in the button*/
|
|
16
|
+
iconName?: IconName;
|
|
17
|
+
/** Avatar configuration to display inside the button*/
|
|
18
|
+
avatarProps?: AvatarProps;
|
|
19
|
+
/** Handle function calls when the button is clicked*/
|
|
20
|
+
onClick?: (e: React.MouseEvent<HTMLElement>) => void;
|
|
21
|
+
/** Optional icon position when both icon and text can present (default is right)*/
|
|
22
|
+
iconPosition?: "left" | "right";
|
|
23
|
+
/** Show loading spinner instead of icon */
|
|
24
|
+
isLoading?: boolean;
|
|
25
|
+
/** Optional custom text color for the button text.*/
|
|
26
|
+
textColor?: TypoColor;
|
|
27
|
+
/** Make the button take full container width when true.*/
|
|
28
|
+
fullWidth?: boolean;
|
|
29
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CheckboxProps } from './Checkbox.types';
|
|
2
|
+
/**
|
|
3
|
+
* Reusable Checkbox component with controlled and uncontrolled support.
|
|
4
|
+
*
|
|
5
|
+
* - Supports disabled state
|
|
6
|
+
* - Shows tick icon when checked
|
|
7
|
+
* - Can be fully controlled or uncontrolled (with `initialChecked`)
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
*
|
|
11
|
+
* @param {IconName} [initialIcon] - Optional icon to display as the initial state.
|
|
12
|
+
* @param {boolean} [checked] - Controlled checkbox state (overrides internal state)
|
|
13
|
+
* @param {boolean} [initialChecked=false] - Initial value for uncontrolled checkbox
|
|
14
|
+
* @param {(checked: boolean) => void} [onChange] - Called when checked state changes
|
|
15
|
+
* @param {boolean} [disabled=false] - Whether the checkbox is disabled
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Uncontrolled checkbox
|
|
19
|
+
* <Checkbox initialChecked />
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Controlled checkbox
|
|
23
|
+
* const [checked, setChecked] = useState(false);
|
|
24
|
+
* <Checkbox checked={checked} onChange={setChecked} />
|
|
25
|
+
*/
|
|
26
|
+
declare const Checkbox: ({ initialIcon, checked, initialChecked, onChange, disabled, }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export default Checkbox;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { default as Checkbox } from './Checkbox.component';
|
|
3
|
+
/** Storybook metadata for the Checkbox component.*/
|
|
4
|
+
declare const meta: Meta<typeof Checkbox>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
7
|
+
export declare const BasicCheckbox: Story;
|
|
8
|
+
export declare const InitialCheckbox: Story;
|
|
9
|
+
export declare const CheckedCheckbox: Story;
|
|
10
|
+
export declare const DisableCheckbox: Story;
|
|
11
|
+
export declare const DisableWithInitialCheckbox: Story;
|
|
12
|
+
export declare const DisableWithCheckedCheckbox: Story;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IconName } from '..';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the reusable Checkbox component.
|
|
4
|
+
*/
|
|
5
|
+
export interface CheckboxProps {
|
|
6
|
+
/** Optional icon to display as the initial state. */
|
|
7
|
+
initialIcon?: IconName;
|
|
8
|
+
/** Controlled checked state (used when parent fully controls the checkbox) Default value is 'false' */
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
/** Initial checked state for uncontrolled usage. Default value is 'false' */
|
|
11
|
+
initialChecked?: boolean;
|
|
12
|
+
/** Callback that runs when the checkbox is toggled. */
|
|
13
|
+
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
/** When true, the checkbox becomes non-interactive and grayed out. */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ChipProps } from './Chip.types';
|
|
2
|
+
/**
|
|
3
|
+
* Chip Component
|
|
4
|
+
*
|
|
5
|
+
* Renders a customizable status chip/tag that visually represents a state
|
|
6
|
+
* (e.g., Active, Suspended, Locked) and supports optional edit functionality.
|
|
7
|
+
*
|
|
8
|
+
* Props:
|
|
9
|
+
* @param {string} text - Text to display inside the chip.
|
|
10
|
+
* @param {"active" | "suspended" | "locked" | "pending" | "info"} state - The visual and semantic state of the chip.
|
|
11
|
+
* @param {"filled" | "outlined"} [variant="filled"] - Controls the visual appearance (background & border).
|
|
12
|
+
* @param {boolean} [isEditable=false] - If true, shows an edit icon and enforces "outlined" styling.
|
|
13
|
+
* @param {iconName} [iconName] – Optional icon to display.
|
|
14
|
+
* @param {() => void} [onClick] - Optional handler for when the chip is clicked.
|
|
15
|
+
*
|
|
16
|
+
* Example usage:
|
|
17
|
+
* <Chip text="Active" state="active" iconName="timer" />
|
|
18
|
+
* <Chip text="Locked" state="locked" isEditable onClick={() => console.log("clicked")} />
|
|
19
|
+
*/
|
|
20
|
+
declare const Chip: React.FC<ChipProps>;
|
|
21
|
+
export default Chip;
|