@emporix/cockpit-component-library 0.0.5 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -12
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -102,10 +102,11 @@ import { PrimaryButton } from '@emporix/cockpit-component-library'
|
|
|
102
102
|
|
|
103
103
|
### Card
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
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
106
|
|
|
107
107
|
```tsx
|
|
108
|
-
import { Card } from '@emporix/cockpit-component-library'
|
|
108
|
+
import { Card, Chip, TertiaryButton } from '@emporix/cockpit-component-library'
|
|
109
|
+
import { FiEdit2, FiTrash2 } from 'react-icons/fi'
|
|
109
110
|
|
|
110
111
|
// Basic usage
|
|
111
112
|
<Card>
|
|
@@ -113,6 +114,32 @@ import { Card } from '@emporix/cockpit-component-library'
|
|
|
113
114
|
<p>Description or nested components go here.</p>
|
|
114
115
|
</Card>
|
|
115
116
|
|
|
117
|
+
// Structured card (see Storybook “IssueCard”)
|
|
118
|
+
<Card>
|
|
119
|
+
<Card.Body>
|
|
120
|
+
<Card.Header
|
|
121
|
+
tag={<Chip variant="error">Blocker</Chip>}
|
|
122
|
+
actions={
|
|
123
|
+
<>
|
|
124
|
+
<Card.IconButton type="button" aria-label="Edit">
|
|
125
|
+
<FiEdit2 />
|
|
126
|
+
</Card.IconButton>
|
|
127
|
+
<Card.IconButton type="button" aria-label="Delete">
|
|
128
|
+
<FiTrash2 />
|
|
129
|
+
</Card.IconButton>
|
|
130
|
+
</>
|
|
131
|
+
}
|
|
132
|
+
/>
|
|
133
|
+
<Card.Title>Issue headline</Card.Title>
|
|
134
|
+
<Card.Meta>
|
|
135
|
+
<Card.MetaRow icon={<span />}>Supporting detail line</Card.MetaRow>
|
|
136
|
+
</Card.Meta>
|
|
137
|
+
</Card.Body>
|
|
138
|
+
<Card.Footer>
|
|
139
|
+
<TertiaryButton label="Edit" icon={<FiEdit2 />} iconPos="left" />
|
|
140
|
+
</Card.Footer>
|
|
141
|
+
</Card>
|
|
142
|
+
|
|
116
143
|
// With custom class and test id
|
|
117
144
|
<Card className="my-card" data-testid="details-card">
|
|
118
145
|
<p>Content</p>
|
|
@@ -127,11 +154,11 @@ import { Card } from '@emporix/cockpit-component-library'
|
|
|
127
154
|
| className | string | - | Additional CSS class on the root element |
|
|
128
155
|
| data-testid | string | - | Test ID for the root element |
|
|
129
156
|
|
|
130
|
-
All standard HTML `div` attributes (e.g. `id`, `role`, `aria-*`, `onClick`) are forwarded to the root element via `CardProps`.
|
|
157
|
+
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
158
|
|
|
132
159
|
### Chip
|
|
133
160
|
|
|
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** (
|
|
161
|
+
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
162
|
|
|
136
163
|
```tsx
|
|
137
164
|
import { Chip } from '@emporix/cockpit-component-library'
|
|
@@ -357,16 +384,37 @@ Reusable focus outline for inputs, dropdowns, SelectButton, etc. Override to cha
|
|
|
357
384
|
Background and text colors per variant for the `Chip` component.
|
|
358
385
|
|
|
359
386
|
```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-
|
|
387
|
+
--color-chip-success-bg: #ecfdf5;
|
|
388
|
+
--color-chip-success-text: #059669;
|
|
389
|
+
--color-chip-success-border: #a7f3d0;
|
|
390
|
+
--color-chip-warning-bg: #fffbeb;
|
|
391
|
+
--color-chip-warning-text: #d97706;
|
|
392
|
+
--color-chip-warning-border: #fde68a;
|
|
393
|
+
--color-chip-info-bg: #eff6ff;
|
|
394
|
+
--color-chip-info-text: #2563eb;
|
|
395
|
+
--color-chip-info-border: #bfdbfe;
|
|
396
|
+
--color-chip-error-bg: #fef2f2;
|
|
397
|
+
--color-chip-error-text: #dc2626;
|
|
398
|
+
--color-chip-error-border: #fecaca;
|
|
368
399
|
```
|
|
369
400
|
|
|
401
|
+
#### Card layout tokens
|
|
402
|
+
|
|
403
|
+
Used by **`Card`** (`Card.module.scss`). Defaults match `src/styles/index.scss`; override on `:root` or a wrapper to change card rhythm app-wide.
|
|
404
|
+
|
|
405
|
+
```css
|
|
406
|
+
--color-card-border: #e5e7eb;
|
|
407
|
+
--color-card-heading: #1f2937;
|
|
408
|
+
--color-card-meta-icon: #4b5563;
|
|
409
|
+
--card-radius: 8px;
|
|
410
|
+
--card-padding: 16px;
|
|
411
|
+
--card-section-gap: 12px; /* root: space between top-level sections (e.g. body vs footer) */
|
|
412
|
+
--card-body-gap: 16px; /* Card.Body: space between title, meta, etc. */
|
|
413
|
+
--card-meta-gap: 6px; /* header / meta / meta-row gaps */
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
**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.
|
|
417
|
+
|
|
370
418
|
#### Spacing
|
|
371
419
|
|
|
372
420
|
```css
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emporix/cockpit-component-library",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "1.0.0",
|
|
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
|
}
|