@kubex/zinc 1.1.115 → 1.1.116

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.
@@ -9,7 +9,8 @@ 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 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
13
+ the footer.
13
14
 
14
15
  ```html:preview
15
16
  <zn-button id="dialog-trigger">Open Basic dialog</zn-button>
@@ -21,9 +22,22 @@ This is a basic dialog. It has a trigger button that opens the dialog. The dialo
21
22
  </zn-dialog>
22
23
  ```
23
24
 
25
+ ## test
26
+
27
+ ```html:preview
28
+ <zn-button id="dialog-trigger">Open Basic dialog</zn-button>
29
+ <zn-dialog class="dialog-basic" trigger="dialog-trigger" label="Verify longdomainwhitlotsofcharacters.somethignsomewhere.dev">
30
+ This is the dialog's body.
31
+
32
+ <zn-button color="default" slot="footer">Do Something</zn-button>
33
+ <zn-button color="secondary" slot="footer" dialog-closer>Close Dialog</zn-button>
34
+ </zn-dialog>
35
+ ```
36
+
24
37
  ### Labels
25
38
 
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.
39
+ The dialog's label is displayed in the header and is required for proper accessibility. Use the `label` attribute to set
40
+ the label text.
27
41
 
28
42
  ```html:preview
29
43
  <zn-button id="dialog-label-trigger">Open Dialog</zn-button>
@@ -48,9 +62,11 @@ For HTML content in the label, use the `label` slot instead.
48
62
 
49
63
  ### Dialog Variants
50
64
 
51
- Dialogs come in three variants: `default`, `warning`, and `announcement`. Set the `variant` attribute to apply the appropriate theme.
65
+ Dialogs come in three variants: `default`, `warning`, and `announcement`. Set the `variant` attribute to apply the
66
+ appropriate theme.
52
67
 
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.
68
+ Use the `header-icon` slot to display an icon to the left of the dialog header label. The icon color is automatically
69
+ styled based on the dialog variant.
54
70
 
55
71
  #### Default Variant
56
72
 
@@ -84,7 +100,8 @@ Use the warning variant for confirmation of destructive actions like deleting or
84
100
 
85
101
  #### Announcement Variant
86
102
 
87
- Use the announcement variant for special announcements, feature introductions, or welcome messages. This variant supports additional slots for intro text and footer text.
103
+ Use the announcement variant for special announcements, feature introductions, or welcome messages. This variant
104
+ supports additional slots for intro text and footer text.
88
105
 
89
106
  ```html:preview
90
107
  <zn-button id="dialog-announcement-trigger">Open Announcement</zn-button>
@@ -101,7 +118,8 @@ Use the announcement variant for special announcements, feature introductions, o
101
118
 
102
119
  ### Dialog Sizes
103
120
 
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.
121
+ Dialogs come in three different sizes: `small`, `medium`, and `large`. The default size is `medium`. Use the `size`
122
+ attribute to control the dialog width.
105
123
 
106
124
  ```html:preview
107
125
  <zn-button id="dialog-small-trigger">Open Small Dialog</zn-button>
@@ -134,7 +152,8 @@ Dialogs come in three different sizes: `small`, `medium`, and `large`. The defau
134
152
 
135
153
  ### Custom Width
136
154
 
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.
155
+ You can set a custom dialog width using the `--width` CSS custom property. Note that the dialog will automatically
156
+ shrink to accommodate smaller screens.
138
157
 
139
158
  ```html:preview
140
159
  <zn-button id="dialog-custom-width-trigger">Open Custom Width Dialog</zn-button>
@@ -148,7 +167,8 @@ You can set a custom dialog width using the `--width` CSS custom property. Note
148
167
 
149
168
  ### Scrolling Content
150
169
 
151
- When the dialog content is longer than the viewport, the body area automatically becomes scrollable while keeping the header and footer fixed.
170
+ When the dialog content is longer than the viewport, the body area automatically becomes scrollable while keeping the
171
+ header and footer fixed.
152
172
 
