@cboxdk/cbox-ui 0.12.1 → 0.14.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cboxdk/cbox-ui",
3
- "version": "0.12.1",
3
+ "version": "0.14.0",
4
4
  "private": false,
5
5
  "description": "Cbox shared UI — layout primitives, design tokens, and brand assets used across every Cbox-family app (id, cortex, atlas, track, …).",
6
6
  "repository": {
package/tokens/cbox.css CHANGED
@@ -2,6 +2,7 @@
2
2
  @import './shell.css';
3
3
  /* Form controls and the dialog (Button, Field, Input, Checkbox, RadioGroup, Switch, Dialog). */
4
4
  @import './controls.css';
5
+ @import './page-tabs.css';
5
6
 
6
7
  /* Cbox colour tokens — cbox-ui structure, warmed toward cbox.dk's cream/ink palette
7
8
  * so the products share temperature with the brand site (and aren't a Linear clone).
@@ -14,7 +14,7 @@
14
14
  .cbx-ui-check,
15
15
  .cbx-ui-radio,
16
16
  .cbx-ui-switch,
17
- .cbx-ui-dialog,
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,65 @@
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
- /* ── Dialog */
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-dialog {
256
+ .cbx-ui-sheet {
254
257
  position: fixed;
255
258
  z-index: 91;
256
- left: 50%;
257
- top: 50%;
258
- transform: translate(-50%, -50%);
259
+ left: 0;
260
+ right: 0;
261
+ bottom: 0;
259
262
  display: flex;
260
263
  flex-direction: column;
261
- width: calc(100vw - 32px);
262
- max-height: calc(100dvh - 64px);
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: var(--radius, 12px);
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-pop 200ms var(--cbx-ui-ease);
275
+ animation: cbx-ui-sheet-up 300ms var(--cbx-ui-ease);
273
276
  }
274
- .cbx-ui-dialog:focus { outline: none; }
275
- .cbx-ui-dialog--sm { max-width: 24rem; }
276
- .cbx-ui-dialog--md { max-width: 32rem; }
277
- .cbx-ui-dialog--lg { max-width: 48rem; }
278
- .cbx-ui-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
279
- .cbx-ui-dialog-heading { min-width: 0; }
280
- .cbx-ui-dialog-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); }
281
- .cbx-ui-dialog-desc { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--muted-foreground); }
282
- /* The body is the only part that scrolls, so the footer's actions stay in reach. */
283
- .cbx-ui-dialog-body { flex: 1; min-height: 0; padding: 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
284
- .cbx-ui-dialog-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }
285
- .cbx-ui-dialog-head + .cbx-ui-dialog-foot { padding-top: 16px; }
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
+ .cbx-ui-sheet-foot { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
286
302
  @keyframes cbx-ui-fade { from { opacity: 0; } }
287
- @keyframes cbx-ui-pop { from { opacity: 0; transform: translate(-50%, calc(-50% + 4px)) scale(0.98); } }
288
- @media (prefers-reduced-motion: reduce) { .cbx-ui-overlay, .cbx-ui-dialog { animation: none; } }
303
+ @keyframes cbx-ui-sheet-up { from { transform: translateY(100%); } }
304
+ @keyframes cbx-ui-sheet-side { from { transform: translateX(100%); } }
305
+ @media (prefers-reduced-motion: reduce) { .cbx-ui-overlay, .cbx-ui-sheet { animation: none; } }
289
306
  }
@@ -0,0 +1,26 @@
1
+ /* PageTabs also serves the shell: it must work without a host Tailwind build. */
2
+ @layer components {
3
+ .cbx-page-tabs { container: tabs / inline-size; min-width: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
4
+ .cbx-page-tabs-desktop { display: none; align-items: end; gap: 12px; padding: 0 12px; }
5
+ .cbx-page-tabs-desktop nav { display: flex; flex: 1; align-items: center; gap: 4px; min-height: 48px; overflow-x: auto; padding: 6px 0; }
6
+ .cbx-page-tabs-desktop nav a { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
7
+ .cbx-page-tabs-desktop > div { display: flex; align-items: center; gap: 8px; min-height: 48px; }
8
+ .cbx-page-tabs-mobile { display: flex; flex-direction: column; gap: 8px; padding: 8px; }
9
+ .cbx-page-tabs-dropdown { position: relative; }
10
+ .cbx-page-tabs-dropdown > button { display: flex; width: 100%; min-height: 44px; align-items: center; justify-content: space-between; gap: 8px; padding: 0 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--foreground); text-align: left; font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; }
11
+ .cbx-page-tabs-dropdown > button > span { display: flex; min-width: 0; align-items: center; gap: 8px; }
12
+ .cbx-page-tabs-dropdown > button > span > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
13
+ .cbx-page-tabs-dropdown > ul { position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin: 4px 0 0; padding: 0; max-height: 60dvh; overflow-y: auto; list-style: none; border: 1px solid var(--border); border-radius: 6px; background: var(--popover); box-shadow: 0 8px 24px oklch(0.2 0.02 75 / 0.18); }
14
+ .cbx-page-tabs-dropdown li a { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 12px; overflow-wrap: anywhere; }
15
+ .cbx-page-tabs a { color: var(--muted-foreground); text-decoration: none; font-size: 13px; }
16
+ .cbx-page-tabs a:hover { color: var(--foreground); background: var(--secondary); }
17
+ .cbx-page-tabs a[aria-current="page"] { color: var(--foreground); background: var(--accent-soft); font-weight: 600; }
18
+ .cbx-page-tabs :is(a, button):focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
19
+ .cbx-page-tabs svg { width: 14px; height: 14px; flex-shrink: 0; }
20
+ .cbx-page-tabs-dropdown > button[aria-expanded="true"] > svg { transform: rotate(180deg); }
21
+ .cbx-m-section-nav { padding: 8px 16px; }
22
+ @container tabs (min-width: 56rem) {
23
+ .cbx-page-tabs-desktop { display: flex; }
24
+ .cbx-page-tabs-mobile { display: none; }
25
+ }
26
+ }