test-bentoweb-ui 1.0.74 → 1.0.76

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
@@ -1,6 +1,48 @@
1
- # bentoweb-ui
1
+ # Bento UI - Component Library
2
2
 
3
- This template should help get you started developing with Vue 3 in Vite.
3
+ A Vue 3 component library built with Vite, providing responsive and customizable UI components with built-in preview mode functionality for development and testing.
4
+
5
+ ## Project Overview
6
+
7
+ ### Core Features
8
+
9
+ 1. **Responsive Components**: All components are built with mobile-first design and responsive breakpoints
10
+ 2. **Preview Mode**: Core feature allowing developers to test desktop/mobile layouts without resizing browser
11
+ 3. **Swiper Integration**: Uses modern Swiper Element (Web Component) for carousel functionality
12
+ 4. **Flexible Layouts**: Multiple size and grid configurations for different use cases
13
+ 5. **Vue 3 Composition API**: Modern Vue 3 features for better performance and developer experience
14
+
15
+ ### Project Structure
16
+
17
+ ```
18
+ bento-ui/
19
+ ├── src/
20
+ │ ├── components/ # Vue components
21
+ │ │ ├── BtwSwiperBanner.vue # Main banner component with preview mode
22
+ │ │ └── ...other components
23
+ │ ├── assets/ # Static assets (images, styles)
24
+ │ ├── composables/ # Vue 3 composables for shared logic
25
+ │ └── utils/ # Helper functions and utilities
26
+ ├── public/ # Public assets
27
+ ├── dist/ # Build output (generated)
28
+ └── package.json # Dependencies and scripts
29
+ ```
30
+
31
+ ### Key Technologies
32
+
33
+ - **Vue 3**: Progressive JavaScript framework
34
+ - **Vite**: Fast build tool and dev server
35
+ - **Swiper**: Modern touch slider library (using Web Components)
36
+ - **SCSS**: Enhanced CSS with variables and mixins
37
+ - **TypeScript Support**: Optional type safety
38
+
39
+ ### Design Philosophy
40
+
41
+ 1. **Component Reusability**: Components are designed to be flexible and reusable across different projects
42
+ 2. **Developer Experience**: Preview mode and clear documentation for easier development
43
+ 3. **Performance First**: Optimized for fast loading and smooth interactions
44
+ 4. **Responsive by Default**: All components work seamlessly across devices
45
+ 5. **Customizable**: Props and slots for extensive customization
4
46
 
5
47
  ## Recommended IDE Setup
6
48
 
