@appsbd/vue3-appsbd-ui 1.0.1 → 1.0.3
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/.ai/ai_ref_AbAvatar.md +9 -1
- package/.ai/ai_ref_AbBadge.md +6 -5
- package/.ai/ai_ref_AbButton.md +8 -8
- package/.ai/ai_ref_AbCarousel.md +47 -47
- package/.ai/ai_ref_AbConfirmPopover.md +59 -59
- package/.ai/ai_ref_AbDarkModeToggler.md +42 -42
- package/.ai/ai_ref_AbEasyModal.md +62 -62
- package/.ai/ai_ref_AbFileUploader.md +63 -63
- package/.ai/ai_ref_AbFilterPanel.md +71 -71
- package/.ai/ai_ref_AbFormCheck.md +75 -75
- package/.ai/ai_ref_AbImageRadioInput.md +63 -63
- package/.ai/ai_ref_AbKbd.md +35 -35
- package/.ai/ai_ref_AbKbdGroup.md +33 -33
- package/.ai/ai_ref_AbModal.md +103 -103
- package/.ai/ai_ref_AbMultiSelect.md +1 -0
- package/.ai/ai_ref_AbNumberField.md +84 -84
- package/.ai/ai_ref_AbPopover.md +64 -64
- package/.ai/ai_ref_AbPricingCard.md +64 -64
- package/.ai/ai_ref_AbPricingContainer.md +49 -49
- package/.ai/ai_ref_AbPricingTable.md +72 -72
- package/.ai/ai_ref_AbProgressbar.md +44 -44
- package/.ai/ai_ref_AbScrollbar.md +48 -48
- package/.ai/ai_ref_AbSettingsForm.md +54 -54
- package/.ai/ai_ref_AbSideMenuItem.md +58 -58
- package/.ai/ai_ref_AbSidebar.md +70 -70
- package/.ai/ai_ref_AbSkeleton.md +41 -41
- package/.ai/ai_ref_AbSlider.md +71 -71
- package/.ai/ai_ref_AbTab.md +38 -38
- package/.ai/ai_ref_AbTable.md +59 -59
- package/.ai/ai_ref_AbTabs.md +47 -47
- package/.ai/ai_ref_AbToggle.md +65 -65
- package/.ai/ai_ref_AbTooltip.md +53 -53
- package/.ai/ai_ref_AbWizard.md +77 -77
- package/.ai/ai_ref_AbWizardStep.md +48 -48
- package/.ai/ai_ref_abEventBus.md +94 -0
- package/.ai/ai_ref_abRequestParam.md +55 -0
- package/.ai/ai_ref_abTranslate.md +33 -0
- package/.ai/ai_ref_abVeeRules.md +42 -0
- package/.ai/ai_ref_useAlert.md +63 -0
- package/.ai/ai_ref_useFileValidator.md +46 -0
- package/.ai/ai_ref_useResponsive.md +55 -0
- package/.ai/ai_ref_useTheme.md +39 -0
- package/.ai/ai_ref_useToast.md +42 -0
- package/AI_REFERENCE.md +160 -134
- package/design-system.md +403 -403
- package/dist/skins/red.scss +3 -3
- package/dist/skins/themes/_red.scss +6 -6
- package/dist/style.css +1 -1
- package/dist/vue3-appsbd-ui.cjs.js +58 -58
- package/dist/vue3-appsbd-ui.es.js +5449 -5342
- package/package.json +1 -1
- package/readme.md +136 -136
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# abVeeRules (Library)
|
|
2
|
+
|
|
3
|
+
A collection of pre-configured VeeValidate validation rules integrated with localization via `abTranslate`.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
npm install @vue3-appsbd-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
These rules are typically used internally by the library's `AbField` or form components, but can be imported and registered globally if needed.
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { abAllRules } from "@vue3-appsbd-ui/libraries/abVeeRules";
|
|
17
|
+
import { defineRule } from "vee-validate";
|
|
18
|
+
|
|
19
|
+
// Register all custom library rules manually if needed
|
|
20
|
+
Object.keys(abAllRules).forEach(rule => {
|
|
21
|
+
defineRule(rule, abAllRules[rule]);
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## API Reference
|
|
26
|
+
|
|
27
|
+
### `abAllRules` Object
|
|
28
|
+
|
|
29
|
+
An object containing validation functions conforming to VeeValidate's custom rule signature `(value, params, field)`.
|
|
30
|
+
|
|
31
|
+
Included rules:
|
|
32
|
+
- `required`: Returns translated `%{fld_name} is required`.
|
|
33
|
+
- `numeric`: Returns translated `%{fld_name} should be numeric`.
|
|
34
|
+
- `email`: Returns translated `%{fld_name} not a valid email address`.
|
|
35
|
+
- `min`: Native min validation.
|
|
36
|
+
- `min_value`: Returns translated `%{fld_name} should be more than X`.
|
|
37
|
+
- `max`: Native max validation.
|
|
38
|
+
- `max_value`: Returns translated `%{fld_name} should be less than X`.
|
|
39
|
+
- `confirmed`: Checks password confirmation match.
|
|
40
|
+
- `url`: Validates URL format.
|
|
41
|
+
- `isUnique`: Custom stub for async uniqueness check.
|
|
42
|
+
- `isValid`: Custom stub for async validity check.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# useAlert (Composable)
|
|
2
|
+
|
|
3
|
+
Provides a procedural API to trigger modal alerts, notifications, and confirmations using the global `$alert` instance.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Ensure the library is installed:
|
|
8
|
+
|
|
9
|
+
```javascript
|
|
10
|
+
npm install @vue3-appsbd-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Import the composable in your `<script setup>` and call it. The `alert` function returns a Promise that resolves when the user dismisses or confirms the dialog.
|
|
16
|
+
|
|
17
|
+
```html
|
|
18
|
+
<script setup>
|
|
19
|
+
import { useAlert } from "@vue3-appsbd-ui";
|
|
20
|
+
|
|
21
|
+
const { alert } = useAlert();
|
|
22
|
+
|
|
23
|
+
async function handleAction() {
|
|
24
|
+
const result = await alert({
|
|
25
|
+
type: "confirm",
|
|
26
|
+
title: "Delete item?",
|
|
27
|
+
message: "Are you sure you want to delete this?",
|
|
28
|
+
icon: "warning",
|
|
29
|
+
confirmText: "Yes, delete",
|
|
30
|
+
cancelText: "Cancel"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (result) {
|
|
34
|
+
// User confirmed
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<template>
|
|
40
|
+
<button @click="handleAction">Delete</button>
|
|
41
|
+
</template>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## API Reference
|
|
45
|
+
|
|
46
|
+
### `alert(options)`
|
|
47
|
+
|
|
48
|
+
The `alert` method accepts an options object to configure the dialog.
|
|
49
|
+
|
|
50
|
+
**Options**
|
|
51
|
+
|
|
52
|
+
| Property | Type | Default | Description |
|
|
53
|
+
|---|---|---|---|
|
|
54
|
+
| `type` | `string` | `"alert"` | Variant: `"alert"`, `"confirm"`, or `"confirm-ajax"`. |
|
|
55
|
+
| `title` | `string` | - | Headline text for the dialog. |
|
|
56
|
+
| `message` | `string` | - | Detailed body text. |
|
|
57
|
+
| `icon` | `string` | - | Status icon: `"success"`, `"error"`, `"warning"`, `"info"`, `"question"`. |
|
|
58
|
+
| `variation` | `string` | `"default"` | Visual style: `"default"`, `"modern"`, `"minimal"`, `"top-color-bar"`. |
|
|
59
|
+
| `size` | `string` | `"md"` | Width limit: `"sm"`, `"md"`, `"lg"`, `"xl"`, `"auto"`. |
|
|
60
|
+
| `confirmText`| `string` | `"OK"` | Label for the primary accept button. |
|
|
61
|
+
| `cancelText` | `string` | `"Cancel"` | Label for the cancel/decline button. |
|
|
62
|
+
| `onConfirm` | `Function` | - | Async callback executed when accepting a `"confirm-ajax"` modal. |
|
|
63
|
+
| `timer` | `number` | - | Auto-close timer in milliseconds (only for `"alert"` type). |
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# useFileValidator (Composable)
|
|
2
|
+
|
|
3
|
+
Provides file validation utilities to check file extensions, MIME types, and file sizes. Automatically spawns error toasts if validation fails, and returns a structured file object with icon metadata for UI display.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
npm install @vue3-appsbd-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script setup>
|
|
15
|
+
import { useFileValidator } from "@vue3-appsbd-ui";
|
|
16
|
+
|
|
17
|
+
const { getFileInfo, getFileIconByExt } = useFileValidator();
|
|
18
|
+
|
|
19
|
+
function handleFileUpload(event) {
|
|
20
|
+
const file = event.target.files[0];
|
|
21
|
+
if (!file) return;
|
|
22
|
+
|
|
23
|
+
// Validates if file is <= 2.0 MB and is a supported type
|
|
24
|
+
const validatedFile = getFileInfo(file, 2.0);
|
|
25
|
+
|
|
26
|
+
if (validatedFile) {
|
|
27
|
+
console.log("File is valid!", validatedFile);
|
|
28
|
+
// validatedFile.isImage
|
|
29
|
+
// validatedFile.fileIcon
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<template>
|
|
35
|
+
<input type="file" @change="handleFileUpload" />
|
|
36
|
+
</template>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API Reference
|
|
40
|
+
|
|
41
|
+
### Returned Methods
|
|
42
|
+
|
|
43
|
+
| Method | Signature | Description |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `getFileInfo(file, sizeLimitMb)` | `Function` | Validates a `File` object against allowed MIME types and max size (`sizeLimitMb`, default `1.0`). If invalid, spawns a toast error and returns `null`. If valid, returns the `file` object augmented with `isImage` and `fileIcon` properties. |
|
|
46
|
+
| `getFileIconByExt(ext, type)` | `Function` | Returns an object `{ isImage: boolean, fileIcon: Component\|String }` based on the file extension and MIME type. Uses `lucide-vue-next` icons for known formats (pdf, zip, doc, xls, ppt, mp4). |
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# useResponsive (Composable)
|
|
2
|
+
|
|
3
|
+
A Vue 3 composable that tracks the browser viewport width in real-time and exposes reactive helpers for responsive layout decisions. Aligned with Bootstrap 5 breakpoints.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
npm install @vue3-appsbd-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script setup>
|
|
15
|
+
import { useResponsive } from "@vue3-appsbd-ui";
|
|
16
|
+
|
|
17
|
+
// Track screen size dynamically
|
|
18
|
+
const { ScreenWidth, ScreenType, isUptoTab } = useResponsive();
|
|
19
|
+
|
|
20
|
+
// Or provide a custom tablet max-width threshold in pixels
|
|
21
|
+
// const { isUptoTab } = useResponsive({ tabMaxWidth: 900 });
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<div>
|
|
26
|
+
<p>Current Width: {{ ScreenWidth }}px</p>
|
|
27
|
+
<p>Breakpoint: {{ ScreenType }}</p>
|
|
28
|
+
|
|
29
|
+
<div v-if="isUptoTab">
|
|
30
|
+
Showing Mobile / Tablet Layout
|
|
31
|
+
</div>
|
|
32
|
+
<div v-else>
|
|
33
|
+
Showing Desktop Layout
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## API Reference
|
|
40
|
+
|
|
41
|
+
### `useResponsive(options)`
|
|
42
|
+
|
|
43
|
+
**Options**
|
|
44
|
+
|
|
45
|
+
| Property | Type | Default | Description |
|
|
46
|
+
|---|---|---|---|
|
|
47
|
+
| `tabMaxWidth` | `number` | `0` | Custom max-width (px) to treat as "up-to tab". When `> 0`, screens at or below this width are considered tablet-sized regardless of breakpoint. |
|
|
48
|
+
|
|
49
|
+
**Returned Properties**
|
|
50
|
+
|
|
51
|
+
| Property | Type | Description |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `ScreenWidth` | `ComputedRef<number>` | Raw viewport width in pixels. |
|
|
54
|
+
| `ScreenType` | `ComputedRef<string>` | Current Bootstrap-style breakpoint (`'xs'`, `'sm'`, `'md'`, `'lg'`, `'xl'`, `'xxl'`). |
|
|
55
|
+
| `isUptoTab` | `ComputedRef<boolean>` | `true` when the viewport is tablet-sized or smaller (`xs`, `sm`, or `<=` `tabMaxWidth`). |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# useTheme (Composable)
|
|
2
|
+
|
|
3
|
+
A Vue composable that handles light and dark theme toggling, stores the user's preference in `localStorage`, and reacts to system theme changes (`prefers-color-scheme: dark`).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
npm install @vue3-appsbd-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script setup>
|
|
15
|
+
import { useTheme } from "@vue3-appsbd-ui";
|
|
16
|
+
|
|
17
|
+
const { theme, toggleTheme, applyTheme } = useTheme();
|
|
18
|
+
|
|
19
|
+
// Manually switch to 'dark' or 'light'
|
|
20
|
+
// applyTheme('dark');
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div>
|
|
25
|
+
<p>Current Theme: {{ theme }}</p>
|
|
26
|
+
<button @click="toggleTheme">Toggle Theme</button>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API Reference
|
|
32
|
+
|
|
33
|
+
### Returned Properties & Methods
|
|
34
|
+
|
|
35
|
+
| Name | Type | Description |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `theme` | `Ref<string>` | A reactive reference containing the current theme (`'light'` or `'dark'`). |
|
|
38
|
+
| `toggleTheme` | `Function` | Toggles the current theme between `'light'` and `'dark'`, updates the DOM (`data-bs-theme`), and saves to `localStorage`. |
|
|
39
|
+
| `applyTheme(value)` | `Function` | Explicitly sets the theme to the provided `value` (`'light'` or `'dark'`). |
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# useToast (Composable)
|
|
2
|
+
|
|
3
|
+
Provides a procedural API to spawn toast notifications using the globally registered `$toast` instance (usually powered by `vue-toastification`).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```javascript
|
|
8
|
+
npm install @vue3-appsbd-ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<script setup>
|
|
15
|
+
import { useToast } from "@vue3-appsbd-ui";
|
|
16
|
+
|
|
17
|
+
const { toast } = useToast();
|
|
18
|
+
|
|
19
|
+
function showNotifications() {
|
|
20
|
+
toast.success("Profile saved successfully");
|
|
21
|
+
toast.error("Failed to connect to server", { timeout: 5000 });
|
|
22
|
+
}
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<button @click="showNotifications">Show Toasts</button>
|
|
27
|
+
</template>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## API Reference
|
|
31
|
+
|
|
32
|
+
### `toast` Methods
|
|
33
|
+
|
|
34
|
+
| Method | Signature | Description |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `toast(msg, options)` | `Function` | Spawns a default toast notification. |
|
|
37
|
+
| `toast.success(msg, options)` | `Function` | Spawns a success toast notification. |
|
|
38
|
+
| `toast.error(msg, options)` | `Function` | Spawns an error toast notification. |
|
|
39
|
+
| `toast.warning(msg, options)` | `Function` | Spawns a warning toast notification. |
|
|
40
|
+
| `toast.info(msg, options)` | `Function` | Spawns an info toast notification. |
|
|
41
|
+
| `toast.dismiss(id)` | `Function` | Dismisses a specific toast by its ID. |
|
|
42
|
+
| `toast.clear()` | `Function` | Clears all currently visible toasts. |
|