153
173
  ```html:preview
154
174
  <zn-button id="dialog-scrolling-trigger">Open Scrolling Dialog</zn-button>
@@ -171,10 +191,12 @@ When the dialog content is longer than the viewport, the body area automatically
171
191
 
172
192
  ### No Header
173
193
 
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.
194
+ Use the `no-header` attribute to hide the header, including the default close button. When using this option, ensure you
195
+ provide an accessible way for users to close the dialog.
175
196
 
176
197
  :::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.
198
+ **Note:** Even when using `no-header`, you should still provide a `label` attribute for proper accessibility. The label
199
+ is used for screen readers even when visually hidden.
178
200
  :::
179
201
 
180
202
  ```html:preview
@@ -251,7 +273,8 @@ Use dialogs as forms when you need to collect information from users. This examp
251
273
 
252
274
  ### Programmatic Control
253
275
 
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.
276
+ Dialogs can be controlled programmatically using the `show()` and `hide()` methods. You can also check or set the `open`
277
+ property to manage the dialog state.
255
278
 
256
279
  ```html:preview
257
280
  <div>
@@ -287,7 +310,8 @@ Dialogs can be controlled programmatically using the `show()` and `hide()` metho
287
310
 
288
311
  ### Listening to Events
289
312
 
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.
313
+ The dialog emits several events that you can listen to: `zn-show` when opened, `zn-close` when closed, and
314
+ `zn-request-close` when a close is requested.
291
315
 
292
316
  ```html:preview
293
317
  <zn-button id="dialog-events-trigger">Open Dialog</zn-button>
@@ -317,10 +341,12 @@ The dialog emits several events that you can listen to: `zn-show` when opened, `
317
341
 
318
342
  ### Preventing Close
319
343
 
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.
344
+ The `zn-request-close` event can be cancelled to prevent the dialog from closing. This is useful when you need to
345
+ validate data or confirm an action before allowing the dialog to close.
321
346
 
322
347
  :::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.
348
+ **Note:** Use this feature sparingly and only when closing the dialog would result in destructive behavior such as data
349
+ loss. Preventing close can be frustrating for users if overused.
324
350
  :::
325
351
 
326
352
  ```html:preview
@@ -376,9 +402,12 @@ You can also prevent close from specific sources by checking the `event.detail.s
376
402
 
377
403
  ### Dialog Closer Attribute
378
404
 
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.
405
+ Add the `dialog-closer` attribute to any element inside the dialog to make it close the dialog when clicked. This is
406
+ commonly used with buttons in the footer.
380
407
 
381
- The `modal-closer` attribute works the same way but closes the nearest containing modal of either kind — dialog or slideout — and, unlike `dialog-closer`, works from inside a nested component's shadow root. `<zn-form-actions>` uses it on its cancel button.
408
+ The `modal-closer` attribute works the same way but closes the nearest containing modal of either kind — dialog or
409
+ slideout — and, unlike `dialog-closer`, works from inside a nested component's shadow root. `<zn-form-actions>` uses it
410
+ on its cancel button.
382
411
 
383
412
  ```html:preview
384
413
  <zn-button id="dialog-closer-trigger">Open Dialog</zn-button>
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  meta:
3
3
  title: Translation Group
4
- description: A panel-styled container that provides a shared language toggle for multiple translation inputs.
4
+ description: A panel-styled container that provides a shared language select for multiple translation inputs.
5
5
  layout: component
6
6
  ---
7
7
 
8
8
  The Translation Group component wraps multiple `zn-translations` components in a panel-styled container with a shared
9
- language toggle. A button group in the top right lets users switch between languages, controlling all child translation
10
- inputs simultaneously.
9
+ language select. The select sits at the top right of the header, opposite the caption. Closed, it carries how many
10
+ languages are done as a `1/5` chip; open, each language is marked translated, partial or falling back to English.
11
+ Choosing a language switches every child at once.
11
12
 
12
13
  ```html:preview
13
14
  <zn-translation-group
@@ -30,7 +31,7 @@ inputs simultaneously.
30
31
 
31
32
  ### Basic Usage
32
33
 
33
- A translation group with two translation inputs sharing one language button group.
34
+ A translation group with two translation inputs sharing one language select.
34
35
 
35
36
  ```html:preview
36
37
  <zn-translation-group languages='{"en":"English","fr":"French"}'>
@@ -41,7 +42,8 @@ A translation group with two translation inputs sharing one language button grou
41
42
 
42
43
  ### With Label
43
44
 