@@ -76,6 +118,7 @@ export default {
76
118
  |------|------|---------|-------------|
77
119
  | BannerImage | Array | required | Array of objects with `src` and `link` properties |
78
120
  | size | String | 'l' | Size/layout of the banner. Options: 'm' (interactive style), 'l' (full banner with pagination), 'xl' (two-column layout), 'grid-2' (two square banners), 'grid-6' (3x2 grid of banners) |
121
+ | previewMode | String | '' | Forces the component to display in a specific mode regardless of screen size. Options: '' (normal responsive), 'desktop' (forces desktop view), 'mobile' (forces mobile view) |
79
122
 
80
123
  The `src` property can be:
81
124
  - A path relative to the public directory (e.g., `/images/example.jpg`)
@@ -128,6 +171,102 @@ On mobile devices (screen width < 768px), this layout automatically switches to
128
171
 
129
172
  <!-- Grid-6 - 3x2 grid of banners -->
130
173
  <SwiperBanner :BannerImage="bannerImages" size="grid-6" />
174
+
175
+ <!-- With Preview Mode - Force mobile view on desktop -->
176
+ <SwiperBanner :BannerImage="bannerImages" size="xl" previewMode="mobile" />
177
+
178
+ <!-- With Preview Mode - Force desktop view on mobile -->
179
+ <SwiperBanner :BannerImage="bannerImages" size="grid-6" previewMode="desktop" />
180
+ ```
181
+
182
+ ### Preview Mode Feature
183
+
184
+ The preview mode is a core feature of Bento UI components that allows developers to preview how components will appear on different devices without resizing the browser window. This is particularly useful during development and testing.
185
+
186
+ #### How Preview Mode Works
187
+
188
+ When `previewMode` is set:
189
+ - **`previewMode="mobile"`**: Forces the component to display its mobile layout regardless of the actual screen size
190
+ - **`previewMode="desktop"`**: Forces the component to display its desktop layout regardless of the actual screen size
191
+ - **`previewMode=""` or not set**: Component uses normal responsive behavior based on actual screen width
192
+
193
+ The preview mode:
194
+ 1. Overrides responsive breakpoints
195
+ 2. Applies fixed settings based on the selected mode
196
+ 3. Uses CSS classes to control layout visibility
197
+ 4. Maintains the appropriate interaction patterns (touch/swipe for mobile, click for desktop)
198
+
199
+ This feature is implemented across Bento UI components to ensure consistent development and testing experience.
200
+
201
+ ### Development Workflow
202
+
203
+ #### Local Development
204
+
205
+ 1. **Install dependencies**: `npm install`
206
+ 2. **Start dev server**: `npm run dev` - Launches Vite dev server with hot module replacement
207
+ 3. **Build for production**: `npm run build` - Creates optimized production build in `dist/`
208
+ 4. **Preview production build**: `npm run preview` - Test the production build locally
209
+
210
+ #### Component Testing Environment
211
+
212
+ The `src/views/DashboardView.vue` file serves as the primary testing environment for all Bento UI components. This view includes:
213
+
214
+ - **Preview Mode Controls**: Buttons to toggle between mobile, desktop, and default responsive modes
215
+ - **Live Component Testing**: All components are imported and tested with real data
216
+ - **Interactive Examples**: Form inputs, color pickers, dropdowns, and other interactive elements
217
+ - **Multiple Layout Tests**: Various banner sizes and configurations (grid-6, grid-2, xl, l, m)
218
+ - **Real-world Data**: Sample products, flash sales, and other e-commerce data for testing
219
+
220
+ Example from DashboardView.vue:
221
+ ```vue
222
+ // Preview mode toggle buttons
223
+ <button @click="togglePreviewMode('mobile')">Preview Mode mobile</button>
224
+ <button @click="togglePreviewMode('desktop')">Preview Mode desktop</button>
225
+ <button @click="togglePreviewMode('')">Preview Mode default</button>
226
+
227
+ // Components with preview mode
228
+ <SwiperBanner :slides="BannerImageXL" size="xl" :previewMode="previewModeMobile" />
229
+ <BtwSpecialCategorySwiper
230
+ :specialProductsBannerList="featuredProducts"
231
+ :previewMode="previewModeMobile"
232
+ />
233
+ ```
234
+
235
+ This centralized testing approach ensures all components work correctly together and maintain consistent behavior across different preview modes.
236
+
237
+ #### Component Development Guidelines
238
+
239
+ When creating or modifying components:
240
+
241
+ 1. **Always implement preview mode** for responsive components:
242
+ ```vue
243
+ props: {
244
+ previewMode: {
245
+ type: String,
246
+ default: '',
247
+ validator: (value) => ['', 'desktop', 'mobile'].includes(value),
248
+ }
249
+ }
250
+ ```
251
+
252
+ 2. **Use computed properties** for dynamic configurations based on props
253
+ 3. **Follow mobile-first approach** with progressive enhancement for larger screens
254
+ 4. **Maintain aspect ratios** for visual consistency across devices
255
+ 5. **Document all props** with clear descriptions and examples
256
+
257
+ #### Testing Components
258
+
259
+ Use the preview mode to test components in different viewport scenarios:
260
+
261
+ ```vue
262
+ <!-- Test mobile layout on desktop browser -->
263
+ <YourComponent previewMode="mobile" />
264
+
265
+ <!-- Test desktop layout on mobile device -->
266
+ <YourComponent previewMode="desktop" />
267
+
268
+ <!-- Normal responsive behavior -->
269
+ <YourComponent />
131
270
  ```
132
271
 
133
272
  ### Swiper Element Attributes