@emporix/cockpit-component-library 0.0.4 → 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 +122 -0
- package/dist/components/card/Card.d.ts +20 -0
- package/dist/components/card/Card.d.ts.map +1 -0
- package/dist/components/chip/Chip.d.ts +25 -0
- package/dist/components/chip/Chip.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1093 -710
- package/dist/index.umd.js +15 -7
- package/dist/style.css +1 -1
- package/package.json +13 -8
package/README.md
CHANGED
|
@@ -100,6 +100,86 @@ import { PrimaryButton } from '@emporix/cockpit-component-library'
|
|
|
100
100
|
| className | string | - | Additional CSS class |
|
|
101
101
|
| data-testid | string | - | Test ID for testing |
|
|
102
102
|
|
|
103
|
+
### Card
|
|
104
|
+
|
|
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
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { Card, Chip, TertiaryButton } from '@emporix/cockpit-component-library'
|
|
109
|
+
import { FiEdit2, FiTrash2 } from 'react-icons/fi'
|
|
110
|
+
|
|
111
|
+
// Basic usage
|
|
112
|
+
<Card>
|
|
113
|
+
<h3>Title</h3>
|
|
114
|
+
<p>Description or nested components go here.</p>
|
|
115
|
+
</Card>
|
|
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
|
+
|
|
143
|
+
// With custom class and test id
|
|
144
|
+
<Card className="my-card" data-testid="details-card">
|
|
145
|
+
<p>Content</p>
|
|
146
|
+
</Card>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### Props
|
|
150
|
+
|
|
151
|
+
| Prop | Type | Default | Description |
|
|
152
|
+
| ----------- | --------- | ------- | -------------------------------------------- |
|
|
153
|
+
| children | ReactNode | - | Content displayed inside the card (required) |
|
|
154
|
+
| className | string | - | Additional CSS class on the root element |
|
|
155
|
+
| data-testid | string | - | Test ID for the root element |
|
|
156
|
+
|
|
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.).
|
|
158
|
+
|
|
159
|
+
### Chip
|
|
160
|
+
|
|
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)).
|
|
162
|
+
|
|
163
|
+
```tsx
|
|
164
|
+
import { Chip } from '@emporix/cockpit-component-library'
|
|
165
|
+
|
|
166
|
+
<Chip variant="success">submitted</Chip>
|
|
167
|
+
<Chip variant="warning">draft</Chip>
|
|
168
|
+
<Chip variant="info">processed</Chip>
|
|
169
|
+
<Chip variant="error">1 issue</Chip>
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
#### Props
|
|
173
|
+
|
|
174
|
+
| Prop | Type | Default | Description |
|
|
175
|
+
| ----------- | --------------------------------------------- | ------- | ---------------------------------------- |
|
|
176
|
+
| variant | `'success' \| 'warning' \| 'info' \| 'error'` | `info` | Visual style / semantic color |
|
|
177
|
+
| children | ReactNode | - | Content inside the chip (required) |
|
|
178
|
+
| className | string | - | Additional CSS class on the root element |
|
|
179
|
+
| data-testid | string | - | Test ID for the root element |
|
|
180
|
+
|
|
181
|
+
The root element is a `<span>`. Standard HTML span attributes are forwarded via `ChipProps`.
|
|
182
|
+
|
|
103
183
|
### InputText
|
|
104
184
|
|
|
105
185
|
A text input with optional label and tooltip. Hover and focus styles match the Dropdown component.
|
|
@@ -299,6 +379,42 @@ Reusable focus outline for inputs, dropdowns, SelectButton, etc. Override to cha
|
|
|
299
379
|
--focus-ring-box-shadow: 0 0 0 2px rgba(38, 101, 183, 0.35);
|
|
300
380
|
```
|
|
301
381
|
|
|
382
|
+
#### Chip (status badge)
|
|
383
|
+
|
|
384
|
+
Background and text colors per variant for the `Chip` component.
|
|
385
|
+
|
|
386
|
+
```css
|
|
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;
|
|
399
|
+
```
|
|
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
|
+
|
|
302
418
|
#### Spacing
|
|
303
419
|
|
|
304
420
|
```css
|
|
@@ -461,6 +577,12 @@ The build output includes:
|
|
|
461
577
|
- TypeScript declarations (`index.d.ts`)
|
|
462
578
|
- CSS styles (`styles.css`)
|
|
463
579
|
|
|
580
|
+
To publish a new version, run:
|
|
581
|
+
|
|
582
|
+
```bash
|
|
583
|
+
npm run publish
|
|
584
|
+
```
|
|
585
|
+
|
|
464
586
|
## Code Formatting
|
|
465
587
|
|
|
466
588
|
This project uses Prettier for consistent code formatting. The configuration is defined in `.prettierrc`.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/**
|
|
4
|
+
* Card content.
|
|
5
|
+
*/
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Additional CSS class name.
|
|
9
|
+
*/
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Test ID for testing.
|
|
13
|
+
*/
|
|
14
|
+
'data-testid'?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Simple card container component used to display nested content.
|
|
18
|
+
*/
|
|
19
|
+
export declare const Card: ({ children, className, "data-testid": testId, ...props }: CardProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../src/components/card/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACrE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,0DAKlB,SAAS,4CAQX,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export type ChipVariant = 'error' | 'info' | 'success' | 'warning';
|
|
3
|
+
export interface ChipProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Visual style: success (green), warning (orange), info (blue), error (red).
|
|
6
|
+
*/
|
|
7
|
+
variant?: ChipVariant;
|
|
8
|
+
/**
|
|
9
|
+
* Label or content inside the chip.
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Additional CSS class name.
|
|
14
|
+
*/
|
|
15
|
+
className?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Test ID for testing.
|
|
18
|
+
*/
|
|
19
|
+
'data-testid'?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Compact pill-shaped status label with semantic color variants.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Chip: ({ variant, children, className, "data-testid": testId, ...props }: ChipProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/chip/Chip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAA;AAElE,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;IACtE;;OAEG;IACH,OAAO,CAAC,EAAE,WAAW,CAAA;IACrB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AASD;;GAEG;AACH,eAAO,MAAM,IAAI,GAAI,mEAMlB,SAAS,4CAUX,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -20,4 +20,8 @@ export { InputText } from './components/input/InputText';
|
|
|
20
20
|
export type { InputTextProps } from './components/input/InputText';
|
|
21
21
|
export { SelectButton } from './components/selectbutton/SelectButton';
|
|
22
22
|
export type { SelectButtonProps, SelectButtonOption, SelectButtonChangeEvent, } from './components/selectbutton/SelectButton';
|
|
23
|
+
export { Card } from './components/card/Card';
|
|
24
|
+
export type { CardProps } from './components/card/Card';
|
|
25
|
+
export { Chip } from './components/chip/Chip';
|
|
26
|
+
export type { ChipProps, ChipVariant } from './components/chip/Chip';
|
|
23
27
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAClE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAA;AAE5E,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAA;AACtE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAA;AAEhF,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAEhE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,YAAY,EACV,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAA;AACrE,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,u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