@kubex/zinc 1.0.25 → 1.0.99

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 (199) hide show
  1. package/.claude/project.md +556 -0
  2. package/.github/workflows/js_build_and_deploy.yaml +9 -10
  3. package/dist/custom-elements.json +13575 -8856
  4. package/dist/vscode.html-custom-data.json +583 -48
  5. package/dist/web-types.json +1441 -181
  6. package/dist/zn.d.ts +1645 -660
  7. package/dist/zn.min.css +1 -1
  8. package/dist/zn.min.js +1412 -893
  9. package/docs/_utilities/code-previews.cjs +10 -1
  10. package/docs/assets/scripts/docs.js +42 -18
  11. package/docs/data/data-table.json +229 -66
  12. package/docs/data/empty.json +6 -0
  13. package/docs/data/products-table.json +41 -193
  14. package/docs/pages/components/action-bar.md +121 -6
  15. package/docs/pages/components/alert.md +118 -15
  16. package/docs/pages/components/animated-button.md +299 -0
  17. package/docs/pages/components/audio-select.md +534 -0
  18. package/docs/pages/components/bulk-actions.md +79 -5
  19. package/docs/pages/components/button-group.md +235 -27
  20. package/docs/pages/components/button.md +139 -1
  21. package/docs/pages/components/chart.md +365 -9
  22. package/docs/pages/components/checkbox.md +387 -58
  23. package/docs/pages/components/chip.md +253 -33
  24. package/docs/pages/components/collapsible.md +393 -46
  25. package/docs/pages/components/cols.md +152 -30
  26. package/docs/pages/components/confirm.md +182 -16
  27. package/docs/pages/components/copy-button.md +169 -6
  28. package/docs/pages/components/data-select.md +194 -15
  29. package/docs/pages/components/data-table-filter.md +96 -5
  30. package/docs/pages/components/data-table-search.md +451 -0
  31. package/docs/pages/components/data-table-sort.md +66 -5
  32. package/docs/pages/components/data-table.md +727 -66
  33. package/docs/pages/components/datepicker.md +402 -7
  34. package/docs/pages/components/defined-label.md +120 -5
  35. package/docs/pages/components/dialog.md +339 -59
  36. package/docs/pages/components/dropdown.md +366 -11
  37. package/docs/pages/components/editor.md +604 -7
  38. package/docs/pages/components/empty-state.md +315 -16
  39. package/docs/pages/components/expanding-action.md +212 -28
  40. package/docs/pages/components/file.md +421 -12
  41. package/docs/pages/components/filter-container.md +158 -5
  42. package/docs/pages/components/filter-wrapper.md +167 -6
  43. package/docs/pages/components/form-group.md +383 -6
  44. package/docs/pages/components/hover-container.md +237 -6
  45. package/docs/pages/components/icon-picker.md +121 -0
  46. package/docs/pages/components/icon.md +454 -48
  47. package/docs/pages/components/inline-edit.md +787 -19
  48. package/docs/pages/components/input-group.md +207 -13
  49. package/docs/pages/components/input.md +194 -0
  50. package/docs/pages/components/item.md +18 -0
  51. package/docs/pages/components/key-container.md +115 -0
  52. package/docs/pages/components/key.md +101 -0
  53. package/docs/pages/components/menu.md +512 -6
  54. package/docs/pages/components/note.md +239 -36
  55. package/docs/pages/components/opt-group.md +107 -0
  56. package/docs/pages/components/pagination.md +332 -6
  57. package/docs/pages/components/pane.md +222 -6
  58. package/docs/pages/components/panel.md +213 -26
  59. package/docs/pages/components/popup.md +1354 -6
  60. package/docs/pages/components/priority-list.md +233 -0
  61. package/docs/pages/components/progress-bar.md +387 -6
  62. package/docs/pages/components/radio-group.md +242 -5
  63. package/docs/pages/components/radio.md +474 -6
  64. package/docs/pages/components/rating.md +331 -7
  65. package/docs/pages/components/reveal.md +524 -6
  66. package/docs/pages/components/scroll-container.md +552 -6
  67. package/docs/pages/components/select.md +762 -160
  68. package/docs/pages/components/skeleton.md +473 -30
  69. package/docs/pages/components/slideout.md +261 -5
  70. package/docs/pages/components/sp.md +99 -41
  71. package/docs/pages/components/split-button.md +347 -9
  72. package/docs/pages/components/split-pane.md +445 -6
  73. package/docs/pages/components/stat.md +549 -9
  74. package/docs/pages/components/status-indicator.md +230 -1
  75. package/docs/pages/components/stepper.md +563 -6
  76. package/docs/pages/components/tabs.md +439 -13
  77. package/docs/pages/components/textarea.md +415 -17
  78. package/docs/pages/components/tile.md +385 -26
  79. package/docs/pages/components/toggle.md +424 -6
  80. package/docs/pages/components/tooltip.md +367 -0
  81. package/docs/pages/components/translation-group.md +210 -0
  82. package/docs/pages/components/translations.md +319 -19
  83. package/docs/pages/components/vertical-stepper.md +401 -8
  84. package/docs/pages/components/well.md +300 -3
  85. package/docs/pages/getting-started/form-controls.md +162 -0
  86. package/docs/pages/index.md +116 -15
  87. package/package.json +5 -6
  88. package/scss/_global-spacing.scss +4 -0
  89. package/scss/_root.scss +2 -2
  90. package/scss/boot.scss +19 -0
  91. package/scss/shared/layout.scss +5 -0
  92. package/scss/themes/_light.scss +3 -3
  93. package/src/components/alert/alert.scss +1 -0
  94. package/src/components/animated-button/README.md +306 -0
  95. package/src/components/animated-button/animated-button.component.ts +229 -0
  96. package/src/components/animated-button/animated-button.scss +228 -0
  97. package/src/components/animated-button/animated-button.test.ts +143 -0
  98. package/src/components/animated-button/index.ts +12 -0
  99. package/src/components/button/button.component.ts +5 -0
  100. package/src/components/button-group/button-group.component.ts +25 -13
  101. package/src/components/button-group/button-group.scss +6 -0
  102. package/src/components/checkbox/checkbox.component.ts +4 -0
  103. package/src/components/checkbox/checkbox.scss +7 -4
  104. package/src/components/checkbox-group/checkbox-group.scss +7 -0
  105. package/src/components/chip/chip.component.ts +7 -2
  106. package/src/components/chip/chip.scss +16 -2
  107. package/src/components/collapsible/collapsible.component.ts +27 -20
  108. package/src/components/cols/cols.component.ts +14 -2
  109. package/src/components/cols/cols.scss +6 -12
  110. package/src/components/confirm/confirm.component.ts +7 -0
  111. package/src/components/copy-button/copy-button.component.ts +12 -11
  112. package/src/components/data-select/data-select.component.ts +215 -44
  113. package/src/components/data-select/data-select.scss +66 -6
  114. package/src/components/data-select/providers/currency-data-provider.ts +20 -6
  115. package/src/components/data-select/providers/provider.ts +1 -0
  116. package/src/components/data-select/providers/us-state-data-provider.ts +68 -0
  117. package/src/components/data-table/data-table.component.ts +81 -22
  118. package/src/components/data-table-search/data-table-search.component.ts +184 -0
  119. package/src/components/data-table-search/data-table-search.scss +17 -0
  120. package/src/components/data-table-search/data-table-search.test.ts +11 -0
  121. package/src/components/data-table-search/index.ts +12 -0
  122. package/src/components/datepicker/datepicker.component.ts +347 -13
  123. package/src/components/dialog/dialog.component.ts +1 -1
  124. package/src/components/empty-state/empty-state.scss +6 -1
  125. package/src/components/header/header.scss +3 -3
  126. package/src/components/icon/icon.component.ts +23 -1
  127. package/src/components/icon/icon.scss +23 -0
  128. package/src/components/icon-picker/brand-icons.ts +24 -0
  129. package/src/components/icon-picker/icon-picker.component.ts +407 -0
  130. package/src/components/icon-picker/icon-picker.scss +205 -0
  131. package/src/components/icon-picker/index.ts +12 -0
  132. package/src/components/icon-picker/line-icons.ts +612 -0
  133. package/src/components/icon-picker/material-icons.ts +14543 -0
  134. package/src/components/inline-edit/inline-edit.component.ts +190 -46
  135. package/src/components/inline-edit/inline-edit.scss +29 -0
  136. package/src/components/inline-edit/inline-edit.test.ts +314 -1
  137. package/src/components/input/input.component.ts +324 -5
  138. package/src/components/input/input.scss +87 -0
  139. package/src/components/input-group/input-group.component.ts +28 -7
  140. package/src/components/input-group/input-group.scss +48 -10
  141. package/src/components/item/item.component.ts +24 -3
  142. package/src/components/item/item.scss +18 -0
  143. package/src/components/key/index.ts +12 -0
  144. package/src/components/key/key.component.ts +47 -0
  145. package/src/components/key/key.scss +38 -0
  146. package/src/components/key-container/index.ts +12 -0
  147. package/src/components/key-container/key-container.component.ts +142 -0
  148. package/src/components/key-container/key-container.scss +33 -0
  149. package/src/components/menu-item/menu-item.component.ts +20 -0
  150. package/src/components/menu-item/menu-item.scss +69 -2
  151. package/src/components/navbar/navbar.component.ts +103 -11
  152. package/src/components/navbar/navbar.scss +6 -1
  153. package/src/components/opt-group/index.ts +12 -0
  154. package/src/components/opt-group/opt-group.component.ts +74 -0
  155. package/src/components/opt-group/opt-group.scss +37 -0
  156. package/src/components/opt-group/opt-group.test.ts +27 -0
  157. package/src/components/option/option.component.ts +1 -16
  158. package/src/components/option/option.scss +4 -0
  159. package/src/components/panel/panel.component.ts +10 -8
  160. package/src/components/panel/panel.scss +20 -0
  161. package/src/components/priority-list/index.ts +12 -0
  162. package/src/components/priority-list/priority-list.component.ts +611 -0
  163. package/src/components/priority-list/priority-list.scss +185 -0
  164. package/src/components/priority-list/priority-list.test.ts +139 -0
  165. package/src/components/progress-bar/progress-bar.component.ts +22 -16
  166. package/src/components/radio/radio.scss +10 -3
  167. package/src/components/select/select.component.ts +812 -72
  168. package/src/components/select/select.scss +108 -2
  169. package/src/components/select/select.test.ts +147 -2
  170. package/src/components/settings-container/settings-container.component.ts +44 -19
  171. package/src/components/settings-container/settings-container.scss +1 -1
  172. package/src/components/skeleton/skeleton.component.ts +6 -1
  173. package/src/components/slideout/slideout.scss +8 -3
  174. package/src/components/sp/sp.component.ts +3 -1
  175. package/src/components/sp/sp.scss +19 -0
  176. package/src/components/stepper/stepper.component.ts +16 -10
  177. package/src/components/textarea/textarea.scss +0 -4
  178. package/src/components/tile/tile.component.ts +12 -3
  179. package/src/components/tile/tile.scss +1 -1
  180. package/src/components/timer/timer.component.ts +15 -2
  181. package/src/components/toggle/toggle.component.ts +29 -26
  182. package/src/components/toggle/toggle.scss +13 -1
  183. package/src/components/translation-group/index.ts +12 -0
  184. package/src/components/translation-group/translation-group.component.ts +207 -0
  185. package/src/components/translation-group/translation-group.scss +8 -0
  186. package/src/components/translations/translations.component.ts +90 -44
  187. package/src/components/translations/translations.scss +4 -0
  188. package/src/components/vertical-stepper/vertical-stepper.component.ts +14 -9
  189. package/src/events/events.ts +12 -7
  190. package/src/events/zn-language-change.ts +7 -0
  191. package/src/events/zn-purchase.ts +11 -0
  192. package/src/events/zn-redirect.ts +7 -0
  193. package/src/events/zn-reorder.ts +7 -0
  194. package/src/events/zn-search-change.ts +11 -0
  195. package/src/events/zn-submit.ts +1 -1
  196. package/src/form-control.scss +4 -0
  197. package/src/internal/form-navigation.ts +510 -0
  198. package/src/internal/form.ts +6 -0
  199. package/src/zinc.ts +91 -83
