smartzi-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.
Files changed (41) hide show
  1. package/README.md +254 -0
  2. package/dist/cjs/index.js +8376 -0
  3. package/dist/cjs/index.js.map +1 -0
  4. package/dist/cjs/types/components/Button/Button.d.ts +14 -0
  5. package/dist/cjs/types/components/Button/Button.stories.d.ts +15 -0
  6. package/dist/cjs/types/components/Button/index.d.ts +1 -0
  7. package/dist/cjs/types/components/Carousel/Carousel.d.ts +21 -0
  8. package/dist/cjs/types/components/Carousel/Carousel.stories.d.ts +29 -0
  9. package/dist/cjs/types/components/Carousel/index.d.ts +1 -0
  10. package/dist/cjs/types/components/CarouselLoop/CarouselLoop.d.ts +21 -0
  11. package/dist/cjs/types/components/CarouselLoop/CarouselLoop.stories.d.ts +29 -0
  12. package/dist/cjs/types/components/CarouselLoop/index.d.ts +1 -0
  13. package/dist/cjs/types/components/DropdownText/DropdownText.d.ts +18 -0
  14. package/dist/cjs/types/components/DropdownText/DropdownText.stories.d.ts +15 -0
  15. package/dist/cjs/types/components/DropdownText/index.d.ts +1 -0
  16. package/dist/cjs/types/components/TitleCard/TitleCard.d.ts +11 -0
  17. package/dist/cjs/types/components/TitleCard/TitleCard.stories.d.ts +15 -0
  18. package/dist/cjs/types/components/TitleCard/index.d.ts +1 -0
  19. package/dist/cjs/types/components/index.d.ts +4 -0
  20. package/dist/cjs/types/index.d.ts +1 -0
  21. package/dist/esm/index.js +8371 -0
  22. package/dist/esm/index.js.map +1 -0
  23. package/dist/esm/types/components/Button/Button.d.ts +14 -0
  24. package/dist/esm/types/components/Button/Button.stories.d.ts +15 -0
  25. package/dist/esm/types/components/Button/index.d.ts +1 -0
  26. package/dist/esm/types/components/Carousel/Carousel.d.ts +21 -0
  27. package/dist/esm/types/components/Carousel/Carousel.stories.d.ts +29 -0
  28. package/dist/esm/types/components/Carousel/index.d.ts +1 -0
  29. package/dist/esm/types/components/CarouselLoop/CarouselLoop.d.ts +21 -0
  30. package/dist/esm/types/components/CarouselLoop/CarouselLoop.stories.d.ts +29 -0
  31. package/dist/esm/types/components/CarouselLoop/index.d.ts +1 -0
  32. package/dist/esm/types/components/DropdownText/DropdownText.d.ts +18 -0
  33. package/dist/esm/types/components/DropdownText/DropdownText.stories.d.ts +15 -0
  34. package/dist/esm/types/components/DropdownText/index.d.ts +1 -0
  35. package/dist/esm/types/components/TitleCard/TitleCard.d.ts +11 -0
  36. package/dist/esm/types/components/TitleCard/TitleCard.stories.d.ts +15 -0
  37. package/dist/esm/types/components/TitleCard/index.d.ts +1 -0
  38. package/dist/esm/types/components/index.d.ts +4 -0
  39. package/dist/esm/types/index.d.ts +1 -0
  40. package/dist/index.d.ts +62 -0
  41. package/package.json +57 -0
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ # Smartzi UI
2
+
3
+ An UI Component Library Created by Smartzi.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Carousel Component](#carousel-component)
8
+ - [Features](#features)
9
+ - [Installation](#installation)
10
+ - [Importing](#importing)
11
+ - [For React App](#for-react-app)
12
+ - [For Next App](#for-next-app)
13
+ - [Usage](#usage)
14
+ - [Props](#props)
15
+ - [Styling](#styling)
16
+ - [Dependencies](#dependencies)
17
+ - [Button Component](#button-component)
18
+ - [Features](#features-1)
19
+ - [Installation](#installation-1)
20
+ - [Importing](#importing-1)
21
+ - [Usage](#usage-1)
22
+ - [Props](#props-1)
23
+ - [Styling](#styling-1)
24
+ - [Dependencies](#dependencies-1)
25
+ - [DropdownText Component](#dropdowntext-component)
26
+ - [Features](#features-2)
27
+ - [Installation](#installation-2)
28
+ - [Importing](#importing-2)
29
+ - [Usage](#usage-2)
30
+ - [Props](#props-2)
31
+ - [Styling](#styling-2)
32
+ - [Dependencies](#dependencies-2)
33
+
34
+ ## Carousel Component
35
+
36
+ A customizable Carousel component for React applications.
37
+
38
+ ### Features
39
+
40
+ - Dynamically display a list of items in a carousel format.
41
+ - Customizable background color, text color, wrapper height, and icon for each slide.
42
+ - Auto-scroll functionality with adjustable interval duration.
43
+ - Responsive design compatible with various screen sizes.
44
+ - Optional back bar with customizable color and angle for additional styling.
45
+
46
+ ### Installation
47
+
48
+ Install the Carousel component via npm:
49
+
50
+ ```bash
51
+ npm install smartziui
52
+ ```
53
+
54
+ ### Importing
55
+
56
+ Due to rendering methods, React and Next have some conflicts in using the Carousel Component. Further discussion will be mentioned under the "Next App usage" section.
57
+
58
+ #### For React App
59
+
60
+ ```jsx
61
+ import Carousel from "smartziui";
62
+ ```
63
+
64
+ #### For Next App
65
+
66
+ In Next.js apps, a normal import will cause a `Document is not defined` error. To overcome this, we have to import our Carousel Component for client-side rendering only. The reason is that we use the document object to get the browser dimension to increase compatibility with the user's browser. However, in server-side rendering, the browser window isn't available.
67
+
68
+ ```jsx
69
+ import dynamic from "next/dynamic";
70
+ const Carousel = dynamic(
71
+ () => import("smartziui").then((mod) => mod.Carousel),
72
+ {
73
+ ssr: false,
74
+ }
75
+ );
76
+ ```
77
+
78
+ ### Usage
79
+
80
+ Here is a basic example of how to use the Carousel component:
81
+
82
+ ```jsx
83
+ import React from 'react';
84
+ import Carousel from 'smartziui'; // Consider that Next.js import will be another method which mentioned above.
85
+
86
+ const App = () => {
87
+ const scrollContent = [
88
+ 'First item', 'Second item', 'Third item'
89
+ ];
90
+
91
+ return (
92
+ <Carousel
93
+ scrollContent=scrollContent,
94
+ intervalDuration={3000},
95
+ bgColor="#3FA535",
96
+ textColor="#FFFFFF",
97
+ WrapperHeight={50},
98
+ icon="<i class='bi bi-star-fill'></i>",
99
+ iconWidth={20},
100
+ scrollerId={0},
101
+ backBar=true,
102
+ backBarColor="#27205B",
103
+ backBarAngle="-2"
104
+ />
105
+ );
106
+ }
107
+
108
+ export default App;
109
+ ```
110
+
111
+ ### Props
112
+
113
+ | Prop | Type | Default | Description |
114
+ | ------------------ | -------- | ---------------------------------- | ----------------------------------------------------------------- |
115
+ | `scrollContent` | string[] | ['first item', 'second item', ...] | Array of strings to display in the carousel. |
116
+ | `intervalDuration` | number | 3000 | Duration (in milliseconds) before transitioning to the next item. |
117
+ | `bgColor` | string | "#3FA535" | Background color of the carousel wrapper. |
118
+ | `textColor` | string | "#FFFFFF" | Text color for the content in the carousel. |
119
+ | `WrapperHeight` | number | 50 | Minimum height of the carousel wrapper in pixels. |
120
+ | `icon` | string | "" | HTML string for an icon to display before the text. |
121
+ | `iconWidth` | number | 20 | Font size for the icon in pixels. |
122
+ | `scrollerID` | number | 0 | Only needed while using multiple carousels in one app. |
123
+ | `backBar` | boolean | true | Enable or disable the back bar behind the carousel. |
124
+ | `backBarColor` | string | "#27205B" | Background color of the back bar. |
125
+ | `backBarAngle` | string | "-2" | Rotation angle of the back bar in degrees. |
126
+
127
+ ### Styling
128
+
129
+ The Carousel component uses Bootstrap classes for styling and layout. You can override these styles by writing your own CSS rules. Ensure to import `Carousel.css` in your project for custom styles.
130
+
131
+ ### Dependencies
132
+
133
+ - React
134
+ - Bootstrap (for styling and responsive design)
135
+ - html-react-parser (to parse strings into HTML elements)
136
+
137
+ ## Button Component
138
+
139
+ A customizable Button component for React applications.
140
+
141
+ ### Features
142
+
143
+ - Customizable label and variant (e.g., primary, secondary, success, etc.).
144
+ - Simple implementation for adding buttons with different styles throughout the application.
145
+ - Scalable and reusable for various button requirements in a project.
146
+
147
+ ### Installation
148
+
149
+ Install the Button component via npm:
150
+
151
+ ```bash
152
+ npm install smartziui
153
+ ```
154
+
155
+ ### Importing
156
+
157
+ Import the Button component in your React application:
158
+
159
+ ```jsx
160
+ import Button from "smartziui/Button";
161
+ ```
162
+
163
+ ### Usage
164
+
165
+ Here is a basic example of how to use the Button component:
166
+
167
+ ```jsx
168
+ import React from 'react';
169
+ import Button from 'smartziui/Button';
170
+
171
+ const App = () => {
172
+ return (
173
+ <Button label="Click me" varient="primary" />
174
+ );
175
+ }
176
+
177
+ export default App;
178
+ ```
179
+
180
+ ### Props
181
+
182
+ | Prop | Type | Default | Description |
183
+ | --------- | ------ | ------- | --------------------------------------------------- |
184
+ | `label` | string | "Button" | Text to display on the button. |
185
+ | `variant` | string | "primary" | Variant style of the button (e.g., primary, secondary, success, etc.). |
186
+
187
+ ### Styling
188
+
189
+ The Button component uses its own CSS file for styling. You can customize the button styles by modifying the `Button.css` file in your project.
190
+
191
+ ### Dependencies
192
+
193
+ - React
194
+ - PropTypes (for prop validation)
195
+ ## DropdownText Component
196
+
197
+ A customizable DropdownText component for React applications.
198
+
199
+ ### Features
200
+
201
+ - Display a collapsible dropdown list with a parent and child items.
202
+ - Customizable parent text, child list, text color, and number of items displayed before scrolling.
203
+ - Simple implementation for creating dropdowns with various content.
204
+
205
+ ### Installation
206
+
207
+ Install the DropdownText component via npm:
208
+
209
+ ```bash
210
+ npm install smartziui
211
+ ```
212
+
213
+ ### Importing
214
+
215
+ Import the DropdownText component in your React application:
216
+
217
+ ```jsx
218
+ import DropdownText from "smartziui/DropdownText";
219
+ ```
220
+
221
+ ### Usage
222
+
223
+ Here is a basic example of how to use the DropdownText component:
224
+
225
+ ```jsx
226
+ import React from 'react';
227
+ import DropdownText from 'smartziui/DropdownText';
228
+
229
+ const App = () => {
230
+ return (
231
+ <DropdownText Parent="Parent" childList={["child1","child2","child3","child4"]} textColor="black" scrollOver={3} />
232
+ );
233
+ }
234
+
235
+ export default App;
236
+ ```
237
+
238
+ ### Props
239
+
240
+ | Prop | Type | Default | Description |
241
+ | ----------- | ------ | ------------- | ---------------------------------------------------------- |
242
+ | `Parent` | string | "Parent" | Text displayed for the parent item in the dropdown. |
243
+ | `childList` | array | ["child1",...] | Array of strings representing the child items in the dropdown. |
244
+ | `textColor` | string | "black" | Text color for both the parent and child items. |
245
+ | `scrollOver`| number | 3 | Number of items displayed before scrolling in the dropdown. |
246
+
247
+ ### Styling
248
+
249
+ The DropdownText component uses its own CSS file for styling. You can customize the dropdown styles by modifying the `DropdownText.css` file in your project.
250
+
251
+ ### Dependencies
252
+
253
+ - React
254
+ - PropTypes (for prop validation)