@rcarls/rc-snackbar 0.0.0-next-20260921045401
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/CHANGELOG.md +45 -0
- package/README.md +15 -0
- package/dist/custom-elements.json +522 -0
- package/dist/rc-snackbar-CGTWrbMU.js +240 -0
- package/dist/rc-snackbar-CGTWrbMU.js.map +1 -0
- package/dist/rc-snackbar-define.js +3 -0
- package/dist/rc-snackbar-define.js.map +1 -0
- package/dist/rc-snackbar.js +5 -0
- package/dist/rc-snackbar.js.map +1 -0
- package/dist/types/packages/rc-snackbar/src/define.d.ts +1 -0
- package/dist/types/packages/rc-snackbar/src/index.d.ts +2 -0
- package/dist/types/packages/rc-snackbar/src/rc-snackbar.d.ts +140 -0
- package/dist/types/packages/rc-snackbar/src/rc-snackbar.styles.d.ts +2 -0
- package/package.json +62 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# @rcarls/rc-snackbar
|
|
2
|
+
|
|
3
|
+
## 0.0.0-next-20260921045401
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 57338f5: `rc-dialog`, `rc-bottom-sheet`, and `rc-snackbar` now fade in and out through
|
|
8
|
+
CSS alone, using `@starting-style` and a discrete `display`/`overlay`
|
|
9
|
+
transition, driven by the shared `--rc-motion-effects-*` tokens (and
|
|
10
|
+
`--rc-motion-spatial-*` for `rc-snackbar`'s slide). `showModal()`/`show()`/
|
|
11
|
+
`close()` all stay synchronous, and nothing in any of the three components
|
|
12
|
+
waits on the transition finishing, so a zero-duration theme or a browser
|
|
13
|
+
without support for the CSS involved both degrade to an instant, fully
|
|
14
|
+
correct open and close.
|
|
15
|
+
|
|
16
|
+
`rc-dialog` and `rc-bottom-sheet` animate opacity only, not a scale or slide
|
|
17
|
+
transform: both support pointer resize and read `getBoundingClientRect()` to
|
|
18
|
+
compute drag deltas, and a transform is a visual effect that
|
|
19
|
+
`getBoundingClientRect()` reports for as long as it's still animating,
|
|
20
|
+
corrupting that measurement if a resize or drag starts during the entrance.
|
|
21
|
+
`rc-snackbar` has no such feature, so it fades and slides up from the
|
|
22
|
+
block-end edge it's anchored to.
|
|
23
|
+
|
|
24
|
+
## 0.6.0
|
|
25
|
+
|
|
26
|
+
## 0.5.0
|
|
27
|
+
|
|
28
|
+
## 0.4.2
|
|
29
|
+
|
|
30
|
+
## 0.4.1
|
|
31
|
+
|
|
32
|
+
## 0.4.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- 4171a9d: Give `open` proper controlled/uncontrolled backing (host writes are silent,
|
|
37
|
+
new `default-open` attribute seeds initial visible state), matching every
|
|
38
|
+
other stateful `open`/`value` property in the library. `show()`, `close()`,
|
|
39
|
+
and `clear()` are unaffected.
|
|
40
|
+
- 985068e: Add the rc-snackbar package for queued live-region status messages.
|
|
41
|
+
|
|
42
|
+
### Patch Changes
|
|
43
|
+
|
|
44
|
+
- 55e8ab5: Preserve UA-like control and surface styling until an optional theme supplies decorative tokens.
|
|
45
|
+
Restore themed button hover and pressed state layers, including a pointer-origin Material ripple.
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @rcarls/rc-snackbar
|
|
2
|
+
|
|
3
|
+
Live-region host for brief status messages and optional actions.
|
|
4
|
+
|
|
5
|
+
```html
|
|
6
|
+
<rc-snackbar id="snackbar"></rc-snackbar>
|
|
7
|
+
<script type="module">
|
|
8
|
+
import '@rcarls/rc-snackbar/define';
|
|
9
|
+
|
|
10
|
+
document.querySelector('#snackbar').show({
|
|
11
|
+
message: 'Recipe saved',
|
|
12
|
+
actionLabel: 'Undo',
|
|
13
|
+
});
|
|
14
|
+
</script>
|
|
15
|
+
```
|
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"readme": "",
|
|
4
|
+
"modules": [
|
|
5
|
+
{
|
|
6
|
+
"kind": "javascript-module",
|
|
7
|
+
"path": "src/define.ts",
|
|
8
|
+
"declarations": [],
|
|
9
|
+
"exports": [
|
|
10
|
+
{
|
|
11
|
+
"kind": "custom-element-definition",
|
|
12
|
+
"name": "rc-snackbar",
|
|
13
|
+
"declaration": {
|
|
14
|
+
"name": "RCSnackbar",
|
|
15
|
+
"module": "/src/index.js"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"kind": "javascript-module",
|
|
22
|
+
"path": "src/index.ts",
|
|
23
|
+
"declarations": [],
|
|
24
|
+
"exports": [
|
|
25
|
+
{
|
|
26
|
+
"kind": "js",
|
|
27
|
+
"name": "RCSnackbar",
|
|
28
|
+
"declaration": {
|
|
29
|
+
"name": "default",
|
|
30
|
+
"module": "./rc-snackbar.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"kind": "js",
|
|
35
|
+
"name": "RCSnackbarActionDetail",
|
|
36
|
+
"declaration": {
|
|
37
|
+
"name": "RCSnackbarActionDetail",
|
|
38
|
+
"module": "./rc-snackbar.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"kind": "js",
|
|
43
|
+
"name": "RCSnackbarCloseDetail",
|
|
44
|
+
"declaration": {
|
|
45
|
+
"name": "RCSnackbarCloseDetail",
|
|
46
|
+
"module": "./rc-snackbar.js"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"kind": "js",
|
|
51
|
+
"name": "RCSnackbarCloseReason",
|
|
52
|
+
"declaration": {
|
|
53
|
+
"name": "RCSnackbarCloseReason",
|
|
54
|
+
"module": "./rc-snackbar.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"kind": "js",
|
|
59
|
+
"name": "RCSnackbarQueuePolicy",
|
|
60
|
+
"declaration": {
|
|
61
|
+
"name": "RCSnackbarQueuePolicy",
|
|
62
|
+
"module": "./rc-snackbar.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"kind": "js",
|
|
67
|
+
"name": "RCSnackbarShowOptions",
|
|
68
|
+
"declaration": {
|
|
69
|
+
"name": "RCSnackbarShowOptions",
|
|
70
|
+
"module": "./rc-snackbar.js"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"kind": "javascript-module",
|
|
77
|
+
"path": "src/rc-snackbar.ts",
|
|
78
|
+
"declarations": [
|
|
79
|
+
{
|
|
80
|
+
"kind": "class",
|
|
81
|
+
"description": "Snackbar live-region host for brief status messages and optional actions.\n\nFades and slides in from the block-end edge it's anchored to through CSS\nalone (`@starting-style` plus a discrete `display` transition), using the\nshared `--rc-motion-effects-*`/`--rc-motion-spatial-*` tokens.\n`show()`/`close()` stay synchronous; nothing waits on the transition\nfinishing.",
|
|
82
|
+
"name": "RCSnackbar",
|
|
83
|
+
"cssProperties": [
|
|
84
|
+
{
|
|
85
|
+
"description": "Inline-axis inset from the viewport edge.",
|
|
86
|
+
"name": "--rc-snackbar-inset-inline",
|
|
87
|
+
"default": "1rem"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"description": "Block-end inset from the viewport edge, before the safe-area inset.",
|
|
91
|
+
"name": "--rc-snackbar-inset-block-end",
|
|
92
|
+
"default": "1rem"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"description": "Stacking order.",
|
|
96
|
+
"name": "--rc-snackbar-z-index",
|
|
97
|
+
"default": "1000"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"description": "Gap between the message and action.",
|
|
101
|
+
"name": "--rc-snackbar-gap",
|
|
102
|
+
"default": "0.5rem"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"description": "Minimum surface block size.",
|
|
106
|
+
"name": "--rc-snackbar-min-block-size",
|
|
107
|
+
"default": "3rem"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"description": "Maximum surface inline size.",
|
|
111
|
+
"name": "--rc-snackbar-max-inline-size",
|
|
112
|
+
"default": "30rem"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"description": "Surface block-axis padding.",
|
|
116
|
+
"name": "--rc-snackbar-padding-block",
|
|
117
|
+
"default": "0.5rem"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"description": "Surface inline-axis padding.",
|
|
121
|
+
"name": "--rc-snackbar-padding-inline",
|
|
122
|
+
"default": "1rem"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"description": "Surface border.",
|
|
126
|
+
"name": "--rc-snackbar-border",
|
|
127
|
+
"default": "1px solid CanvasText"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"description": "Surface border radius.",
|
|
131
|
+
"name": "--rc-snackbar-radius",
|
|
132
|
+
"default": "0"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"description": "Surface background.",
|
|
136
|
+
"name": "--rc-snackbar-bg",
|
|
137
|
+
"default": "Canvas"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"description": "Surface text color.",
|
|
141
|
+
"name": "--rc-snackbar-color",
|
|
142
|
+
"default": "CanvasText"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"description": "Surface box shadow.",
|
|
146
|
+
"name": "--rc-snackbar-shadow",
|
|
147
|
+
"default": "none"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"description": "Action button border; defers to native button border when unset.",
|
|
151
|
+
"name": "--rc-snackbar-action-border"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"description": "Action button border radius; defers to native button radius when unset.",
|
|
155
|
+
"name": "--rc-snackbar-action-radius"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"description": "Action button block-axis padding; defers to native button padding when unset.",
|
|
159
|
+
"name": "--rc-snackbar-action-padding-block"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"description": "Action button inline-axis padding; defers to native button padding when unset.",
|
|
163
|
+
"name": "--rc-snackbar-action-padding-inline"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
"description": "Action button background; defers to native button background when unset.",
|
|
167
|
+
"name": "--rc-snackbar-action-bg"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"description": "Action button text color; defers to native button color when unset.",
|
|
171
|
+
"name": "--rc-snackbar-action-color"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"description": "Action button font shorthand; defers to native button font when unset.",
|
|
175
|
+
"name": "--rc-snackbar-action-font"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"description": "Action button focus outline; defers to native focus styling when unset.",
|
|
179
|
+
"name": "--rc-snackbar-focus-ring"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"description": "Action button focus outline offset; defers to native focus styling when unset.",
|
|
183
|
+
"name": "--rc-snackbar-focus-ring-offset"
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
"cssParts": [
|
|
187
|
+
{
|
|
188
|
+
"description": "Snackbar surface.",
|
|
189
|
+
"name": "surface"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"description": "Message text.",
|
|
193
|
+
"name": "message"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"description": "Optional action button.",
|
|
197
|
+
"name": "action"
|
|
198
|
+
}
|
|
199
|
+
],
|
|
200
|
+
"members": [
|
|
201
|
+
{
|
|
202
|
+
"kind": "field",
|
|
203
|
+
"name": "_queue",
|
|
204
|
+
"type": {
|
|
205
|
+
"text": "RCSnackbarShowOptions[]"
|
|
206
|
+
},
|
|
207
|
+
"privacy": "private",
|
|
208
|
+
"default": "[]"
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"kind": "field",
|
|
212
|
+
"name": "_timer",
|
|
213
|
+
"type": {
|
|
214
|
+
"text": "number | undefined"
|
|
215
|
+
},
|
|
216
|
+
"privacy": "private"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"kind": "field",
|
|
220
|
+
"name": "_lastMessage",
|
|
221
|
+
"type": {
|
|
222
|
+
"text": "string"
|
|
223
|
+
},
|
|
224
|
+
"privacy": "private",
|
|
225
|
+
"default": "''"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"kind": "field",
|
|
229
|
+
"name": "_open",
|
|
230
|
+
"type": {
|
|
231
|
+
"text": "boolean | undefined"
|
|
232
|
+
},
|
|
233
|
+
"privacy": "private"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"kind": "field",
|
|
237
|
+
"name": "_defaultOpen",
|
|
238
|
+
"type": {
|
|
239
|
+
"text": "boolean"
|
|
240
|
+
},
|
|
241
|
+
"privacy": "private",
|
|
242
|
+
"default": "false"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"kind": "field",
|
|
246
|
+
"name": "_openInitialized",
|
|
247
|
+
"type": {
|
|
248
|
+
"text": "boolean"
|
|
249
|
+
},
|
|
250
|
+
"privacy": "private",
|
|
251
|
+
"default": "false"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"kind": "field",
|
|
255
|
+
"name": "open",
|
|
256
|
+
"type": {
|
|
257
|
+
"text": "boolean"
|
|
258
|
+
},
|
|
259
|
+
"description": "Whether the snackbar is currently visible. Host writes are silent.",
|
|
260
|
+
"attribute": "open",
|
|
261
|
+
"reflects": true
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"kind": "field",
|
|
265
|
+
"name": "defaultOpen",
|
|
266
|
+
"type": {
|
|
267
|
+
"text": "boolean"
|
|
268
|
+
},
|
|
269
|
+
"description": "Initial visible state for uncontrolled usage, such as an already-queued\nmessage shown on first render.",
|
|
270
|
+
"attribute": "default-open"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"kind": "field",
|
|
274
|
+
"name": "message",
|
|
275
|
+
"type": {
|
|
276
|
+
"text": "string"
|
|
277
|
+
},
|
|
278
|
+
"default": "''",
|
|
279
|
+
"description": "Visible message text.",
|
|
280
|
+
"attribute": "message",
|
|
281
|
+
"reflects": true
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"kind": "field",
|
|
285
|
+
"name": "actionLabel",
|
|
286
|
+
"type": {
|
|
287
|
+
"text": "string"
|
|
288
|
+
},
|
|
289
|
+
"default": "''",
|
|
290
|
+
"description": "Optional action button label.",
|
|
291
|
+
"attribute": "action-label",
|
|
292
|
+
"reflects": true
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"kind": "field",
|
|
296
|
+
"name": "duration",
|
|
297
|
+
"type": {
|
|
298
|
+
"text": "number"
|
|
299
|
+
},
|
|
300
|
+
"default": "4000",
|
|
301
|
+
"description": "Auto-close duration in milliseconds. Set to 0 to keep open.",
|
|
302
|
+
"attribute": "duration"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"kind": "field",
|
|
306
|
+
"name": "queuePolicy",
|
|
307
|
+
"type": {
|
|
308
|
+
"text": "RCSnackbarQueuePolicy"
|
|
309
|
+
},
|
|
310
|
+
"default": "'queue'",
|
|
311
|
+
"description": "Queue behavior for show calls while open.",
|
|
312
|
+
"attribute": "queue-policy"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"kind": "method",
|
|
316
|
+
"name": "show",
|
|
317
|
+
"return": {
|
|
318
|
+
"type": {
|
|
319
|
+
"text": "void"
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"parameters": [
|
|
323
|
+
{
|
|
324
|
+
"name": "message",
|
|
325
|
+
"type": {
|
|
326
|
+
"text": "string | RCSnackbarShowOptions"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
],
|
|
330
|
+
"description": "Shows a message or queues it according to `queuePolicy`."
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"kind": "method",
|
|
334
|
+
"name": "close",
|
|
335
|
+
"return": {
|
|
336
|
+
"type": {
|
|
337
|
+
"text": "void"
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
"parameters": [
|
|
341
|
+
{
|
|
342
|
+
"name": "reason",
|
|
343
|
+
"default": "'api'",
|
|
344
|
+
"type": {
|
|
345
|
+
"text": "RCSnackbarCloseReason"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"description": "Closes the current snackbar."
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"kind": "method",
|
|
353
|
+
"name": "clear",
|
|
354
|
+
"return": {
|
|
355
|
+
"type": {
|
|
356
|
+
"text": "void"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"description": "Clears the current snackbar and all queued messages."
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"kind": "method",
|
|
363
|
+
"name": "_showNow",
|
|
364
|
+
"privacy": "private",
|
|
365
|
+
"return": {
|
|
366
|
+
"type": {
|
|
367
|
+
"text": "void"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
"parameters": [
|
|
371
|
+
{
|
|
372
|
+
"name": "next",
|
|
373
|
+
"type": {
|
|
374
|
+
"text": "RCSnackbarShowOptions"
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
]
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"kind": "method",
|
|
381
|
+
"name": "_closeCurrent",
|
|
382
|
+
"privacy": "private",
|
|
383
|
+
"return": {
|
|
384
|
+
"type": {
|
|
385
|
+
"text": "void"
|
|
386
|
+
}
|
|
387
|
+
},
|
|
388
|
+
"parameters": [
|
|
389
|
+
{
|
|
390
|
+
"name": "reason",
|
|
391
|
+
"type": {
|
|
392
|
+
"text": "RCSnackbarCloseReason"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"name": "showNext",
|
|
397
|
+
"type": {
|
|
398
|
+
"text": "boolean"
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
]
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"kind": "method",
|
|
405
|
+
"name": "_handleAction",
|
|
406
|
+
"privacy": "private",
|
|
407
|
+
"return": {
|
|
408
|
+
"type": {
|
|
409
|
+
"text": "void"
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"kind": "method",
|
|
415
|
+
"name": "_clearTimer",
|
|
416
|
+
"privacy": "private",
|
|
417
|
+
"return": {
|
|
418
|
+
"type": {
|
|
419
|
+
"text": "void"
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
],
|
|
424
|
+
"events": [
|
|
425
|
+
{
|
|
426
|
+
"name": "rc-snackbar-close",
|
|
427
|
+
"type": {
|
|
428
|
+
"text": "CustomEvent"
|
|
429
|
+
},
|
|
430
|
+
"description": "Fired after a visible snackbar closes."
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"name": "rc-snackbar-action",
|
|
434
|
+
"type": {
|
|
435
|
+
"text": "CustomEvent"
|
|
436
|
+
},
|
|
437
|
+
"description": "Fired when the action button is activated."
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
"attributes": [
|
|
441
|
+
{
|
|
442
|
+
"description": "Whether the snackbar is currently visible. Host writes are silent.",
|
|
443
|
+
"name": "open",
|
|
444
|
+
"type": {
|
|
445
|
+
"text": "boolean"
|
|
446
|
+
},
|
|
447
|
+
"fieldName": "open"
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"description": "Initial visible state for uncontrolled usage, such as an already-queued\nmessage shown on first render.",
|
|
451
|
+
"name": "default-open",
|
|
452
|
+
"type": {
|
|
453
|
+
"text": "boolean"
|
|
454
|
+
},
|
|
455
|
+
"fieldName": "defaultOpen"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"description": "Visible message text.",
|
|
459
|
+
"name": "message",
|
|
460
|
+
"type": {
|
|
461
|
+
"text": "string"
|
|
462
|
+
},
|
|
463
|
+
"default": "''",
|
|
464
|
+
"fieldName": "message"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"description": "Optional action button label.",
|
|
468
|
+
"name": "action-label",
|
|
469
|
+
"type": {
|
|
470
|
+
"text": "string"
|
|
471
|
+
},
|
|
472
|
+
"default": "''",
|
|
473
|
+
"fieldName": "actionLabel"
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
"description": "Auto-close duration in milliseconds. Set to 0 to keep open.",
|
|
477
|
+
"name": "duration",
|
|
478
|
+
"type": {
|
|
479
|
+
"text": "number"
|
|
480
|
+
},
|
|
481
|
+
"default": "4000",
|
|
482
|
+
"fieldName": "duration"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"description": "Queue behavior for show calls while open.",
|
|
486
|
+
"name": "queue-policy",
|
|
487
|
+
"type": {
|
|
488
|
+
"text": "RCSnackbarQueuePolicy"
|
|
489
|
+
},
|
|
490
|
+
"default": "'queue'",
|
|
491
|
+
"fieldName": "queuePolicy"
|
|
492
|
+
}
|
|
493
|
+
],
|
|
494
|
+
"superclass": {
|
|
495
|
+
"name": "LitElement",
|
|
496
|
+
"package": "lit"
|
|
497
|
+
},
|
|
498
|
+
"tagName": "rc-snackbar",
|
|
499
|
+
"customElement": true
|
|
500
|
+
}
|
|
501
|
+
],
|
|
502
|
+
"exports": [
|
|
503
|
+
{
|
|
504
|
+
"kind": "js",
|
|
505
|
+
"name": "RCSnackbar",
|
|
506
|
+
"declaration": {
|
|
507
|
+
"name": "RCSnackbar",
|
|
508
|
+
"module": "src/rc-snackbar.ts"
|
|
509
|
+
}
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"kind": "js",
|
|
513
|
+
"name": "default",
|
|
514
|
+
"declaration": {
|
|
515
|
+
"name": "RCSnackbar",
|
|
516
|
+
"module": "src/rc-snackbar.ts"
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
]
|
|
522
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { css as u, LitElement as d, html as h } from "lit";
|
|
2
|
+
import { property as i } from "lit/decorators.js";
|
|
3
|
+
const f = u`
|
|
4
|
+
:host {
|
|
5
|
+
position: fixed;
|
|
6
|
+
inset-inline: var(--rc-snackbar-inset-inline, 1rem);
|
|
7
|
+
inset-block-end: calc(
|
|
8
|
+
var(--rc-snackbar-inset-block-end, 1rem) + env(safe-area-inset-bottom, 0px)
|
|
9
|
+
);
|
|
10
|
+
z-index: var(--rc-snackbar-z-index, 1000);
|
|
11
|
+
display: none;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
pointer-events: none;
|
|
14
|
+
color-scheme: inherit;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host([hidden]) {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:host([open]) {
|
|
22
|
+
display: flex;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
* Fade and slide up from the block-end edge it's anchored to. Unlike
|
|
27
|
+
* rc-dialog/rc-bottom-sheet, nothing here reads getBoundingClientRect()
|
|
28
|
+
* during the entrance, so a transform is safe: the host is a fixed
|
|
29
|
+
* positioning wrapper with no resize or drag feature of its own.
|
|
30
|
+
* show()/close() stay synchronous either way.
|
|
31
|
+
*/
|
|
32
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
33
|
+
:host {
|
|
34
|
+
opacity: 0;
|
|
35
|
+
translate: 0 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host([open]) {
|
|
39
|
+
opacity: 1;
|
|
40
|
+
translate: none;
|
|
41
|
+
transition:
|
|
42
|
+
opacity var(--rc-motion-effects-duration-default, 200ms)
|
|
43
|
+
var(--rc-motion-effects-easing-enter, ease-out),
|
|
44
|
+
translate var(--rc-motion-spatial-duration-default, 400ms)
|
|
45
|
+
var(--rc-motion-spatial-easing-enter, ease-out),
|
|
46
|
+
display var(--rc-motion-effects-duration-default, 200ms) allow-discrete;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
:host(:not([open])) {
|
|
50
|
+
transition:
|
|
51
|
+
opacity var(--rc-motion-effects-duration-default, 200ms)
|
|
52
|
+
var(--rc-motion-effects-easing-exit, ease-in),
|
|
53
|
+
translate var(--rc-motion-spatial-duration-default, 400ms)
|
|
54
|
+
var(--rc-motion-spatial-easing-exit, ease-in),
|
|
55
|
+
display var(--rc-motion-effects-duration-default, 200ms) allow-discrete;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@starting-style {
|
|
59
|
+
:host([open]) {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
translate: 0 100%;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
[part='surface'] {
|
|
67
|
+
pointer-events: auto;
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
gap: var(--rc-snackbar-gap, 0.5rem);
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
min-block-size: var(--rc-snackbar-min-block-size, 3rem);
|
|
73
|
+
inline-size: min(100%, var(--rc-snackbar-max-inline-size, 30rem));
|
|
74
|
+
padding-block: var(--rc-snackbar-padding-block, 0.5rem);
|
|
75
|
+
padding-inline: var(--rc-snackbar-padding-inline, 1rem);
|
|
76
|
+
border: var(--rc-snackbar-border, 1px solid CanvasText);
|
|
77
|
+
border-radius: var(--rc-snackbar-radius, 0);
|
|
78
|
+
background: var(--rc-snackbar-bg, Canvas);
|
|
79
|
+
color: var(--rc-snackbar-color, CanvasText);
|
|
80
|
+
box-shadow: var(--rc-snackbar-shadow, none);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[part='message'] {
|
|
84
|
+
flex: 1 1 auto;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
[part='action'] {
|
|
88
|
+
flex: 0 0 auto;
|
|
89
|
+
display: none;
|
|
90
|
+
border: var(--rc-snackbar-action-border, revert);
|
|
91
|
+
border-radius: var(--rc-snackbar-action-radius, revert);
|
|
92
|
+
padding-block: var(--rc-snackbar-action-padding-block, revert);
|
|
93
|
+
padding-inline: var(--rc-snackbar-action-padding-inline, revert);
|
|
94
|
+
background: var(--rc-snackbar-action-bg, revert);
|
|
95
|
+
color: var(--rc-snackbar-action-color, revert);
|
|
96
|
+
font: var(--rc-snackbar-action-font, revert);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([action-label]) [part='action'] {
|
|
100
|
+
display: inline-flex;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
[part='action']:focus-visible {
|
|
104
|
+
outline: var(--rc-snackbar-focus-ring, revert);
|
|
105
|
+
outline-offset: var(--rc-snackbar-focus-ring-offset, revert);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@media (forced-colors: active) {
|
|
109
|
+
[part='surface'] {
|
|
110
|
+
border: 1px solid CanvasText;
|
|
111
|
+
background: CanvasText;
|
|
112
|
+
color: Canvas;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
[part='action'] {
|
|
116
|
+
color: Highlight;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
`;
|
|
120
|
+
var b = Object.defineProperty, m = Object.getOwnPropertyDescriptor, n = (p, e, t, s) => {
|
|
121
|
+
for (var a = s > 1 ? void 0 : s ? m(e, t) : e, o = p.length - 1, c; o >= 0; o--)
|
|
122
|
+
(c = p[o]) && (a = (s ? c(e, t, a) : c(a)) || a);
|
|
123
|
+
return s && a && b(e, t, a), a;
|
|
124
|
+
};
|
|
125
|
+
const l = class l extends d {
|
|
126
|
+
constructor() {
|
|
127
|
+
super(...arguments), this._queue = [], this._lastMessage = "", this._defaultOpen = !1, this._openInitialized = !1, this.message = "", this.actionLabel = "", this.duration = 4e3, this.queuePolicy = "queue";
|
|
128
|
+
}
|
|
129
|
+
get open() {
|
|
130
|
+
return this._open ?? this._defaultOpen;
|
|
131
|
+
}
|
|
132
|
+
set open(e) {
|
|
133
|
+
const t = this.open;
|
|
134
|
+
this._open = e, this._openInitialized = !0, this.requestUpdate("open", t);
|
|
135
|
+
}
|
|
136
|
+
get defaultOpen() {
|
|
137
|
+
return this._defaultOpen;
|
|
138
|
+
}
|
|
139
|
+
set defaultOpen(e) {
|
|
140
|
+
const t = this._defaultOpen;
|
|
141
|
+
this._defaultOpen = e, !this._openInitialized && this._open === void 0 && this.requestUpdate("open", t), this.requestUpdate("defaultOpen", t);
|
|
142
|
+
}
|
|
143
|
+
disconnectedCallback() {
|
|
144
|
+
this._clearTimer(), super.disconnectedCallback();
|
|
145
|
+
}
|
|
146
|
+
updated(e) {
|
|
147
|
+
e.has("open") && !this.open && this._clearTimer();
|
|
148
|
+
}
|
|
149
|
+
render() {
|
|
150
|
+
return h`
|
|
151
|
+
<div part="surface" role="status" aria-live="polite" aria-atomic="true">
|
|
152
|
+
<span part="message">${this.message}</span>
|
|
153
|
+
<button part="action" type="button" @click=${this._handleAction}>
|
|
154
|
+
${this.actionLabel}
|
|
155
|
+
</button>
|
|
156
|
+
</div>
|
|
157
|
+
`;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Shows a message or queues it according to `queuePolicy`.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* snackbar.show({
|
|
164
|
+
* message: 'Recipe saved',
|
|
165
|
+
* actionLabel: 'Undo',
|
|
166
|
+
* duration: 6000,
|
|
167
|
+
* });
|
|
168
|
+
*/
|
|
169
|
+
show(e) {
|
|
170
|
+
const t = typeof e == "string" ? { message: e } : e;
|
|
171
|
+
if (this.open) {
|
|
172
|
+
this.queuePolicy === "replace" ? (this._closeCurrent("replace", !1), this._showNow(t)) : this._queue.push(t);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this._showNow(t);
|
|
176
|
+
}
|
|
177
|
+
/** Closes the current snackbar. */
|
|
178
|
+
close(e = "api") {
|
|
179
|
+
this._closeCurrent(e, !0);
|
|
180
|
+
}
|
|
181
|
+
/** Clears the current snackbar and all queued messages. */
|
|
182
|
+
clear() {
|
|
183
|
+
this._queue = [], this._closeCurrent("clear", !1);
|
|
184
|
+
}
|
|
185
|
+
_showNow(e) {
|
|
186
|
+
const t = e.duration ?? this.duration;
|
|
187
|
+
this._clearTimer(), this.message = e.message, this.actionLabel = e.actionLabel ?? "", this._lastMessage = e.message, this.open = !0, t > 0 && (this._timer = window.setTimeout(() => this._closeCurrent("timeout", !0), t));
|
|
188
|
+
}
|
|
189
|
+
_closeCurrent(e, t) {
|
|
190
|
+
if (!this.open)
|
|
191
|
+
return;
|
|
192
|
+
const s = this.message;
|
|
193
|
+
if (this._clearTimer(), this.open = !1, this.message = "", this.actionLabel = "", this.dispatchEvent(
|
|
194
|
+
new CustomEvent("rc-snackbar-close", {
|
|
195
|
+
bubbles: !0,
|
|
196
|
+
composed: !0,
|
|
197
|
+
detail: { reason: e, message: s }
|
|
198
|
+
})
|
|
199
|
+
), t) {
|
|
200
|
+
const a = this._queue.shift();
|
|
201
|
+
a && queueMicrotask(() => this._showNow(a));
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
_handleAction() {
|
|
205
|
+
this.open && (this.dispatchEvent(
|
|
206
|
+
new CustomEvent("rc-snackbar-action", {
|
|
207
|
+
bubbles: !0,
|
|
208
|
+
composed: !0,
|
|
209
|
+
detail: { message: this._lastMessage }
|
|
210
|
+
})
|
|
211
|
+
), this._closeCurrent("action", !0));
|
|
212
|
+
}
|
|
213
|
+
_clearTimer() {
|
|
214
|
+
window.clearTimeout(this._timer), this._timer = void 0;
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
l.styles = f;
|
|
218
|
+
let r = l;
|
|
219
|
+
n([
|
|
220
|
+
i({ type: Boolean, reflect: !0 })
|
|
221
|
+
], r.prototype, "open", 1);
|
|
222
|
+
n([
|
|
223
|
+
i({ type: Boolean, attribute: "default-open" })
|
|
224
|
+
], r.prototype, "defaultOpen", 1);
|
|
225
|
+
n([
|
|
226
|
+
i({ type: String, reflect: !0 })
|
|
227
|
+
], r.prototype, "message", 2);
|
|
228
|
+
n([
|
|
229
|
+
i({ type: String, attribute: "action-label", reflect: !0 })
|
|
230
|
+
], r.prototype, "actionLabel", 2);
|
|
231
|
+
n([
|
|
232
|
+
i({ type: Number })
|
|
233
|
+
], r.prototype, "duration", 2);
|
|
234
|
+
n([
|
|
235
|
+
i({ type: String, attribute: "queue-policy" })
|
|
236
|
+
], r.prototype, "queuePolicy", 2);
|
|
237
|
+
export {
|
|
238
|
+
r as R
|
|
239
|
+
};
|
|
240
|
+
//# sourceMappingURL=rc-snackbar-CGTWrbMU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rc-snackbar-CGTWrbMU.js","sources":["../src/rc-snackbar.styles.ts","../src/rc-snackbar.ts"],"sourcesContent":["import { css } from 'lit';\n\nexport const snackbarStyles = css`\n :host {\n position: fixed;\n inset-inline: var(--rc-snackbar-inset-inline, 1rem);\n inset-block-end: calc(\n var(--rc-snackbar-inset-block-end, 1rem) + env(safe-area-inset-bottom, 0px)\n );\n z-index: var(--rc-snackbar-z-index, 1000);\n display: none;\n justify-content: center;\n pointer-events: none;\n color-scheme: inherit;\n }\n\n :host([hidden]) {\n display: none;\n }\n\n :host([open]) {\n display: flex;\n }\n\n /*\n * Fade and slide up from the block-end edge it's anchored to. Unlike\n * rc-dialog/rc-bottom-sheet, nothing here reads getBoundingClientRect()\n * during the entrance, so a transform is safe: the host is a fixed\n * positioning wrapper with no resize or drag feature of its own.\n * show()/close() stay synchronous either way.\n */\n @media (prefers-reduced-motion: no-preference) {\n :host {\n opacity: 0;\n translate: 0 100%;\n }\n\n :host([open]) {\n opacity: 1;\n translate: none;\n transition:\n opacity var(--rc-motion-effects-duration-default, 200ms)\n var(--rc-motion-effects-easing-enter, ease-out),\n translate var(--rc-motion-spatial-duration-default, 400ms)\n var(--rc-motion-spatial-easing-enter, ease-out),\n display var(--rc-motion-effects-duration-default, 200ms) allow-discrete;\n }\n\n :host(:not([open])) {\n transition:\n opacity var(--rc-motion-effects-duration-default, 200ms)\n var(--rc-motion-effects-easing-exit, ease-in),\n translate var(--rc-motion-spatial-duration-default, 400ms)\n var(--rc-motion-spatial-easing-exit, ease-in),\n display var(--rc-motion-effects-duration-default, 200ms) allow-discrete;\n }\n\n @starting-style {\n :host([open]) {\n opacity: 0;\n translate: 0 100%;\n }\n }\n }\n\n [part='surface'] {\n pointer-events: auto;\n display: flex;\n align-items: center;\n gap: var(--rc-snackbar-gap, 0.5rem);\n box-sizing: border-box;\n min-block-size: var(--rc-snackbar-min-block-size, 3rem);\n inline-size: min(100%, var(--rc-snackbar-max-inline-size, 30rem));\n padding-block: var(--rc-snackbar-padding-block, 0.5rem);\n padding-inline: var(--rc-snackbar-padding-inline, 1rem);\n border: var(--rc-snackbar-border, 1px solid CanvasText);\n border-radius: var(--rc-snackbar-radius, 0);\n background: var(--rc-snackbar-bg, Canvas);\n color: var(--rc-snackbar-color, CanvasText);\n box-shadow: var(--rc-snackbar-shadow, none);\n }\n\n [part='message'] {\n flex: 1 1 auto;\n }\n\n [part='action'] {\n flex: 0 0 auto;\n display: none;\n border: var(--rc-snackbar-action-border, revert);\n border-radius: var(--rc-snackbar-action-radius, revert);\n padding-block: var(--rc-snackbar-action-padding-block, revert);\n padding-inline: var(--rc-snackbar-action-padding-inline, revert);\n background: var(--rc-snackbar-action-bg, revert);\n color: var(--rc-snackbar-action-color, revert);\n font: var(--rc-snackbar-action-font, revert);\n }\n\n :host([action-label]) [part='action'] {\n display: inline-flex;\n }\n\n [part='action']:focus-visible {\n outline: var(--rc-snackbar-focus-ring, revert);\n outline-offset: var(--rc-snackbar-focus-ring-offset, revert);\n }\n\n @media (forced-colors: active) {\n [part='surface'] {\n border: 1px solid CanvasText;\n background: CanvasText;\n color: Canvas;\n }\n\n [part='action'] {\n color: Highlight;\n }\n }\n`;\n\nexport default snackbarStyles;\n","import { LitElement, html } from 'lit';\nimport type { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport snackbarStyles from './rc-snackbar.styles.js';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'rc-snackbar': RCSnackbar;\n }\n\n interface HTMLElementEventMap {\n 'rc-snackbar-action': CustomEvent<RCSnackbarActionDetail>;\n 'rc-snackbar-close': CustomEvent<RCSnackbarCloseDetail>;\n }\n}\n\n/** Snackbar queue behavior when `show()` is called while open. */\nexport type RCSnackbarQueuePolicy = 'queue' | 'replace';\n\n/** Close reasons surfaced by `rc-snackbar-close`. */\nexport type RCSnackbarCloseReason = 'action' | 'api' | 'timeout' | 'replace' | 'clear';\n\n/** Options accepted by `show()`. */\nexport interface RCSnackbarShowOptions {\n /** Message text to announce. */\n message: string;\n /** Optional action button label. */\n actionLabel?: string;\n /** Auto-close duration in milliseconds. */\n duration?: number;\n}\n\n/** Detail payload for `rc-snackbar-action`. */\nexport interface RCSnackbarActionDetail {\n /** Message that was visible when the action was activated. */\n message: string;\n}\n\n/** Detail payload for `rc-snackbar-close`. */\nexport interface RCSnackbarCloseDetail {\n /** Close reason. */\n reason: RCSnackbarCloseReason;\n /** Message that closed. */\n message: string;\n}\n\n/**\n * Snackbar live-region host for brief status messages and optional actions.\n *\n * Fades and slides in from the block-end edge it's anchored to through CSS\n * alone (`@starting-style` plus a discrete `display` transition), using the\n * shared `--rc-motion-effects-*`/`--rc-motion-spatial-*` tokens.\n * `show()`/`close()` stay synchronous; nothing waits on the transition\n * finishing.\n *\n * @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-snackbar rc-snackbar docs}\n *\n * @fires rc-snackbar-action - Fired when the action button is activated.\n * @fires rc-snackbar-close - Fired after a visible snackbar closes.\n *\n * @csspart surface - Snackbar surface.\n * @csspart message - Message text.\n * @csspart action - Optional action button.\n *\n * @attr open - Whether a snackbar is currently visible. Host writes are silent.\n * @attr default-open - Initial visible state for uncontrolled usage.\n * @attr message - Visible snackbar message.\n * @attr action-label - Optional action button label.\n * @attr duration - Auto-close duration in milliseconds.\n * @attr queue-policy - `queue` appends while open; `replace` closes the current message.\n *\n * @cssprop [--rc-snackbar-inset-inline=1rem] - Inline-axis inset from the viewport edge.\n * @cssprop [--rc-snackbar-inset-block-end=1rem] - Block-end inset from the viewport edge, before\n * the safe-area inset.\n * @cssprop [--rc-snackbar-z-index=1000] - Stacking order.\n * @cssprop [--rc-snackbar-gap=0.5rem] - Gap between the message and action.\n * @cssprop [--rc-snackbar-min-block-size=3rem] - Minimum surface block size.\n * @cssprop [--rc-snackbar-max-inline-size=30rem] - Maximum surface inline size.\n * @cssprop [--rc-snackbar-padding-block=0.5rem] - Surface block-axis padding.\n * @cssprop [--rc-snackbar-padding-inline=1rem] - Surface inline-axis padding.\n * @cssprop [--rc-snackbar-border=1px solid CanvasText] - Surface border.\n * @cssprop [--rc-snackbar-radius=0] - Surface border radius.\n * @cssprop [--rc-snackbar-bg=Canvas] - Surface background.\n * @cssprop [--rc-snackbar-color=CanvasText] - Surface text color.\n * @cssprop [--rc-snackbar-shadow=none] - Surface box shadow.\n * @cssprop [--rc-snackbar-action-border] - Action button border; defers to native button\n * border when unset.\n * @cssprop [--rc-snackbar-action-radius] - Action button border radius; defers to native button\n * radius when unset.\n * @cssprop [--rc-snackbar-action-padding-block] - Action button block-axis padding; defers to\n * native button padding when unset.\n * @cssprop [--rc-snackbar-action-padding-inline] - Action button inline-axis padding; defers to\n * native button padding when unset.\n * @cssprop [--rc-snackbar-action-bg] - Action button background; defers to native button\n * background when unset.\n * @cssprop [--rc-snackbar-action-color] - Action button text color; defers to native button\n * color when unset.\n * @cssprop [--rc-snackbar-action-font] - Action button font shorthand; defers to native button\n * font when unset.\n * @cssprop [--rc-snackbar-focus-ring] - Action button focus outline; defers to native focus\n * styling when unset.\n * @cssprop [--rc-snackbar-focus-ring-offset] - Action button focus outline offset; defers to\n * native focus styling when unset.\n */\nexport class RCSnackbar extends LitElement {\n static override styles = snackbarStyles;\n\n private _queue: RCSnackbarShowOptions[] = [];\n private _timer: number | undefined;\n private _lastMessage = '';\n\n private _open: boolean | undefined;\n private _defaultOpen = false;\n private _openInitialized = false;\n\n /** Whether the snackbar is currently visible. Host writes are silent. */\n @property({ type: Boolean, reflect: true })\n get open(): boolean {\n return this._open ?? this._defaultOpen;\n }\n\n set open(value: boolean | undefined) {\n const oldValue = this.open;\n\n this._open = value;\n this._openInitialized = true;\n this.requestUpdate('open', oldValue);\n }\n\n /** Initial visible state for uncontrolled usage, such as an already-queued\n * message shown on first render. */\n @property({ type: Boolean, attribute: 'default-open' })\n get defaultOpen(): boolean {\n return this._defaultOpen;\n }\n\n set defaultOpen(value: boolean) {\n const oldValue = this._defaultOpen;\n\n this._defaultOpen = value;\n\n if (!this._openInitialized && this._open === undefined) {\n this.requestUpdate('open', oldValue);\n }\n\n this.requestUpdate('defaultOpen', oldValue);\n }\n\n /** Visible message text. */\n @property({ type: String, reflect: true })\n message = '';\n\n /** Optional action button label. */\n @property({ type: String, attribute: 'action-label', reflect: true })\n actionLabel = '';\n\n /** Auto-close duration in milliseconds. Set to 0 to keep open. */\n @property({ type: Number })\n duration = 4000;\n\n /** Queue behavior for show calls while open. */\n @property({ type: String, attribute: 'queue-policy' })\n queuePolicy: RCSnackbarQueuePolicy = 'queue';\n\n override disconnectedCallback(): void {\n this._clearTimer();\n super.disconnectedCallback();\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n if (changed.has('open') && !this.open) {\n this._clearTimer();\n }\n }\n\n protected override render() {\n return html`\n <div part=\"surface\" role=\"status\" aria-live=\"polite\" aria-atomic=\"true\">\n <span part=\"message\">${this.message}</span>\n <button part=\"action\" type=\"button\" @click=${this._handleAction}>\n ${this.actionLabel}\n </button>\n </div>\n `;\n }\n\n /**\n * Shows a message or queues it according to `queuePolicy`.\n *\n * @example\n * snackbar.show({\n * message: 'Recipe saved',\n * actionLabel: 'Undo',\n * duration: 6000,\n * });\n */\n show(message: string | RCSnackbarShowOptions): void {\n const next = typeof message === 'string' ? { message } : message;\n\n if (this.open) {\n if (this.queuePolicy === 'replace') {\n this._closeCurrent('replace', false);\n this._showNow(next);\n } else {\n this._queue.push(next);\n }\n\n return;\n }\n\n this._showNow(next);\n }\n\n /** Closes the current snackbar. */\n close(reason: RCSnackbarCloseReason = 'api'): void {\n this._closeCurrent(reason, true);\n }\n\n /** Clears the current snackbar and all queued messages. */\n clear(): void {\n this._queue = [];\n this._closeCurrent('clear', false);\n }\n\n private _showNow(next: RCSnackbarShowOptions): void {\n const duration = next.duration ?? this.duration;\n\n this._clearTimer();\n this.message = next.message;\n this.actionLabel = next.actionLabel ?? '';\n this._lastMessage = next.message;\n this.open = true;\n\n if (duration > 0) {\n this._timer = window.setTimeout(() => this._closeCurrent('timeout', true), duration);\n }\n }\n\n private _closeCurrent(reason: RCSnackbarCloseReason, showNext: boolean): void {\n if (!this.open) {\n return;\n }\n\n const message = this.message;\n\n this._clearTimer();\n this.open = false;\n this.message = '';\n this.actionLabel = '';\n\n this.dispatchEvent(\n new CustomEvent<RCSnackbarCloseDetail>('rc-snackbar-close', {\n bubbles: true,\n composed: true,\n detail: { reason, message },\n }),\n );\n\n if (showNext) {\n const next = this._queue.shift();\n\n if (next) {\n queueMicrotask(() => this._showNow(next));\n }\n }\n }\n\n private _handleAction(): void {\n if (!this.open) {\n return;\n }\n\n this.dispatchEvent(\n new CustomEvent<RCSnackbarActionDetail>('rc-snackbar-action', {\n bubbles: true,\n composed: true,\n detail: { message: this._lastMessage },\n }),\n );\n\n this._closeCurrent('action', true);\n }\n\n private _clearTimer(): void {\n window.clearTimeout(this._timer);\n this._timer = undefined;\n }\n}\n\nexport default RCSnackbar;\n"],"names":["snackbarStyles","css","_RCSnackbar","LitElement","value","oldValue","changed","html","message","next","reason","duration","showNext","RCSnackbar","__decorateClass","property"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rc-snackbar-define.js","sources":["../src/define.ts"],"sourcesContent":["import { RCSnackbar } from './index.js';\n\ncustomElements.get('rc-snackbar') || customElements.define('rc-snackbar', RCSnackbar);\n"],"names":["RCSnackbar"],"mappings":";AAEA,eAAe,IAAI,aAAa,KAAK,eAAe,OAAO,eAAeA,CAAU;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rc-snackbar.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
declare global {
|
|
3
|
+
interface HTMLElementTagNameMap {
|
|
4
|
+
'rc-snackbar': RCSnackbar;
|
|
5
|
+
}
|
|
6
|
+
interface HTMLElementEventMap {
|
|
7
|
+
'rc-snackbar-action': CustomEvent<RCSnackbarActionDetail>;
|
|
8
|
+
'rc-snackbar-close': CustomEvent<RCSnackbarCloseDetail>;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/** Snackbar queue behavior when `show()` is called while open. */
|
|
12
|
+
export type RCSnackbarQueuePolicy = 'queue' | 'replace';
|
|
13
|
+
/** Close reasons surfaced by `rc-snackbar-close`. */
|
|
14
|
+
export type RCSnackbarCloseReason = 'action' | 'api' | 'timeout' | 'replace' | 'clear';
|
|
15
|
+
/** Options accepted by `show()`. */
|
|
16
|
+
export interface RCSnackbarShowOptions {
|
|
17
|
+
/** Message text to announce. */
|
|
18
|
+
message: string;
|
|
19
|
+
/** Optional action button label. */
|
|
20
|
+
actionLabel?: string;
|
|
21
|
+
/** Auto-close duration in milliseconds. */
|
|
22
|
+
duration?: number;
|
|
23
|
+
}
|
|
24
|
+
/** Detail payload for `rc-snackbar-action`. */
|
|
25
|
+
export interface RCSnackbarActionDetail {
|
|
26
|
+
/** Message that was visible when the action was activated. */
|
|
27
|
+
message: string;
|
|
28
|
+
}
|
|
29
|
+
/** Detail payload for `rc-snackbar-close`. */
|
|
30
|
+
export interface RCSnackbarCloseDetail {
|
|
31
|
+
/** Close reason. */
|
|
32
|
+
reason: RCSnackbarCloseReason;
|
|
33
|
+
/** Message that closed. */
|
|
34
|
+
message: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Snackbar live-region host for brief status messages and optional actions.
|
|
38
|
+
*
|
|
39
|
+
* Fades and slides in from the block-end edge it's anchored to through CSS
|
|
40
|
+
* alone (`@starting-style` plus a discrete `display` transition), using the
|
|
41
|
+
* shared `--rc-motion-effects-*`/`--rc-motion-spatial-*` tokens.
|
|
42
|
+
* `show()`/`close()` stay synchronous; nothing waits on the transition
|
|
43
|
+
* finishing.
|
|
44
|
+
*
|
|
45
|
+
* @see {@link https://richardcarls.github.io/rc-webcomponents/components/rc-snackbar rc-snackbar docs}
|
|
46
|
+
*
|
|
47
|
+
* @fires rc-snackbar-action - Fired when the action button is activated.
|
|
48
|
+
* @fires rc-snackbar-close - Fired after a visible snackbar closes.
|
|
49
|
+
*
|
|
50
|
+
* @csspart surface - Snackbar surface.
|
|
51
|
+
* @csspart message - Message text.
|
|
52
|
+
* @csspart action - Optional action button.
|
|
53
|
+
*
|
|
54
|
+
* @attr open - Whether a snackbar is currently visible. Host writes are silent.
|
|
55
|
+
* @attr default-open - Initial visible state for uncontrolled usage.
|
|
56
|
+
* @attr message - Visible snackbar message.
|
|
57
|
+
* @attr action-label - Optional action button label.
|
|
58
|
+
* @attr duration - Auto-close duration in milliseconds.
|
|
59
|
+
* @attr queue-policy - `queue` appends while open; `replace` closes the current message.
|
|
60
|
+
*
|
|
61
|
+
* @cssprop [--rc-snackbar-inset-inline=1rem] - Inline-axis inset from the viewport edge.
|
|
62
|
+
* @cssprop [--rc-snackbar-inset-block-end=1rem] - Block-end inset from the viewport edge, before
|
|
63
|
+
* the safe-area inset.
|
|
64
|
+
* @cssprop [--rc-snackbar-z-index=1000] - Stacking order.
|
|
65
|
+
* @cssprop [--rc-snackbar-gap=0.5rem] - Gap between the message and action.
|
|
66
|
+
* @cssprop [--rc-snackbar-min-block-size=3rem] - Minimum surface block size.
|
|
67
|
+
* @cssprop [--rc-snackbar-max-inline-size=30rem] - Maximum surface inline size.
|
|
68
|
+
* @cssprop [--rc-snackbar-padding-block=0.5rem] - Surface block-axis padding.
|
|
69
|
+
* @cssprop [--rc-snackbar-padding-inline=1rem] - Surface inline-axis padding.
|
|
70
|
+
* @cssprop [--rc-snackbar-border=1px solid CanvasText] - Surface border.
|
|
71
|
+
* @cssprop [--rc-snackbar-radius=0] - Surface border radius.
|
|
72
|
+
* @cssprop [--rc-snackbar-bg=Canvas] - Surface background.
|
|
73
|
+
* @cssprop [--rc-snackbar-color=CanvasText] - Surface text color.
|
|
74
|
+
* @cssprop [--rc-snackbar-shadow=none] - Surface box shadow.
|
|
75
|
+
* @cssprop [--rc-snackbar-action-border] - Action button border; defers to native button
|
|
76
|
+
* border when unset.
|
|
77
|
+
* @cssprop [--rc-snackbar-action-radius] - Action button border radius; defers to native button
|
|
78
|
+
* radius when unset.
|
|
79
|
+
* @cssprop [--rc-snackbar-action-padding-block] - Action button block-axis padding; defers to
|
|
80
|
+
* native button padding when unset.
|
|
81
|
+
* @cssprop [--rc-snackbar-action-padding-inline] - Action button inline-axis padding; defers to
|
|
82
|
+
* native button padding when unset.
|
|
83
|
+
* @cssprop [--rc-snackbar-action-bg] - Action button background; defers to native button
|
|
84
|
+
* background when unset.
|
|
85
|
+
* @cssprop [--rc-snackbar-action-color] - Action button text color; defers to native button
|
|
86
|
+
* color when unset.
|
|
87
|
+
* @cssprop [--rc-snackbar-action-font] - Action button font shorthand; defers to native button
|
|
88
|
+
* font when unset.
|
|
89
|
+
* @cssprop [--rc-snackbar-focus-ring] - Action button focus outline; defers to native focus
|
|
90
|
+
* styling when unset.
|
|
91
|
+
* @cssprop [--rc-snackbar-focus-ring-offset] - Action button focus outline offset; defers to
|
|
92
|
+
* native focus styling when unset.
|
|
93
|
+
*/
|
|
94
|
+
export declare class RCSnackbar extends LitElement {
|
|
95
|
+
static styles: import('lit').CSSResult;
|
|
96
|
+
private _queue;
|
|
97
|
+
private _timer;
|
|
98
|
+
private _lastMessage;
|
|
99
|
+
private _open;
|
|
100
|
+
private _defaultOpen;
|
|
101
|
+
private _openInitialized;
|
|
102
|
+
/** Whether the snackbar is currently visible. Host writes are silent. */
|
|
103
|
+
get open(): boolean;
|
|
104
|
+
set open(value: boolean | undefined);
|
|
105
|
+
/** Initial visible state for uncontrolled usage, such as an already-queued
|
|
106
|
+
* message shown on first render. */
|
|
107
|
+
get defaultOpen(): boolean;
|
|
108
|
+
set defaultOpen(value: boolean);
|
|
109
|
+
/** Visible message text. */
|
|
110
|
+
message: string;
|
|
111
|
+
/** Optional action button label. */
|
|
112
|
+
actionLabel: string;
|
|
113
|
+
/** Auto-close duration in milliseconds. Set to 0 to keep open. */
|
|
114
|
+
duration: number;
|
|
115
|
+
/** Queue behavior for show calls while open. */
|
|
116
|
+
queuePolicy: RCSnackbarQueuePolicy;
|
|
117
|
+
disconnectedCallback(): void;
|
|
118
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
119
|
+
protected render(): import('lit').TemplateResult<1>;
|
|
120
|
+
/**
|
|
121
|
+
* Shows a message or queues it according to `queuePolicy`.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* snackbar.show({
|
|
125
|
+
* message: 'Recipe saved',
|
|
126
|
+
* actionLabel: 'Undo',
|
|
127
|
+
* duration: 6000,
|
|
128
|
+
* });
|
|
129
|
+
*/
|
|
130
|
+
show(message: string | RCSnackbarShowOptions): void;
|
|
131
|
+
/** Closes the current snackbar. */
|
|
132
|
+
close(reason?: RCSnackbarCloseReason): void;
|
|
133
|
+
/** Clears the current snackbar and all queued messages. */
|
|
134
|
+
clear(): void;
|
|
135
|
+
private _showNow;
|
|
136
|
+
private _closeCurrent;
|
|
137
|
+
private _handleAction;
|
|
138
|
+
private _clearTimer;
|
|
139
|
+
}
|
|
140
|
+
export default RCSnackbar;
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rcarls/rc-snackbar",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "public"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.0.0-next-20260921045401",
|
|
7
|
+
"description": "Snackbar live-region host for brief status messages and optional actions.",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/richardcarls/rc-webcomponents.git",
|
|
11
|
+
"directory": "packages/rc-snackbar"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://richardcarls.github.io/rc-webcomponents/components/rc-snackbar",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"module": "./dist/rc-snackbar.js",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"import": {
|
|
23
|
+
"types": "./dist/types/packages/rc-snackbar/src/index.d.ts",
|
|
24
|
+
"default": "./dist/rc-snackbar.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"./define": {
|
|
28
|
+
"import": {
|
|
29
|
+
"types": "./dist/types/packages/rc-snackbar/src/define.d.ts",
|
|
30
|
+
"default": "./dist/rc-snackbar-define.js"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"types": "./dist/types/packages/rc-snackbar/src/index.d.ts",
|
|
35
|
+
"sideEffects": [
|
|
36
|
+
"./dist/rc-snackbar-define.js"
|
|
37
|
+
],
|
|
38
|
+
"customElements": "dist/custom-elements.json",
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc && vite build && cem analyze",
|
|
41
|
+
"cem:analyze": "cem analyze",
|
|
42
|
+
"preview": "vite preview",
|
|
43
|
+
"test:browser": "vitest --run",
|
|
44
|
+
"test:browser:chrome": "vitest --run --project=chromium",
|
|
45
|
+
"test:browser:firefox": "vitest --run --project=firefox"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@custom-elements-manifest/analyzer": "0.11.0",
|
|
49
|
+
"@vitest/browser-playwright": "4.1.5",
|
|
50
|
+
"lit": "^3.0.0",
|
|
51
|
+
"playwright": "^1.56.0",
|
|
52
|
+
"rollup": "^4.60.2",
|
|
53
|
+
"typescript": "~5.9.3",
|
|
54
|
+
"vite": "^7.1.7",
|
|
55
|
+
"vite-plugin-dts": "^4.5.4",
|
|
56
|
+
"vitest": "^4.0.6",
|
|
57
|
+
"vitest-browser-lit": "^1.0.1"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"lit": "^3.0.0"
|
|
61
|
+
}
|
|
62
|
+
}
|