44
- Use the `label` attribute to add a descriptive label in the panel header, displayed on the left side alongside the language toggle.
45
+ Use the `label` attribute to add a caption on the left of the header, opposite the language select. `language-label`
46
+ sets the select's accessible name — it is not shown, since the caption names the section on screen.
45
47
 
46
48
  ```html:preview
47
49
  <zn-translation-group
@@ -54,8 +56,9 @@ Use the `label` attribute to add a descriptive label in the panel header, displa
54
56
 
55
57
  ### Pre-filled Values
56
58
 
57
- Set initial translations on each child. The group automatically collects all language codes from children and displays
58
- them as buttons in the toggle group.
59
+ Set initial translations on each child. A language every child has a value for is marked `Translated`; one only some
60
+ children have is `Partial`; one no child has falls back to English. English itself is the source, so it is neither
61
+ counted nor marked as a translation.
59
62
 
60
63
  ```html:preview
61
64
  <zn-translation-group
@@ -74,44 +77,90 @@ them as buttons in the toggle group.
74
77
  </zn-translation-group>
75
78
  ```
76
79
 
77
- ### Many Fields
80
+ ### Many Languages
78
81
 
79
- The group scales well with multiple translation inputs under a single toggle.
82
+ Every configured language is offered whether or not it has been translated yet, so there is no separate step to add
83
+ one — pick it and start typing. The chip on the closed select tracks how many are done.
80
84
 
81
85
  ```html:preview
82
86
  <zn-translation-group
83
- label="SEO Metadata"
87
+ label="Release Notes"
88
+ languages='{"en":"English","ar":"Arabic","de":"German","es":"Spanish","fr":"French","it":"Italian","ja":"Japanese","ko":"Korean","pt":"Portuguese","ru":"Russian","tr":"Turkish","zh-hans":"Simplified Chinese"}'>
89
+ <zn-translations
90
+ label="Headline"
91
+ name="headline"
92
+ values='{"en":"Now shipping","ar":"متاح الآن","de":"Jetzt verfügbar","es":"Ya disponible","fr":"Disponible dès maintenant","it":"Disponibile ora","ja":"発売開始","ko":"출시됨","pt":"Disponível agora","ru":"Уже в продаже","tr":"Şimdi mevcut","zh-hans":"现已发布"}'
93
+ ></zn-translations>
94
+ <zn-translations
95
+ label="Summary"
96
+ name="summary"
97
+ values='{"en":"Tap through the release highlights.","ar":"تصفح أبرز ميزات الإصدار.","de":"Highlights der Version ansehen.","es":"Consulta lo más destacado.","fr":"Découvrez les nouveautés.","it":"Scopri le novità.","ja":"リリースのハイライトをご覧ください。","ko":"업데이트 주요 내용 보기.","pt":"Veja os destaques.","ru":"Ознакомьтесь с обновлениями.","tr":"Sürüm önemli noktaları.","zh-hans":"浏览版本亮点。"}'
98
+ ></zn-translations>
99
+ </zn-translation-group>
100
+ ```
101
+
102
+ ### Custom Accessible Name
103
+
104
+ `language-label` is read out by a screen reader in place of a visible label.
105
+
106
+ ```html:preview
107
+ <zn-translation-group
108
+ language-label="Language"
84
109
  languages='{"en":"English","fr":"French","de":"German"}'>
85
- <zn-translations label="Page Title" name="seo-title"></zn-translations>
86
- <zn-translations label="Meta Description" name="seo-description"></zn-translations>
87
- <zn-translations label="Open Graph Title" name="og-title"></zn-translations>
88
- <zn-translations label="Open Graph Description" name="og-description"></zn-translations>
110
+ <zn-translations label="Heading" name="heading" values='{"en":"Now shipping","de":"Jetzt verfügbar"}'></zn-translations>
111
+ <zn-translations label="Body" name="body" values='{"en":"Tap through the highlights."}'></zn-translations>
89
112
  </zn-translation-group>
90
113
  ```
91
114
 
92
- ### Language Overflow
115
+ ### Inline (No Panel)
93
116
 
94
- When there are more languages than will fit across the header, the extras collapse into a chevron dropdown beside the
95
- visible buttons. The dropdown sits before the `+` add-language dropdown and selects the same way picking a language
96
- switches every child translation input in the group.
117
+ Nested inside another panel, the group's own border and padding indent its fields out of line with everything around
118
+ them. `inline` drops the chrome so the group reads as a section of the form instead.
97
119
 
98
120
  ```html:preview
