@ticatec/uniface-element 0.2.0 → 0.2.1
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 +273 -1
- package/README_CN.md +341 -0
- package/dist/common/MouseClickHandler.d.ts +1 -1
- package/dist/dialog/CommonDialog.svelte +6 -3
- package/dist/dialog/CommonDialog.svelte.d.ts +2 -1
- package/dist/dialog/Dialog.svelte +36 -10
- package/dist/dialog/Dialog.svelte.d.ts +4 -3
- package/dist/dialog/DialogBoard.svelte +11 -8
- package/dist/dialog/DialogWrapper.svelte +10 -0
- package/dist/dialog/DialogWrapper.svelte.d.ts +22 -0
- package/dist/dialog/Dialogs.js +1 -1
- package/dist/dialog/ModalResult.d.ts +5 -0
- package/dist/dialog/ModalResult.js +5 -0
- package/docs/buttons/cn/ActionBar.md +459 -0
- package/docs/buttons/cn/Button.md +228 -0
- package/docs/buttons/cn/IconButton.md +294 -0
- package/docs/buttons/cn/README.md +600 -0
- package/docs/buttons/cn/TextButton.md +163 -0
- package/docs/buttons/en/ActionBar.md +459 -0
- package/docs/buttons/en/Button.md +228 -0
- package/docs/buttons/en/IconButton.md +294 -0
- package/docs/buttons/en/README.md +600 -0
- package/docs/buttons/en/TextButton.md +163 -0
- package/docs/containers/cn/accordion.md +622 -0
- package/docs/containers/cn/box.md +445 -0
- package/docs/containers/cn/card.md +404 -0
- package/docs/containers/cn/page.md +576 -0
- package/docs/containers/cn/tabs.md +686 -0
- package/docs/containers/en/accordion.md +622 -0
- package/docs/containers/en/box.md +445 -0
- package/docs/containers/en/card.md +404 -0
- package/docs/containers/en/page.md +576 -0
- package/docs/containers/en/tabs.md +686 -0
- package/docs/data-display/cn/concise-data-table.md +731 -0
- package/docs/data-display/cn/listbox.md +786 -0
- package/docs/data-display/cn/treeview.md +863 -0
- package/docs/data-display/en/concise-data-table.md +732 -0
- package/docs/data-display/en/listbox.md +786 -0
- package/docs/data-display/en/treeview.md +863 -0
- package/docs/data-table/cn/README.md +596 -0
- package/docs/data-table/en/README.md +596 -0
- package/docs/dialog/cn/README.md +767 -0
- package/docs/dialog/en/README.md +767 -0
- package/docs/form/cn/README.md +847 -0
- package/docs/form/en/README.md +847 -0
- package/docs/form-components/cn/README.md +495 -0
- package/docs/form-components/cn/attachmentfilesfield.md +757 -0
- package/docs/form-components/cn/cascade-options-select.md +374 -0
- package/docs/form-components/cn/checkbox.md +58 -0
- package/docs/form-components/cn/date-picker.md +138 -0
- package/docs/form-components/cn/datetime-picker.md +228 -0
- package/docs/form-components/cn/group-checkbox.md +405 -0
- package/docs/form-components/cn/group-radiobox.md +525 -0
- package/docs/form-components/cn/imagefilesfield.md +651 -0
- package/docs/form-components/cn/input-options-select.md +250 -0
- package/docs/form-components/cn/lookup-editor.md +406 -0
- package/docs/form-components/cn/memoeditor.md +409 -0
- package/docs/form-components/cn/number-editor.md +261 -0
- package/docs/form-components/cn/options-multi-select.md +177 -0
- package/docs/form-components/cn/options-select.md +83 -0
- package/docs/form-components/cn/passwordeditor.md +538 -0
- package/docs/form-components/cn/prompts-text-editor.md +241 -0
- package/docs/form-components/cn/radiobutton.md +84 -0
- package/docs/form-components/cn/switch.md +178 -0
- package/docs/form-components/cn/text-editor.md +142 -0
- package/docs/form-components/cn/time-editor.md +159 -0
- package/docs/form-components/cn/unit-number-editor.md +164 -0
- package/docs/form-components/en/README.md +463 -0
- package/docs/form-components/en/attachmentfilesfield.md +757 -0
- package/docs/form-components/en/cascade-options-select.md +358 -0
- package/docs/form-components/en/checkbox.md +59 -0
- package/docs/form-components/en/date-picker.md +138 -0
- package/docs/form-components/en/datetime-picker.md +228 -0
- package/docs/form-components/en/group-checkbox.md +395 -0
- package/docs/form-components/en/group-radiobox.md +498 -0
- package/docs/form-components/en/imagefilesfield.md +651 -0
- package/docs/form-components/en/input-options-select.md +239 -0
- package/docs/form-components/en/lookup-editor.md +389 -0
- package/docs/form-components/en/memoeditor.md +409 -0
- package/docs/form-components/en/number-editor.md +249 -0
- package/docs/form-components/en/options-multi-select.md +177 -0
- package/docs/form-components/en/options-select.md +83 -0
- package/docs/form-components/en/passwordeditor.md +538 -0
- package/docs/form-components/en/prompts-text-editor.md +241 -0
- package/docs/form-components/en/radiobutton.md +84 -0
- package/docs/form-components/en/switch.md +180 -0
- package/docs/form-components/en/text-editor.md +142 -0
- package/docs/form-components/en/time-editor.md +159 -0
- package/docs/form-components/en/unit-number-editor.md +164 -0
- package/docs/form-layout/cn/criteria-field.md +652 -0
- package/docs/form-layout/cn/flex-form.md +454 -0
- package/docs/form-layout/cn/flex-row-form.md +542 -0
- package/docs/form-layout/cn/form-field.md +923 -0
- package/docs/form-layout/cn/grid-form.md +676 -0
- package/docs/form-layout/en/criteria-field.md +652 -0
- package/docs/form-layout/en/flex-form.md +454 -0
- package/docs/form-layout/en/flex-row-form.md +542 -0
- package/docs/form-layout/en/form-field.md +923 -0
- package/docs/form-layout/en/grid-form.md +676 -0
- package/docs/global/cn/README.md +534 -0
- package/docs/global/en/README.md +534 -0
- package/docs/layout/cn/classiclayout.md +460 -0
- package/docs/layout/cn/headerlayout.md +524 -0
- package/docs/layout/cn/sidebarlayout.md +263 -0
- package/docs/layout/en/classiclayout.md +951 -0
- package/docs/layout/en/headerlayout.md +524 -0
- package/docs/layout/en/sidebarlayout.md +262 -0
- package/docs/misc/cn/README.md +1217 -0
- package/docs/misc/en/README.md +1217 -0
- package/docs/navigation/cn/breadcrumb.md +291 -0
- package/docs/navigation/cn/navigator.md +322 -0
- package/docs/navigation/cn/navigatormenu.md +512 -0
- package/docs/navigation/cn/progressbar.md +199 -0
- package/docs/navigation/cn/progressstepbar.md +299 -0
- package/docs/navigation/en/breadcrumb.md +291 -0
- package/docs/navigation/en/navigator.md +322 -0
- package/docs/navigation/en/navigatormenu.md +512 -0
- package/docs/navigation/en/progressbar.md +199 -0
- package/docs/navigation/en/progressstepbar.md +299 -0
- package/docs/search-filters/cn/daterange.md +1156 -0
- package/docs/search-filters/cn/numberrange.md +688 -0
- package/docs/search-filters/cn/searchbox.md +1582 -0
- package/docs/search-filters/en/daterange.md +1156 -0
- package/docs/search-filters/en/numberrange.md +688 -0
- package/docs/search-filters/en/searchbox.md +1582 -0
- package/package.json +38 -5
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Button Component
|
|
2
|
+
|
|
3
|
+
The primary `Button` component provides comprehensive button functionality with icon and label support.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import Button from '@ticatec/uniface-element/Button';
|
|
10
|
+
|
|
11
|
+
const handleClick = async (event: MouseEvent) => {
|
|
12
|
+
console.log('Button clicked!');
|
|
13
|
+
// Perform async operation
|
|
14
|
+
};
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Button
|
|
18
|
+
label="Save Changes"
|
|
19
|
+
type="primary"
|
|
20
|
+
icon="icon_google_save"
|
|
21
|
+
onClick={handleClick}
|
|
22
|
+
/>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Advanced Configuration
|
|
26
|
+
|
|
27
|
+
```svelte
|
|
28
|
+
<script lang="ts">
|
|
29
|
+
import Button from '@ticatec/uniface-element/Button';
|
|
30
|
+
import type { ButtonType } from '@ticatec/uniface-element';
|
|
31
|
+
|
|
32
|
+
let isSubmitting = false;
|
|
33
|
+
|
|
34
|
+
const handleSubmit = async (event: MouseEvent) => {
|
|
35
|
+
isSubmitting = true;
|
|
36
|
+
try {
|
|
37
|
+
await submitForm();
|
|
38
|
+
} finally {
|
|
39
|
+
isSubmitting = false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<Button
|
|
45
|
+
label={isSubmitting ? "Submitting..." : "Submit Form"}
|
|
46
|
+
type="primary"
|
|
47
|
+
size="big"
|
|
48
|
+
variant="round"
|
|
49
|
+
icon="icon_google_send"
|
|
50
|
+
disabled={isSubmitting}
|
|
51
|
+
style="margin: 16px;"
|
|
52
|
+
onClick={handleSubmit}
|
|
53
|
+
/>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Properties
|
|
57
|
+
|
|
58
|
+
| Property | Type | Default | Description |
|
|
59
|
+
|----------|------|---------|-------------|
|
|
60
|
+
| `label` | `string` | `''` | Button text label |
|
|
61
|
+
| `type` | `ButtonType` | `'default'` | Visual style variant |
|
|
62
|
+
| `size` | `'big' \| 'medium' \| 'mini'` | `'medium'` | Button size |
|
|
63
|
+
| `variant` | `'plain' \| 'round' \| ''` | `''` | Additional style variant |
|
|
64
|
+
| `icon` | `string \| null` | `null` | Icon class (e.g., Google Material Icons) |
|
|
65
|
+
| `disabled` | `boolean` | `false` | Disable button interaction |
|
|
66
|
+
| `style` | `string` | `''` | Custom CSS styles |
|
|
67
|
+
| `onClick` | `(event: MouseEvent) => void` | - | Click event handler |
|
|
68
|
+
|
|
69
|
+
## Button with Slot Content
|
|
70
|
+
|
|
71
|
+
```svelte
|
|
72
|
+
<Button type="secondary" onClick={handleAction}>
|
|
73
|
+
<i class="icon_google_star"></i>
|
|
74
|
+
<span>Custom Content</span>
|
|
75
|
+
<span class="badge">3</span>
|
|
76
|
+
</Button>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Style Variants
|
|
80
|
+
|
|
81
|
+
### ButtonType Options
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
type ButtonType = 'default' | 'primary' | 'secondary' | 'third' | 'forth';
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Visual Appearance
|
|
88
|
+
|
|
89
|
+
- **default**: Standard neutral button appearance
|
|
90
|
+
- **primary**: Emphasizes primary actions (typically blue)
|
|
91
|
+
- **secondary**: Secondary actions button (typically gray)
|
|
92
|
+
- **third**: Alternative style (typically for warnings/caution)
|
|
93
|
+
- **forth**: Additional style variant
|
|
94
|
+
|
|
95
|
+
### Size Variants
|
|
96
|
+
|
|
97
|
+
- **big**: Large button size for prominent actions
|
|
98
|
+
- **medium**: Standard button size for most use cases
|
|
99
|
+
- **mini**: Small button size for compact interfaces
|
|
100
|
+
|
|
101
|
+
### Style Variants
|
|
102
|
+
|
|
103
|
+
- **plain**: Minimalist style variant
|
|
104
|
+
- **round**: Rounded corner variant
|
|
105
|
+
- **'' (empty string)**: Standard styling
|
|
106
|
+
|
|
107
|
+
## Icon Usage
|
|
108
|
+
|
|
109
|
+
The component uses `@ticatec/uniface-google-material-icons` as the icon library. Simply pass the icon class name:
|
|
110
|
+
|
|
111
|
+
```svelte
|
|
112
|
+
<!-- Common Material Icons -->
|
|
113
|
+
<Button icon="icon_google_save" label="Save" />
|
|
114
|
+
<Button icon="icon_google_edit" label="Edit" />
|
|
115
|
+
<Button icon="icon_google_delete" label="Delete" />
|
|
116
|
+
<Button icon="icon_google_add" label="Add" />
|
|
117
|
+
<Button icon="icon_google_remove" label="Remove" />
|
|
118
|
+
<Button icon="icon_google_search" label="Search" />
|
|
119
|
+
<Button icon="icon_google_settings" label="Settings" />
|
|
120
|
+
<Button icon="icon_google_home" label="Home" />
|
|
121
|
+
<Button icon="icon_google_check" label="Confirm" />
|
|
122
|
+
<Button icon="icon_google_arrow_back" label="Back" />
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Best Practices
|
|
126
|
+
|
|
127
|
+
### Use Appropriate Button Types
|
|
128
|
+
|
|
129
|
+
Choose the correct button type based on action importance:
|
|
130
|
+
|
|
131
|
+
```svelte
|
|
132
|
+
<!-- Primary actions -->
|
|
133
|
+
<Button label="Save" type="primary" />
|
|
134
|
+
<Button label="Submit" type="primary" />
|
|
135
|
+
|
|
136
|
+
<!-- Secondary actions -->
|
|
137
|
+
<Button label="Cancel" type="secondary" />
|
|
138
|
+
<Button label="Preview" type="secondary" />
|
|
139
|
+
|
|
140
|
+
<!-- Dangerous actions -->
|
|
141
|
+
<Button label="Delete" type="third" />
|
|
142
|
+
<Button label="Remove" type="third" />
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Handle Async Operations Properly
|
|
146
|
+
|
|
147
|
+
Always handle loading states and errors:
|
|
148
|
+
|
|
149
|
+
```svelte
|
|
150
|
+
<script lang="ts">
|
|
151
|
+
let isLoading = false;
|
|
152
|
+
let error = null;
|
|
153
|
+
|
|
154
|
+
const handleAction = async () => {
|
|
155
|
+
isLoading = true;
|
|
156
|
+
error = null;
|
|
157
|
+
|
|
158
|
+
try {
|
|
159
|
+
await performAction();
|
|
160
|
+
} catch (err) {
|
|
161
|
+
error = err.message;
|
|
162
|
+
} finally {
|
|
163
|
+
isLoading = false;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<Button
|
|
169
|
+
label={isLoading ? "Processing..." : "Start Process"}
|
|
170
|
+
type="primary"
|
|
171
|
+
disabled={isLoading}
|
|
172
|
+
onClick={handleAction}
|
|
173
|
+
/>
|
|
174
|
+
|
|
175
|
+
{#if error}
|
|
176
|
+
<div class="error">{error}</div>
|
|
177
|
+
{/if}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Provide Visual Feedback
|
|
181
|
+
|
|
182
|
+
Use icons and appropriate styling:
|
|
183
|
+
|
|
184
|
+
```svelte
|
|
185
|
+
<!-- Success actions -->
|
|
186
|
+
<Button label="Save" icon="icon_google_save" type="primary" />
|
|
187
|
+
|
|
188
|
+
<!-- Dangerous actions -->
|
|
189
|
+
<Button label="Delete" icon="icon_google_delete" type="third" />
|
|
190
|
+
|
|
191
|
+
<!-- Navigation actions -->
|
|
192
|
+
<Button label="Back" icon="icon_google_arrow_back" type="secondary" />
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Consider Mobile Responsiveness
|
|
196
|
+
|
|
197
|
+
Use appropriate sizes for different screen sizes:
|
|
198
|
+
|
|
199
|
+
```svelte
|
|
200
|
+
<div class="responsive-buttons">
|
|
201
|
+
<!-- Desktop: normal size, Mobile: larger for touch -->
|
|
202
|
+
<Button label="Action" size="big" class="mobile-friendly" />
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
<style>
|
|
206
|
+
.responsive-buttons .mobile-friendly {
|
|
207
|
+
/* Responsive styles */
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@media (max-width: 768px) {
|
|
211
|
+
.responsive-buttons .mobile-friendly {
|
|
212
|
+
min-height: 44px; /* iOS recommended touch target size */
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
</style>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Accessibility Considerations
|
|
219
|
+
|
|
220
|
+
**⚠️ Important Note**: The current button components have the following accessibility limitations:
|
|
221
|
+
|
|
222
|
+
- **Non-semantic elements**: All buttons use `<div>` elements instead of `<button>`
|
|
223
|
+
- **Hidden from screen readers**: All buttons have `aria-hidden="true"` by default
|
|
224
|
+
- **No keyboard navigation**: Components don't support Tab navigation or Enter/Space activation
|
|
225
|
+
- **No focus management**: Components don't provide focus method or support `bind:this`
|
|
226
|
+
- **No ARIA attribute support**: Custom aria-* attributes cannot be passed
|
|
227
|
+
|
|
228
|
+
For full accessibility compliance, consider wrapping components with proper semantic elements.
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# IconButton Component
|
|
2
|
+
|
|
3
|
+
The `IconButton` component is designed for icon-only buttons in compact interfaces.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import IconButton from '@ticatec/uniface-element/IconButton';
|
|
10
|
+
|
|
11
|
+
const handleEdit = async (event: MouseEvent) => {
|
|
12
|
+
// Handle edit action
|
|
13
|
+
};
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<IconButton
|
|
17
|
+
icon="icon_google_edit"
|
|
18
|
+
type="primary"
|
|
19
|
+
onClick={handleEdit}
|
|
20
|
+
/>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage Examples
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<script lang="ts">
|
|
27
|
+
import IconButton from '@ticatec/uniface-element/IconButton';
|
|
28
|
+
|
|
29
|
+
const toolbarActions = {
|
|
30
|
+
edit: async () => { /* edit logic */ },
|
|
31
|
+
delete: async () => { /* delete logic */ },
|
|
32
|
+
share: async () => { /* share logic */ },
|
|
33
|
+
favorite: async () => { /* favorite logic */ }
|
|
34
|
+
};
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<!-- Toolbar icon buttons -->
|
|
38
|
+
<div class="toolbar">
|
|
39
|
+
<IconButton icon="icon_google_edit" type="default" onClick={toolbarActions.edit} />
|
|
40
|
+
<IconButton icon="icon_google_delete" type="third" onClick={toolbarActions.delete} />
|
|
41
|
+
<IconButton icon="icon_google_share" type="secondary" onClick={toolbarActions.share} />
|
|
42
|
+
<IconButton icon="icon_google_favorite" type="primary" onClick={toolbarActions.favorite} />
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
<!-- Different sizes -->
|
|
46
|
+
<IconButton icon="icon_google_settings" size="big" onClick={toolbarActions.edit} />
|
|
47
|
+
<IconButton icon="icon_google_settings" size="medium" onClick={toolbarActions.edit} />
|
|
48
|
+
<IconButton icon="icon_google_settings" size="mini" onClick={toolbarActions.edit} />
|
|
49
|
+
|
|
50
|
+
<!-- With custom slot content -->
|
|
51
|
+
<IconButton type="primary" onClick={toolbarActions.edit}>
|
|
52
|
+
<i class="icon_google_edit"></i>
|
|
53
|
+
</IconButton>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.toolbar {
|
|
57
|
+
display: flex;
|
|
58
|
+
gap: 8px;
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Properties
|
|
65
|
+
|
|
66
|
+
| Property | Type | Default | Description |
|
|
67
|
+
|----------|------|---------|-------------|
|
|
68
|
+
| `icon` | `string` | `''` | Icon class (e.g., Google Material Icons) |
|
|
69
|
+
| `type` | `ButtonType` | `'default'` | Visual style variant |
|
|
70
|
+
| `size` | `'big' \| 'medium' \| 'mini'` | `'medium'` | Button size |
|
|
71
|
+
| `disabled` | `boolean` | `false` | Disable button interaction |
|
|
72
|
+
| `style` | `string` | `''` | Custom CSS styles |
|
|
73
|
+
| `onClick` | `(event: MouseEvent) => void` | - | Click event handler |
|
|
74
|
+
|
|
75
|
+
## Style Variants
|
|
76
|
+
|
|
77
|
+
### ButtonType Options
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
type ButtonType = 'default' | 'primary' | 'secondary' | 'third' | 'forth';
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Visual Appearance
|
|
84
|
+
|
|
85
|
+
- **default**: Standard neutral button appearance
|
|
86
|
+
- **primary**: Emphasizes primary actions (typically blue)
|
|
87
|
+
- **secondary**: Secondary actions button (typically gray)
|
|
88
|
+
- **third**: Alternative style (typically for warnings/caution)
|
|
89
|
+
- **forth**: Additional style variant
|
|
90
|
+
|
|
91
|
+
### Size Variants
|
|
92
|
+
|
|
93
|
+
- **big**: Large icon button for prominent actions
|
|
94
|
+
- **medium**: Standard icon button for most use cases
|
|
95
|
+
- **mini**: Small icon button for compact interfaces
|
|
96
|
+
|
|
97
|
+
## Common Icons
|
|
98
|
+
|
|
99
|
+
Using `@ticatec/uniface-google-material-icons` icon library:
|
|
100
|
+
|
|
101
|
+
```svelte
|
|
102
|
+
<!-- Edit actions -->
|
|
103
|
+
<IconButton icon="icon_google_edit" />
|
|
104
|
+
<IconButton icon="icon_google_create" />
|
|
105
|
+
<IconButton icon="icon_google_mode_edit" />
|
|
106
|
+
|
|
107
|
+
<!-- Delete actions -->
|
|
108
|
+
<IconButton icon="icon_google_delete" type="third" />
|
|
109
|
+
<IconButton icon="icon_google_delete_forever" type="third" />
|
|
110
|
+
<IconButton icon="icon_google_remove" type="third" />
|
|
111
|
+
|
|
112
|
+
<!-- View actions -->
|
|
113
|
+
<IconButton icon="icon_google_visibility" />
|
|
114
|
+
<IconButton icon="icon_google_preview" />
|
|
115
|
+
<IconButton icon="icon_google_search" />
|
|
116
|
+
|
|
117
|
+
<!-- Settings actions -->
|
|
118
|
+
<IconButton icon="icon_google_settings" />
|
|
119
|
+
<IconButton icon="icon_google_tune" />
|
|
120
|
+
<IconButton icon="icon_google_more_vert" />
|
|
121
|
+
|
|
122
|
+
<!-- Navigation actions -->
|
|
123
|
+
<IconButton icon="icon_google_arrow_back" />
|
|
124
|
+
<IconButton icon="icon_google_arrow_forward" />
|
|
125
|
+
<IconButton icon="icon_google_close" />
|
|
126
|
+
|
|
127
|
+
<!-- Status actions -->
|
|
128
|
+
<IconButton icon="icon_google_favorite" type="primary" />
|
|
129
|
+
<IconButton icon="icon_google_star" type="primary" />
|
|
130
|
+
<IconButton icon="icon_google_bookmark" />
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Use Cases
|
|
134
|
+
|
|
135
|
+
IconButton component is particularly suitable for:
|
|
136
|
+
|
|
137
|
+
- Data table row actions
|
|
138
|
+
- Toolbar buttons
|
|
139
|
+
- Card actions
|
|
140
|
+
- Compact navigation controls
|
|
141
|
+
- Status toggle buttons
|
|
142
|
+
|
|
143
|
+
## Best Practices
|
|
144
|
+
|
|
145
|
+
### Data Table Row Actions
|
|
146
|
+
|
|
147
|
+
```svelte
|
|
148
|
+
<script lang="ts">
|
|
149
|
+
import IconButton from '@ticatec/uniface-element/IconButton';
|
|
150
|
+
|
|
151
|
+
export let item: any;
|
|
152
|
+
export let onEdit: (item: any) => Promise<void>;
|
|
153
|
+
export let onDelete: (item: any) => Promise<void>;
|
|
154
|
+
export let onView: (item: any) => Promise<void>;
|
|
155
|
+
</script>
|
|
156
|
+
|
|
157
|
+
<div class="table-actions">
|
|
158
|
+
<IconButton
|
|
159
|
+
icon="icon_google_visibility"
|
|
160
|
+
type="default"
|
|
161
|
+
onClick={async () => await onView(item)}
|
|
162
|
+
/>
|
|
163
|
+
<IconButton
|
|
164
|
+
icon="icon_google_edit"
|
|
165
|
+
type="primary"
|
|
166
|
+
onClick={async () => await onEdit(item)}
|
|
167
|
+
/>
|
|
168
|
+
<IconButton
|
|
169
|
+
icon="icon_google_delete"
|
|
170
|
+
type="third"
|
|
171
|
+
onClick={async () => await onDelete(item)}
|
|
172
|
+
/>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<style>
|
|
176
|
+
.table-actions {
|
|
177
|
+
display: flex;
|
|
178
|
+
gap: 4px;
|
|
179
|
+
}
|
|
180
|
+
</style>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Card Action Bar
|
|
184
|
+
|
|
185
|
+
```svelte
|
|
186
|
+
<script lang="ts">
|
|
187
|
+
import IconButton from '@ticatec/uniface-element/IconButton';
|
|
188
|
+
|
|
189
|
+
let isFavorite = false;
|
|
190
|
+
let isBookmarked = false;
|
|
191
|
+
|
|
192
|
+
const toggleFavorite = async () => {
|
|
193
|
+
isFavorite = !isFavorite;
|
|
194
|
+
// Save state to server
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const toggleBookmark = async () => {
|
|
198
|
+
isBookmarked = !isBookmarked;
|
|
199
|
+
// Save state to server
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const shareContent = async () => {
|
|
203
|
+
// Share functionality
|
|
204
|
+
};
|
|
205
|
+
</script>
|
|
206
|
+
|
|
207
|
+
<div class="card-actions">
|
|
208
|
+
<IconButton
|
|
209
|
+
icon={isFavorite ? "icon_google_favorite" : "icon_google_favorite_border"}
|
|
210
|
+
type={isFavorite ? "primary" : "default"}
|
|
211
|
+
onClick={toggleFavorite}
|
|
212
|
+
/>
|
|
213
|
+
<IconButton
|
|
214
|
+
icon={isBookmarked ? "icon_google_bookmark" : "icon_google_bookmark_border"}
|
|
215
|
+
type={isBookmarked ? "primary" : "default"}
|
|
216
|
+
onClick={toggleBookmark}
|
|
217
|
+
/>
|
|
218
|
+
<IconButton
|
|
219
|
+
icon="icon_google_share"
|
|
220
|
+
type="secondary"
|
|
221
|
+
onClick={shareContent}
|
|
222
|
+
/>
|
|
223
|
+
</div>
|
|
224
|
+
|
|
225
|
+
<style>
|
|
226
|
+
.card-actions {
|
|
227
|
+
display: flex;
|
|
228
|
+
gap: 8px;
|
|
229
|
+
justify-content: flex-end;
|
|
230
|
+
padding: 8px 0;
|
|
231
|
+
}
|
|
232
|
+
</style>
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Toolbar Layout
|
|
236
|
+
|
|
237
|
+
```svelte
|
|
238
|
+
<script lang="ts">
|
|
239
|
+
import IconButton from '@ticatec/uniface-element/IconButton';
|
|
240
|
+
|
|
241
|
+
const toolbarActions = {
|
|
242
|
+
save: async () => { /* save */ },
|
|
243
|
+
undo: async () => { /* undo */ },
|
|
244
|
+
redo: async () => { /* redo */ },
|
|
245
|
+
settings: async () => { /* settings */ }
|
|
246
|
+
};
|
|
247
|
+
</script>
|
|
248
|
+
|
|
249
|
+
<div class="editor-toolbar">
|
|
250
|
+
<div class="toolbar-group">
|
|
251
|
+
<IconButton icon="icon_google_save" type="primary" onClick={toolbarActions.save} />
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
<div class="toolbar-divider"></div>
|
|
255
|
+
|
|
256
|
+
<div class="toolbar-group">
|
|
257
|
+
<IconButton icon="icon_google_undo" onClick={toolbarActions.undo} />
|
|
258
|
+
<IconButton icon="icon_google_redo" onClick={toolbarActions.redo} />
|
|
259
|
+
</div>
|
|
260
|
+
|
|
261
|
+
<div class="toolbar-divider"></div>
|
|
262
|
+
|
|
263
|
+
<div class="toolbar-group">
|
|
264
|
+
<IconButton icon="icon_google_settings" onClick={toolbarActions.settings} />
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
|
|
268
|
+
<style>
|
|
269
|
+
.editor-toolbar {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
gap: 8px;
|
|
273
|
+
padding: 8px;
|
|
274
|
+
border-bottom: 1px solid #e0e0e0;
|
|
275
|
+
background: #f8f9fa;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.toolbar-group {
|
|
279
|
+
display: flex;
|
|
280
|
+
gap: 4px;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.toolbar-divider {
|
|
284
|
+
width: 1px;
|
|
285
|
+
height: 24px;
|
|
286
|
+
background: #d0d0d0;
|
|
287
|
+
margin: 0 4px;
|
|
288
|
+
}
|
|
289
|
+
</style>
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## Click Throttling
|
|
293
|
+
|
|
294
|
+
IconButton component implements automatic click throttling with a 500ms cooldown to prevent accidental double-clicks and ensure proper async operation handling.
|