@cboxdk/cbox-ui 0.13.0 → 0.14.1
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/README.md +3 -3
- package/dist/index.d.ts +24 -13
- package/dist/index.js +284 -264
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/tokens/controls.css +43 -25
package/package.json
CHANGED
package/tokens/controls.css
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
.cbx-ui-check,
|
|
15
15
|
.cbx-ui-radio,
|
|
16
16
|
.cbx-ui-switch,
|
|
17
|
-
.cbx-ui-
|
|
17
|
+
.cbx-ui-sheet,
|
|
18
18
|
.cbx-ui-iconbtn {
|
|
19
19
|
--cbx-ui-ease: cubic-bezier(.4, 0, .2, 1);
|
|
20
20
|
box-sizing: border-box;
|
|
@@ -242,48 +242,66 @@
|
|
|
242
242
|
.cbx-ui-iconbtn > svg { width: 16px; height: 16px; }
|
|
243
243
|
@media (pointer: coarse) { .cbx-ui-iconbtn { width: 40px; height: 40px; } }
|
|
244
244
|
|
|
245
|
-
/* ──
|
|
245
|
+
/* ── Sheet: never a centred modal. A bottom sheet on a phone, a panel from the right from
|
|
246
|
+
768px. The body is the only scroller, so the title and the actions stay put. */
|
|
246
247
|
.cbx-ui-overlay {
|
|
247
248
|
position: fixed;
|
|
248
249
|
inset: 0;
|
|
249
250
|
z-index: 90;
|
|
250
251
|
background: var(--overlay, oklch(0.2 0.015 75 / 0.45));
|
|
252
|
+
/* Fades as the phone's sheet is dragged down (sheet-drag sets --cbx-scrim). */
|
|
253
|
+
opacity: var(--cbx-scrim, 1);
|
|
251
254
|
animation: cbx-ui-fade 200ms var(--cbx-ui-ease, ease);
|
|
252
255
|
}
|
|
253
|
-
.cbx-ui-
|
|
256
|
+
.cbx-ui-sheet {
|
|
254
257
|
position: fixed;
|
|
255
258
|
z-index: 91;
|
|
256
|
-
left:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
+
left: 0;
|
|
260
|
+
right: 0;
|
|
261
|
+
bottom: 0;
|
|
259
262
|
display: flex;
|
|
260
263
|
flex-direction: column;
|
|
261
|
-
|
|
262
|
-
|
|
264
|
+
max-height: 88svh;
|
|
265
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
263
266
|
background: var(--popover);
|
|
264
267
|
color: var(--popover-foreground);
|
|
265
|
-
border: 1px solid var(--border);
|
|
266
|
-
border-radius:
|
|
268
|
+
border-top: 1px solid var(--border);
|
|
269
|
+
border-radius: 16px 16px 0 0;
|
|
267
270
|
box-shadow: 0 1px 2px oklch(0.2 0.02 75 / 0.08), 0 16px 48px oklch(0.2 0.02 75 / 0.24);
|
|
268
271
|
/* Portalled to <body>, outside the shell: it states its own type. */
|
|
269
272
|
font-family: var(--font-sans, system-ui, -apple-system, 'Segoe UI', sans-serif);
|
|
270
273
|
font-size: 14px;
|
|
271
274
|
line-height: 1.45;
|
|
272
|
-
animation: cbx-ui-
|
|
275
|
+
animation: cbx-ui-sheet-up 300ms var(--cbx-ui-ease);
|
|
273
276
|
}
|
|
274
|
-
.cbx-ui-
|
|
275
|
-
.cbx-ui-
|
|
276
|
-
.cbx-ui-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
277
|
+
.cbx-ui-sheet:focus { outline: none; }
|
|
278
|
+
.cbx-ui-sheet-handle { flex: none; width: 36px; height: 4px; margin: 8px auto 0; border-radius: 9999px; background: var(--border-strong, var(--border)); }
|
|
279
|
+
.cbx-ui-sheet[data-cbx-dragging] { user-select: none; -webkit-user-select: none; }
|
|
280
|
+
@media (min-width: 768px) {
|
|
281
|
+
.cbx-ui-sheet {
|
|
282
|
+
left: auto;
|
|
283
|
+
top: 0;
|
|
284
|
+
width: min(30rem, calc(100vw - 48px));
|
|
285
|
+
max-height: none;
|
|
286
|
+
padding-bottom: 0;
|
|
287
|
+
border-top: 0;
|
|
288
|
+
border-left: 1px solid var(--border);
|
|
289
|
+
border-radius: 0;
|
|
290
|
+
animation-name: cbx-ui-sheet-side;
|
|
291
|
+
}
|
|
292
|
+
.cbx-ui-sheet--sm { width: min(26rem, calc(100vw - 48px)); }
|
|
293
|
+
.cbx-ui-sheet--lg { width: min(44rem, calc(100vw - 48px)); }
|
|
294
|
+
.cbx-ui-sheet-handle { display: none; }
|
|
295
|
+
}
|
|
296
|
+
.cbx-ui-sheet-head { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--border); }
|
|
297
|
+
.cbx-ui-sheet-heading { min-width: 0; }
|
|
298
|
+
.cbx-ui-sheet-title { margin: 0; font-family: var(--font-display, system-ui, sans-serif); font-size: 16px; font-weight: 600; line-height: 1.3; color: var(--foreground); }
|
|
299
|
+
.cbx-ui-sheet-desc { margin: 4px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted-foreground); }
|
|
300
|
+
.cbx-ui-sheet-body { flex: 1; min-height: 0; padding: 20px; overflow-y: auto; overscroll-behavior: contain; }
|
|
301
|
+
/* Keep actions at the bottom even when a confirmation has no body. */
|
|
302
|
+
.cbx-ui-sheet-foot { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: auto; padding: 12px 20px; border-top: 1px solid var(--border); }
|
|
286
303
|
@keyframes cbx-ui-fade { from { opacity: 0; } }
|
|
287
|
-
@keyframes cbx-ui-
|
|
288
|
-
@
|
|
304
|
+
@keyframes cbx-ui-sheet-up { from { transform: translateY(100%); } }
|
|
305
|
+
@keyframes cbx-ui-sheet-side { from { transform: translateX(100%); } }
|
|
306
|
+
@media (prefers-reduced-motion: reduce) { .cbx-ui-overlay, .cbx-ui-sheet { animation: none; } }
|
|
289
307
|
}
|