@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/typography.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Schmancy Typography - AI Reference
|
|
2
|
+
|
|
3
|
+
```js
|
|
4
|
+
// Basic Typography
|
|
5
|
+
<schmancy-typography
|
|
6
|
+
variant="h1|h2|h3|h4|h5|h6|subtitle1|subtitle2|body1|body2|button|caption|overline"
|
|
7
|
+
color="primary|secondary|tertiary|error|text-primary|text-secondary|text-disabled"
|
|
8
|
+
align="left|center|right|justify"
|
|
9
|
+
weight="thin|light|regular|medium|bold"
|
|
10
|
+
transform="none|uppercase|lowercase|capitalize"
|
|
11
|
+
truncate?
|
|
12
|
+
no-wrap?
|
|
13
|
+
gutter-bottom?>
|
|
14
|
+
Text content goes here
|
|
15
|
+
</schmancy-typography>
|
|
16
|
+
|
|
17
|
+
// Typography heading variants
|
|
18
|
+
<schmancy-typography variant="h1">Heading 1</schmancy-typography>
|
|
19
|
+
<schmancy-typography variant="h2">Heading 2</schmancy-typography>
|
|
20
|
+
<schmancy-typography variant="h3">Heading 3</schmancy-typography>
|
|
21
|
+
<schmancy-typography variant="h4">Heading 4</schmancy-typography>
|
|
22
|
+
<schmancy-typography variant="h5">Heading 5</schmancy-typography>
|
|
23
|
+
<schmancy-typography variant="h6">Heading 6</schmancy-typography>
|
|
24
|
+
|
|
25
|
+
// Typography body variants
|
|
26
|
+
<schmancy-typography variant="subtitle1">Subtitle 1</schmancy-typography>
|
|
27
|
+
<schmancy-typography variant="subtitle2">Subtitle 2</schmancy-typography>
|
|
28
|
+
<schmancy-typography variant="body1">Body 1 text</schmancy-typography>
|
|
29
|
+
<schmancy-typography variant="body2">Body 2 text</schmancy-typography>
|
|
30
|
+
<schmancy-typography variant="button">Button text</schmancy-typography>
|
|
31
|
+
<schmancy-typography variant="caption">Caption text</schmancy-typography>
|
|
32
|
+
<schmancy-typography variant="overline">Overline text</schmancy-typography>
|
|
33
|
+
|
|
34
|
+
// Typography Properties
|
|
35
|
+
variant: string // Text style variant
|
|
36
|
+
color: string // Text color
|
|
37
|
+
align: string // Text alignment
|
|
38
|
+
weight: string // Font weight
|
|
39
|
+
transform: string // Text transformation
|
|
40
|
+
truncate: boolean // Truncate overflow with ellipsis
|
|
41
|
+
noWrap: boolean // Prevent text wrapping
|
|
42
|
+
gutterBottom: boolean // Add margin at the bottom
|
|
43
|
+
italic: boolean // Italic style
|
|
44
|
+
underline: boolean // Underline text
|
|
45
|
+
lineHeight: string // Line height
|
|
46
|
+
letterSpacing: string // Letter spacing
|
|
47
|
+
fontFamily: string // Font family
|
|
48
|
+
size: string // Custom font size (overrides variant)
|
|
49
|
+
responsive: boolean // Apply responsive sizing
|
|
50
|
+
|
|
51
|
+
// Examples
|
|
52
|
+
// Basic usage
|
|
53
|
+
<schmancy-typography variant="h2" color="primary">
|
|
54
|
+
Welcome to Our Application
|
|
55
|
+
</schmancy-typography>
|
|
56
|
+
|
|
57
|
+
<schmancy-typography variant="body1">
|
|
58
|
+
This is a paragraph of text that demonstrates the body1 typography variant.
|
|
59
|
+
It's commonly used for the main content text on a page.
|
|
60
|
+
</schmancy-typography>
|
|
61
|
+
|
|
62
|
+
// Styled text
|
|
63
|
+
<schmancy-typography
|
|
64
|
+
variant="subtitle1"
|
|
65
|
+
weight="bold"
|
|
66
|
+
color="secondary"
|
|
67
|
+
transform="uppercase">
|
|
68
|
+
Important Notice
|
|
69
|
+
</schmancy-typography>
|
|
70
|
+
|
|
71
|
+
// Truncated text
|
|
72
|
+
<schmancy-typography
|
|
73
|
+
variant="body2"
|
|
74
|
+
truncate
|
|
75
|
+
style="max-width: 200px;">
|
|
76
|
+
This is a very long text that will be truncated with an ellipsis when it exceeds the container width.
|
|
77
|
+
</schmancy-typography>
|
|
78
|
+
|
|
79
|
+
// Responsive headings
|
|
80
|
+
<schmancy-typography
|
|
81
|
+
variant="h1"
|
|
82
|
+
responsive
|
|
83
|
+
align="center"
|
|
84
|
+
gutter-bottom>
|
|
85
|
+
Responsive Heading
|
|
86
|
+
</schmancy-typography>
|
|
87
|
+
|
|
88
|
+
// Text with custom styling
|
|
89
|
+
<schmancy-typography
|
|
90
|
+
variant="body1"
|
|
91
|
+
italic
|
|
92
|
+
letter-spacing="0.5px"
|
|
93
|
+
line-height="1.8">
|
|
94
|
+
This text has custom letter spacing and line height, with italic styling.
|
|
95
|
+
</schmancy-typography>
|
|
96
|
+
|
|
97
|
+
// Text with different weights
|
|
98
|
+
<div>
|
|
99
|
+
<schmancy-typography variant="body1" weight="thin">
|
|
100
|
+
This text has thin weight.
|
|
101
|
+
</schmancy-typography>
|
|
102
|
+
|
|
103
|
+
<schmancy-typography variant="body1" weight="light">
|
|
104
|
+
This text has light weight.
|
|
105
|
+
</schmancy-typography>
|
|
106
|
+
|
|
107
|
+
<schmancy-typography variant="body1" weight="regular">
|
|
108
|
+
This text has regular weight.
|
|
109
|
+
</schmancy-typography>
|
|
110
|
+
|
|
111
|
+
<schmancy-typography variant="body1" weight="medium">
|
|
112
|
+
This text has medium weight.
|
|
113
|
+
</schmancy-typography>
|
|
114
|
+
|
|
115
|
+
<schmancy-typography variant="body1" weight="bold">
|
|
116
|
+
This text has bold weight.
|
|
117
|
+
</schmancy-typography>
|
|
118
|
+
</div>
|
|
119
|
+
|
|
120
|
+
// Typography in a card
|
|
121
|
+
<schmancy-card>
|
|
122
|
+
<schmancy-card-content>
|
|
123
|
+
<schmancy-typography variant="h4" gutter-bottom>
|
|
124
|
+
Card Title
|
|
125
|
+
</schmancy-typography>
|
|
126
|
+
|
|
127
|
+
<schmancy-typography variant="body2" color="text-secondary" gutter-bottom>
|
|
128
|
+
Posted on January 1, 2023
|
|
129
|
+
</schmancy-typography>
|
|
130
|
+
|
|
131
|
+
<schmancy-typography variant="body1">
|
|
132
|
+
This is the main content of the card. It uses the body1 typography variant
|
|
133
|
+
which is suitable for longer text content.
|
|
134
|
+
</schmancy-typography>
|
|
135
|
+
</schmancy-card-content>
|
|
136
|
+
|
|
137
|
+
<schmancy-card-actions>
|
|
138
|
+
<schmancy-button>
|
|
139
|
+
<schmancy-typography variant="button">
|
|
140
|
+
Read More
|
|
141
|
+
</schmancy-typography>
|
|
142
|
+
</schmancy-button>
|
|
143
|
+
</schmancy-card-actions>
|
|
144
|
+
</schmancy-card>
|
|
145
|
+
|
|
146
|
+
// Error message
|
|
147
|
+
<schmancy-typography
|
|
148
|
+
variant="body2"
|
|
149
|
+
color="error"
|
|
150
|
+
gutter-bottom>
|
|
151
|
+
The username or password you entered is incorrect.
|
|
152
|
+
</schmancy-typography>
|
|
153
|
+
|
|
154
|
+
// Caption with custom size
|
|
155
|
+
<schmancy-typography
|
|
156
|
+
variant="caption"
|
|
157
|
+
color="text-secondary"
|
|
158
|
+
size="10px">
|
|
159
|
+
* Terms and conditions apply
|
|
160
|
+
</schmancy-typography>
|
|
161
|
+
|
|
162
|
+
// Paragraph with custom font family
|
|
163
|
+
<schmancy-typography
|
|
164
|
+
variant="body1"
|
|
165
|
+
font-family="'Georgia', serif"
|
|
166
|
+
line-height="1.7">
|
|
167
|
+
This paragraph uses a serif font for a more traditional typographic style.
|
|
168
|
+
Custom font families can be specified when needed for special sections.
|
|
169
|
+
</schmancy-typography>
|
|
170
|
+
```
|
package/dist/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
|
+
```
|
|
@@ -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
|
+
```
|