@warp-ds/elements 2.10.0-next.14 → 2.10.0-next.15
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/dist/custom-elements.json +372 -0
- package/dist/docs/attention/api.md +48 -0
- package/dist/docs/attention/attention.md +48 -0
- package/dist/docs/button/api.md +8 -0
- package/dist/docs/button/button.md +8 -0
- package/dist/docs/card/api.md +8 -0
- package/dist/docs/card/card.md +8 -0
- package/dist/docs/checkbox/api.md +48 -0
- package/dist/docs/checkbox/checkbox.md +48 -0
- package/dist/docs/checkbox-group/api.md +24 -0
- package/dist/docs/checkbox-group/checkbox-group.md +24 -0
- package/dist/docs/combobox/api.md +8 -0
- package/dist/docs/combobox/combobox.md +8 -0
- package/dist/docs/datepicker/api.md +8 -0
- package/dist/docs/datepicker/datepicker.md +8 -0
- package/dist/docs/index.md +2 -0
- package/dist/docs/modal/api.md +16 -0
- package/dist/docs/modal/modal.md +16 -0
- package/dist/docs/slider-thumb/api.md +16 -0
- package/dist/docs/slider-thumb/slider-thumb.md +16 -0
- package/dist/docs/snackbar/accessibility.md +20 -0
- package/dist/docs/snackbar/api.md +30 -0
- package/dist/docs/snackbar/examples.md +191 -0
- package/dist/docs/snackbar/snackbar.md +385 -0
- package/dist/docs/snackbar/styling.md +72 -0
- package/dist/docs/snackbar/usage.md +60 -0
- package/dist/docs/snackbar-item/api.md +41 -0
- package/dist/docs/snackbar-item/snackbar-item.md +49 -0
- package/dist/docs/step/api.md +16 -0
- package/dist/docs/step/step.md +16 -0
- package/dist/docs/switch/api.md +8 -0
- package/dist/docs/switch/switch.md +8 -0
- package/dist/docs/textarea/api.md +40 -0
- package/dist/docs/textarea/textarea.md +40 -0
- package/dist/docs/textfield/api.md +32 -0
- package/dist/docs/textfield/textfield.md +32 -0
- package/dist/index.d.ts +292 -1
- package/dist/packages/affix/affix.js +4 -4
- package/dist/packages/affix/affix.js.map +2 -2
- package/dist/packages/alert/alert.js +2 -2
- package/dist/packages/alert/alert.js.map +2 -2
- package/dist/packages/attention/attention.d.ts +5 -0
- package/dist/packages/attention/attention.js +14 -14
- package/dist/packages/attention/attention.js.map +2 -2
- package/dist/packages/button/button.d.ts +5 -0
- package/dist/packages/button/button.js +3 -3
- package/dist/packages/button/button.js.map +2 -2
- package/dist/packages/button/button.react.stories.d.ts +2 -2
- package/dist/packages/button/button.test.js +0 -1
- package/dist/packages/button/react.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.js +1 -1
- package/dist/packages/datepicker/datepicker.js.map +2 -2
- package/dist/packages/expandable/expandable.js +9 -9
- package/dist/packages/expandable/expandable.js.map +4 -4
- package/dist/packages/global.d.ts +1 -0
- package/dist/packages/global.js +5 -0
- package/dist/packages/icon/icon.d.ts +5 -0
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +2 -2
- package/dist/packages/interaction-type-detection.d.ts +22 -0
- package/dist/packages/interaction-type-detection.js +38 -0
- package/dist/packages/modal/modal.js +1 -1
- package/dist/packages/modal/modal.js.map +2 -2
- package/dist/packages/modal-header/modal-header.js +3 -3
- package/dist/packages/modal-header/modal-header.js.map +2 -2
- package/dist/packages/pagination/pagination.js +1 -1
- package/dist/packages/pagination/pagination.js.map +2 -2
- package/dist/packages/pill/pill.js +4 -4
- package/dist/packages/pill/pill.js.map +2 -2
- package/dist/packages/select/select.js +3 -3
- package/dist/packages/select/select.js.map +2 -2
- package/dist/packages/snackbar/locales/da/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/da/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/en/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/en/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/fi/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/fi/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/nb/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/nb/messages.mjs +1 -0
- package/dist/packages/snackbar/locales/sv/messages.d.mts +1 -0
- package/dist/packages/snackbar/locales/sv/messages.mjs +1 -0
- package/dist/packages/snackbar/react.d.ts +2 -0
- package/dist/packages/snackbar/react.js +11 -0
- package/dist/packages/snackbar/snackbar.d.ts +132 -0
- package/dist/packages/snackbar/snackbar.hydration.test.d.ts +1 -0
- package/dist/packages/snackbar/snackbar.hydration.test.js +13 -0
- package/dist/packages/snackbar/snackbar.js +2646 -0
- package/dist/packages/snackbar/snackbar.js.map +7 -0
- package/dist/packages/snackbar/snackbar.react.stories.d.ts +12 -0
- package/dist/packages/snackbar/snackbar.react.stories.js +160 -0
- package/dist/packages/snackbar/snackbar.stories.d.ts +20 -0
- package/dist/packages/snackbar/snackbar.stories.js +291 -0
- package/dist/packages/snackbar/snackbar.test.d.ts +4 -0
- package/dist/packages/snackbar/snackbar.test.js +17 -0
- package/dist/packages/snackbar/styles.d.ts +1 -0
- package/dist/packages/snackbar/styles.js +35 -0
- package/dist/packages/snackbar-item/react.d.ts +5 -0
- package/dist/packages/snackbar-item/react.js +15 -0
- package/dist/packages/snackbar-item/snackbar-item.d.ts +69 -0
- package/dist/packages/snackbar-item/snackbar-item.js +2601 -0
- package/dist/packages/snackbar-item/snackbar-item.js.map +7 -0
- package/dist/packages/snackbar-item/snackbar-item.react.test.d.ts +1 -0
- package/dist/packages/snackbar-item/snackbar-item.react.test.js +5 -0
- package/dist/packages/snackbar-item/styles.d.ts +1 -0
- package/dist/packages/snackbar-item/styles.js +111 -0
- package/dist/packages/step/step.js +9 -9
- package/dist/packages/step/step.js.map +2 -2
- package/dist/packages/tabs/tabs.react.stories.d.ts +4 -4
- package/dist/packages/tabs/tabs.react.stories.js +1 -1
- package/dist/packages/tabs/tabs.stories.d.ts +1 -1
- package/dist/packages/tabs/tabs.stories.js +1 -1
- package/dist/packages/toast/toast.js +6 -6
- package/dist/packages/toast/toast.js.map +4 -4
- package/dist/packages/utils/element-collapse.d.ts +12 -0
- package/dist/packages/utils/element-collapse.js +92 -0
- package/dist/packages/utils/expand-transition.js +1 -1
- package/dist/web-types.json +88 -3
- package/eik/index.js +12 -12
- package/package.json +1 -3
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { getStorybookHelpers } from '@wc-toolkit/storybook-helpers';
|
|
2
|
+
import { html } from 'lit';
|
|
3
|
+
// @ts-expect-error You'll find no types here, TypeScript the Grey
|
|
4
|
+
import 'virtual:uno.css';
|
|
5
|
+
import '../attention/attention.js';
|
|
6
|
+
import '../button/button.js';
|
|
7
|
+
import '../icon/icon.js';
|
|
8
|
+
import '../modal/modal.js';
|
|
9
|
+
import '../modal-header/modal-header.js';
|
|
10
|
+
import '../modal-footer/modal-footer.js';
|
|
11
|
+
import './snackbar.js';
|
|
12
|
+
import '../snackbar-item/snackbar-item.js';
|
|
13
|
+
import { SnackbarDuration } from '../snackbar-item/snackbar-item.js';
|
|
14
|
+
const { events: snackbarEvents, args: snackbarArgs, argTypes: snackbarArgTypes, } = getStorybookHelpers('w-snackbar');
|
|
15
|
+
const meta = {
|
|
16
|
+
title: 'Overlays/Snackbar',
|
|
17
|
+
args: {
|
|
18
|
+
...snackbarArgs,
|
|
19
|
+
canClose: true,
|
|
20
|
+
duration: undefined,
|
|
21
|
+
},
|
|
22
|
+
argTypes: {
|
|
23
|
+
...snackbarArgTypes,
|
|
24
|
+
duration: {
|
|
25
|
+
control: { type: 'select' },
|
|
26
|
+
options: [
|
|
27
|
+
'4 seconds',
|
|
28
|
+
'10 seconds',
|
|
29
|
+
'Infinite',
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
parameters: {
|
|
34
|
+
actions: {
|
|
35
|
+
handles: snackbarEvents,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
export const Default = {
|
|
41
|
+
render({ duration, canClose }) {
|
|
42
|
+
const durationNum = duration === 'Infinite' ?
|
|
43
|
+
SnackbarDuration.Infinite :
|
|
44
|
+
duration === '10 seconds' ?
|
|
45
|
+
SnackbarDuration.Long :
|
|
46
|
+
SnackbarDuration.Short;
|
|
47
|
+
return html `
|
|
48
|
+
<div class="flex gap-8">
|
|
49
|
+
<w-button @click="${() => {
|
|
50
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
51
|
+
snackbar.create('The message should be short, but if it is not and spans multiple lines then the icon and actions should be centered vertically', { variant: 'positive', duration: durationNum, canClose });
|
|
52
|
+
}}">Positive variant</w-button>
|
|
53
|
+
|
|
54
|
+
<w-button @click="${() => {
|
|
55
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
56
|
+
snackbar.create('The message should be short', { variant: 'warning', duration: durationNum, canClose });
|
|
57
|
+
}}">Warning variant</w-button>
|
|
58
|
+
|
|
59
|
+
<w-button @click="${() => {
|
|
60
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
61
|
+
snackbar.create('The message should be short', { variant: 'negative', duration: durationNum, canClose });
|
|
62
|
+
}}">Negative variant</w-button>
|
|
63
|
+
|
|
64
|
+
<w-button @click="${() => {
|
|
65
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
66
|
+
snackbar.create('The message should be short', { variant: 'info', duration: durationNum, canClose });
|
|
67
|
+
}}">Info variant</w-button>
|
|
68
|
+
|
|
69
|
+
<w-button @click="${() => {
|
|
70
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
71
|
+
snackbar.create('The message should be short', { duration: durationNum, canClose });
|
|
72
|
+
}}">Neutral variant</w-button>
|
|
73
|
+
|
|
74
|
+
<w-button @click="${() => {
|
|
75
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
76
|
+
const item = snackbar.create('The message should be short', { duration: durationNum, canClose });
|
|
77
|
+
const customIcon = document.createElement('w-icon');
|
|
78
|
+
customIcon.name = 'Rocket';
|
|
79
|
+
customIcon.slot = 'icon';
|
|
80
|
+
item.prepend(customIcon);
|
|
81
|
+
}}">Neutral w/ icon</w-button>
|
|
82
|
+
</div>
|
|
83
|
+
`;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
export const WithAction = {
|
|
87
|
+
render({ duration, canClose }) {
|
|
88
|
+
const durationNum = duration === 'Infinite' ?
|
|
89
|
+
SnackbarDuration.Infinite :
|
|
90
|
+
duration === '10 seconds' ?
|
|
91
|
+
SnackbarDuration.Long :
|
|
92
|
+
SnackbarDuration.Short;
|
|
93
|
+
return html `
|
|
94
|
+
<div class="flex gap-8">
|
|
95
|
+
<w-button @click="${() => {
|
|
96
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
97
|
+
snackbar.create('The message should be short, but if it is not and spans multiple lines then the icon and actions should be centered vertically', {
|
|
98
|
+
variant: 'positive',
|
|
99
|
+
duration: durationNum,
|
|
100
|
+
canClose,
|
|
101
|
+
action: {
|
|
102
|
+
label: 'Action',
|
|
103
|
+
onclick() {
|
|
104
|
+
const modal = document.getElementById('with-action-modal');
|
|
105
|
+
modal.show = true;
|
|
106
|
+
},
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}}">Positive variant</w-button>
|
|
110
|
+
|
|
111
|
+
<w-button @click="${() => {
|
|
112
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
113
|
+
snackbar.create('The message should be short', {
|
|
114
|
+
variant: 'warning',
|
|
115
|
+
duration: durationNum,
|
|
116
|
+
canClose,
|
|
117
|
+
action: {
|
|
118
|
+
label: 'Action',
|
|
119
|
+
onclick() {
|
|
120
|
+
const modal = document.getElementById('with-action-modal');
|
|
121
|
+
modal.show = true;
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}}">Warning variant</w-button>
|
|
126
|
+
|
|
127
|
+
<w-button @click="${() => {
|
|
128
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
129
|
+
snackbar.create('The message should be short', {
|
|
130
|
+
variant: 'negative',
|
|
131
|
+
duration: durationNum,
|
|
132
|
+
canClose,
|
|
133
|
+
action: {
|
|
134
|
+
label: 'Action',
|
|
135
|
+
onclick() {
|
|
136
|
+
const modal = document.getElementById('with-action-modal');
|
|
137
|
+
modal.show = true;
|
|
138
|
+
},
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}}">Negative variant</w-button>
|
|
142
|
+
|
|
143
|
+
<w-button @click="${() => {
|
|
144
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
145
|
+
snackbar.create('The message should be short', {
|
|
146
|
+
variant: 'info',
|
|
147
|
+
duration: durationNum,
|
|
148
|
+
canClose,
|
|
149
|
+
action: {
|
|
150
|
+
label: 'Action',
|
|
151
|
+
onclick() {
|
|
152
|
+
const modal = document.getElementById('with-action-modal');
|
|
153
|
+
modal.show = true;
|
|
154
|
+
},
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}}">Info variant</w-button>
|
|
158
|
+
|
|
159
|
+
<w-button @click="${() => {
|
|
160
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
161
|
+
snackbar.create('The message should be short', {
|
|
162
|
+
duration: durationNum,
|
|
163
|
+
canClose,
|
|
164
|
+
action: {
|
|
165
|
+
label: 'Action',
|
|
166
|
+
onclick() {
|
|
167
|
+
const modal = document.getElementById('with-action-modal');
|
|
168
|
+
modal.show = true;
|
|
169
|
+
},
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
}}">Neutral variant</w-button>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<w-modal id="with-action-modal">
|
|
176
|
+
<w-modal-header slot="header" no-close></w-modal-header>
|
|
177
|
+
<div slot="content">
|
|
178
|
+
<p>Action was triggered</p>
|
|
179
|
+
</div>
|
|
180
|
+
<w-modal-footer slot="footer">
|
|
181
|
+
<div class="flex gap-16">
|
|
182
|
+
<w-button variant="primary" commandfor="with-action-modal" command="--close">Close</w-button>
|
|
183
|
+
</div>
|
|
184
|
+
</w-modal-footer>
|
|
185
|
+
</w-modal>
|
|
186
|
+
`;
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
export const WithLongActionLabel = {
|
|
190
|
+
render({ duration, canClose }) {
|
|
191
|
+
const durationNum = duration === 'Infinite' ?
|
|
192
|
+
SnackbarDuration.Infinite :
|
|
193
|
+
duration === '10 seconds' ?
|
|
194
|
+
SnackbarDuration.Long :
|
|
195
|
+
SnackbarDuration.Short;
|
|
196
|
+
return html `
|
|
197
|
+
<div class="flex gap-8">
|
|
198
|
+
<w-button @click="${() => {
|
|
199
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
200
|
+
snackbar.create('The message should be short, but if it is not and spans multiple lines then the icon and actions should be centered vertically', {
|
|
201
|
+
variant: 'positive',
|
|
202
|
+
duration: durationNum,
|
|
203
|
+
canClose,
|
|
204
|
+
action: {
|
|
205
|
+
label: 'Long action label',
|
|
206
|
+
onclick() {
|
|
207
|
+
const modal = document.getElementById('with-long-action-modal');
|
|
208
|
+
modal.show = true;
|
|
209
|
+
},
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
}}">Positive variant</w-button>
|
|
213
|
+
|
|
214
|
+
<w-button @click="${() => {
|
|
215
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
216
|
+
snackbar.create('The message should be short', {
|
|
217
|
+
variant: 'warning',
|
|
218
|
+
duration: durationNum,
|
|
219
|
+
canClose,
|
|
220
|
+
action: {
|
|
221
|
+
label: 'Long action label',
|
|
222
|
+
onclick() {
|
|
223
|
+
const modal = document.getElementById('with-long-action-modal');
|
|
224
|
+
modal.show = true;
|
|
225
|
+
},
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}}">Warning variant</w-button>
|
|
229
|
+
|
|
230
|
+
<w-button @click="${() => {
|
|
231
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
232
|
+
snackbar.create('The message should be short', {
|
|
233
|
+
variant: 'negative',
|
|
234
|
+
duration: durationNum,
|
|
235
|
+
canClose,
|
|
236
|
+
action: {
|
|
237
|
+
label: 'Long action label',
|
|
238
|
+
onclick() {
|
|
239
|
+
const modal = document.getElementById('with-long-action-modal');
|
|
240
|
+
modal.show = true;
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
}}">Negative variant</w-button>
|
|
245
|
+
|
|
246
|
+
<w-button @click="${() => {
|
|
247
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
248
|
+
snackbar.create('The message should be short', {
|
|
249
|
+
variant: 'info',
|
|
250
|
+
duration: durationNum,
|
|
251
|
+
canClose,
|
|
252
|
+
action: {
|
|
253
|
+
label: 'Long action label',
|
|
254
|
+
onclick() {
|
|
255
|
+
const modal = document.getElementById('with-long-action-modal');
|
|
256
|
+
modal.show = true;
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}}">Info variant</w-button>
|
|
261
|
+
|
|
262
|
+
<w-button @click="${() => {
|
|
263
|
+
const snackbar = document.querySelector('w-snackbar');
|
|
264
|
+
snackbar.create('The message should be short', {
|
|
265
|
+
duration: durationNum,
|
|
266
|
+
canClose,
|
|
267
|
+
action: {
|
|
268
|
+
label: 'Long action label',
|
|
269
|
+
onclick() {
|
|
270
|
+
const modal = document.getElementById('with-long-action-modal');
|
|
271
|
+
modal.show = true;
|
|
272
|
+
},
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}}">Neutral variant</w-button>
|
|
276
|
+
</div>
|
|
277
|
+
|
|
278
|
+
<w-modal id="with-long-action-modal">
|
|
279
|
+
<w-modal-header slot="header" no-close></w-modal-header>
|
|
280
|
+
<div slot="content">
|
|
281
|
+
<p>Action was triggered</p>
|
|
282
|
+
</div>
|
|
283
|
+
<w-modal-footer slot="footer">
|
|
284
|
+
<div class="flex gap-16">
|
|
285
|
+
<w-button variant="primary" commandfor="with-long-action-modal" command="--close">Close</w-button>
|
|
286
|
+
</div>
|
|
287
|
+
</w-modal-footer>
|
|
288
|
+
</w-modal>
|
|
289
|
+
`;
|
|
290
|
+
},
|
|
291
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { expect, test } from 'vitest';
|
|
3
|
+
import { render } from 'vitest-browser-lit';
|
|
4
|
+
import '../button/button.js';
|
|
5
|
+
import '../icon/icon.js';
|
|
6
|
+
import '../snackbar-item/snackbar-item.js';
|
|
7
|
+
import './snackbar.js';
|
|
8
|
+
test('exposes a create function that adds snackbar items', async () => {
|
|
9
|
+
const component = html `<w-snackbar></w-snackbar>`;
|
|
10
|
+
const page = render(component);
|
|
11
|
+
const snackbar = page.container.querySelector('w-snackbar');
|
|
12
|
+
if (!snackbar)
|
|
13
|
+
return expect(snackbar).not.toBeNull();
|
|
14
|
+
await snackbar.updateComplete;
|
|
15
|
+
snackbar.create('Test message');
|
|
16
|
+
await expect.element(page.getByText('Test message')).toBeVisible();
|
|
17
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: import("lit").CSSResult;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: fixed;
|
|
5
|
+
pointer-events: none;
|
|
6
|
+
|
|
7
|
+
--_snackbar-gap: var(--w-c-snackbar-container-gap, 8px);
|
|
8
|
+
--_snackbar-position-top: var(--w-c-snackbar-position-top, initial);
|
|
9
|
+
--_snackbar-position-right: var(--w-c-snackbar-position-right, 0);
|
|
10
|
+
--_snackbar-position-bottom: var(--w-c-snackbar-position-bottom, 16px);
|
|
11
|
+
--_snackbar-position-left: var(--w-c-snackbar-position-left, 0);
|
|
12
|
+
--_snackbar-z-index: var(--w-c-snackbar-z-index, 50);
|
|
13
|
+
|
|
14
|
+
bottom: var(--_snackbar-position-bottom);
|
|
15
|
+
left: var(--_snackbar-position-left);
|
|
16
|
+
right: var(--_snackbar-position-right);
|
|
17
|
+
top: var(--_snackbar-position-top);
|
|
18
|
+
|
|
19
|
+
z-index: var(--_snackbar-z-index);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[part='container'] {
|
|
23
|
+
display: grid;
|
|
24
|
+
gap: var(--_snackbar-gap);
|
|
25
|
+
grid-template-rows: auto;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
justify-items: center;
|
|
28
|
+
margin-inline: auto;
|
|
29
|
+
pointer-events: none;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
::slotted(*) {
|
|
33
|
+
pointer-events: initial;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SnackbarActionPlacement, WarpSnackbarItem } from './snackbar-item.js';
|
|
3
|
+
export declare const SnackbarItem: React.ForwardRefExoticComponent<Omit<Omit<Omit<React.HTMLAttributes<WarpSnackbarItem>, "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "connectedCallback" | "disconnectedCallback" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "updated" | "render" | "renderOptions" | "close" | "actionPlacement" | "duration"> & {} & Partial<Omit<WarpSnackbarItem, keyof HTMLElement>> & React.RefAttributes<WarpSnackbarItem>, "ref">, "action-placement"> & {
|
|
4
|
+
actionPlacement?: SnackbarActionPlacement;
|
|
5
|
+
} & React.RefAttributes<WarpSnackbarItem>>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createComponent } from '@lit/react';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
// decouple from CDN by providing a dummy class
|
|
5
|
+
class Component extends LitElement {
|
|
6
|
+
}
|
|
7
|
+
const BaseSnackbarItem = createComponent({
|
|
8
|
+
tagName: 'w-snackbar-item',
|
|
9
|
+
elementClass: Component,
|
|
10
|
+
react: React,
|
|
11
|
+
});
|
|
12
|
+
export const SnackbarItem = React.forwardRef(({ actionPlacement, ...props }, ref) => React.createElement(BaseSnackbarItem, {
|
|
13
|
+
...props,
|
|
14
|
+
...(actionPlacement ? { 'action-placement': actionPlacement } : {}),
|
|
15
|
+
}));
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
export type SnackbarVariant = 'positive' | 'warning' | 'negative' | 'info' | 'neutral';
|
|
3
|
+
export type SnackbarActionPlacement = 'inline' | 'block';
|
|
4
|
+
export declare enum SnackbarDuration {
|
|
5
|
+
Short = 4000,
|
|
6
|
+
Long = 10000,
|
|
7
|
+
Infinite = 120000000
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An item to show in a `w-snackbar`.
|
|
11
|
+
*
|
|
12
|
+
* See the `create` function on `w-snackbar` for a convenience API which helps you make snackbar items.
|
|
13
|
+
*
|
|
14
|
+
* @parent w-snackbar
|
|
15
|
+
*
|
|
16
|
+
* @slot default - the snackbar message.
|
|
17
|
+
* @slot icon - icon preceeding the message.
|
|
18
|
+
* @slot action - action following the message.
|
|
19
|
+
*
|
|
20
|
+
* @csspart item - the container wrapping the message, icon and actions.
|
|
21
|
+
* @csspart icon - the icon for the variant.
|
|
22
|
+
* @csspart message - the default slot, body of the snackbar item.
|
|
23
|
+
* @csspart action - close and action button.
|
|
24
|
+
*
|
|
25
|
+
* @cssprop --w-c-snackbar-item-radius
|
|
26
|
+
* @cssprop --w-c-snackbar-item-max-width
|
|
27
|
+
* @cssprop --w-c-snackbar-item-min-width
|
|
28
|
+
* @cssprop --w-c-snackbar-item-padding
|
|
29
|
+
*
|
|
30
|
+
* @cssprop --w-c-snackbar-item-bg
|
|
31
|
+
* @cssprop --w-c-snackbar-item-action-bg-active
|
|
32
|
+
* @cssprop --w-c-snackbar-item-action-bg-hover
|
|
33
|
+
*
|
|
34
|
+
* @cssprop --w-c-snackbar-item-color
|
|
35
|
+
* @cssprop --w-c-snackbar-item-action-color-active
|
|
36
|
+
* @cssprop --w-c-snackbar-item-action-color-hover
|
|
37
|
+
*
|
|
38
|
+
* @cssprop --w-c-snackbar-item-box-shadow
|
|
39
|
+
*/
|
|
40
|
+
export declare class WarpSnackbarItem extends LitElement {
|
|
41
|
+
#private;
|
|
42
|
+
static styles: import("lit").CSSResult[];
|
|
43
|
+
/**
|
|
44
|
+
* The placement of the action and close buttons.
|
|
45
|
+
*/
|
|
46
|
+
actionPlacement: SnackbarActionPlacement;
|
|
47
|
+
/**
|
|
48
|
+
* How long the message should stay in the document before removing itself.
|
|
49
|
+
*/
|
|
50
|
+
duration: number;
|
|
51
|
+
private root;
|
|
52
|
+
private hasAction;
|
|
53
|
+
connectedCallback(): void;
|
|
54
|
+
disconnectedCallback(): void;
|
|
55
|
+
updated(): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Remove the snackbar item from the document.
|
|
58
|
+
*
|
|
59
|
+
* Moves focus to the last focused element outside of the snackbar item, if available.
|
|
60
|
+
*/
|
|
61
|
+
close(): void;
|
|
62
|
+
protected firstUpdated(): void;
|
|
63
|
+
render(): import("lit").TemplateResult<1>;
|
|
64
|
+
}
|
|
65
|
+
declare global {
|
|
66
|
+
interface HTMLElementTagNameMap {
|
|
67
|
+
'w-snackbar-item': WarpSnackbarItem;
|
|
68
|
+
}
|
|
69
|
+
}
|