@kubex/zinc 1.0.24 → 1.0.98

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 (198) 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 +13431 -8728
  4. package/dist/vscode.html-custom-data.json +571 -37
  5. package/dist/web-types.json +1439 -181
  6. package/dist/zn.d.ts +1642 -661
  7. package/dist/zn.min.css +1 -1
  8. package/dist/zn.min.js +1407 -887
  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/key-container.md +115 -0
  51. package/docs/pages/components/key.md +101 -0
  52. package/docs/pages/components/menu.md +512 -6
  53. package/docs/pages/components/note.md +239 -36
  54. package/docs/pages/components/opt-group.md +107 -0
  55. package/docs/pages/components/pagination.md +332 -6
  56. package/docs/pages/components/pane.md +222 -6
  57. package/docs/pages/components/panel.md +213 -26
  58. package/docs/pages/components/popup.md +1354 -6
  59. package/docs/pages/components/priority-list.md +233 -0
  60. package/docs/pages/components/progress-bar.md +387 -6
  61. package/docs/pages/components/radio-group.md +242 -5
  62. package/docs/pages/components/radio.md +474 -6
  63. package/docs/pages/components/rating.md +331 -7
  64. package/docs/pages/components/reveal.md +524 -6
  65. package/docs/pages/components/scroll-container.md +552 -6
  66. package/docs/pages/components/select.md +762 -160
  67. package/docs/pages/components/skeleton.md +473 -30
  68. package/docs/pages/components/slideout.md +261 -5
  69. package/docs/pages/components/sp.md +99 -41
  70. package/docs/pages/components/split-button.md +347 -9
  71. package/docs/pages/components/split-pane.md +445 -6
  72. package/docs/pages/components/stat.md +549 -9
  73. package/docs/pages/components/status-indicator.md +230 -1
  74. package/docs/pages/components/stepper.md +563 -6
  75. package/docs/pages/components/tabs.md +439 -13
  76. package/docs/pages/components/textarea.md +415 -17
  77. package/docs/pages/components/tile.md +385 -26
  78. package/docs/pages/components/toggle.md +424 -6
  79. package/docs/pages/components/tooltip.md +367 -0
  80. package/docs/pages/components/translation-group.md +210 -0
  81. package/docs/pages/components/translations.md +319 -18
  82. package/docs/pages/components/vertical-stepper.md +401 -8
  83. package/docs/pages/components/well.md +300 -3
  84. package/docs/pages/getting-started/form-controls.md +162 -0
  85. package/docs/pages/index.md +116 -15
  86. package/package.json +5 -6
  87. package/scss/_global-spacing.scss +4 -0
  88. package/scss/_root.scss +2 -2
  89. package/scss/boot.scss +19 -0
  90. package/scss/shared/layout.scss +5 -0
  91. package/scss/themes/_light.scss +3 -3
  92. package/src/components/alert/alert.scss +1 -0
  93. package/src/components/animated-button/README.md +306 -0
  94. package/src/components/animated-button/animated-button.component.ts +229 -0
  95. package/src/components/animated-button/animated-button.scss +228 -0
  96. package/src/components/animated-button/animated-button.test.ts +143 -0
  97. package/src/components/animated-button/index.ts +12 -0
  98. package/src/components/button/button.component.ts +5 -0
  99. package/src/components/button-group/button-group.component.ts +25 -13
  100. package/src/components/button-group/button-group.scss +6 -0
  101. package/src/components/checkbox/checkbox.component.ts +4 -0
  102. package/src/components/checkbox/checkbox.scss +7 -4
  103. package/src/components/checkbox-group/checkbox-group.scss +7 -0
  104. package/src/components/chip/chip.component.ts +7 -2
  105. package/src/components/chip/chip.scss +16 -2
  106. package/src/components/collapsible/collapsible.component.ts +27 -20
  107. package/src/components/cols/cols.component.ts +14 -2
  108. package/src/components/cols/cols.scss +6 -12
  109. package/src/components/confirm/confirm.component.ts +7 -0
  110. package/src/components/copy-button/copy-button.component.ts +12 -11
  111. package/src/components/data-select/data-select.component.ts +215 -44
  112. package/src/components/data-select/data-select.scss +66 -6
  113. package/src/components/data-select/providers/currency-data-provider.ts +20 -6
  114. package/src/components/data-select/providers/provider.ts +1 -0
  115. package/src/components/data-select/providers/us-state-data-provider.ts +68 -0
  116. package/src/components/data-table/data-table.component.ts +82 -23
  117. package/src/components/data-table-search/data-table-search.component.ts +184 -0
  118. package/src/components/data-table-search/data-table-search.scss +17 -0
  119. package/src/components/data-table-search/data-table-search.test.ts +11 -0
  120. package/src/components/data-table-search/index.ts +12 -0
  121. package/src/components/datepicker/datepicker.component.ts +347 -13
  122. package/src/components/dialog/dialog.component.ts +1 -1
  123. package/src/components/empty-state/empty-state.scss +6 -1
  124. package/src/components/header/header.scss +3 -3
  125. package/src/components/icon/icon.component.ts +23 -1
  126. package/src/components/icon/icon.scss +23 -0
  127. package/src/components/icon-picker/brand-icons.ts +24 -0
  128. package/src/components/icon-picker/icon-picker.component.ts +407 -0
  129. package/src/components/icon-picker/icon-picker.scss +205 -0
  130. package/src/components/icon-picker/index.ts +12 -0
  131. package/src/components/icon-picker/line-icons.ts +612 -0
  132. package/src/components/icon-picker/material-icons.ts +14543 -0
  133. package/src/components/inline-edit/inline-edit.component.ts +190 -46
  134. package/src/components/inline-edit/inline-edit.scss +29 -0
  135. package/src/components/inline-edit/inline-edit.test.ts +314 -1
  136. package/src/components/input/input.component.ts +328 -5
  137. package/src/components/input/input.scss +100 -4
  138. package/src/components/input-group/input-group.component.ts +28 -7
  139. package/src/components/input-group/input-group.scss +48 -10
  140. package/src/components/item/item.component.ts +11 -2
  141. package/src/components/item/item.scss +7 -0
  142. package/src/components/key/index.ts +12 -0
  143. package/src/components/key/key.component.ts +47 -0
  144. package/src/components/key/key.scss +38 -0
  145. package/src/components/key-container/index.ts +12 -0
  146. package/src/components/key-container/key-container.component.ts +142 -0
  147. package/src/components/key-container/key-container.scss +33 -0
  148. package/src/components/menu-item/menu-item.component.ts +20 -0
  149. package/src/components/menu-item/menu-item.scss +69 -2
  150. package/src/components/navbar/navbar.component.ts +103 -8
  151. package/src/components/navbar/navbar.scss +6 -1
  152. package/src/components/opt-group/index.ts +12 -0
  153. package/src/components/opt-group/opt-group.component.ts +74 -0
  154. package/src/components/opt-group/opt-group.scss +37 -0
  155. package/src/components/opt-group/opt-group.test.ts +27 -0
  156. package/src/components/option/option.component.ts +1 -16
  157. package/src/components/option/option.scss +4 -0
  158. package/src/components/panel/panel.component.ts +10 -8
  159. package/src/components/panel/panel.scss +20 -0
  160. package/src/components/priority-list/index.ts +12 -0
  161. package/src/components/priority-list/priority-list.component.ts +611 -0
  162. package/src/components/priority-list/priority-list.scss +185 -0
  163. package/src/components/priority-list/priority-list.test.ts +139 -0
  164. package/src/components/progress-bar/progress-bar.component.ts +22 -16
  165. package/src/components/radio/radio.scss +10 -3
  166. package/src/components/select/select.component.ts +812 -72
  167. package/src/components/select/select.scss +108 -2
  168. package/src/components/select/select.test.ts +147 -2
  169. package/src/components/settings-container/settings-container.component.ts +44 -19
  170. package/src/components/settings-container/settings-container.scss +1 -1
  171. package/src/components/skeleton/skeleton.component.ts +6 -1
  172. package/src/components/slideout/slideout.scss +8 -3
  173. package/src/components/sp/sp.component.ts +3 -1
  174. package/src/components/sp/sp.scss +19 -0
  175. package/src/components/stepper/stepper.component.ts +16 -10
  176. package/src/components/textarea/textarea.scss +0 -4
  177. package/src/components/tile/tile.component.ts +12 -3
  178. package/src/components/tile/tile.scss +1 -1
  179. package/src/components/timer/timer.component.ts +15 -2
  180. package/src/components/toggle/toggle.component.ts +29 -26
  181. package/src/components/toggle/toggle.scss +13 -1
  182. package/src/components/translation-group/index.ts +12 -0
  183. package/src/components/translation-group/translation-group.component.ts +207 -0
  184. package/src/components/translation-group/translation-group.scss +8 -0
  185. package/src/components/translations/translations.component.ts +90 -42
  186. package/src/components/translations/translations.scss +5 -1
  187. package/src/components/vertical-stepper/vertical-stepper.component.ts +14 -9
  188. package/src/events/events.ts +12 -7
  189. package/src/events/zn-language-change.ts +7 -0
  190. package/src/events/zn-purchase.ts +11 -0
  191. package/src/events/zn-redirect.ts +7 -0
  192. package/src/events/zn-reorder.ts +7 -0
  193. package/src/events/zn-search-change.ts +11 -0
  194. package/src/events/zn-submit.ts +1 -1
  195. package/src/form-control.scss +4 -0
  196. package/src/internal/form-navigation.ts +510 -0
  197. package/src/internal/form.ts +6 -0
  198. package/src/zinc.ts +91 -83
