@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
@@ -1,32 +1,370 @@
1
1
  ---
2
2
  meta:
3
3
  title: Split Button
4
- description:
4
+ description: Split buttons combine a primary action button with a dropdown menu for related secondary actions.
5
5
  layout: component
6
6
  ---
7
7
 
8
- ```html:preview
8
+ Split buttons are useful when you have a primary action that users will perform most often, but you also want to provide quick access to related alternative actions. They consist of a main button that triggers the default action and a dropdown button that reveals additional options.
9
9
 
10
- <zn-split-button href="#something" color="primary" caption="Hello World">
10
+ ```html:preview
11
+ <zn-split-button caption="Save Document" href="#save">
11
12
  <zn-menu slot="menu">
12
- <zn-menu-item href="#somewhere">Somewhere</zn-menu-item>
13
+ <zn-menu-item href="#save-as">Save As...</zn-menu-item>
14
+ <zn-menu-item href="#save-copy">Save a Copy</zn-menu-item>
15
+ <zn-menu-item href="#save-template">Save as Template</zn-menu-item>
13
16
  </zn-menu>
14
17
  </zn-split-button>
15
18
  ```
16
19
 
17
20
  ## Examples
18
21
 
19
- ### As a form Submit with different values
22
+ ### Basic Split Button with Links
23
+
24
+ Use the `caption` attribute to set the text for the primary button. The `href` attribute on the main component sets the primary action link.
25
+
26
+ ```html:preview
27
+ <zn-split-button caption="View Details" href="/details">
28
+ <zn-menu slot="menu">
29
+ <zn-menu-item href="/edit">Edit</zn-menu-item>
30
+ <zn-menu-item href="/duplicate">Duplicate</zn-menu-item>
31
+ <zn-menu-item href="/archive">Archive</zn-menu-item>
32
+ </zn-menu>
33
+ </zn-split-button>
34
+ ```
35
+
36
+ ### Form Submit with Different Values
37
+
38
+ Split buttons integrate with forms and can submit different values depending on which option is selected. Use the `type`, `name`, and `value` attributes to configure form behavior.
39
+
40
+ When the primary button is clicked, it submits with the `defaultValue` (which is the initial `value`). When a menu item is clicked, it updates the `value` before submitting.
41
+
42
+ ```html:preview
43
+ <form id="example-form" onsubmit="event.preventDefault(); alert('Form submitted with value: ' + this.action.value);">
44
+ <zn-input name="email" label="Email" value="user@example.com"></zn-input>
45
+ <br />
46
+ <zn-split-button type="submit" name="action" value="send-close" caption="Send and Close">
47
+ <zn-menu slot="menu">
48
+ <zn-menu-item value="send">Send</zn-menu-item>
49
+ <zn-menu-item value="send-draft">Send as Draft</zn-menu-item>
50
+ <zn-menu-item value="schedule">Schedule Send</zn-menu-item>
51
+ </zn-menu>
52
+ </zn-split-button>
53
+ </form>
54
+ ```
55
+
56
+ ### Button Types
57
+
58
+ Like regular buttons, split buttons support different types for form interactions: `submit`, `button`, and `reset`.
59
+
60
+ ```html:preview
61
+ <form id="type-form" onsubmit="event.preventDefault(); alert('Form submitted');">
62
+ <zn-input name="username" label="Username"></zn-input>
63
+ <br />
64
+
65
+ <zn-split-button type="submit" name="submit-action" value="save" caption="Save">
66
+ <zn-menu slot="menu">
67
+ <zn-menu-item value="save-exit">Save and Exit</zn-menu-item>
68
+ <zn-menu-item value="save-new">Save and New</zn-menu-item>
69
+ </zn-menu>
70
+ </zn-split-button>
71
+
72
+ <zn-split-button type="reset" caption="Reset Form">
73
+ <zn-menu slot="menu">
74
+ <zn-menu-item onclick="alert('Clear all clicked')">Clear All</zn-menu-item>
75
+ <zn-menu-item onclick="alert('Reset to defaults clicked')">Reset to Defaults</zn-menu-item>
76
+ </zn-menu>
77
+ </zn-split-button>
78
+ </form>
79
+ ```
80
+
81
+ ### Menu with Icons
82
+
83
+ Add icons to menu items for better visual clarity using the `prefix` slot.
20
84
 
21
85
  ```html:preview
