@mhmo91/schmancy 0.2.193 → 0.2.194
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/area.md +125 -0
- package/ai/autocomplete.md +135 -0
- package/ai/avatar.md +178 -0
- package/ai/badge.md +100 -0
- package/ai/busy.md +195 -0
- package/ai/button.md +112 -0
- package/ai/card.md +155 -0
- package/ai/checkbox.md +108 -0
- package/ai/chips.md +180 -0
- package/ai/component-relationships.md +93 -0
- package/ai/dialog.md +109 -0
- package/ai/dropdown.md +238 -0
- package/ai/form.md +148 -0
- package/ai/icons.md +147 -0
- package/ai/index.md +71 -0
- package/ai/input.md +167 -0
- package/ai/layout.md +166 -0
- package/ai/list.md +145 -0
- package/ai/menu.md +217 -0
- package/ai/notification.md +93 -0
- package/ai/radio-group.md +176 -0
- package/ai/select.md +174 -0
- package/ai/sheet.md +122 -0
- package/ai/store.md +235 -0
- package/ai/surface.md +221 -0
- package/ai/table.md +236 -0
- package/ai/tabs.md +71 -0
- package/ai/template.md +144 -0
- package/ai/textarea.md +147 -0
- package/ai/tooltip.md +149 -0
- package/ai/tree.md +279 -0
- package/ai/typography.md +170 -0
- package/dist/ai/area.md +125 -0
- package/dist/ai/autocomplete.md +135 -0
- package/dist/ai/avatar.md +178 -0
- package/dist/ai/badge.md +100 -0
- package/dist/ai/busy.md +195 -0
- package/dist/ai/button.md +112 -0
- package/dist/ai/card.md +155 -0
- package/dist/ai/checkbox.md +108 -0
- package/dist/ai/chips.md +180 -0
- package/dist/ai/component-relationships.md +93 -0
- package/dist/ai/dialog.md +109 -0
- package/dist/ai/dropdown.md +238 -0
- package/dist/ai/form.md +148 -0
- package/dist/ai/icons.md +147 -0
- package/dist/ai/index.md +71 -0
- package/dist/ai/input.md +167 -0
- package/dist/ai/layout.md +166 -0
- package/dist/ai/list.md +145 -0
- package/dist/ai/menu.md +217 -0
- package/dist/ai/notification.md +93 -0
- package/dist/ai/radio-group.md +176 -0
- package/dist/ai/select.md +174 -0
- package/dist/ai/sheet.md +122 -0
- package/dist/ai/store.md +235 -0
- package/dist/ai/surface.md +221 -0
- package/dist/ai/table.md +236 -0
- package/dist/ai/tabs.md +71 -0
- package/dist/ai/template.md +144 -0
- package/dist/ai/textarea.md +147 -0
- package/dist/ai/tooltip.md +149 -0
- package/dist/ai/tree.md +279 -0
- package/dist/ai/typography.md +170 -0
- package/dist/area.cjs +1 -1
- package/dist/area.component-CzFJM7Y4.js +143 -0
- package/dist/area.component-CzFJM7Y4.js.map +1 -0
- package/dist/area.component-WxccFh1z.cjs +8 -0
- package/dist/area.component-WxccFh1z.cjs.map +1 -0
- package/dist/area.js +1 -1
- package/dist/{avatar-s-2jSsaH.cjs → avatar-Bmg5TXj9.cjs} +2 -2
- package/dist/{avatar-s-2jSsaH.cjs.map → avatar-Bmg5TXj9.cjs.map} +1 -1
- package/dist/{avatar-WAIlaNJg.js → avatar-CgP1tBZq.js} +2 -2
- package/dist/{avatar-WAIlaNJg.js.map → avatar-CgP1tBZq.js.map} +1 -1
- package/dist/badge.cjs +1 -1
- package/dist/badge.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.js +1 -1
- package/dist/content-drawer.cjs +1 -1
- package/dist/content-drawer.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/dist/nav-drawer.cjs +1 -1
- package/dist/nav-drawer.js +1 -1
- package/dist/teleport.cjs +1 -1
- package/dist/teleport.js +1 -1
- package/package.json +2 -1
- package/types/src/area/area.service.d.ts +53 -4
- package/types/src/area/router.types.d.ts +41 -2
- package/dist/area.component-CZELEuMj.js +0 -107
- package/dist/area.component-CZELEuMj.js.map +0 -1
- package/dist/area.component-grRkXEse.cjs +0 -8
- package/dist/area.component-grRkXEse.cjs.map +0 -1
package/ai/area.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Schmancy Area - AI Reference
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
// Area Router Component
|
|
5
|
+
<schmancy-area
|
|
6
|
+
name="root"
|
|
7
|
+
default="home-component">
|
|
8
|
+
</schmancy-area>
|
|
9
|
+
|
|
10
|
+
// Area Service
|
|
11
|
+
import { area } from '@schmancy/area';
|
|
12
|
+
|
|
13
|
+
// Navigation methods
|
|
14
|
+
area.push({
|
|
15
|
+
component: UserProfileComponent, // Component constructor, string tag name, or element instance
|
|
16
|
+
area: 'root', // Target area name
|
|
17
|
+
state?: { view: 'profile' }, // Optional state object
|
|
18
|
+
params?: { id: '123' }, // Optional parameters
|
|
19
|
+
historyStrategy: 'push' // 'push', 'replace', 'pop', 'silent'
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
area.pop('sidebar'); // Remove an area
|
|
23
|
+
|
|
24
|
+
// Subscription methods
|
|
25
|
+
area.on(areaName, skipCurrent?) -> Observable<ActiveRoute>
|
|
26
|
+
area.all(skipCurrent?) -> Observable<Map<string, ActiveRoute>>
|
|
27
|
+
area.getState<T>(areaName) -> Observable<T>
|
|
28
|
+
area.params<T>(areaName) -> Observable<T>
|
|
29
|
+
area.param<T>(areaName, key) -> Observable<T>
|
|
30
|
+
|
|
31
|
+
// Event name format for DOM event listeners
|
|
32
|
+
schmancy-area-${areaName}-changed
|
|
33
|
+
|
|
34
|
+
// Examples
|
|
35
|
+
// 1. Basic navigation
|
|
36
|
+
area.push({
|
|
37
|
+
component: 'home-page',
|
|
38
|
+
area: 'main',
|
|
39
|
+
historyStrategy: 'push'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// 2. Navigation with params
|
|
43
|
+
area.push({
|
|
44
|
+
component: ProductDetailComponent,
|
|
45
|
+
area: 'main',
|
|
46
|
+
params: { productId: '12345' },
|
|
47
|
+
historyStrategy: 'push'
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// 3. Subscribe to an area
|
|
51
|
+
area.on('main').subscribe(route => {
|
|
52
|
+
console.log(`Component: ${route.component}, Params: ${route.params}`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// 4. Get and react to a specific param
|
|
56
|
+
area.param<string>('product', 'productId').subscribe(id => {
|
|
57
|
+
fetchProductDetails(id);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// 5. DOM event listening (non-RxJS approach)
|
|
61
|
+
window.addEventListener('schmancy-area-main-changed', event => {
|
|
62
|
+
const { component, params } = event.detail;
|
|
63
|
+
updateUI(component, params);
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Related Components
|
|
68
|
+
- **[Teleport](./teleport.md)**: Can be used with Area for advanced component transportation
|
|
69
|
+
- **[Store](./store.md)**: Complements Area for more complex state management
|
|
70
|
+
- **[Layout](./layout.md)**: Often used as a container for areas
|
|
71
|
+
|
|
72
|
+
## Technical Details
|
|
73
|
+
|
|
74
|
+
### ActiveRoute Interface
|
|
75
|
+
```typescript
|
|
76
|
+
interface ActiveRoute {
|
|
77
|
+
component: string; // Component tag name
|
|
78
|
+
area: string; // Area name
|
|
79
|
+
state?: Record<string, unknown>; // Optional state
|
|
80
|
+
params?: Record<string, unknown>; // Optional parameters
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### RouteAction Interface
|
|
85
|
+
```typescript
|
|
86
|
+
interface RouteAction {
|
|
87
|
+
component: CustomElementConstructor | string | HTMLElement;
|
|
88
|
+
area: string;
|
|
89
|
+
state?: Record<string, unknown>;
|
|
90
|
+
params?: Record<string, unknown>;
|
|
91
|
+
historyStrategy?: 'push' | 'replace' | 'pop' | 'silent';
|
|
92
|
+
clearQueryParams?: string[] | null;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Common Use Cases
|
|
97
|
+
|
|
98
|
+
1. **Single Page Applications**: Define multiple areas for different sections of your app
|
|
99
|
+
```html
|
|
100
|
+
<schmancy-area name="main"></schmancy-area>
|
|
101
|
+
<schmancy-area name="sidebar"></schmancy-area>
|
|
102
|
+
<schmancy-area name="modal"></schmancy-area>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
2. **Typed Params and State**: Use TypeScript generics for type safety
|
|
106
|
+
```typescript
|
|
107
|
+
interface UserParams { id: string; tab?: string; }
|
|
108
|
+
area.params<UserParams>('user').subscribe(params => {
|
|
109
|
+
fetchUser(params.id);
|
|
110
|
+
setActiveTab(params.tab || 'profile');
|
|
111
|
+
});
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
3. **Navigation Guards**: Implement navigation guards with RxJS operators
|
|
115
|
+
```typescript
|
|
116
|
+
area.on('protected').pipe(
|
|
117
|
+
switchMap(route => {
|
|
118
|
+
if (!isAuthenticated()) {
|
|
119
|
+
area.push({ component: 'login-page', area: 'main' });
|
|
120
|
+
return EMPTY;
|
|
121
|
+
}
|
|
122
|
+
return of(route);
|
|
123
|
+
})
|
|
124
|
+
).subscribe(handleProtectedRoute);
|
|
125
|
+
```
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Schmancy Autocomplete - AI Reference
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
// Basic Autocomplete (Single-Select)
|
|
5
|
+
<schmancy-autocomplete
|
|
6
|
+
label="Select an option"
|
|
7
|
+
placeholder="Type to search..."
|
|
8
|
+
value="selected-value"
|
|
9
|
+
size="sm|md|lg"
|
|
10
|
+
required?
|
|
11
|
+
maxHeight="300px"
|
|
12
|
+
@change=${handleChange}>
|
|
13
|
+
|
|
14
|
+
<schmancy-option value="option1" label="Option 1"></schmancy-option>
|
|
15
|
+
<schmancy-option value="option2" label="Option 2"></schmancy-option>
|
|
16
|
+
<schmancy-option value="option3" label="Option 3"></schmancy-option>
|
|
17
|
+
</schmancy-autocomplete>
|
|
18
|
+
|
|
19
|
+
// Multi-Select Autocomplete
|
|
20
|
+
<schmancy-autocomplete
|
|
21
|
+
label="Select multiple options"
|
|
22
|
+
placeholder="Type to search..."
|
|
23
|
+
multi
|
|
24
|
+
.values=${['option1', 'option3']} // Array of selected values (preferred for multi-select)
|
|
25
|
+
@change=${handleMultiChange}>
|
|
26
|
+
|
|
27
|
+
<schmancy-option value="option1" label="Option 1"></schmancy-option>
|
|
28
|
+
<schmancy-option value="option2" label="Option 2"></schmancy-option>
|
|
29
|
+
<schmancy-option value="option3" label="Option 3"></schmancy-option>
|
|
30
|
+
</schmancy-autocomplete>
|
|
31
|
+
|
|
32
|
+
// Autocomplete with Custom Trigger
|
|
33
|
+
<schmancy-autocomplete>
|
|
34
|
+
<button slot="trigger">Open Options</button>
|
|
35
|
+
|
|
36
|
+
<schmancy-option value="option1" label="Option 1"></schmancy-option>
|
|
37
|
+
<schmancy-option value="option2" label="Option 2"></schmancy-option>
|
|
38
|
+
</schmancy-autocomplete>
|
|
39
|
+
|
|
40
|
+
// Autocomplete Properties
|
|
41
|
+
value: string // Selected value for single-select, comma-separated string for multi-select (legacy API)
|
|
42
|
+
values: string[] // Array of selected values for multi-select (preferred API for multi-select)
|
|
43
|
+
multi: boolean // Enable multi-select mode
|
|
44
|
+
label: string // Input label
|
|
45
|
+
placeholder: string // Input placeholder
|
|
46
|
+
required: boolean // Mark as required for validation
|
|
47
|
+
size: string // Input size: "sm", "md", "lg"
|
|
48
|
+
maxHeight: string // Maximum height of dropdown
|
|
49
|
+
debounceMs: number // Debounce delay in milliseconds for filtering
|
|
50
|
+
autocomplete: string // Value for input's autocomplete attribute
|
|
51
|
+
description: string // Description for screen readers
|
|
52
|
+
|
|
53
|
+
// Autocomplete Events
|
|
54
|
+
@change // Fires when selection changes with { detail: { value, values? } }
|
|
55
|
+
|
|
56
|
+
// Autocomplete Methods
|
|
57
|
+
checkValidity() -> boolean // Check if the input is valid
|
|
58
|
+
reportValidity() -> boolean // Show validation state and return validity
|
|
59
|
+
|
|
60
|
+
// Examples
|
|
61
|
+
// Basic usage
|
|
62
|
+
<schmancy-autocomplete
|
|
63
|
+
label="Country"
|
|
64
|
+
placeholder="Select country"
|
|
65
|
+
@change=${(e) => selectedCountry = e.detail.value}>
|
|
66
|
+
|
|
67
|
+
<schmancy-option value="us" label="United States"></schmancy-option>
|
|
68
|
+
<schmancy-option value="ca" label="Canada"></schmancy-option>
|
|
69
|
+
<schmancy-option value="mx" label="Mexico"></schmancy-option>
|
|
70
|
+
<schmancy-option value="fr" label="France"></schmancy-option>
|
|
71
|
+
<schmancy-option value="de" label="Germany"></schmancy-option>
|
|
72
|
+
</schmancy-autocomplete>
|
|
73
|
+
|
|
74
|
+
// Multi-select with preferred API
|
|
75
|
+
<schmancy-autocomplete
|
|
76
|
+
label="Programming Languages"
|
|
77
|
+
placeholder="Select languages"
|
|
78
|
+
multi
|
|
79
|
+
.values=${selectedLanguages}
|
|
80
|
+
@change=${(e) => {
|
|
81
|
+
selectedLanguages = e.detail.values; // Use the new values array property
|
|
82
|
+
}}>
|
|
83
|
+
|
|
84
|
+
<schmancy-option value="js" label="JavaScript"></schmancy-option>
|
|
85
|
+
<schmancy-option value="ts" label="TypeScript"></schmancy-option>
|
|
86
|
+
<schmancy-option value="py" label="Python"></schmancy-option>
|
|
87
|
+
<schmancy-option value="java" label="Java"></schmancy-option>
|
|
88
|
+
<schmancy-option value="go" label="Go"></schmancy-option>
|
|
89
|
+
</schmancy-autocomplete>
|
|
90
|
+
|
|
91
|
+
// Handling the change event
|
|
92
|
+
handleChange(e) {
|
|
93
|
+
if (e.target.multi) {
|
|
94
|
+
const selectedValues = e.detail.values; // Array of values (preferred)
|
|
95
|
+
const legacyValue = e.detail.value; // Comma-separated string (legacy)
|
|
96
|
+
console.log('Selected:', selectedValues);
|
|
97
|
+
} else {
|
|
98
|
+
const selectedValue = e.detail.value; // Single value
|
|
99
|
+
console.log('Selected:', selectedValue);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Dynamic options from data
|
|
104
|
+
<schmancy-autocomplete
|
|
105
|
+
label="Select Item"
|
|
106
|
+
.value=${selectedItem}>
|
|
107
|
+
|
|
108
|
+
${items.map(item => html`
|
|
109
|
+
<schmancy-option
|
|
110
|
+
value=${item.id}
|
|
111
|
+
label=${item.name}>
|
|
112
|
+
</schmancy-option>
|
|
113
|
+
`)}
|
|
114
|
+
</schmancy-autocomplete>
|
|
115
|
+
|
|
116
|
+
// In a form
|
|
117
|
+
<schmancy-form @submit=${handleSubmit}>
|
|
118
|
+
<schmancy-input
|
|
119
|
+
name="name"
|
|
120
|
+
label="Name"
|
|
121
|
+
required>
|
|
122
|
+
</schmancy-input>
|
|
123
|
+
|
|
124
|
+
<schmancy-autocomplete
|
|
125
|
+
name="department"
|
|
126
|
+
label="Department"
|
|
127
|
+
required>
|
|
128
|
+
<schmancy-option value="hr" label="Human Resources"></schmancy-option>
|
|
129
|
+
<schmancy-option value="eng" label="Engineering"></schmancy-option>
|
|
130
|
+
<schmancy-option value="fin" label="Finance"></schmancy-option>
|
|
131
|
+
</schmancy-autocomplete>
|
|
132
|
+
|
|
133
|
+
<schmancy-button type="submit">Submit</schmancy-button>
|
|
134
|
+
</schmancy-form>
|
|
135
|
+
```
|
package/ai/avatar.md
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Schmancy Avatar - AI Reference
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
// Basic Avatar
|
|
5
|
+
<schmancy-avatar
|
|
6
|
+
src="path/to/image.jpg"
|
|
7
|
+
alt="User Name"
|
|
8
|
+
size="x-small|small|medium|large|x-large">
|
|
9
|
+
</schmancy-avatar>
|
|
10
|
+
|
|
11
|
+
// Avatar with name initials
|
|
12
|
+
<schmancy-avatar
|
|
13
|
+
name="John Doe"
|
|
14
|
+
size="medium">
|
|
15
|
+
</schmancy-avatar>
|
|
16
|
+
|
|
17
|
+
// Avatar with icon
|
|
18
|
+
<schmancy-avatar
|
|
19
|
+
icon="user"
|
|
20
|
+
size="medium">
|
|
21
|
+
</schmancy-avatar>
|
|
22
|
+
|
|
23
|
+
// Avatar with custom size and color
|
|
24
|
+
<schmancy-avatar
|
|
25
|
+
name="John Doe"
|
|
26
|
+
size="48px"
|
|
27
|
+
background-color="#6200ee"
|
|
28
|
+
color="white">
|
|
29
|
+
</schmancy-avatar>
|
|
30
|
+
|
|
31
|
+
// Avatar with shape
|
|
32
|
+
<schmancy-avatar
|
|
33
|
+
src="path/to/image.jpg"
|
|
34
|
+
shape="circle|square|rounded">
|
|
35
|
+
</schmancy-avatar>
|
|
36
|
+
|
|
37
|
+
// Avatar Properties
|
|
38
|
+
src: string // Image URL
|
|
39
|
+
alt: string // Alt text for the image
|
|
40
|
+
name: string // Name for generating initials
|
|
41
|
+
icon: string // Icon name to display (if no src or name)
|
|
42
|
+
size: string // Size: "x-small" (24px), "small" (32px), "medium" (40px), "large" (48px), "x-large" (56px), or custom size
|
|
43
|
+
shape: string // Shape: "circle" (default), "square", "rounded"
|
|
44
|
+
backgroundColor: string // Background color for name and icon avatars
|
|
45
|
+
color: string // Text/icon color
|
|
46
|
+
bordered: boolean // Show border
|
|
47
|
+
badgeContent: string // Content for the badge
|
|
48
|
+
badgeColor: string // Color for the badge
|
|
49
|
+
fallback: string // Fallback content if image fails to load
|
|
50
|
+
clickable: boolean // Make avatar clickable with hover effect
|
|
51
|
+
|
|
52
|
+
// Avatar Events
|
|
53
|
+
@click // Fires when avatar is clicked
|
|
54
|
+
@error // Fires when image fails to load
|
|
55
|
+
|
|
56
|
+
// Examples
|
|
57
|
+
// Basic image avatar
|
|
58
|
+
<schmancy-avatar
|
|
59
|
+
src="https://example.com/avatar.jpg"
|
|
60
|
+
alt="Jane Smith"
|
|
61
|
+
size="medium">
|
|
62
|
+
</schmancy-avatar>
|
|
63
|
+
|
|
64
|
+
// Name initials avatar
|
|
65
|
+
<schmancy-avatar
|
|
66
|
+
name="John Doe"
|
|
67
|
+
size="large">
|
|
68
|
+
</schmancy-avatar>
|
|
69
|
+
|
|
70
|
+
// Icon avatar
|
|
71
|
+
<schmancy-avatar
|
|
72
|
+
icon="user"
|
|
73
|
+
size="medium"
|
|
74
|
+
background-color="var(--color-primary)"
|
|
75
|
+
color="white">
|
|
76
|
+
</schmancy-avatar>
|
|
77
|
+
|
|
78
|
+
// Avatar with badge
|
|
79
|
+
<schmancy-avatar
|
|
80
|
+
src="https://example.com/avatar.jpg"
|
|
81
|
+
badge-content="3"
|
|
82
|
+
badge-color="error">
|
|
83
|
+
</schmancy-avatar>
|
|
84
|
+
|
|
85
|
+
// Avatar with status indicator
|
|
86
|
+
<div style="position: relative;">
|
|
87
|
+
<schmancy-avatar
|
|
88
|
+
name="Jane Smith"
|
|
89
|
+
size="large">
|
|
90
|
+
</schmancy-avatar>
|
|
91
|
+
|
|
92
|
+
<schmancy-badge
|
|
93
|
+
dot
|
|
94
|
+
variant="success"
|
|
95
|
+
style="position: absolute; bottom: 0; right: 0; border: 2px solid white;">
|
|
96
|
+
</schmancy-badge>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
// Avatar group
|
|
100
|
+
<div style="display: flex;">
|
|
101
|
+
<schmancy-avatar
|
|
102
|
+
src="https://example.com/avatar1.jpg"
|
|
103
|
+
size="medium"
|
|
104
|
+
style="margin-right: -8px; border: 2px solid white;">
|
|
105
|
+
</schmancy-avatar>
|
|
106
|
+
|
|
107
|
+
<schmancy-avatar
|
|
108
|
+
src="https://example.com/avatar2.jpg"
|
|
109
|
+
size="medium"
|
|
110
|
+
style="margin-right: -8px; border: 2px solid white;">
|
|
111
|
+
</schmancy-avatar>
|
|
112
|
+
|
|
113
|
+
<schmancy-avatar
|
|
114
|
+
src="https://example.com/avatar3.jpg"
|
|
115
|
+
size="medium"
|
|
116
|
+
style="margin-right: -8px; border: 2px solid white;">
|
|
117
|
+
</schmancy-avatar>
|
|
118
|
+
|
|
119
|
+
<schmancy-avatar
|
|
120
|
+
name="+5"
|
|
121
|
+
size="medium"
|
|
122
|
+
background-color="#e0e0e0"
|
|
123
|
+
color="#757575"
|
|
124
|
+
style="border: 2px solid white;">
|
|
125
|
+
</schmancy-avatar>
|
|
126
|
+
</div>
|
|
127
|
+
|
|
128
|
+
// Clickable avatar for profile
|
|
129
|
+
<schmancy-avatar
|
|
130
|
+
src="https://example.com/avatar.jpg"
|
|
131
|
+
size="large"
|
|
132
|
+
clickable
|
|
133
|
+
@click=${openProfile}>
|
|
134
|
+
</schmancy-avatar>
|
|
135
|
+
|
|
136
|
+
// Avatar with fallback
|
|
137
|
+
<schmancy-avatar
|
|
138
|
+
src="https://example.com/avatar.jpg"
|
|
139
|
+
name="John Doe"
|
|
140
|
+
fallback="JD"
|
|
141
|
+
@error=${handleImageError}>
|
|
142
|
+
</schmancy-avatar>
|
|
143
|
+
|
|
144
|
+
// Square avatar
|
|
145
|
+
<schmancy-avatar
|
|
146
|
+
src="https://example.com/avatar.jpg"
|
|
147
|
+
shape="square"
|
|
148
|
+
size="large">
|
|
149
|
+
</schmancy-avatar>
|
|
150
|
+
|
|
151
|
+
// Avatar in a list item
|
|
152
|
+
<schmancy-list-item>
|
|
153
|
+
<schmancy-avatar
|
|
154
|
+
slot="start"
|
|
155
|
+
src="https://example.com/avatar.jpg"
|
|
156
|
+
size="medium">
|
|
157
|
+
</schmancy-avatar>
|
|
158
|
+
|
|
159
|
+
<div slot="main">
|
|
160
|
+
<div>John Doe</div>
|
|
161
|
+
<div>Software Engineer</div>
|
|
162
|
+
</div>
|
|
163
|
+
</schmancy-list-item>
|
|
164
|
+
|
|
165
|
+
// Avatar in a chat message
|
|
166
|
+
<div style="display: flex; margin-bottom: 16px;">
|
|
167
|
+
<schmancy-avatar
|
|
168
|
+
src="https://example.com/avatar.jpg"
|
|
169
|
+
size="small"
|
|
170
|
+
style="margin-right: 8px;">
|
|
171
|
+
</schmancy-avatar>
|
|
172
|
+
|
|
173
|
+
<div>
|
|
174
|
+
<div><strong>Jane Smith</strong> <span style="color: #757575;">12:34 PM</span></div>
|
|
175
|
+
<div>Hello! How are you doing today?</div>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
```
|
package/ai/badge.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Schmancy Badge - AI Reference
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
// Basic Badge
|
|
5
|
+
<schmancy-badge>
|
|
6
|
+
42
|
|
7
|
+
</schmancy-badge>
|
|
8
|
+
|
|
9
|
+
// Badge with variants
|
|
10
|
+
<schmancy-badge
|
|
11
|
+
variant="primary|secondary|success|warning|danger|info"
|
|
12
|
+
size="small|medium|large"
|
|
13
|
+
shape="square|pill|circle">
|
|
14
|
+
New
|
|
15
|
+
</schmancy-badge>
|
|
16
|
+
|
|
17
|
+
// Badge with icon
|
|
18
|
+
<schmancy-badge variant="warning">
|
|
19
|
+
<schmancy-icon icon="warning"></schmancy-icon>
|
|
20
|
+
Caution
|
|
21
|
+
</schmancy-badge>
|
|
22
|
+
|
|
23
|
+
// Dot badge
|
|
24
|
+
<schmancy-badge dot variant="danger"></schmancy-badge>
|
|
25
|
+
|
|
26
|
+
// Badge on other elements
|
|
27
|
+
<div style="position: relative;">
|
|
28
|
+
<schmancy-icon icon="notifications"></schmancy-icon>
|
|
29
|
+
<schmancy-badge
|
|
30
|
+
position="top-right"
|
|
31
|
+
value="5">
|
|
32
|
+
</schmancy-badge>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
// Badge Properties
|
|
36
|
+
variant: string // Visual style: "primary", "secondary", "success", "warning", "danger", "info"
|
|
37
|
+
size: string // Size: "small", "medium", "large"
|
|
38
|
+
shape: string // Shape: "square", "pill", "circle"
|
|
39
|
+
dot: boolean // Show as a dot instead of with content
|
|
40
|
+
position: string // Positioning: "top-right", "top-left", "bottom-right", "bottom-left"
|
|
41
|
+
value: string|number // Value to display (alternative to slot content)
|
|
42
|
+
max: number // Maximum value to display before showing "+"
|
|
43
|
+
invisible: boolean // Hide the badge while maintaining layout
|
|
44
|
+
|
|
45
|
+
// Examples
|
|
46
|
+
// Simple numeric badge
|
|
47
|
+
<schmancy-badge>10</schmancy-badge>
|
|
48
|
+
|
|
49
|
+
// Styled text badge
|
|
50
|
+
<schmancy-badge variant="success" shape="pill">
|
|
51
|
+
Completed
|
|
52
|
+
</schmancy-badge>
|
|
53
|
+
|
|
54
|
+
// Status badges
|
|
55
|
+
<div>
|
|
56
|
+
<schmancy-badge variant="success">Active</schmancy-badge>
|
|
57
|
+
<schmancy-badge variant="warning">Pending</schmancy-badge>
|
|
58
|
+
<schmancy-badge variant="danger">Failed</schmancy-badge>
|
|
59
|
+
<schmancy-badge variant="info">Draft</schmancy-badge>
|
|
60
|
+
</div>
|
|
61
|
+
|
|
62
|
+
// Badge on a button
|
|
63
|
+
<schmancy-button>
|
|
64
|
+
Notifications
|
|
65
|
+
<schmancy-badge
|
|
66
|
+
position="top-right"
|
|
67
|
+
variant="danger"
|
|
68
|
+
value="99+">
|
|
69
|
+
</schmancy-badge>
|
|
70
|
+
</schmancy-button>
|
|
71
|
+
|
|
72
|
+
// Badge with maximum value
|
|
73
|
+
<schmancy-badge
|
|
74
|
+
value="125"
|
|
75
|
+
max="99">
|
|
76
|
+
</schmancy-badge>
|
|
77
|
+
// Shows "99+"
|
|
78
|
+
|
|
79
|
+
// Dot indicators for status
|
|
80
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
81
|
+
<schmancy-badge dot variant="success"></schmancy-badge>
|
|
82
|
+
<span>Online</span>
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
86
|
+
<schmancy-badge dot variant="warning"></schmancy-badge>
|
|
87
|
+
<span>Away</span>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
91
|
+
<schmancy-badge dot variant="danger"></schmancy-badge>
|
|
92
|
+
<span>Offline</span>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
// Badge with dynamic content
|
|
96
|
+
<schmancy-badge
|
|
97
|
+
variant=${status === 'active' ? 'success' : 'warning'}
|
|
98
|
+
value=${count}>
|
|
99
|
+
</schmancy-badge>
|
|
100
|
+
```
|