@emporix/cockpit-component-library 0.0.4 → 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 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`.
@@ -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
@@ -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,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