@@ -9,78 +9,216 @@ layout: component
9
9
 
10
10
  ### Basic Dialog
11
11
 
12
- This is a basic dialog. It has a trigger button that opens the dialog. The dialog has a close button and two buttons in
13
- the footer.
12
+ This is a basic dialog. It has a trigger button that opens the dialog. The dialog has a close button and two buttons in the footer.
14
13
 
15
14
  ```html:preview
16
-
17
15
  <zn-button id="dialog-trigger">Open Basic dialog</zn-button>
18
16
  <zn-dialog class="dialog-basic" trigger="dialog-trigger" label="Dialog">
19
- This is the dialogs body.
17
+ This is the dialog's body.
20
18
 
21
19
  <zn-button color="default" slot="footer">Do Something</zn-button>
22
20
  <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
23
21
  </zn-dialog>
24
22
  ```
25
23
 
26
- ### Dialog Variants
24
+ ### Labels
27
25
 
28
- Use the header-icon slot to display an sl-icon to the left of the dialog header (label).
26
+ The dialog's label is displayed in the header and is required for proper accessibility. Use the `label` attribute to set the label text.
29
27
 
30
- Use this pattern for confirmation dialogs, when asking people to confirm that they want to take an action, and for
31
- informational dialogs.
28
+ ```html:preview
29
+ <zn-button id="dialog-label-trigger">Open Dialog</zn-button>
30
+ <zn-dialog trigger="dialog-label-trigger" label="Important Information">
31
+ This dialog has a label in the header that describes its purpose.
32
32
 
33
- Set the dialog variant (default or warning) to apply the right color theme to the icon: default for confirmation of
34
- neutral actions (like submitting a form), and warning for confirmation of destructive actions (like canceling or
35
- deleting something).
33
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
34
+ </zn-dialog>
35
+ ```
36
+
37
+ For HTML content in the label, use the `label` slot instead.
36
38
 
