@dtlvmw/react 0.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/dist/index.d.ts +457 -0
- package/dist/index.js +772 -0
- package/guidelines/Guidelines.md +53 -0
- package/guidelines/components/accordion.md +109 -0
- package/guidelines/components/alert.md +107 -0
- package/guidelines/components/badge-label.md +100 -0
- package/guidelines/components/breadcrumbs.md +45 -0
- package/guidelines/components/button.md +77 -0
- package/guidelines/components/card.md +78 -0
- package/guidelines/components/dropdown.md +75 -0
- package/guidelines/components/forms.md +133 -0
- package/guidelines/components/header.md +59 -0
- package/guidelines/components/icon.md +64 -0
- package/guidelines/components/login.md +59 -0
- package/guidelines/components/modal.md +87 -0
- package/guidelines/components/progress.md +75 -0
- package/guidelines/components/spinner.md +52 -0
- package/guidelines/components/stack-view.md +57 -0
- package/guidelines/components/table.md +76 -0
- package/guidelines/components/tabs.md +70 -0
- package/guidelines/components/timeline.md +87 -0
- package/guidelines/components/wizard.md +160 -0
- package/guidelines/design-tokens/colors.md +21 -0
- package/guidelines/design-tokens/spacing.md +15 -0
- package/guidelines/design-tokens/typography.md +11 -0
- package/guidelines/overview-components.md +48 -0
- package/guidelines/tier2/combobox.md +48 -0
- package/guidelines/tier2/datagrid.md +62 -0
- package/guidelines/tier2/datepicker.md +26 -0
- package/guidelines/tier2/overview.md +69 -0
- package/guidelines/tier2/popovers.md +81 -0
- package/guidelines/tier2/stepper.md +39 -0
- package/guidelines/tier2/tree-view.md +45 -0
- package/guidelines/tier2/vertical-nav.md +52 -0
- package/package.json +52 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Clarity Design System — React Components for Figma MAKE
|
|
2
|
+
|
|
3
|
+
This package provides React components for the Clarity Design System. Components are split into two tiers:
|
|
4
|
+
|
|
5
|
+
## Tier 1: CSS-Only Components (this section)
|
|
6
|
+
|
|
7
|
+
Pure React components that use Clarity CSS classes on standard HTML elements. **No Angular runtime required.** These are lightweight and have zero JavaScript framework overhead beyond React itself.
|
|
8
|
+
|
|
9
|
+
## Tier 2: Angular Element Components
|
|
10
|
+
|
|
11
|
+
Complex interactive components (Datagrid, Tree View, Stepper, etc.) backed by `@angular/elements`. These import the actual Angular component logic as web components. See the `tier2/` guidelines folder.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
// 1. Import Clarity CSS (required for all components)
|
|
17
|
+
import '@dtlvmw/ui/clr-ui.min.css';
|
|
18
|
+
|
|
19
|
+
// 2. Import React components
|
|
20
|
+
import { Button, Alert, Card, Modal, Wizard, WizardPage, CdsIcon } from '@dtlvmw/react';
|
|
21
|
+
|
|
22
|
+
// 3. For Tier 2 components only — import the elements bundle
|
|
23
|
+
// import '@dtlvmw/elements';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Tier 1 Components (CSS-Only)
|
|
27
|
+
|
|
28
|
+
| Component | Description |
|
|
29
|
+
|-----------|-------------|
|
|
30
|
+
| **Button** | Action trigger — solid, outline, link styles |
|
|
31
|
+
| **Alert** | Notification banners — info, success, warning, danger |
|
|
32
|
+
| **Badge** | Numeric/status indicators |
|
|
33
|
+
| **Label** | Categorization tags with colors |
|
|
34
|
+
| **Card** | Content containers with header, body, footer |
|
|
35
|
+
| **Modal** | Overlay dialogs with backdrop |
|
|
36
|
+
| **Input** | Text input with label and validation states |
|
|
37
|
+
| **Select** | Dropdown select |
|
|
38
|
+
| **Checkbox** | Binary toggle |
|
|
39
|
+
| **Toggle** | Switch-style toggle |
|
|
40
|
+
| **Tabs** | Tabbed navigation with panels |
|
|
41
|
+
| **Dropdown** | Action menu (CSS-based open/close) |
|
|
42
|
+
| **Accordion** | Collapsible content panels |
|
|
43
|
+
| **Spinner** | Loading indicator |
|
|
44
|
+
| **ProgressBar** | Determinate/indeterminate progress |
|
|
45
|
+
| **Timeline** | Horizontal/vertical step sequence |
|
|
46
|
+
| **StackView** | Expandable key-value blocks |
|
|
47
|
+
| **Header** | App header with nav and branding |
|
|
48
|
+
| **Table** | Styled data table |
|
|
49
|
+
| **Login** | Login page layout |
|
|
50
|
+
| **Wizard** | Multi-step modal wizard with composable pages |
|
|
51
|
+
| **CdsIcon** | Pure React SVG icon (reads from Clarity icon registry) |
|
|
52
|
+
|
|
53
|
+
See individual component guidelines in the `components/` folder for detailed API reference and usage examples.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Accordion
|
|
2
|
+
|
|
3
|
+
Collapsible content panels for organizing sections of content.
|
|
4
|
+
|
|
5
|
+
## HTML/CSS Template
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<div class="clr-accordion">
|
|
9
|
+
<!-- Open panel -->
|
|
10
|
+
<div class="clr-accordion-panel">
|
|
11
|
+
<div class="clr-accordion-panel-open">
|
|
12
|
+
<div class="clr-accordion-header">
|
|
13
|
+
<button type="button" class="clr-accordion-header-button" aria-expanded="true">
|
|
14
|
+
<span class="clr-accordion-status">
|
|
15
|
+
<cds-icon shape="angle" direction="right" class="clr-accordion-angle"></cds-icon>
|
|
16
|
+
</span>
|
|
17
|
+
<span class="clr-accordion-title">Panel 1</span>
|
|
18
|
+
</button>
|
|
19
|
+
</div>
|
|
20
|
+
<div role="region" class="clr-accordion-content-region">
|
|
21
|
+
<div class="clr-accordion-content">
|
|
22
|
+
<div class="clr-accordion-inner-content">
|
|
23
|
+
Panel 1 content goes here.
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<!-- Closed panel -->
|
|
31
|
+
<div class="clr-accordion-panel">
|
|
32
|
+
<div class="clr-accordion-panel-closed">
|
|
33
|
+
<div class="clr-accordion-header">
|
|
34
|
+
<button type="button" class="clr-accordion-header-button" aria-expanded="false">
|
|
35
|
+
<span class="clr-accordion-status">
|
|
36
|
+
<cds-icon shape="angle" direction="right" class="clr-accordion-angle"></cds-icon>
|
|
37
|
+
</span>
|
|
38
|
+
<span class="clr-accordion-title">Panel 2</span>
|
|
39
|
+
</button>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<!-- Disabled panel -->
|
|
45
|
+
<div class="clr-accordion-panel clr-accordion-panel-disabled">
|
|
46
|
+
<div class="clr-accordion-panel-closed">
|
|
47
|
+
<div class="clr-accordion-header">
|
|
48
|
+
<button type="button" class="clr-accordion-header-button" disabled>
|
|
49
|
+
<span class="clr-accordion-status">
|
|
50
|
+
<cds-icon shape="angle" direction="right" class="clr-accordion-angle"></cds-icon>
|
|
51
|
+
</span>
|
|
52
|
+
<span class="clr-accordion-title">Disabled Panel</span>
|
|
53
|
+
</button>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### CSS Classes
|
|
61
|
+
|
|
62
|
+
| Class | Description |
|
|
63
|
+
|-------|-------------|
|
|
64
|
+
| `clr-accordion` | Accordion container (required) |
|
|
65
|
+
| `clr-accordion-panel` | Panel wrapper |
|
|
66
|
+
| `clr-accordion-panel-open` | Open state wrapper |
|
|
67
|
+
| `clr-accordion-panel-closed` | Closed state wrapper |
|
|
68
|
+
| `clr-accordion-panel-disabled` | Disabled panel |
|
|
69
|
+
| `clr-accordion-header` | Header container |
|
|
70
|
+
| `clr-accordion-header-button` | Clickable header button |
|
|
71
|
+
| `clr-accordion-status` | Icon container |
|
|
72
|
+
| `clr-accordion-angle` | Chevron icon |
|
|
73
|
+
| `clr-accordion-title` | Panel title text |
|
|
74
|
+
| `clr-accordion-content-region` | Content wrapper (visible when open) |
|
|
75
|
+
| `clr-accordion-content` | Content inner wrapper |
|
|
76
|
+
| `clr-accordion-inner-content` | Innermost content |
|
|
77
|
+
|
|
78
|
+
## React Component
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
import { Accordion, AccordionPanel } from '@dtlvmw/react';
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### AccordionPanel Props
|
|
85
|
+
|
|
86
|
+
| Prop | Type | Default | Description |
|
|
87
|
+
|------|------|---------|-------------|
|
|
88
|
+
| `panelOpen` | `boolean` | — | Whether the panel is expanded |
|
|
89
|
+
| `disabled` | `boolean` | — | Disables the panel |
|
|
90
|
+
| `title` | `ReactNode` | — | Panel header text |
|
|
91
|
+
| `onToggle` | `() => void` | — | Called when header is clicked |
|
|
92
|
+
|
|
93
|
+
### Example
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
const [open, setOpen] = useState<number | null>(0);
|
|
97
|
+
|
|
98
|
+
<Accordion>
|
|
99
|
+
<AccordionPanel title="Section 1" panelOpen={open === 0} onToggle={() => setOpen(open === 0 ? null : 0)}>
|
|
100
|
+
Content for section 1.
|
|
101
|
+
</AccordionPanel>
|
|
102
|
+
<AccordionPanel title="Section 2" panelOpen={open === 1} onToggle={() => setOpen(open === 1 ? null : 1)}>
|
|
103
|
+
Content for section 2.
|
|
104
|
+
</AccordionPanel>
|
|
105
|
+
<AccordionPanel title="Disabled" disabled>
|
|
106
|
+
Cannot open this.
|
|
107
|
+
</AccordionPanel>
|
|
108
|
+
</Accordion>
|
|
109
|
+
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
Notification banners for displaying contextual messages.
|
|
4
|
+
|
|
5
|
+
## HTML/CSS Template
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Info alert (default) -->
|
|
9
|
+
<div class="alert alert-info">
|
|
10
|
+
<div class="alert-items">
|
|
11
|
+
<div class="alert-item static">
|
|
12
|
+
<div class="alert-icon-wrapper">
|
|
13
|
+
<cds-icon class="alert-icon" shape="info-circle"></cds-icon>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="alert-text">This is an info alert.</div>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
<button type="button" class="close">
|
|
19
|
+
<cds-icon shape="times"></cds-icon>
|
|
20
|
+
</button>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<!-- Danger alert, small, not closable -->
|
|
24
|
+
<div class="alert alert-danger alert-sm">
|
|
25
|
+
<div class="alert-items">
|
|
26
|
+
<div class="alert-item static">
|
|
27
|
+
<div class="alert-icon-wrapper">
|
|
28
|
+
<cds-icon class="alert-icon" shape="exclamation-circle"></cds-icon>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="alert-text">Error occurred.</div>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<!-- App-level alert -->
|
|
36
|
+
<div class="alert alert-warning alert-app-level">
|
|
37
|
+
<div class="alert-items">
|
|
38
|
+
<div class="alert-item static">
|
|
39
|
+
<div class="alert-icon-wrapper">
|
|
40
|
+
<cds-icon class="alert-icon" shape="exclamation-triangle"></cds-icon>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="alert-text">Maintenance scheduled.</div>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<!-- Lightweight alert -->
|
|
48
|
+
<div class="alert alert-success alert-lightweight">
|
|
49
|
+
<div class="alert-items">
|
|
50
|
+
<div class="alert-item static">
|
|
51
|
+
<div class="alert-icon-wrapper">
|
|
52
|
+
<cds-icon class="alert-icon" shape="check-circle"></cds-icon>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="alert-text">Operation succeeded.</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### CSS Classes
|
|
61
|
+
|
|
62
|
+
| Class | Description |
|
|
63
|
+
|-------|-------------|
|
|
64
|
+
| `alert` | Base class (required) |
|
|
65
|
+
| `alert-info` | Blue info style |
|
|
66
|
+
| `alert-success` | Green success style |
|
|
67
|
+
| `alert-warning` | Yellow warning style |
|
|
68
|
+
| `alert-danger` | Red danger style |
|
|
69
|
+
| `alert-sm` | Compact size |
|
|
70
|
+
| `alert-lightweight` | Lightweight style (no background) |
|
|
71
|
+
| `alert-app-level` | Full-width app-level banner |
|
|
72
|
+
|
|
73
|
+
### Icon Mapping
|
|
74
|
+
|
|
75
|
+
| Alert Type | Icon Shape |
|
|
76
|
+
|------------|------------|
|
|
77
|
+
| `info` | `info-circle` |
|
|
78
|
+
| `success` | `check-circle` |
|
|
79
|
+
| `warning` | `exclamation-triangle` |
|
|
80
|
+
| `danger` | `exclamation-circle` |
|
|
81
|
+
|
|
82
|
+
## React Component
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
import { Alert } from '@dtlvmw/react';
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Props
|
|
89
|
+
|
|
90
|
+
| Prop | Type | Default | Description |
|
|
91
|
+
|------|------|---------|-------------|
|
|
92
|
+
| `alertType` | `'info' \| 'warning' \| 'danger' \| 'success'` | `'info'` | Alert color/type |
|
|
93
|
+
| `closable` | `boolean` | `true` | Shows close button |
|
|
94
|
+
| `small` | `boolean` | — | Compact size |
|
|
95
|
+
| `lightweight` | `boolean` | — | Lightweight style |
|
|
96
|
+
| `appLevel` | `boolean` | — | App-level banner |
|
|
97
|
+
| `onClose` | `() => void` | — | Called when close button clicked |
|
|
98
|
+
|
|
99
|
+
### Examples
|
|
100
|
+
|
|
101
|
+
```tsx
|
|
102
|
+
<Alert alertType="info">This is informational.</Alert>
|
|
103
|
+
<Alert alertType="danger" closable={false}>Critical error.</Alert>
|
|
104
|
+
<Alert alertType="success" small>Saved!</Alert>
|
|
105
|
+
<Alert alertType="warning" appLevel>Maintenance window tonight.</Alert>
|
|
106
|
+
<Alert alertType="info" lightweight>Subtle notification.</Alert>
|
|
107
|
+
```
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Badge & Label
|
|
2
|
+
|
|
3
|
+
## Badge
|
|
4
|
+
|
|
5
|
+
Numeric or status indicators.
|
|
6
|
+
|
|
7
|
+
### HTML/CSS Template
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<span class="badge">42</span>
|
|
11
|
+
<span class="badge badge-info">Info</span>
|
|
12
|
+
<span class="badge badge-success">3</span>
|
|
13
|
+
<span class="badge badge-warning">!</span>
|
|
14
|
+
<span class="badge badge-danger">9</span>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### CSS Classes
|
|
18
|
+
|
|
19
|
+
| Class | Description |
|
|
20
|
+
|-------|-------------|
|
|
21
|
+
| `badge` | Base class (required) |
|
|
22
|
+
| `badge-info` | Blue badge |
|
|
23
|
+
| `badge-success` | Green badge |
|
|
24
|
+
| `badge-warning` | Yellow badge |
|
|
25
|
+
| `badge-danger` | Red badge |
|
|
26
|
+
| `badge-gray` | Gray badge |
|
|
27
|
+
| `badge-orange` | Orange badge |
|
|
28
|
+
| `badge-purple` | Purple badge |
|
|
29
|
+
|
|
30
|
+
### React Component
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { Badge } from '@dtlvmw/react';
|
|
34
|
+
|
|
35
|
+
<Badge>42</Badge>
|
|
36
|
+
<Badge color="success">3</Badge>
|
|
37
|
+
<Badge color="danger">9</Badge>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
#### Props
|
|
41
|
+
|
|
42
|
+
| Prop | Type | Default | Description |
|
|
43
|
+
|------|------|---------|-------------|
|
|
44
|
+
| `color` | `'info' \| 'success' \| 'warning' \| 'danger' \| 'gray' \| ...` | — | Badge color |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Label
|
|
49
|
+
|
|
50
|
+
Categorization tags with colors and states.
|
|
51
|
+
|
|
52
|
+
### HTML/CSS Template
|
|
53
|
+
|
|
54
|
+
```html
|
|
55
|
+
<span class="label">Default</span>
|
|
56
|
+
<span class="label label-info">Info</span>
|
|
57
|
+
<span class="label label-success solid">Solid Success</span>
|
|
58
|
+
<span class="label label-warning clickable">Clickable</span>
|
|
59
|
+
<span class="label label-danger disabled">Disabled</span>
|
|
60
|
+
|
|
61
|
+
<!-- Label with badge -->
|
|
62
|
+
<span class="label label-info">
|
|
63
|
+
Category <span class="badge">5</span>
|
|
64
|
+
</span>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### CSS Classes
|
|
68
|
+
|
|
69
|
+
| Class | Description |
|
|
70
|
+
|-------|-------------|
|
|
71
|
+
| `label` | Base class (required) |
|
|
72
|
+
| `label-info` | Blue label |
|
|
73
|
+
| `label-success` | Green label |
|
|
74
|
+
| `label-warning` | Yellow label |
|
|
75
|
+
| `label-danger` | Red label |
|
|
76
|
+
| `solid` | Solid background fill |
|
|
77
|
+
| `clickable` | Hover/click styling |
|
|
78
|
+
| `disabled` | Muted disabled state |
|
|
79
|
+
|
|
80
|
+
### React Component
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { Label } from '@dtlvmw/react';
|
|
84
|
+
|
|
85
|
+
<Label color="info">Status</Label>
|
|
86
|
+
<Label color="success" labelType="solid">Active</Label>
|
|
87
|
+
<Label color="danger" clickable>Remove</Label>
|
|
88
|
+
<Label color="info" badgeText="5">Category</Label>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### Props
|
|
92
|
+
|
|
93
|
+
| Prop | Type | Default | Description |
|
|
94
|
+
|------|------|---------|-------------|
|
|
95
|
+
| `color` | `'info' \| 'success' \| 'warning' \| 'danger' \| ...` | — | Color variant |
|
|
96
|
+
| `labelType` | `'solid' \| 'outlined'` | — | Fill style |
|
|
97
|
+
| `clickable` | `boolean` | — | Clickable appearance |
|
|
98
|
+
| `disabled` | `boolean` | — | Disabled state |
|
|
99
|
+
| `text` | `string` | — | Label text (alternative to children) |
|
|
100
|
+
| `badgeText` | `string` | — | Badge text inside the label |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Breadcrumbs
|
|
2
|
+
|
|
3
|
+
Navigation breadcrumbs for showing page hierarchy.
|
|
4
|
+
|
|
5
|
+
## HTML/CSS Template
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<nav class="clr-breadcrumb" aria-label="Breadcrumbs">
|
|
9
|
+
<ol>
|
|
10
|
+
<li><a href="#">Home</a></li>
|
|
11
|
+
<li><a href="#">Settings</a></li>
|
|
12
|
+
<li><span aria-current="page">Profile</span></li>
|
|
13
|
+
</ol>
|
|
14
|
+
</nav>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### CSS Classes
|
|
18
|
+
|
|
19
|
+
| Class | Description |
|
|
20
|
+
|-------|-------------|
|
|
21
|
+
| `clr-breadcrumb` | Container `nav` element (required) |
|
|
22
|
+
|
|
23
|
+
## React Component
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import { Breadcrumbs } from '@dtlvmw/react';
|
|
27
|
+
|
|
28
|
+
<Breadcrumbs
|
|
29
|
+
items={[
|
|
30
|
+
{ label: 'Home', href: '/' },
|
|
31
|
+
{ label: 'Settings', href: '/settings' },
|
|
32
|
+
{ label: 'Profile', active: true },
|
|
33
|
+
]}
|
|
34
|
+
onItemClick={(item) => navigate(item.href)}
|
|
35
|
+
/>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Props
|
|
39
|
+
|
|
40
|
+
| Prop | Type | Default | Description |
|
|
41
|
+
|------|------|---------|-------------|
|
|
42
|
+
| `items` | `BreadcrumbItem[]` | `[]` | Breadcrumb items |
|
|
43
|
+
| `onItemClick` | `(item) => void` | — | Click handler |
|
|
44
|
+
|
|
45
|
+
**BreadcrumbItem**: `{ label: string; href?: string; active?: boolean }`
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Button
|
|
2
|
+
|
|
3
|
+
Action trigger component with multiple visual styles and states.
|
|
4
|
+
|
|
5
|
+
## HTML/CSS Template
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Primary solid -->
|
|
9
|
+
<button class="btn btn-primary">Primary</button>
|
|
10
|
+
|
|
11
|
+
<!-- Success outline -->
|
|
12
|
+
<button class="btn btn-success-outline">Success</button>
|
|
13
|
+
|
|
14
|
+
<!-- Link style -->
|
|
15
|
+
<button class="btn btn-link">Link</button>
|
|
16
|
+
|
|
17
|
+
<!-- Small -->
|
|
18
|
+
<button class="btn btn-primary btn-sm">Small</button>
|
|
19
|
+
|
|
20
|
+
<!-- Block (full width) -->
|
|
21
|
+
<button class="btn btn-primary btn-block">Full Width</button>
|
|
22
|
+
|
|
23
|
+
<!-- Loading -->
|
|
24
|
+
<button class="btn btn-primary btn-loading" disabled>
|
|
25
|
+
<span class="spinner spinner-inline"></span>
|
|
26
|
+
Saving...
|
|
27
|
+
</button>
|
|
28
|
+
|
|
29
|
+
<!-- Disabled -->
|
|
30
|
+
<button class="btn btn-primary" disabled>Disabled</button>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### CSS Classes
|
|
34
|
+
|
|
35
|
+
| Class | Description |
|
|
36
|
+
|-------|-------------|
|
|
37
|
+
| `btn` | Base button class (required) |
|
|
38
|
+
| `btn-primary` | Blue primary button |
|
|
39
|
+
| `btn-success` | Green success button |
|
|
40
|
+
| `btn-warning` | Yellow warning button |
|
|
41
|
+
| `btn-danger` | Red danger button |
|
|
42
|
+
| `btn-primary-outline` | Primary outline variant |
|
|
43
|
+
| `btn-success-outline` | Success outline variant |
|
|
44
|
+
| `btn-warning-outline` | Warning outline variant |
|
|
45
|
+
| `btn-danger-outline` | Danger outline variant |
|
|
46
|
+
| `btn-link` | Link-style button |
|
|
47
|
+
| `btn-sm` | Small size |
|
|
48
|
+
| `btn-block` | Full-width block layout |
|
|
49
|
+
| `btn-loading` | Loading state (add spinner inside) |
|
|
50
|
+
|
|
51
|
+
## React Component
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Button } from '@dtlvmw/react';
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Props
|
|
58
|
+
|
|
59
|
+
| Prop | Type | Default | Description |
|
|
60
|
+
|------|------|---------|-------------|
|
|
61
|
+
| `btnType` | `'primary' \| 'success' \| 'warning' \| 'danger'` | `'primary'` | Color variant |
|
|
62
|
+
| `btnStyle` | `'solid' \| 'outline' \| 'link'` | `'solid'` | Visual style |
|
|
63
|
+
| `size` | `'default' \| 'sm'` | — | Size variant |
|
|
64
|
+
| `disabled` | `boolean` | — | Disabled state |
|
|
65
|
+
| `block` | `boolean` | — | Full-width button |
|
|
66
|
+
| `loading` | `boolean` | — | Shows inline spinner, disables button |
|
|
67
|
+
|
|
68
|
+
### Examples
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
<Button btnType="primary">Save</Button>
|
|
72
|
+
<Button btnType="danger" btnStyle="outline">Delete</Button>
|
|
73
|
+
<Button btnStyle="link">Cancel</Button>
|
|
74
|
+
<Button size="sm">Small</Button>
|
|
75
|
+
<Button loading>Saving...</Button>
|
|
76
|
+
<Button block>Full Width</Button>
|
|
77
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Card
|
|
2
|
+
|
|
3
|
+
Content containers with header, body, and footer sections.
|
|
4
|
+
|
|
5
|
+
## HTML/CSS Template
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<div class="card">
|
|
9
|
+
<div class="card-header">Card Title</div>
|
|
10
|
+
<div class="card-block">
|
|
11
|
+
<div class="card-title">Section Title</div>
|
|
12
|
+
<div class="card-text">Card body content goes here.</div>
|
|
13
|
+
</div>
|
|
14
|
+
<div class="card-footer">
|
|
15
|
+
<button class="btn btn-sm btn-link">Action 1</button>
|
|
16
|
+
<button class="btn btn-sm btn-link">Action 2</button>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<!-- Clickable card -->
|
|
21
|
+
<div class="card clickable">
|
|
22
|
+
<div class="card-block">
|
|
23
|
+
<div class="card-text">Click me</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<!-- Card with image -->
|
|
28
|
+
<div class="card">
|
|
29
|
+
<div class="card-img">
|
|
30
|
+
<img src="image.jpg" alt="Card image" />
|
|
31
|
+
</div>
|
|
32
|
+
<div class="card-block">
|
|
33
|
+
<div class="card-text">Image card content.</div>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### CSS Classes
|
|
39
|
+
|
|
40
|
+
| Class | Description |
|
|
41
|
+
|-------|-------------|
|
|
42
|
+
| `card` | Base card container (required) |
|
|
43
|
+
| `card-header` | Card header section |
|
|
44
|
+
| `card-block` | Card body container |
|
|
45
|
+
| `card-title` | Title inside card-block |
|
|
46
|
+
| `card-text` | Text content inside card-block |
|
|
47
|
+
| `card-footer` | Footer with actions |
|
|
48
|
+
| `card-img` | Image container |
|
|
49
|
+
| `clickable` | Adds hover effect |
|
|
50
|
+
|
|
51
|
+
## React Component
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Card, CardHeader, CardBlock, CardTitle, CardText, CardFooter } from '@dtlvmw/react';
|
|
55
|
+
|
|
56
|
+
<Card>
|
|
57
|
+
<CardHeader>My Card</CardHeader>
|
|
58
|
+
<CardBlock>
|
|
59
|
+
<CardTitle>Section</CardTitle>
|
|
60
|
+
<CardText>Content goes here.</CardText>
|
|
61
|
+
</CardBlock>
|
|
62
|
+
<CardFooter>
|
|
63
|
+
<button className="btn btn-sm btn-link">Action</button>
|
|
64
|
+
</CardFooter>
|
|
65
|
+
</Card>
|
|
66
|
+
|
|
67
|
+
<Card clickable>
|
|
68
|
+
<CardBlock>
|
|
69
|
+
<CardText>Clickable card</CardText>
|
|
70
|
+
</CardBlock>
|
|
71
|
+
</Card>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Props
|
|
75
|
+
|
|
76
|
+
| Prop | Type | Default | Description |
|
|
77
|
+
|------|------|---------|-------------|
|
|
78
|
+
| `clickable` | `boolean` | — | Adds hover effect |
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Dropdown
|
|
2
|
+
|
|
3
|
+
Action menu with trigger button, items, headers, and dividers.
|
|
4
|
+
|
|
5
|
+
## HTML/CSS Template
|
|
6
|
+
|
|
7
|
+
```html
|
|
8
|
+
<!-- Closed dropdown -->
|
|
9
|
+
<div class="dropdown">
|
|
10
|
+
<button class="dropdown-toggle btn btn-link">
|
|
11
|
+
Dropdown <cds-icon shape="angle" direction="down"></cds-icon>
|
|
12
|
+
</button>
|
|
13
|
+
<div class="dropdown-menu">
|
|
14
|
+
<div class="dropdown-header">Group 1</div>
|
|
15
|
+
<button class="dropdown-item">Action 1</button>
|
|
16
|
+
<button class="dropdown-item">Action 2</button>
|
|
17
|
+
<div class="dropdown-divider"></div>
|
|
18
|
+
<button class="dropdown-item">Action 3</button>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<!-- Open dropdown — add .open class -->
|
|
23
|
+
<div class="dropdown open">
|
|
24
|
+
...
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<!-- Position variants — add to .dropdown -->
|
|
28
|
+
<!-- bottom-left (default), bottom-right, top-left, top-right -->
|
|
29
|
+
<div class="dropdown open bottom-right">
|
|
30
|
+
...
|
|
31
|
+
</div>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### CSS Classes
|
|
35
|
+
|
|
36
|
+
| Class | Description |
|
|
37
|
+
|-------|-------------|
|
|
38
|
+
| `dropdown` | Container (required) |
|
|
39
|
+
| `open` | Shows the dropdown menu |
|
|
40
|
+
| `dropdown-toggle` | Trigger button |
|
|
41
|
+
| `dropdown-menu` | Menu container |
|
|
42
|
+
| `dropdown-header` | Group header text |
|
|
43
|
+
| `dropdown-item` | Menu item button |
|
|
44
|
+
| `dropdown-divider` | Separator line |
|
|
45
|
+
| `bottom-left` | Position (default) |
|
|
46
|
+
| `bottom-right` | Position |
|
|
47
|
+
| `top-left` | Position |
|
|
48
|
+
| `top-right` | Position |
|
|
49
|
+
|
|
50
|
+
## React Component
|
|
51
|
+
|
|
52
|
+
```tsx
|
|
53
|
+
import { Dropdown, DropdownTrigger, DropdownMenu, DropdownItem, DropdownDivider, DropdownHeader } from '@dtlvmw/react';
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Props
|
|
57
|
+
|
|
58
|
+
**Dropdown**: `open?: boolean`, `position?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right'`, `onOpenChange?: (open: boolean) => void`
|
|
59
|
+
|
|
60
|
+
### Example
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
const [open, setOpen] = useState(false);
|
|
64
|
+
|
|
65
|
+
<Dropdown open={open} onOpenChange={setOpen}>
|
|
66
|
+
<DropdownTrigger onClick={() => setOpen(!open)}>Actions</DropdownTrigger>
|
|
67
|
+
<DropdownMenu>
|
|
68
|
+
<DropdownHeader>Management</DropdownHeader>
|
|
69
|
+
<DropdownItem onClick={() => console.log('edit')}>Edit</DropdownItem>
|
|
70
|
+
<DropdownItem onClick={() => console.log('delete')}>Delete</DropdownItem>
|
|
71
|
+
<DropdownDivider />
|
|
72
|
+
<DropdownItem>Archive</DropdownItem>
|
|
73
|
+
</DropdownMenu>
|
|
74
|
+
</Dropdown>
|
|
75
|
+
```
|