@emporix/cockpit-component-library 0.0.3 → 0.0.5
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 +74 -0
- package/dist/components/buttons/PrimaryButton.d.ts +11 -3
- package/dist/components/buttons/PrimaryButton.d.ts.map +1 -1
- package/dist/components/buttons/SecondaryButton.d.ts +11 -3
- package/dist/components/buttons/SecondaryButton.d.ts.map +1 -1
- 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 +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +1096 -695
- package/dist/index.umd.js +15 -7
- package/dist/style.css +1 -1
- package/dist/styles.d.ts +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -100,6 +100,59 @@ 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
|
+
A simple surface container for grouping content. Renders `children` inside a bordered, padded panel. Styling uses existing theme variables (`--color-bg-primary`, `--color-border-light`, `--border-radius-lg`, `--spacing-lg`).
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { Card } from '@emporix/cockpit-component-library'
|
|
109
|
+
|
|
110
|
+
// Basic usage
|
|
111
|
+
<Card>
|
|
112
|
+
<h3>Title</h3>
|
|
113
|
+
<p>Description or nested components go here.</p>
|
|
114
|
+
</Card>
|
|
115
|
+
|
|
116
|
+
// With custom class and test id
|
|
117
|
+
<Card className="my-card" data-testid="details-card">
|
|
118
|
+
<p>Content</p>
|
|
119
|
+
</Card>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### Props
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Default | Description |
|
|
125
|
+
| ----------- | --------- | ------- | -------------------------------------------- |
|
|
126
|
+
| children | ReactNode | - | Content displayed inside the card (required) |
|
|
127
|
+
| className | string | - | Additional CSS class on the root element |
|
|
128
|
+
| data-testid | string | - | Test ID for the root element |
|
|
129
|
+
|
|
130
|
+
All standard HTML `div` attributes (e.g. `id`, `role`, `aria-*`, `onClick`) are forwarded to the root element via `CardProps`.
|
|
131
|
+
|
|
132
|
+
### Chip
|
|
133
|
+
|
|
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** (red). Colors are driven by CSS variables (see [Theming with CSS Variables](#theming-with-css-variables)).
|
|
135
|
+
|
|
136
|
+
```tsx
|
|
137
|
+
import { Chip } from '@emporix/cockpit-component-library'
|
|
138
|
+
|
|
139
|
+
<Chip variant="success">submitted</Chip>
|
|
140
|
+
<Chip variant="warning">draft</Chip>
|
|
141
|
+
<Chip variant="info">processed</Chip>
|
|
142
|
+
<Chip variant="error">1 issue</Chip>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
#### Props
|
|
146
|
+
|
|
147
|
+
| Prop | Type | Default | Description |
|
|
148
|
+
| ----------- | --------------------------------------------- | ------- | ---------------------------------------- |
|
|
149
|
+
| variant | `'success' \| 'warning' \| 'info' \| 'error'` | `info` | Visual style / semantic color |
|
|
150
|
+
| children | ReactNode | - | Content inside the chip (required) |
|
|
151
|
+
| className | string | - | Additional CSS class on the root element |
|
|
152
|
+
| data-testid | string | - | Test ID for the root element |
|
|
153
|
+
|
|
154
|
+
The root element is a `<span>`. Standard HTML span attributes are forwarded via `ChipProps`.
|
|
155
|
+
|
|
103
156
|
### InputText
|
|
104
157
|
|
|
105
158
|
A text input with optional label and tooltip. Hover and focus styles match the Dropdown component.
|
|
@@ -299,6 +352,21 @@ Reusable focus outline for inputs, dropdowns, SelectButton, etc. Override to cha
|
|
|
299
352
|
--focus-ring-box-shadow: 0 0 0 2px rgba(38, 101, 183, 0.35);
|
|
300
353
|
```
|
|
301
354
|
|
|
355
|
+
#### Chip (status badge)
|
|
356
|
+
|
|
357
|
+
Background and text colors per variant for the `Chip` component.
|
|
358
|
+
|
|
359
|
+
```css
|
|
360
|
+
--color-chip-success-bg: #e6f4ea;
|
|
361
|
+
--color-chip-success-text: #1e4620;
|
|
362
|
+
--color-chip-warning-bg: #fff8e6;
|
|
363
|
+
--color-chip-warning-text: #b45309;
|
|
364
|
+
--color-chip-info-bg: #e8f4fc;
|
|
365
|
+
--color-chip-info-text: #0b5c8a;
|
|
366
|
+
--color-chip-error-bg: #fdecea;
|
|
367
|
+
--color-chip-error-text: #b42318;
|
|
368
|
+
```
|
|
369
|
+
|
|
302
370
|
#### Spacing
|
|
303
371
|
|
|
304
372
|
```css
|
|
@@ -461,6 +529,12 @@ The build output includes:
|
|
|
461
529
|
- TypeScript declarations (`index.d.ts`)
|
|
462
530
|
- CSS styles (`styles.css`)
|
|
463
531
|
|
|
532
|
+
To publish a new version, run:
|
|
533
|
+
|
|
534
|
+
```bash
|
|
535
|
+
npm run publish
|
|
536
|
+
```
|
|
537
|
+
|
|
464
538
|
## Code Formatting
|
|
465
539
|
|
|
466
540
|
This project uses Prettier for consistent code formatting. The configuration is defined in `.prettierrc`.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export interface PrimaryButtonProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Text label displayed inside the button
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
label?: string;
|
|
7
7
|
/**
|
|
8
8
|
* Whether the button is disabled
|
|
9
9
|
*/
|
|
@@ -12,6 +12,14 @@ export interface PrimaryButtonProps {
|
|
|
12
12
|
* Whether the button is loading
|
|
13
13
|
*/
|
|
14
14
|
loading?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Optional icon
|
|
17
|
+
*/
|
|
18
|
+
icon?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Icon position relative to the label
|
|
21
|
+
*/
|
|
22
|
+
iconPos?: 'left' | 'right';
|
|
15
23
|
/**
|
|
16
24
|
* Click handler
|
|
17
25
|
*/
|
|
@@ -25,5 +33,5 @@ export interface PrimaryButtonProps {
|
|
|
25
33
|
*/
|
|
26
34
|
'data-testid'?: string;
|
|
27
35
|
}
|
|
28
|
-
export declare const PrimaryButton: ({
|
|
36
|
+
export declare const PrimaryButton: ({ label, disabled, loading, icon, iconPos, onClick, className, "data-testid": testId, ...props }: PrimaryButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
37
|
//# sourceMappingURL=PrimaryButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimaryButton.d.ts","sourceRoot":"","sources":["../../../src/components/buttons/PrimaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"PrimaryButton.d.ts","sourceRoot":"","sources":["../../../src/components/buttons/PrimaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,aAAa,GAAI,kGAU3B,kBAAkB,4CAuCpB,CAAA"}
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
export interface SecondaryButtonProps {
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Text label displayed inside the button
|
|
5
5
|
*/
|
|
6
|
-
|
|
6
|
+
label?: string;
|
|
7
7
|
/**
|
|
8
8
|
* Whether the button is disabled
|
|
9
9
|
*/
|
|
10
10
|
disabled?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Optional icon
|
|
13
|
+
*/
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Icon position relative to the label
|
|
17
|
+
*/
|
|
18
|
+
iconPos?: 'left' | 'right';
|
|
11
19
|
/**
|
|
12
20
|
* Click handler
|
|
13
21
|
*/
|
|
@@ -21,5 +29,5 @@ export interface SecondaryButtonProps {
|
|
|
21
29
|
*/
|
|
22
30
|
'data-testid'?: string;
|
|
23
31
|
}
|
|
24
|
-
export declare const SecondaryButton: ({
|
|
32
|
+
export declare const SecondaryButton: ({ label, disabled, icon, iconPos, onClick, className, "data-testid": testId, ...props }: SecondaryButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
33
|
//# sourceMappingURL=SecondaryButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../src/components/buttons/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../src/components/buttons/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC1B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,eAAO,MAAM,eAAe,GAAI,yFAS7B,oBAAoB,4CAmCtB,CAAA"}
|
|
@@ -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
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* For components to render with correct layout and styles in your app,
|
|
5
5
|
* import the library styles once (e.g. in your root entry or App):
|
|
6
6
|
*
|
|
7
|
-
* import '@emporix/component-library/styles'
|
|
7
|
+
* import '@emporix/cockpit-component-library/styles'
|
|
8
8
|
*
|
|
9
|
-
* Or in CSS: @import '@emporix/component-library/styles';
|
|
9
|
+
* Or in CSS: @import '@emporix/cockpit-component-library/styles';
|
|
10
10
|
*/
|
|
11
11
|
export { PrimaryButton } from './components/buttons/PrimaryButton';
|
|
12
12
|
export type { PrimaryButtonProps } from './components/buttons/PrimaryButton';
|
|
@@ -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,EA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