@windstream/react-shared-components 0.0.1

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 (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +360 -0
  3. package/dist/core.d.ts +389 -0
  4. package/dist/index.d.ts +389 -0
  5. package/dist/index.esm.js +35 -0
  6. package/dist/index.esm.js.map +1 -0
  7. package/dist/index.js +35 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/styles.css +3 -0
  10. package/dist/utils/index.d.ts +11 -0
  11. package/dist/utils/index.esm.js +2 -0
  12. package/dist/utils/index.esm.js.map +1 -0
  13. package/dist/utils/index.js +2 -0
  14. package/dist/utils/index.js.map +1 -0
  15. package/package.json +151 -0
  16. package/src/components/accordion/Accordion.stories.tsx +225 -0
  17. package/src/components/accordion/index.tsx +36 -0
  18. package/src/components/accordion/types.ts +10 -0
  19. package/src/components/alert-card/AlertCard.stories.tsx +172 -0
  20. package/src/components/alert-card/index.tsx +35 -0
  21. package/src/components/alert-card/types.ts +9 -0
  22. package/src/components/brand-button/BrandButton.stories.tsx +221 -0
  23. package/src/components/brand-button/helpers.ts +35 -0
  24. package/src/components/brand-button/index.tsx +90 -0
  25. package/src/components/brand-button/types.ts +27 -0
  26. package/src/components/button/Button.stories.tsx +108 -0
  27. package/src/components/button/index.tsx +23 -0
  28. package/src/components/button/types.ts +14 -0
  29. package/src/components/call-button/CallButton.stories.tsx +324 -0
  30. package/src/components/call-button/index.tsx +80 -0
  31. package/src/components/call-button/types.ts +9 -0
  32. package/src/components/checkbox/Checkbox.stories.tsx +248 -0
  33. package/src/components/checkbox/index.tsx +185 -0
  34. package/src/components/checkbox/types.ts +24 -0
  35. package/src/components/checklist/Checklist.stories.tsx +151 -0
  36. package/src/components/checklist/index.tsx +33 -0
  37. package/src/components/checklist/types.ts +6 -0
  38. package/src/components/collapse/Collapse.stories.tsx +256 -0
  39. package/src/components/collapse/index.tsx +44 -0
  40. package/src/components/collapse/types.ts +6 -0
  41. package/src/components/divider/Divider.stories.tsx +206 -0
  42. package/src/components/divider/index.tsx +23 -0
  43. package/src/components/divider/type.ts +3 -0
  44. package/src/components/input/Input.stories.tsx +358 -0
  45. package/src/components/input/index.tsx +174 -0
  46. package/src/components/input/types.ts +37 -0
  47. package/src/components/link/Link.stories.tsx +163 -0
  48. package/src/components/link/index.tsx +96 -0
  49. package/src/components/link/types.ts +25 -0
  50. package/src/components/list/List.stories.tsx +272 -0
  51. package/src/components/list/index.tsx +86 -0
  52. package/src/components/list/list-item/index.tsx +36 -0
  53. package/src/components/list/list-item/types.ts +13 -0
  54. package/src/components/list/types.ts +29 -0
  55. package/src/components/material-icon/MaterialIcon.stories.tsx +330 -0
  56. package/src/components/material-icon/constants.ts +95 -0
  57. package/src/components/material-icon/index.tsx +44 -0
  58. package/src/components/material-icon/types.ts +31 -0
  59. package/src/components/modal/Modal.stories.tsx +171 -0
  60. package/src/components/modal/index.tsx +168 -0
  61. package/src/components/modal/types.ts +24 -0
  62. package/src/components/radio-button/RadioButton.stories.tsx +307 -0
  63. package/src/components/radio-button/index.tsx +73 -0
  64. package/src/components/radio-button/types.ts +22 -0
  65. package/src/components/see-more/SeeMore.stories.tsx +182 -0
  66. package/src/components/see-more/index.tsx +38 -0
  67. package/src/components/see-more/types.ts +4 -0
  68. package/src/components/select/Select.stories.tsx +410 -0
  69. package/src/components/select/index.tsx +150 -0
  70. package/src/components/select/types.ts +34 -0
  71. package/src/components/select-plan-button/SelectPlanButton.stories.tsx +160 -0
  72. package/src/components/select-plan-button/index.tsx +21 -0
  73. package/src/components/select-plan-button/types.ts +4 -0
  74. package/src/components/skeleton/Skeleton.stories.tsx +180 -0
  75. package/src/components/skeleton/index.tsx +61 -0
  76. package/src/components/skeleton/types.ts +4 -0
  77. package/src/components/spinner/Spinner.stories.tsx +335 -0
  78. package/src/components/spinner/index.tsx +44 -0
  79. package/src/components/spinner/types.ts +5 -0
  80. package/src/components/text/Text.stories.tsx +302 -0
  81. package/src/components/text/index.tsx +26 -0
  82. package/src/components/text/types.ts +45 -0
  83. package/src/components/tooltip/Tooltip.stories.tsx +220 -0
  84. package/src/components/tooltip/index.tsx +78 -0
  85. package/src/components/tooltip/types.ts +7 -0
  86. package/src/components/view-cart-button/ViewCartButton.stories.tsx +241 -0
  87. package/src/components/view-cart-button/index.tsx +39 -0
  88. package/src/components/view-cart-button/types.ts +5 -0
  89. package/src/hooks/use-body-scroll-lock.ts +31 -0
  90. package/src/index.ts +81 -0
  91. package/src/setupTests.ts +46 -0
  92. package/src/stories/DocsTemplate.tsx +26 -0
  93. package/src/stories/assets/accessibility.png +0 -0
  94. package/src/stories/assets/accessibility.svg +1 -0
  95. package/src/stories/assets/addon-library.png +0 -0
  96. package/src/stories/assets/assets.png +0 -0
  97. package/src/stories/assets/avif-test-image.avif +0 -0
  98. package/src/stories/assets/context.png +0 -0
  99. package/src/stories/assets/discord.svg +1 -0
  100. package/src/stories/assets/docs.png +0 -0
  101. package/src/stories/assets/figma-plugin.png +0 -0
  102. package/src/stories/assets/github.svg +1 -0
  103. package/src/stories/assets/share.png +0 -0
  104. package/src/stories/assets/styling.png +0 -0
  105. package/src/stories/assets/testing.png +0 -0
  106. package/src/stories/assets/theming.png +0 -0
  107. package/src/stories/assets/tutorials.svg +1 -0
  108. package/src/stories/assets/youtube.svg +1 -0
  109. package/src/styles/globals.css +50 -0
  110. package/src/types/global.d.ts +9 -0
  111. package/src/utils/index.ts +49 -0
  112. package/tailwind.config.cjs +524 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Kinetic
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,360 @@
1
+ # @kinetic/react-shared-components
2
+
3
+ A comprehensive React component library built with TypeScript and Tailwind CSS, designed for Kinetic applications.
4
+
5
+ ## ๐Ÿš€ Features
6
+
7
+ - **TypeScript First**: Full TypeScript support with comprehensive type definitions
8
+ - **Tailwind CSS**: Built with Tailwind CSS for consistent design and easy customization
9
+ - **Modern React**: Built with React 18+ and modern hooks
10
+ - **Accessible**: Components follow accessibility best practices
11
+ - **Customizable**: Easy to customize with CSS variables and Tailwind classes
12
+ - **Tree-shakeable**: Optimized for bundle size with proper exports
13
+
14
+ ## ๐Ÿ“ฆ Installation
15
+
16
+ ```bash
17
+ npm install @kinetic/react-shared-components
18
+ # or
19
+ yarn add @kinetic/react-shared-components
20
+ # or
21
+ pnpm add @kinetic/react-shared-components
22
+ ```
23
+
24
+ ## ๐Ÿ”ง Setup
25
+
26
+ ### Tailwind CSS
27
+
28
+ This library requires Tailwind CSS to be installed in your project. Make sure you have Tailwind CSS configured:
29
+
30
+ ```bash
31
+ npm install -D tailwindcss postcss autoprefixer
32
+ npx tailwindcss init -p
33
+ ```
34
+
35
+ ### Import Styles
36
+
37
+ **Important**: Styles are NOT automatically included when you import components. You MUST manually import the CSS file in your application.
38
+
39
+ Import the library styles in your main CSS file (recommended approach):
40
+
41
+ ```css
42
+ @import '@kinetic/react-shared-components/dist/styles.css';
43
+ ```
44
+
45
+ Or import it directly in your JavaScript/TypeScript entry file:
46
+
47
+ ```tsx
48
+ import '@kinetic/react-shared-components/dist/styles.css';
49
+ ```
50
+
51
+ **CSS Import Order**: The order in which you import styles matters:
52
+ - If you want to override package styles with your own `globals.css`, import the package styles **before** your `globals.css`
53
+ - If you want package styles to take precedence, import them **after** your `globals.css`
54
+
55
+ Example with CSS import order control:
56
+
57
+ ```css
58
+ /* In your main CSS file (e.g., globals.css) */
59
+ /* Import package styles first */
60
+ @import '@kinetic/react-shared-components/dist/styles.css';
61
+
62
+ /* Then your app-specific overrides */
63
+ @tailwind base;
64
+ @tailwind components;
65
+ @tailwind utilities;
66
+
67
+ /* Your custom styles that can override package styles */
68
+ .bg-bg-fill-brand {
69
+ background-color: #your-custom-color;
70
+ }
71
+ ```
72
+
73
+ ## ๐ŸŽฏ Usage
74
+
75
+ ### Basic Usage
76
+
77
+ ```tsx
78
+ import { Button, Input, Text } from '@kinetic/react-shared-components/core';
79
+
80
+ function MyComponent() {
81
+ return (
82
+ <div>
83
+ <Text className="heading1">Welcome to Kinetic</Text>
84
+ <Input placeholder="Enter your name" />
85
+ <Button variant="primary">Submit</Button>
86
+ </div>
87
+ );
88
+ }
89
+ ```
90
+
91
+ ### Component Examples
92
+
93
+ #### Button
94
+
95
+ ```tsx
96
+ import { Button } from '@kinetic/react-shared-components/core';
97
+
98
+ // Different variants
99
+ <Button variant="primary">Primary Button</Button>
100
+ <Button variant="secondary">Secondary Button</Button>
101
+ <Button variant="outline">Outline Button</Button>
102
+
103
+ // Different sizes
104
+ <Button className="btn-small">Small</Button>
105
+ <Button className="btn-medium">Medium</Button>
106
+ <Button className="btn-large">Large</Button>
107
+
108
+ // With loading state
109
+ <Button isLoading>Loading...</Button>
110
+
111
+ // Full width
112
+ <Button fullWidth>Full Width Button</Button>
113
+ ```
114
+
115
+ #### Input
116
+
117
+ ```tsx
118
+ import { Input } from '@kinetic/react-shared-components/core';
119
+
120
+ <Input
121
+ placeholder="Enter text"
122
+ type="text"
123
+ variant="default"
124
+ size="medium"
125
+ />
126
+ ```
127
+
128
+ #### Text
129
+
130
+ ```tsx
131
+ import { Text } from '@kinetic/react-shared-components/core';
132
+
133
+ <Text className="heading1">Heading 1</Text>
134
+ <Text className="body1">Body text</Text>
135
+ <Text className="caption">Caption text</Text>
136
+ ```
137
+
138
+ ### Utilities
139
+
140
+ ```tsx
141
+ import { cx, clsx } from '@kinetic/react-shared-components/utils';
142
+
143
+ const classes = cx('btn', condition && 'btn-primary');
144
+ ```
145
+
146
+ ## ๐ŸŽจ Available Components
147
+
148
+ All components are available from the `/core` export path:
149
+
150
+ ```tsx
151
+ import {
152
+ Button,
153
+ Input,
154
+ Link,
155
+ List,
156
+ MaterialIcon,
157
+ Spinner,
158
+ Text,
159
+ CallButton,
160
+ Modal,
161
+ Accordion,
162
+ Checkbox,
163
+ Select,
164
+ AlertCard,
165
+ BrandButton,
166
+ Checklist,
167
+ Collapse,
168
+ Divider,
169
+ RadioButton,
170
+ SeeMore,
171
+ SelectPlanButton,
172
+ Skeleton,
173
+ Tooltip,
174
+ ViewCartButton
175
+ } from '@kinetic/react-shared-components/core';
176
+ ```
177
+
178
+ ### Core Components
179
+
180
+ - **Button** - Versatile button component with multiple variants and sizes
181
+ - **Input** - Form input component with validation states
182
+ - **Link** - Accessible link component
183
+ - **List** - List and list item components
184
+ - **MaterialIcon** - Material Design icon component
185
+ - **Spinner** - Loading spinner component
186
+ - **Text** - Typography component with predefined variants
187
+ - **CallButton** - Button component for call-to-action
188
+ - **Modal** - Modal dialog component
189
+ - **Accordion** - Collapsible accordion component
190
+ - **Checkbox** - Checkbox input component
191
+ - **Select** - Select dropdown component
192
+ - **AlertCard** - Alert notification card component
193
+ - **BrandButton** - Branded button variant
194
+ - **Checklist** - Checklist component
195
+ - **Collapse** - Collapsible content component
196
+ - **Divider** - Divider/separator component
197
+ - **RadioButton** - Radio button input component
198
+ - **SeeMore** - Expandable content component
199
+ - **SelectPlanButton** - Plan selection button
200
+ - **Skeleton** - Loading skeleton component
201
+ - **Tooltip** - Tooltip component
202
+ - **ViewCartButton** - Shopping cart button component
203
+
204
+ ### Component Variants
205
+
206
+ Each component comes with multiple variants and sizes to fit different use cases:
207
+
208
+ - **Variants**: default, primary, secondary, outline, unstyled
209
+ - **Sizes**: small, medium, large
210
+ - **States**: loading, disabled, error, success
211
+
212
+ ## ๐ŸŽจ Design System
213
+
214
+ This library follows the Kinetic design system with:
215
+
216
+ - **Color Palette**: Primary, secondary, and semantic colors
217
+ - **Typography**: Consistent font sizes and line heights
218
+ - **Spacing**: Standardized spacing scale
219
+ - **Shadows**: Consistent shadow system
220
+ - **Border Radius**: Unified border radius values
221
+
222
+ ## ๐Ÿ”ง Development
223
+
224
+ ### Prerequisites
225
+
226
+ - Node.js 16+
227
+ - npm 7+ or yarn 1.22+
228
+
229
+ ### Setup
230
+
231
+ ```bash
232
+ # Clone the repository
233
+ git clone <repository-url>
234
+ cd kinetic-react-shared-components
235
+
236
+ # Install dependencies
237
+ npm install
238
+
239
+ # Start development mode
240
+ npm run dev
241
+
242
+ # Build the library
243
+ npm run build
244
+
245
+ # Run tests
246
+ npm test
247
+
248
+ # Run linting
249
+ npm run lint
250
+
251
+ # Format code
252
+ npm run format
253
+ ```
254
+
255
+ ### Project Structure
256
+
257
+ ```
258
+ src/
259
+ โ”œโ”€โ”€ components/ # React components
260
+ โ”‚ โ”œโ”€โ”€ accordion/ # Accordion component
261
+ โ”‚ โ”œโ”€โ”€ alert-card/ # AlertCard component
262
+ โ”‚ โ”œโ”€โ”€ brand-button/ # BrandButton component
263
+ โ”‚ โ”œโ”€โ”€ button/ # Button component
264
+ โ”‚ โ”œโ”€โ”€ call-button/ # CallButton component
265
+ โ”‚ โ”œโ”€โ”€ checkbox/ # Checkbox component
266
+ โ”‚ โ”œโ”€โ”€ checklist/ # Checklist component
267
+ โ”‚ โ”œโ”€โ”€ collapse/ # Collapse component
268
+ โ”‚ โ”œโ”€โ”€ divider/ # Divider component
269
+ โ”‚ โ”œโ”€โ”€ input/ # Input component
270
+ โ”‚ โ”œโ”€โ”€ link/ # Link component
271
+ โ”‚ โ”œโ”€โ”€ list/ # List components
272
+ โ”‚ โ”œโ”€โ”€ material-icon/ # Icon component
273
+ โ”‚ โ”œโ”€โ”€ modal/ # Modal component
274
+ โ”‚ โ”œโ”€โ”€ radio-button/ # RadioButton component
275
+ โ”‚ โ”œโ”€โ”€ see-more/ # SeeMore component
276
+ โ”‚ โ”œโ”€โ”€ select/ # Select component
277
+ โ”‚ โ”œโ”€โ”€ select-plan-button/ # SelectPlanButton component
278
+ โ”‚ โ”œโ”€โ”€ skeleton/ # Skeleton component
279
+ โ”‚ โ”œโ”€โ”€ spinner/ # Spinner component
280
+ โ”‚ โ”œโ”€โ”€ text/ # Text component
281
+ โ”‚ โ”œโ”€โ”€ tooltip/ # Tooltip component
282
+ โ”‚ โ””โ”€โ”€ view-cart-button/ # ViewCartButton component
283
+ โ”œโ”€โ”€ hooks/ # Custom React hooks
284
+ โ”œโ”€โ”€ styles/ # Global styles and Tailwind config
285
+ โ”œโ”€โ”€ utils/ # Utility functions
286
+ โ””โ”€โ”€ index.ts # Main export file (exports all components)
287
+ ```
288
+
289
+ ### Building
290
+
291
+ The library is built using Rollup with the following outputs:
292
+
293
+ - **CommonJS**: `dist/index.js`
294
+ - **ES Modules**: `dist/index.esm.js`
295
+ - **TypeScript declarations**: `dist/index.d.ts`
296
+
297
+ All components are exported from a single entry point (`src/index.ts`), which allows for:
298
+ - Simplified build process
299
+ - Consistent import path: `@kinetic/react-shared-components/core`
300
+ - Tree-shaking support for optimal bundle sizes
301
+
302
+ ## ๐Ÿงช Testing
303
+
304
+ ```bash
305
+ # Run tests
306
+ npm test
307
+
308
+ # Run tests in watch mode
309
+ npm run test:watch
310
+
311
+ # Run tests with coverage
312
+ npm run test:coverage
313
+ ```
314
+
315
+ ## ๐Ÿ“ Contributing
316
+
317
+ 1. Fork the repository
318
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
319
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
320
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
321
+ 5. Open a Pull Request
322
+
323
+ ### Development Guidelines
324
+
325
+ - Follow the existing code style and conventions
326
+ - Write tests for new components and features
327
+ - Update documentation for any API changes
328
+ - Ensure all components are accessible
329
+ - Follow the established component structure
330
+
331
+ ## ๐Ÿ“„ License
332
+
333
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
334
+
335
+ ## ๐Ÿค Support
336
+
337
+ For support and questions:
338
+
339
+ - Create an issue in the GitHub repository
340
+ - Contact the Kinetic development team
341
+ - Check the documentation and examples
342
+
343
+ ## ๐Ÿ”„ Changelog
344
+
345
+ ### v0.1.0
346
+ - Initial release
347
+ - Core components: Button, Input, Link, List, MaterialIcon, Spinner, Text
348
+ - Additional components: CallButton, Modal, Accordion, Checkbox, Select, AlertCard, BrandButton, Checklist, Collapse, Divider, RadioButton, SeeMore, SelectPlanButton, Skeleton, Tooltip, ViewCartButton
349
+ - TypeScript support
350
+ - Tailwind CSS integration
351
+ - Unified `/core` export path for all components
352
+ - Simplified build process with single entry point
353
+ - Comprehensive documentation
354
+
355
+ ## ๐Ÿ“š Additional Resources
356
+
357
+ - [React Documentation](https://reactjs.org/)
358
+ - [Tailwind CSS Documentation](https://tailwindcss.com/)
359
+ - [TypeScript Documentation](https://www.typescriptlang.org/)
360
+ - [Kinetic Design System](https://design.kinetic.com/)