37
39
  ```html:preview
40
+ <zn-button id="dialog-label-slot-trigger">Open Dialog</zn-button>
41
+ <zn-dialog trigger="dialog-label-slot-trigger">
42
+ <span slot="label">Important <em>Information</em></span>
43
+ This dialog uses the label slot for HTML content.
44
+
45
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
46
+ </zn-dialog>
47
+ ```
38
48
 
39
- <zn-button id="dialog-trigger">Open Default Dialog</zn-button>
40
- <zn-dialog class="dialog-basic" trigger="dialog-trigger" label="Dialog" cosmic>
49
+ ### Dialog Variants
50
+
51
+ Dialogs come in three variants: `default`, `warning`, and `announcement`. Set the `variant` attribute to apply the appropriate theme.
52
+
53
+ Use the `header-icon` slot to display an icon to the left of the dialog header label. The icon color is automatically styled based on the dialog variant.
54
+
55
+ #### Default Variant
56
+
57
+ Use the default variant for confirmation of neutral actions like submitting a form or displaying informational content.
58
+
59
+ ```html:preview
60
+ <zn-button id="dialog-default-trigger">Open Default Dialog</zn-button>
61
+ <zn-dialog trigger="dialog-default-trigger" label="Confirm Submission" variant="default">
41
62
  <zn-icon src="info" slot="header-icon"></zn-icon>
42
63
  If you need to, you can cancel this request after submitting it. Are you sure you want to submit it now?
43
64
 
44
- <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
45
- <zn-button color="default" slot="footer" type="submit">Do Something</zn-button>
65
+ <zn-button color="secondary" slot="footer" dialog-closer>Cancel</zn-button>
66
+ <zn-button color="default" slot="footer">Submit</zn-button>
46
67
  </zn-dialog>
68
+ ```
47
69
 
