@surgeui/ds-vue 2.2.0 → 3.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 +372 -372
- package/dist/components/atoms/Avatar.vue.d.ts +0 -1
- package/dist/components/atoms/Avatar.vue.d.ts.map +1 -1
- package/dist/components/atoms/Badge.vue.d.ts.map +1 -1
- package/dist/components/atoms/Button.vue.d.ts +1 -2
- package/dist/components/atoms/Button.vue.d.ts.map +1 -1
- package/dist/components/atoms/CheckboxGroup.vue.d.ts +2 -2
- package/dist/components/atoms/CheckboxGroup.vue.d.ts.map +1 -1
- package/dist/components/atoms/FileUpload.vue.d.ts +4 -9
- package/dist/components/atoms/FileUpload.vue.d.ts.map +1 -1
- package/dist/components/atoms/FormField.vue.d.ts +4 -3
- package/dist/components/atoms/FormField.vue.d.ts.map +1 -1
- package/dist/components/atoms/Heading.vue.d.ts.map +1 -1
- package/dist/components/atoms/Image.vue.d.ts +0 -3
- package/dist/components/atoms/Image.vue.d.ts.map +1 -1
- package/dist/components/atoms/Input.vue.d.ts +3 -3
- package/dist/components/atoms/Input.vue.d.ts.map +1 -1
- package/dist/components/atoms/Link.vue.d.ts.map +1 -1
- package/dist/components/atoms/Panel.vue.d.ts +1 -1
- package/dist/components/atoms/Panel.vue.d.ts.map +1 -1
- package/dist/components/atoms/Price.vue.d.ts +47 -0
- package/dist/components/atoms/Price.vue.d.ts.map +1 -0
- package/dist/components/atoms/Progress.vue.d.ts +1 -4
- package/dist/components/atoms/Progress.vue.d.ts.map +1 -1
- package/dist/components/atoms/RadioGroup.vue.d.ts +2 -2
- package/dist/components/atoms/RadioGroup.vue.d.ts.map +1 -1
- package/dist/components/atoms/SelectBox.vue.d.ts +5 -9
- package/dist/components/atoms/SelectBox.vue.d.ts.map +1 -1
- package/dist/components/atoms/Slider.vue.d.ts +2 -2
- package/dist/components/atoms/Slider.vue.d.ts.map +1 -1
- package/dist/components/atoms/Spinner.vue.d.ts +1 -2
- package/dist/components/atoms/Spinner.vue.d.ts.map +1 -1
- package/dist/components/atoms/Switch.vue.d.ts +5 -4
- package/dist/components/atoms/Switch.vue.d.ts.map +1 -1
- package/dist/components/atoms/Textarea.vue.d.ts +2 -2
- package/dist/components/atoms/Textarea.vue.d.ts.map +1 -1
- package/dist/components/atoms/Toggle.vue.d.ts +2 -3
- package/dist/components/atoms/Toggle.vue.d.ts.map +1 -1
- package/dist/components/molecules/AccordionItem.vue.d.ts +2 -6
- package/dist/components/molecules/AccordionItem.vue.d.ts.map +1 -1
- package/dist/components/molecules/AvatarGroup.vue.d.ts.map +1 -1
- package/dist/components/molecules/CheckboxGroupField.vue.d.ts +3 -3
- package/dist/components/molecules/CheckboxGroupField.vue.d.ts.map +1 -1
- package/dist/components/molecules/Dropdown.vue.d.ts +2 -3
- package/dist/components/molecules/Dropdown.vue.d.ts.map +1 -1
- package/dist/components/molecules/FileUploadField.vue.d.ts +5 -10
- package/dist/components/molecules/FileUploadField.vue.d.ts.map +1 -1
- package/dist/components/molecules/FloatButton.vue.d.ts +10 -10
- package/dist/components/molecules/FloatButton.vue.d.ts.map +1 -1
- package/dist/components/molecules/InputField.vue.d.ts +12 -12
- package/dist/components/molecules/InputField.vue.d.ts.map +1 -1
- package/dist/components/molecules/LinkGroup.vue.d.ts.map +1 -1
- package/dist/components/molecules/OtpInput.vue.d.ts +57 -0
- package/dist/components/molecules/OtpInput.vue.d.ts.map +1 -0
- package/dist/components/molecules/OtpInputField.vue.d.ts +173 -0
- package/dist/components/molecules/OtpInputField.vue.d.ts.map +1 -0
- package/dist/components/molecules/Password.vue.d.ts +2 -2
- package/dist/components/molecules/Password.vue.d.ts.map +1 -1
- package/dist/components/molecules/PasswordField.vue.d.ts +4 -4
- package/dist/components/molecules/PasswordField.vue.d.ts.map +1 -1
- package/dist/components/molecules/RadioGroupField.vue.d.ts +3 -3
- package/dist/components/molecules/RadioGroupField.vue.d.ts.map +1 -1
- package/dist/components/molecules/SelectBoxField.vue.d.ts +14 -26
- package/dist/components/molecules/SelectBoxField.vue.d.ts.map +1 -1
- package/dist/components/molecules/SliderField.vue.d.ts +4 -4
- package/dist/components/molecules/SliderField.vue.d.ts.map +1 -1
- package/dist/components/molecules/SwitchField.vue.d.ts +3 -3
- package/dist/components/molecules/SwitchField.vue.d.ts.map +1 -1
- package/dist/components/molecules/TextareaField.vue.d.ts +6 -6
- package/dist/components/molecules/TextareaField.vue.d.ts.map +1 -1
- package/dist/components/molecules/ToggleGroup.vue.d.ts +2 -2
- package/dist/components/organisms/Accordion.vue.d.ts +1 -0
- package/dist/components/organisms/Accordion.vue.d.ts.map +1 -1
- package/dist/components/organisms/Alert.vue.d.ts +2 -3
- package/dist/components/organisms/Alert.vue.d.ts.map +1 -1
- package/dist/components/organisms/Card.vue.d.ts +27 -0
- package/dist/components/organisms/Card.vue.d.ts.map +1 -0
- package/dist/components/organisms/Dialog.vue.d.ts +3 -3
- package/dist/components/organisms/Dialog.vue.d.ts.map +1 -1
- package/dist/components/organisms/Tabs.vue.d.ts +6 -2
- package/dist/components/organisms/Tabs.vue.d.ts.map +1 -1
- package/dist/components/templates/FullScreenLayout.vue.d.ts +27 -0
- package/dist/components/templates/FullScreenLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/GridLayout.vue.d.ts +46 -0
- package/dist/components/templates/GridLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/HeroLayout.vue.d.ts +49 -0
- package/dist/components/templates/HeroLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/HolyGrailLayout.vue.d.ts +51 -0
- package/dist/components/templates/HolyGrailLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/MagazineLayout.vue.d.ts +38 -0
- package/dist/components/templates/MagazineLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/MasonryLayout.vue.d.ts +27 -0
- package/dist/components/templates/MasonryLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/SidebarLayout.vue.d.ts +36 -0
- package/dist/components/templates/SidebarLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/SingleColumnLayout.vue.d.ts +36 -0
- package/dist/components/templates/SingleColumnLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/SplitLayout.vue.d.ts +34 -0
- package/dist/components/templates/SplitLayout.vue.d.ts.map +1 -0
- package/dist/components/templates/_stories/layoutDemo.d.ts +43 -0
- package/dist/components/templates/_stories/layoutDemo.d.ts.map +1 -0
- package/dist/composables/index.d.ts +17 -1
- package/dist/composables/index.d.ts.map +1 -1
- package/dist/composables/useAnnouncer.d.ts +32 -0
- package/dist/composables/useAnnouncer.d.ts.map +1 -0
- package/dist/composables/useDismiss.d.ts +32 -0
- package/dist/composables/useDismiss.d.ts.map +1 -0
- package/dist/composables/useFloatingPosition.d.ts +32 -0
- package/dist/composables/useFloatingPosition.d.ts.map +1 -0
- package/dist/composables/useFocusTrap.d.ts +42 -0
- package/dist/composables/useFocusTrap.d.ts.map +1 -0
- package/dist/composables/useFormField.d.ts +76 -0
- package/dist/composables/useFormField.d.ts.map +1 -0
- package/dist/composables/useListNavigation.d.ts +40 -0
- package/dist/composables/useListNavigation.d.ts.map +1 -0
- package/dist/composables/useLocale.d.ts +33 -0
- package/dist/composables/useLocale.d.ts.map +1 -0
- package/dist/composables/usePrice.d.ts +85 -0
- package/dist/composables/usePrice.d.ts.map +1 -0
- package/dist/composables/useTheme.d.ts +2 -2
- package/dist/composables/useTypeahead.d.ts +17 -0
- package/dist/composables/useTypeahead.d.ts.map +1 -0
- package/dist/composables/useUniqueId.d.ts +4 -0
- package/dist/composables/useUniqueId.d.ts.map +1 -1
- package/dist/{index-B5DNZRyd.js → index-DxsqHbLv.js} +1 -1
- package/dist/index-n-LN9d8r.js +9062 -0
- package/dist/index.d.ts +26 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +85 -48
- package/dist/index.umd.js +1 -1
- package/dist/locales/en.d.ts +4 -0
- package/dist/locales/en.d.ts.map +1 -0
- package/dist/locales/fr.d.ts +4 -0
- package/dist/locales/fr.d.ts.map +1 -0
- package/dist/locales/index.d.ts +10 -0
- package/dist/locales/index.d.ts.map +1 -0
- package/dist/locales/types.d.ts +155 -0
- package/dist/locales/types.d.ts.map +1 -0
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +247 -14
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/accessibility.d.ts +4 -3
- package/dist/utils/accessibility.d.ts.map +1 -1
- package/dist/utils/layout.d.ts +9 -0
- package/dist/utils/layout.d.ts.map +1 -0
- package/package.json +81 -74
- package/dist/index-B3HEnZbh.js +0 -6194
package/README.md
CHANGED
|
@@ -1,373 +1,373 @@
|
|
|
1
|
-
# SurgeUI Vue Design System
|
|
2
|
-
|
|
3
|
-
A modern **Vue.js 3** component library with Composition API, designed to create beautiful and consistent user interfaces.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@surgeui/ds-vue)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
[](https://vuejs.org/)
|
|
8
|
-
[](https://www.typescriptlang.org/)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
## ✨ Features
|
|
12
|
-
|
|
13
|
-
- 🎨 **Modern Design** - Polished and professional components
|
|
14
|
-
- 🎯 **Composition API** - Built with Vue 3 Composition API
|
|
15
|
-
- 🔧 **TypeScript** - Full TypeScript support for better developer experience
|
|
16
|
-
- 🎨 **Customizable** - Global configuration and theming support
|
|
17
|
-
- 📱 **Responsive** - Components adapted to all screen sizes
|
|
18
|
-
- ♿ **Accessible** - WCAG 2.1 AA compliant with complete accessibility support
|
|
19
|
-
- 🌙 **Dark Mode** - Native dark mode support
|
|
20
|
-
- ⚡ **Performance** - Optimized for best performance
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
|
-
|
|
25
|
-
### Installation
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
npm install @surgeui/ds-vue
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Basic Usage
|
|
32
|
-
|
|
33
|
-
```vue
|
|
34
|
-
<script setup lang="ts" >
|
|
35
|
-
import '@surgeui/ds-vue/style.css'
|
|
36
|
-
import { SuButton } from '@surgeui/ds-vue'
|
|
37
|
-
import type { ButtonProps } from '@surgeui/ds-vue/types'
|
|
38
|
-
</script>
|
|
39
|
-
|
|
40
|
-
<template>
|
|
41
|
-
<SuButton variant="primary">
|
|
42
|
-
My first button
|
|
43
|
-
</SuButton>
|
|
44
|
-
</template>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Global Installation
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
// main.js
|
|
51
|
-
import { createApp } from 'vue'
|
|
52
|
-
import SurgeUpDS from '@surgeui/ds-vue'
|
|
53
|
-
import '@surgeui/ds-vue/style.css'
|
|
54
|
-
import App from './App.vue'
|
|
55
|
-
|
|
56
|
-
const app = createApp(App)
|
|
57
|
-
app.use(SurgeUpDS)
|
|
58
|
-
app.mount('#app')
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 🎨 Customization & Theming
|
|
62
|
-
|
|
63
|
-
SurgeUI provides a **declarative, CSS-based theming system** that allows you to customize colors and styles by defining custom CSS variables.
|
|
64
|
-
|
|
65
|
-
### How It Works
|
|
66
|
-
|
|
67
|
-
The customization system automatically converts theme properties into CSS variables with the `--su-custom-` prefix. These variables can override the default theme tokens when defined.
|
|
68
|
-
|
|
69
|
-
### Global Configuration
|
|
70
|
-
|
|
71
|
-
Configure the design system when installing:
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
import { createApp } from 'vue'
|
|
75
|
-
import SurgeUpDS from '@surgeui/ds-vue'
|
|
76
|
-
import '@surgeui/ds-vue/style.css'
|
|
77
|
-
import App from './App.vue'
|
|
78
|
-
|
|
79
|
-
const app = createApp(App)
|
|
80
|
-
|
|
81
|
-
const themeConfig = {
|
|
82
|
-
// Component prefix (default: 'Su')
|
|
83
|
-
prefix: 'My', // Components become MyButton, MyInput, etc.
|
|
84
|
-
|
|
85
|
-
// Theme customization via CSS variables
|
|
86
|
-
theme: {
|
|
87
|
-
// Text colors
|
|
88
|
-
textPrimary: '#1f2937',
|
|
89
|
-
textSecondary: '#6b7280',
|
|
90
|
-
textTertiary: '#9ca3af',
|
|
91
|
-
textDisabled: '#d1d5db',
|
|
92
|
-
|
|
93
|
-
// Background colors
|
|
94
|
-
bgCanvas: '#ffffff',
|
|
95
|
-
bgSurface: '#f9fafb',
|
|
96
|
-
bgOverlay: 'rgba(0, 0, 0, 0.5)',
|
|
97
|
-
|
|
98
|
-
// Border colors
|
|
99
|
-
borderDefault: '#e5e7eb',
|
|
100
|
-
borderFocus: '#3b82f6',
|
|
101
|
-
|
|
102
|
-
// Action colors
|
|
103
|
-
primaryDefault: '#3b82f6',
|
|
104
|
-
primaryHover: '#2563eb',
|
|
105
|
-
primaryText: '#ffffff',
|
|
106
|
-
|
|
107
|
-
// State colors
|
|
108
|
-
stateSuccess: '#10b981',
|
|
109
|
-
stateWarning: '#f59e0b',
|
|
110
|
-
stateError: '#ef4444',
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
app.use(SurgeUpDS, themeConfig)
|
|
115
|
-
app.mount('#app')
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
### CSS Variable Generation
|
|
119
|
-
|
|
120
|
-
All theme properties are automatically converted to CSS custom properties with the `--su-custom-` prefix:
|
|
121
|
-
|
|
122
|
-
```ts
|
|
123
|
-
theme: {
|
|
124
|
-
textPrimary: '#1f2937' // → --su-custom-text-primary
|
|
125
|
-
bgSurface: '#f9fafb' // → --su-custom-bg-surface
|
|
126
|
-
primaryDefault: '#3b82f6' // → --su-custom-primary-default
|
|
127
|
-
stateSuccessBg: '#d1fae5' // → --su-custom-state-success-bg
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
### Using Custom Variables in CSS
|
|
132
|
-
|
|
133
|
-
Define custom variables in your CSS and they will automatically take precedence over default theme tokens:
|
|
134
|
-
|
|
135
|
-
```css
|
|
136
|
-
/* In your global CSS file */
|
|
137
|
-
:root {
|
|
138
|
-
/* Text customization */
|
|
139
|
-
--su-custom-text-primary: #1f2937;
|
|
140
|
-
--su-custom-text-secondary: #6b7280;
|
|
141
|
-
|
|
142
|
-
/* Background customization */
|
|
143
|
-
--su-custom-bg-canvas: #ffffff;
|
|
144
|
-
--su-custom-bg-surface: #f9fafb;
|
|
145
|
-
|
|
146
|
-
/* Button customization */
|
|
147
|
-
--su-custom-primary-default: #3b82f6;
|
|
148
|
-
--su-custom-primary-hover: #2563eb;
|
|
149
|
-
--su-custom-primary-text: #ffffff;
|
|
150
|
-
|
|
151
|
-
/* State customization */
|
|
152
|
-
--su-custom-state-success: #10b981;
|
|
153
|
-
--su-custom-state-error: #ef4444;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/* Dark mode example */
|
|
157
|
-
@media (prefers-color-scheme: dark) {
|
|
158
|
-
:root {
|
|
159
|
-
--su-custom-text-primary: #f3f4f6;
|
|
160
|
-
--su-custom-bg-canvas: #111827;
|
|
161
|
-
--su-custom-bg-surface: #1f2937;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
### Available Theme Tokens
|
|
167
|
-
|
|
168
|
-
#### Text Tokens
|
|
169
|
-
- `textPrimary` - Primary text color
|
|
170
|
-
- `textSecondary` - Secondary text color
|
|
171
|
-
- `textTertiary` - Tertiary text color
|
|
172
|
-
- `textDisabled` - Disabled text color
|
|
173
|
-
- `textInverse` - Inverse text color (for contrast backgrounds)
|
|
174
|
-
|
|
175
|
-
#### Background Tokens
|
|
176
|
-
- `bgCanvas` - Canvas/page background
|
|
177
|
-
- `bgSurface` - Card and modal backgrounds
|
|
178
|
-
- `bgSurfaceElevated` - Elevated surface backgrounds
|
|
179
|
-
- `bgHover` - Hover state background
|
|
180
|
-
- `bgActive` - Active state background
|
|
181
|
-
- `bgSelected` - Selected state background
|
|
182
|
-
- `bgOverlay` - Overlay/backdrop background
|
|
183
|
-
|
|
184
|
-
#### Border Tokens
|
|
185
|
-
- `borderDefault` - Default border color
|
|
186
|
-
- `borderSubtle` - Subtle border color
|
|
187
|
-
- `borderStrong` - Strong border color
|
|
188
|
-
- `borderFocus` - Focus state border
|
|
189
|
-
- `borderDisabled` - Disabled border
|
|
190
|
-
|
|
191
|
-
#### Action Tokens
|
|
192
|
-
- `primaryDefault` - Primary action default
|
|
193
|
-
- `primaryHover` - Primary action hover
|
|
194
|
-
- `primaryActive` - Primary action active
|
|
195
|
-
- `primaryDisabled` - Primary action disabled
|
|
196
|
-
- `primaryText` - Primary action text
|
|
197
|
-
- `secondaryDefault` - Secondary action default
|
|
198
|
-
- `secondaryHover` - Secondary action hover
|
|
199
|
-
- `secondaryText` - Secondary action text
|
|
200
|
-
|
|
201
|
-
#### State Tokens
|
|
202
|
-
- `stateSuccess` - Success state color
|
|
203
|
-
- `stateSuccessBg` - Success background
|
|
204
|
-
- `stateWarning` - Warning state color
|
|
205
|
-
- `stateWarningBg` - Warning background
|
|
206
|
-
- `stateError` - Error state color
|
|
207
|
-
- `stateErrorBg` - Error background
|
|
208
|
-
- `stateInfo` - Info state color
|
|
209
|
-
- `stateInfoBg` - Info background
|
|
210
|
-
|
|
211
|
-
#### Link Tokens (legacy configuration)
|
|
212
|
-
- `linkVariant` - Default link variant
|
|
213
|
-
- `linkSize` - Default link size
|
|
214
|
-
- `linkUnderline` - Default underline style
|
|
215
|
-
- `dialogDisplay` - Default dialog display mode
|
|
216
|
-
|
|
217
|
-
### Variable Priority & Fallback
|
|
218
|
-
|
|
219
|
-
Variables follow this priority order:
|
|
220
|
-
|
|
221
|
-
1. **Custom CSS variables** (`--su-custom-*`) - Highest priority
|
|
222
|
-
2. **Theme configuration** - Applied during plugin initialization
|
|
223
|
-
3. **Default theme tokens** - Fallbacks from theme definitions
|
|
224
|
-
|
|
225
|
-
This means:
|
|
226
|
-
- CSS variables defined in `:root` or element styles always take precedence
|
|
227
|
-
- Variables not defined in the theme config fall back to default tokens
|
|
228
|
-
- You can override specific tokens without defining the entire theme
|
|
229
|
-
|
|
230
|
-
### Scoped Customization
|
|
231
|
-
|
|
232
|
-
Apply different themes to different parts of your application:
|
|
233
|
-
|
|
234
|
-
```vue
|
|
235
|
-
<template>
|
|
236
|
-
<!-- Light theme section -->
|
|
237
|
-
<section class="light-section">
|
|
238
|
-
<SuButton>Light Button</SuButton>
|
|
239
|
-
</section>
|
|
240
|
-
|
|
241
|
-
<!-- Dark theme section -->
|
|
242
|
-
<section class="dark-section">
|
|
243
|
-
<SuButton>Dark Button</SuButton>
|
|
244
|
-
</section>
|
|
245
|
-
</template>
|
|
246
|
-
|
|
247
|
-
<style scoped>
|
|
248
|
-
.light-section {
|
|
249
|
-
--su-custom-text-primary: #1f2937;
|
|
250
|
-
--su-custom-bg-surface: #ffffff;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.dark-section {
|
|
254
|
-
--su-custom-text-primary: #f3f4f6;
|
|
255
|
-
--su-custom-bg-surface: #1f2937;
|
|
256
|
-
}
|
|
257
|
-
</style>
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
### With Icons
|
|
261
|
-
|
|
262
|
-
SurgeUI use **Heroicons** for add and display icons
|
|
263
|
-
|
|
264
|
-
```vue
|
|
265
|
-
<script setup>
|
|
266
|
-
import { informationCircleIcon, HeartIcon } from '@heroicons/vue/24/outline'
|
|
267
|
-
</script>
|
|
268
|
-
|
|
269
|
-
<template>
|
|
270
|
-
<SuHeading>
|
|
271
|
-
<informationCircleIcon /> User informations
|
|
272
|
-
</SuHeading>
|
|
273
|
-
<SuButton variant="primary" :icon="HeartIcon" iconDisplay="left">
|
|
274
|
-
I like it
|
|
275
|
-
</SuButton>
|
|
276
|
-
</template>
|
|
277
|
-
```
|
|
278
|
-
|
|
279
|
-
## ♿ Accessibility
|
|
280
|
-
|
|
281
|
-
All components follow WCAG 2.1 AA standards:
|
|
282
|
-
|
|
283
|
-
- **Focus Management** - Clear focus indicators and logical tab order
|
|
284
|
-
- **Keyboard Navigation** - Full keyboard support
|
|
285
|
-
- **Screen Readers** - Proper ARIA attributes and announcements
|
|
286
|
-
- **Color Contrast** - WCAG AA compliant contrast ratios (4.5:1 minimum)
|
|
287
|
-
- **Touch Targets** - Minimum 44px touch targets
|
|
288
|
-
- **Reduced Motion** - Respects `prefers-reduced-motion`
|
|
289
|
-
- **High Contrast** - Supports `prefers-contrast: high`
|
|
290
|
-
- **RTL Support** - Right-to-left language support
|
|
291
|
-
|
|
292
|
-
## 🌙 Dark Mode
|
|
293
|
-
|
|
294
|
-
Dark mode is automatically supported through CSS media queries:
|
|
295
|
-
|
|
296
|
-
```css
|
|
297
|
-
@media (prefers-color-scheme: dark) {
|
|
298
|
-
/* Dark mode styles are automatically applied */
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.dark, [theme="dark"] * {
|
|
302
|
-
/* Dark mode styles are automatically applied */
|
|
303
|
-
}
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
## 📱 Responsive Design
|
|
307
|
-
|
|
308
|
-
All components are responsive by default:
|
|
309
|
-
|
|
310
|
-
- **Mobile-first** approach
|
|
311
|
-
- **Flexible layouts** that adapt to screen size
|
|
312
|
-
- **Touch-friendly** interactions
|
|
313
|
-
- **Automatic responsive behavior** (e.g., FormFields switches to vertical on mobile)
|
|
314
|
-
|
|
315
|
-
## 🎭 Storybook
|
|
316
|
-
|
|
317
|
-
Explore all components interactively in Storybook:
|
|
318
|
-
|
|
319
|
-
```bash
|
|
320
|
-
npm run storybook
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
## 🛠️ Development
|
|
324
|
-
|
|
325
|
-
### Prerequisites
|
|
326
|
-
|
|
327
|
-
- Node.js 16+
|
|
328
|
-
- Vue.js 3.3+
|
|
329
|
-
|
|
330
|
-
### Build the library
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
npm run build
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
### Development mode
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
npm run dev
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
### Run Storybook
|
|
343
|
-
|
|
344
|
-
```bash
|
|
345
|
-
npm run storybook
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
## 📖 Documentation
|
|
349
|
-
|
|
350
|
-
Visit our [complete documentation](https://surgeui.com/) for:
|
|
351
|
-
|
|
352
|
-
- **Component API** - Detailed props, events, and slots
|
|
353
|
-
- **Usage examples** - Real-world implementation examples
|
|
354
|
-
- **Accessibility guide** - Best practices for inclusive design
|
|
355
|
-
- **Customization** - Theming and configuration options
|
|
356
|
-
|
|
357
|
-
## 🤝 Contributing
|
|
358
|
-
|
|
359
|
-
We welcome contributions! Please see our [Contributing Guide](https://github.com/mahmoud-nb/surge.ui/blob/main/package/CONTRIBUTING.md) for details.
|
|
360
|
-
|
|
361
|
-
## 📄 License
|
|
362
|
-
|
|
363
|
-
MIT License - see the [LICENSE](https://github.com/mahmoud-nb/surge.ui/blob/main/package/LICENSE.md) file for details.
|
|
364
|
-
|
|
365
|
-
## 🔗 Links
|
|
366
|
-
|
|
367
|
-
- [Documentation](https://surgeui.com/)
|
|
368
|
-
- [Storybook](https://surgeui.com/storybook/)
|
|
369
|
-
- [GitHub Repository](https://github.com/mahmoud-nb/surge.ui)
|
|
370
|
-
|
|
371
|
-
---
|
|
372
|
-
|
|
1
|
+
# SurgeUI Vue Design System
|
|
2
|
+
|
|
3
|
+
A modern **Vue.js 3** component library with Composition API, designed to create beautiful and consistent user interfaces.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@surgeui/ds-vue)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://vuejs.org/)
|
|
8
|
+
[](https://www.typescriptlang.org/)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- 🎨 **Modern Design** - Polished and professional components
|
|
14
|
+
- 🎯 **Composition API** - Built with Vue 3 Composition API
|
|
15
|
+
- 🔧 **TypeScript** - Full TypeScript support for better developer experience
|
|
16
|
+
- 🎨 **Customizable** - Global configuration and theming support
|
|
17
|
+
- 📱 **Responsive** - Components adapted to all screen sizes
|
|
18
|
+
- ♿ **Accessible** - WCAG 2.1 AA compliant with complete accessibility support
|
|
19
|
+
- 🌙 **Dark Mode** - Native dark mode support
|
|
20
|
+
- ⚡ **Performance** - Optimized for best performance
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @surgeui/ds-vue
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Basic Usage
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<script setup lang="ts" >
|
|
35
|
+
import '@surgeui/ds-vue/style.css'
|
|
36
|
+
import { SuButton } from '@surgeui/ds-vue'
|
|
37
|
+
import type { ButtonProps } from '@surgeui/ds-vue/types'
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<SuButton variant="primary">
|
|
42
|
+
My first button
|
|
43
|
+
</SuButton>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Global Installation
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// main.js
|
|
51
|
+
import { createApp } from 'vue'
|
|
52
|
+
import SurgeUpDS from '@surgeui/ds-vue'
|
|
53
|
+
import '@surgeui/ds-vue/style.css'
|
|
54
|
+
import App from './App.vue'
|
|
55
|
+
|
|
56
|
+
const app = createApp(App)
|
|
57
|
+
app.use(SurgeUpDS)
|
|
58
|
+
app.mount('#app')
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 🎨 Customization & Theming
|
|
62
|
+
|
|
63
|
+
SurgeUI provides a **declarative, CSS-based theming system** that allows you to customize colors and styles by defining custom CSS variables.
|
|
64
|
+
|
|
65
|
+
### How It Works
|
|
66
|
+
|
|
67
|
+
The customization system automatically converts theme properties into CSS variables with the `--su-custom-` prefix. These variables can override the default theme tokens when defined.
|
|
68
|
+
|
|
69
|
+
### Global Configuration
|
|
70
|
+
|
|
71
|
+
Configure the design system when installing:
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { createApp } from 'vue'
|
|
75
|
+
import SurgeUpDS from '@surgeui/ds-vue'
|
|
76
|
+
import '@surgeui/ds-vue/style.css'
|
|
77
|
+
import App from './App.vue'
|
|
78
|
+
|
|
79
|
+
const app = createApp(App)
|
|
80
|
+
|
|
81
|
+
const themeConfig = {
|
|
82
|
+
// Component prefix (default: 'Su')
|
|
83
|
+
prefix: 'My', // Components become MyButton, MyInput, etc.
|
|
84
|
+
|
|
85
|
+
// Theme customization via CSS variables
|
|
86
|
+
theme: {
|
|
87
|
+
// Text colors
|
|
88
|
+
textPrimary: '#1f2937',
|
|
89
|
+
textSecondary: '#6b7280',
|
|
90
|
+
textTertiary: '#9ca3af',
|
|
91
|
+
textDisabled: '#d1d5db',
|
|
92
|
+
|
|
93
|
+
// Background colors
|
|
94
|
+
bgCanvas: '#ffffff',
|
|
95
|
+
bgSurface: '#f9fafb',
|
|
96
|
+
bgOverlay: 'rgba(0, 0, 0, 0.5)',
|
|
97
|
+
|
|
98
|
+
// Border colors
|
|
99
|
+
borderDefault: '#e5e7eb',
|
|
100
|
+
borderFocus: '#3b82f6',
|
|
101
|
+
|
|
102
|
+
// Action colors
|
|
103
|
+
primaryDefault: '#3b82f6',
|
|
104
|
+
primaryHover: '#2563eb',
|
|
105
|
+
primaryText: '#ffffff',
|
|
106
|
+
|
|
107
|
+
// State colors
|
|
108
|
+
stateSuccess: '#10b981',
|
|
109
|
+
stateWarning: '#f59e0b',
|
|
110
|
+
stateError: '#ef4444',
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
app.use(SurgeUpDS, themeConfig)
|
|
115
|
+
app.mount('#app')
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### CSS Variable Generation
|
|
119
|
+
|
|
120
|
+
All theme properties are automatically converted to CSS custom properties with the `--su-custom-` prefix:
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
theme: {
|
|
124
|
+
textPrimary: '#1f2937' // → --su-custom-text-primary
|
|
125
|
+
bgSurface: '#f9fafb' // → --su-custom-bg-surface
|
|
126
|
+
primaryDefault: '#3b82f6' // → --su-custom-primary-default
|
|
127
|
+
stateSuccessBg: '#d1fae5' // → --su-custom-state-success-bg
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Using Custom Variables in CSS
|
|
132
|
+
|
|
133
|
+
Define custom variables in your CSS and they will automatically take precedence over default theme tokens:
|
|
134
|
+
|
|
135
|
+
```css
|
|
136
|
+
/* In your global CSS file */
|
|
137
|
+
:root {
|
|
138
|
+
/* Text customization */
|
|
139
|
+
--su-custom-text-primary: #1f2937;
|
|
140
|
+
--su-custom-text-secondary: #6b7280;
|
|
141
|
+
|
|
142
|
+
/* Background customization */
|
|
143
|
+
--su-custom-bg-canvas: #ffffff;
|
|
144
|
+
--su-custom-bg-surface: #f9fafb;
|
|
145
|
+
|
|
146
|
+
/* Button customization */
|
|
147
|
+
--su-custom-primary-default: #3b82f6;
|
|
148
|
+
--su-custom-primary-hover: #2563eb;
|
|
149
|
+
--su-custom-primary-text: #ffffff;
|
|
150
|
+
|
|
151
|
+
/* State customization */
|
|
152
|
+
--su-custom-state-success: #10b981;
|
|
153
|
+
--su-custom-state-error: #ef4444;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* Dark mode example */
|
|
157
|
+
@media (prefers-color-scheme: dark) {
|
|
158
|
+
:root {
|
|
159
|
+
--su-custom-text-primary: #f3f4f6;
|
|
160
|
+
--su-custom-bg-canvas: #111827;
|
|
161
|
+
--su-custom-bg-surface: #1f2937;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Available Theme Tokens
|
|
167
|
+
|
|
168
|
+
#### Text Tokens
|
|
169
|
+
- `textPrimary` - Primary text color
|
|
170
|
+
- `textSecondary` - Secondary text color
|
|
171
|
+
- `textTertiary` - Tertiary text color
|
|
172
|
+
- `textDisabled` - Disabled text color
|
|
173
|
+
- `textInverse` - Inverse text color (for contrast backgrounds)
|
|
174
|
+
|
|
175
|
+
#### Background Tokens
|
|
176
|
+
- `bgCanvas` - Canvas/page background
|
|
177
|
+
- `bgSurface` - Card and modal backgrounds
|
|
178
|
+
- `bgSurfaceElevated` - Elevated surface backgrounds
|
|
179
|
+
- `bgHover` - Hover state background
|
|
180
|
+
- `bgActive` - Active state background
|
|
181
|
+
- `bgSelected` - Selected state background
|
|
182
|
+
- `bgOverlay` - Overlay/backdrop background
|
|
183
|
+
|
|
184
|
+
#### Border Tokens
|
|
185
|
+
- `borderDefault` - Default border color
|
|
186
|
+
- `borderSubtle` - Subtle border color
|
|
187
|
+
- `borderStrong` - Strong border color
|
|
188
|
+
- `borderFocus` - Focus state border
|
|
189
|
+
- `borderDisabled` - Disabled border
|
|
190
|
+
|
|
191
|
+
#### Action Tokens
|
|
192
|
+
- `primaryDefault` - Primary action default
|
|
193
|
+
- `primaryHover` - Primary action hover
|
|
194
|
+
- `primaryActive` - Primary action active
|
|
195
|
+
- `primaryDisabled` - Primary action disabled
|
|
196
|
+
- `primaryText` - Primary action text
|
|
197
|
+
- `secondaryDefault` - Secondary action default
|
|
198
|
+
- `secondaryHover` - Secondary action hover
|
|
199
|
+
- `secondaryText` - Secondary action text
|
|
200
|
+
|
|
201
|
+
#### State Tokens
|
|
202
|
+
- `stateSuccess` - Success state color
|
|
203
|
+
- `stateSuccessBg` - Success background
|
|
204
|
+
- `stateWarning` - Warning state color
|
|
205
|
+
- `stateWarningBg` - Warning background
|
|
206
|
+
- `stateError` - Error state color
|
|
207
|
+
- `stateErrorBg` - Error background
|
|
208
|
+
- `stateInfo` - Info state color
|
|
209
|
+
- `stateInfoBg` - Info background
|
|
210
|
+
|
|
211
|
+
#### Link Tokens (legacy configuration)
|
|
212
|
+
- `linkVariant` - Default link variant
|
|
213
|
+
- `linkSize` - Default link size
|
|
214
|
+
- `linkUnderline` - Default underline style
|
|
215
|
+
- `dialogDisplay` - Default dialog display mode
|
|
216
|
+
|
|
217
|
+
### Variable Priority & Fallback
|
|
218
|
+
|
|
219
|
+
Variables follow this priority order:
|
|
220
|
+
|
|
221
|
+
1. **Custom CSS variables** (`--su-custom-*`) - Highest priority
|
|
222
|
+
2. **Theme configuration** - Applied during plugin initialization
|
|
223
|
+
3. **Default theme tokens** - Fallbacks from theme definitions
|
|
224
|
+
|
|
225
|
+
This means:
|
|
226
|
+
- CSS variables defined in `:root` or element styles always take precedence
|
|
227
|
+
- Variables not defined in the theme config fall back to default tokens
|
|
228
|
+
- You can override specific tokens without defining the entire theme
|
|
229
|
+
|
|
230
|
+
### Scoped Customization
|
|
231
|
+
|
|
232
|
+
Apply different themes to different parts of your application:
|
|
233
|
+
|
|
234
|
+
```vue
|
|
235
|
+
<template>
|
|
236
|
+
<!-- Light theme section -->
|
|
237
|
+
<section class="light-section">
|
|
238
|
+
<SuButton>Light Button</SuButton>
|
|
239
|
+
</section>
|
|
240
|
+
|
|
241
|
+
<!-- Dark theme section -->
|
|
242
|
+
<section class="dark-section">
|
|
243
|
+
<SuButton>Dark Button</SuButton>
|
|
244
|
+
</section>
|
|
245
|
+
</template>
|
|
246
|
+
|
|
247
|
+
<style scoped>
|
|
248
|
+
.light-section {
|
|
249
|
+
--su-custom-text-primary: #1f2937;
|
|
250
|
+
--su-custom-bg-surface: #ffffff;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.dark-section {
|
|
254
|
+
--su-custom-text-primary: #f3f4f6;
|
|
255
|
+
--su-custom-bg-surface: #1f2937;
|
|
256
|
+
}
|
|
257
|
+
</style>
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### With Icons
|
|
261
|
+
|
|
262
|
+
SurgeUI use **Heroicons** for add and display icons
|
|
263
|
+
|
|
264
|
+
```vue
|
|
265
|
+
<script setup>
|
|
266
|
+
import { informationCircleIcon, HeartIcon } from '@heroicons/vue/24/outline'
|
|
267
|
+
</script>
|
|
268
|
+
|
|
269
|
+
<template>
|
|
270
|
+
<SuHeading>
|
|
271
|
+
<informationCircleIcon /> User informations
|
|
272
|
+
</SuHeading>
|
|
273
|
+
<SuButton variant="primary" :icon="HeartIcon" iconDisplay="left">
|
|
274
|
+
I like it
|
|
275
|
+
</SuButton>
|
|
276
|
+
</template>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## ♿ Accessibility
|
|
280
|
+
|
|
281
|
+
All components follow WCAG 2.1 AA standards:
|
|
282
|
+
|
|
283
|
+
- **Focus Management** - Clear focus indicators and logical tab order
|
|
284
|
+
- **Keyboard Navigation** - Full keyboard support
|
|
285
|
+
- **Screen Readers** - Proper ARIA attributes and announcements
|
|
286
|
+
- **Color Contrast** - WCAG AA compliant contrast ratios (4.5:1 minimum)
|
|
287
|
+
- **Touch Targets** - Minimum 44px touch targets
|
|
288
|
+
- **Reduced Motion** - Respects `prefers-reduced-motion`
|
|
289
|
+
- **High Contrast** - Supports `prefers-contrast: high`
|
|
290
|
+
- **RTL Support** - Right-to-left language support
|
|
291
|
+
|
|
292
|
+
## 🌙 Dark Mode
|
|
293
|
+
|
|
294
|
+
Dark mode is automatically supported through CSS media queries:
|
|
295
|
+
|
|
296
|
+
```css
|
|
297
|
+
@media (prefers-color-scheme: dark) {
|
|
298
|
+
/* Dark mode styles are automatically applied */
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.dark, [theme="dark"] * {
|
|
302
|
+
/* Dark mode styles are automatically applied */
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## 📱 Responsive Design
|
|
307
|
+
|
|
308
|
+
All components are responsive by default:
|
|
309
|
+
|
|
310
|
+
- **Mobile-first** approach
|
|
311
|
+
- **Flexible layouts** that adapt to screen size
|
|
312
|
+
- **Touch-friendly** interactions
|
|
313
|
+
- **Automatic responsive behavior** (e.g., FormFields switches to vertical on mobile)
|
|
314
|
+
|
|
315
|
+
## 🎭 Storybook
|
|
316
|
+
|
|
317
|
+
Explore all components interactively in Storybook:
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
npm run storybook
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
## 🛠️ Development
|
|
324
|
+
|
|
325
|
+
### Prerequisites
|
|
326
|
+
|
|
327
|
+
- Node.js 16+
|
|
328
|
+
- Vue.js 3.3+
|
|
329
|
+
|
|
330
|
+
### Build the library
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
npm run build
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Development mode
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
npm run dev
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
### Run Storybook
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
npm run storybook
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## 📖 Documentation
|
|
349
|
+
|
|
350
|
+
Visit our [complete documentation](https://surgeui.com/) for:
|
|
351
|
+
|
|
352
|
+
- **Component API** - Detailed props, events, and slots
|
|
353
|
+
- **Usage examples** - Real-world implementation examples
|
|
354
|
+
- **Accessibility guide** - Best practices for inclusive design
|
|
355
|
+
- **Customization** - Theming and configuration options
|
|
356
|
+
|
|
357
|
+
## 🤝 Contributing
|
|
358
|
+
|
|
359
|
+
We welcome contributions! Please see our [Contributing Guide](https://github.com/mahmoud-nb/surge.ui/blob/main/package/CONTRIBUTING.md) for details.
|
|
360
|
+
|
|
361
|
+
## 📄 License
|
|
362
|
+
|
|
363
|
+
MIT License - see the [LICENSE](https://github.com/mahmoud-nb/surge.ui/blob/main/package/LICENSE.md) file for details.
|
|
364
|
+
|
|
365
|
+
## 🔗 Links
|
|
366
|
+
|
|
367
|
+
- [Documentation](https://surgeui.com/)
|
|
368
|
+
- [Storybook](https://surgeui.com/storybook/)
|
|
369
|
+
- [GitHub Repository](https://github.com/mahmoud-nb/surge.ui)
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
373
|
Made with ❤️ by the SurgeUp team
|