@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.
- package/.claude/project.md +556 -0
- package/.github/workflows/js_build_and_deploy.yaml +9 -10
- package/dist/custom-elements.json +13575 -8856
- package/dist/vscode.html-custom-data.json +583 -48
- package/dist/web-types.json +1441 -181
- package/dist/zn.d.ts +1645 -660
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +1412 -893
- package/docs/_utilities/code-previews.cjs +10 -1
- package/docs/assets/scripts/docs.js +42 -18
- package/docs/data/data-table.json +229 -66
- package/docs/data/empty.json +6 -0
- package/docs/data/products-table.json +41 -193
- package/docs/pages/components/action-bar.md +121 -6
- package/docs/pages/components/alert.md +118 -15
- package/docs/pages/components/animated-button.md +299 -0
- package/docs/pages/components/audio-select.md +534 -0
- package/docs/pages/components/bulk-actions.md +79 -5
- package/docs/pages/components/button-group.md +235 -27
- package/docs/pages/components/button.md +139 -1
- package/docs/pages/components/chart.md +365 -9
- package/docs/pages/components/checkbox.md +387 -58
- package/docs/pages/components/chip.md +253 -33
- package/docs/pages/components/collapsible.md +393 -46
- package/docs/pages/components/cols.md +152 -30
- package/docs/pages/components/confirm.md +182 -16
- package/docs/pages/components/copy-button.md +169 -6
- package/docs/pages/components/data-select.md +194 -15
- package/docs/pages/components/data-table-filter.md +96 -5
- package/docs/pages/components/data-table-search.md +451 -0
- package/docs/pages/components/data-table-sort.md +66 -5
- package/docs/pages/components/data-table.md +727 -66
- package/docs/pages/components/datepicker.md +402 -7
- package/docs/pages/components/defined-label.md +120 -5
- package/docs/pages/components/dialog.md +339 -59
- package/docs/pages/components/dropdown.md +366 -11
- package/docs/pages/components/editor.md +604 -7
- package/docs/pages/components/empty-state.md +315 -16
- package/docs/pages/components/expanding-action.md +212 -28
- package/docs/pages/components/file.md +421 -12
- package/docs/pages/components/filter-container.md +158 -5
- package/docs/pages/components/filter-wrapper.md +167 -6
- package/docs/pages/components/form-group.md +383 -6
- package/docs/pages/components/hover-container.md +237 -6
- package/docs/pages/components/icon-picker.md +121 -0
- package/docs/pages/components/icon.md +454 -48
- package/docs/pages/components/inline-edit.md +787 -19
- package/docs/pages/components/input-group.md +207 -13
- package/docs/pages/components/input.md +194 -0
- package/docs/pages/components/item.md +18 -0
- package/docs/pages/components/key-container.md +115 -0
- package/docs/pages/components/key.md +101 -0
- package/docs/pages/components/menu.md +512 -6
- package/docs/pages/components/note.md +239 -36
- package/docs/pages/components/opt-group.md +107 -0
- package/docs/pages/components/pagination.md +332 -6
- package/docs/pages/components/pane.md +222 -6
- package/docs/pages/components/panel.md +213 -26
- package/docs/pages/components/popup.md +1354 -6
- package/docs/pages/components/priority-list.md +233 -0
- package/docs/pages/components/progress-bar.md +387 -6
- package/docs/pages/components/radio-group.md +242 -5
- package/docs/pages/components/radio.md +474 -6
- package/docs/pages/components/rating.md +331 -7
- package/docs/pages/components/reveal.md +524 -6
- package/docs/pages/components/scroll-container.md +552 -6
- package/docs/pages/components/select.md +762 -160
- package/docs/pages/components/skeleton.md +473 -30
- package/docs/pages/components/slideout.md +261 -5
- package/docs/pages/components/sp.md +99 -41
- package/docs/pages/components/split-button.md +347 -9
- package/docs/pages/components/split-pane.md +445 -6
- package/docs/pages/components/stat.md +549 -9
- package/docs/pages/components/status-indicator.md +230 -1
- package/docs/pages/components/stepper.md +563 -6
- package/docs/pages/components/tabs.md +439 -13
- package/docs/pages/components/textarea.md +415 -17
- package/docs/pages/components/tile.md +385 -26
- package/docs/pages/components/toggle.md +424 -6
- package/docs/pages/components/tooltip.md +367 -0
- package/docs/pages/components/translation-group.md +210 -0
- package/docs/pages/components/translations.md +319 -19
- package/docs/pages/components/vertical-stepper.md +401 -8
- package/docs/pages/components/well.md +300 -3
- package/docs/pages/getting-started/form-controls.md +162 -0
- package/docs/pages/index.md +116 -15
- package/package.json +5 -6
- package/scss/_global-spacing.scss +4 -0
- package/scss/_root.scss +2 -2
- package/scss/boot.scss +19 -0
- package/scss/shared/layout.scss +5 -0
- package/scss/themes/_light.scss +3 -3
- package/src/components/alert/alert.scss +1 -0
- package/src/components/animated-button/README.md +306 -0
- package/src/components/animated-button/animated-button.component.ts +229 -0
- package/src/components/animated-button/animated-button.scss +228 -0
- package/src/components/animated-button/animated-button.test.ts +143 -0
- package/src/components/animated-button/index.ts +12 -0
- package/src/components/button/button.component.ts +5 -0
- package/src/components/button-group/button-group.component.ts +25 -13
- package/src/components/button-group/button-group.scss +6 -0
- package/src/components/checkbox/checkbox.component.ts +4 -0
- package/src/components/checkbox/checkbox.scss +7 -4
- package/src/components/checkbox-group/checkbox-group.scss +7 -0
- package/src/components/chip/chip.component.ts +7 -2
- package/src/components/chip/chip.scss +16 -2
- package/src/components/collapsible/collapsible.component.ts +27 -20
- package/src/components/cols/cols.component.ts +14 -2
- package/src/components/cols/cols.scss +6 -12
- package/src/components/confirm/confirm.component.ts +7 -0
- package/src/components/copy-button/copy-button.component.ts +12 -11
- package/src/components/data-select/data-select.component.ts +215 -44
- package/src/components/data-select/data-select.scss +66 -6
- package/src/components/data-select/providers/currency-data-provider.ts +20 -6
- package/src/components/data-select/providers/provider.ts +1 -0
- package/src/components/data-select/providers/us-state-data-provider.ts +68 -0
- package/src/components/data-table/data-table.component.ts +81 -22
- package/src/components/data-table-search/data-table-search.component.ts +184 -0
- package/src/components/data-table-search/data-table-search.scss +17 -0
- package/src/components/data-table-search/data-table-search.test.ts +11 -0
- package/src/components/data-table-search/index.ts +12 -0
- package/src/components/datepicker/datepicker.component.ts +347 -13
- package/src/components/dialog/dialog.component.ts +1 -1
- package/src/components/empty-state/empty-state.scss +6 -1
- package/src/components/header/header.scss +3 -3
- package/src/components/icon/icon.component.ts +23 -1
- package/src/components/icon/icon.scss +23 -0
- package/src/components/icon-picker/brand-icons.ts +24 -0
- package/src/components/icon-picker/icon-picker.component.ts +407 -0
- package/src/components/icon-picker/icon-picker.scss +205 -0
- package/src/components/icon-picker/index.ts +12 -0
- package/src/components/icon-picker/line-icons.ts +612 -0
- package/src/components/icon-picker/material-icons.ts +14543 -0
- package/src/components/inline-edit/inline-edit.component.ts +190 -46
- package/src/components/inline-edit/inline-edit.scss +29 -0
- package/src/components/inline-edit/inline-edit.test.ts +314 -1
- package/src/components/input/input.component.ts +324 -5
- package/src/components/input/input.scss +87 -0
- package/src/components/input-group/input-group.component.ts +28 -7
- package/src/components/input-group/input-group.scss +48 -10
- package/src/components/item/item.component.ts +24 -3
- package/src/components/item/item.scss +18 -0
- package/src/components/key/index.ts +12 -0
- package/src/components/key/key.component.ts +47 -0
- package/src/components/key/key.scss +38 -0
- package/src/components/key-container/index.ts +12 -0
- package/src/components/key-container/key-container.component.ts +142 -0
- package/src/components/key-container/key-container.scss +33 -0
- package/src/components/menu-item/menu-item.component.ts +20 -0
- package/src/components/menu-item/menu-item.scss +69 -2
- package/src/components/navbar/navbar.component.ts +103 -11
- package/src/components/navbar/navbar.scss +6 -1
- package/src/components/opt-group/index.ts +12 -0
- package/src/components/opt-group/opt-group.component.ts +74 -0
- package/src/components/opt-group/opt-group.scss +37 -0
- package/src/components/opt-group/opt-group.test.ts +27 -0
- package/src/components/option/option.component.ts +1 -16
- package/src/components/option/option.scss +4 -0
- package/src/components/panel/panel.component.ts +10 -8
- package/src/components/panel/panel.scss +20 -0
- package/src/components/priority-list/index.ts +12 -0
- package/src/components/priority-list/priority-list.component.ts +611 -0
- package/src/components/priority-list/priority-list.scss +185 -0
- package/src/components/priority-list/priority-list.test.ts +139 -0
- package/src/components/progress-bar/progress-bar.component.ts +22 -16
- package/src/components/radio/radio.scss +10 -3
- package/src/components/select/select.component.ts +812 -72
- package/src/components/select/select.scss +108 -2
- package/src/components/select/select.test.ts +147 -2
- package/src/components/settings-container/settings-container.component.ts +44 -19
- package/src/components/settings-container/settings-container.scss +1 -1
- package/src/components/skeleton/skeleton.component.ts +6 -1
- package/src/components/slideout/slideout.scss +8 -3
- package/src/components/sp/sp.component.ts +3 -1
- package/src/components/sp/sp.scss +19 -0
- package/src/components/stepper/stepper.component.ts +16 -10
- package/src/components/textarea/textarea.scss +0 -4
- package/src/components/tile/tile.component.ts +12 -3
- package/src/components/tile/tile.scss +1 -1
- package/src/components/timer/timer.component.ts +15 -2
- package/src/components/toggle/toggle.component.ts +29 -26
- package/src/components/toggle/toggle.scss +13 -1
- package/src/components/translation-group/index.ts +12 -0
- package/src/components/translation-group/translation-group.component.ts +207 -0
- package/src/components/translation-group/translation-group.scss +8 -0
- package/src/components/translations/translations.component.ts +90 -44
- package/src/components/translations/translations.scss +4 -0
- package/src/components/vertical-stepper/vertical-stepper.component.ts +14 -9
- package/src/events/events.ts +12 -7
- package/src/events/zn-language-change.ts +7 -0
- package/src/events/zn-purchase.ts +11 -0
- package/src/events/zn-redirect.ts +7 -0
- package/src/events/zn-reorder.ts +7 -0
- package/src/events/zn-search-change.ts +11 -0
- package/src/events/zn-submit.ts +1 -1
- package/src/form-control.scss +4 -0
- package/src/internal/form-navigation.ts +510 -0
- package/src/internal/form.ts +6 -0
- package/src/zinc.ts +91 -83
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Cols
|
|
4
|
-
description:
|
|
4
|
+
description: A flexible column layout component that distributes children across multiple columns with configurable layouts, gaps, borders, and padding options.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -18,48 +18,170 @@ layout: component
|
|
|
18
18
|
|
|
19
19
|
## Examples
|
|
20
20
|
|
|
21
|
-
###
|
|
21
|
+
### Equal Column Layout
|
|
22
|
+
|
|
23
|
+
Create equal-width columns by using a layout pattern like "1,1" or "1,1,1".
|
|
24
|
+
|
|
25
|
+
```html:preview
|
|
26
|
+
<zn-cols layout="1,1">
|
|
27
|
+
<zn-panel>Column 1</zn-panel>
|
|
28
|
+
<zn-panel>Column 2</zn-panel>
|
|
29
|
+
</zn-cols>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Three Equal Columns
|
|
33
|
+
|
|
34
|
+
```html:preview
|
|
35
|
+
<zn-cols layout="1,1,1">
|
|
36
|
+
<zn-panel>Column 1</zn-panel>
|
|
37
|
+
<zn-panel>Column 2</zn-panel>
|
|
38
|
+
<zn-panel>Column 3</zn-panel>
|
|
39
|
+
</zn-cols>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Asymmetric Layout
|
|
43
|
+
|
|
44
|
+
Use different numbers in the layout to create columns of different widths. The pattern "2,1" creates a layout where the first column is twice as wide as the second.
|
|
45
|
+
|
|
46
|
+
```html:preview
|
|
47
|
+
<zn-cols layout="2,1">
|
|
48
|
+
<zn-panel>Wide Column (2 units)</zn-panel>
|
|
49
|
+
<zn-panel>Narrow Column (1 unit)</zn-panel>
|
|
50
|
+
</zn-cols>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Three Column Asymmetric
|
|
22
54
|
|
|
23
55
|
```html:preview
|
|
56
|
+
<zn-cols layout="3,2,1">
|
|
57
|
+
<zn-panel>Widest Column (3 units)</zn-panel>
|
|
58
|
+
<zn-panel>Medium Column (2 units)</zn-panel>
|
|
59
|
+
<zn-panel>Narrowest Column (1 unit)</zn-panel>
|
|
60
|
+
</zn-cols>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Repeating Pattern
|
|
64
|
+
|
|
65
|
+
The layout pattern repeats for additional children. With "2,1", items cycle through the pattern.
|
|
66
|
+
|
|
67
|
+
```html:preview
|
|
68
|
+
<zn-cols layout="2,1">
|
|
69
|
+
<zn-panel>1 (2 units)</zn-panel>
|
|
70
|
+
<zn-panel>2 (1 unit)</zn-panel>
|
|
71
|
+
<zn-panel>3 (2 units)</zn-panel>
|
|
72
|
+
<zn-panel>4 (1 unit)</zn-panel>
|
|
73
|
+
<zn-panel>5 (2 units)</zn-panel>
|
|
74
|
+
</zn-cols>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### With Borders
|
|
78
|
+
|
|
79
|
+
Use the `border` attribute to add borders around columns.
|
|
24
80
|
|
|
81
|
+
```html:preview
|
|
82
|
+
<zn-cols layout="1,1,1" border>
|
|
83
|
+
<zn-panel>Column 1</zn-panel>
|
|
84
|
+
<zn-panel>Column 2</zn-panel>
|
|
85
|
+
<zn-panel>Column 3</zn-panel>
|
|
86
|
+
</zn-cols>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Without Gap
|
|
90
|
+
|
|
91
|
+
Use the `no-gap` attribute to remove spacing between columns.
|
|
92
|
+
|
|
93
|
+
```html:preview
|
|
94
|
+
<zn-cols layout="1,1,1" no-gap border>
|
|
95
|
+
<zn-panel>No Gap</zn-panel>
|
|
96
|
+
<zn-panel>Between</zn-panel>
|
|
97
|
+
<zn-panel>Columns</zn-panel>
|
|
98
|
+
</zn-cols>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### With Padding
|
|
102
|
+
|
|
103
|
+
Use the `pad` attribute to add padding inside each column.
|
|
104
|
+
|
|
105
|
+
```html:preview
|
|
106
|
+
<zn-cols layout="1,1" pad border>
|
|
107
|
+
<zn-panel>Padded Column 1</zn-panel>
|
|
108
|
+
<zn-panel>Padded Column 2</zn-panel>
|
|
109
|
+
</zn-cols>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Horizontal Padding Only
|
|
113
|
+
|
|
114
|
+
Use the `pad-x` attribute to add only horizontal padding.
|
|
115
|
+
|
|
116
|
+
```html:preview
|
|
117
|
+
<zn-cols layout="1,1" pad-x border>
|
|
118
|
+
<zn-panel>Horizontal Padding</zn-panel>
|
|
119
|
+
<zn-panel>Horizontal Padding</zn-panel>
|
|
120
|
+
</zn-cols>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Vertical Padding Only
|
|
124
|
+
|
|
125
|
+
Use the `pad-y` attribute to add only vertical padding.
|
|
126
|
+
|
|
127
|
+
```html:preview
|
|
128
|
+
<zn-cols layout="1,1" pad-y border>
|
|
129
|
+
<zn-panel>Vertical Padding</zn-panel>
|
|
130
|
+
<zn-panel>Vertical Padding</zn-panel>
|
|
131
|
+
</zn-cols>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### With Dividers
|
|
135
|
+
|
|
136
|
+
Use the `divide` attribute to add dividers between columns.
|
|
137
|
+
|
|
138
|
+
```html:preview
|
|
139
|
+
<zn-cols layout="1,1,1" divide>
|
|
140
|
+
<zn-panel>Column 1</zn-panel>
|
|
141
|
+
<zn-panel>Column 2</zn-panel>
|
|
142
|
+
<zn-panel>Column 3</zn-panel>
|
|
143
|
+
</zn-cols>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Sticky Sidebar
|
|
147
|
+
|
|
148
|
+
Create a sticky sidebar layout for scrollable content.
|
|
149
|
+
|
|
150
|
+
```html:preview
|
|
25
151
|
<zn-cols layout="1,1">
|
|
26
|
-
|
|
27
152
|
<div>
|
|
28
153
|
<zn-panel style="position: -webkit-sticky; position: sticky; top:10px;">
|
|
29
|
-
<div class="box" style="height: 100px; margin: 10px 0; background: purple"
|
|
30
|
-
<div class="box" style="height: 100px;"
|
|
154
|
+
<div class="box" style="height: 100px; margin: 10px 0; background: purple">Sticky Sidebar</div>
|
|
155
|
+
<div class="box" style="height: 100px;">Navigation</div>
|
|
31
156
|
</zn-panel>
|
|
32
157
|
</div>
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<div class="box" style="height: 100px; background: orange"></div>
|
|
44
|
-
<div class="box" style="height: 100px; background: orange"></div>
|
|
45
|
-
<div class="box" style="height: 100px; background: orange"></div>
|
|
46
|
-
<div class="box" style="height: 100px; background: orange"></div>
|
|
47
|
-
<div class="box" style="height: 100px; background: orange"></div>
|
|
48
|
-
<div class="box" style="height: 100px; background: orange"></div>
|
|
49
|
-
</zn-panel>
|
|
50
|
-
|
|
158
|
+
|
|
159
|
+
<zn-panel>
|
|
160
|
+
<div class="box" style="height: 100px; margin: 10px 0; background: orange">Scrollable Content</div>
|
|
161
|
+
<div class="box" style="height: 100px; background: orange">Item 1</div>
|
|
162
|
+
<div class="box" style="height: 100px; background: orange">Item 2</div>
|
|
163
|
+
<div class="box" style="height: 100px; background: orange">Item 3</div>
|
|
164
|
+
<div class="box" style="height: 100px; background: orange">Item 4</div>
|
|
165
|
+
<div class="box" style="height: 100px; background: orange">Item 5</div>
|
|
166
|
+
<div class="box" style="height: 100px; background: orange">Item 6</div>
|
|
167
|
+
</zn-panel>
|
|
51
168
|
</zn-cols>
|
|
52
169
|
```
|
|
53
170
|
|
|
54
|
-
###
|
|
171
|
+
### Dashboard Layout
|
|
55
172
|
|
|
56
|
-
|
|
173
|
+
Combine multiple features for a complete dashboard layout.
|
|
57
174
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<zn-panel>
|
|
61
|
-
|
|
62
|
-
|
|
175
|
+
```html:preview
|
|
176
|
+
<zn-cols layout="2,1" border pad>
|
|
177
|
+
<zn-panel>
|
|
178
|
+
<h3>Main Content</h3>
|
|
179
|
+
<p>This is the main content area with a 2:1 ratio.</p>
|
|
180
|
+
</zn-panel>
|
|
181
|
+
<zn-panel>
|
|
182
|
+
<h3>Sidebar</h3>
|
|
183
|
+
<p>This is a narrower sidebar.</p>
|
|
184
|
+
</zn-panel>
|
|
63
185
|
</zn-cols>
|
|
64
186
|
```
|
|
65
187
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Confirm
|
|
4
|
-
description:
|
|
4
|
+
description: A confirmation dialog component that prompts users before performing critical actions. Supports various types (error, warning, success, info), custom content, form validation, and loading states.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -18,7 +18,7 @@ layout: component
|
|
|
18
18
|
type="error"
|
|
19
19
|
caption="Do Something"
|
|
20
20
|
content="Are you sure you want to do that?">
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
<form class="form-spacing">
|
|
23
23
|
<zn-input label="Name" required></zn-input>
|
|
24
24
|
<zn-input label="Email" type="email" required></zn-input>
|
|
@@ -28,25 +28,191 @@ layout: component
|
|
|
28
28
|
|
|
29
29
|
## Examples
|
|
30
30
|
|
|
31
|
-
###
|
|
31
|
+
### Confirmation Types
|
|
32
|
+
|
|
33
|
+
Use different types to indicate the severity or nature of the action.
|
|
32
34
|
|
|
33
35
|
```html:preview
|
|
34
|
-
<zn-button id="
|
|
35
|
-
<zn-confirm trigger="
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
<zn-button id="error-trigger">Error Confirmation</zn-button>
|
|
37
|
+
<zn-confirm trigger="error-trigger"
|
|
38
|
+
type="error"
|
|
39
|
+
caption="Delete Item"
|
|
40
|
+
content="Are you sure you want to delete this item? This action cannot be undone.">
|
|
41
|
+
</zn-confirm>
|
|
42
|
+
|
|
43
|
+
<zn-button id="warning-trigger">Warning Confirmation</zn-button>
|
|
44
|
+
<zn-confirm trigger="warning-trigger"
|
|
45
|
+
type="warning"
|
|
46
|
+
caption="Change Status"
|
|
47
|
+
content="Changing the status will affect related items. Continue?">
|
|
48
|
+
</zn-confirm>
|
|
49
|
+
|
|
50
|
+
<zn-button id="success-trigger">Success Confirmation</zn-button>
|
|
51
|
+
<zn-confirm trigger="success-trigger"
|
|
52
|
+
type="success"
|
|
53
|
+
caption="Complete Task"
|
|
54
|
+
content="Mark this task as complete?">
|
|
55
|
+
</zn-confirm>
|
|
56
|
+
|
|
57
|
+
<zn-button id="info-trigger">Info Confirmation</zn-button>
|
|
58
|
+
<zn-confirm trigger="info-trigger"
|
|
59
|
+
type="info"
|
|
60
|
+
caption="View Details"
|
|
61
|
+
content="Would you like to view the full details?">
|
|
62
|
+
</zn-confirm>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Custom Button Text
|
|
66
|
+
|
|
67
|
+
Customize the confirm and cancel button text using the `confirm-text` and `cancel-text` attributes.
|
|
68
|
+
|
|
69
|
+
```html:preview
|
|
70
|
+
<zn-button id="custom-text-trigger">Delete Account</zn-button>
|
|
71
|
+
<zn-confirm trigger="custom-text-trigger"
|
|
72
|
+
type="error"
|
|
73
|
+
caption="Delete Account"
|
|
74
|
+
content="This will permanently delete your account and all associated data."
|
|
75
|
+
confirm-text="Yes, Delete"
|
|
76
|
+
cancel-text="Keep Account">
|
|
77
|
+
</zn-confirm>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Dialog Sizes
|
|
81
|
+
|
|
82
|
+
Control the dialog size with the `size` attribute.
|
|
83
|
+
|
|
84
|
+
```html:preview
|
|
85
|
+
<zn-button id="small-trigger">Small Dialog</zn-button>
|
|
86
|
+
<zn-confirm trigger="small-trigger"
|
|
87
|
+
type="warning"
|
|
88
|
+
size="small"
|
|
89
|
+
caption="Quick Action"
|
|
90
|
+
content="This is a small confirmation dialog.">
|
|
91
|
+
</zn-confirm>
|
|
92
|
+
|
|
93
|
+
<zn-button id="medium-trigger">Medium Dialog</zn-button>
|
|
94
|
+
<zn-confirm trigger="medium-trigger"
|
|
95
|
+
type="warning"
|
|
96
|
+
size="medium"
|
|
97
|
+
caption="Standard Action"
|
|
98
|
+
content="This is a medium-sized confirmation dialog.">
|
|
99
|
+
</zn-confirm>
|
|
100
|
+
|
|
101
|
+
<zn-button id="large-trigger">Large Dialog</zn-button>
|
|
102
|
+
<zn-confirm trigger="large-trigger"
|
|
103
|
+
type="warning"
|
|
104
|
+
size="large"
|
|
105
|
+
caption="Complex Action"
|
|
106
|
+
content="This is a large confirmation dialog with more space for detailed information.">
|
|
107
|
+
</zn-confirm>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### With Form Content
|
|
111
|
+
|
|
112
|
+
Include form fields within the confirmation dialog for gathering additional information.
|
|
113
|
+
|
|
114
|
+
```html:preview
|
|
115
|
+
<zn-button id="form-trigger">Update Settings</zn-button>
|
|
116
|
+
<zn-confirm trigger="form-trigger"
|
|
117
|
+
type="info"
|
|
118
|
+
caption="Update Settings"
|
|
119
|
+
content="Please provide the following information:">
|
|
120
|
+
<form class="form-spacing">
|
|
121
|
+
<zn-input label="Name" required></zn-input>
|
|
122
|
+
<zn-input label="Email" type="email" required></zn-input>
|
|
123
|
+
<zn-textarea label="Reason for change"></zn-textarea>
|
|
124
|
+
</form>
|
|
45
125
|
</zn-confirm>
|
|
46
126
|
```
|
|
47
127
|
|
|
48
|
-
###
|
|
128
|
+
### Announcement Variant
|
|
49
129
|
|
|
50
|
-
|
|
130
|
+
Use the announcement variant for important notifications that require acknowledgment.
|
|
131
|
+
|
|
132
|
+
```html:preview
|
|
133
|
+
<zn-button id="announcement-trigger">View Announcement</zn-button>
|
|
134
|
+
<zn-confirm trigger="announcement-trigger"
|
|
135
|
+
variant="announcement"
|
|
136
|
+
type="warning"
|
|
137
|
+
caption="Important System Update"
|
|
138
|
+
content="The system will undergo maintenance tonight from 10 PM to 2 AM. During this time, all services will be unavailable.">
|
|
139
|
+
<form class="form-spacing">
|
|
140
|
+
<zn-input label="Name" required></zn-input>
|
|
141
|
+
<zn-input label="Email" type="email" required></zn-input>
|
|
142
|
+
</form>
|
|
143
|
+
</zn-confirm>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Without Icon
|
|
147
|
+
|
|
148
|
+
Hide the icon using the `hide-icon` attribute for a cleaner appearance.
|
|
149
|
+
|
|
150
|
+
```html:preview
|
|
151
|
+
<zn-button id="no-icon-trigger">Simple Confirm</zn-button>
|
|
152
|
+
<zn-confirm trigger="no-icon-trigger"
|
|
153
|
+
type="info"
|
|
154
|
+
caption="Continue?"
|
|
155
|
+
content="Do you want to proceed with this action?"
|
|
156
|
+
hide-icon>
|
|
157
|
+
</zn-confirm>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### With Loading State
|
|
161
|
+
|
|
162
|
+
Use the `show-loading` attribute to display a loading state after confirmation.
|
|
163
|
+
|
|
164
|
+
```html:preview
|
|
165
|
+
<zn-button id="loading-trigger">Submit Data</zn-button>
|
|
166
|
+
<zn-confirm trigger="loading-trigger"
|
|
167
|
+
type="success"
|
|
168
|
+
caption="Submit Data"
|
|
169
|
+
content="Ready to submit your data?"
|
|
170
|
+
show-loading>
|
|
171
|
+
</zn-confirm>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### With Footer Text
|
|
175
|
+
|
|
176
|
+
Add additional information in the footer using the `footer-text` attribute or slot.
|
|
177
|
+
|
|
178
|
+
```html:preview
|
|
179
|
+
<zn-button id="footer-trigger">Delete Files</zn-button>
|
|
180
|
+
<zn-confirm trigger="footer-trigger"
|
|
181
|
+
type="error"
|
|
182
|
+
caption="Delete Files"
|
|
183
|
+
content="This will delete all selected files permanently."
|
|
184
|
+
footer-text="This action cannot be undone and files cannot be recovered.">
|
|
185
|
+
</zn-confirm>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Multiple Triggers
|
|
189
|
+
|
|
190
|
+
Use the same trigger ID on multiple buttons to open the same confirmation dialog.
|
|
191
|
+
|
|
192
|
+
```html:preview
|
|
193
|
+
<zn-button id="multi-trigger">Delete from List</zn-button>
|
|
194
|
+
<zn-button id="multi-trigger" color="error">Delete from Table</zn-button>
|
|
195
|
+
<zn-button id="multi-trigger" color="transparent">Delete from Grid</zn-button>
|
|
196
|
+
|
|
197
|
+
<zn-confirm trigger="multi-trigger"
|
|
198
|
+
type="error"
|
|
199
|
+
caption="Delete Item"
|
|
200
|
+
content="Are you sure you want to delete this item?">
|
|
201
|
+
</zn-confirm>
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Form with Action
|
|
205
|
+
|
|
206
|
+
Specify a form action URL that will be submitted when confirmed.
|
|
207
|
+
|
|
208
|
+
```html:preview
|
|
209
|
+
<zn-button id="action-trigger-form">Submit to Server</zn-button>
|
|
210
|
+
<zn-confirm trigger="action-trigger-form"
|
|
211
|
+
type="success"
|
|
212
|
+
caption="Submit Form"
|
|
213
|
+
content="Ready to submit?"
|
|
214
|
+
action="/api/submit">
|
|
215
|
+
</zn-confirm>
|
|
216
|
+
```
|
|
51
217
|
|
|
52
218
|
|
|
@@ -1,22 +1,185 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Copy Button
|
|
4
|
-
description:
|
|
4
|
+
description: Copy buttons provide a simple way to copy text to the clipboard with visual feedback.
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
```html:preview
|
|
9
|
-
<zn-copy-button></zn-copy-button>
|
|
9
|
+
<zn-copy-button value="Hello, World!"></zn-copy-button>
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## Examples
|
|
13
13
|
|
|
14
|
-
###
|
|
14
|
+
### Copying a Value
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
Use the `value` attribute to specify the text that should be copied to the clipboard.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
```html:preview
|
|
19
|
+
<zn-copy-button value="This text will be copied"></zn-copy-button>
|
|
20
|
+
<zn-copy-button value="support@example.com"></zn-copy-button>
|
|
21
|
+
<zn-copy-button value="npm install @kubex/zinc"></zn-copy-button>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Copying from Elements
|
|
25
|
+
|
|
26
|
+
Use the `from` attribute to copy content from another element by its ID. By default, it copies the element's `textContent`.
|
|
27
|
+
|
|
28
|
+
```html:preview
|
|
29
|
+
<div id="content-to-copy">This is some text that can be copied.</div>
|
|
30
|
+
<zn-copy-button from="content-to-copy"></zn-copy-button>
|
|
31
|
+
|
|
32
|
+
<br /><br />
|
|
33
|
+
|
|
34
|
+
<input id="email-input" type="email" value="user@example.com" />
|
|
35
|
+
<zn-copy-button from="email-input.value"></zn-copy-button>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Copying Element Attributes
|
|
39
|
+
|
|
40
|
+
Append the attribute name in square brackets to copy a specific attribute value.
|
|
41
|
+
|
|
42
|
+
```html:preview
|
|
43
|
+
<a id="my-link" href="https://example.com">Example Link</a>
|
|
44
|
+
<zn-copy-button from="my-link[href]"></zn-copy-button>
|
|
45
|
+
|
|
46
|
+
<br /><br />
|
|
47
|
+
|
|
48
|
+
<img id="my-image" src="https://via.placeholder.com/150" alt="Placeholder" />
|
|
49
|
+
<zn-copy-button from="my-image[src]"></zn-copy-button>
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Copying Element Properties
|
|
53
|
+
|
|
54
|
+
Append a dot and the property name to copy a specific property value from an element.
|
|
55
|
+
|
|
56
|
+
```html:preview
|
|
57
|
+
<input id="username" type="text" value="john.doe" />
|
|
58
|
+
<zn-copy-button from="username.value"></zn-copy-button>
|
|
59
|
+
|
|
60
|
+
<br /><br />
|
|
61
|
+
|
|
62
|
+
<textarea id="bio">Software developer passionate about web components.</textarea>
|
|
63
|
+
<zn-copy-button from="bio.value"></zn-copy-button>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Custom Copy Label
|
|
67
|
+
|
|
68
|
+
Use the `copy-label` attribute to customize the tooltip text shown before copying.
|
|
69
|
+
|
|
70
|
+
```html:preview
|
|
71
|
+
<zn-copy-button value="Copy me!" copy-label="Click to copy"></zn-copy-button>
|
|
72
|
+
<zn-copy-button value="API Key: abc123xyz" copy-label="Copy API Key"></zn-copy-button>
|
|
73
|
+
<zn-copy-button value="https://example.com" copy-label="Copy URL"></zn-copy-button>
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Custom Icon
|
|
77
|
+
|
|
78
|
+
Use the `src` attribute to change the copy icon.
|
|
79
|
+
|
|
80
|
+
```html:preview
|
|
81
|
+
<zn-copy-button value="Custom icon button" src="content_paste"></zn-copy-button>
|
|
82
|
+
<zn-copy-button value="Another icon" src="file_copy"></zn-copy-button>
|
|
83
|
+
```
|
|
19
84
|
|
|
20
|
-
|
|
85
|
+
### Icon Size
|
|
21
86
|
|
|
87
|
+
Use the `size` attribute to control the icon size.
|
|
88
|
+
|
|
89
|
+
```html:preview
|
|
90
|
+
<zn-copy-button value="Small icon" size="16"></zn-copy-button>
|
|
91
|
+
<zn-copy-button value="Default size" size="24"></zn-copy-button>
|
|
92
|
+
<zn-copy-button value="Large icon" size="32"></zn-copy-button>
|
|
93
|
+
<zn-copy-button value="Extra large" size="48"></zn-copy-button>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Custom Icons with Slots
|
|
97
|
+
|
|
98
|
+
You can provide custom icons for the copy, success, and error states using slots.
|
|
99
|
+
|
|
100
|
+
```html:preview
|
|
101
|
+
<zn-copy-button value="Custom icons">
|
|
102
|
+
<zn-icon slot="copy-icon" src="content_copy" size="24"></zn-icon>
|
|
103
|
+
<zn-icon slot="success-icon" src="check_circle" size="24"></zn-icon>
|
|
104
|
+
<zn-icon slot="error-icon" src="error" size="24"></zn-icon>
|
|
105
|
+
</zn-copy-button>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Status Feedback
|
|
109
|
+
|
|
110
|
+
The copy button provides automatic visual feedback when the copy operation succeeds or fails. Click the button to see the status change.
|
|
111
|
+
|
|
112
|
+
```html:preview
|
|
113
|
+
<zn-copy-button value="Click to see success feedback"></zn-copy-button>
|
|
114
|
+
|
|
115
|
+
<br /><br />
|
|
116
|
+
|
|
117
|
+
<!-- This will show error feedback since the element doesn't exist -->
|
|
118
|
+
<zn-copy-button from="non-existent-element"></zn-copy-button>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Listening to Events
|
|
122
|
+
|
|
123
|
+
The copy button emits `zn-copy` events when text is successfully copied and `zn-error` events when the copy operation fails.
|
|
124
|
+
|
|
125
|
+
```html:preview
|
|
126
|
+
<zn-copy-button
|
|
127
|
+
id="event-demo"
|
|
128
|
+
value="Copy me to see the event"
|
|
129
|
+
copy-label="Copy text">
|
|
130
|
+
</zn-copy-button>
|
|
131
|
+
|
|
132
|
+
<div id="event-log"></div>
|
|
133
|
+
|
|
134
|
+
<script type="module">
|
|
135
|
+
const copyButton = document.getElementById('event-demo');
|
|
136
|
+
const eventLog = document.getElementById('event-log');
|
|
137
|
+
|
|
138
|
+
copyButton.addEventListener('zn-copy', (event) => {
|
|
139
|
+
eventLog.innerHTML = `<zn-alert caption="Copy Success" level="success" icon="check">
|
|
140
|
+
Copied: "${event.detail.value}"
|
|
141
|
+
</zn-alert>`;
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
copyButton.addEventListener('zn-error', () => {
|
|
145
|
+
eventLog.innerHTML = `<zn-alert caption="Copy Error" level="error" icon="error">
|
|
146
|
+
Failed to copy to clipboard
|
|
147
|
+
</zn-alert>`;
|
|
148
|
+
});
|
|
149
|
+
</script>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Real-world Examples
|
|
153
|
+
|
|
154
|
+
Here are some practical use cases for copy buttons.
|
|
155
|
+
|
|
156
|
+
```html:preview
|
|
157
|
+
<!-- Code snippet with copy button -->
|
|
158
|
+
<div style="display: flex; align-items: start; gap: 8px;">
|
|
159
|
+
<pre id="code-snippet" style="background: #f5f5f5; padding: 12px; border-radius: 4px; margin: 0; flex: 1;">npm install @kubex/zinc
|
|
160
|
+
import { ZnButton } from '@kubex/zinc';</pre>
|
|
161
|
+
<zn-copy-button from="code-snippet" copy-label="Copy code"></zn-copy-button>
|
|
162
|
+
</div>
|
|
163
|
+
|
|
164
|
+
<br /><br />
|
|
165
|
+
|
|
166
|
+
<!-- API Key display with copy button -->
|
|
167
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
168
|
+
<span style="font-family: monospace; background: #f5f5f5; padding: 8px; border-radius: 4px;">sk_live_abc123xyz789</span>
|
|
169
|
+
<zn-copy-button value="sk_live_abc123xyz789" copy-label="Copy API Key"></zn-copy-button>
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<br /><br />
|
|
173
|
+
|
|
174
|
+
<!-- URL with copy button -->
|
|
175
|
+
<div style="display: flex; align-items: center; gap: 8px;">
|
|
176
|
+
<input
|
|
177
|
+
id="share-url"
|
|
178
|
+
type="text"
|
|
179
|
+
value="https://example.com/share/abc123"
|
|
180
|
+
readonly
|
|
181
|
+
style="flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 4px;" />
|
|
182
|
+
<zn-copy-button from="share-url.value" copy-label="Copy share link"></zn-copy-button>
|
|
183
|
+
</div>
|
|
184
|
+
```
|
|
22
185
|
|