48
- <zn-button id="dialog-trigger-2">Open Warning Dialog</zn-button>
49
- <zn-dialog class="dialog-basic" trigger="dialog-trigger-2" label="Dialog" variant="warning">
50
- <zn-icon src="info" slot="header-icon"></zn-icon>
51
- If you need to, you can cancel this request after submitting it. Are you sure you want to submit it now?
70
+ #### Warning Variant
52
71
 
53
- <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
54
- <zn-button color="warning" slot="footer">Do Something</zn-button>
72
+ Use the warning variant for confirmation of destructive actions like deleting or canceling something.
73
+
74
+ ```html:preview
75
+ <zn-button id="dialog-warning-trigger">Open Warning Dialog</zn-button>
76
+ <zn-dialog trigger="dialog-warning-trigger" label="Delete Item" variant="warning">
77
+ <zn-icon src="warning" slot="header-icon"></zn-icon>
78
+ This action cannot be undone. Are you sure you want to delete this item?
79
+
80
+ <zn-button color="secondary" slot="footer" dialog-closer>Cancel</zn-button>
81
+ <zn-button color="warning" slot="footer">Delete</zn-button>
55
82
  </zn-dialog>
83
+ ```
84
+
85
+ #### Announcement Variant
56
86
 
57
- <zn-button id="dialog-trigger-3" color="warning">Open Announcement Dialog</zn-button>
58
- <zn-dialog class="dialog-basic" trigger="dialog-trigger-3" label="Meet your new Monthly Numbers dashboard" variant="announcement">
87
+ Use the announcement variant for special announcements, feature introductions, or welcome messages. This variant supports additional slots for intro text and footer text.
88
+
89
+ ```html:preview
90
+ <zn-button id="dialog-announcement-trigger">Open Announcement</zn-button>
91
+ <zn-dialog trigger="dialog-announcement-trigger" label="Meet your new Monthly Numbers dashboard" variant="announcement">
59
92
  <div slot="announcement-intro">Welcome!</div>
60
- <zn-icon src="info" slot="header-icon"></zn-icon>
61
- If you need to, you can cancel this request after submitting it. Are you sure you want to submit it now?
93
+ <zn-icon src="celebration" slot="header-icon"></zn-icon>
94
+ We've redesigned the Monthly Numbers dashboard with new features and improved performance. Take a tour to see what's new.
62
95
 
63
- <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
64
- <zn-button color="default" slot="footer">Do Something</zn-button>
96
+ <zn-button color="secondary" slot="footer" dialog-closer>Skip Tour</zn-button>
97
+ <zn-button color="default" slot="footer">Start Tour</zn-button>
65
98
  <div slot="footer-text"><a href="#">Learn more about Monthly Numbers</a></div>
66
99
  </zn-dialog>
67
100
  ```
68
101
 