86
+ <zn-split-button caption="Export Data" href="#export">
87
+ <zn-menu slot="menu">
88
+ <zn-menu-item href="#export-pdf">
89
+ <zn-icon slot="prefix" src="picture_as_pdf" size="20"></zn-icon>
90
+ Export as PDF
91
+ </zn-menu-item>
92
+ <zn-menu-item href="#export-csv">
93
+ <zn-icon slot="prefix" src="grid_on" size="20"></zn-icon>
94
+ Export as CSV
95
+ </zn-menu-item>
96
+ <zn-menu-item href="#export-json">
97
+ <zn-icon slot="prefix" src="code" size="20"></zn-icon>
98
+ Export as JSON
99
+ </zn-menu-item>
100
+ </zn-menu>
101
+ </zn-split-button>
102
+ ```
103
+
104
+ ### Complex Menu Options
105
+
106
+ Split buttons can contain complex menus with submenus, dividers, and various menu item features.
107
+
108
+ ```html:preview
109
+ <zn-split-button caption="Publish Now" type="button">
110
+ <zn-menu slot="menu">
111
+ <zn-menu-item value="publish-schedule">
112
+ <zn-icon slot="prefix" src="schedule" size="20"></zn-icon>
113
+ Schedule Publish
114
+ </zn-menu-item>
115
+ <zn-menu-item value="publish-draft">
116
+ <zn-icon slot="prefix" src="draft" size="20"></zn-icon>
117
+ Save as Draft
118
+ </zn-menu-item>
119
+ <hr style="margin: 0; border: none; border-top: 1px solid rgba(0,0,0,0.1);">
120
+ <zn-menu-item value="publish-settings">
121
+ Publish Settings
122
+ <zn-menu slot="submenu">
123
+ <zn-menu-item type="checkbox" value="notify-subscribers" checked>
124
+ Notify Subscribers
125
+ </zn-menu-item>
126
+ <zn-menu-item type="checkbox" value="send-email">
127
+ Send Email Notification
128
+ </zn-menu-item>
129
+ <zn-menu-item type="checkbox" value="post-social" checked>
130
+ Post to Social Media
131
+ </zn-menu-item>
132
+ </zn-menu>
133
+ </zn-menu-item>
134
+ <hr style="margin: 0; border: none; border-top: 1px solid rgba(0,0,0,0.1);">
135
+ <zn-menu-item value="preview">
136
+ <zn-icon slot="prefix" src="visibility" size="20"></zn-icon>
137
+ Preview Before Publishing
138
+ </zn-menu-item>
139
+ </zn-menu>
140
+ </zn-split-button>
141
+ ```
22
142
 
23
- <zn-split-button type="submit" name="button" value="send-on-close" caption="Send and Close">
143
+ ### Action Menu with Different Severities
144
+
145
+ Use colored menu items to indicate the severity or importance of different actions.
146
+
147
+ ```html:preview
148
+ <zn-split-button caption="Approve Request" type="button">
149
+ <zn-menu slot="menu">
150
+ <zn-menu-item value="approve-conditions" color="info">
151
+ <zn-icon slot="prefix" src="info" size="20"></zn-icon>
152
+ Approve with Conditions
153
+ </zn-menu-item>
154
+ <zn-menu-item value="approve-review" color="warning">
155
+ <zn-icon slot="prefix" src="flag" size="20"></zn-icon>
156
+ Approve and Flag for Review
157
+ </zn-menu-item>
158
+ <hr style="margin: 0; border: none; border-top: 1px solid rgba(0,0,0,0.1);">
159
+ <zn-menu-item value="reject" color="error">
160
+ <zn-icon slot="prefix" src="cancel" size="20"></zn-icon>
161
+ Reject Request
162
+ </zn-menu-item>
163
+ </zn-menu>
164
+ </zn-split-button>
165
+ ```
166
+
167
+ ### Custom Trigger
168
+
169
+ You can provide a completely custom trigger by using the `trigger` slot. This overrides the default button group appearance.
170
+
171
+ ```html:preview
172
+ <zn-split-button>
173
+ <zn-button-group slot="trigger">
174
+ <zn-button color="success" icon="check">Accept</zn-button>
175
+ <zn-button color="success" icon="keyboard_arrow_down"></zn-button>
176
+ </zn-button-group>
24
177
  <zn-menu slot="menu">