@@ -0,0 +1,233 @@
1
+ ---
2
+ meta:
3
+ title: Priority List
4
+ description: Priority lists allow users to reorder items via drag-and-drop or keyboard, assigning a numerical priority to each position.
5
+ layout: component
6
+ ---
7
+
8
+ ## Examples
9
+
10
+ ### Basic Priority List
11
+
12
+ Use the `label` attribute to give the list an accessible label. Each child element must have a `value` attribute that
13
+ uniquely identifies it.
14
+
15
+ ```html:preview
16
+ <zn-priority-list label="Task Priority">
17
+ <div value="bug-fixes">Bug Fixes</div>
18
+ <div value="new-features">New Features</div>
19
+ <div value="documentation">Documentation</div>
20
+ <div value="testing">Testing</div>
21
+ </zn-priority-list>
22
+ ```
23
+
24
+ :::tip
25
+ This component works with standard `<form>` elements. Please refer to the section
26
+ on [form controls](/getting-started/form-controls) to learn more about form submission and client-side validation.
27
+ :::
28
+
29
+ ### Help Text
30
+
31
+ Add descriptive help text with the `help-text` attribute. For help text that contains HTML, use the `help-text` slot
32
+ instead.
33
+
34
+ ```html:preview
35
+ <zn-priority-list label="Deployment Order" help-text="Drag items to set the deployment sequence">
36
+ <div value="database">Database Migrations</div>
37
+ <div value="backend">Backend Services</div>
38
+ <div value="frontend">Frontend App</div>
39
+ <div value="cdn">CDN Cache Invalidation</div>
40
+ </zn-priority-list>
41
+ ```
42
+
43
+ ### Label with Tooltip
44
+
45
+ Use the `label-tooltip` attribute to add text that appears in a tooltip triggered by an info icon next to the label.
46
+
47
+ ```html:preview
48
+ <zn-priority-list label="Processing Order" label-tooltip="Items will be processed from highest to lowest priority" help-text="Drag to reorder">
49
+ <div value="validation">Input Validation</div>
50
+ <div value="transform">Data Transformation</div>
51
+ <div value="enrichment">Data Enrichment</div>
52
+ <div value="storage">Storage</div>
53
+ </zn-priority-list>
54
+ ```
55
+
56
+ ### Initial Order
57
+
58
+ Use the `order` attribute to define the initial display order as a comma-separated list of item keys. Items not listed
59
+ in `order` are appended at the end in their DOM order.
60
+
61
+ ```html:preview
62
+ <zn-priority-list label="Release Pipeline" order="testing,staging,production,development">
63
+ <div value="development">Development</div>
64
+ <div value="testing">Testing</div>
65
+ <div value="staging">Staging</div>
66
+ <div value="production">Production</div>
67
+ </zn-priority-list>
68
+ ```
69
+
70
+ ### Custom Priority Start
71
+
72
+ Use the `priority-start` attribute to change the starting priority number. This is useful when priorities don't start at
73
+ 1.
74
+
75
+ ```html:preview
76
+ <zn-priority-list label="Priority Queue" priority-start="0">
77
+ <div value="critical">Critical</div>
78
+ <div value="high">High</div>
79
+ <div value="medium">Medium</div>
80
+ <div value="low">Low</div>
81
+ </zn-priority-list>
82
+ ```
83
+
84
+ ### Sizes
85
+
86
+ Use the `size` attribute to change the size of the list items.
87
+
88
+ ```html:preview
89
+ <zn-priority-list label="Small" size="small">
90
+ <div value="a">Item A</div>
91
+ <div value="b">Item B</div>
92
+ <div value="c">Item C</div>
93
+ </zn-priority-list>
94
+ <br />
95
+ <zn-priority-list label="Medium" size="medium">
96
+ <div value="a">Item A</div>
97
+ <div value="b">Item B</div>
98
+ <div value="c">Item C</div>
99
+ </zn-priority-list>
100
+ <br />
101
+ <zn-priority-list label="Large" size="large">
102
+ <div value="a">Item A</div>
103
+ <div value="b">Item B</div>
104
+ <div value="c">Item C</div>
105
+ </zn-priority-list>
106
+ ```
107
+
108
+ ### Disabled
109
+
110
+ Use the `disabled` attribute to prevent reordering.
111
+
112
+ ```html:preview
113
+ <zn-priority-list label="Locked Order" disabled>
114
+ <div value="first">First</div>
115
+ <div value="second">Second</div>
116
+ <div value="third">Third</div>
117
+ </zn-priority-list>
118
+ ```
119
+
120
+ ### Rich Content
121
+
122
+ Slotted items can contain any HTML content, not just text.
123
+
124
+ ```html:preview
125
+ <zn-priority-list label="Feature Roadmap">
126
+ <div value="auth">
127
+ <strong>Authentication</strong>
128
+ <br /><small>OAuth2 + SSO integration</small>
129
+ </div>
130
+ <div value="dashboard">
131
+ <strong>Dashboard</strong>
132
+ <br /><small>Analytics and reporting</small>
133
+ </div>
134
+ <div value="api">
135
+ <strong>Public API</strong>
136
+ <br /><small>REST and GraphQL endpoints</small>
137
+ </div>
138
+ <div value="mobile">
139
+ <strong>Mobile App</strong>
140
+ <br /><small>iOS and Android support</small>
141
+ </div>
142
+ </zn-priority-list>
143
+ ```
144
+
145
+ ### Item Actions
146
+
147
+ Use the `action-{value}` slot to add interactive elements (buttons, links, etc.) to the right side of each item. Actions are fully clickable and won't interfere with drag behaviour.
148
+
149
+ ```html:preview
150
+ <zn-priority-list id="action-list" label="Task Queue">
151
+ <div value="deploy">Deploy to Production</div>
152
+ <zn-button slot="action-deploy" size="small" variant="text" theme="danger" onclick="this.closest('zn-priority-list').querySelector('[value=deploy]').remove()">
153
+ <zn-icon src="delete" size="16"></zn-icon>
154
+ </zn-button>
155
+
156
+ <div value="review">Code Review</div>
157
+ <zn-button slot="action-review" size="small" variant="text" theme="danger" onclick="this.closest('zn-priority-list').querySelector('[value=review]').remove()">
158
+ <zn-icon src="delete" size="16"></zn-icon>
159
+ </zn-button>
160
+
161
+ <div value="test">Run Test Suite</div>
162
+ <zn-button slot="action-test" size="small" variant="text" theme="danger" onclick="this.closest('zn-priority-list').querySelector('[value=test]').remove()">
163
+ <zn-icon src="delete" size="16"></zn-icon>
164
+ </zn-button>
165
+ </zn-priority-list>
166
+ ```
167
+
168
+ ### Form Submission
169
+
170
+ When a `name` is set, the component generates hidden inputs for each item as `name[itemValue]=priority`. This example
171
+ shows the submitted form data.
172
+
173
+ ```html:preview
174
+ <form id="priority-form">
175
+ <zn-priority-list name="priority" label="Reorder and Submit">
176
+ <div value="alpha">Alpha</div>
177
+ <div value="beta">Beta</div>
178
+ <div value="gamma">Gamma</div>
179
+ </zn-priority-list>
180
+ <br />
181
+ <zn-button type="submit">Submit</zn-button>
182
+ </form>
183
+
184
+ <br />
185
+ <pre id="priority-output">Submit the form to see the data</pre>
186
+
187
+ <script type="module">
188
+ const form = document.getElementById('priority-form');
189
+ const output = document.getElementById('priority-output');
190
+
191
+ form.addEventListener('submit', event => {
192
+ event.preventDefault();
193
+ const formData = new FormData(form);
194
+ const entries = [...formData.entries()].map(([key, val]) => `${key} = ${val}`);
195
+ output.textContent = entries.join('\n');
196
+ });
197
+ </script>
198
+ ```
199
+
200
+ ### Listening for Changes
201
+
202
+ Use the `zn-reorder` event to react to order changes. Call `getPriorityMap()` on the component to get the current
203
+ priority assignments.
204
+
205
+ ```html:preview
206
+ <zn-priority-list id="event-list" label="Reorder to see events">
207
+ <div value="red">Red</div>
208
+ <div value="green">Green</div>
209
+ <div value="blue">Blue</div>
210
+ </zn-priority-list>
211
+
212
+ <br />
213
+ <pre id="event-output">Reorder items to see the priority map</pre>
214
+
215
+ <script type="module">
216
+ const list = document.getElementById('event-list');
217
+ const output = document.getElementById('event-output');
218
+
219
+ list.addEventListener('zn-reorder', () => {
220
+ const map = list.getPriorityMap();
221
+ output.textContent = JSON.stringify(map, null, 2);
222
+ });
223
+ </script>
224
+ ```
225
+
226
+ ### Keyboard Navigation
227
+
228
+ Focus any item and use the keyboard to reorder:
229
+
230
+ - **Arrow Up** — Move the focused item up one position
231
+ - **Arrow Down** — Move the focused item down one position
232
+ - **Home** — Move the focused item to the top
233
+ - **End** — Move the focused item to the bottom
@@ -1,22 +1,403 @@
1
1
  ---
