@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.
Files changed (178) hide show
  1. package/dist/accordion/README.md +169 -0
  2. package/dist/accordion/README_CN.md +176 -0
  3. package/dist/action-bar/README.md +275 -0
  4. package/dist/action-bar/README_CN.md +285 -0
  5. package/dist/app-layout/README.md +374 -0
  6. package/dist/app-layout/README_CN.md +381 -0
  7. package/dist/app-top-bar/README.md +357 -0
  8. package/dist/app-top-bar/README_CN.md +365 -0
  9. package/dist/attachment-files/AttachmentFilesField.svelte +67 -1
  10. package/dist/attachment-files/AttachmentFilesField.svelte.d.ts +8 -1
  11. package/dist/base-calendar/CalendarBase.svelte +0 -3
  12. package/dist/box/README.md +385 -0
  13. package/dist/box/README_CN.md +393 -0
  14. package/dist/breadcrumbs/README.md +442 -0
  15. package/dist/breadcrumbs/README_CN.md +442 -0
  16. package/dist/button/Button.svelte +27 -7
  17. package/dist/button/Button.svelte.d.ts +3 -1
  18. package/dist/button/IconButton.svelte +26 -6
  19. package/dist/button/IconButton.svelte.d.ts +3 -1
  20. package/dist/button/IconButton_README.md +513 -0
  21. package/dist/button/IconButton_README_CN.md +513 -0
  22. package/dist/button/README.md +428 -0
  23. package/dist/button/README_CN.md +428 -0
  24. package/dist/button/TextButton.svelte +26 -6
  25. package/dist/button/TextButton.svelte.d.ts +3 -1
  26. package/dist/button/TextButton_README.md +571 -0
  27. package/dist/button/TextButton_README_CN.md +571 -0
  28. package/dist/card/README.md +666 -0
  29. package/dist/card/README_CN.md +666 -0
  30. package/dist/cascade-options-select/CascadeOptionSelect.svelte +43 -7
  31. package/dist/cascade-options-select/CascadeOptionSelect.svelte.d.ts +3 -4
  32. package/dist/cascade-options-select/README.md +663 -2
  33. package/dist/cascade-options-select/README_CN.md +664 -0
  34. package/dist/checkbox/CheckBox.svelte +20 -6
  35. package/dist/checkbox/CheckBox.svelte.d.ts +4 -2
  36. package/dist/checkbox/README.md +562 -0
  37. package/dist/checkbox/README_CN.md +727 -0
  38. package/dist/common-editor/NumberInput.svelte +39 -26
  39. package/dist/common-editor/NumberInput.svelte.d.ts +5 -1
  40. package/dist/concise-data-table/ConciseListTable.svelte +133 -36
  41. package/dist/concise-data-table/ConciseListTable.svelte.d.ts +8 -1
  42. package/dist/concise-data-table/DataCell.svelte +5 -6
  43. package/dist/concise-data-table/DataRow.svelte +22 -2
  44. package/dist/concise-data-table/DataRow.svelte.d.ts +1 -0
  45. package/dist/concise-data-table/README.md +606 -0
  46. package/dist/concise-data-table/README_CN.md +611 -0
  47. package/dist/context-menu/ContextMenu.svelte +138 -21
  48. package/dist/context-menu/ContextMenu.svelte.d.ts +5 -0
  49. package/dist/context-menu/ContextMenuItem.d.ts +20 -4
  50. package/dist/context-menu/README.md +551 -0
  51. package/dist/context-menu/README_CN.md +551 -0
  52. package/dist/criteria-field/CriteriaField.svelte +3 -5
  53. package/dist/criteria-field/README.md +532 -0
  54. package/dist/criteria-field/README_CN.md +532 -0
  55. package/dist/data-table/README.md +712 -0
  56. package/dist/data-table/README_CN.md +712 -0
  57. package/dist/date-picker/DatePicker.svelte +44 -7
  58. package/dist/date-picker/DatePicker.svelte.d.ts +3 -4
  59. package/dist/date-picker/DateTimePicker.svelte +32 -8
  60. package/dist/date-picker/DateTimePicker.svelte.d.ts +3 -4
  61. package/dist/date-picker/README.md +326 -0
  62. package/dist/date-picker/README_CN.md +316 -0
  63. package/dist/date-picker/ScrollBar.svelte +18 -8
  64. package/dist/date-picker/ScrollBar.svelte.d.ts +1 -1
  65. package/dist/date-picker/TimePanel.svelte +5 -5
  66. package/dist/date-picker/TimePanel.svelte.d.ts +1 -1
  67. package/dist/date-range/README.md +374 -0
  68. package/dist/date-range/README_CN.md +374 -0
  69. package/dist/dialog/DialogBoard.svelte +1 -1
  70. package/dist/dialog/README.md +596 -0
  71. package/dist/dialog/README_CN.md +596 -0
  72. package/dist/drawer/README.md +679 -1
  73. package/dist/drawer/README_CN.md +679 -0
  74. package/dist/group-box/group-check-box/GroupCheckBox.svelte +62 -5
  75. package/dist/group-box/group-check-box/GroupCheckBox.svelte.d.ts +7 -2
  76. package/dist/group-box/group-check-box/README.md +749 -0
  77. package/dist/group-box/group-check-box/README_CN.md +750 -0
  78. package/dist/group-box/group-radio-box/GroupRadioBox.svelte +69 -4
  79. package/dist/group-box/group-radio-box/GroupRadioBox.svelte.d.ts +8 -2
  80. package/dist/group-box/group-radio-box/README.md +920 -0
  81. package/dist/group-box/group-radio-box/README_CN.md +920 -0
  82. package/dist/image-files/README.md +1346 -0
  83. package/dist/image-files/README_CN.md +1346 -0
  84. package/dist/input-options-select/InputOptionsSelect.svelte +161 -65
  85. package/dist/input-options-select/InputOptionsSelect.svelte.d.ts +4 -1
  86. package/dist/lib/forwardAllEvents.d.ts +3 -0
  87. package/dist/lib/forwardAllEvents.js +24 -0
  88. package/dist/list-box/README.md +579 -0
  89. package/dist/list-box/README_CN.md +682 -0
  90. package/dist/lookup-editor/LookupEditor.svelte +15 -3
  91. package/dist/lookup-editor/LookupEditor.svelte.d.ts +3 -4
  92. package/dist/lookup-editor/README.md +684 -0
  93. package/dist/lookup-editor/README_CN.md +684 -0
  94. package/dist/memo-editor/MemoEditor.svelte +77 -27
  95. package/dist/memo-editor/MemoEditor.svelte.d.ts +6 -3
  96. package/dist/memo-editor/README.md +819 -0
  97. package/dist/memo-editor/README_CN.md +819 -0
  98. package/dist/message-box/README.md +398 -0
  99. package/dist/message-box/README_CN.md +398 -0
  100. package/dist/number-editor/NumberEditor.svelte +2 -2
  101. package/dist/number-editor/NumberEditor.svelte.d.ts +1 -1
  102. package/dist/number-editor/README.md +353 -22
  103. package/dist/number-editor/README_CN.md +357 -0
  104. package/dist/number-range/README.md +443 -0
  105. package/dist/number-range/README_CN.md +443 -0
  106. package/dist/options-multi-select/OptionsMultiSelect.svelte +87 -12
  107. package/dist/options-multi-select/OptionsMultiSelect.svelte.d.ts +3 -1
  108. package/dist/options-multi-select/README.md +480 -0
  109. package/dist/options-multi-select/README_CN.md +480 -0
  110. package/dist/options-select/OptionsSelect.svelte +36 -5
  111. package/dist/options-select/OptionsSelect.svelte.d.ts +3 -4
  112. package/dist/options-select/README.md +632 -0
  113. package/dist/options-select/README_CN.md +632 -0
  114. package/dist/page/README.md +605 -0
  115. package/dist/page/README_CN.md +605 -0
  116. package/dist/pagination/README.md +946 -0
  117. package/dist/pagination/README_CN.md +946 -0
  118. package/dist/pagination-panel/README.md +1075 -0
  119. package/dist/pagination-panel/README_CN.md +1075 -0
  120. package/dist/popup-hint/README.md +841 -0
  121. package/dist/popup-hint/README_CN.md +840 -0
  122. package/dist/progress-bar/README.md +242 -0
  123. package/dist/progress-bar/README_CN.md +242 -0
  124. package/dist/progress-step-bar/README.md +316 -0
  125. package/dist/progress-step-bar/README_CN.md +316 -0
  126. package/dist/prompts-text-editor/PromptsTextEditor.svelte +6 -3
  127. package/dist/prompts-text-editor/PromptsTextEditor.svelte.d.ts +3 -1
  128. package/dist/prompts-text-editor/README.md +329 -0
  129. package/dist/prompts-text-editor/README_CN.md +329 -0
  130. package/dist/property-editor/README.md +969 -0
  131. package/dist/property-editor/README_CN.md +969 -0
  132. package/dist/radio-button/README.md +372 -0
  133. package/dist/radio-button/README_CN.md +372 -0
  134. package/dist/radio-button/RadioButton.svelte +32 -3
  135. package/dist/radio-button/RadioButton.svelte.d.ts +12 -1
  136. package/dist/search-box/README.md +425 -0
  137. package/dist/search-box/README_CN.md +424 -0
  138. package/dist/search-box/SearchBox.svelte +22 -6
  139. package/dist/search-box/SearchBox.svelte.d.ts +4 -1
  140. package/dist/tabs/README.md +919 -0
  141. package/dist/tabs/README_CN.md +920 -0
  142. package/dist/tag/README.md +922 -0
  143. package/dist/tag/README_CN.md +922 -0
  144. package/dist/text-editor/PasswordEditor.svelte +17 -2
  145. package/dist/text-editor/PasswordEditor.svelte.d.ts +3 -3
  146. package/dist/text-editor/PasswordEditor_README.md +551 -0
  147. package/dist/text-editor/PasswordEditor_README_CN.md +551 -0
  148. package/dist/text-editor/README.md +466 -0
  149. package/dist/text-editor/README_CN.md +466 -0
  150. package/dist/text-editor/TextEditor.svelte +51 -19
  151. package/dist/text-editor/TextEditor.svelte.d.ts +0 -1
  152. package/dist/ticatec-uniface-web.css +1 -0
  153. package/dist/time-editor/README.md +498 -24
  154. package/dist/time-editor/README_CN.md +498 -0
  155. package/dist/time-editor/TimeEditor.svelte +7 -3
  156. package/dist/time-editor/TimeEditor.svelte.d.ts +3 -1
  157. package/dist/toast/README.md +667 -0
  158. package/dist/toast/README_CN.md +667 -0
  159. package/dist/transfer/README.md +795 -0
  160. package/dist/transfer/Transfer.svelte +6 -4
  161. package/dist/transfer/Transfer.svelte.d.ts +3 -1
  162. package/dist/tree-view/README.md +761 -0
  163. package/dist/tree-view/README_CN.md +761 -0
  164. package/dist/tree-view/TreeView.svelte +5 -3
  165. package/dist/tree-view/TreeView.svelte.d.ts +3 -1
  166. package/dist/unit-number-editor/README.md +546 -20
  167. package/dist/unit-number-editor/README_CN.md +525 -0
  168. package/dist/unit-number-editor/UnitNumberEditor.svelte +62 -8
  169. package/dist/unit-number-editor/UnitNumberEditor.svelte.d.ts +5 -1
  170. package/docs/form-field/cn/README_CN.md +364 -0
  171. package/docs/form-field/en/README.md +364 -0
  172. package/docs/form-panel/flex-form/cn/README_CN.md +586 -0
  173. package/docs/form-panel/flex-form/en/README.md +586 -0
  174. package/docs/form-panel/flex-row-form/cn/README_CN.md +787 -0
  175. package/docs/form-panel/flex-row-form/en/README.md +787 -0
  176. package/docs/form-panel/grid-form/en/README.md +744 -0
  177. package/package.json +1 -1
  178. package/dist/drawer/README-CN.md +0 -1