25
- <zn-menu-item value="send">Send</zn-menu-item>
178
+ <zn-menu-item value="accept-all">
179
+ <zn-icon slot="prefix" src="done_all" size="20"></zn-icon>
180
+ Accept All
181
+ </zn-menu-item>
182
+ <zn-menu-item value="accept-conditionally">
183
+ <zn-icon slot="prefix" src="check_circle_outline" size="20"></zn-icon>
184
+ Accept with Conditions
185
+ </zn-menu-item>
26
186
  </zn-menu>
27
187
  </zn-split-button>
28
188
  ```
29
189
 
30
- ### Second Example
190
+ ### Real-World Example: Email Actions
191
+
192
+ A practical example showing how split buttons work in a typical email application scenario.
31
193
 
32
- TODO
194
+ ```html:preview
195
+ <div style="display: flex; gap: 1rem; flex-wrap: wrap;">
196
+ <zn-split-button caption="Reply" type="button">
197
+ <zn-menu slot="menu">
198
+ <zn-menu-item value="reply-all">
199
+ <zn-icon slot="prefix" src="reply_all" size="20"></zn-icon>
200
+ Reply All
201
+ </zn-menu-item>
202
+ <zn-menu-item value="forward">
203
+ <zn-icon slot="prefix" src="forward" size="20"></zn-icon>
204
+ Forward
205
+ </zn-menu-item>
206
+ </zn-menu>
207
+ </zn-split-button>
208
+
209
+ <zn-split-button caption="Archive" type="button">
210
+ <zn-menu slot="menu">
211
+ <zn-menu-item value="archive-mark-read">
212
+ <zn-icon slot="prefix" src="mark_email_read" size="20"></zn-icon>
213
+ Archive and Mark as Read
214
+ </zn-menu-item>
215
+ <zn-menu-item value="archive-mute">
216
+ <zn-icon slot="prefix" src="notifications_off" size="20"></zn-icon>
217
+ Archive and Mute Thread
218
+ </zn-menu-item>
219
+ </zn-menu>
220
+ </zn-split-button>
221
+
222
+ <zn-split-button caption="Move to" type="button">
223
+ <zn-menu slot="menu">
224
+ <zn-menu-item value="inbox">
225
+ <zn-icon slot="prefix" src="inbox" size="20"></zn-icon>
226
+ Inbox
227
+ </zn-menu-item>
228
+ <zn-menu-item value="spam">
229
+ <zn-icon slot="prefix" src="report" size="20"></zn-icon>
230
+ Spam
231
+ </zn-menu-item>
232
+ <zn-menu-item value="trash" color="error">
233
+ <zn-icon slot="prefix" src="delete" size="20"></zn-icon>
234
+ Trash
235
+ </zn-menu-item>
236
+ </zn-menu>
237
+ </zn-split-button>
238
+ </div>
239
+ ```
240
+
241
+ ### Dropdown Placement
242
+
243
+ The dropdown uses `placement="bottom-end"` by default, positioning the menu at the bottom-right of the button group. The split button wraps a `zn-dropdown` component internally.
244
+
245
+ ```html:preview
246
+ <zn-split-button caption="Default Placement">
247
+ <zn-menu slot="menu">
248
+ <zn-menu-item>Option 1</zn-menu-item>
249
+ <zn-menu-item>Option 2</zn-menu-item>
250
+ <zn-menu-item>Option 3</zn-menu-item>
251
+ </zn-menu>
252
+ </zn-split-button>
253
+ ```
254
+
255
+ ### Form Integration Example
256
+
257
+ A complete form example showing how split buttons work with form validation and submission.
258
+
259
+ ```html:preview
260
+ <form id="complete-form" style="max-width: 400px;">
261
+ <zn-input name="title" label="Document Title" required></zn-input>
262
+ <br />
263
+ <zn-textarea name="content" label="Content" rows="4"></zn-textarea>
264
+ <br />
265
+
266
+ <div style="display: flex; gap: 0.5rem; justify-content: flex-end;">
267
+ <zn-button type="button" color="transparent" onclick="this.closest('form').reset()">
268
+ Cancel
269
+ </zn-button>
270
+
271
+ <zn-split-button type="submit" name="save-action" value="save" caption="Save">
272
+ <zn-menu slot="menu">
273
+ <zn-menu-item value="save-close">Save and Close</zn-menu-item>
274
+ <zn-menu-item value="save-new">Save and Create New</zn-menu-item>
275
+ <zn-menu-item value="save-preview">Save and Preview</zn-menu-item>
276
+ </zn-menu>
277
+ </zn-split-button>
278
+ </div>
279
+ </form>
280
+
281
+ <script>
282
+ document.getElementById('complete-form').addEventListener('submit', (e) => {
283
+ e.preventDefault();
284
+ const formData = new FormData(e.target);
285
+ const data = Object.fromEntries(formData);
286
+ alert(`Form submitted with action: ${data['save-action']}\nTitle: ${data.title}`);
287
+ });
288
+ </script>
289
+ ```
290
+
291
+ ### Events
292
+
293
+ Split buttons work with the standard menu events. Listen for the `zn-menu-select` event to handle menu item selections.
294
+
295
+ ```html:preview
296
+ <zn-split-button id="event-split-button" caption="Perform Action" type="button">
297
+ <zn-menu slot="menu">
298
+ <zn-menu-item value="action1">Action 1</zn-menu-item>
299
+ <zn-menu-item value="action2">Action 2</zn-menu-item>
300
+ <zn-menu-item value="action3">Action 3</zn-menu-item>
301
+ </zn-menu>
302
+ </zn-split-button>
303
+
304
+ <div id="event-output" style="margin-top: 1rem; padding: 1rem; background: var(--zn-color-neutral-100); border-radius: 4px;">
305
+ <strong>Last action:</strong> <span id="last-action">None</span>
306
+ </div>
307
+
308
+ <script>
309
+ const splitButton = document.getElementById('event-split-button');
310
+ const lastAction = document.getElementById('last-action');
311
+
312
+ splitButton.addEventListener('zn-menu-select', (e) => {
313
+ lastAction.textContent = e.detail.value || 'Primary button clicked';
314
+ });
315
+
316
+ splitButton.addEventListener('click', (e) => {
317
+ if (e.target === splitButton.button) {
318
+ lastAction.textContent = 'Primary action (default value)';
319
+ }
320
+ });
321
+ </script>
322
+ ```
323
+
324
+ ### Programmatic Control
325
+
326
+ You can programmatically control the split button and access its internal components.
327
+
328
+ ```html:preview
329
+ <zn-split-button id="prog-split-button" caption="Action" type="button" value="default-action">
330
+ <zn-menu slot="menu">
331
+ <zn-menu-item value="option1">Option 1</zn-menu-item>
332
+ <zn-menu-item value="option2">Option 2</zn-menu-item>
333
+ </zn-menu>
334
+ </zn-split-button>
335
+
336
+ <div style="margin-top: 1rem; display: flex; gap: 0.5rem;">
337
+ <zn-button id="show-dropdown" size="small">Show Dropdown</zn-button>
338
+ <zn-button id="hide-dropdown" size="small">Hide Dropdown</zn-button>
339
+ <zn-button id="get-value" size="small" color="info">Get Current Value</zn-button>
340
+ <zn-button id="set-value" size="small" color="success">Set Value to 'option1'</zn-button>
341
+ </div>
342
+
343
+ <div id="prog-output" style="margin-top: 1rem; padding: 1rem; background: var(--zn-color-neutral-100); border-radius: 4px;">
344
+ <strong>Status:</strong> <span id="prog-status">Ready</span>
345
+ </div>
346
+
347
+ <script>
348
+ const progSplitButton = document.getElementById('prog-split-button');
349
+ const progStatus = document.getElementById('prog-status');
350
+
351
+ document.getElementById('show-dropdown').addEventListener('click', () => {
352
+ progSplitButton.dropdown.show();
353
+ progStatus.textContent = 'Dropdown shown';
354
+ });
355
+
356
+ document.getElementById('hide-dropdown').addEventListener('click', () => {
357
+ progSplitButton.dropdown.hide();
358
+ progStatus.textContent = 'Dropdown hidden';
359
+ });
360
+
361
+ document.getElementById('get-value').addEventListener('click', () => {
362
+ progStatus.textContent = `Current value: ${progSplitButton.value}`;
363
+ });
364
+
365
+ document.getElementById('set-value').addEventListener('click', () => {
366
+ progSplitButton.value = 'option1';
367
+ progStatus.textContent = `Value set to: ${progSplitButton.value}`;
368
+ });
369
+ </script>
370
+ ```