@windstream/react-shared-components 0.0.9 โ 0.0.11
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 +623 -623
- package/dist/contentful/index.d.ts +10 -6
- package/dist/contentful/index.esm.js +1 -1
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +1 -1
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +159 -159
- package/src/components/accordion/Accordion.stories.tsx +225 -225
- package/src/components/accordion/index.tsx +36 -36
- package/src/components/accordion/types.ts +9 -9
- package/src/components/alert-card/types.ts +9 -9
- package/src/components/brand-button/BrandButton.stories.tsx +221 -221
- package/src/components/brand-button/helpers.ts +35 -35
- package/src/components/brand-button/index.tsx +90 -90
- package/src/components/brand-button/types.ts +26 -26
- package/src/components/button/Button.stories.tsx +108 -108
- package/src/components/button/index.tsx +23 -23
- package/src/components/button/types.ts +14 -14
- package/src/components/call-button/CallButton.stories.tsx +324 -324
- package/src/components/call-button/index.tsx +80 -80
- package/src/components/call-button/types.ts +9 -9
- package/src/components/checkbox/Checkbox.stories.tsx +248 -248
- package/src/components/checkbox/types.ts +23 -23
- package/src/components/checklist/Checklist.stories.tsx +151 -151
- package/src/components/checklist/index.tsx +33 -33
- package/src/components/checklist/types.ts +5 -5
- package/src/components/collapse/Collapse.stories.tsx +256 -256
- package/src/components/collapse/index.tsx +44 -44
- package/src/components/collapse/types.ts +5 -5
- package/src/components/divider/Divider.stories.tsx +206 -206
- package/src/components/divider/index.tsx +23 -23
- package/src/components/divider/type.ts +2 -2
- package/src/components/input/Input.stories.tsx +358 -358
- package/src/components/input/index.tsx +174 -174
- package/src/components/input/types.ts +36 -36
- package/src/components/link/Link.stories.tsx +163 -163
- package/src/components/link/index.tsx +96 -96
- package/src/components/link/types.ts +25 -25
- package/src/components/list/List.stories.tsx +272 -272
- package/src/components/list/index.tsx +86 -86
- package/src/components/list/list-item/index.tsx +36 -36
- package/src/components/list/list-item/types.ts +13 -13
- package/src/components/list/types.ts +29 -29
- package/src/components/material-icon/MaterialIcon.stories.tsx +330 -330
- package/src/components/material-icon/constants.ts +95 -95
- package/src/components/material-icon/index.tsx +44 -44
- package/src/components/material-icon/types.ts +31 -31
- package/src/components/modal/Modal.stories.tsx +171 -171
- package/src/components/modal/index.tsx +168 -168
- package/src/components/modal/types.ts +23 -23
- package/src/components/radio-button/index.tsx +73 -73
- package/src/components/radio-button/types.ts +21 -21
- package/src/components/see-more/SeeMore.stories.tsx +182 -182
- package/src/components/see-more/index.tsx +38 -38
- package/src/components/see-more/types.ts +3 -3
- package/src/components/select/Select.stories.tsx +410 -410
- package/src/components/select/index.tsx +150 -150
- package/src/components/select/types.ts +34 -34
- package/src/components/select-plan-button/SelectPlanButton.stories.tsx +160 -160
- package/src/components/select-plan-button/index.tsx +20 -20
- package/src/components/select-plan-button/types.ts +3 -3
- package/src/components/skeleton/Skeleton.stories.tsx +180 -180
- package/src/components/skeleton/index.tsx +61 -61
- package/src/components/skeleton/types.ts +3 -3
- package/src/components/spinner/Spinner.stories.tsx +335 -335
- package/src/components/spinner/index.tsx +44 -44
- package/src/components/spinner/types.ts +4 -4
- package/src/components/text/Text.stories.tsx +302 -302
- package/src/components/text/index.tsx +26 -26
- package/src/components/text/types.ts +45 -45
- package/src/components/tooltip/Tooltip.stories.tsx +220 -220
- package/src/components/tooltip/index.tsx +78 -78
- package/src/components/tooltip/types.ts +6 -6
- package/src/components/view-cart-button/ViewCartButton.stories.tsx +241 -241
- package/src/components/view-cart-button/index.tsx +38 -38
- package/src/components/view-cart-button/types.ts +4 -4
- package/src/contentful/blocks/accordion/index.tsx +7 -7
- package/src/contentful/blocks/button/index.tsx +5 -5
- package/src/contentful/blocks/callout/index.tsx +7 -7
- package/src/contentful/blocks/cards/index.tsx +7 -7
- package/src/contentful/blocks/carousel/index.tsx +7 -7
- package/src/contentful/blocks/cta-callout/index.tsx +6 -0
- package/src/contentful/blocks/cta-callout/types.ts +1 -0
- package/src/contentful/blocks/floating-banner/index.tsx +7 -7
- package/src/contentful/blocks/footer/index.tsx +7 -7
- package/src/contentful/blocks/image-promo-bar/index.tsx +7 -7
- package/src/contentful/blocks/modal/index.tsx +5 -5
- package/src/contentful/blocks/navigation/index.tsx +7 -7
- package/src/contentful/blocks/primary-hero/index.tsx +7 -7
- package/src/contentful/blocks/shape-background-wrapper/index.tsx +123 -101
- package/src/contentful/blocks/shape-background-wrapper/types.ts +35 -29
- package/src/contentful/blocks/text/index.tsx +6 -6
- package/src/contentful/index.ts +4 -1
- package/src/hooks/use-body-scroll-lock.ts +31 -31
- package/src/index.ts +81 -81
- package/src/setupTests.ts +46 -46
- package/src/styles/globals.css +275 -269
- package/src/types/global.d.ts +9 -9
- package/src/utils/index.ts +49 -49
package/README.md
CHANGED
|
@@ -1,623 +1,623 @@
|
|
|
1
|
-
# @windstream/react-shared-components
|
|
2
|
-
|
|
3
|
-
A comprehensive React component library built with TypeScript and Tailwind CSS, designed for Kinetic applications. This library provides a complete set of reusable UI components following the Kinetic design system.
|
|
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
|
-
- **Storybook**: Interactive component documentation and development environment
|
|
14
|
-
- **Design System**: Comprehensive design tokens following Kinetic brand guidelines
|
|
15
|
-
- **Material Icons**: Built-in Material Symbols Rounded icon support
|
|
16
|
-
|
|
17
|
-
## ๐ฆ Installation
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
npm install @windstream/react-shared-components
|
|
21
|
-
# or
|
|
22
|
-
yarn add @windstream/react-shared-components
|
|
23
|
-
# or
|
|
24
|
-
pnpm add @windstream/react-shared-components
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## ๐ง Setup
|
|
28
|
-
|
|
29
|
-
### Prerequisites
|
|
30
|
-
|
|
31
|
-
- React 18.0.0 or higher
|
|
32
|
-
- React DOM 18.0.0 or higher
|
|
33
|
-
- Tailwind CSS 3.4+ (for styling)
|
|
34
|
-
|
|
35
|
-
### Tailwind CSS Configuration
|
|
36
|
-
|
|
37
|
-
This library requires Tailwind CSS to be installed and configured in your project. You can extend the library's Tailwind configuration:
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
// tailwind.config.js
|
|
41
|
-
const sharedConfig = require('@windstream/react-shared-components/tailwind.config');
|
|
42
|
-
|
|
43
|
-
module.exports = {
|
|
44
|
-
...sharedConfig,
|
|
45
|
-
content: [
|
|
46
|
-
'./src/**/*.{js,jsx,ts,tsx}',
|
|
47
|
-
'./node_modules/@windstream/react-shared-components/src/**/*.{js,jsx,ts,tsx}',
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Or import the Tailwind config directly:
|
|
53
|
-
|
|
54
|
-
```js
|
|
55
|
-
// tailwind.config.js
|
|
56
|
-
module.exports = {
|
|
57
|
-
presets: [require('@windstream/react-shared-components/tailwind.config')],
|
|
58
|
-
content: [
|
|
59
|
-
'./src/**/*.{js,jsx,ts,tsx}',
|
|
60
|
-
'./node_modules/@windstream/react-shared-components/src/**/*.{js,jsx,ts,tsx}',
|
|
61
|
-
],
|
|
62
|
-
};
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## ๐ฏ Usage
|
|
66
|
-
|
|
67
|
-
### Basic Usage
|
|
68
|
-
|
|
69
|
-
```tsx
|
|
70
|
-
import { Button, Input, Text } from '@windstream/react-shared-components/core';
|
|
71
|
-
|
|
72
|
-
function MyComponent() {
|
|
73
|
-
return (
|
|
74
|
-
<div>
|
|
75
|
-
<Text className="heading1">Welcome to Kinetic</Text>
|
|
76
|
-
<Input placeholder="Enter your name" />
|
|
77
|
-
<Button variant="primary">Submit</Button>
|
|
78
|
-
</div>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### Import Paths
|
|
84
|
-
|
|
85
|
-
The library provides multiple export paths for different use cases:
|
|
86
|
-
|
|
87
|
-
```tsx
|
|
88
|
-
// Core components (recommended)
|
|
89
|
-
import { Button, Input, Text } from '@windstream/react-shared-components/core';
|
|
90
|
-
|
|
91
|
-
// Utilities
|
|
92
|
-
import { cx, clsx } from '@windstream/react-shared-components/utils';
|
|
93
|
-
|
|
94
|
-
// Styles (required - styles are not automatically included)
|
|
95
|
-
import '@windstream/react-shared-components/dist/styles.css';
|
|
96
|
-
// Or in CSS: @import '@windstream/react-shared-components/dist/styles.css';
|
|
97
|
-
|
|
98
|
-
// Tailwind config
|
|
99
|
-
const tailwindConfig = require('@windstream/react-shared-components/tailwind.config');
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Component Examples
|
|
103
|
-
|
|
104
|
-
#### Button
|
|
105
|
-
|
|
106
|
-
```tsx
|
|
107
|
-
import { Button } from '@windstream/react-shared-components/core';
|
|
108
|
-
|
|
109
|
-
// Different variants
|
|
110
|
-
<Button variant="primary">Primary Button</Button>
|
|
111
|
-
<Button variant="secondary">Secondary Button</Button>
|
|
112
|
-
<Button variant="outline">Outline Button</Button>
|
|
113
|
-
|
|
114
|
-
// Different sizes
|
|
115
|
-
<Button className="btn-small">Small</Button>
|
|
116
|
-
<Button className="btn-medium">Medium</Button>
|
|
117
|
-
<Button className="btn-large">Large</Button>
|
|
118
|
-
|
|
119
|
-
// With loading state
|
|
120
|
-
<Button isLoading>Loading...</Button>
|
|
121
|
-
|
|
122
|
-
// Full width
|
|
123
|
-
<Button fullWidth>Full Width Button</Button>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
#### Input
|
|
127
|
-
|
|
128
|
-
```tsx
|
|
129
|
-
import { Input, InputField, TextInput } from '@windstream/react-shared-components/core';
|
|
130
|
-
|
|
131
|
-
// Input, InputField, and TextInput are all aliases for the same component
|
|
132
|
-
<Input
|
|
133
|
-
placeholder="Enter text"
|
|
134
|
-
type="text"
|
|
135
|
-
variant="default"
|
|
136
|
-
size="medium"
|
|
137
|
-
/>
|
|
138
|
-
|
|
139
|
-
<InputField
|
|
140
|
-
placeholder="Enter text"
|
|
141
|
-
label="Name"
|
|
142
|
-
/>
|
|
143
|
-
|
|
144
|
-
<TextInput
|
|
145
|
-
placeholder="Enter text"
|
|
146
|
-
/>
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
#### Text
|
|
150
|
-
|
|
151
|
-
```tsx
|
|
152
|
-
import { Text } from '@windstream/react-shared-components/core';
|
|
153
|
-
|
|
154
|
-
<Text className="heading1">Heading 1</Text>
|
|
155
|
-
<Text className="body1">Body text</Text>
|
|
156
|
-
<Text className="caption">Caption text</Text>
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
### Utilities
|
|
160
|
-
|
|
161
|
-
The `cx` utility is an enhanced version of `clsx` that intelligently merges Tailwind classes:
|
|
162
|
-
|
|
163
|
-
```tsx
|
|
164
|
-
import { cx, clsx } from '@windstream/react-shared-components/utils';
|
|
165
|
-
|
|
166
|
-
// cx automatically merges conflicting Tailwind classes
|
|
167
|
-
const classes = cx('btn', 'btn-primary', condition && 'btn-secondary');
|
|
168
|
-
// If condition is true, btn-secondary will override btn-primary
|
|
169
|
-
|
|
170
|
-
// clsx is also available for basic class name concatenation
|
|
171
|
-
const basicClasses = clsx('btn', condition && 'active');
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Hooks
|
|
175
|
-
|
|
176
|
-
```tsx
|
|
177
|
-
import { useBodyScrollLock } from '@windstream/react-shared-components/core';
|
|
178
|
-
|
|
179
|
-
function Modal({ isOpen }) {
|
|
180
|
-
// Lock body scroll when modal is open
|
|
181
|
-
useBodyScrollLock(isOpen, true);
|
|
182
|
-
|
|
183
|
-
return (
|
|
184
|
-
// Modal content
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
## ๐จ Available Components
|
|
190
|
-
|
|
191
|
-
All components are available from the `/core` export path:
|
|
192
|
-
|
|
193
|
-
```tsx
|
|
194
|
-
import {
|
|
195
|
-
Button,
|
|
196
|
-
Input,
|
|
197
|
-
InputField,
|
|
198
|
-
TextInput,
|
|
199
|
-
Link,
|
|
200
|
-
List,
|
|
201
|
-
ListItem,
|
|
202
|
-
MaterialIcon,
|
|
203
|
-
Spinner,
|
|
204
|
-
Text,
|
|
205
|
-
CallButton,
|
|
206
|
-
Modal,
|
|
207
|
-
Accordion,
|
|
208
|
-
Checkbox,
|
|
209
|
-
Select,
|
|
210
|
-
AlertCard,
|
|
211
|
-
BrandButton,
|
|
212
|
-
Checklist,
|
|
213
|
-
Collapse,
|
|
214
|
-
Divider,
|
|
215
|
-
RadioButton,
|
|
216
|
-
SeeMore,
|
|
217
|
-
SelectPlanButton,
|
|
218
|
-
Skeleton,
|
|
219
|
-
PageSkeleton,
|
|
220
|
-
Tooltip,
|
|
221
|
-
ViewCartButton,
|
|
222
|
-
useBodyScrollLock
|
|
223
|
-
} from '@windstream/react-shared-components/core';
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### Core Components
|
|
227
|
-
|
|
228
|
-
- **Button** - Versatile button component with multiple variants and sizes
|
|
229
|
-
- **Input / InputField / TextInput** - Form input component with validation states (all are aliases)
|
|
230
|
-
- **Link** - Accessible link component
|
|
231
|
-
- **List / ListItem** - List and list item components
|
|
232
|
-
- **MaterialIcon** - Material Design icon component using Material Symbols Rounded
|
|
233
|
-
- **Spinner** - Loading spinner component
|
|
234
|
-
- **Text** - Typography component with predefined variants (heading1-6, body1-3, etc.)
|
|
235
|
-
- **CallButton** - Button component for call-to-action
|
|
236
|
-
- **Modal** - Modal dialog component with customizable size, shape, and animations
|
|
237
|
-
- **Accordion** - Collapsible accordion component
|
|
238
|
-
- **Checkbox** - Checkbox input component
|
|
239
|
-
- **Select** - Select dropdown component (powered by react-select)
|
|
240
|
-
- **AlertCard** - Alert notification card component
|
|
241
|
-
- **BrandButton** - Branded button variant with responsive sizing
|
|
242
|
-
- **Checklist** - Checklist component
|
|
243
|
-
- **Collapse** - Collapsible content component
|
|
244
|
-
- **Divider** - Divider/separator component
|
|
245
|
-
- **RadioButton** - Radio button input component
|
|
246
|
-
- **SeeMore** - Expandable content component
|
|
247
|
-
- **SelectPlanButton** - Plan selection button
|
|
248
|
-
- **Skeleton / PageSkeleton** - Loading skeleton components
|
|
249
|
-
- **Tooltip** - Tooltip component
|
|
250
|
-
- **ViewCartButton** - Shopping cart button component
|
|
251
|
-
|
|
252
|
-
### Custom Hooks
|
|
253
|
-
|
|
254
|
-
- **useBodyScrollLock** - Hook to lock/unlock body scroll (useful for modals)
|
|
255
|
-
|
|
256
|
-
### Component Variants
|
|
257
|
-
|
|
258
|
-
Each component comes with multiple variants and sizes to fit different use cases:
|
|
259
|
-
|
|
260
|
-
- **Variants**: default, primary, secondary, outline, unstyled
|
|
261
|
-
- **Sizes**: small (btn-small), medium (btn-medium), large (btn-large), x-large (btn-x-large)
|
|
262
|
-
- **States**: loading, disabled, error, success
|
|
263
|
-
|
|
264
|
-
### Typography Variants
|
|
265
|
-
|
|
266
|
-
The `Text` component supports the following typography variants via className:
|
|
267
|
-
|
|
268
|
-
- **Headings**: `heading1`, `heading2`, `heading3`, `heading4`, `heading5`, `heading6`
|
|
269
|
-
- **Subheadings**: `subheading1`, `subheading2`, `subheading3`, `subheading4`, `subheading5`, `subheading6`
|
|
270
|
-
- **Body**: `body1`, `body2`, `body3`
|
|
271
|
-
- **Labels**: `label1`, `label2`, `label3`, `label4`, `label5`, `label6`
|
|
272
|
-
- **Other**: `footnote`, `micro`
|
|
273
|
-
|
|
274
|
-
## ๐จ Design System
|
|
275
|
-
|
|
276
|
-
This library follows the Kinetic design system with comprehensive design tokens:
|
|
277
|
-
|
|
278
|
-
### Color System
|
|
279
|
-
|
|
280
|
-
- **Brand Colors**: Primary brand color (#24A76A) with variants (accent, active, hover, disabled, etc.)
|
|
281
|
-
- **Semantic Colors**: Success, critical (error), info, inverse
|
|
282
|
-
- **Surface Colors**: Background fills, surfaces with states (active, hover, selected, disabled)
|
|
283
|
-
- **Text Colors**: Default, brand, critical, secondary, inverse, disabled
|
|
284
|
-
- **Border Colors**: Default, brand, critical, focus, hover, disabled
|
|
285
|
-
- **Icon Colors**: Brand, critical, default, info, inverse, secondary, success
|
|
286
|
-
|
|
287
|
-
### Typography
|
|
288
|
-
|
|
289
|
-
- **Font Families**:
|
|
290
|
-
- Sans-serif (configurable via CSS variable `--win-site-font`)
|
|
291
|
-
- Material Symbols Rounded (for icons)
|
|
292
|
-
- Figtree (for body text)
|
|
293
|
-
- **Font Sizes**: Comprehensive scale from micro (12px) to heading1 (48px)
|
|
294
|
-
- **Line Heights**: Standardized line heights for optimal readability
|
|
295
|
-
|
|
296
|
-
### Spacing & Layout
|
|
297
|
-
|
|
298
|
-
- **Spacing Scale**: Custom spacing values (1.5, 2, 3, 4, 4.5, 6, 7, 13, 15, 17, 18, 26)
|
|
299
|
-
- **Border Radius**: Custom radius values (2.5, 3.5, 2xl, 2.5xl, 4xl)
|
|
300
|
-
- **Shadows**: drop, light, cardDrop, card
|
|
301
|
-
|
|
302
|
-
### Responsive Breakpoints
|
|
303
|
-
|
|
304
|
-
- `sm`: 640px
|
|
305
|
-
- `md`: 768px
|
|
306
|
-
- `lg`: 1024px
|
|
307
|
-
- `xl`: 1280px
|
|
308
|
-
- `max`: 1200px
|
|
309
|
-
|
|
310
|
-
## ๐ง Development
|
|
311
|
-
|
|
312
|
-
### Prerequisites
|
|
313
|
-
|
|
314
|
-
- Node.js 16+
|
|
315
|
-
- npm 7+ or yarn 1.22+
|
|
316
|
-
|
|
317
|
-
### Setup
|
|
318
|
-
|
|
319
|
-
```bash
|
|
320
|
-
# Clone the repository
|
|
321
|
-
git clone <repository-url>
|
|
322
|
-
cd kinetic-react-shared-components
|
|
323
|
-
|
|
324
|
-
# Install dependencies
|
|
325
|
-
npm install
|
|
326
|
-
|
|
327
|
-
# Start development mode (watch mode)
|
|
328
|
-
npm run dev
|
|
329
|
-
|
|
330
|
-
# Build the library
|
|
331
|
-
npm run build
|
|
332
|
-
|
|
333
|
-
# Run tests
|
|
334
|
-
npm test
|
|
335
|
-
|
|
336
|
-
# Run tests in watch mode
|
|
337
|
-
npm run test:watch
|
|
338
|
-
|
|
339
|
-
# Run linting
|
|
340
|
-
npm run lint
|
|
341
|
-
|
|
342
|
-
# Fix linting issues
|
|
343
|
-
npm run lint:fix
|
|
344
|
-
|
|
345
|
-
# Format code
|
|
346
|
-
npm run format
|
|
347
|
-
|
|
348
|
-
# Check code formatting
|
|
349
|
-
npm run format:check
|
|
350
|
-
|
|
351
|
-
# Type check
|
|
352
|
-
npm run type-check
|
|
353
|
-
|
|
354
|
-
# Start Storybook (component documentation)
|
|
355
|
-
npm run storybook
|
|
356
|
-
|
|
357
|
-
# Build Storybook
|
|
358
|
-
npm run build-storybook
|
|
359
|
-
|
|
360
|
-
# Clean build artifacts
|
|
361
|
-
npm run clean
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### Project Structure
|
|
365
|
-
|
|
366
|
-
```
|
|
367
|
-
src/
|
|
368
|
-
โโโ components/ # React components
|
|
369
|
-
โ โโโ accordion/ # Accordion component
|
|
370
|
-
โ โโโ alert-card/ # AlertCard component
|
|
371
|
-
โ โโโ brand-button/ # BrandButton component
|
|
372
|
-
โ โโโ button/ # Button component
|
|
373
|
-
โ โโโ call-button/ # CallButton component
|
|
374
|
-
โ โโโ checkbox/ # Checkbox component
|
|
375
|
-
โ โโโ checklist/ # Checklist component
|
|
376
|
-
โ โโโ collapse/ # Collapse component
|
|
377
|
-
โ โโโ divider/ # Divider component
|
|
378
|
-
โ โโโ input/ # Input component
|
|
379
|
-
โ โโโ link/ # Link component
|
|
380
|
-
โ โโโ list/ # List components
|
|
381
|
-
โ โโโ material-icon/ # Icon component
|
|
382
|
-
โ โโโ modal/ # Modal component
|
|
383
|
-
โ โโโ radio-button/ # RadioButton component
|
|
384
|
-
โ โโโ see-more/ # SeeMore component
|
|
385
|
-
โ โโโ select/ # Select component
|
|
386
|
-
โ โโโ select-plan-button/ # SelectPlanButton component
|
|
387
|
-
โ โโโ skeleton/ # Skeleton component
|
|
388
|
-
โ โโโ spinner/ # Spinner component
|
|
389
|
-
โ โโโ text/ # Text component
|
|
390
|
-
โ โโโ tooltip/ # Tooltip component
|
|
391
|
-
โ โโโ view-cart-button/ # ViewCartButton component
|
|
392
|
-
โโโ hooks/ # Custom React hooks
|
|
393
|
-
โโโ styles/ # Global styles and Tailwind config
|
|
394
|
-
โโโ utils/ # Utility functions
|
|
395
|
-
โโโ index.ts # Main export file (exports all components)
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Building
|
|
399
|
-
|
|
400
|
-
The library is built using Rollup with the following outputs:
|
|
401
|
-
|
|
402
|
-
- **CommonJS**: `dist/index.js` and `dist/utils/index.js`
|
|
403
|
-
- **ES Modules**: `dist/index.esm.js` and `dist/utils/index.esm.js`
|
|
404
|
-
- **TypeScript declarations**: `dist/index.d.ts`, `dist/core.d.ts`, and `dist/utils/index.d.ts`
|
|
405
|
-
- **Styles**: `dist/styles.css` (extracted and minified)
|
|
406
|
-
|
|
407
|
-
All components are exported from a single entry point (`src/index.ts`), which allows for:
|
|
408
|
-
- Simplified build process
|
|
409
|
-
- Consistent import path: `@windstream/react-shared-components/core`
|
|
410
|
-
- Tree-shaking support for optimal bundle sizes
|
|
411
|
-
- Separate utils export path for utility-only imports
|
|
412
|
-
|
|
413
|
-
### Package Exports
|
|
414
|
-
|
|
415
|
-
The package provides the following export paths:
|
|
416
|
-
|
|
417
|
-
- `@windstream/react-shared-components/core` - All components and hooks
|
|
418
|
-
- `@windstream/react-shared-components/utils` - Utility functions (cx, clsx)
|
|
419
|
-
- `@windstream/react-shared-components/styles.css` - Compiled CSS styles
|
|
420
|
-
- `@windstream/react-shared-components/tailwind.config` - Tailwind configuration
|
|
421
|
-
|
|
422
|
-
## ๐ฆ Publishing
|
|
423
|
-
|
|
424
|
-
### Prerequisites
|
|
425
|
-
|
|
426
|
-
Before publishing the package, ensure you have:
|
|
427
|
-
|
|
428
|
-
1. **npm account**: An account on npmjs.com with access to the `@windstream` organization
|
|
429
|
-
2. **Authentication**: Logged in to npm via `npm login` or using an authentication token
|
|
430
|
-
3. **Organization access**: Permission to publish packages under the `@windstream` scope
|
|
431
|
-
|
|
432
|
-
### Publishing Steps
|
|
433
|
-
|
|
434
|
-
1. **Ensure you're authenticated**:
|
|
435
|
-
```bash
|
|
436
|
-
npm login
|
|
437
|
-
# Or verify your authentication
|
|
438
|
-
npm whoami
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
2. **Update the version** in `package.json`:
|
|
442
|
-
```bash
|
|
443
|
-
# For patch version (0.0.4 -> 0.0.5)
|
|
444
|
-
npm version patch
|
|
445
|
-
|
|
446
|
-
# For minor version (0.0.4 -> 0.1.0)
|
|
447
|
-
npm version minor
|
|
448
|
-
|
|
449
|
-
# For major version (0.0.4 -> 1.0.0)
|
|
450
|
-
npm version major
|
|
451
|
-
```
|
|
452
|
-
|
|
453
|
-
Or manually update the `version` field in `package.json` and commit the change.
|
|
454
|
-
|
|
455
|
-
3. **Build the package**:
|
|
456
|
-
```bash
|
|
457
|
-
npm run build
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
This will:
|
|
461
|
-
- Clean the `dist` directory
|
|
462
|
-
- Build CommonJS and ES Module outputs
|
|
463
|
-
- Generate TypeScript declarations
|
|
464
|
-
- Extract and minify CSS styles
|
|
465
|
-
|
|
466
|
-
4. **Verify the build**:
|
|
467
|
-
```bash
|
|
468
|
-
# Check that dist directory contains all necessary files
|
|
469
|
-
ls -la dist/
|
|
470
|
-
```
|
|
471
|
-
|
|
472
|
-
Ensure the following files exist:
|
|
473
|
-
- `dist/index.js` (CommonJS)
|
|
474
|
-
- `dist/index.esm.js` (ES Modules)
|
|
475
|
-
- `dist/index.d.ts` (TypeScript declarations)
|
|
476
|
-
- `dist/core.d.ts` (Core types)
|
|
477
|
-
- `dist/utils/index.js` (Utils CommonJS)
|
|
478
|
-
- `dist/utils/index.esm.js` (Utils ES Modules)
|
|
479
|
-
- `dist/utils/index.d.ts` (Utils types)
|
|
480
|
-
- `dist/styles.css` (Compiled CSS)
|
|
481
|
-
|
|
482
|
-
5. **Run tests** (optional but recommended):
|
|
483
|
-
```bash
|
|
484
|
-
npm test
|
|
485
|
-
npm run type-check
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
6. **Publish to npm**:
|
|
489
|
-
```bash
|
|
490
|
-
# Dry run to see what would be published
|
|
491
|
-
npm publish --dry-run
|
|
492
|
-
|
|
493
|
-
# Publish to npm
|
|
494
|
-
npm publish --access public
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
Note: The `--access public` flag is required for scoped packages (`@windstream/...`) when publishing to the public npm registry.
|
|
498
|
-
|
|
499
|
-
7. **Create a git tag** (if you used `npm version`, this is done automatically):
|
|
500
|
-
```bash
|
|
501
|
-
# If you manually updated the version, create and push the tag
|
|
502
|
-
git tag v0.0.4
|
|
503
|
-
git push origin v0.0.4
|
|
504
|
-
```
|
|
505
|
-
|
|
506
|
-
8. **Push changes to repository**:
|
|
507
|
-
```bash
|
|
508
|
-
git push origin main
|
|
509
|
-
```
|
|
510
|
-
|
|
511
|
-
### Version Management
|
|
512
|
-
|
|
513
|
-
Follow [Semantic Versioning](https://semver.org/) (semver):
|
|
514
|
-
|
|
515
|
-
- **MAJOR** version (1.0.0): Breaking changes
|
|
516
|
-
- **MINOR** version (0.1.0): New features (backward compatible)
|
|
517
|
-
- **PATCH** version (0.0.5): Bug fixes (backward compatible)
|
|
518
|
-
|
|
519
|
-
### Publishing Checklist
|
|
520
|
-
|
|
521
|
-
Before publishing, verify:
|
|
522
|
-
|
|
523
|
-
- [ ] All tests pass (`npm test`)
|
|
524
|
-
- [ ] Type checking passes (`npm run type-check`)
|
|
525
|
-
- [ ] Linting passes (`npm run lint`)
|
|
526
|
-
- [ ] Build completes successfully (`npm run build`)
|
|
527
|
-
- [ ] Version number is updated in `package.json`
|
|
528
|
-
- [ ] README is up to date
|
|
529
|
-
- [ ] All changes are committed
|
|
530
|
-
- [ ] You're logged in to npm (`npm whoami`)
|
|
531
|
-
|
|
532
|
-
## ๐งช Testing
|
|
533
|
-
|
|
534
|
-
The library uses Jest and React Testing Library for testing:
|
|
535
|
-
|
|
536
|
-
```bash
|
|
537
|
-
# Run tests
|
|
538
|
-
npm test
|
|
539
|
-
|
|
540
|
-
# Run tests in watch mode
|
|
541
|
-
npm run test:watch
|
|
542
|
-
|
|
543
|
-
# Run tests with coverage
|
|
544
|
-
npm run test:coverage
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
Test files should be named `*.test.ts` or `*.test.tsx` and placed alongside the components they test.
|
|
548
|
-
|
|
549
|
-
## ๐ Contributing
|
|
550
|
-
|
|
551
|
-
1. Fork the repository
|
|
552
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
553
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
554
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
555
|
-
5. Open a Pull Request
|
|
556
|
-
|
|
557
|
-
### Development Guidelines
|
|
558
|
-
|
|
559
|
-
- Follow the existing code style and conventions
|
|
560
|
-
- Write tests for new components and features
|
|
561
|
-
- Update documentation for any API changes
|
|
562
|
-
- Ensure all components are accessible
|
|
563
|
-
- Follow the established component structure
|
|
564
|
-
|
|
565
|
-
## ๐ License
|
|
566
|
-
|
|
567
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
568
|
-
|
|
569
|
-
## ๐ค Support
|
|
570
|
-
|
|
571
|
-
For support and questions:
|
|
572
|
-
|
|
573
|
-
- Create an issue in the GitHub repository
|
|
574
|
-
- Contact the Kinetic development team
|
|
575
|
-
- Check the documentation and examples
|
|
576
|
-
|
|
577
|
-
## ๐ Changelog
|
|
578
|
-
|
|
579
|
-
### v0.0.4
|
|
580
|
-
- Current version
|
|
581
|
-
- 23+ React components with full TypeScript support
|
|
582
|
-
- Comprehensive design system with Tailwind CSS
|
|
583
|
-
- Material Symbols Rounded icon support
|
|
584
|
-
- Storybook integration for component documentation
|
|
585
|
-
- Custom hooks (useBodyScrollLock)
|
|
586
|
-
- Utility functions (cx, clsx) with Tailwind class merging
|
|
587
|
-
- Multiple export paths (core, utils, styles, tailwind.config)
|
|
588
|
-
- CommonJS and ES Module builds
|
|
589
|
-
- Full type definitions
|
|
590
|
-
|
|
591
|
-
### Components Included
|
|
592
|
-
- **Form Components**: Button, Input, Checkbox, RadioButton, Select
|
|
593
|
-
- **Layout Components**: List, ListItem, Divider, Collapse, Accordion
|
|
594
|
-
- **Feedback Components**: Spinner, Skeleton, PageSkeleton, AlertCard, Tooltip
|
|
595
|
-
- **Navigation Components**: Link, Modal, SeeMore
|
|
596
|
-
- **Specialized Components**: CallButton, BrandButton, SelectPlanButton, ViewCartButton
|
|
597
|
-
- **Typography**: Text component with comprehensive variant system
|
|
598
|
-
- **Icons**: MaterialIcon component
|
|
599
|
-
|
|
600
|
-
## ๐ Additional Resources
|
|
601
|
-
|
|
602
|
-
- [React Documentation](https://reactjs.org/)
|
|
603
|
-
- [Tailwind CSS Documentation](https://tailwindcss.com/)
|
|
604
|
-
- [TypeScript Documentation](https://www.typescriptlang.org/)
|
|
605
|
-
- [Storybook Documentation](https://storybook.js.org/)
|
|
606
|
-
- [Material Symbols](https://fonts.google.com/icons)
|
|
607
|
-
- [React Testing Library](https://testing-library.com/react)
|
|
608
|
-
- [Jest Documentation](https://jestjs.io/)
|
|
609
|
-
|
|
610
|
-
## ๐ฆ Package Information
|
|
611
|
-
|
|
612
|
-
- **Package Name**: `@windstream/react-shared-components`
|
|
613
|
-
- **Current Version**: `0.0.4`
|
|
614
|
-
- **License**: MIT
|
|
615
|
-
- **Repository**: [GitHub](https://github.com/kinetic/react-shared-components)
|
|
616
|
-
- **Issues**: [GitHub Issues](https://github.com/kinetic/react-shared-components/issues)
|
|
617
|
-
|
|
618
|
-
## ๐ Related Packages
|
|
619
|
-
|
|
620
|
-
This package is part of the Kinetic ecosystem and works seamlessly with:
|
|
621
|
-
- Kinetic design system tokens
|
|
622
|
-
- Kinetic applications and services
|
|
623
|
-
- Other Windstream/Kinetic React packages
|
|
1
|
+
# @windstream/react-shared-components
|
|
2
|
+
|
|
3
|
+
A comprehensive React component library built with TypeScript and Tailwind CSS, designed for Kinetic applications. This library provides a complete set of reusable UI components following the Kinetic design system.
|
|
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
|
+
- **Storybook**: Interactive component documentation and development environment
|
|
14
|
+
- **Design System**: Comprehensive design tokens following Kinetic brand guidelines
|
|
15
|
+
- **Material Icons**: Built-in Material Symbols Rounded icon support
|
|
16
|
+
|
|
17
|
+
## ๐ฆ Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install @windstream/react-shared-components
|
|
21
|
+
# or
|
|
22
|
+
yarn add @windstream/react-shared-components
|
|
23
|
+
# or
|
|
24
|
+
pnpm add @windstream/react-shared-components
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## ๐ง Setup
|
|
28
|
+
|
|
29
|
+
### Prerequisites
|
|
30
|
+
|
|
31
|
+
- React 18.0.0 or higher
|
|
32
|
+
- React DOM 18.0.0 or higher
|
|
33
|
+
- Tailwind CSS 3.4+ (for styling)
|
|
34
|
+
|
|
35
|
+
### Tailwind CSS Configuration
|
|
36
|
+
|
|
37
|
+
This library requires Tailwind CSS to be installed and configured in your project. You can extend the library's Tailwind configuration:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
// tailwind.config.js
|
|
41
|
+
const sharedConfig = require('@windstream/react-shared-components/tailwind.config');
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
...sharedConfig,
|
|
45
|
+
content: [
|
|
46
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
|
47
|
+
'./node_modules/@windstream/react-shared-components/src/**/*.{js,jsx,ts,tsx}',
|
|
48
|
+
],
|
|
49
|
+
};
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or import the Tailwind config directly:
|
|
53
|
+
|
|
54
|
+
```js
|
|
55
|
+
// tailwind.config.js
|
|
56
|
+
module.exports = {
|
|
57
|
+
presets: [require('@windstream/react-shared-components/tailwind.config')],
|
|
58
|
+
content: [
|
|
59
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
|
60
|
+
'./node_modules/@windstream/react-shared-components/src/**/*.{js,jsx,ts,tsx}',
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## ๐ฏ Usage
|
|
66
|
+
|
|
67
|
+
### Basic Usage
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { Button, Input, Text } from '@windstream/react-shared-components/core';
|
|
71
|
+
|
|
72
|
+
function MyComponent() {
|
|
73
|
+
return (
|
|
74
|
+
<div>
|
|
75
|
+
<Text className="heading1">Welcome to Kinetic</Text>
|
|
76
|
+
<Input placeholder="Enter your name" />
|
|
77
|
+
<Button variant="primary">Submit</Button>
|
|
78
|
+
</div>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Import Paths
|
|
84
|
+
|
|
85
|
+
The library provides multiple export paths for different use cases:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
// Core components (recommended)
|
|
89
|
+
import { Button, Input, Text } from '@windstream/react-shared-components/core';
|
|
90
|
+
|
|
91
|
+
// Utilities
|
|
92
|
+
import { cx, clsx } from '@windstream/react-shared-components/utils';
|
|
93
|
+
|
|
94
|
+
// Styles (required - styles are not automatically included)
|
|
95
|
+
import '@windstream/react-shared-components/dist/styles.css';
|
|
96
|
+
// Or in CSS: @import '@windstream/react-shared-components/dist/styles.css';
|
|
97
|
+
|
|
98
|
+
// Tailwind config
|
|
99
|
+
const tailwindConfig = require('@windstream/react-shared-components/tailwind.config');
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Component Examples
|
|
103
|
+
|
|
104
|
+
#### Button
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
import { Button } from '@windstream/react-shared-components/core';
|
|
108
|
+
|
|
109
|
+
// Different variants
|
|
110
|
+
<Button variant="primary">Primary Button</Button>
|
|
111
|
+
<Button variant="secondary">Secondary Button</Button>
|
|
112
|
+
<Button variant="outline">Outline Button</Button>
|
|
113
|
+
|
|
114
|
+
// Different sizes
|
|
115
|
+
<Button className="btn-small">Small</Button>
|
|
116
|
+
<Button className="btn-medium">Medium</Button>
|
|
117
|
+
<Button className="btn-large">Large</Button>
|
|
118
|
+
|
|
119
|
+
// With loading state
|
|
120
|
+
<Button isLoading>Loading...</Button>
|
|
121
|
+
|
|
122
|
+
// Full width
|
|
123
|
+
<Button fullWidth>Full Width Button</Button>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
#### Input
|
|
127
|
+
|
|
128
|
+
```tsx
|
|
129
|
+
import { Input, InputField, TextInput } from '@windstream/react-shared-components/core';
|
|
130
|
+
|
|
131
|
+
// Input, InputField, and TextInput are all aliases for the same component
|
|
132
|
+
<Input
|
|
133
|
+
placeholder="Enter text"
|
|
134
|
+
type="text"
|
|
135
|
+
variant="default"
|
|
136
|
+
size="medium"
|
|
137
|
+
/>
|
|
138
|
+
|
|
139
|
+
<InputField
|
|
140
|
+
placeholder="Enter text"
|
|
141
|
+
label="Name"
|
|
142
|
+
/>
|
|
143
|
+
|
|
144
|
+
<TextInput
|
|
145
|
+
placeholder="Enter text"
|
|
146
|
+
/>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Text
|
|
150
|
+
|
|
151
|
+
```tsx
|
|
152
|
+
import { Text } from '@windstream/react-shared-components/core';
|
|
153
|
+
|
|
154
|
+
<Text className="heading1">Heading 1</Text>
|
|
155
|
+
<Text className="body1">Body text</Text>
|
|
156
|
+
<Text className="caption">Caption text</Text>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Utilities
|
|
160
|
+
|
|
161
|
+
The `cx` utility is an enhanced version of `clsx` that intelligently merges Tailwind classes:
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import { cx, clsx } from '@windstream/react-shared-components/utils';
|
|
165
|
+
|
|
166
|
+
// cx automatically merges conflicting Tailwind classes
|
|
167
|
+
const classes = cx('btn', 'btn-primary', condition && 'btn-secondary');
|
|
168
|
+
// If condition is true, btn-secondary will override btn-primary
|
|
169
|
+
|
|
170
|
+
// clsx is also available for basic class name concatenation
|
|
171
|
+
const basicClasses = clsx('btn', condition && 'active');
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Hooks
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
import { useBodyScrollLock } from '@windstream/react-shared-components/core';
|
|
178
|
+
|
|
179
|
+
function Modal({ isOpen }) {
|
|
180
|
+
// Lock body scroll when modal is open
|
|
181
|
+
useBodyScrollLock(isOpen, true);
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
// Modal content
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## ๐จ Available Components
|
|
190
|
+
|
|
191
|
+
All components are available from the `/core` export path:
|
|
192
|
+
|
|
193
|
+
```tsx
|
|
194
|
+
import {
|
|
195
|
+
Button,
|
|
196
|
+
Input,
|
|
197
|
+
InputField,
|
|
198
|
+
TextInput,
|
|
199
|
+
Link,
|
|
200
|
+
List,
|
|
201
|
+
ListItem,
|
|
202
|
+
MaterialIcon,
|
|
203
|
+
Spinner,
|
|
204
|
+
Text,
|
|
205
|
+
CallButton,
|
|
206
|
+
Modal,
|
|
207
|
+
Accordion,
|
|
208
|
+
Checkbox,
|
|
209
|
+
Select,
|
|
210
|
+
AlertCard,
|
|
211
|
+
BrandButton,
|
|
212
|
+
Checklist,
|
|
213
|
+
Collapse,
|
|
214
|
+
Divider,
|
|
215
|
+
RadioButton,
|
|
216
|
+
SeeMore,
|
|
217
|
+
SelectPlanButton,
|
|
218
|
+
Skeleton,
|
|
219
|
+
PageSkeleton,
|
|
220
|
+
Tooltip,
|
|
221
|
+
ViewCartButton,
|
|
222
|
+
useBodyScrollLock
|
|
223
|
+
} from '@windstream/react-shared-components/core';
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Core Components
|
|
227
|
+
|
|
228
|
+
- **Button** - Versatile button component with multiple variants and sizes
|
|
229
|
+
- **Input / InputField / TextInput** - Form input component with validation states (all are aliases)
|
|
230
|
+
- **Link** - Accessible link component
|
|
231
|
+
- **List / ListItem** - List and list item components
|
|
232
|
+
- **MaterialIcon** - Material Design icon component using Material Symbols Rounded
|
|
233
|
+
- **Spinner** - Loading spinner component
|
|
234
|
+
- **Text** - Typography component with predefined variants (heading1-6, body1-3, etc.)
|
|
235
|
+
- **CallButton** - Button component for call-to-action
|
|
236
|
+
- **Modal** - Modal dialog component with customizable size, shape, and animations
|
|
237
|
+
- **Accordion** - Collapsible accordion component
|
|
238
|
+
- **Checkbox** - Checkbox input component
|
|
239
|
+
- **Select** - Select dropdown component (powered by react-select)
|
|
240
|
+
- **AlertCard** - Alert notification card component
|
|
241
|
+
- **BrandButton** - Branded button variant with responsive sizing
|
|
242
|
+
- **Checklist** - Checklist component
|
|
243
|
+
- **Collapse** - Collapsible content component
|
|
244
|
+
- **Divider** - Divider/separator component
|
|
245
|
+
- **RadioButton** - Radio button input component
|
|
246
|
+
- **SeeMore** - Expandable content component
|
|
247
|
+
- **SelectPlanButton** - Plan selection button
|
|
248
|
+
- **Skeleton / PageSkeleton** - Loading skeleton components
|
|
249
|
+
- **Tooltip** - Tooltip component
|
|
250
|
+
- **ViewCartButton** - Shopping cart button component
|
|
251
|
+
|
|
252
|
+
### Custom Hooks
|
|
253
|
+
|
|
254
|
+
- **useBodyScrollLock** - Hook to lock/unlock body scroll (useful for modals)
|
|
255
|
+
|
|
256
|
+
### Component Variants
|
|
257
|
+
|
|
258
|
+
Each component comes with multiple variants and sizes to fit different use cases:
|
|
259
|
+
|
|
260
|
+
- **Variants**: default, primary, secondary, outline, unstyled
|
|
261
|
+
- **Sizes**: small (btn-small), medium (btn-medium), large (btn-large), x-large (btn-x-large)
|
|
262
|
+
- **States**: loading, disabled, error, success
|
|
263
|
+
|
|
264
|
+
### Typography Variants
|
|
265
|
+
|
|
266
|
+
The `Text` component supports the following typography variants via className:
|
|
267
|
+
|
|
268
|
+
- **Headings**: `heading1`, `heading2`, `heading3`, `heading4`, `heading5`, `heading6`
|
|
269
|
+
- **Subheadings**: `subheading1`, `subheading2`, `subheading3`, `subheading4`, `subheading5`, `subheading6`
|
|
270
|
+
- **Body**: `body1`, `body2`, `body3`
|
|
271
|
+
- **Labels**: `label1`, `label2`, `label3`, `label4`, `label5`, `label6`
|
|
272
|
+
- **Other**: `footnote`, `micro`
|
|
273
|
+
|
|
274
|
+
## ๐จ Design System
|
|
275
|
+
|
|
276
|
+
This library follows the Kinetic design system with comprehensive design tokens:
|
|
277
|
+
|
|
278
|
+
### Color System
|
|
279
|
+
|
|
280
|
+
- **Brand Colors**: Primary brand color (#24A76A) with variants (accent, active, hover, disabled, etc.)
|
|
281
|
+
- **Semantic Colors**: Success, critical (error), info, inverse
|
|
282
|
+
- **Surface Colors**: Background fills, surfaces with states (active, hover, selected, disabled)
|
|
283
|
+
- **Text Colors**: Default, brand, critical, secondary, inverse, disabled
|
|
284
|
+
- **Border Colors**: Default, brand, critical, focus, hover, disabled
|
|
285
|
+
- **Icon Colors**: Brand, critical, default, info, inverse, secondary, success
|
|
286
|
+
|
|
287
|
+
### Typography
|
|
288
|
+
|
|
289
|
+
- **Font Families**:
|
|
290
|
+
- Sans-serif (configurable via CSS variable `--win-site-font`)
|
|
291
|
+
- Material Symbols Rounded (for icons)
|
|
292
|
+
- Figtree (for body text)
|
|
293
|
+
- **Font Sizes**: Comprehensive scale from micro (12px) to heading1 (48px)
|
|
294
|
+
- **Line Heights**: Standardized line heights for optimal readability
|
|
295
|
+
|
|
296
|
+
### Spacing & Layout
|
|
297
|
+
|
|
298
|
+
- **Spacing Scale**: Custom spacing values (1.5, 2, 3, 4, 4.5, 6, 7, 13, 15, 17, 18, 26)
|
|
299
|
+
- **Border Radius**: Custom radius values (2.5, 3.5, 2xl, 2.5xl, 4xl)
|
|
300
|
+
- **Shadows**: drop, light, cardDrop, card
|
|
301
|
+
|
|
302
|
+
### Responsive Breakpoints
|
|
303
|
+
|
|
304
|
+
- `sm`: 640px
|
|
305
|
+
- `md`: 768px
|
|
306
|
+
- `lg`: 1024px
|
|
307
|
+
- `xl`: 1280px
|
|
308
|
+
- `max`: 1200px
|
|
309
|
+
|
|
310
|
+
## ๐ง Development
|
|
311
|
+
|
|
312
|
+
### Prerequisites
|
|
313
|
+
|
|
314
|
+
- Node.js 16+
|
|
315
|
+
- npm 7+ or yarn 1.22+
|
|
316
|
+
|
|
317
|
+
### Setup
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# Clone the repository
|
|
321
|
+
git clone <repository-url>
|
|
322
|
+
cd kinetic-react-shared-components
|
|
323
|
+
|
|
324
|
+
# Install dependencies
|
|
325
|
+
npm install
|
|
326
|
+
|
|
327
|
+
# Start development mode (watch mode)
|
|
328
|
+
npm run dev
|
|
329
|
+
|
|
330
|
+
# Build the library
|
|
331
|
+
npm run build
|
|
332
|
+
|
|
333
|
+
# Run tests
|
|
334
|
+
npm test
|
|
335
|
+
|
|
336
|
+
# Run tests in watch mode
|
|
337
|
+
npm run test:watch
|
|
338
|
+
|
|
339
|
+
# Run linting
|
|
340
|
+
npm run lint
|
|
341
|
+
|
|
342
|
+
# Fix linting issues
|
|
343
|
+
npm run lint:fix
|
|
344
|
+
|
|
345
|
+
# Format code
|
|
346
|
+
npm run format
|
|
347
|
+
|
|
348
|
+
# Check code formatting
|
|
349
|
+
npm run format:check
|
|
350
|
+
|
|
351
|
+
# Type check
|
|
352
|
+
npm run type-check
|
|
353
|
+
|
|
354
|
+
# Start Storybook (component documentation)
|
|
355
|
+
npm run storybook
|
|
356
|
+
|
|
357
|
+
# Build Storybook
|
|
358
|
+
npm run build-storybook
|
|
359
|
+
|
|
360
|
+
# Clean build artifacts
|
|
361
|
+
npm run clean
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Project Structure
|
|
365
|
+
|
|
366
|
+
```
|
|
367
|
+
src/
|
|
368
|
+
โโโ components/ # React components
|
|
369
|
+
โ โโโ accordion/ # Accordion component
|
|
370
|
+
โ โโโ alert-card/ # AlertCard component
|
|
371
|
+
โ โโโ brand-button/ # BrandButton component
|
|
372
|
+
โ โโโ button/ # Button component
|
|
373
|
+
โ โโโ call-button/ # CallButton component
|
|
374
|
+
โ โโโ checkbox/ # Checkbox component
|
|
375
|
+
โ โโโ checklist/ # Checklist component
|
|
376
|
+
โ โโโ collapse/ # Collapse component
|
|
377
|
+
โ โโโ divider/ # Divider component
|
|
378
|
+
โ โโโ input/ # Input component
|
|
379
|
+
โ โโโ link/ # Link component
|
|
380
|
+
โ โโโ list/ # List components
|
|
381
|
+
โ โโโ material-icon/ # Icon component
|
|
382
|
+
โ โโโ modal/ # Modal component
|
|
383
|
+
โ โโโ radio-button/ # RadioButton component
|
|
384
|
+
โ โโโ see-more/ # SeeMore component
|
|
385
|
+
โ โโโ select/ # Select component
|
|
386
|
+
โ โโโ select-plan-button/ # SelectPlanButton component
|
|
387
|
+
โ โโโ skeleton/ # Skeleton component
|
|
388
|
+
โ โโโ spinner/ # Spinner component
|
|
389
|
+
โ โโโ text/ # Text component
|
|
390
|
+
โ โโโ tooltip/ # Tooltip component
|
|
391
|
+
โ โโโ view-cart-button/ # ViewCartButton component
|
|
392
|
+
โโโ hooks/ # Custom React hooks
|
|
393
|
+
โโโ styles/ # Global styles and Tailwind config
|
|
394
|
+
โโโ utils/ # Utility functions
|
|
395
|
+
โโโ index.ts # Main export file (exports all components)
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Building
|
|
399
|
+
|
|
400
|
+
The library is built using Rollup with the following outputs:
|
|
401
|
+
|
|
402
|
+
- **CommonJS**: `dist/index.js` and `dist/utils/index.js`
|
|
403
|
+
- **ES Modules**: `dist/index.esm.js` and `dist/utils/index.esm.js`
|
|
404
|
+
- **TypeScript declarations**: `dist/index.d.ts`, `dist/core.d.ts`, and `dist/utils/index.d.ts`
|
|
405
|
+
- **Styles**: `dist/styles.css` (extracted and minified)
|
|
406
|
+
|
|
407
|
+
All components are exported from a single entry point (`src/index.ts`), which allows for:
|
|
408
|
+
- Simplified build process
|
|
409
|
+
- Consistent import path: `@windstream/react-shared-components/core`
|
|
410
|
+
- Tree-shaking support for optimal bundle sizes
|
|
411
|
+
- Separate utils export path for utility-only imports
|
|
412
|
+
|
|
413
|
+
### Package Exports
|
|
414
|
+
|
|
415
|
+
The package provides the following export paths:
|
|
416
|
+
|
|
417
|
+
- `@windstream/react-shared-components/core` - All components and hooks
|
|
418
|
+
- `@windstream/react-shared-components/utils` - Utility functions (cx, clsx)
|
|
419
|
+
- `@windstream/react-shared-components/styles.css` - Compiled CSS styles
|
|
420
|
+
- `@windstream/react-shared-components/tailwind.config` - Tailwind configuration
|
|
421
|
+
|
|
422
|
+
## ๐ฆ Publishing
|
|
423
|
+
|
|
424
|
+
### Prerequisites
|
|
425
|
+
|
|
426
|
+
Before publishing the package, ensure you have:
|
|
427
|
+
|
|
428
|
+
1. **npm account**: An account on npmjs.com with access to the `@windstream` organization
|
|
429
|
+
2. **Authentication**: Logged in to npm via `npm login` or using an authentication token
|
|
430
|
+
3. **Organization access**: Permission to publish packages under the `@windstream` scope
|
|
431
|
+
|
|
432
|
+
### Publishing Steps
|
|
433
|
+
|
|
434
|
+
1. **Ensure you're authenticated**:
|
|
435
|
+
```bash
|
|
436
|
+
npm login
|
|
437
|
+
# Or verify your authentication
|
|
438
|
+
npm whoami
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
2. **Update the version** in `package.json`:
|
|
442
|
+
```bash
|
|
443
|
+
# For patch version (0.0.4 -> 0.0.5)
|
|
444
|
+
npm version patch
|
|
445
|
+
|
|
446
|
+
# For minor version (0.0.4 -> 0.1.0)
|
|
447
|
+
npm version minor
|
|
448
|
+
|
|
449
|
+
# For major version (0.0.4 -> 1.0.0)
|
|
450
|
+
npm version major
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Or manually update the `version` field in `package.json` and commit the change.
|
|
454
|
+
|
|
455
|
+
3. **Build the package**:
|
|
456
|
+
```bash
|
|
457
|
+
npm run build
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
This will:
|
|
461
|
+
- Clean the `dist` directory
|
|
462
|
+
- Build CommonJS and ES Module outputs
|
|
463
|
+
- Generate TypeScript declarations
|
|
464
|
+
- Extract and minify CSS styles
|
|
465
|
+
|
|
466
|
+
4. **Verify the build**:
|
|
467
|
+
```bash
|
|
468
|
+
# Check that dist directory contains all necessary files
|
|
469
|
+
ls -la dist/
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
Ensure the following files exist:
|
|
473
|
+
- `dist/index.js` (CommonJS)
|
|
474
|
+
- `dist/index.esm.js` (ES Modules)
|
|
475
|
+
- `dist/index.d.ts` (TypeScript declarations)
|
|
476
|
+
- `dist/core.d.ts` (Core types)
|
|
477
|
+
- `dist/utils/index.js` (Utils CommonJS)
|
|
478
|
+
- `dist/utils/index.esm.js` (Utils ES Modules)
|
|
479
|
+
- `dist/utils/index.d.ts` (Utils types)
|
|
480
|
+
- `dist/styles.css` (Compiled CSS)
|
|
481
|
+
|
|
482
|
+
5. **Run tests** (optional but recommended):
|
|
483
|
+
```bash
|
|
484
|
+
npm test
|
|
485
|
+
npm run type-check
|
|
486
|
+
```
|
|
487
|
+
|
|
488
|
+
6. **Publish to npm**:
|
|
489
|
+
```bash
|
|
490
|
+
# Dry run to see what would be published
|
|
491
|
+
npm publish --dry-run
|
|
492
|
+
|
|
493
|
+
# Publish to npm
|
|
494
|
+
npm publish --access public
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
Note: The `--access public` flag is required for scoped packages (`@windstream/...`) when publishing to the public npm registry.
|
|
498
|
+
|
|
499
|
+
7. **Create a git tag** (if you used `npm version`, this is done automatically):
|
|
500
|
+
```bash
|
|
501
|
+
# If you manually updated the version, create and push the tag
|
|
502
|
+
git tag v0.0.4
|
|
503
|
+
git push origin v0.0.4
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
8. **Push changes to repository**:
|
|
507
|
+
```bash
|
|
508
|
+
git push origin main
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
### Version Management
|
|
512
|
+
|
|
513
|
+
Follow [Semantic Versioning](https://semver.org/) (semver):
|
|
514
|
+
|
|
515
|
+
- **MAJOR** version (1.0.0): Breaking changes
|
|
516
|
+
- **MINOR** version (0.1.0): New features (backward compatible)
|
|
517
|
+
- **PATCH** version (0.0.5): Bug fixes (backward compatible)
|
|
518
|
+
|
|
519
|
+
### Publishing Checklist
|
|
520
|
+
|
|
521
|
+
Before publishing, verify:
|
|
522
|
+
|
|
523
|
+
- [ ] All tests pass (`npm test`)
|
|
524
|
+
- [ ] Type checking passes (`npm run type-check`)
|
|
525
|
+
- [ ] Linting passes (`npm run lint`)
|
|
526
|
+
- [ ] Build completes successfully (`npm run build`)
|
|
527
|
+
- [ ] Version number is updated in `package.json`
|
|
528
|
+
- [ ] README is up to date
|
|
529
|
+
- [ ] All changes are committed
|
|
530
|
+
- [ ] You're logged in to npm (`npm whoami`)
|
|
531
|
+
|
|
532
|
+
## ๐งช Testing
|
|
533
|
+
|
|
534
|
+
The library uses Jest and React Testing Library for testing:
|
|
535
|
+
|
|
536
|
+
```bash
|
|
537
|
+
# Run tests
|
|
538
|
+
npm test
|
|
539
|
+
|
|
540
|
+
# Run tests in watch mode
|
|
541
|
+
npm run test:watch
|
|
542
|
+
|
|
543
|
+
# Run tests with coverage
|
|
544
|
+
npm run test:coverage
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
Test files should be named `*.test.ts` or `*.test.tsx` and placed alongside the components they test.
|
|
548
|
+
|
|
549
|
+
## ๐ Contributing
|
|
550
|
+
|
|
551
|
+
1. Fork the repository
|
|
552
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
553
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
554
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
555
|
+
5. Open a Pull Request
|
|
556
|
+
|
|
557
|
+
### Development Guidelines
|
|
558
|
+
|
|
559
|
+
- Follow the existing code style and conventions
|
|
560
|
+
- Write tests for new components and features
|
|
561
|
+
- Update documentation for any API changes
|
|
562
|
+
- Ensure all components are accessible
|
|
563
|
+
- Follow the established component structure
|
|
564
|
+
|
|
565
|
+
## ๐ License
|
|
566
|
+
|
|
567
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
568
|
+
|
|
569
|
+
## ๐ค Support
|
|
570
|
+
|
|
571
|
+
For support and questions:
|
|
572
|
+
|
|
573
|
+
- Create an issue in the GitHub repository
|
|
574
|
+
- Contact the Kinetic development team
|
|
575
|
+
- Check the documentation and examples
|
|
576
|
+
|
|
577
|
+
## ๐ Changelog
|
|
578
|
+
|
|
579
|
+
### v0.0.4
|
|
580
|
+
- Current version
|
|
581
|
+
- 23+ React components with full TypeScript support
|
|
582
|
+
- Comprehensive design system with Tailwind CSS
|
|
583
|
+
- Material Symbols Rounded icon support
|
|
584
|
+
- Storybook integration for component documentation
|
|
585
|
+
- Custom hooks (useBodyScrollLock)
|
|
586
|
+
- Utility functions (cx, clsx) with Tailwind class merging
|
|
587
|
+
- Multiple export paths (core, utils, styles, tailwind.config)
|
|
588
|
+
- CommonJS and ES Module builds
|
|
589
|
+
- Full type definitions
|
|
590
|
+
|
|
591
|
+
### Components Included
|
|
592
|
+
- **Form Components**: Button, Input, Checkbox, RadioButton, Select
|
|
593
|
+
- **Layout Components**: List, ListItem, Divider, Collapse, Accordion
|
|
594
|
+
- **Feedback Components**: Spinner, Skeleton, PageSkeleton, AlertCard, Tooltip
|
|
595
|
+
- **Navigation Components**: Link, Modal, SeeMore
|
|
596
|
+
- **Specialized Components**: CallButton, BrandButton, SelectPlanButton, ViewCartButton
|
|
597
|
+
- **Typography**: Text component with comprehensive variant system
|
|
598
|
+
- **Icons**: MaterialIcon component
|
|
599
|
+
|
|
600
|
+
## ๐ Additional Resources
|
|
601
|
+
|
|
602
|
+
- [React Documentation](https://reactjs.org/)
|
|
603
|
+
- [Tailwind CSS Documentation](https://tailwindcss.com/)
|
|
604
|
+
- [TypeScript Documentation](https://www.typescriptlang.org/)
|
|
605
|
+
- [Storybook Documentation](https://storybook.js.org/)
|
|
606
|
+
- [Material Symbols](https://fonts.google.com/icons)
|
|
607
|
+
- [React Testing Library](https://testing-library.com/react)
|
|
608
|
+
- [Jest Documentation](https://jestjs.io/)
|
|
609
|
+
|
|
610
|
+
## ๐ฆ Package Information
|
|
611
|
+
|
|
612
|
+
- **Package Name**: `@windstream/react-shared-components`
|
|
613
|
+
- **Current Version**: `0.0.4`
|
|
614
|
+
- **License**: MIT
|
|
615
|
+
- **Repository**: [GitHub](https://github.com/kinetic/react-shared-components)
|
|
616
|
+
- **Issues**: [GitHub Issues](https://github.com/kinetic/react-shared-components/issues)
|
|
617
|
+
|
|
618
|
+
## ๐ Related Packages
|
|
619
|
+
|
|
620
|
+
This package is part of the Kinetic ecosystem and works seamlessly with:
|
|
621
|
+
- Kinetic design system tokens
|
|
622
|
+
- Kinetic applications and services
|
|
623
|
+
- Other Windstream/Kinetic React packages
|