102
+ ### Dialog Sizes
103
+
104
+ Dialogs come in three different sizes: `small`, `medium`, and `large`. The default size is `medium`. Use the `size` attribute to control the dialog width.
105
+
106
+ ```html:preview
107
+ <zn-button id="dialog-small-trigger">Open Small Dialog</zn-button>
108
+ <zn-dialog trigger="dialog-small-trigger" label="Small Dialog" size="small">
109
+ <zn-icon src="info" slot="header-icon"></zn-icon>
110
+ This is a small dialog, ideal for simple confirmations.
111
+
112
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
113
+ <zn-button color="default" slot="footer">Confirm</zn-button>
114
+ </zn-dialog>
115
+
116
+ <zn-button id="dialog-medium-trigger">Open Medium Dialog</zn-button>
117
+ <zn-dialog trigger="dialog-medium-trigger" label="Medium Dialog">
118
+ <zn-icon src="info" slot="header-icon"></zn-icon>
119
+ This is a medium dialog, the default size. It works well for most content.
120
+
121
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
122
+ <zn-button color="default" slot="footer">Confirm</zn-button>
123
+ </zn-dialog>
124
+
125
+ <zn-button id="dialog-large-trigger">Open Large Dialog</zn-button>
126
+ <zn-dialog trigger="dialog-large-trigger" label="Large Dialog" size="large">
127
+ <zn-icon src="info" slot="header-icon"></zn-icon>
128
+ This is a large dialog, suitable for complex forms or detailed content.
129
+
130
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
131
+ <zn-button color="default" slot="footer">Confirm</zn-button>
132
+ </zn-dialog>
133
+ ```
134
+
135
+ ### Custom Width
136
+
137
+ You can set a custom dialog width using the `--width` CSS custom property. Note that the dialog will automatically shrink to accommodate smaller screens.
138
+
139
+ ```html:preview
140
+ <zn-button id="dialog-custom-width-trigger">Open Custom Width Dialog</zn-button>
141
+ <zn-dialog trigger="dialog-custom-width-trigger" label="Custom Width" style="--width: 800px;">
142
+ <zn-icon src="info" slot="header-icon"></zn-icon>
143
+ This dialog has a custom width of 800px set using the --width CSS property.
144
+
145
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
146
+ </zn-dialog>
147
+ ```
148
+
149
+ ### Scrolling Content
150
+
151
+ When the dialog content is longer than the viewport, the body area automatically becomes scrollable while keeping the header and footer fixed.
152
+
153
+ ```html:preview
154
+ <zn-button id="dialog-scrolling-trigger">Open Scrolling Dialog</zn-button>
155
+ <zn-dialog trigger="dialog-scrolling-trigger" label="Scrolling Content">
156
+ <zn-icon src="info" slot="header-icon"></zn-icon>
157
+ <p>This dialog has a lot of content that requires scrolling.</p>
158
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
159
+ <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
160
+ <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
161
+ <p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
162
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
163
+ <p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
164
+ <p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
165
+ <p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
166
+
167
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
168
+ <zn-button color="default" slot="footer">Save</zn-button>
169
+ </zn-dialog>
170
+ ```
171
+
172
+ ### No Header
173
+
174
+ Use the `no-header` attribute to hide the header, including the default close button. When using this option, ensure you provide an accessible way for users to close the dialog.
175
+
176
+ :::warning
177
+ **Note:** Even when using `no-header`, you should still provide a `label` attribute for proper accessibility. The label is used for screen readers even when visually hidden.
178
+ :::
179
+
180
+ ```html:preview
181
+ <zn-button id="dialog-no-header-trigger">Open No Header Dialog</zn-button>
182
+ <zn-dialog trigger="dialog-no-header-trigger" label="Dialog without header" no-header>
183
+ <p>This dialog has no header. Notice there's no close button, so we've added one in the footer.</p>
184
+ <p>The label attribute is still required for accessibility, even though it's not visible.</p>
185
+
186
+ <zn-button color="default" slot="footer">Continue</zn-button>
187
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
188
+ </zn-dialog>
189
+ ```
190
+
191
+ ### Header Actions
192
+
193
+ Use the `header-actions` slot to add buttons or other interactive elements to the header, next to the close button.
194
+
195
+ ```html:preview
196
+ <zn-button id="dialog-header-actions-trigger">Open Dialog</zn-button>
197
+ <zn-dialog trigger="dialog-header-actions-trigger" label="Document Settings">
198
+ <zn-button icon="refresh" color="transparent" size="content" slot="header-actions"></zn-button>
199
+ <zn-button icon="settings" color="transparent" size="content" slot="header-actions"></zn-button>
200
+
201
+ <p>This dialog has action buttons in the header for quick access to common functions.</p>
202
+
203
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
204
+ <zn-button color="default" slot="footer">Save</zn-button>
205
+ </zn-dialog>
206
+ ```
207
+
69
208
  ### Dialogs as Forms