2
2
  meta:
3
3
  title: Progress Bar
4
- description:
4
+ description: Progress bars provide visual feedback about the completion status of a task or process.
5
5
  layout: component
6
6
  ---
7
7
 
8
8
  ```html:preview
9
- <zn-progress-bar></zn-progress-bar>
9
+ <zn-progress-bar value="50"></zn-progress-bar>
10
10
  ```
11
11
 
12
12
  ## Examples
13
13
 
14
- ### First Example
14
+ ### Basic Progress Bar
15
15
 
16
- TODO
16
+ A basic progress bar displays the completion percentage using the `value` attribute. The value should be a number between 0 and 100.
17
17
 
18
- ### Second Example
18
+ ```html:preview
19
+ <zn-progress-bar value="25"></zn-progress-bar>
20
+ <br />
21
+ <zn-progress-bar value="50"></zn-progress-bar>
22
+ <br />
23
+ <zn-progress-bar value="75"></zn-progress-bar>
24
+ <br />
25
+ <zn-progress-bar value="100"></zn-progress-bar>
26
+ ```
27
+
28
+ ### With Caption
29
+
30
+ Use the `caption` attribute to add a label above the progress bar. This helps identify what the progress bar represents.
31
+
32
+ ```html:preview
33
+ <zn-progress-bar caption="Upload Progress" value="45"></zn-progress-bar>
34
+ <br />
35
+ <zn-progress-bar caption="Installation" value="70"></zn-progress-bar>
36
+ <br />
37
+ <zn-progress-bar caption="Download Complete" value="100"></zn-progress-bar>
38
+ ```
39
+
40
+ ### Showing Progress Percentage
41
+
42
+ Use the `show-progress` attribute to display the numerical percentage value next to the caption.
43
+
44
+ ```html:preview
45
+ <zn-progress-bar caption="File Transfer" value="35" show-progress></zn-progress-bar>
46
+ <br />
47
+ <zn-progress-bar caption="Processing Data" value="62" show-progress></zn-progress-bar>
48
+ <br />
49
+ <zn-progress-bar caption="Backup Complete" value="100" show-progress></zn-progress-bar>
50
+ ```
51
+
52
+ ### Progress Only (No Caption)
53
+
54
+ You can show the progress percentage without a caption by using `show-progress` without the `caption` attribute.
55
+
56
+ ```html:preview
57
+ <zn-progress-bar value="40" show-progress></zn-progress-bar>
58
+ ```
59
+
60
+ ### With Description
61
+
62
+ Use the `description` attribute to add helpful information or context below the progress bar.
63
+
64
+ ```html:preview
65
+ <zn-progress-bar
66
+ caption="Uploading files"
67
+ value="55"
68
+ show-progress
69
+ description="3 of 10 files uploaded">
70
+ </zn-progress-bar>
71
+ <br />
72
+ <zn-progress-bar
73
+ caption="Processing"
74
+ value="30"
75
+ description="Estimated time remaining: 2 minutes">
76
+ </zn-progress-bar>
77
+ ```
78
+
79
+ ### Complete Progress States
80
+
81
+ Examples showing different stages of task completion with captions, progress percentages, and descriptions.
82
+
83
+ ```html:preview
84
+ <zn-progress-bar
85
+ caption="Starting"
86
+ value="0"
87
+ show-progress
88
+ description="Initializing...">
89
+ </zn-progress-bar>
90
+ <br />
91
+ <zn-progress-bar
92
+ caption="In Progress"
93
+ value="45"
94
+ show-progress
95
+ description="Processing 45 of 100 items">
96
+ </zn-progress-bar>
97
+ <br />
98
+ <zn-progress-bar
99
+ caption="Almost Done"
100
+ value="95"
101
+ show-progress
102
+ description="Finalizing...">
103
+ </zn-progress-bar>
104
+ <br />
105
+ <zn-progress-bar
106
+ caption="Complete"
107
+ value="100"
108
+ show-progress
109
+ description="All tasks finished successfully">
110
+ </zn-progress-bar>
111
+ ```
112
+
113
+ ### Dynamic Progress Updates
114
+
115
+ Progress bars can be updated dynamically using JavaScript to reflect real-time progress.
116
+
117
+ ```html:preview
118
+ <zn-progress-bar
119
+ id="dynamic-progress"
120
+ caption="Dynamic Update"
121
+ value="0"
122
+ show-progress
123
+ description="Click the button to start">
124
+ </zn-progress-bar>
125
+ <br />
126
+ <zn-button id="start-progress">Start Progress</zn-button>
127
+ <zn-button id="reset-progress" color="secondary">Reset</zn-button>
128
+
129
+ <script type="module">
130
+ const progressBar = document.getElementById('dynamic-progress');
131
+ const startBtn = document.getElementById('start-progress');
132
+ const resetBtn = document.getElementById('reset-progress');
133
+ let interval;
134
+
135
+ startBtn.addEventListener('click', () => {
136
+ progressBar.value = 0;
137
+ progressBar.description = 'Processing...';
138
+ startBtn.disabled = true;
139
+
140
+ interval = setInterval(() => {
141
+ if (progressBar.value < 100) {
142
+ progressBar.value = progressBar.value + 1;
143
+ progressBar.description = `Processing ${progressBar.value} of 100 items`;
144
+ } else {
145
+ clearInterval(interval);
146
+ progressBar.description = 'Complete!';
147
+ startBtn.disabled = false;
148
+ }
149
+ }, 50);
150
+ });
151
+
152
+ resetBtn.addEventListener('click', () => {
153
+ clearInterval(interval);
154
+ progressBar.value = 0;
155
+ progressBar.description = 'Click the button to start';
156
+ startBtn.disabled = false;
157
+ });
158
+ </script>
159
+ ```
160
+
161
+ ### File Upload Simulation
162
+
163
+ A practical example simulating a file upload process with dynamic updates.
164
+
165
+ ```html:preview
166
+ <zn-progress-bar
167
+ id="upload-progress"
168
+ caption="Uploading document.pdf"
169
+ value="0"
170
+ show-progress
171
+ description="Preparing upload...">
172
+ </zn-progress-bar>
173
+ <br />
174
+ <zn-button id="simulate-upload" icon="cloud_upload">Upload File</zn-button>
175
+
176
+ <script type="module">
177
+ const uploadProgress = document.getElementById('upload-progress');
178
+ const uploadBtn = document.getElementById('simulate-upload');
179
+
180
+ uploadBtn.addEventListener('click', () => {
181
+ uploadProgress.value = 0;
182
+ uploadBtn.disabled = true;
183
+ uploadBtn.loading = true;
184
+
185
+ let uploadSpeed = 2; // Percentage per interval
186
+ const interval = setInterval(() => {
187
+ if (uploadProgress.value < 100) {
188
+ uploadProgress.value = Math.min(uploadProgress.value + uploadSpeed, 100);
19
189
 
20
- TODO
190
+ // Calculate approximate KB uploaded (simulate 5MB file)
191
+ const totalKB = 5120;
192
+ const uploadedKB = Math.floor((uploadProgress.value / 100) * totalKB);
193
+ uploadProgress.description = `Uploaded ${uploadedKB} KB of ${totalKB} KB`;
21
194
 
195
+ // Slow down near the end (realistic upload behavior)
196
+ if (uploadProgress.value > 90) {
197
+ uploadSpeed = 0.5;
198
+ }
199
+ } else {
200
+ clearInterval(interval);
201
+ uploadProgress.caption = 'Upload Complete';
202
+ uploadProgress.description = 'File uploaded successfully';
203
+ uploadBtn.loading = false;
204
+ uploadBtn.disabled = false;
205
+ }
206
+ }, 100);
207
+ });
208
+ </script>
209
+ ```
210
+
211
+ ### Multiple Progress Bars
212
+
213
+ Display multiple progress bars to track different concurrent tasks or processes.
214
+
215
+ ```html:preview
216
+ <zn-progress-bar
217
+ caption="Frontend Build"
218
+ value="100"
219
+ show-progress
220
+ description="Completed">
221
+ </zn-progress-bar>
222
+ <br />
223
+ <zn-progress-bar
224
+ caption="Backend Build"
225
+ value="85"
226
+ show-progress
227
+ description="Compiling...">
228
+ </zn-progress-bar>
229
+ <br />
230
+ <zn-progress-bar
231
+ caption="Running Tests"
232
+ value="60"
233
+ show-progress
234
+ description="156 of 260 tests passed">
235
+ </zn-progress-bar>
236
+ <br />
237
+ <zn-progress-bar
238
+ caption="Deployment"
239
+ value="0"
240
+ show-progress
241
+ description="Waiting for builds to complete">
242
+ </zn-progress-bar>
243
+ ```
244
+
245
+ ### Minimal Progress Bar
246
+
247
+ A clean, minimal progress bar without any text, useful for compact layouts or when context is provided elsewhere.
248
+
249
+ ```html:preview
250
+ <zn-progress-bar value="33"></zn-progress-bar>
251
+ <br />
252
+ <zn-progress-bar value="66"></zn-progress-bar>
253
+ <br />
254
+ <zn-progress-bar value="99"></zn-progress-bar>
255
+ ```
256
+
257
+ ## Customization
258
+
259
+ ### Styling with CSS Parts
260
+
261
+ Use [CSS parts](#css-parts) to customize the appearance of the progress bar. The component exposes several parts that can be styled.
262
+
263
+ ```html:preview
264
+ <zn-progress-bar
265
+ class="custom-progress"
266
+ caption="Custom Styled Progress"
267
+ value="75"
268
+ show-progress
269
+ description="Customized with CSS parts">
270
+ </zn-progress-bar>
271
+
272
+ <style>
273
+ .custom-progress::part(fill) {
274
+ fill: rgb(255, 107, 53);
275
+ }
276
+
277
+ .custom-progress::part(track) {
278
+ fill: rgba(255, 107, 53, 0.2);
279
+ }
280
+
281
+ .custom-progress::part(caption) {
282
+ color: rgb(255, 107, 53);
283
+ font-weight: 600;
284
+ font-size: 14px;
285
+ }
286
+
287
+ .custom-progress::part(progress) {
288
+ color: rgb(255, 107, 53);
289
+ font-weight: 600;
290
+ }
291
+ </style>
292
+ ```
293
+
294
+ ### Custom Height
22
295
 
296
+ Adjust the height of the progress bar using CSS custom properties and parts.
297
+
298
+ ```html:preview
299
+ <zn-progress-bar
300
+ class="tall-progress"
301
+ caption="Tall Progress Bar"
302
+ value="60"
303
+ show-progress>
304
+ </zn-progress-bar>
305
+
306
+ <style>
307
+ .tall-progress::part(bar) {
308
+ height: 16px;
309
+ }
310
+
311
+ .tall-progress::part(track),
312
+ .tall-progress::part(fill) {
313
+ rx: 8px;
314
+ }
315
+ </style>
316
+ ```
317
+
318
+ ### Themed Progress Bars
319
+
320
+ Create themed progress bars for different use cases like success, warning, or error states.
321
+
322
+ ```html:preview
323
+ <zn-progress-bar
324
+ class="success-progress"
325
+ caption="Success"
326
+ value="100"
327
+ show-progress
328
+ description="Operation completed successfully">
329
+ </zn-progress-bar>
330
+ <br />
331
+ <zn-progress-bar
332
+ class="warning-progress"
333
+ caption="Warning"
334
+ value="65"
335
+ show-progress
336
+ description="Approaching storage limit">
337
+ </zn-progress-bar>
338
+ <br />
339
+ <zn-progress-bar
340
+ class="error-progress"
341
+ caption="Error"
342
+ value="30"
343
+ show-progress
344
+ description="Upload failed, retrying...">
345
+ </zn-progress-bar>
346
+
347
+ <style>
348
+ .success-progress::part(fill) {
349
+ fill: rgb(var(--zn-success));
350
+ }
351
+ .success-progress::part(track) {
352
+ fill: rgba(var(--zn-success), 0.2);
353
+ }
354
+
355
+ .warning-progress::part(fill) {
356
+ fill: rgb(var(--zn-warning));
357
+ }
358
+ .warning-progress::part(track) {
359
+ fill: rgba(var(--zn-warning), 0.2);
360
+ }
361
+
362
+ .error-progress::part(fill) {
363
+ fill: rgb(var(--zn-error));
364
+ }
365
+ .error-progress::part(track) {
366
+ fill: rgba(var(--zn-error), 0.2);
367
+ }
368
+ </style>
369
+ ```
370
+
371
+ ### Animated Progress
372
+
373
+ Add smooth animations to the progress bar fill using CSS transitions.
374
+
375
+ ```html:preview
376
+ <zn-progress-bar
377
+ id="animated-progress"
378
+ class="animated-progress"
379
+ caption="Animated Progress"
380
+ value="20"
381
+ show-progress
382
+ description="Watch the smooth animation">
383
+ </zn-progress-bar>
384
+ <br />
385
+ <zn-button id="increase-animated">Increase Progress</zn-button>
386
+
387
+ <style>
388
+ .animated-progress::part(fill) {
389
+ transition: width 0.5s ease-in-out;
390
+ }
391
+ </style>
392
+
393
+ <script type="module">
394
+ const animatedProgress = document.getElementById('animated-progress');
395
+ const increaseBtn = document.getElementById('increase-animated');
396
+
397
+ increaseBtn.addEventListener('click', () => {
398
+ const newValue = Math.min(animatedProgress.value + 20, 100);
399
+ animatedProgress.value = newValue;
400
+ animatedProgress.description = newValue === 100 ? 'Complete!' : 'Watch the smooth animation';
401
+ });
402
+ </script>
403
+ ```