99
- <div style="max-width: 480px;">
100
- <zn-translation-group
101
- label="Release Notes"
102
- languages='{"en":"English","ar":"Arabic","de":"German","es":"Spanish","fr":"French","it":"Italian","ja":"Japanese","ko":"Korean","pt":"Portuguese","ru":"Russian","tr":"Turkish","zh-hans":"Simplified Chinese"}'>
103
- <zn-translations
104
- label="Headline"
105
- name="headline"
106
- values='{"en":"Now shipping","ar":"متاح الآن","de":"Jetzt verfügbar","es":"Ya disponible","fr":"Disponible dès maintenant","it":"Disponibile ora","ja":"発売開始","ko":"출시됨","pt":"Disponível agora","ru":"Уже в продаже","tr":"Şimdi mevcut","zh-hans":"现已发布"}'
107
- ></zn-translations>
108
- <zn-translations
109
- label="Summary"
110
- name="summary"
111
- values='{"en":"Tap through the release highlights.","ar":"تصفح أبرز ميزات الإصدار.","de":"Highlights der Version ansehen.","es":"Consulta lo más destacado.","fr":"Découvrez les nouveautés.","it":"Scopri le novità.","ja":"リリースのハイライトをご覧ください。","ko":"업데이트 주요 내용 보기.","pt":"Veja os destaques.","ru":"Ознакомьтесь с обновлениями.","tr":"Sürüm önemli noktaları.","zh-hans":"浏览版本亮点。"}'
112
- ></zn-translations>
113
- </zn-translation-group>
114
- </div>
121
+ <zn-panel caption="Product Details" icon="inventory_2">
122
+ <div style="display: flex; flex-direction: column; gap: 1rem;">
123
+ <zn-input label="Product SKU" value="PROD-12345" readonly></zn-input>
124
+
125
+ <zn-translation-group
126
+ inline
127
+ label="Translatable Content"
128
+ languages='{"en":"English","fr":"French","de":"German"}'>
129
+ <zn-translations
130
+ name="name"
131
+ label="Product Name"
132
+ values='{"en":"Premium Wireless Headphones","fr":"Écouteurs sans fil premium","de":"Premium kabellose Kopfhörer"}'
133
+ ></zn-translations>
134
+ <zn-translations
135
+ name="short-description"
136
+ label="Short Description"
137
+ values='{"en":"High-quality wireless audio","fr":"Audio sans fil haute qualité","de":"Hochwertiges kabelloses Audio"}'
138
+ ></zn-translations>
139
+ </zn-translation-group>
140
+
141
+ <zn-input label="Price" type="currency" value="299.99"></zn-input>
142
+ </div>
143
+ </zn-panel>
144
+ ```
145
+
146
+ ### Actions
147
+
148
+ Buttons for the bottom of the group go in the `actions` slot. They sit on the white body rather than the grey
149
+ `footer`, and follow zinc's form action rows in sitting on the right. `align="start"` moves one to the left; any
150
+ number can sit on either side. Write them in the order they should be read — the sides are set by CSS ordering, so
151
+ markup order is what a keyboard follows.
152
+
153
+ ```html:preview
154
+ <zn-translation-group
155
+ label="Product Content"
156
+ languages='{"en":"English","fr":"French","de":"German"}'>
157
+ <zn-translations label="Name" name="name" values='{"en":"Wireless Headphones","de":"Kabellose Kopfhörer"}'></zn-translations>
158
+ <zn-translations label="Description" name="description" values='{"en":"Premium noise-cancelling headphones"}'></zn-translations>
159
+
160
+ <zn-button slot="actions" align="start" color="transparent" icon="translate">Auto-translate</zn-button>
161
+ <zn-button slot="actions" color="secondary">Cancel</zn-button>
162
+ <zn-button slot="actions" color="success">Save</zn-button>
163
+ </zn-translation-group>
115
164
  ```
116
165
 
117
166
  ### Flush Layout
@@ -156,62 +205,15 @@ The group emits a `zn-language-change` event when the active language changes.
156
205
  </script>
157
206
  ```
158
207
 