70
209
 
71
210
  Use dialogs as forms when you need to collect information from users. This example shows a dialog with a form inside it.
72
211
 
73
212
  ```html:preview
74
-
75
213
  <form method="post" action="#" style="display: inline-block">
76
- <zn-button id="dialog-trigger">Open Form Dialog</zn-button>
77
- <zn-dialog class="dialog-basic" trigger="dialog-trigger" label="Dialog" size="large">
78
- <zn-icon src="info" slot="header-icon"></zn-icon>
214
+ <zn-button id="dialog-form-trigger">Open Form Dialog</zn-button>
215
+ <zn-dialog trigger="dialog-form-trigger" label="Edit Profile" size="large">
216
+ <zn-icon src="person" slot="header-icon"></zn-icon>
79
217
 
80
218
  <zn-form-group
81
- label="Profile"
82
- label-tooltip="huh"
83
- help-text="This information will be displayed publicly so be careful what you share">
219
+ label="Profile Information"
220
+ label-tooltip="This information will be displayed on your public profile"
221
+ help-text="All fields marked with an asterisk are required">
84
222
 
85
223
  <div class="form-spacing">
86
224
  <zn-input type="text" name="name" label="Name" required></zn-input>
@@ -91,55 +229,197 @@ Use dialogs as forms when you need to collect information from users. This examp
91
229
  <zn-option value="other">Other</zn-option>
92
230
  </zn-select>
93
231
 
94
- <zn-textarea name="comment" label="Comment" required></zn-textarea>
232
+ <zn-textarea name="comment" label="Bio" required></zn-textarea>
95
233
 
96
- <zn-checkbox required>Check me before submitting</zn-checkbox>
234
+ <zn-checkbox required>I agree to the terms and conditions</zn-checkbox>
97
235
 
98
236
  <br>
99
- <zn-checkbox-group label="Checkbox group" help-text="Select at least one" label-tooltip="Do you need help?"
237
+ <zn-checkbox-group label="Interests" help-text="Select at least one" label-tooltip="Choose your areas of interest"
100
238
  required>
101
- <zn-checkbox value="I'm option 1">Option 1</zn-checkbox>
102
- <zn-checkbox value="I'm option 2">Option 2</zn-checkbox>
103
- <zn-checkbox value="I'm option 3">Option 3</zn-checkbox>
239
+ <zn-checkbox value="technology">Technology</zn-checkbox>
240
+ <zn-checkbox value="sports">Sports</zn-checkbox>
241
+ <zn-checkbox value="music">Music</zn-checkbox>
104
242
  </zn-checkbox-group>
105
243
  </div>
106
244
  </zn-form-group>
107
245
 
108
- <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
109
- <zn-button color="default" slot="footer" type="submit">Submit</zn-button>
246
+ <zn-button color="secondary" slot="footer" dialog-closer>Cancel</zn-button>
247
+ <zn-button color="default" slot="footer" type="submit">Save Profile</zn-button>
110
248
  </zn-dialog>
249
+ </form>
111
250
  ```
112
251
 
113
- ### Dialog Sizes
252
+ ### Programmatic Control
114
253
 
115
- Dialogs come in three different sizes: `small`, `medium`, and `large`. The default size is `medium`.
254
+ Dialogs can be controlled programmatically using the `show()` and `hide()` methods. You can also check or set the `open` property to manage the dialog state.
116
255
 
