@emporix/cockpit-component-library 0.0.5 → 1.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.
- package/README.md +309 -12
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -64,6 +64,37 @@ If the above methods don't work, copy the CSS file from `node_modules/@emporix/c
|
|
|
64
64
|
|
|
65
65
|
## Components
|
|
66
66
|
|
|
67
|
+
Current exported components:
|
|
68
|
+
|
|
69
|
+
- `PrimaryButton`
|
|
70
|
+
- `SecondaryButton`
|
|
71
|
+
- `TertiaryButton`
|
|
72
|
+
- `ContrastButton`
|
|
73
|
+
- `Tabs`
|
|
74
|
+
- `RichTextEditor`
|
|
75
|
+
- `Spinner`
|
|
76
|
+
- `Breadcrumb`
|
|
77
|
+
- `Dropdown`
|
|
78
|
+
- `MultiSelect`
|
|
79
|
+
- `InputText`
|
|
80
|
+
- `SelectButton`
|
|
81
|
+
- `Card`
|
|
82
|
+
- `IconCard`
|
|
83
|
+
- `FileUploadDropzone`
|
|
84
|
+
- `Chip`
|
|
85
|
+
- `AlertBox`
|
|
86
|
+
- `SideMenu`
|
|
87
|
+
- `TopNav`
|
|
88
|
+
- `Toast` (plus `ToastProvider` and `useToast`)
|
|
89
|
+
- `Modal`
|
|
90
|
+
- `ConfirmDialog`
|
|
91
|
+
- `ProductTable`
|
|
92
|
+
- `ProductTableIconAddButton`
|
|
93
|
+
- `OrderTable`
|
|
94
|
+
- `OrderStatusTag`
|
|
95
|
+
- `Wizard`
|
|
96
|
+
- `Timeline`
|
|
97
|
+
|
|
67
98
|
### PrimaryButton
|
|
68
99
|
|
|
69
100
|
A simple, focused button component for primary actions.
|
|
@@ -102,10 +133,11 @@ import { PrimaryButton } from '@emporix/cockpit-component-library'
|
|
|
102
133
|
|
|
103
134
|
### Card
|
|
104
135
|
|
|
105
|
-
|
|
136
|
+
White panel styled with design tokens (defaults from `src/styles/index.scss`). The root uses a **1px** border (`var(--color-card-border)`), corner radius **`var(--card-radius)`** (default **8px**), padding **`var(--card-padding)`** (default **16px**), and vertical spacing between direct children **`var(--card-section-gap)`** (default **12px**). **`Card.Body`** stacks title, meta, etc. with **`var(--card-body-gap)`** (default **16px**). **`Card.Header`**, **`Card.Meta`**, and **`Card.MetaRow`** share **`var(--card-meta-gap)`** (default **6px**); the header’s leading side (`tag` + children) also uses a fixed **8px** gap between flex items. **`Card.MetaRow`** uses a **20×20px** icon frame with **18×18px** SVGs—pass icons intended for that footprint (or larger icons will scale visually via CSS). Compound parts: **`Card.Body`**, **`Card.Header`** (optional `tag` + `actions`), **`Card.Title`**, **`Card.Meta`** / **`Card.MetaRow`**, **`Card.Footer`**, **`Card.IconButton`**. Use **`Chip`** in the header `tag` slot for status pills (e.g. `<Chip variant="error">Blocker</Chip>`). Override the `--card-*` variables to tune spacing without forking the component (see [Card layout tokens](#card-layout-tokens) under _Theming_).
|
|
106
137
|
|
|
107
138
|
```tsx
|
|
108
|
-
import { Card } from '@emporix/cockpit-component-library'
|
|
139
|
+
import { Card, Chip, TertiaryButton } from '@emporix/cockpit-component-library'
|
|
140
|
+
import { FiEdit2, FiTrash2 } from 'react-icons/fi'
|
|
109
141
|
|
|
110
142
|
// Basic usage
|
|
111
143
|
<Card>
|
|
@@ -113,6 +145,32 @@ import { Card } from '@emporix/cockpit-component-library'
|
|
|
113
145
|
<p>Description or nested components go here.</p>
|
|
114
146
|
</Card>
|
|
115
147
|
|
|
148
|
+
// Structured card (see Storybook “IssueCard”)
|
|
149
|
+
<Card>
|
|
150
|
+
<Card.Body>
|
|
151
|
+
<Card.Header
|
|
152
|
+
tag={<Chip variant="error">Blocker</Chip>}
|
|
153
|
+
actions={
|
|
154
|
+
<>
|
|
155
|
+
<Card.IconButton type="button" aria-label="Edit">
|
|
156
|
+
<FiEdit2 />
|
|
157
|
+
</Card.IconButton>
|
|
158
|
+
<Card.IconButton type="button" aria-label="Delete">
|
|
159
|
+
<FiTrash2 />
|
|
160
|
+
</Card.IconButton>
|
|
161
|
+
</>
|
|
162
|
+
}
|
|
163
|
+
/>
|
|
164
|
+
<Card.Title>Issue headline</Card.Title>
|
|
165
|
+
<Card.Meta>
|
|
166
|
+
<Card.MetaRow icon={<span />}>Supporting detail line</Card.MetaRow>
|
|
167
|
+
</Card.Meta>
|
|
168
|
+
</Card.Body>
|
|
169
|
+
<Card.Footer>
|
|
170
|
+
<TertiaryButton label="Edit" icon={<FiEdit2 />} iconPos="left" />
|
|
171
|
+
</Card.Footer>
|
|
172
|
+
</Card>
|
|
173
|
+
|
|
116
174
|
// With custom class and test id
|
|
117
175
|
<Card className="my-card" data-testid="details-card">
|
|
118
176
|
<p>Content</p>
|
|
@@ -127,11 +185,11 @@ import { Card } from '@emporix/cockpit-component-library'
|
|
|
127
185
|
| className | string | - | Additional CSS class on the root element |
|
|
128
186
|
| data-testid | string | - | Test ID for the root element |
|
|
129
187
|
|
|
130
|
-
All standard HTML `div` attributes (e.g. `id`, `role`, `aria-*`, `onClick`) are forwarded to the root element via `CardProps`.
|
|
188
|
+
All standard HTML `div` attributes (e.g. `id`, `role`, `aria-*`, `onClick`) are forwarded to the root element via `CardProps`. Subcomponents accept the usual attributes for their underlying elements (`Card.Title` → `h2`, `Card.IconButton` → `button`, etc.).
|
|
131
189
|
|
|
132
190
|
### Chip
|
|
133
191
|
|
|
134
|
-
A compact, pill-shaped label for statuses (e.g. draft, submitted). Four variants use a light tinted background with darker text: **success** (green), **warning** (orange), **info** (blue), **error** (
|
|
192
|
+
A compact, pill-shaped label for statuses (e.g. draft, submitted). Four variants use a light tinted background with darker text: **success** (green), **warning** (orange), **info** (blue), **error** (rose / burgundy — same look as Figma card header labels such as “Blocker”). Use **`Chip`** for those header pills instead of a separate card-only primitive. Colors are driven by CSS variables (see [Theming with CSS Variables](#theming-with-css-variables)).
|
|
135
193
|
|
|
136
194
|
```tsx
|
|
137
195
|
import { Chip } from '@emporix/cockpit-component-library'
|
|
@@ -298,6 +356,224 @@ const tabs: TabItem[] = [
|
|
|
298
356
|
| label | string | Display label for the tab |
|
|
299
357
|
| content | ReactNode | Content to display when active |
|
|
300
358
|
|
|
359
|
+
### SecondaryButton
|
|
360
|
+
|
|
361
|
+
Secondary action button variant with API similar to `PrimaryButton`.
|
|
362
|
+
|
|
363
|
+
```tsx
|
|
364
|
+
import { SecondaryButton } from '@emporix/cockpit-component-library'
|
|
365
|
+
|
|
366
|
+
<SecondaryButton label="Cancel" />
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### TertiaryButton
|
|
370
|
+
|
|
371
|
+
Low-emphasis button for tertiary actions.
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
import { TertiaryButton } from '@emporix/cockpit-component-library'
|
|
375
|
+
|
|
376
|
+
<TertiaryButton label="Learn more" />
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### ContrastButton
|
|
380
|
+
|
|
381
|
+
Button variant designed for high-contrast contexts.
|
|
382
|
+
|
|
383
|
+
```tsx
|
|
384
|
+
import { ContrastButton } from '@emporix/cockpit-component-library'
|
|
385
|
+
|
|
386
|
+
<ContrastButton label="Open" />
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### Dropdown
|
|
390
|
+
|
|
391
|
+
Single-select dropdown component with optional filtering, editable mode, and templating.
|
|
392
|
+
|
|
393
|
+
```tsx
|
|
394
|
+
import { Dropdown } from '@emporix/cockpit-component-library'
|
|
395
|
+
|
|
396
|
+
<Dropdown options={options} value={value} onChange={(e) => setValue(e.value)} />
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### MultiSelect
|
|
400
|
+
|
|
401
|
+
Multi-value selection component for choosing multiple options from a list.
|
|
402
|
+
|
|
403
|
+
```tsx
|
|
404
|
+
import { MultiSelect } from '@emporix/cockpit-component-library'
|
|
405
|
+
|
|
406
|
+
<MultiSelect options={options} value={value} onChange={(e) => setValue(e.value)} />
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
### RichTextEditor
|
|
410
|
+
|
|
411
|
+
Rich text input component for formatted content editing.
|
|
412
|
+
|
|
413
|
+
```tsx
|
|
414
|
+
import { RichTextEditor } from '@emporix/cockpit-component-library'
|
|
415
|
+
|
|
416
|
+
<RichTextEditor value={value} onChange={setValue} />
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### Spinner
|
|
420
|
+
|
|
421
|
+
Loading indicator component with configurable size.
|
|
422
|
+
|
|
423
|
+
```tsx
|
|
424
|
+
import { Spinner } from '@emporix/cockpit-component-library'
|
|
425
|
+
|
|
426
|
+
<Spinner size="md" />
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### Breadcrumb
|
|
430
|
+
|
|
431
|
+
Navigation breadcrumb for representing hierarchical page location.
|
|
432
|
+
|
|
433
|
+
```tsx
|
|
434
|
+
import { Breadcrumb } from '@emporix/cockpit-component-library'
|
|
435
|
+
|
|
436
|
+
<Breadcrumb items={items} />
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
### IconCard
|
|
440
|
+
|
|
441
|
+
Card-like container with a prominent icon/content layout.
|
|
442
|
+
|
|
443
|
+
```tsx
|
|
444
|
+
import { IconCard } from '@emporix/cockpit-component-library'
|
|
445
|
+
|
|
446
|
+
<IconCard title="Title" description="Description" icon={<span />} />
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
### FileUploadDropzone
|
|
450
|
+
|
|
451
|
+
Dropzone component for drag-and-drop file uploads with type constraints.
|
|
452
|
+
|
|
453
|
+
```tsx
|
|
454
|
+
import { FileUploadDropzone } from '@emporix/cockpit-component-library'
|
|
455
|
+
|
|
456
|
+
<FileUploadDropzone acceptedTypes={['image']} onFilesSelected={handleFiles} />
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
### AlertBox
|
|
460
|
+
|
|
461
|
+
Inline alert component for success, info, warning, and error messages.
|
|
462
|
+
|
|
463
|
+
```tsx
|
|
464
|
+
import { AlertBox } from '@emporix/cockpit-component-library'
|
|
465
|
+
|
|
466
|
+
<AlertBox variant="info" title="Heads up" />
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
### SideMenu
|
|
470
|
+
|
|
471
|
+
Composable side navigation menu with brand, nav items, and footer slots.
|
|
472
|
+
|
|
473
|
+
```tsx
|
|
474
|
+
import { SideMenu } from '@emporix/cockpit-component-library'
|
|
475
|
+
|
|
476
|
+
<SideMenu>{/* ... */}</SideMenu>
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### TopNav
|
|
480
|
+
|
|
481
|
+
Top navigation/header component for page-level actions and context.
|
|
482
|
+
|
|
483
|
+
```tsx
|
|
484
|
+
import { TopNav } from '@emporix/cockpit-component-library'
|
|
485
|
+
|
|
486
|
+
<TopNav title="Dashboard" />
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
### Toast
|
|
490
|
+
|
|
491
|
+
Toast notification primitives: `Toast`, `ToastProvider`, and `useToast`.
|
|
492
|
+
|
|
493
|
+
```tsx
|
|
494
|
+
import { ToastProvider, useToast } from '@emporix/cockpit-component-library'
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
### Modal
|
|
498
|
+
|
|
499
|
+
Dialog modal component for focused workflows and confirmations.
|
|
500
|
+
|
|
501
|
+
```tsx
|
|
502
|
+
import { Modal } from '@emporix/cockpit-component-library'
|
|
503
|
+
|
|
504
|
+
<Modal isOpen={open} onClose={onClose} title="Edit item" />
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### ConfirmDialog
|
|
508
|
+
|
|
509
|
+
Preset confirmation dialog for destructive or high-impact actions.
|
|
510
|
+
|
|
511
|
+
```tsx
|
|
512
|
+
import { ConfirmDialog } from '@emporix/cockpit-component-library'
|
|
513
|
+
|
|
514
|
+
<ConfirmDialog open={open} onConfirm={onConfirm} onCancel={onCancel} />
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
### ProductTable
|
|
518
|
+
|
|
519
|
+
Data table component focused on product records and common actions.
|
|
520
|
+
|
|
521
|
+
```tsx
|
|
522
|
+
import { ProductTable } from '@emporix/cockpit-component-library'
|
|
523
|
+
|
|
524
|
+
<ProductTable items={items} columns={columns} />
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### ProductTableIconAddButton
|
|
528
|
+
|
|
529
|
+
Compact icon button variant used with `ProductTable` add flows.
|
|
530
|
+
|
|
531
|
+
```tsx
|
|
532
|
+
import { ProductTableIconAddButton } from '@emporix/cockpit-component-library'
|
|
533
|
+
|
|
534
|
+
<ProductTableIconAddButton onClick={onAdd} />
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### OrderTable
|
|
538
|
+
|
|
539
|
+
Data table for order rows and order-oriented workflows.
|
|
540
|
+
|
|
541
|
+
```tsx
|
|
542
|
+
import { OrderTable } from '@emporix/cockpit-component-library'
|
|
543
|
+
|
|
544
|
+
<OrderTable rows={rows} />
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
### OrderStatusTag
|
|
548
|
+
|
|
549
|
+
Status badge component for order state presentation.
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
import { OrderStatusTag } from '@emporix/cockpit-component-library'
|
|
553
|
+
|
|
554
|
+
<OrderStatusTag status="submitted" />
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### Wizard
|
|
558
|
+
|
|
559
|
+
Step-based workflow component for multi-stage forms and processes.
|
|
560
|
+
|
|
561
|
+
```tsx
|
|
562
|
+
import { Wizard } from '@emporix/cockpit-component-library'
|
|
563
|
+
|
|
564
|
+
<Wizard steps={steps} />
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
### Timeline
|
|
568
|
+
|
|
569
|
+
Chronological event list component for activity/history views.
|
|
570
|
+
|
|
571
|
+
```tsx
|
|
572
|
+
import { Timeline } from '@emporix/cockpit-component-library'
|
|
573
|
+
|
|
574
|
+
<Timeline events={events} />
|
|
575
|
+
```
|
|
576
|
+
|
|
301
577
|
## Theming with CSS Variables
|
|
302
578
|
|
|
303
579
|
The component library uses CSS variables for easy theming. You can customize the appearance by overriding these variables:
|
|
@@ -357,16 +633,37 @@ Reusable focus outline for inputs, dropdowns, SelectButton, etc. Override to cha
|
|
|
357
633
|
Background and text colors per variant for the `Chip` component.
|
|
358
634
|
|
|
359
635
|
```css
|
|
360
|
-
--color-chip-success-bg: #
|
|
361
|
-
--color-chip-success-text: #
|
|
362
|
-
--color-chip-
|
|
363
|
-
--color-chip-warning-
|
|
364
|
-
--color-chip-
|
|
365
|
-
--color-chip-
|
|
366
|
-
--color-chip-
|
|
367
|
-
--color-chip-
|
|
636
|
+
--color-chip-success-bg: #ecfdf5;
|
|
637
|
+
--color-chip-success-text: #059669;
|
|
638
|
+
--color-chip-success-border: #a7f3d0;
|
|
639
|
+
--color-chip-warning-bg: #fffbeb;
|
|
640
|
+
--color-chip-warning-text: #d97706;
|
|
641
|
+
--color-chip-warning-border: #fde68a;
|
|
642
|
+
--color-chip-info-bg: #eff6ff;
|
|
643
|
+
--color-chip-info-text: #2563eb;
|
|
644
|
+
--color-chip-info-border: #bfdbfe;
|
|
645
|
+
--color-chip-error-bg: #fef2f2;
|
|
646
|
+
--color-chip-error-text: #dc2626;
|
|
647
|
+
--color-chip-error-border: #fecaca;
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
#### Card layout tokens
|
|
651
|
+
|
|
652
|
+
Used by **`Card`** (`Card.module.scss`). Defaults match `src/styles/index.scss`; override on `:root` or a wrapper to change card rhythm app-wide.
|
|
653
|
+
|
|
654
|
+
```css
|
|
655
|
+
--color-card-border: #e5e7eb;
|
|
656
|
+
--color-card-heading: #1f2937;
|
|
657
|
+
--color-card-meta-icon: #4b5563;
|
|
658
|
+
--card-radius: 8px;
|
|
659
|
+
--card-padding: 16px;
|
|
660
|
+
--card-section-gap: 12px; /* root: space between top-level sections (e.g. body vs footer) */
|
|
661
|
+
--card-body-gap: 16px; /* Card.Body: space between title, meta, etc. */
|
|
662
|
+
--card-meta-gap: 6px; /* header / meta / meta-row gaps */
|
|
368
663
|
```
|
|
369
664
|
|
|
665
|
+
**Note:** **`IconCard`** uses **`24px`** padding and **`var(--card-body-gap)`** for its content column—slightly different from **`Card`**’s shell; see `IconCard.module.scss` if you theme both.
|
|
666
|
+
|
|
370
667
|
#### Spacing
|
|
371
668
|
|
|
372
669
|
```css
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emporix/cockpit-component-library",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "A React component library for cockipt projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
@@ -55,6 +55,10 @@
|
|
|
55
55
|
],
|
|
56
56
|
"author": "Emporix",
|
|
57
57
|
"license": "MIT",
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=18.18.0",
|
|
60
|
+
"npm": ">=9"
|
|
61
|
+
},
|
|
58
62
|
"peerDependencies": {
|
|
59
63
|
"react": "^18.0.0",
|
|
60
64
|
"react-dom": "^18.0.0"
|
|
@@ -80,7 +84,7 @@
|
|
|
80
84
|
"eslint-plugin-react": "^7.37.4",
|
|
81
85
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
82
86
|
"husky": "^9.1.7",
|
|
83
|
-
"jsdom": "^
|
|
87
|
+
"jsdom": "^24.1.3",
|
|
84
88
|
"prettier": "^3.8.1",
|
|
85
89
|
"react": "^18.3.1",
|
|
86
90
|
"react-dom": "^18.3.1",
|
|
@@ -96,6 +100,7 @@
|
|
|
96
100
|
"@testing-library/react": "^16.3.2",
|
|
97
101
|
"@testing-library/user-event": "^14.5.2",
|
|
98
102
|
"primereact": "^10.9.7",
|
|
103
|
+
"quill": "^2.0.3",
|
|
99
104
|
"react-icons": "^5.6.0"
|
|
100
105
|
}
|
|
101
106
|
}
|