159
- ### Real-World Use Case: Product Content Management
160
-
161
- A complete example showing how the translation group simplifies a product editing form.
162
-
163
- ```html:preview
164
- <div style="max-width: 800px;">
165
- <zn-panel caption="Product Details" icon="inventory_2">
166
- <div style="display: flex; flex-direction: column; gap: 1rem;">
167
- <zn-input
168
- label="Product SKU"
169
- value="PROD-12345"
170
- readonly
171
- ></zn-input>
172
-
173
- <zn-translation-group
174
- label="Translatable Content"
175
- languages='{"en":"English","fr":"French","de":"German","es":"Spanish"}'>
176
- <zn-translations
177
- name="name"
178
- label="Product Name"
179
- values='{"en":"Premium Wireless Headphones","fr":"Écouteurs sans fil premium","de":"Premium kabellose Kopfhörer","es":"Auriculares inalámbricos premium"}'
180
- ></zn-translations>
181
- <zn-translations
182
- name="short-description"
183
- label="Short Description"
184
- values='{"en":"High-quality wireless audio","fr":"Audio sans fil haute qualité","de":"Hochwertiges kabelloses Audio","es":"Audio inalámbrico de alta calidad"}'
185
- ></zn-translations>
186
- <zn-translations
187
- name="description"
188
- label="Full Description"
189
- values='{"en":"Experience premium sound with active noise cancellation","fr":"Découvrez un son premium avec suppression active du bruit","de":"Erleben Sie Premium-Sound mit aktiver Geräuschunterdrückung","es":"Experimente sonido premium con cancelación activa de ruido"}'
190
- ></zn-translations>
191
- </zn-translation-group>
192
-
193
- <zn-input
194
- label="Price"
195
- type="currency"
196
- value="299.99"
197
- ></zn-input>
198
- </div>
199
-
200
- <div slot="footer" style="display: flex; gap: 0.5rem; justify-content: flex-end;">
201
- <zn-button color="secondary">Cancel</zn-button>
202
- <zn-button color="success">Save Product</zn-button>
203
- </div>
204
- </zn-panel>
205
- </div>
206
- ```
207
-
208
208
  ## Properties
209
209
 
210
- | Property | Type | Default | Description |
211
- |-------------|--------------------------|--------------|--------------------------------------------------------|
212
- | `label` | `string` | `''` | Label displayed in the panel header |
213
- | `languages` | `Record<string, string>` | `{en: "EN"}` | Object mapping language codes to display names |
214
- | `flush` | `boolean` | `false` | Removes body padding for compact layout |
210
+ | Property | Type | Default | Description |
211
+ |------------------|--------------------------|--------------------|---------------------------------------------------|
212
+ | `label` | `string` | `''` | Caption displayed in the panel header |
213
+ | `language-label` | `string` | `'Edit Languages'` | The select's accessible name; not shown on screen |
214
+ | `inline` | `boolean` | `false` | Drops the panel border, background and padding |
215
+ | `languages` | `Record<string, string>` | `{en: "EN"}` | Object mapping language codes to display names |
216
+ | `flush` | `boolean` | `false` | Removes body padding for compact layout |
215
217
 
216
218
  ## Events
217
219
 
@@ -225,11 +227,18 @@ A complete example showing how the translation group simplifies a product editin
225
227
  |-----------|------------------------------------------------------------|
226
228
  | (default) | Place `<zn-translations>` elements here |
227
229
  | `label` | Alternative to the `label` attribute for rich HTML content |
230
+ | `actions` | Buttons for the bottom of the body; `align="start"` on a child moves it to the left |
231
+ | `footer` | Content displayed in the grey panel footer |
232
+
233
+ The header carries the caption and the language select alone; nothing else is slotted into it.
228
234
 
229
235
  ## CSS Parts
230
236
 
231
- | Part | Description |
232
- |----------------|---------------------------------------------------------|
233
- | `base` | The outer panel wrapper |
234
- | `header` | The header area containing the label and language toggle |
235
- | `translations` | The body container wrapping the slotted children |
237
+ | Part | Description |
238
+ |-------------------|-----------------------------------------------------------------|
239
+ | `base` | The outer panel wrapper |
240
+ | `header` | The header area containing the caption and the language select |
241
+ | `language-field` | The container holding the language select |
242
+ | `language-select` | The select itself |
243
+ | `actions` | The row of buttons at the bottom of the body |
244
+ | `translations` | The body container wrapping the slotted children |