117
256
  ```html:preview
257
+ <div>
258
+ <zn-button class="dialog-show">Show Dialog</zn-button>
259
+ <zn-button class="dialog-hide">Hide Dialog</zn-button>
260
+ <zn-button class="dialog-toggle">Toggle Dialog</zn-button>
261
+ </div>
118
262
 
119
- <zn-button id="dialog-trigger">Open Small Dialog</zn-button>
120
- <zn-dialog class="dialog-basic" trigger="dialog-trigger" label="Dialog" size="small">
263
+ <zn-dialog class="dialog-programmatic" label="Programmatic Control">
121
264
  <zn-icon src="info" slot="header-icon"></zn-icon>
122
- This is a small dialog.
265
+ This dialog is controlled programmatically using JavaScript methods.
123
266
 
124
- <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
125
- <zn-button color="default" slot="footer">Do Something</zn-button>
267
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
126
268
  </zn-dialog>
127
269
 
128
- <zn-button id="dialog-trigger-2">Open Medium Dialog</zn-button>
129
- <zn-dialog class="dialog-basic" trigger="dialog-trigger-2" label="Dialog">
270
+ <script type="module">
271
+ const dialog = document.querySelector('.dialog-programmatic');
272
+ const showButton = document.querySelector('.dialog-show');
273
+ const hideButton = document.querySelector('.dialog-hide');
274
+ const toggleButton = document.querySelector('.dialog-toggle');
275
+
276
+ showButton.addEventListener('click', () => dialog.show());
277
+ hideButton.addEventListener('click', () => dialog.hide());
278
+ toggleButton.addEventListener('click', () => {
279
+ if (dialog.open) {
280
+ dialog.hide();
281
+ } else {
282
+ dialog.show();
283
+ }
284
+ });
285
+ </script>
286
+ ```
287
+
288
+ ### Listening to Events
289
+
290
+ The dialog emits several events that you can listen to: `zn-show` when opened, `zn-close` when closed, and `zn-request-close` when a close is requested.
291
+
292
+ ```html:preview
293
+ <zn-button id="dialog-events-trigger">Open Dialog</zn-button>
294
+ <zn-dialog class="dialog-events" trigger="dialog-events-trigger" label="Dialog Events">
130
295
  <zn-icon src="info" slot="header-icon"></zn-icon>
131
- This is a medium dialog.
296
+ Open the browser console to see events logged as you interact with this dialog.
132
297
 
133
- <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
134
- <zn-button color="default" slot="footer">Do Something</zn-button>
298
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
299
+ </zn-dialog>
300
+
301
+ <script type="module">
302
+ const dialog = document.querySelector('.dialog-events');
303
+
304
+ dialog.addEventListener('zn-show', () => {
305
+ console.log('Dialog opened');
306
+ });
307
+
308
+ dialog.addEventListener('zn-close', () => {
309
+ console.log('Dialog closed');
310
+ });
311
+
312
+ dialog.addEventListener('zn-request-close', (event) => {
313
+ console.log('Close requested from:', event.detail.source);
314
+ });
315
+ </script>
316
+ ```
317
+
318
+ ### Preventing Close
319
+
320
+ The `zn-request-close` event can be cancelled to prevent the dialog from closing. This is useful when you need to validate data or confirm an action before allowing the dialog to close.
321
+
322
+ :::warning
323
+ **Note:** Use this feature sparingly and only when closing the dialog would result in destructive behavior such as data loss. Preventing close can be frustrating for users if overused.
324
+ :::
325
+
326
+ ```html:preview
327
+ <zn-button id="dialog-prevent-close-trigger">Open Dialog</zn-button>
328
+ <zn-dialog class="dialog-prevent-close" trigger="dialog-prevent-close-trigger" label="Unsaved Changes">
329
+ <zn-icon src="warning" slot="header-icon"></zn-icon>
330
+ <p>Try closing this dialog using the close button, clicking the overlay, or pressing Escape.</p>
331
+ <p>You'll need to click the "I'm Sure" button to actually close it.</p>
332
+
333
+ <zn-button color="warning" slot="footer" class="close-allowed">I'm Sure</zn-button>
135
334
  </zn-dialog>
136
335
 
137
- <zn-button id="dialog-trigger-3">Open Large Dialog</zn-button>
138
- <zn-dialog class="dialog-basic" trigger="dialog-trigger-3" label="Dialog" size="large">
336
+ <script type="module">
337
+ const dialog = document.querySelector('.dialog-prevent-close');
338
+ const confirmButton = document.querySelector('.close-allowed');
339
+
340
+ // Prevent all close attempts
341
+ dialog.addEventListener('zn-request-close', (event) => {
342
+ event.preventDefault();
343
+ alert('Please click "I\'m Sure" to close this dialog.');
344
+ });
345
+
346
+ // Allow close when clicking the confirmation button
347
+ confirmButton.addEventListener('click', () => {
348
+ dialog.hide();
349
+ });
350
+ </script>
351
+ ```
352
+
353
+ You can also prevent close from specific sources by checking the `event.detail.source` property.
354
+
355
+ ```html:preview
356
+ <zn-button id="dialog-prevent-specific-trigger">Open Dialog</zn-button>
357
+ <zn-dialog class="dialog-prevent-specific" trigger="dialog-prevent-specific-trigger" label="Selective Close Prevention">
139
358
  <zn-icon src="info" slot="header-icon"></zn-icon>
140
- This is a large dialog.
359
+ <p>This dialog prevents closing via the overlay or Escape key, but allows the close button to work.</p>
141
360
 
142
- <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
143
- <zn-button color="default" slot="footer">Do Something</zn-button>
361
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
362
+ </zn-dialog>
363
+
364
+ <script type="module">
365
+ const dialog = document.querySelector('.dialog-prevent-specific');
366
+
367
+ dialog.addEventListener('zn-request-close', (event) => {
368
+ // Prevent close from overlay and keyboard, but allow close button
369
+ if (event.detail.source === 'overlay' || event.detail.source === 'keyboard') {
370
+ event.preventDefault();
371
+ alert('Please use the close button to dismiss this dialog.');
372
+ }
373
+ });
374
+ </script>
375
+ ```
376
+
377
+ ### Dialog Closer Attribute
378
+
379
+ Add the `dialog-closer` attribute to any element inside the dialog to make it close the dialog when clicked. This is commonly used with buttons in the footer.
380
+
381
+ ```html:preview
382
+ <zn-button id="dialog-closer-trigger">Open Dialog</zn-button>
383
+ <zn-dialog trigger="dialog-closer-trigger" label="Dialog Closer">
384
+ <zn-icon src="info" slot="header-icon"></zn-icon>
385
+ <p>Any element with the dialog-closer attribute will close this dialog when clicked.</p>
386
+
387
+ <zn-button color="default" slot="footer">This Won't Close</zn-button>
388
+ <zn-button color="secondary" slot="footer" dialog-closer>This Will Close</zn-button>
389
+ </zn-dialog>
390
+ ```
391
+
392
+ ### Cosmic Effect
393
+
394
+ Add the `cosmic` attribute to apply a special visual effect to the dialog backdrop.
395
+
396
+ ```html:preview
397
+ <zn-button id="dialog-cosmic-trigger">Open Cosmic Dialog</zn-button>
398
+ <zn-dialog trigger="dialog-cosmic-trigger" label="Cosmic Dialog" cosmic>
399
+ <zn-icon src="star" slot="header-icon"></zn-icon>
400
+ This dialog has the cosmic effect applied to the backdrop.
401
+
402
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
403
+ </zn-dialog>
404
+ ```
405
+
406
+ ### Customizing Spacing
407
+
408
+ Use CSS custom properties to customize the padding in different areas of the dialog.
409
+
410
+ ```html:preview
411
+ <zn-button id="dialog-spacing-trigger">Open Dialog</zn-button>
412
+ <zn-dialog
413
+ trigger="dialog-spacing-trigger"
414
+ label="Custom Spacing"
415
+ style="
416
+ --header-spacing: 2rem;
417
+ --body-spacing: 3rem;
418
+ --footer-spacing: 2rem;
419
+ ">
420
+ <zn-icon src="info" slot="header-icon"></zn-icon>
421
+ This dialog has custom spacing applied using CSS properties.
422
+
423
+ <zn-button color="secondary" slot="footer" dialog-closer>Close</zn-button>
144
424
  </zn-dialog>
145
425
  ```