@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.
- package/.claude/project.md +556 -0
- package/.github/workflows/js_build_and_deploy.yaml +9 -10
- package/dist/custom-elements.json +13431 -8728
- package/dist/vscode.html-custom-data.json +571 -37
- package/dist/web-types.json +1439 -181
- package/dist/zn.d.ts +1642 -661
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +1407 -887
- 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/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 -18
- 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 +82 -23
- 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 +328 -5
- package/src/components/input/input.scss +100 -4
- 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 +11 -2
- package/src/components/item/item.scss +7 -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 -8
- 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 -42
- package/src/components/translations/translations.scss +5 -1
- 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: Slideout
|
|
4
|
-
description: 'Slideouts
|
|
4
|
+
description: 'Slideouts appear from the side of the screen and are used to display additional content without navigating away from the current page.'
|
|
5
5
|
layout: component
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -9,15 +9,271 @@ layout: component
|
|
|
9
9
|
|
|
10
10
|
### Basic Slideout
|
|
11
11
|
|
|
12
|
-
This is a basic
|
|
12
|
+
This is a basic slideout that can be triggered by a button. It slides in from the right side of the screen and includes a header with a close button and a footer with action buttons.
|
|
13
13
|
|
|
14
14
|
```html:preview
|
|
15
|
-
|
|
16
|
-
<zn-button id="slideout-trigger">Open Basic slideout</zn-button>
|
|
15
|
+
<zn-button id="slideout-trigger">Open Basic Slideout</zn-button>
|
|
17
16
|
<zn-slideout class="slideout-basic" trigger="slideout-trigger" label="Slideout">
|
|
18
|
-
This is the slideout
|
|
17
|
+
This is the slideout's body.
|
|
19
18
|
|
|
20
19
|
<zn-button color="default" slot="footer">Do Something</zn-button>
|
|
21
20
|
<zn-button color="secondary" slot="footer" slideout-closer>Close Slideout</zn-button>
|
|
22
21
|
</zn-slideout>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Labels
|
|
25
|
+
|
|
26
|
+
The slideout's label is displayed in the header and is required for proper accessibility. Use the `label` attribute to set the label text.
|
|
27
|
+
|
|
28
|
+
```html:preview
|
|
29
|
+
<zn-button id="slideout-label-trigger">Open Slideout</zn-button>
|
|
30
|
+
<zn-slideout trigger="slideout-label-trigger" label="Important Information">
|
|
31
|
+
This slideout has a label in the header that describes its purpose.
|
|
32
|
+
|
|
33
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
34
|
+
</zn-slideout>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
For HTML content in the label, use the `label` slot instead.
|
|
38
|
+
|
|
39
|
+
```html:preview
|
|
40
|
+
<zn-button id="slideout-label-slot-trigger">Open Slideout</zn-button>
|
|
41
|
+
<zn-slideout trigger="slideout-label-slot-trigger">
|
|
42
|
+
<span slot="label">Important <em>Information</em></span>
|
|
43
|
+
This slideout uses the label slot for HTML content.
|
|
44
|
+
|
|
45
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
46
|
+
</zn-slideout>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Custom Width
|
|
50
|
+
|
|
51
|
+
You can set a custom slideout width using the `--width` CSS custom property. The default width is `min(100vw, 46rem)`. Note that the slideout will automatically shrink to accommodate smaller screens.
|
|
52
|
+
|
|
53
|
+
```html:preview
|
|
54
|
+
<zn-button id="slideout-custom-width-trigger">Open Custom Width Slideout</zn-button>
|
|
55
|
+
<zn-slideout trigger="slideout-custom-width-trigger" label="Custom Width" style="--width: 800px;">
|
|
56
|
+
This slideout has a custom width of 800px set using the --width CSS property.
|
|
57
|
+
|
|
58
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
59
|
+
</zn-slideout>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Scrolling Content
|
|
63
|
+
|
|
64
|
+
When the slideout content is longer than the viewport, the body area automatically becomes scrollable while keeping the header and footer fixed.
|
|
65
|
+
|
|
66
|
+
```html:preview
|
|
67
|
+
<zn-button id="slideout-scrolling-trigger">Open Scrolling Slideout</zn-button>
|
|
68
|
+
<zn-slideout trigger="slideout-scrolling-trigger" label="Scrolling Content">
|
|
69
|
+
<p>This slideout has a lot of content that requires scrolling.</p>
|
|
70
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
71
|
+
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
|
72
|
+
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
|
|
73
|
+
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
74
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
75
|
+
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
|
|
76
|
+
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
|
|
77
|
+
<p>Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
78
|
+
|
|
79
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
80
|
+
<zn-button color="default" slot="footer">Save</zn-button>
|
|
81
|
+
</zn-slideout>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Slideouts as Forms
|
|
85
|
+
|
|
86
|
+
Use slideouts as forms when you need to collect information from users without navigating away from the current page. This example shows a slideout with a form inside it.
|
|
87
|
+
|
|
88
|
+
```html:preview
|
|
89
|
+
<form method="post" action="#" style="display: inline-block">
|
|
90
|
+
<zn-button id="slideout-form-trigger">Open Form Slideout</zn-button>
|
|
91
|
+
<zn-slideout trigger="slideout-form-trigger" label="Edit Profile">
|
|
92
|
+
<zn-form-group
|
|
93
|
+
label="Profile Information"
|
|
94
|
+
label-tooltip="This information will be displayed on your public profile"
|
|
95
|
+
help-text="All fields marked with an asterisk are required">
|
|
96
|
+
|
|
97
|
+
<div class="form-spacing">
|
|
98
|
+
<zn-input type="text" name="name" label="Name" required></zn-input>
|
|
99
|
+
<zn-select label="Favorite Animal" clearable required>
|
|
100
|
+
<zn-option value="birds">Birds</zn-option>
|
|
101
|
+
<zn-option value="cats">Cats</zn-option>
|
|
102
|
+
<zn-option value="dogs">Dogs</zn-option>
|
|
103
|
+
<zn-option value="other">Other</zn-option>
|
|
104
|
+
</zn-select>
|
|
105
|
+
|
|
106
|
+
<zn-textarea name="comment" label="Bio" required></zn-textarea>
|
|
107
|
+
|
|
108
|
+
<zn-checkbox required>I agree to the terms and conditions</zn-checkbox>
|
|
109
|
+
|
|
110
|
+
<br>
|
|
111
|
+
<zn-checkbox-group label="Interests" help-text="Select at least one" label-tooltip="Choose your areas of interest"
|
|
112
|
+
required>
|
|
113
|
+
<zn-checkbox value="technology">Technology</zn-checkbox>
|
|
114
|
+
<zn-checkbox value="sports">Sports</zn-checkbox>
|
|
115
|
+
<zn-checkbox value="music">Music</zn-checkbox>
|
|
116
|
+
</zn-checkbox-group>
|
|
117
|
+
</div>
|
|
118
|
+
</zn-form-group>
|
|
119
|
+
|
|
120
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Cancel</zn-button>
|
|
121
|
+
<zn-button color="default" slot="footer" type="submit">Save Profile</zn-button>
|
|
122
|
+
</zn-slideout>
|
|
123
|
+
</form>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Programmatic Control
|
|
127
|
+
|
|
128
|
+
Slideouts can be controlled programmatically using the `show()` and `hide()` methods. You can also check or set the `open` property to manage the slideout state.
|
|
129
|
+
|
|
130
|
+
```html:preview
|
|
131
|
+
<div>
|
|
132
|
+
<zn-button class="slideout-show">Show Slideout</zn-button>
|
|
133
|
+
<zn-button class="slideout-hide">Hide Slideout</zn-button>
|
|
134
|
+
<zn-button class="slideout-toggle">Toggle Slideout</zn-button>
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<zn-slideout class="slideout-programmatic" label="Programmatic Control">
|
|
138
|
+
This slideout is controlled programmatically using JavaScript methods.
|
|
139
|
+
|
|
140
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
141
|
+
</zn-slideout>
|
|
142
|
+
|
|
143
|
+
<script type="module">
|
|
144
|
+
const slideout = document.querySelector('.slideout-programmatic');
|
|
145
|
+
const showButton = document.querySelector('.slideout-show');
|
|
146
|
+
const hideButton = document.querySelector('.slideout-hide');
|
|
147
|
+
const toggleButton = document.querySelector('.slideout-toggle');
|
|
148
|
+
|
|
149
|
+
showButton.addEventListener('click', () => slideout.show());
|
|
150
|
+
hideButton.addEventListener('click', () => slideout.hide());
|
|
151
|
+
toggleButton.addEventListener('click', () => {
|
|
152
|
+
if (slideout.open) {
|
|
153
|
+
slideout.hide();
|
|
154
|
+
} else {
|
|
155
|
+
slideout.show();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
</script>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Listening to Events
|
|
162
|
+
|
|
163
|
+
The slideout 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.
|
|
164
|
+
|
|
165
|
+
```html:preview
|
|
166
|
+
<zn-button id="slideout-events-trigger">Open Slideout</zn-button>
|
|
167
|
+
<zn-slideout class="slideout-events" trigger="slideout-events-trigger" label="Slideout Events">
|
|
168
|
+
Open the browser console to see events logged as you interact with this slideout.
|
|
169
|
+
|
|
170
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
171
|
+
</zn-slideout>
|
|
172
|
+
|
|
173
|
+
<script type="module">
|
|
174
|
+
const slideout = document.querySelector('.slideout-events');
|
|
175
|
+
|
|
176
|
+
slideout.addEventListener('zn-show', () => {
|
|
177
|
+
console.log('Slideout opened');
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
slideout.addEventListener('zn-close', () => {
|
|
181
|
+
console.log('Slideout closed');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
slideout.addEventListener('zn-request-close', (event) => {
|
|
185
|
+
console.log('Close requested from:', event.detail.source);
|
|
186
|
+
});
|
|
187
|
+
</script>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Preventing Close
|
|
191
|
+
|
|
192
|
+
The `zn-request-close` event can be cancelled to prevent the slideout from closing. This is useful when you need to validate data or confirm an action before allowing the slideout to close.
|
|
193
|
+
|
|
194
|
+
:::warning
|
|
195
|
+
**Note:** Use this feature sparingly and only when closing the slideout would result in destructive behavior such as data loss. Preventing close can be frustrating for users if overused.
|
|
196
|
+
:::
|
|
197
|
+
|
|
198
|
+
```html:preview
|
|
199
|
+
<zn-button id="slideout-prevent-close-trigger">Open Slideout</zn-button>
|
|
200
|
+
<zn-slideout class="slideout-prevent-close" trigger="slideout-prevent-close-trigger" label="Unsaved Changes">
|
|
201
|
+
<p>Try closing this slideout using the close button or pressing Escape.</p>
|
|
202
|
+
<p>You'll need to click the "I'm Sure" button to actually close it.</p>
|
|
203
|
+
|
|
204
|
+
<zn-button color="warning" slot="footer" class="close-allowed">I'm Sure</zn-button>
|
|
205
|
+
</zn-slideout>
|
|
206
|
+
|
|
207
|
+
<script type="module">
|
|
208
|
+
const slideout = document.querySelector('.slideout-prevent-close');
|
|
209
|
+
const confirmButton = document.querySelector('.close-allowed');
|
|
210
|
+
|
|
211
|
+
// Prevent all close attempts
|
|
212
|
+
slideout.addEventListener('zn-request-close', (event) => {
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
alert('Please click "I\'m Sure" to close this slideout.');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// Allow close when clicking the confirmation button
|
|
218
|
+
confirmButton.addEventListener('click', () => {
|
|
219
|
+
slideout.hide();
|
|
220
|
+
});
|
|
221
|
+
</script>
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
You can also prevent close from specific sources by checking the `event.detail.source` property.
|
|
225
|
+
|
|
226
|
+
```html:preview
|
|
227
|
+
<zn-button id="slideout-prevent-specific-trigger">Open Slideout</zn-button>
|
|
228
|
+
<zn-slideout class="slideout-prevent-specific" trigger="slideout-prevent-specific-trigger" label="Selective Close Prevention">
|
|
229
|
+
<p>This slideout prevents closing via the Escape key, but allows the close button to work.</p>
|
|
230
|
+
|
|
231
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
232
|
+
</zn-slideout>
|
|
233
|
+
|
|
234
|
+
<script type="module">
|
|
235
|
+
const slideout = document.querySelector('.slideout-prevent-specific');
|
|
236
|
+
|
|
237
|
+
slideout.addEventListener('zn-request-close', (event) => {
|
|
238
|
+
// Prevent close from keyboard, but allow close button
|
|
239
|
+
if (event.detail.source === 'keyboard') {
|
|
240
|
+
event.preventDefault();
|
|
241
|
+
alert('Please use the close button to dismiss this slideout.');
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
</script>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Slideout Closer Attribute
|
|
248
|
+
|
|
249
|
+
Add the `slideout-closer` attribute to any element inside the slideout to make it close the slideout when clicked. This is commonly used with buttons in the footer.
|
|
250
|
+
|
|
251
|
+
```html:preview
|
|
252
|
+
<zn-button id="slideout-closer-trigger">Open Slideout</zn-button>
|
|
253
|
+
<zn-slideout trigger="slideout-closer-trigger" label="Slideout Closer">
|
|
254
|
+
<p>Any element with the slideout-closer attribute will close this slideout when clicked.</p>
|
|
255
|
+
|
|
256
|
+
<zn-button color="default" slot="footer">This Won't Close</zn-button>
|
|
257
|
+
<zn-button color="secondary" slot="footer" slideout-closer>This Will Close</zn-button>
|
|
258
|
+
</zn-slideout>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Customizing Spacing
|
|
262
|
+
|
|
263
|
+
Use CSS custom properties to customize the padding in different areas of the slideout.
|
|
264
|
+
|
|
265
|
+
```html:preview
|
|
266
|
+
<zn-button id="slideout-spacing-trigger">Open Slideout</zn-button>
|
|
267
|
+
<zn-slideout
|
|
268
|
+
trigger="slideout-spacing-trigger"
|
|
269
|
+
label="Custom Spacing"
|
|
270
|
+
style="
|
|
271
|
+
--header-spacing: 2rem;
|
|
272
|
+
--body-spacing: 3rem;
|
|
273
|
+
--footer-spacing: 2rem;
|
|
274
|
+
">
|
|
275
|
+
This slideout has custom spacing applied using CSS properties.
|
|
276
|
+
|
|
277
|
+
<zn-button color="secondary" slot="footer" slideout-closer>Close</zn-button>
|
|
278
|
+
</zn-slideout>
|
|
23
279
|
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
meta:
|
|
3
3
|
title: Sp
|
|
4
|
-
description:
|
|
4
|
+
description: A flexible layout container for spacing and arranging child elements in rows or columns with configurable gap, padding, and dividers.
|
|
5
5
|
layout: component
|
|
6
6
|
fullWidth: true
|
|
7
7
|
---
|
|
@@ -17,71 +17,129 @@ fullWidth: true
|
|
|
17
17
|
|
|
18
18
|
## Examples
|
|
19
19
|
|
|
20
|
-
###
|
|
20
|
+
### Row
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Use the `row` attribute to lay out children horizontally instead of vertically.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
<
|
|
24
|
+
```html:preview
|
|
25
|
+
<zn-sp row>
|
|
26
|
+
<zn-chip>One</zn-chip>
|
|
27
|
+
<zn-chip>Two</zn-chip>
|
|
28
|
+
<zn-chip>Three</zn-chip>
|
|
29
29
|
</zn-sp>
|
|
30
|
-
|
|
30
|
+
```
|
|
31
31
|
|
|
32
|
-
###
|
|
32
|
+
### Gap Sizes
|
|
33
|
+
|
|
34
|
+
Use the `gap` attribute to control the spacing between children. Available sizes are `px`, `xxs`, `xs`, `sm`, `md`, `lg`, and `xl`.
|
|
33
35
|
|
|
34
36
|
```html:preview
|
|
35
|
-
<zn-sp
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<
|
|
37
|
+
<zn-sp row gap="px">
|
|
38
|
+
<zn-chip>px</zn-chip><zn-chip>gap</zn-chip>
|
|
39
|
+
</zn-sp>
|
|
40
|
+
<zn-sp row gap="xs">
|
|
41
|
+
<zn-chip>xs</zn-chip><zn-chip>gap</zn-chip>
|
|
42
|
+
</zn-sp>
|
|
43
|
+
<zn-sp row gap="sm">
|
|
44
|
+
<zn-chip>sm</zn-chip><zn-chip>gap</zn-chip>
|
|
40
45
|
</zn-sp>
|
|
41
|
-
|
|
46
|
+
<zn-sp row gap="md">
|
|
47
|
+
<zn-chip>md</zn-chip><zn-chip>gap</zn-chip>
|
|
48
|
+
</zn-sp>
|
|
49
|
+
<zn-sp row gap="lg">
|
|
50
|
+
<zn-chip>lg</zn-chip><zn-chip>gap</zn-chip>
|
|
51
|
+
</zn-sp>
|
|
52
|
+
<zn-sp row gap="xl">
|
|
53
|
+
<zn-chip>xl</zn-chip><zn-chip>gap</zn-chip>
|
|
54
|
+
</zn-sp>
|
|
55
|
+
```
|
|
42
56
|
|
|
43
|
-
###
|
|
57
|
+
### No Gap
|
|
58
|
+
|
|
59
|
+
Use the `no-gap` attribute to remove all spacing between children.
|
|
44
60
|
|
|
45
61
|
```html:preview
|
|
46
|
-
<zn-sp row>
|
|
47
|
-
<
|
|
48
|
-
<
|
|
49
|
-
<
|
|
50
|
-
<p>Hello World</p>
|
|
62
|
+
<zn-sp row no-gap>
|
|
63
|
+
<zn-chip>No</zn-chip>
|
|
64
|
+
<zn-chip>Gap</zn-chip>
|
|
65
|
+
<zn-chip>Between</zn-chip>
|
|
51
66
|
</zn-sp>
|
|
52
67
|
```
|
|
53
68
|
|
|
54
|
-
###
|
|
69
|
+
### Flush
|
|
70
|
+
|
|
71
|
+
By default, `zn-sp` applies padding. Use the `flush` attribute to remove all padding, or `flush-x` / `flush-y` to remove padding in a single direction.
|
|
55
72
|
|
|
56
73
|
```html:preview
|
|
57
|
-
<
|
|
58
|
-
<
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
<div style="background: #f5f5f5; border: 1px dashed #ccc;">
|
|
75
|
+
<zn-sp>
|
|
76
|
+
<p>Default padding</p>
|
|
77
|
+
</zn-sp>
|
|
78
|
+
</div>
|
|
79
|
+
<br />
|
|
80
|
+
<div style="background: #f5f5f5; border: 1px dashed #ccc;">
|
|
81
|
+
<zn-sp flush>
|
|
82
|
+
<p>Flush (no padding)</p>
|
|
83
|
+
</zn-sp>
|
|
84
|
+
</div>
|
|
85
|
+
<br />
|
|
86
|
+
<div style="background: #f5f5f5; border: 1px dashed #ccc;">
|
|
87
|
+
<zn-sp flush-x>
|
|
88
|
+
<p>Flush X (no horizontal padding)</p>
|
|
89
|
+
</zn-sp>
|
|
90
|
+
</div>
|
|
91
|
+
<br />
|
|
92
|
+
<div style="background: #f5f5f5; border: 1px dashed #ccc;">
|
|
93
|
+
<zn-sp flush-y>
|
|
94
|
+
<p>Flush Y (no vertical padding)</p>
|
|
95
|
+
</zn-sp>
|
|
96
|
+
</div>
|
|
63
97
|
```
|
|
64
98
|
|
|
65
|
-
|
|
99
|
+
Individual sides can also be flushed with `flush-t`, `flush-b`, `flush-l`, and `flush-r`.
|
|
100
|
+
|
|
101
|
+
### Divided
|
|
102
|
+
|
|
103
|
+
Use the `divide` attribute to add divider lines between children.
|
|
66
104
|
|
|
67
105
|
```html:preview
|
|
68
|
-
<zn-sp
|
|
69
|
-
<p>
|
|
70
|
-
<p>
|
|
71
|
-
<p>
|
|
72
|
-
<p>Hello World</p>
|
|
106
|
+
<zn-sp divide>
|
|
107
|
+
<p>Section One</p>
|
|
108
|
+
<p>Section Two</p>
|
|
109
|
+
<p>Section Three</p>
|
|
73
110
|
</zn-sp>
|
|
74
111
|
```
|
|
75
112
|
|
|
76
|
-
|
|
113
|
+
### Grow
|
|
114
|
+
|
|
115
|
+
Use the `grow` attribute to make the container expand to fill available space.
|
|
77
116
|
|
|
78
117
|
```html:preview
|
|
79
|
-
<
|
|
80
|
-
<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
118
|
+
<div style="display: flex; height: 120px; border: 1px dashed #ccc;">
|
|
119
|
+
<zn-sp grow>
|
|
120
|
+
<p>This container grows to fill the parent</p>
|
|
121
|
+
</zn-sp>
|
|
122
|
+
</div>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Restricted Width
|
|
126
|
+
|
|
127
|
+
Use the `width-container` attribute to constrain the content to a maximum width.
|
|
128
|
+
|
|
129
|
+
```html:preview
|
|
130
|
+
<zn-sp width-container>
|
|
131
|
+
<p>This content is width-constrained</p>
|
|
132
|
+
<p>Useful for readable line lengths</p>
|
|
84
133
|
</zn-sp>
|
|
85
134
|
```
|
|
86
135
|
|
|
136
|
+
### Form Container
|
|
87
137
|
|
|
138
|
+
Use `form-container` or `wide-form-container` to constrain the width for form layouts.
|
|
139
|
+
|
|
140
|
+
```html:preview
|
|
141
|
+
<zn-sp form-container>
|
|
142
|
+
<zn-input label="Name"></zn-input>
|
|
143
|
+
<zn-input label="Email"></zn-input>
|
|
144
|
+
</zn-sp>
|
|
145
|
+
```
|