@@ -0,0 +1,922 @@
1
+ # Tag
2
+
3
+ A flexible tag component for labeling, categorization, and status indication. Features include multiple variants, color themes, removable functionality, and size options. Perfect for displaying categories, filters, user selections, and status indicators.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @ticatec/uniface-element
9
+ ```
10
+
11
+ ## Import
12
+
13
+ ```typescript
14
+ import Tag from "@ticatec/uniface-element/Tag";
15
+ ```
16
+
17
+ ## Basic Usage
18
+
19
+ ```svelte
20
+ <script>
21
+ import Tag from "@ticatec/uniface-element/Tag";
22
+
23
+ function handleRemove() {
24
+ console.log('Tag removed');
25
+ }
26
+ </script>
27
+
28
+ <Tag text="Basic Tag" />
29
+ <Tag text="Removable Tag" removable={true} removeHandler={handleRemove} />
30
+ <Tag text="Non-removable Tag" removable={false} />
31
+ ```
32
+
33
+ ## Props
34
+
35
+ | Prop | Type | Default | Description |
36
+ |------|------|---------|-------------|
37
+ | `text` | `string` | `""` | Text content of the tag |
38
+ | `size` | `"big" \| "middle" \| "small"` | `"middle"` | Size of the tag |
39
+ | `variant` | `"borderless" \| "border" \| "round"` | `"border"` | Visual variant of the tag |
40
+ | `removable` | `boolean` | `true` | Whether the tag can be removed |
41
+ | `removeHandler` | `MouseClickHandler` | `null` | Callback when remove icon is clicked |
42
+ | `color` | `string` | `null` | Color theme (1-12) |
43
+ | `style` | `string` | `""` | Additional CSS styles |
44
+ | `class` | `string` | `""` | CSS class name |
45
+
46
+ ## Examples
47
+
48
+ ### Basic Tags
49
+
50
+ ```svelte
51
+ <script>
52
+ import Tag from "@ticatec/uniface-element/Tag";
53
+ </script>
54
+
55
+ <div class="tag-demo">
56
+ <h3>Basic Tags</h3>
57
+ <div class="tag-group">
58
+ <Tag text="Default" />
59
+ <Tag text="Technology" />
60
+ <Tag text="Design" />
61
+ <Tag text="Development" />
62
+ </div>
63
+ </div>
64
+
65
+ <style>
66
+ .tag-demo {
67
+ margin: 20px;
68
+ }
69
+
70
+ .tag-group {
71
+ display: flex;
72
+ gap: 8px;
73
+ flex-wrap: wrap;
74
+ }
75
+ </style>
76
+ ```
77
+
78
+ ### Different Sizes
79
+
80
+ ```svelte
81
+ <script>
82
+ import Tag from "@ticatec/uniface-element/Tag";
83
+ </script>
84
+
85
+ <div class="size-demo">
86
+ <h3>Tag Sizes</h3>
87
+
88
+ <div class="size-section">
89
+ <h4>Small Tags</h4>
90
+ <div class="tag-group">
91
+ <Tag text="Small Tag" size="small" />
92
+ <Tag text="Category" size="small" color="1" />
93
+ <Tag text="Label" size="small" color="2" />
94
+ </div>
95
+ </div>
96
+
97
+ <div class="size-section">
98
+ <h4>Medium Tags (Default)</h4>
99
+ <div class="tag-group">
100
+ <Tag text="Medium Tag" size="middle" />
101
+ <Tag text="Category" size="middle" color="1" />
102
+ <Tag text="Label" size="middle" color="2" />
103
+ </div>
104
+ </div>
105
+
106
+ <div class="size-section">
107
+ <h4>Large Tags</h4>
108
+ <div class="tag-group">
109
+ <Tag text="Large Tag" size="big" />
110
+ <Tag text="Category" size="big" color="1" />
111
+ <Tag text="Label" size="big" color="2" />
112
+ </div>
113
+ </div>
114
+ </div>
115
+
116
+ <style>
117
+ .size-demo {
118
+ margin: 20px;
119
+ }
120
+
121
+ .size-section {
122
+ margin-bottom: 20px;
123
+ }
124
+
125
+ .size-section h4 {
126
+ margin: 12px 0 8px 0;
127
+ font-size: 14px;
128
+ color: #666;
129
+ }
130
+
131
+ .tag-group {
132
+ display: flex;
133
+ gap: 8px;
134
+ flex-wrap: wrap;
135
+ align-items: center;
136
+ }
137
+ </style>
138
+ ```
139
+
140
+ ### Different Variants
141
+
142
+ ```svelte
143
+ <script>
144
+ import Tag from "@ticatec/uniface-element/Tag";
145
+ </script>
146
+
147
+ <div class="variant-demo">
148
+ <h3>Tag Variants</h3>
149
+
150
+ <div class="variant-section">
151
+ <h4>Border Variant (Default)</h4>
152
+ <div class="tag-group">
153
+ <Tag text="Border Tag" variant="border" />
154
+ <Tag text="JavaScript" variant="border" color="1" />
155
+ <Tag text="React" variant="border" color="2" />
156
+ <Tag text="Vue" variant="border" color="3" />
157
+ </div>
158
+ </div>
159
+
160
+ <div class="variant-section">
161
+ <h4>Round Variant</h4>
162
+ <div class="tag-group">
163
+ <Tag text="Round Tag" variant="round" />
164
+ <Tag text="JavaScript" variant="round" color="1" />
165
+ <Tag text="React" variant="round" color="2" />
166
+ <Tag text="Vue" variant="round" color="3" />
167
+ </div>
168
+ </div>
169
+
170
+ <div class="variant-section">
171
+ <h4>Borderless Variant</h4>
172
+ <div class="tag-group">
173
+ <Tag text="Borderless Tag" variant="borderless" />
174
+ <Tag text="JavaScript" variant="borderless" color="1" />
175
+ <Tag text="React" variant="borderless" color="2" />
176
+ <Tag text="Vue" variant="borderless" color="3" />
177
+ </div>
178
+ </div>
179
+ </div>
180
+
181
+ <style>
182
+ .variant-demo {
183
+ margin: 20px;
184
+ }
185
+
186
+ .variant-section {
187
+ margin-bottom: 20px;
188
+ }
189
+
190
+ .variant-section h4 {
191
+ margin: 12px 0 8px 0;
192
+ font-size: 14px;
193
+ color: #666;
194
+ }
195
+
196
+ .tag-group {
197
+ display: flex;
198
+ gap: 8px;
199
+ flex-wrap: wrap;
200
+ }
201
+ </style>
202
+ ```
203
+
204
+ ### Color Themes
205
+
206
+ ```svelte
207
+ <script>
208
+ import Tag from "@ticatec/uniface-element/Tag";
209
+
210
+ const colorThemes = [
211
+ { color: "1", name: "Blue", description: "Primary actions" },
212
+ { color: "2", name: "Green", description: "Success states" },
213
+ { color: "3", name: "Red", description: "Error states" },
214
+ { color: "4", name: "Yellow", description: "Warning states" },
215
+ { color: "5", name: "Pink", description: "Highlights" },
216
+ { color: "6", name: "Cyan", description: "Information" },
217
+ { color: "7", name: "Orange", description: "Alerts" },
218
+ { color: "8", name: "Amber", description: "Pending states" },
219
+ { color: "9", name: "Indigo", description: "Navigation" },
220
+ { color: "10", name: "Purple", description: "Creative" },
221
+ { color: "11", name: "Lime", description: "Fresh content" },
222
+ { color: "12", name: "Gray", description: "Neutral" }
223
+ ];
224
+ </script>
225
+
226
+ <div class="color-demo">
227
+ <h3>Color Themes</h3>
228
+
229
+ <div class="color-grid">
230
+ {#each colorThemes as theme}
231
+ <div class="color-item">
232
+ <Tag text={theme.name} color={theme.color} />
233
+ <p class="color-description">{theme.description}</p>
234
+ </div>
235
+ {/each}
236
+ </div>
237
+
238
+ <h4>All Variants with Color</h4>
239
+ <div class="variant-comparison">
240
+ <div class="variant-row">
241
+ <span class="variant-label">Border:</span>
242
+ <Tag text="Technology" variant="border" color="1" />
243
+ <Tag text="Design" variant="border" color="2" />
244
+ <Tag text="Marketing" variant="border" color="3" />
245
+ </div>
246
+
247
+ <div class="variant-row">
248
+ <span class="variant-label">Round:</span>
249
+ <Tag text="Technology" variant="round" color="1" />
250
+ <Tag text="Design" variant="round" color="2" />
251
+ <Tag text="Marketing" variant="round" color="3" />
252
+ </div>
253
+
254
+ <div class="variant-row">
255
+ <span class="variant-label">Borderless:</span>
256
+ <Tag text="Technology" variant="borderless" color="1" />
257
+ <Tag text="Design" variant="borderless" color="2" />
258
+ <Tag text="Marketing" variant="borderless" color="3" />
259
+ </div>
260
+ </div>
261
+ </div>
262
+
263
+ <style>
264
+ .color-demo {
265
+ margin: 20px;
266
+ }
267
+
268
+ .color-grid {
269
+ display: grid;
270
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
271
+ gap: 16px;
272
+ margin-bottom: 24px;
273
+ }
274
+
275
+ .color-item {
276
+ text-align: center;
277
+ }
278
+
279
+ .color-description {
280
+ margin: 8px 0 0 0;
281
+ font-size: 12px;
282
+ color: #666;
283
+ }
284
+
285
+ .variant-comparison h4 {
286
+ margin: 20px 0 12px 0;
287
+ }
288
+
289
+ .variant-row {
290
+ display: flex;
291
+ align-items: center;
292
+ gap: 12px;
293
+ margin: 8px 0;
294
+ }
295
+
296
+ .variant-label {
297
+ min-width: 80px;
298
+ font-size: 14px;
299
+ color: #666;
300
+ }
301
+ </style>
302
+ ```
303
+
304
+ ### Removable Tags
305
+
306
+ ```svelte
307
+ <script>
308
+ import Tag from "@ticatec/uniface-element/Tag";
309
+
310
+ let tags = [
311
+ { id: 1, text: "JavaScript", color: "1" },
312
+ { id: 2, text: "React", color: "2" },
313
+ { id: 3, text: "Vue.js", color: "3" },
314
+ { id: 4, text: "Angular", color: "4" },
315
+ { id: 5, text: "Svelte", color: "5" }
316
+ ];
317
+
318
+ function removeTag(tagId) {
319
+ tags = tags.filter(tag => tag.id !== tagId);
320
+ }
321
+
322
+ function addTag() {
323
+ const newTagText = prompt("Enter tag name:");
324
+ if (newTagText) {
325
+ const newTag = {
326
+ id: Date.now(),
327
+ text: newTagText,
328
+ color: String(Math.floor(Math.random() * 12) + 1)
329
+ };
330
+ tags = [...tags, newTag];
331
+ }
332
+ }
333
+ </script>
334
+
335
+ <div class="removable-demo">
336
+ <h3>Removable Tags</h3>
337
+ <p>Hover over tags to see the remove icon</p>
338
+
339
+ <div class="tag-container">
340
+ {#each tags as tag}
341
+ <Tag
342
+ text={tag.text}
343
+ color={tag.color}
344
+ removable={true}
345
+ removeHandler={() => removeTag(tag.id)}
346
+ />
347
+ {/each}
348
+
349
+ <button class="add-tag-btn" on:click={addTag}>+ Add Tag</button>
350
+ </div>
351
+
352
+ <div class="tag-count">
353
+ Total tags: {tags.length}
354
+ </div>
355
+ </div>
356
+
357
+ <style>
358
+ .removable-demo {
359
+ margin: 20px;
360
+ max-width: 600px;
361
+ }
362
+
363
+ .removable-demo p {
364
+ margin: 8px 0 16px 0;
365
+ color: #666;
366
+ font-size: 14px;
367
+ }
368
+
369
+ .tag-container {
370
+ display: flex;
371
+ gap: 8px;
372
+ flex-wrap: wrap;
373
+ align-items: center;
374
+ margin-bottom: 16px;
375
+ }
376
+
377
+ .add-tag-btn {
378
+ padding: 4px 12px;
379
+ border: 2px dashed #ccc;
380
+ background: transparent;
381
+ border-radius: 4px;
382
+ cursor: pointer;
383
+ font-size: 12px;
384
+ color: #666;
385
+ line-height: 20px;
386
+ }
387
+
388
+ .add-tag-btn:hover {
389
+ border-color: #007bff;
390
+ color: #007bff;
391
+ }
392
+
393
+ .tag-count {
394
+ font-size: 14px;
395
+ color: #666;
396
+ }
397
+ </style>
398
+ ```
399
+
400
+ ### Status Tags
401
+
402
+ ```svelte
403
+ <script>
404
+ import Tag from "@ticatec/uniface-element/Tag";
405
+
406
+ const statusItems = [
407
+ { name: "Active Users", status: "online", color: "2", count: 1240 },
408
+ { name: "Pending Orders", status: "pending", color: "4", count: 45 },
409
+ { name: "Failed Requests", status: "error", color: "3", count: 12 },
410
+ { name: "Completed Tasks", status: "success", color: "2", count: 89 },
411
+ { name: "In Review", status: "review", color: "1", count: 23 },
412
+ { name: "Draft Posts", status: "draft", color: "12", count: 7 }
413
+ ];
414
+ </script>
415
+
416
+ <div class="status-demo">
417
+ <h3>Status Indicators</h3>
418
+
419
+ <div class="status-grid">
420
+ {#each statusItems as item}
421
+ <div class="status-item">
422
+ <div class="status-header">
423
+ <span class="status-name">{item.name}</span>
424
+ <Tag text={item.status} color={item.color} size="small" variant="round" removable={false} />
425
+ </div>
426
+ <div class="status-count">{item.count}</div>
427
+ </div>
428
+ {/each}
429
+ </div>
430
+ </div>
431
+
432
+ <style>
433
+ .status-demo {
434
+ margin: 20px;
435
+ }
436
+
437
+ .status-grid {
438
+ display: grid;
439
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
440
+ gap: 16px;
441
+ }
442
+
443
+ .status-item {
444
+ padding: 16px;
445
+ border: 1px solid #eee;
446
+ border-radius: 8px;
447
+ background: #fafafa;
448
+ }
449
+
450
+ .status-header {
451
+ display: flex;
452
+ justify-content: space-between;
453
+ align-items: center;
454
+ margin-bottom: 8px;
455
+ }
456
+
457
+ .status-name {
458
+ font-size: 14px;
459
+ color: #333;
460
+ }
461
+
462
+ .status-count {
463
+ font-size: 24px;
464
+ font-weight: bold;
465
+ color: #333;
466
+ }
467
+ </style>
468
+ ```
469
+
470
+ ### Tag Input Component
471
+
472
+ ```svelte
473
+ <script>
474
+ import Tag from "@ticatec/uniface-element/Tag";
475
+
476
+ let inputTags = ["frontend", "javascript"];
477
+ let inputValue = "";
478
+
479
+ function addTag(event) {
480
+ if (event.key === 'Enter' && inputValue.trim()) {
481
+ const newTag = inputValue.trim().toLowerCase();
482
+ if (!inputTags.includes(newTag)) {
483
+ inputTags = [...inputTags, newTag];
484
+ }
485
+ inputValue = "";
486
+ }
487
+ }
488
+
489
+ function removeInputTag(tagToRemove) {
490
+ inputTags = inputTags.filter(tag => tag !== tagToRemove);
491
+ }
492
+
493
+ function clearAllTags() {
494
+ inputTags = [];
495
+ }
496
+ </script>
497
+
498
+ <div class="tag-input-demo">
499
+ <h3>Tag Input Component</h3>
500
+
501
+ <div class="tag-input-container">
502
+ <label for="tag-input">Skills:</label>
503
+ <div class="input-wrapper">
504
+ <div class="tag-display">
505
+ {#each inputTags as tag, index}
506
+ <Tag
507
+ text={tag}
508
+ color={String((index % 12) + 1)}
509
+ size="small"
510
+ variant="round"
511
+ removable={true}
512
+ removeHandler={() => removeInputTag(tag)}
513
+ />
514
+ {/each}
515
+
516
+ <input
517
+ id="tag-input"
518
+ type="text"
519
+ bind:value={inputValue}
520
+ on:keydown={addTag}
521
+ placeholder={inputTags.length === 0 ? "Type and press Enter to add tags" : "Add more..."}
522
+ class="tag-input"
523
+ />
524
+ </div>
525
+
526
+ <div class="input-actions">
527
+ <button on:click={clearAllTags} disabled={inputTags.length === 0}>
528
+ Clear All
529
+ </button>
530
+ </div>
531
+ </div>
532
+
533
+ <div class="tag-suggestions">
534
+ <span class="suggestions-label">Suggestions:</span>
535
+ {#each ["react", "vue", "angular", "svelte", "typescript"] as suggestion}
536
+ <button
537
+ class="suggestion-btn"
538
+ on:click={() => {
539
+ if (!inputTags.includes(suggestion)) {
540
+ inputTags = [...inputTags, suggestion];
541
+ }
542
+ }}
543
+ disabled={inputTags.includes(suggestion)}
544
+ >
545
+ {suggestion}
546
+ </button>
547
+ {/each}
548
+ </div>
549
+ </div>
550
+
551
+ <div class="output">
552
+ <h4>Current Tags:</h4>
553
+ <pre>{JSON.stringify(inputTags, null, 2)}</pre>
554
+ </div>
555
+ </div>
556
+
557
+ <style>
558
+ .tag-input-demo {
559
+ margin: 20px;
560
+ max-width: 600px;
561
+ }
562
+
563
+ .tag-input-container {
564
+ border: 1px solid #ddd;
565
+ border-radius: 8px;
566
+ padding: 16px;
567
+ background: #fafafa;
568
+ }
569
+
570
+ .tag-input-container label {
571
+ display: block;
572
+ margin-bottom: 8px;
573
+ font-weight: 500;
574
+ }
575
+
576
+ .input-wrapper {
577
+ display: flex;
578
+ gap: 12px;
579
+ align-items: flex-start;
580
+ }
581
+
582
+ .tag-display {
583
+ flex: 1;
584
+ display: flex;
585
+ flex-wrap: wrap;
586
+ gap: 6px;
587
+ align-items: center;
588
+ min-height: 32px;
589
+ padding: 8px;
590
+ border: 1px solid #ccc;
591
+ border-radius: 4px;
592
+ background: white;
593
+ }
594
+
595
+ .tag-input {
596
+ border: none;
597
+ outline: none;
598
+ flex: 1;
599
+ min-width: 120px;
600
+ font-size: 14px;
601
+ }
602
+
603
+ .tag-input::placeholder {
604
+ color: #999;
605
+ }
606
+
607
+ .input-actions button {
608
+ padding: 8px 12px;
609
+ border: 1px solid #dc3545;
610
+ background: white;
611
+ color: #dc3545;
612
+ border-radius: 4px;
613
+ cursor: pointer;
614
+ font-size: 12px;
615
+ }
616
+
617
+ .input-actions button:hover:not(:disabled) {
618
+ background: #dc3545;
619
+ color: white;
620
+ }
621
+
622
+ .input-actions button:disabled {
623
+ opacity: 0.5;
624
+ cursor: not-allowed;
625
+ }
626
+
627
+ .tag-suggestions {
628
+ margin-top: 12px;
629
+ display: flex;
630
+ gap: 6px;
631
+ align-items: center;
632
+ flex-wrap: wrap;
633
+ }
634
+
635
+ .suggestions-label {
636
+ font-size: 12px;
637
+ color: #666;
638
+ margin-right: 8px;
639
+ }
640
+
641
+ .suggestion-btn {
642
+ padding: 4px 8px;
643
+ border: 1px solid #007bff;
644
+ background: white;
645
+ color: #007bff;
646
+ border-radius: 12px;
647
+ cursor: pointer;
648
+ font-size: 11px;
649
+ }
650
+
651
+ .suggestion-btn:hover:not(:disabled) {
652
+ background: #007bff;
653
+ color: white;
654
+ }
655
+
656
+ .suggestion-btn:disabled {
657
+ opacity: 0.5;
658
+ cursor: not-allowed;
659
+ }
660
+
661
+ .output {
662
+ margin-top: 20px;
663
+ padding: 16px;
664
+ background: #f8f9fa;
665
+ border-radius: 4px;
666
+ }
667
+
668
+ .output h4 {
669
+ margin: 0 0 8px 0;
670
+ }
671
+
672
+ .output pre {
673
+ margin: 0;
674
+ font-size: 12px;
675
+ }
676
+ </style>
677
+ ```
678
+
679
+ ### Tag Categories
680
+
681
+ ```svelte
682
+ <script>
683
+ import Tag from "@ticatec/uniface-element/Tag";
684
+
685
+ const categories = [
686
+ {
687
+ name: "Technologies",
688
+ color: "1",
689
+ tags: ["JavaScript", "TypeScript", "Python", "React", "Vue.js"]
690
+ },
691
+ {
692
+ name: "Skills",
693
+ color: "2",
694
+ tags: ["Frontend", "Backend", "DevOps", "UI/UX", "Testing"]
695
+ },
696
+ {
697
+ name: "Interests",
698
+ color: "3",
699
+ tags: ["Open Source", "AI/ML", "Web3", "Mobile", "Gaming"]
700
+ },
701
+ {
702
+ name: "Tools",
703
+ color: "4",
704
+ tags: ["VS Code", "Git", "Docker", "AWS", "Figma"]
705
+ }
706
+ ];
707
+
708
+ let selectedTags = [];
709
+
710
+ function toggleTag(tag) {
711
+ if (selectedTags.includes(tag)) {
712
+ selectedTags = selectedTags.filter(t => t !== tag);
713
+ } else {
714
+ selectedTags = [...selectedTags, tag];
715
+ }
716
+ }
717
+ </script>
718
+
719
+ <div class="category-demo">
720
+ <h3>Tag Categories</h3>
721
+
722
+ <div class="categories">
723
+ {#each categories as category}
724
+ <div class="category-section">
725
+ <div class="category-header">
726
+ <Tag text={category.name} color={category.color} removable={false} variant="round" />
727
+ <span class="tag-count">({category.tags.length})</span>
728
+ </div>
729
+
730
+ <div class="category-tags">
731
+ {#each category.tags as tag}
732
+ <button
733
+ class="tag-button"
734
+ class:selected={selectedTags.includes(tag)}
735
+ on:click={() => toggleTag(tag)}
736
+ >
737
+ <Tag
738
+ text={tag}
739
+ color={selectedTags.includes(tag) ? category.color : "12"}
740
+ size="small"
741
+ removable={false}
742
+ />
743
+ </button>
744
+ {/each}
745
+ </div>
746
+ </div>
747
+ {/each}
748
+ </div>
749
+
750
+ <div class="selected-summary">
751
+ <h4>Selected Tags ({selectedTags.length})</h4>
752
+ <div class="selected-tags">
753
+ {#each selectedTags as tag}
754
+ <Tag
755
+ text={tag}
756
+ color="1"
757
+ size="small"
758
+ variant="round"
759
+ removable={true}
760
+ removeHandler={() => toggleTag(tag)}
761
+ />
762
+ {/each}
763
+ </div>
764
+ </div>
765
+ </div>
766
+
767
+ <style>
768
+ .category-demo {
769
+ margin: 20px;
770
+ max-width: 800px;
771
+ }
772
+
773
+ .categories {
774
+ display: grid;
775
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
776
+ gap: 20px;
777
+ margin-bottom: 24px;
778
+ }
779
+
780
+ .category-section {
781
+ padding: 16px;
782
+ border: 1px solid #eee;
783
+ border-radius: 8px;
784
+ background: #fafafa;
785
+ }
786
+
787
+ .category-header {
788
+ display: flex;
789
+ align-items: center;
790
+ gap: 8px;
791
+ margin-bottom: 12px;
792
+ }
793
+
794
+ .tag-count {
795
+ font-size: 12px;
796
+ color: #666;
797
+ }
798
+
799
+ .category-tags {
800
+ display: flex;
801
+ flex-wrap: wrap;
802
+ gap: 6px;
803
+ }
804
+
805
+ .tag-button {
806
+ border: none;
807
+ background: none;
808
+ padding: 0;
809
+ cursor: pointer;
810
+ border-radius: 4px;
811
+ }
812
+
813
+ .tag-button:hover {
814
+ transform: translateY(-1px);
815
+ }
816
+
817
+ .tag-button.selected {
818
+ transform: scale(1.05);
819
+ }
820
+
821
+ .selected-summary {
822
+ padding: 16px;
823
+ background: #f8f9fa;
824
+ border-radius: 8px;
825
+ border-left: 4px solid #007bff;
826
+ }
827
+
828
+ .selected-summary h4 {
829
+ margin: 0 0 12px 0;
830
+ color: #333;
831
+ }
832
+
833
+ .selected-tags {
834
+ display: flex;
835
+ flex-wrap: wrap;
836
+ gap: 6px;
837
+ }
838
+ </style>
839
+ ```
840
+
841
+ ## Features
842
+
843
+ - **Multiple Variants**: Border, round, and borderless styles
844
+ - **Size Options**: Small, medium, and large sizes
845
+ - **Color Themes**: 12 predefined color themes with semantic meanings
846
+ - **Removable Functionality**: Optional remove icon with hover interaction
847
+ - **Flexible Styling**: Custom CSS classes and inline styles support
848
+ - **Responsive Design**: Adapts to different screen sizes
849
+ - **Hover Effects**: Interactive remove icon on hover
850
+
851
+ ## Color Theme Reference
852
+
853
+ | Color | Theme | Use Case |
854
+ |-------|-------|----------|
855
+ | 1 | Blue | Primary actions, links, navigation |
856
+ | 2 | Green | Success states, completed actions |
857
+ | 3 | Red | Error states, critical alerts |
858
+ | 4 | Yellow | Warning states, caution |
859
+ | 5 | Pink | Highlights, special features |
860
+ | 6 | Cyan | Information, tips |
861
+ | 7 | Orange | Alerts, notifications |
862
+ | 8 | Amber | Pending states, in progress |
863
+ | 9 | Indigo | Navigation, secondary actions |
864
+ | 10 | Purple | Creative content, premium features |
865
+ | 11 | Lime | Fresh content, new items |
866
+ | 12 | Gray | Neutral, default states |
867
+
868
+ ## Styling
869
+
870
+ The Tag component uses CSS custom properties for theming:
871
+
872
+ ```css
873
+ :root {
874
+ --uniface-default-text-color: #374151;
875
+ --uniface-primary-border-color: #E2E8F0;
876
+ }
877
+
878
+ /* Custom tag styles */
879
+ .uniface-tag {
880
+ /* Container styles */
881
+ }
882
+
883
+ .uniface-tag > div {
884
+ /* Tag content styles */
885
+ }
886
+
887
+ .uniface-tag .uniface-remove-icon {
888
+ /* Remove icon styles */
889
+ }
890
+ ```
891
+
892
+ ## Accessibility
893
+
894
+ - Proper semantic HTML structure
895
+ - Keyboard navigation support for remove functionality
896
+ - High contrast color themes
897
+ - Screen reader compatible
898
+ - Focus indicators for interactive elements
899
+
900
+ ## Best Practices
901
+
902
+ 1. **Color Usage**: Use colors consistently across your application
903
+ 2. **Removable Tags**: Always provide clear feedback when tags are removed
904
+ 3. **Tag Limits**: Consider limiting the number of tags for better UX
905
+ 4. **Responsive Design**: Test tag layouts on different screen sizes
906
+ 5. **Semantic Meaning**: Use color themes that match their semantic meaning
907
+ 6. **Performance**: For large lists, consider virtualization
908
+
909
+ ## Browser Support
910
+
911
+ - Modern browsers with CSS custom properties support
912
+ - Compatible with Svelte 5+
913
+ - Hover and focus interactions
914
+ - Flexbox layout support
915
+ - Full TypeScript support
916
+
917
+ ## Related Components
918
+
919
+ - `Chip` - Interactive chip component with actions
920
+ - `Badge` - Small status indicators
921
+ - `Label` - Form field labels
922
+ - `Button` - Interactive button component