@zscloud/design 0.2.0 → 0.3.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/components/primitive/card.d.ts +4 -1
- package/dist/guidelines/Guidelines.md +28 -0
- package/dist/guidelines/components/button.md +73 -0
- package/dist/guidelines/components/date-picker.md +49 -0
- package/dist/guidelines/components/dialog.md +93 -0
- package/dist/guidelines/components/drawer.md +48 -0
- package/dist/guidelines/components/form.md +100 -0
- package/dist/guidelines/components/select.md +81 -0
- package/dist/guidelines/components/tabs.md +73 -0
- package/dist/guidelines/components/toast.md +60 -0
- package/dist/guidelines/components/tooltip.md +40 -0
- package/dist/guidelines/design-tokens/colors.md +74 -0
- package/dist/guidelines/design-tokens/shadows.md +28 -0
- package/dist/guidelines/design-tokens/spacing.md +46 -0
- package/dist/guidelines/design-tokens/typography.md +62 -0
- package/dist/guidelines/overview-components.md +195 -0
- package/dist/guidelines/overview-icons.md +62 -0
- package/dist/zscloud-design.es.js +30 -22
- package/package.json +50 -49
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Color Tokens
|
|
2
|
+
|
|
3
|
+
## Semantic color system
|
|
4
|
+
|
|
5
|
+
Use semantic color names, not raw hex values. The color system adapts automatically in dark mode.
|
|
6
|
+
|
|
7
|
+
### Theme (brand) colors
|
|
8
|
+
|
|
9
|
+
The primary brand color. Customizable at runtime via CSS variables.
|
|
10
|
+
|
|
11
|
+
| Tailwind class | CSS variable | Default |
|
|
12
|
+
|---------------|-------------|---------|
|
|
13
|
+
| `bg-theme-500` | `--color-theme-500` | `#0076f7` (blue) |
|
|
14
|
+
| `text-theme-600` | `--color-theme-600` | Darker brand |
|
|
15
|
+
| `bg-theme-50` | `--color-theme-50` | Light brand tint |
|
|
16
|
+
|
|
17
|
+
Full scale: `theme-50` through `theme-950`.
|
|
18
|
+
|
|
19
|
+
### Status colors
|
|
20
|
+
|
|
21
|
+
| Role | Tailwind prefix | Use for | Default base |
|
|
22
|
+
|------|----------------|---------|-------------|
|
|
23
|
+
| **danger** | `text-danger-500` | Errors, destructive actions | `#f4454c` (red) |
|
|
24
|
+
| **positive** | `text-positive-500` | Success, healthy status | `#5aca49` (green) |
|
|
25
|
+
| **alert** | `text-alert-500` | Warnings, caution | `#ff9000` (orange) |
|
|
26
|
+
| **info** | `text-info-500` | Informational | `#0076f7` (blue) |
|
|
27
|
+
| **pending** | `text-pending-500` | In-progress, waiting | `#9a45e4` (purple) |
|
|
28
|
+
|
|
29
|
+
Each status color has a full scale from `50` to `950`.
|
|
30
|
+
|
|
31
|
+
### Neutral colors
|
|
32
|
+
|
|
33
|
+
For text, borders, backgrounds, and disabled states.
|
|
34
|
+
|
|
35
|
+
| Usage | Tailwind class | Description |
|
|
36
|
+
|-------|---------------|-------------|
|
|
37
|
+
| Default text | `text-neutral-700` | Primary text |
|
|
38
|
+
| Secondary text | `text-neutral-500` | Muted/helper text |
|
|
39
|
+
| Disabled text | `text-neutral-400` | Disabled state |
|
|
40
|
+
| Default border | `border-neutral-300` | Standard borders |
|
|
41
|
+
| Subtle border | `border-neutral-200` | Subtle separation |
|
|
42
|
+
| Hover background | `bg-neutral-100` | Hover state |
|
|
43
|
+
| Page background | `bg-neutral-50` | Light background |
|
|
44
|
+
|
|
45
|
+
Full scale: `neutral-0` (white) through `neutral-950` (near-black).
|
|
46
|
+
|
|
47
|
+
### On-brand color
|
|
48
|
+
|
|
49
|
+
Use `text-on-brand` for text on brand-colored backgrounds (buttons, badges). This is always white.
|
|
50
|
+
|
|
51
|
+
## Semantic variables (CSS)
|
|
52
|
+
|
|
53
|
+
These map to component default styles:
|
|
54
|
+
|
|
55
|
+
| Variable | Light mode | Purpose |
|
|
56
|
+
|----------|-----------|---------|
|
|
57
|
+
| `--foreground` | `neutral-700` | Default text |
|
|
58
|
+
| `--background` | `white` | Page background |
|
|
59
|
+
| `--primary` | `theme-600` | Primary actions |
|
|
60
|
+
| `--destructive` | `red-500` | Destructive actions |
|
|
61
|
+
| `--border` | `neutral-300` | Default border |
|
|
62
|
+
| `--input` | `neutral-400` | Input border |
|
|
63
|
+
| `--ring` | `theme-300` | Focus ring |
|
|
64
|
+
| `--muted` | `neutral-100` | Muted background |
|
|
65
|
+
| `--muted-foreground` | `neutral-500` | Muted text |
|
|
66
|
+
|
|
67
|
+
## Rules
|
|
68
|
+
|
|
69
|
+
- Always use semantic color names (`danger`, `positive`, `alert`) instead of raw color names (`red`, `green`, `orange`).
|
|
70
|
+
- Use `theme-*` for brand-related elements. Do not hardcode blue.
|
|
71
|
+
- Use `neutral-*` for grays. Do not use arbitrary gray values.
|
|
72
|
+
- For text on colored backgrounds, use `text-on-brand` (white).
|
|
73
|
+
- For hover states, go one shade darker (e.g., `bg-theme-500` hover `bg-theme-600`).
|
|
74
|
+
- For disabled states, reduce to `neutral-400` text and `neutral-200` background.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Shadow Tokens
|
|
2
|
+
|
|
3
|
+
## Elevation scale
|
|
4
|
+
|
|
5
|
+
| Tailwind class | Use for |
|
|
6
|
+
|---------------|---------|
|
|
7
|
+
| `shadow-2xs` | Subtle bottom border effect |
|
|
8
|
+
| `shadow-xs` | Cards at rest |
|
|
9
|
+
| `shadow-sm` | Raised cards, form controls on focus |
|
|
10
|
+
| `shadow-md` | Dropdowns, popovers |
|
|
11
|
+
| `shadow-lg` | Dialogs, drawers |
|
|
12
|
+
| `shadow-xl` | Top-level modals |
|
|
13
|
+
| `shadow-2xl` | Maximum elevation |
|
|
14
|
+
|
|
15
|
+
## Focus rings
|
|
16
|
+
|
|
17
|
+
| Tailwind class | Use for |
|
|
18
|
+
|---------------|---------|
|
|
19
|
+
| `shadow-focus-ring` | Default focus indicator (green tint) |
|
|
20
|
+
| `shadow-focus-ring-error` | Error state focus indicator (red tint) |
|
|
21
|
+
| `shadow-focus-ring-sidebar` | Sidebar-specific focus indicator (gray) |
|
|
22
|
+
|
|
23
|
+
## Rules
|
|
24
|
+
|
|
25
|
+
- Use `shadow-md` for all floating elements (popovers, dropdowns, context menus).
|
|
26
|
+
- Use `shadow-lg` for dialogs and drawers.
|
|
27
|
+
- Do not apply shadows to flat, inline elements.
|
|
28
|
+
- Focus rings are applied automatically by components. Do not manually add focus ring styles.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Spacing Tokens
|
|
2
|
+
|
|
3
|
+
The spacing system follows a 4px base grid. All spacing values are multiples of 4px.
|
|
4
|
+
|
|
5
|
+
## Scale
|
|
6
|
+
|
|
7
|
+
| Tailwind class | Value | Common use |
|
|
8
|
+
|---------------|-------|------------|
|
|
9
|
+
| `gap-0.5` / `p-0.5` | 2px | Tight internal spacing |
|
|
10
|
+
| `gap-1` / `p-1` | 4px | Icon-to-text gap |
|
|
11
|
+
| `gap-1.5` / `p-1.5` | 6px | Compact padding |
|
|
12
|
+
| `gap-2` / `p-2` | 8px | Standard gap between related items |
|
|
13
|
+
| `gap-3` / `p-3` | 12px | Form field gap, card padding |
|
|
14
|
+
| `gap-4` / `p-4` | 16px | Section padding, standard margin |
|
|
15
|
+
| `gap-6` / `p-6` | 24px | Section separation |
|
|
16
|
+
| `gap-8` / `p-8` | 32px | Large section separation |
|
|
17
|
+
|
|
18
|
+
## Component-specific spacing
|
|
19
|
+
|
|
20
|
+
| Context | Spacing | Example |
|
|
21
|
+
|---------|---------|---------|
|
|
22
|
+
| Button icon gap | `gap-1` (4px) | Icon to label inside button |
|
|
23
|
+
| Form field spacing | `gap-3` (12px) | Between form items vertically |
|
|
24
|
+
| Dialog body padding | `p-4` (16px) | Content area padding |
|
|
25
|
+
| Card content padding | `p-4` (16px) | Card body padding |
|
|
26
|
+
| Page section gap | `gap-6` (24px) | Between major sections |
|
|
27
|
+
| Inline elements | `gap-2` (8px) | Between buttons in a toolbar |
|
|
28
|
+
|
|
29
|
+
## Border radius
|
|
30
|
+
|
|
31
|
+
| Tailwind class | Value | Use for |
|
|
32
|
+
|---------------|-------|---------|
|
|
33
|
+
| `rounded-none` | 0px | No rounding |
|
|
34
|
+
| `rounded-xs` | 2px | Inputs, buttons, cards (default) |
|
|
35
|
+
| `rounded-sm` | 4px | Tags, badges |
|
|
36
|
+
| `rounded-md` | 6px | Dialogs, dropdowns |
|
|
37
|
+
| `rounded-lg` | 8px | Large containers |
|
|
38
|
+
| `rounded-full` | 9999px | Circular elements, pills |
|
|
39
|
+
|
|
40
|
+
## Rules
|
|
41
|
+
|
|
42
|
+
- Always use the 4px grid. Do not use arbitrary spacing values like 5px or 7px.
|
|
43
|
+
- Use `gap-*` for flex/grid layouts instead of margin on individual children.
|
|
44
|
+
- The default border radius for interactive controls is `rounded-xs` (2px). Do not override unless specifically required.
|
|
45
|
+
- Use `rounded-md` (6px) for floating elements (dialogs, popovers, dropdowns).
|
|
46
|
+
- Use `rounded-full` only for avatars, status dots, and pill-shaped elements.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Typography Tokens
|
|
2
|
+
|
|
3
|
+
## Font families
|
|
4
|
+
|
|
5
|
+
| Token | Tailwind class | Value |
|
|
6
|
+
|-------|---------------|-------|
|
|
7
|
+
| Sans (default) | `font-sans` | `-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", Helvetica, Arial, sans-serif` |
|
|
8
|
+
| Monospace | `font-mono` | `"SFMono-Medium", "SF Mono", "Segoe UI Mono", Menlo, Consolas, monospace` |
|
|
9
|
+
|
|
10
|
+
Use `font-sans` for all UI text. Use `font-mono` only for code, UUIDs, and technical identifiers.
|
|
11
|
+
|
|
12
|
+
## Font sizes
|
|
13
|
+
|
|
14
|
+
| Token | Tailwind class | Size | Use for |
|
|
15
|
+
|-------|---------------|------|---------|
|
|
16
|
+
| xs | `text-xs` | 12px | Captions, helper text, badges |
|
|
17
|
+
| sm | `text-sm` | 14px | Default body text, form labels, table cells |
|
|
18
|
+
| base | `text-base` | 16px | Emphasized body text |
|
|
19
|
+
| lg | `text-lg` | 20px | Section headings |
|
|
20
|
+
| xl | `text-xl` | 24px | Page titles |
|
|
21
|
+
| 2xl | `text-2xl` | 30px | Large headings |
|
|
22
|
+
| 3xl | `text-3xl` | 38px | Hero headings |
|
|
23
|
+
|
|
24
|
+
## Line heights
|
|
25
|
+
|
|
26
|
+
| Token | Tailwind class | Value | Pair with |
|
|
27
|
+
|-------|---------------|-------|-----------|
|
|
28
|
+
| tight | `leading-tight` | 20px | `text-xs`, `text-sm` |
|
|
29
|
+
| snug | `leading-snug` | 22px | `text-sm` |
|
|
30
|
+
| normal | `leading-normal` | 24px | `text-base` |
|
|
31
|
+
| relaxed | `leading-relaxed` | 28px | `text-lg` |
|
|
32
|
+
| loose | `leading-loose` | 32px | `text-xl` |
|
|
33
|
+
|
|
34
|
+
## Font weights
|
|
35
|
+
|
|
36
|
+
| Tailwind class | Weight | Use for |
|
|
37
|
+
|---------------|--------|---------|
|
|
38
|
+
| `font-normal` | 400 | Body text |
|
|
39
|
+
| `font-medium` | 500 | Labels, emphasis |
|
|
40
|
+
| `font-semibold` | 600 | Headings, buttons |
|
|
41
|
+
| `font-bold` | 700 | Strong emphasis |
|
|
42
|
+
|
|
43
|
+
## Text component
|
|
44
|
+
|
|
45
|
+
Use the `Text` component for consistent typography:
|
|
46
|
+
|
|
47
|
+
```tsx
|
|
48
|
+
import { Text } from "@zscloud/design"
|
|
49
|
+
|
|
50
|
+
<Text variant="heading-lg">Page Title</Text>
|
|
51
|
+
<Text variant="body">Regular text content</Text>
|
|
52
|
+
<Text variant="caption" color="muted">Helper text</Text>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Rules
|
|
56
|
+
|
|
57
|
+
- The default font size for all UI controls is `text-sm` (14px). Do not use `text-xs` for form inputs or buttons.
|
|
58
|
+
- Use `text-xs` (12px) only for captions, timestamps, and secondary metadata.
|
|
59
|
+
- Do not use `text-base` (16px) or larger for table cell content.
|
|
60
|
+
- Always pair font sizes with appropriate line heights. Use `leading-tight` for compact layouts.
|
|
61
|
+
- Use `font-medium` (500) for form labels. Use `font-semibold` (600) for dialog titles and section headings.
|
|
62
|
+
- Do not use letter-spacing adjustments unless specifically required for headings.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# Component Overview
|
|
2
|
+
|
|
3
|
+
## Import pattern
|
|
4
|
+
|
|
5
|
+
All components are named exports from the package root:
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Button, Dialog, Input, Select } from "@zscloud/design"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Component categories
|
|
12
|
+
|
|
13
|
+
### Form Controls
|
|
14
|
+
|
|
15
|
+
| Component | Use for |
|
|
16
|
+
|-----------|---------|
|
|
17
|
+
| `Button` | Actions and submissions. Variants: primary, subtle, outline, secondary, danger, ghost, link |
|
|
18
|
+
| `Input` | Single-line text input |
|
|
19
|
+
| `InputNumber` | Numeric input with optional increment/decrement controls |
|
|
20
|
+
| `InputPassword` | Password input with show/hide toggle |
|
|
21
|
+
| `Textarea` | Multi-line text input |
|
|
22
|
+
| `SearchInput` | Input with search icon, for filtering |
|
|
23
|
+
| `Checkbox` | Boolean toggle. Supports indeterminate state |
|
|
24
|
+
| `CheckboxGroup` | Multiple checkbox options |
|
|
25
|
+
| `RadioGroup` | Single selection from options. Variants: basic, button |
|
|
26
|
+
| `Select` | Single selection dropdown. Use `options` prop for simple usage |
|
|
27
|
+
| `MultiSelect` | Multiple selection dropdown with tags |
|
|
28
|
+
| `AutoComplete` | Input with suggestions dropdown |
|
|
29
|
+
| `Cascader` | Hierarchical selection (province/city/district) |
|
|
30
|
+
| `Switch` | Boolean toggle as a slider |
|
|
31
|
+
| `Slider` | Range value selection |
|
|
32
|
+
| `DatePicker` | Date selection with optional time picker |
|
|
33
|
+
| `RangePicker` | Date range selection |
|
|
34
|
+
| `TimePicker` | Time-only selection |
|
|
35
|
+
| `Calendar` | Inline calendar display |
|
|
36
|
+
| `Form` | Form container with validation. Built on react-hook-form + zod |
|
|
37
|
+
|
|
38
|
+
### Data Display
|
|
39
|
+
|
|
40
|
+
| Component | Use for |
|
|
41
|
+
|-----------|---------|
|
|
42
|
+
| `Tag` | Status labels and categories |
|
|
43
|
+
| `TagList` | Multiple tags with overflow handling |
|
|
44
|
+
| `Badge` | Notification count or dot indicator |
|
|
45
|
+
| `StatusBadge` | Status indicator with semantic colors |
|
|
46
|
+
| `Text` | Typography with variants (heading, body, caption) |
|
|
47
|
+
| `Card` | Content container with header/body/footer sections |
|
|
48
|
+
| `Collapse` | Expandable/collapsible content sections |
|
|
49
|
+
| `Steps` | Multi-step process indicator |
|
|
50
|
+
| `Progress` | Progress bar with percentage |
|
|
51
|
+
| `Tree` | Hierarchical data display with expand/collapse |
|
|
52
|
+
| `TreeSelect` | Tree-based selection dropdown |
|
|
53
|
+
| `JsonViewer` | JSON data viewer with syntax highlighting |
|
|
54
|
+
| `CodeEditor` | Code editing with syntax highlighting (CodeMirror) |
|
|
55
|
+
| `Markdown` | Markdown content renderer |
|
|
56
|
+
| `Divider` | Visual separator line |
|
|
57
|
+
|
|
58
|
+
### Feedback
|
|
59
|
+
|
|
60
|
+
| Component | Use for |
|
|
61
|
+
|-----------|---------|
|
|
62
|
+
| `Dialog` | Modal dialogs for confirmations, forms, and complex interactions |
|
|
63
|
+
| `AlertDialog` | Simple confirm/cancel dialogs |
|
|
64
|
+
| `Drawer` | Side panel overlay. Placement: right (default), left, top, bottom |
|
|
65
|
+
| `Toast` | Temporary notification messages |
|
|
66
|
+
| `Alert` | Inline alert messages |
|
|
67
|
+
| `Spin` | Loading spinner overlay |
|
|
68
|
+
| `Loader` | Inline loading indicator |
|
|
69
|
+
| `PopoverConfirm` | Confirmation popover attached to a trigger |
|
|
70
|
+
|
|
71
|
+
### Navigation
|
|
72
|
+
|
|
73
|
+
| Component | Use for |
|
|
74
|
+
|-----------|---------|
|
|
75
|
+
| `Tabs` | Tab-based content switching. Variants: line, card, outline |
|
|
76
|
+
| `Breadcrumb` | Navigation hierarchy |
|
|
77
|
+
| `Pagination` | Page navigation with size selector |
|
|
78
|
+
| `Link` | Styled anchor element |
|
|
79
|
+
|
|
80
|
+
### Overlay
|
|
81
|
+
|
|
82
|
+
| Component | Use for |
|
|
83
|
+
|-----------|---------|
|
|
84
|
+
| `Tooltip` | Hover information. 12 placement options |
|
|
85
|
+
| `Popover` | Click-triggered content overlay |
|
|
86
|
+
| `Dropdown` | Action menu triggered by button |
|
|
87
|
+
| `ContextMenu` | Right-click context menu |
|
|
88
|
+
|
|
89
|
+
### Layout
|
|
90
|
+
|
|
91
|
+
| Component | Use for |
|
|
92
|
+
|-----------|---------|
|
|
93
|
+
| `ResizablePanelGroup` | Resizable split panes |
|
|
94
|
+
| `ResizablePanel` | Individual panel within a group |
|
|
95
|
+
| `ResizableHandle` | Drag handle between panels |
|
|
96
|
+
|
|
97
|
+
### Business Components
|
|
98
|
+
|
|
99
|
+
These are higher-level components for specific use cases:
|
|
100
|
+
|
|
101
|
+
| Component | Use for |
|
|
102
|
+
|-----------|---------|
|
|
103
|
+
| `Field` | Labeled value display (label: value pairs) |
|
|
104
|
+
| `FieldOperations` | Field with action buttons |
|
|
105
|
+
| `State` | Resource state display with semantic colors |
|
|
106
|
+
| `Info` | Info icon with tooltip explanation |
|
|
107
|
+
| `InfoPopover` | Info icon with rich popover content |
|
|
108
|
+
| `SmartTip` | Adaptive content display (truncate with expand) |
|
|
109
|
+
| `Copy` | Copy-to-clipboard button |
|
|
110
|
+
| `NoData` | Empty state placeholder |
|
|
111
|
+
| `HeaderPage` | Page-level header with title and actions |
|
|
112
|
+
| `HeaderDetail` | Detail page header with breadcrumb |
|
|
113
|
+
| `HelperDoc` | Help documentation link |
|
|
114
|
+
| `DateValue` | Formatted date display |
|
|
115
|
+
| `ConfigProvider` | Global configuration provider |
|
|
116
|
+
| `LocaleContainer` | i18n locale provider |
|
|
117
|
+
| `AppBase` | Application root wrapper |
|
|
118
|
+
|
|
119
|
+
## Common patterns
|
|
120
|
+
|
|
121
|
+
### Form with validation
|
|
122
|
+
|
|
123
|
+
```tsx
|
|
124
|
+
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage, Input, Button } from "@zscloud/design"
|
|
125
|
+
import { useForm } from "react-hook-form"
|
|
126
|
+
import { zodResolver } from "@hookform/resolvers/zod"
|
|
127
|
+
import { z } from "zod"
|
|
128
|
+
|
|
129
|
+
const schema = z.object({
|
|
130
|
+
name: z.string().min(1, "Name is required"),
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
function MyForm() {
|
|
134
|
+
const form = useForm({ resolver: zodResolver(schema) })
|
|
135
|
+
|
|
136
|
+
return (
|
|
137
|
+
<Form {...form}>
|
|
138
|
+
<form onSubmit={form.handleSubmit(onSubmit)}>
|
|
139
|
+
<FormField
|
|
140
|
+
control={form.control}
|
|
141
|
+
name="name"
|
|
142
|
+
render={({ field }) => (
|
|
143
|
+
<FormItem>
|
|
144
|
+
<FormLabel required>Name</FormLabel>
|
|
145
|
+
<FormControl>
|
|
146
|
+
<Input {...field} />
|
|
147
|
+
</FormControl>
|
|
148
|
+
<FormMessage />
|
|
149
|
+
</FormItem>
|
|
150
|
+
)}
|
|
151
|
+
/>
|
|
152
|
+
<Button type="submit">Submit</Button>
|
|
153
|
+
</form>
|
|
154
|
+
</Form>
|
|
155
|
+
)
|
|
156
|
+
}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Dialog with form
|
|
160
|
+
|
|
161
|
+
```tsx
|
|
162
|
+
import { Dialog, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogBody, Button } from "@zscloud/design"
|
|
163
|
+
|
|
164
|
+
function MyDialog({ open, onOpenChange }) {
|
|
165
|
+
return (
|
|
166
|
+
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
167
|
+
<DialogContent>
|
|
168
|
+
<DialogHeader>
|
|
169
|
+
<DialogTitle>Edit Resource</DialogTitle>
|
|
170
|
+
</DialogHeader>
|
|
171
|
+
<DialogBody>
|
|
172
|
+
{/* Form content here */}
|
|
173
|
+
</DialogBody>
|
|
174
|
+
<DialogFooter>
|
|
175
|
+
<Button variant="subtle" onClick={() => onOpenChange(false)}>Cancel</Button>
|
|
176
|
+
<Button>Confirm</Button>
|
|
177
|
+
</DialogFooter>
|
|
178
|
+
</DialogContent>
|
|
179
|
+
</Dialog>
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Select with options
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
import { Select } from "@zscloud/design"
|
|
188
|
+
|
|
189
|
+
const options = [
|
|
190
|
+
{ label: "Option A", value: "a" },
|
|
191
|
+
{ label: "Option B", value: "b", description: "With description" },
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
<Select options={options} value={value} onValueChange={setValue} placeholder="Select..." />
|
|
195
|
+
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Icon System
|
|
2
|
+
|
|
3
|
+
The icon library provides 644 system icons and 38 app icons, all SVG-based.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { Icon, AppIcon } from "@zscloud/design"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## System Icons (`Icon`)
|
|
12
|
+
|
|
13
|
+
Use for inline UI icons (buttons, menus, status indicators).
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<Icon type="search" />
|
|
17
|
+
<Icon type="arrow-down" />
|
|
18
|
+
<Icon type="checkmark-circle-fill" color="positive" />
|
|
19
|
+
<Icon type="close" color="danger" />
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Props
|
|
23
|
+
|
|
24
|
+
| Prop | Type | Default | Description |
|
|
25
|
+
|------|------|---------|-------------|
|
|
26
|
+
| `type` | `IconName` | required | Kebab-case icon name |
|
|
27
|
+
| `color` | `"neutral" \| "danger" \| "positive" \| "info" \| "alert" \| "pending"` | - | Semantic color |
|
|
28
|
+
| `colorNumber` | `number` | - | Color shade (50-950) |
|
|
29
|
+
|
|
30
|
+
Default size: 16x16px.
|
|
31
|
+
|
|
32
|
+
### Commonly used icons
|
|
33
|
+
|
|
34
|
+
**Navigation**: `arrow-left`, `arrow-right`, `arrow-up`, `arrow-down`, `chevron-left`, `chevron-right`, `chevron-down`, `chevron-up`
|
|
35
|
+
|
|
36
|
+
**Actions**: `add`, `close`, `delete`, `edit`, `search`, `refresh`, `download`, `upload`, `copy`, `more`, `settings`
|
|
37
|
+
|
|
38
|
+
**Status**: `checkmark-circle-fill`, `close-circle-fill`, `warning-fill`, `info-circle-fill`, `loading`
|
|
39
|
+
|
|
40
|
+
**Content**: `file`, `folder`, `image`, `link`, `calendar`, `clock`, `user`, `lock`, `eye`, `eye-off`
|
|
41
|
+
|
|
42
|
+
## App Icons (`AppIcon`)
|
|
43
|
+
|
|
44
|
+
Use for application/module navigation icons. Larger, more detailed than system icons.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<AppIcon type="settings" />
|
|
48
|
+
<AppIcon type="hardware" />
|
|
49
|
+
<AppIcon type="cloud-monitoring" />
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Default size: 40x40px.
|
|
53
|
+
|
|
54
|
+
### Available app icons
|
|
55
|
+
|
|
56
|
+
`backup`, `settings`, `hardware`, `cloud-monitoring`, `ai-store`, `network-resource`, `network-service`, `vcenter`, `dashboard`, `virtual-orchestration`, `storage`, `tenant-management`, `zwatch-alarm`, `zwatch-endpoint`, `zwatch-monitor-group`, `zwatch-monitor-template`, and more.
|
|
57
|
+
|
|
58
|
+
## Rules
|
|
59
|
+
|
|
60
|
+
- Always use the `Icon` component instead of raw SVG or icon fonts.
|
|
61
|
+
- Use semantic `color` prop for status-related icons. Do not apply Tailwind color classes directly to icons.
|
|
62
|
+
- Do not resize icons with `width`/`height` attributes. Use the Tailwind `size-*` class on a wrapper if needed.
|
|
@@ -19032,7 +19032,7 @@ var SelectEmptyPlaceholder = (e) => {
|
|
|
19032
19032
|
});
|
|
19033
19033
|
InputNumber.displayName = "InputNumber";
|
|
19034
19034
|
var Pagination = (e) => {
|
|
19035
|
-
let { pagination: t, setPagination: n, count: i } = e, o = useIntl(), l = Math.ceil(i / t.pageSize), [u, d] = useState(""), f =
|
|
19035
|
+
let { pagination: t, setPagination: n, count: i } = e, o = useIntl(), l = Math.ceil(i / t.pageSize), [u, d] = useState(""), f = useRef(null);
|
|
19036
19036
|
return /* @__PURE__ */ jsxs("div", {
|
|
19037
19037
|
className: "flex items-center gap-6 h-8",
|
|
19038
19038
|
children: [/* @__PURE__ */ jsx(PaginationRoot, {
|
|
@@ -19092,7 +19092,7 @@ var Pagination = (e) => {
|
|
|
19092
19092
|
})
|
|
19093
19093
|
}), /* @__PURE__ */ jsxs("div", {
|
|
19094
19094
|
className: "items-center text-sm flex gap-4 h-8",
|
|
19095
|
-
|
|
19095
|
+
ref: f,
|
|
19096
19096
|
children: [/* @__PURE__ */ jsxs(SelectRoot, {
|
|
19097
19097
|
value: t.pageSize + "",
|
|
19098
19098
|
onValueChange: (e) => {
|
|
@@ -19105,7 +19105,7 @@ var Pagination = (e) => {
|
|
|
19105
19105
|
className: "w-auto text-nowrap h-8",
|
|
19106
19106
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
19107
19107
|
}), /* @__PURE__ */ jsx(SelectContent, {
|
|
19108
|
-
selectPortalProps: { container:
|
|
19108
|
+
selectPortalProps: { container: f.current },
|
|
19109
19109
|
children: /* @__PURE__ */ jsxs(SelectGroup, { children: [
|
|
19110
19110
|
/* @__PURE__ */ jsx(SelectItem, {
|
|
19111
19111
|
value: "10",
|
|
@@ -23761,34 +23761,42 @@ var cardVariants = cva("rounded-xs w-full box-border h-min bg-neutral-0", {
|
|
|
23761
23761
|
defaultVariants: { variant: "default" }
|
|
23762
23762
|
}), CardContext = createContext({
|
|
23763
23763
|
isCollapsed: !1,
|
|
23764
|
-
toggleCollapse: () => {}
|
|
23764
|
+
toggleCollapse: () => {},
|
|
23765
|
+
variant: "default"
|
|
23765
23766
|
});
|
|
23766
23767
|
function useCardContext() {
|
|
23767
23768
|
return useContext(CardContext);
|
|
23768
23769
|
}
|
|
23769
|
-
function CardProvider({ children: e }) {
|
|
23770
|
-
let [
|
|
23770
|
+
function CardProvider({ children: e, variant: t }) {
|
|
23771
|
+
let [n, i] = useState(!1);
|
|
23771
23772
|
return /* @__PURE__ */ jsx(CardContext.Provider, {
|
|
23772
23773
|
value: {
|
|
23773
|
-
isCollapsed:
|
|
23774
|
+
isCollapsed: n,
|
|
23774
23775
|
toggleCollapse: () => {
|
|
23775
|
-
|
|
23776
|
-
}
|
|
23776
|
+
i(!n);
|
|
23777
|
+
},
|
|
23778
|
+
variant: t
|
|
23777
23779
|
},
|
|
23778
23780
|
children: e
|
|
23779
23781
|
});
|
|
23780
23782
|
}
|
|
23781
|
-
var Card = React$1.forwardRef(({ className: e, variant: t, ...n }, i) => /* @__PURE__ */ jsx(CardProvider, {
|
|
23782
|
-
|
|
23783
|
-
|
|
23784
|
-
|
|
23785
|
-
})
|
|
23786
|
-
|
|
23787
|
-
|
|
23788
|
-
ref: n,
|
|
23789
|
-
className: cn("flex bg-transparent text-neutral-700 w-full items-center px-6 py-3 box-border justify-between border-b border-solid border-neutral-300", e),
|
|
23790
|
-
...t
|
|
23783
|
+
var Card = React$1.forwardRef(({ className: e, variant: t, ...n }, i) => /* @__PURE__ */ jsx(CardProvider, {
|
|
23784
|
+
variant: t,
|
|
23785
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
23786
|
+
ref: i,
|
|
23787
|
+
className: cn(cardVariants({ variant: t }), e),
|
|
23788
|
+
...n
|
|
23789
|
+
})
|
|
23791
23790
|
}));
|
|
23791
|
+
Card.displayName = "Card";
|
|
23792
|
+
var CardHeader = React$1.forwardRef(({ className: e, ...t }, n) => {
|
|
23793
|
+
let { variant: i } = useCardContext();
|
|
23794
|
+
return /* @__PURE__ */ jsx("div", {
|
|
23795
|
+
ref: n,
|
|
23796
|
+
className: cn("flex text-neutral-700 w-full items-center box-border justify-between", i === "default" || i === "detail" || !i ? "bg-neutral-100 h-9.5 px-5" : "bg-transparent px-6 py-3", e),
|
|
23797
|
+
...t
|
|
23798
|
+
});
|
|
23799
|
+
});
|
|
23792
23800
|
CardHeader.displayName = "CardHeader";
|
|
23793
23801
|
var CardTitle = React$1.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ jsx("div", {
|
|
23794
23802
|
ref: n,
|
|
@@ -32122,7 +32130,7 @@ var CollapseContent = React$1.forwardRef(({ className: t, forceRender: n = !1, .
|
|
|
32122
32130
|
});
|
|
32123
32131
|
});
|
|
32124
32132
|
CollapseContent.displayName = "CollapseContent";
|
|
32125
|
-
var alertVariants = cva("flex items-
|
|
32133
|
+
var alertVariants = cva("flex items-start relative flex-row px-4 py-2.5 rounded-xs", {
|
|
32126
32134
|
variants: {
|
|
32127
32135
|
variant: {
|
|
32128
32136
|
danger: "bg-danger-50",
|
|
@@ -32152,7 +32160,7 @@ var alertVariants = cva("flex items-center relative flex-row px-4 py-2.5 rounded
|
|
|
32152
32160
|
m(!1), u == null || u();
|
|
32153
32161
|
}, [u]);
|
|
32154
32162
|
if (!p) return null;
|
|
32155
|
-
let g = cn("mr-2 min-h-4 min-w-4 shrink-0", i === "weak"
|
|
32163
|
+
let g = cn("mr-2 min-h-4 min-w-4 shrink-0", i === "weak" ? "mr-1.5" : "mt-0.5");
|
|
32156
32164
|
return /* @__PURE__ */ jsxs("div", {
|
|
32157
32165
|
ref: f,
|
|
32158
32166
|
className: alertVariants({
|
|
@@ -32162,7 +32170,7 @@ var alertVariants = cva("flex items-center relative flex-row px-4 py-2.5 rounded
|
|
|
32162
32170
|
}),
|
|
32163
32171
|
...d,
|
|
32164
32172
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
32165
|
-
className: cn("text-neutral-700 text-sm flex flex-row flex-1", i === "weak" && "text-xs text-neutral-500"),
|
|
32173
|
+
className: cn("text-neutral-700 text-sm flex flex-row items-start flex-1", i === "weak" && "text-xs text-neutral-500"),
|
|
32166
32174
|
children: [
|
|
32167
32175
|
n === "danger" && /* @__PURE__ */ jsx(alert_triangle_fillreact$1, { className: cn(g, "text-danger-500") }),
|
|
32168
32176
|
n === "warning" && /* @__PURE__ */ jsx(alert_triangle_fillreact$1, { className: cn(g, "text-alert-500") }),
|