@ticatec/uniface-element 0.2.3 → 0.3.0
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/dist/accordion/README.md +169 -0
- package/dist/accordion/README_CN.md +176 -0
- package/dist/action-bar/README.md +275 -0
- package/dist/action-bar/README_CN.md +285 -0
- package/dist/app-layout/README.md +374 -0
- package/dist/app-layout/README_CN.md +381 -0
- package/dist/app-top-bar/README.md +357 -0
- package/dist/app-top-bar/README_CN.md +365 -0
- package/dist/attachment-files/AttachmentFilesField.svelte +67 -1
- package/dist/attachment-files/AttachmentFilesField.svelte.d.ts +8 -1
- package/dist/base-calendar/CalendarBase.svelte +0 -3
- package/dist/box/README.md +385 -0
- package/dist/box/README_CN.md +393 -0
- package/dist/breadcrumbs/README.md +442 -0
- package/dist/breadcrumbs/README_CN.md +442 -0
- package/dist/button/Button.svelte +27 -7
- package/dist/button/Button.svelte.d.ts +3 -1
- package/dist/button/IconButton.svelte +26 -6
- package/dist/button/IconButton.svelte.d.ts +3 -1
- package/dist/button/IconButton_README.md +513 -0
- package/dist/button/IconButton_README_CN.md +513 -0
- package/dist/button/README.md +428 -0
- package/dist/button/README_CN.md +428 -0
- package/dist/button/TextButton.svelte +26 -6
- package/dist/button/TextButton.svelte.d.ts +3 -1
- package/dist/button/TextButton_README.md +571 -0
- package/dist/button/TextButton_README_CN.md +571 -0
- package/dist/card/README.md +666 -0
- package/dist/card/README_CN.md +666 -0
- package/dist/cascade-options-select/CascadeOptionSelect.svelte +43 -7
- package/dist/cascade-options-select/CascadeOptionSelect.svelte.d.ts +3 -4
- package/dist/cascade-options-select/README.md +663 -2
- package/dist/cascade-options-select/README_CN.md +664 -0
- package/dist/checkbox/CheckBox.svelte +20 -6
- package/dist/checkbox/CheckBox.svelte.d.ts +4 -2
- package/dist/checkbox/README.md +562 -0
- package/dist/checkbox/README_CN.md +727 -0
- package/dist/common-editor/NumberInput.svelte +39 -26
- package/dist/common-editor/NumberInput.svelte.d.ts +5 -1
- package/dist/concise-data-table/ConciseListTable.svelte +133 -36
- package/dist/concise-data-table/ConciseListTable.svelte.d.ts +8 -1
- package/dist/concise-data-table/DataCell.svelte +5 -6
- package/dist/concise-data-table/DataRow.svelte +22 -2
- package/dist/concise-data-table/DataRow.svelte.d.ts +1 -0
- package/dist/concise-data-table/README.md +606 -0
- package/dist/concise-data-table/README_CN.md +611 -0
- package/dist/context-menu/ContextMenu.svelte +138 -21
- package/dist/context-menu/ContextMenu.svelte.d.ts +5 -0
- package/dist/context-menu/ContextMenuItem.d.ts +20 -4
- package/dist/context-menu/README.md +551 -0
- package/dist/context-menu/README_CN.md +551 -0
- package/dist/criteria-field/CriteriaField.svelte +3 -5
- package/dist/criteria-field/README.md +532 -0
- package/dist/criteria-field/README_CN.md +532 -0
- package/dist/data-table/README.md +712 -0
- package/dist/data-table/README_CN.md +712 -0
- package/dist/date-picker/DatePicker.svelte +44 -7
- package/dist/date-picker/DatePicker.svelte.d.ts +3 -4
- package/dist/date-picker/DateTimePicker.svelte +32 -8
- package/dist/date-picker/DateTimePicker.svelte.d.ts +3 -4
- package/dist/date-picker/README.md +326 -0
- package/dist/date-picker/README_CN.md +316 -0
- package/dist/date-picker/ScrollBar.svelte +18 -8
- package/dist/date-picker/ScrollBar.svelte.d.ts +1 -1
- package/dist/date-picker/TimePanel.svelte +5 -5
- package/dist/date-picker/TimePanel.svelte.d.ts +1 -1
- package/dist/date-range/README.md +374 -0
- package/dist/date-range/README_CN.md +374 -0
- package/dist/dialog/DialogBoard.svelte +1 -1
- package/dist/dialog/README.md +596 -0
- package/dist/dialog/README_CN.md +596 -0
- package/dist/drawer/README.md +679 -1
- package/dist/drawer/README_CN.md +679 -0
- package/dist/group-box/group-check-box/GroupCheckBox.svelte +62 -5
- package/dist/group-box/group-check-box/GroupCheckBox.svelte.d.ts +7 -2
- package/dist/group-box/group-check-box/README.md +749 -0
- package/dist/group-box/group-check-box/README_CN.md +750 -0
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte +69 -4
- package/dist/group-box/group-radio-box/GroupRadioBox.svelte.d.ts +8 -2
- package/dist/group-box/group-radio-box/README.md +920 -0
- package/dist/group-box/group-radio-box/README_CN.md +920 -0
- package/dist/image-files/README.md +1346 -0
- package/dist/image-files/README_CN.md +1346 -0
- package/dist/input-options-select/InputOptionsSelect.svelte +161 -65
- package/dist/input-options-select/InputOptionsSelect.svelte.d.ts +4 -1
- package/dist/lib/forwardAllEvents.d.ts +3 -0
- package/dist/lib/forwardAllEvents.js +24 -0
- package/dist/list-box/README.md +579 -0
- package/dist/list-box/README_CN.md +682 -0
- package/dist/lookup-editor/LookupEditor.svelte +15 -3
- package/dist/lookup-editor/LookupEditor.svelte.d.ts +3 -4
- package/dist/lookup-editor/README.md +684 -0
- package/dist/lookup-editor/README_CN.md +684 -0
- package/dist/memo-editor/MemoEditor.svelte +77 -27
- package/dist/memo-editor/MemoEditor.svelte.d.ts +6 -3
- package/dist/memo-editor/README.md +819 -0
- package/dist/memo-editor/README_CN.md +819 -0
- package/dist/message-box/README.md +398 -0
- package/dist/message-box/README_CN.md +398 -0
- package/dist/number-editor/NumberEditor.svelte +2 -2
- package/dist/number-editor/NumberEditor.svelte.d.ts +1 -1
- package/dist/number-editor/README.md +353 -22
- package/dist/number-editor/README_CN.md +357 -0
- package/dist/number-range/README.md +443 -0
- package/dist/number-range/README_CN.md +443 -0
- package/dist/options-multi-select/OptionsMultiSelect.svelte +87 -12
- package/dist/options-multi-select/OptionsMultiSelect.svelte.d.ts +3 -1
- package/dist/options-multi-select/README.md +480 -0
- package/dist/options-multi-select/README_CN.md +480 -0
- package/dist/options-select/OptionsSelect.svelte +36 -5
- package/dist/options-select/OptionsSelect.svelte.d.ts +3 -4
- package/dist/options-select/README.md +632 -0
- package/dist/options-select/README_CN.md +632 -0
- package/dist/page/README.md +605 -0
- package/dist/page/README_CN.md +605 -0
- package/dist/pagination/README.md +946 -0
- package/dist/pagination/README_CN.md +946 -0
- package/dist/pagination-panel/README.md +1075 -0
- package/dist/pagination-panel/README_CN.md +1075 -0
- package/dist/popup-hint/README.md +841 -0
- package/dist/popup-hint/README_CN.md +840 -0
- package/dist/progress-bar/README.md +242 -0
- package/dist/progress-bar/README_CN.md +242 -0
- package/dist/progress-step-bar/README.md +316 -0
- package/dist/progress-step-bar/README_CN.md +316 -0
- package/dist/prompts-text-editor/PromptsTextEditor.svelte +6 -3
- package/dist/prompts-text-editor/PromptsTextEditor.svelte.d.ts +3 -1
- package/dist/prompts-text-editor/README.md +329 -0
- package/dist/prompts-text-editor/README_CN.md +329 -0
- package/dist/property-editor/README.md +969 -0
- package/dist/property-editor/README_CN.md +969 -0
- package/dist/radio-button/README.md +372 -0
- package/dist/radio-button/README_CN.md +372 -0
- package/dist/radio-button/RadioButton.svelte +32 -3
- package/dist/radio-button/RadioButton.svelte.d.ts +12 -1
- package/dist/search-box/README.md +425 -0
- package/dist/search-box/README_CN.md +424 -0
- package/dist/search-box/SearchBox.svelte +22 -6
- package/dist/search-box/SearchBox.svelte.d.ts +4 -1
- package/dist/tabs/README.md +919 -0
- package/dist/tabs/README_CN.md +920 -0
- package/dist/tag/README.md +922 -0
- package/dist/tag/README_CN.md +922 -0
- package/dist/text-editor/PasswordEditor.svelte +17 -2
- package/dist/text-editor/PasswordEditor.svelte.d.ts +3 -3
- package/dist/text-editor/PasswordEditor_README.md +551 -0
- package/dist/text-editor/PasswordEditor_README_CN.md +551 -0
- package/dist/text-editor/README.md +466 -0
- package/dist/text-editor/README_CN.md +466 -0
- package/dist/text-editor/TextEditor.svelte +51 -19
- package/dist/text-editor/TextEditor.svelte.d.ts +0 -1
- package/dist/ticatec-uniface-web.css +1 -0
- package/dist/time-editor/README.md +498 -24
- package/dist/time-editor/README_CN.md +498 -0
- package/dist/time-editor/TimeEditor.svelte +7 -3
- package/dist/time-editor/TimeEditor.svelte.d.ts +3 -1
- package/dist/toast/README.md +667 -0
- package/dist/toast/README_CN.md +667 -0
- package/dist/transfer/README.md +795 -0
- package/dist/transfer/Transfer.svelte +6 -4
- package/dist/transfer/Transfer.svelte.d.ts +3 -1
- package/dist/tree-view/README.md +761 -0
- package/dist/tree-view/README_CN.md +761 -0
- package/dist/tree-view/TreeView.svelte +5 -3
- package/dist/tree-view/TreeView.svelte.d.ts +3 -1
- package/dist/unit-number-editor/README.md +546 -20
- package/dist/unit-number-editor/README_CN.md +525 -0
- package/dist/unit-number-editor/UnitNumberEditor.svelte +62 -8
- package/dist/unit-number-editor/UnitNumberEditor.svelte.d.ts +5 -1
- package/docs/form-field/cn/README_CN.md +364 -0
- package/docs/form-field/en/README.md +364 -0
- package/docs/form-panel/flex-form/cn/README_CN.md +586 -0
- package/docs/form-panel/flex-form/en/README.md +586 -0
- package/docs/form-panel/flex-row-form/cn/README_CN.md +787 -0
- package/docs/form-panel/flex-row-form/en/README.md +787 -0
- package/docs/form-panel/grid-form/en/README.md +744 -0
- package/package.json +1 -1
- package/dist/drawer/README-CN.md +0 -1
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
# SearchBox
|
|
2
|
+
|
|
3
|
+
A specialized text input component designed for search functionality with a built-in search icon and optimized input handling. Features composition event handling for international text input and clear functionality.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @ticatec/uniface-element
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Basic Usage
|
|
18
|
+
|
|
19
|
+
```svelte
|
|
20
|
+
<script>
|
|
21
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
22
|
+
|
|
23
|
+
let searchQuery = '';
|
|
24
|
+
|
|
25
|
+
function handleSearch(query) {
|
|
26
|
+
console.log('Searching for:', query);
|
|
27
|
+
}
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<SearchBox
|
|
31
|
+
bind:value={searchQuery}
|
|
32
|
+
onchange={handleSearch}
|
|
33
|
+
placeholder="Search..."
|
|
34
|
+
/>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Props
|
|
38
|
+
|
|
39
|
+
| Prop | Type | Default | Description |
|
|
40
|
+
|------|------|---------|-------------|
|
|
41
|
+
| `value` | `string \| null` | Required | Current search input value |
|
|
42
|
+
| `onchange` | `OnChangeHandler<string \| null>` | `null` | Callback when input value changes (on blur/enter) |
|
|
43
|
+
| `oninput` | `OnChangeHandler<string \| null>` | `null` | Callback when input value changes (real-time) |
|
|
44
|
+
| `onfocus` | `((event: FocusEvent) => void) \| null` | `null` | Callback when input gains focus |
|
|
45
|
+
| `onblur` | `((event: FocusEvent) => void) \| null` | `null` | Callback when input loses focus |
|
|
46
|
+
| `disabled` | `boolean` | `false` | Whether the input is disabled |
|
|
47
|
+
| `placeholder` | `string \| null` | `null` | Placeholder text |
|
|
48
|
+
| `variant` | `"" \| "plain" \| "outlined" \| "filled"` | `""` | Input visual variant |
|
|
49
|
+
| `compact` | `boolean` | `false` | Whether to use compact spacing |
|
|
50
|
+
| `style` | `string` | `""` | Additional CSS styles |
|
|
51
|
+
|
|
52
|
+
## Methods
|
|
53
|
+
|
|
54
|
+
| Method | Description |
|
|
55
|
+
|--------|-------------|
|
|
56
|
+
| `focus()` | Programmatically focus the search input |
|
|
57
|
+
|
|
58
|
+
## Examples
|
|
59
|
+
|
|
60
|
+
### Basic Search
|
|
61
|
+
|
|
62
|
+
```svelte
|
|
63
|
+
<script>
|
|
64
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
65
|
+
|
|
66
|
+
let searchTerm = '';
|
|
67
|
+
let results = [];
|
|
68
|
+
|
|
69
|
+
function performSearch(query) {
|
|
70
|
+
if (query) {
|
|
71
|
+
// Simulate search
|
|
72
|
+
results = [`Result for "${query}" 1`, `Result for "${query}" 2`];
|
|
73
|
+
} else {
|
|
74
|
+
results = [];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<SearchBox
|
|
80
|
+
bind:value={searchTerm}
|
|
81
|
+
onchange={performSearch}
|
|
82
|
+
placeholder="Search products..."
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
{#if results.length > 0}
|
|
86
|
+
<ul>
|
|
87
|
+
{#each results as result}
|
|
88
|
+
<li>{result}</li>
|
|
89
|
+
{/each}
|
|
90
|
+
</ul>
|
|
91
|
+
{/if}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Real-time Search
|
|
95
|
+
|
|
96
|
+
```svelte
|
|
97
|
+
<script>
|
|
98
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
99
|
+
import { debounce } from 'lodash-es';
|
|
100
|
+
|
|
101
|
+
let searchQuery = '';
|
|
102
|
+
let suggestions = [];
|
|
103
|
+
|
|
104
|
+
// Debounced search function
|
|
105
|
+
const debouncedSearch = debounce((query) => {
|
|
106
|
+
if (query.length > 2) {
|
|
107
|
+
// Simulate API call
|
|
108
|
+
suggestions = [
|
|
109
|
+
`${query} suggestion 1`,
|
|
110
|
+
`${query} suggestion 2`,
|
|
111
|
+
`${query} suggestion 3`
|
|
112
|
+
];
|
|
113
|
+
} else {
|
|
114
|
+
suggestions = [];
|
|
115
|
+
}
|
|
116
|
+
}, 300);
|
|
117
|
+
|
|
118
|
+
function handleInput(query) {
|
|
119
|
+
debouncedSearch(query);
|
|
120
|
+
}
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<SearchBox
|
|
124
|
+
bind:value={searchQuery}
|
|
125
|
+
oninput={handleInput}
|
|
126
|
+
placeholder="Type to search..."
|
|
127
|
+
/>
|
|
128
|
+
|
|
129
|
+
{#if suggestions.length > 0}
|
|
130
|
+
<div class="suggestions">
|
|
131
|
+
{#each suggestions as suggestion}
|
|
132
|
+
<div class="suggestion-item">{suggestion}</div>
|
|
133
|
+
{/each}
|
|
134
|
+
</div>
|
|
135
|
+
{/if}
|
|
136
|
+
|
|
137
|
+
<style>
|
|
138
|
+
.suggestions {
|
|
139
|
+
border: 1px solid #ddd;
|
|
140
|
+
border-radius: 4px;
|
|
141
|
+
margin-top: 4px;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.suggestion-item {
|
|
145
|
+
padding: 8px 12px;
|
|
146
|
+
cursor: pointer;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.suggestion-item:hover {
|
|
150
|
+
background-color: #f5f5f5;
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### With Event Handlers
|
|
156
|
+
|
|
157
|
+
```svelte
|
|
158
|
+
<script>
|
|
159
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
160
|
+
|
|
161
|
+
let searchValue = '';
|
|
162
|
+
let isSearching = false;
|
|
163
|
+
|
|
164
|
+
function handleChange(query) {
|
|
165
|
+
console.log('Search committed:', query);
|
|
166
|
+
// Perform final search
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function handleInput(query) {
|
|
170
|
+
console.log('Input changed:', query);
|
|
171
|
+
// Real-time suggestions
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function handleFocus(event) {
|
|
175
|
+
console.log('Search box focused');
|
|
176
|
+
isSearching = true;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function handleBlur(event) {
|
|
180
|
+
console.log('Search box blurred');
|
|
181
|
+
isSearching = false;
|
|
182
|
+
}
|
|
183
|
+
</script>
|
|
184
|
+
|
|
185
|
+
<SearchBox
|
|
186
|
+
bind:value={searchValue}
|
|
187
|
+
onchange={handleChange}
|
|
188
|
+
oninput={handleInput}
|
|
189
|
+
onfocus={handleFocus}
|
|
190
|
+
onblur={handleBlur}
|
|
191
|
+
placeholder="Search..."
|
|
192
|
+
/>
|
|
193
|
+
|
|
194
|
+
{#if isSearching}
|
|
195
|
+
<p>Search is active...</p>
|
|
196
|
+
{/if}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Different Variants
|
|
200
|
+
|
|
201
|
+
```svelte
|
|
202
|
+
<script>
|
|
203
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
204
|
+
|
|
205
|
+
let search1 = '', search2 = '', search3 = '';
|
|
206
|
+
</script>
|
|
207
|
+
|
|
208
|
+
<!-- Default variant -->
|
|
209
|
+
<SearchBox bind:value={search1} placeholder="Default search" />
|
|
210
|
+
|
|
211
|
+
<!-- Outlined variant -->
|
|
212
|
+
<SearchBox bind:value={search2} variant="outlined" placeholder="Outlined search" />
|
|
213
|
+
|
|
214
|
+
<!-- Filled variant -->
|
|
215
|
+
<SearchBox bind:value={search3} variant="filled" placeholder="Filled search" />
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Compact Mode
|
|
219
|
+
|
|
220
|
+
```svelte
|
|
221
|
+
<script>
|
|
222
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
223
|
+
|
|
224
|
+
let compactSearch = '';
|
|
225
|
+
</script>
|
|
226
|
+
|
|
227
|
+
<div class="toolbar">
|
|
228
|
+
<SearchBox
|
|
229
|
+
bind:value={compactSearch}
|
|
230
|
+
compact
|
|
231
|
+
placeholder="Quick search"
|
|
232
|
+
/>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<style>
|
|
236
|
+
.toolbar {
|
|
237
|
+
display: flex;
|
|
238
|
+
align-items: center;
|
|
239
|
+
padding: 8px;
|
|
240
|
+
background: #f8f9fa;
|
|
241
|
+
}
|
|
242
|
+
</style>
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Search with Filter
|
|
246
|
+
|
|
247
|
+
```svelte
|
|
248
|
+
<script>
|
|
249
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
250
|
+
import Button from "@ticatec/uniface-element/Button";
|
|
251
|
+
|
|
252
|
+
let searchTerm = '';
|
|
253
|
+
let filterType = 'all';
|
|
254
|
+
let items = [
|
|
255
|
+
{ name: 'Apple iPhone', category: 'electronics' },
|
|
256
|
+
{ name: 'Nike Shoes', category: 'clothing' },
|
|
257
|
+
{ name: 'Coffee Maker', category: 'appliances' },
|
|
258
|
+
{ name: 'Samsung TV', category: 'electronics' }
|
|
259
|
+
];
|
|
260
|
+
|
|
261
|
+
$: filteredItems = items.filter(item => {
|
|
262
|
+
const matchesSearch = !searchTerm ||
|
|
263
|
+
item.name.toLowerCase().includes(searchTerm.toLowerCase());
|
|
264
|
+
const matchesFilter = filterType === 'all' ||
|
|
265
|
+
item.category === filterType;
|
|
266
|
+
return matchesSearch && matchesFilter;
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
function clearSearch() {
|
|
270
|
+
searchTerm = '';
|
|
271
|
+
}
|
|
272
|
+
</script>
|
|
273
|
+
|
|
274
|
+
<div class="search-controls">
|
|
275
|
+
<SearchBox
|
|
276
|
+
bind:value={searchTerm}
|
|
277
|
+
placeholder="Search products..."
|
|
278
|
+
style="flex: 1; margin-right: 8px;"
|
|
279
|
+
/>
|
|
280
|
+
<Button label="Clear" onClick={clearSearch} />
|
|
281
|
+
</div>
|
|
282
|
+
|
|
283
|
+
<div class="filters">
|
|
284
|
+
<label>
|
|
285
|
+
<input type="radio" bind:group={filterType} value="all" />
|
|
286
|
+
All
|
|
287
|
+
</label>
|
|
288
|
+
<label>
|
|
289
|
+
<input type="radio" bind:group={filterType} value="electronics" />
|
|
290
|
+
Electronics
|
|
291
|
+
</label>
|
|
292
|
+
<label>
|
|
293
|
+
<input type="radio" bind:group={filterType} value="clothing" />
|
|
294
|
+
Clothing
|
|
295
|
+
</label>
|
|
296
|
+
</div>
|
|
297
|
+
|
|
298
|
+
<div class="results">
|
|
299
|
+
{#each filteredItems as item}
|
|
300
|
+
<div class="item">{item.name} - {item.category}</div>
|
|
301
|
+
{/each}
|
|
302
|
+
</div>
|
|
303
|
+
|
|
304
|
+
<style>
|
|
305
|
+
.search-controls {
|
|
306
|
+
display: flex;
|
|
307
|
+
margin-bottom: 16px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.filters {
|
|
311
|
+
display: flex;
|
|
312
|
+
gap: 16px;
|
|
313
|
+
margin-bottom: 16px;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.item {
|
|
317
|
+
padding: 8px;
|
|
318
|
+
border-bottom: 1px solid #eee;
|
|
319
|
+
}
|
|
320
|
+
</style>
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
### Disabled State
|
|
324
|
+
|
|
325
|
+
```svelte
|
|
326
|
+
<script>
|
|
327
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
328
|
+
|
|
329
|
+
let searchValue = '';
|
|
330
|
+
let isDisabled = false;
|
|
331
|
+
</script>
|
|
332
|
+
|
|
333
|
+
<label>
|
|
334
|
+
<input type="checkbox" bind:checked={isDisabled} />
|
|
335
|
+
Disable search
|
|
336
|
+
</label>
|
|
337
|
+
|
|
338
|
+
<SearchBox
|
|
339
|
+
bind:value={searchValue}
|
|
340
|
+
disabled={isDisabled}
|
|
341
|
+
placeholder="Search when enabled..."
|
|
342
|
+
/>
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Programmatic Focus
|
|
346
|
+
|
|
347
|
+
```svelte
|
|
348
|
+
<script>
|
|
349
|
+
import SearchBox from "@ticatec/uniface-element/SearchBox";
|
|
350
|
+
import Button from "@ticatec/uniface-element/Button";
|
|
351
|
+
|
|
352
|
+
let searchBox;
|
|
353
|
+
let searchValue = '';
|
|
354
|
+
|
|
355
|
+
function focusSearch() {
|
|
356
|
+
searchBox.focus();
|
|
357
|
+
}
|
|
358
|
+
</script>
|
|
359
|
+
|
|
360
|
+
<Button label="Focus Search" onClick={focusSearch} />
|
|
361
|
+
|
|
362
|
+
<SearchBox
|
|
363
|
+
bind:this={searchBox}
|
|
364
|
+
bind:value={searchValue}
|
|
365
|
+
placeholder="Click button to focus me"
|
|
366
|
+
/>
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
## Features
|
|
370
|
+
|
|
371
|
+
- **Search Icon**: Built-in search icon for clear visual indication
|
|
372
|
+
- **Clear Functionality**: Automatic clear button when text is present
|
|
373
|
+
- **Composition Events**: Proper handling of international text input (IME support)
|
|
374
|
+
- **Real-time Input**: Separate handlers for input and change events
|
|
375
|
+
- **Focus Management**: Programmatic focus control and event handling
|
|
376
|
+
- **Flexible Styling**: Multiple visual variants and custom styling options
|
|
377
|
+
|
|
378
|
+
## Input Handling
|
|
379
|
+
|
|
380
|
+
The SearchBox component provides sophisticated input handling:
|
|
381
|
+
|
|
382
|
+
1. **Real-time Updates**: `oninput` fires on every keystroke
|
|
383
|
+
2. **Committed Changes**: `onchange` fires on blur or Enter key
|
|
384
|
+
3. **Composition Support**: Properly handles IME input for international languages
|
|
385
|
+
4. **Clear Action**: Triggers both input and change callbacks when cleared
|
|
386
|
+
|
|
387
|
+
## Behavior
|
|
388
|
+
|
|
389
|
+
1. **Typing**: Real-time updates trigger `oninput` callback
|
|
390
|
+
2. **Enter/Blur**: Committed changes trigger `onchange` callback
|
|
391
|
+
3. **Clear Button**: Appears when text is present, clears input when clicked
|
|
392
|
+
4. **Focus**: Click or tab to focus, programmable via `focus()` method
|
|
393
|
+
5. **IME Input**: Composition events prevent premature updates during multi-key input
|
|
394
|
+
|
|
395
|
+
## Accessibility
|
|
396
|
+
|
|
397
|
+
- Proper ARIA attributes for search functionality
|
|
398
|
+
- Keyboard navigation support
|
|
399
|
+
- Screen reader compatible
|
|
400
|
+
- Focus indicators and management
|
|
401
|
+
- Clear button accessibility
|
|
402
|
+
|
|
403
|
+
## Best Practices
|
|
404
|
+
|
|
405
|
+
1. **Search Feedback**: Provide visual feedback during search operations
|
|
406
|
+
2. **Debouncing**: Use debouncing for real-time search to avoid excessive API calls
|
|
407
|
+
3. **Empty States**: Handle empty search results gracefully
|
|
408
|
+
4. **Loading States**: Show loading indicators for async searches
|
|
409
|
+
5. **Clear Action**: Always provide a way to clear the search
|
|
410
|
+
6. **Placeholder Text**: Use descriptive placeholder text
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
## Browser Support
|
|
414
|
+
|
|
415
|
+
- Modern browsers with composition event support
|
|
416
|
+
- Compatible with Svelte 5+
|
|
417
|
+
- IME (Input Method Editor) support for international input
|
|
418
|
+
- Touch-friendly interface
|
|
419
|
+
|
|
420
|
+
## Related Components
|
|
421
|
+
|
|
422
|
+
- `TextEditor` - Basic text input without search features
|
|
423
|
+
- `PromptsTextEditor` - Text input with suggestion dropdown
|
|
424
|
+
- `LookupEditor` - Advanced lookup with search and selection
|
|
425
|
+
- `OptionsSelect` - Dropdown selection with search capability
|