@cognite/aura 0.1.7 → 0.2.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/DESIGN.md +34 -92
- package/README.md +3 -3
- package/dist/colors.css +441 -214
- package/dist/components/index.d.ts +15 -1
- package/dist/components/index.js +345 -275
- package/dist/components/ui/core/accordion/accordion.js +22 -22
- package/dist/components/ui/core/alert/alert.d.ts +1 -1
- package/dist/components/ui/core/avatar/avatar.js +10 -10
- package/dist/components/ui/core/badge/badge.d.ts +2 -2
- package/dist/components/ui/core/badge/badge.js +13 -13
- package/dist/components/ui/core/banner/banner.d.ts +4 -4
- package/dist/components/ui/core/breadcrumb/breadcrumb.d.ts +11 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +190 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.metadata.d.ts +2 -0
- package/dist/components/ui/core/breadcrumb/breadcrumb.metadata.js +9 -0
- package/dist/components/ui/core/button/button.d.ts +1 -1
- package/dist/components/ui/core/card/card.d.ts +7 -4
- package/dist/components/ui/core/card/card.js +131 -87
- package/dist/components/ui/core/card/card.metadata.js +1 -1
- package/dist/components/ui/core/checkbox/checkbox.d.ts +13 -0
- package/dist/components/ui/core/checkbox/checkbox.js +129 -0
- package/dist/components/ui/core/checkbox/checkbox.metadata.d.ts +2 -0
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +8 -0
- package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
- package/dist/components/ui/core/command/command.d.ts +2 -2
- package/dist/components/ui/core/count/count.d.ts +8 -0
- package/dist/components/ui/core/count/count.js +32 -0
- package/dist/components/ui/core/inline-citation/inline-citation.js +8 -8
- package/dist/components/ui/core/input-group/input-group.d.ts +1 -1
- package/dist/components/ui/core/kbd/kbd.d.ts +3 -0
- package/dist/components/ui/core/kbd/kbd.js +36 -0
- package/dist/components/ui/core/kbd/kbd.metadata.d.ts +2 -0
- package/dist/components/ui/core/kbd/kbd.metadata.js +9 -0
- package/dist/components/ui/core/loader/loader.d.ts +9 -1
- package/dist/components/ui/core/loader/loader.js +106 -107
- package/dist/components/ui/core/loader/loader.metadata.js +2 -2
- package/dist/components/ui/core/popover/popover.d.ts +1 -1
- package/dist/components/ui/core/prompt-input/prompt-input.d.ts +1 -1
- package/dist/components/ui/core/radio-group/radio-group.d.ts +16 -0
- package/dist/components/ui/core/radio-group/radio-group.js +110 -0
- package/dist/components/ui/core/radio-group/radio-group.metadata.d.ts +2 -0
- package/dist/components/ui/core/radio-group/radio-group.metadata.js +9 -0
- package/dist/components/ui/core/segmented-control/segmented-control.d.ts +16 -0
- package/dist/components/ui/core/segmented-control/segmented-control.js +169 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.d.ts +3 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +48 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.metadata.d.ts +2 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.metadata.js +9 -0
- package/dist/components/ui/core/tabs/tabs.d.ts +23 -0
- package/dist/components/ui/core/tabs/tabs.js +222 -0
- package/dist/components/ui/core/tabs/tabs.utils.d.ts +2 -0
- package/dist/components/ui/core/tabs/tabs.utils.js +9 -0
- package/dist/components/ui/core/topbar/topbar.d.ts +30 -0
- package/dist/components/ui/core/topbar/topbar.js +190 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +314 -255
- package/dist/lib/utils.d.ts +11 -0
- package/dist/lib/utils.js +40 -29
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +66 -7
- package/package.json +5 -5
package/DESIGN.md
CHANGED
|
@@ -8,14 +8,14 @@ Aura is the design system for Cognite Data Fusion experiences: composable UI pri
|
|
|
8
8
|
|
|
9
9
|
The canonical token files (`colors.css`, `styles.source.css`) live in the Aura library repo under `src/`. In a consuming app they are available through the published package — import from `@cognite/aura/colors.css` and `@cognite/aura/styles.css`. Do not look for `src/colors.css` next to your app code; resolve token names via your IDE's autocomplete on `@cognite/aura`, or consult the tables in [Tokens](#tokens) below.
|
|
10
10
|
|
|
11
|
-
**Code:** In Fusion / host apps (example convention), ship UI from Aura exports (`@cognite/aura/components`, [Storybook](https://
|
|
11
|
+
**Code:** In Fusion / host apps (example convention), ship UI from Aura exports (`@cognite/aura/components`, [Storybook](https://storybook-aura-23638.fusion-preview.preview.cogniteapp.com)) under e.g. `src/components/ui`; prefer **CVA** variants. **[Interaction states](#interaction-states)**, **[Heuristics](#heuristics)**, and **[Content](#content)** define how to use primitives — prefer component APIs over reimplementing or overriding internals when a variant already matches intent. **Prop names, `size` values, and subcomponents** are **not** duplicated here; use [Storybook](https://storybook-aura-23638.fusion-preview.preview.cogniteapp.com), the [Aura design system documentation](https://docs.cognite.com/aura-design-system/get-started) (foundations, primitives, installation), and TypeScript types from `@cognite/aura/components` as the source of truth. For color in product UI, use tokens — not raw `hex` / `rgb` / `hsl` when a semantic or base token exists; details under **[Tokens](#tokens)**.
|
|
12
12
|
|
|
13
13
|
## Dashboard quick start (agent checklist)
|
|
14
14
|
|
|
15
15
|
For pages with data-heavy layouts — cards, charts, metric tiles — work through these steps before writing component code.
|
|
16
16
|
|
|
17
17
|
- [ ] **Tokens** — confirm all colors use semantic or chart tokens, no raw hex. Metric tiles: `decorative-*`. Data series: `chart-*`. Status: `info-*`, `success-*`, `warning-*`, `destructive-*`. See [Tokens → Color](#color).
|
|
18
|
-
- [ ] **Layout** — use a 12-column grid with `gap-4` or `gap-6`. Tile widths: `col-span-12 sm:col-span-6 lg:col-span-3`. Cap the page frame with `max-w-[min(100%,var(--container-8xl))]`.
|
|
18
|
+
- [ ] **Layout** — use a 12-column grid with `gap-4` or `gap-6`. Tile widths: `col-span-12 sm:col-span-6 lg:col-span-3`. Cap the page frame with `max-w-[min(100%,var(--container-8xl))]`.
|
|
19
19
|
- [ ] **Cards** — use the `Card` component with title, description, and a primary action. Do not stack unrelated actions in the same card. See [Heuristics §6.1](#61-grouping-and-proximity).
|
|
20
20
|
- [ ] **Loading states** — every data region must show `Shimmer` (known layout) or `Loader` (unknown layout) while fetching. See [Heuristics §1.1](#11-loading-states).
|
|
21
21
|
- [ ] **Status signals** — default to **Badge** or compact status cards for repeated states; keep **Alert** to one page-level inline instance unless multiple independent incidents each need separate action. See [Alert vs Banner vs Badge vs Sonner](#alert-vs-banner-vs-badge-vs-sonner).
|
|
@@ -32,7 +32,7 @@ For pages with data-heavy layouts — cards, charts, metric tiles — work throu
|
|
|
32
32
|
|
|
33
33
|
**Scope — two layers**
|
|
34
34
|
|
|
35
|
-
- **`@cognite/aura`:** primitives exported from this library ([Storybook](https://
|
|
35
|
+
- **`@cognite/aura`:** primitives exported from this library ([Storybook](https://storybook-aura-23638.fusion-preview.preview.cogniteapp.com)). **Components:** lines below name Aura exports where they exist.
|
|
36
36
|
- **Fusion / app shell:** patterns such as global **Topbar**, **Sonner** toasts, **AlertDialog**, **Sheet** / **Drawer**, **Tabs**, **SegmentedControl**, **Checkbox** / **Radio** / **Switch**, **ContextMenu**, or **EmptyState** may live **outside** this package — **Must** still follow the same **Tokens**, **Interaction states**, and severity rules using your shell’s components or Radix-style primitives themed with Aura.
|
|
37
37
|
- **Minimal or standalone apps** (no Fusion shell): apply the **same tokens** and **interaction rules** with Aura primitives and your stack’s equivalents. **Must** rules that name shell-only components (**Topbar**, **Sonner**, **AlertDialog**, **Sheet**, …) apply **when that capability exists** — treat them as **Should** / **when available** and substitute with the closest Aura or Radix pattern; wire **TooltipProvider** (or your tooltip root) at app root wherever **Tooltip** is used. Do not invent a fake shell just to satisfy a checklist.
|
|
38
38
|
|
|
@@ -374,7 +374,7 @@ Information **must** be scannable and oriented before action.
|
|
|
374
374
|
|
|
375
375
|
**Rules**
|
|
376
376
|
|
|
377
|
-
- **Should** verify layouts at common widths (e.g. 768 / 1024 / 1440px) when shipping responsive surfaces
|
|
377
|
+
- **Should** verify layouts at common widths (e.g. 768 / 1024 / 1440px) when shipping responsive surfaces.
|
|
378
378
|
- **Should** prefer **Dialog** / shell **Drawer** for secondary tasks on narrow viewports instead of cramming wide panels.
|
|
379
379
|
- **Avoid** hard-coded pixel widths that bypass Tailwind and Aura layout tokens.
|
|
380
380
|
|
|
@@ -469,7 +469,7 @@ When splitting or stripping this doc for agents:
|
|
|
469
469
|
- Keep **Must** / **Should** / **Avoid** / **must not** wording — severity is the routing signal.
|
|
470
470
|
- Keep each **Applies when:** line — it tells the agent which subsection fires.
|
|
471
471
|
- Keep **Aura components:** lines aligned with [`src/components/index.ts`](./src/components/index.ts) exports (public entry for `@cognite/aura/components`); treat **App / Fusion shell** lines as integration responsibilities, not as Aura package exports.
|
|
472
|
-
- Preserve links: [Aura Storybook](https://
|
|
472
|
+
- Preserve links: [Aura Storybook](https://storybook-aura-23638.fusion-preview.preview.cogniteapp.com); [Aura documentation](https://docs.cognite.com/aura-design-system/get-started) for published guides. Fetch current prop names from Storybook or source before codegen.
|
|
473
473
|
- If you split by section (§1–§7), repeat the **Severity** and **Scope** bullets at the top of each file so standalone chunks stay interpretable.
|
|
474
474
|
- Preserve **[Content](#content)** for action verbs, date/time rules, and tone; agents generating strings should follow it alongside **Heuristics**.
|
|
475
475
|
|
|
@@ -500,7 +500,7 @@ Tables in this section use **CSS role names** (e.g. `link-foreground`, `card-bac
|
|
|
500
500
|
| `destructive-background` | `bg-destructive-background`, `text-destructive-foreground-on-critical` (on surface) | Destructive actions — pairings in **Semantic colors** |
|
|
501
501
|
| `info-background`, `success-background`, … | `bg-info-background`, `text-info-foreground`, … | Full names match **Semantic colors** token columns |
|
|
502
502
|
|
|
503
|
-
Semantic utilities use the **full token name** as the Tailwind segment (e.g. `bg-info-background`, not `bg-info`). For **charts**, utilities follow the **Chart tokens** names (`bg-chart-fjord-
|
|
503
|
+
Semantic utilities use the **full token name** as the Tailwind segment (e.g. `bg-info-background`, not `bg-info`). For **charts**, utilities follow the **Chart tokens** names (`bg-chart-fjord-color-1`, `bg-chart-gridlines`, …). For exhaustive coverage, use [`src/colors.css`](./src/colors.css) or your IDE on `@cognite/aura`.
|
|
504
504
|
|
|
505
505
|
Tables below list **approximate hex** resolved from [`src/colors.css`](./src/colors.css) at build time; the source of truth is the synced file (some entries are `rgba()`).
|
|
506
506
|
|
|
@@ -531,7 +531,7 @@ Aura groups color into **Base** (~80–90% of UI), **Semantic** (status and feed
|
|
|
531
531
|
| `popover-background` | `#FFFFFF` | `#212426` | Top-layer surfaces with shadow (dialogs, popovers) |
|
|
532
532
|
| `raised-background` | `#2D3134` | `#40464A` | Tooltips, Sonner toasts — floats above page |
|
|
533
533
|
| `disabled-background` | `#F1F2F3` | `#2D3134` | Disabled inputs and controls |
|
|
534
|
-
| `overlay-background` | `
|
|
534
|
+
| `overlay-background` | `#7C868E80` | `#7C868E80` | Scrim behind modals |
|
|
535
535
|
| `background-fixed-dark` | `#212426` | `#212426` | Must stay **dark** in both themes |
|
|
536
536
|
| `background-fixed-light` | `#FFFFFF` | `#FFFFFF` | Must stay **light** in both themes |
|
|
537
537
|
| `accent-background-fixed-dark` | `#2D3134` | `#2D3134` | Persistent dark accent chrome (e.g. sidebar) |
|
|
@@ -543,7 +543,7 @@ Aura groups color into **Base** (~80–90% of UI), **Semantic** (status and feed
|
|
|
543
543
|
| `foreground` | `#191B1D` | `#F1F2F3` | Primary text and icons |
|
|
544
544
|
| `secondary-foreground` | `#40464A` | `#D4D7D9` | Supporting text and icons |
|
|
545
545
|
| `muted-foreground` | `#6D767E` | `#A5ABB1` | Tertiary / low emphasis |
|
|
546
|
-
| `disabled-foreground` | `#
|
|
546
|
+
| `disabled-foreground` | `#D4D7D9` | `#5E666D` | Disabled text and icons |
|
|
547
547
|
| `link-foreground` | `#486AED` | `#1742E7` | Text links |
|
|
548
548
|
| `foreground-on-primary` | `#F1F2F3` | `#191B1D` | On `primary-background` |
|
|
549
549
|
| `foreground-on-active` | `#F1F2F3` | `#191B1D` | On `active-background` |
|
|
@@ -565,7 +565,7 @@ Aura groups color into **Base** (~80–90% of UI), **Semantic** (status and feed
|
|
|
565
565
|
| `ring` | `#7081C7` | `#7081C7` | Focus ring outer (maps to `--shadow-focus-ring`) |
|
|
566
566
|
| `ring-muted` | `#B5BEE2` | `#B5BEE2` | Focus ring inner companion |
|
|
567
567
|
|
|
568
|
-
Also generated: `ring-
|
|
568
|
+
Also generated: `ring-destructive`, `ring-destructive-muted` for destructive / invalid focus (see **Effects — Focus rings**).
|
|
569
569
|
|
|
570
570
|
#### Semantic colors
|
|
571
571
|
|
|
@@ -601,7 +601,7 @@ Each family has **default** pairings (theme-switching surfaces) and **muted** pa
|
|
|
601
601
|
| :--- | :--- | :--- | :--- |
|
|
602
602
|
| `warning-background` | `#FFE3A2` | `#FFE3A2` | Warning surface |
|
|
603
603
|
| `warning-background-hover` | `#FFD062` | `#FFF1D0` | Hover on `warning-background` |
|
|
604
|
-
| `warning-foreground` | `#
|
|
604
|
+
| `warning-foreground` | `#C18800` | `#D8BF00` | Text near warning on standard surfaces |
|
|
605
605
|
| `warning-foreground-on-warning` | `#755200` | `#5B4000` | Text **on** `warning-background` |
|
|
606
606
|
| `warning-muted-background` | `#FFF1D0` | `#2D3134` | Warning on dark chrome |
|
|
607
607
|
|
|
@@ -630,21 +630,21 @@ Each family has **default** pairings (theme-switching surfaces) and **muted** pa
|
|
|
630
630
|
|
|
631
631
|
#### Decorative colors
|
|
632
632
|
|
|
633
|
-
For **small accents** (badges, avatars, empty states) where color differentiates but does **not** signal status — use **Chart tokens** for plot colors, not this ramp, unless a design explicitly maps a tile to a series color. Pattern: `decorative-{ramp}
|
|
633
|
+
For **small accents** (badges, avatars, empty states) where color differentiates but does **not** signal status — use **Chart tokens** for plot colors, not this ramp, unless a design explicitly maps a tile to a series color. Pattern: `decorative-background-{ramp}`, `decorative-background-{ramp}-hover`, `decorative-foreground-{ramp}`.
|
|
634
634
|
|
|
635
635
|
**Preference order for new work:**
|
|
636
636
|
|
|
637
637
|
| Priority | Ramp | Background | Foreground |
|
|
638
638
|
| :---: | :--- | :--- | :--- |
|
|
639
|
-
| 1 | Fjord | `decorative-fjord
|
|
640
|
-
| 2 | Nordic | `decorative-nordic
|
|
641
|
-
| 3 | Aurora | `decorative-aurora
|
|
642
|
-
| 4 | Dusk | `decorative-dusk
|
|
643
|
-
| 5 | Orange | `decorative-orange
|
|
644
|
-
| 6 | Sky | `decorative-sky
|
|
645
|
-
| 7 | Mountain | `decorative-mountain
|
|
639
|
+
| 1 | Fjord | `decorative-background-fjord` | `decorative-foreground-fjord` |
|
|
640
|
+
| 2 | Nordic | `decorative-background-nordic` | `decorative-foreground-nordic` |
|
|
641
|
+
| 3 | Aurora | `decorative-background-aurora` | `decorative-foreground-aurora` |
|
|
642
|
+
| 4 | Dusk | `decorative-background-dusk` | `decorative-foreground-dusk` |
|
|
643
|
+
| 5 | Orange | `decorative-background-orange` | `decorative-foreground-orange` |
|
|
644
|
+
| 6 | Sky | `decorative-background-sky` | `decorative-foreground-sky` |
|
|
645
|
+
| 7 | Mountain | `decorative-background-mountain` | `decorative-foreground-mountain` |
|
|
646
646
|
|
|
647
|
-
Example (fjord ramp): light `decorative-fjord
|
|
647
|
+
Example (fjord ramp): light `decorative-background-fjord` → `#CCD5FA` (fjord-200), `decorative-foreground-fjord` → `#1234B6` (fjord-700); dark → `#AEBDF7` / `#0D2582` (fjord-300 / fjord-800). Every ramp resolves in [`src/colors.css`](./src/colors.css).
|
|
648
648
|
|
|
649
649
|
#### Chart tokens
|
|
650
650
|
|
|
@@ -652,8 +652,7 @@ Example (fjord ramp): light `decorative-fjord-background` → `#CCD5FA` (fjord-2
|
|
|
652
652
|
|
|
653
653
|
| Token | Use |
|
|
654
654
|
| :--- | :--- |
|
|
655
|
-
| `chart-
|
|
656
|
-
| `chart-{ramp}-opacity-1` … `chart-{ramp}-opacity-5` | Area-fill opacity steps (lightest → strongest) |
|
|
655
|
+
| `chart-{ramp}-color-1` … `chart-{ramp}-color-6` | Alpha-based series / area-fill steps (strongest → lightest) |
|
|
657
656
|
| `chart-gridlines` | Grid lines |
|
|
658
657
|
|
|
659
658
|
Default series order: **fjord → nordic → aurora → dusk → orange**.
|
|
@@ -767,9 +766,9 @@ Aura is visually **flat**; surfaces, spacing, and typography do most structure.
|
|
|
767
766
|
| Tailwind shadow | Built from `--effect-shadow-*` | Light (α) | Dark (α) | Use (per theme comments in CSS) |
|
|
768
767
|
| :--- | :--- | :--- | :--- | :--- |
|
|
769
768
|
| `shadow-sm` | `--effect-shadow-sm` | 0.04 | 0.2 | Tooltips, small floating containers |
|
|
770
|
-
| `shadow-default` | md + sm layers | 0.05 + 0.04 | 0.
|
|
771
|
-
| `shadow-md` |
|
|
772
|
-
| `shadow-lg` |
|
|
769
|
+
| `shadow-default` | md + sm layers | 0.05 + 0.04 | 0.302 + 0.2 | Menus, popovers, hover cards |
|
|
770
|
+
| `shadow-md` | lg + md layers | 0.06 + 0.05 | 0.4 + 0.302 | Sonner toasts, temporary elevated elements |
|
|
771
|
+
| `shadow-lg` | xl + lg layers | 0.10 + 0.06 | 0.6 + 0.4 | Modals / dialogs **without** full backdrop overlay |
|
|
773
772
|
| `shadow-xl` | xl + lg layers | 0.10 + 0.06 | 0.6 + 0.4 | Modals / dialogs **with** backdrop overlay |
|
|
774
773
|
|
|
775
774
|
Exact pixel stacks: `--shadow-sm` … `--shadow-xl` in [`src/styles.source.css`](./src/styles.source.css).
|
|
@@ -780,8 +779,8 @@ Shadow-based (not `outline`) for consistent rendering:
|
|
|
780
779
|
|
|
781
780
|
| Token | Composition | Use |
|
|
782
781
|
| :--- | :--- | :--- |
|
|
783
|
-
| `--shadow-focus-ring` | `0 0 0
|
|
784
|
-
| `--shadow-focus-ring-destructive` | `0 0 0
|
|
782
|
+
| `--shadow-focus-ring` | `0 0 0 1px var(--ring), 0 0 0 3px var(--ring-muted)` | Default focus on interactive controls |
|
|
783
|
+
| `--shadow-focus-ring-destructive` | `0 0 0 1px var(--ring-destructive), 0 0 0 3px var(--ring-destructive-muted)` | Destructive / invalid focus |
|
|
785
784
|
|
|
786
785
|
#### Opacity
|
|
787
786
|
|
|
@@ -789,7 +788,7 @@ Shadow-based (not `outline`) for consistent rendering:
|
|
|
789
788
|
| :--- | :--- | :--- |
|
|
790
789
|
| `--opacity-10` … `--opacity-80` (+ `*-inverted`) | rgba steps | Overlays, glass effects |
|
|
791
790
|
| Overlay scrim | via `overlay-background` | Modal backdrop (see color tables) |
|
|
792
|
-
| Chart fills | `chart-*-
|
|
791
|
+
| Chart fills | `chart-*-color-*` | See **Chart tokens** |
|
|
793
792
|
|
|
794
793
|
#### Motion (reference)
|
|
795
794
|
|
|
@@ -797,60 +796,11 @@ Short UI motion (e.g. accordion height) uses **~0.2s ease-out** in utilities; th
|
|
|
797
796
|
|
|
798
797
|
---
|
|
799
798
|
|
|
800
|
-
|
|
799
|
+
### Layout and spacing
|
|
801
800
|
|
|
802
|
-
|
|
801
|
+
Width and spacing values in this subsection come from [`src/styles.source.css`](./src/styles.source.css) (`@theme inline` and `:root`) where noted. **Gutters and gaps** use the same **4px-based** spacing scale as **[Tokens → Size and dimensions](#size-and-dimensions)**.
|
|
803
802
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
| Topic | Storybook |
|
|
807
|
-
| :--- | :--- |
|
|
808
|
-
| Layout overview (docs) | [Foundations / Layout — Docs](https://cognitedata.github.io/aura/storybook/?path=/docs/foundations-layout--docs) |
|
|
809
|
-
| **Column spans** | [Column spans](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--column-spans) |
|
|
810
|
-
| **Layout compositions** | [Compositions](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--compositions) |
|
|
811
|
-
| **Grid patterns** | [Grid patterns reference](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--grid-patterns-reference) |
|
|
812
|
-
| **Container queries** | [Container queries](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--container-queries) |
|
|
813
|
-
| **Breakpoints** | [Breakpoints](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--breakpoints) |
|
|
814
|
-
|
|
815
|
-
### Copy-paste patterns (Tailwind)
|
|
816
|
-
|
|
817
|
-
Abbreviated recipes for local iteration when Storybook is not open — **[Grid patterns reference](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--grid-patterns-reference)** and related stories remain the source of truth; tune spans and gaps to match product templates.
|
|
818
|
-
|
|
819
|
-
**Dashboard main frame** (wide upper bound from **Width and max content**):
|
|
820
|
-
|
|
821
|
-
```html
|
|
822
|
-
<div class="mx-auto w-full max-w-[min(100%,var(--container-8xl))] px-4 md:px-6">
|
|
823
|
-
<!-- page content -->
|
|
824
|
-
</div>
|
|
825
|
-
```
|
|
826
|
-
|
|
827
|
-
**12-column metric row** (example tile shrinks from full width to quarter width at large breakpoints):
|
|
828
|
-
|
|
829
|
-
```html
|
|
830
|
-
<div class="grid grid-cols-12 gap-4">
|
|
831
|
-
<section class="col-span-12 sm:col-span-6 lg:col-span-3">…</section>
|
|
832
|
-
<!-- repeat tiles -->
|
|
833
|
-
</div>
|
|
834
|
-
```
|
|
835
|
-
|
|
836
|
-
**12-column dashboard tile row** (copy-pasteable baseline):
|
|
837
|
-
|
|
838
|
-
```html
|
|
839
|
-
<div class="mx-auto w-full max-w-[min(100%,var(--container-8xl))] px-4 md:px-6">
|
|
840
|
-
<div class="grid grid-cols-12 gap-4 lg:gap-6">
|
|
841
|
-
<section class="col-span-12 sm:col-span-6 lg:col-span-3">…</section>
|
|
842
|
-
<section class="col-span-12 sm:col-span-6 lg:col-span-3">…</section>
|
|
843
|
-
<section class="col-span-12 sm:col-span-6 lg:col-span-3">…</section>
|
|
844
|
-
<section class="col-span-12 sm:col-span-6 lg:col-span-3">…</section>
|
|
845
|
-
</div>
|
|
846
|
-
</div>
|
|
847
|
-
```
|
|
848
|
-
|
|
849
|
-
Adjust `col-span-*` values to match your content hierarchy. Always verify against [Storybook grid patterns](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--grid-patterns-reference).
|
|
850
|
-
|
|
851
|
-
**Numbers** in the tables below come from [`src/styles.source.css`](./src/styles.source.css) (`@theme inline` and `:root`) where applicable. **Gutters and gaps** use the same **4px-based** spacing scale as **[Tokens → Size and dimensions](#size-and-dimensions)**.
|
|
852
|
-
|
|
853
|
-
### Body text reading width
|
|
803
|
+
**Body text reading width**
|
|
854
804
|
|
|
855
805
|
- **Must** cap **continuous body text** (paragraphs, descriptions, long labels) at a **maximum width of 600px** for comfortable reading.
|
|
856
806
|
- **Must** apply that limit to the **text column only** — companion UI (icons, thumbnails, side metadata, charts, code blocks) **may** sit outside that 600px band in the same row or card; do not shrink the text measure to absorb those elements.
|
|
@@ -867,34 +817,26 @@ Aura adjusts Tailwind **container** breakpoints where the default scale is too w
|
|
|
867
817
|
|
|
868
818
|
Prefer **`max-w-*`** (and other width utilities) tied to the theme over ad-hoc pixel `max-width` on wrappers. **Global frame** width (shell chrome) is defined by the **Fusion / product** host; **inside** the frame, combine these tokens with responsive utilities so regions reflow predictably.
|
|
869
819
|
|
|
870
|
-
### Column spans, compositions, and grids
|
|
871
|
-
|
|
872
|
-
- **Must** follow the **column span** and **composition** patterns from Storybook when laying out multi-column app and marketing surfaces — see [Column spans](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--column-spans) and [Compositions](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--compositions).
|
|
873
|
-
- **Must** align card grids, lists, and dashboard tiles to the **grid pattern** reference — see [Grid patterns reference](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--grid-patterns-reference).
|
|
874
|
-
- **Should** use **container queries** where a component’s layout should react to its **parent** width, not only the viewport — see [Container queries](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--container-queries).
|
|
875
|
-
- **Should** use the canonical **viewport breakpoints** for page-level reflow — see [Breakpoints](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--breakpoints).
|
|
876
820
|
|
|
877
|
-
### Specialized
|
|
821
|
+
### Specialized variables
|
|
878
822
|
|
|
879
823
|
| Variable | Value | Use |
|
|
880
824
|
| :--- | :--- | :--- |
|
|
881
825
|
| `--message-content-max-width` | `80%` | Primary column for chat / assistant **Message** content in wide threads |
|
|
882
826
|
| `--drawer-max-height` | `80vh` | Maximum height for top/bottom drawer-style panels when the host implements them |
|
|
883
|
-
| `--alert-icon-width` | `calc(var(--spacing) * 4)` (typically **16px**) | Fixed icon column in the **Alert**
|
|
827
|
+
| `--alert-icon-width` | `calc(var(--spacing) * 4)` (typically **16px**) | Fixed icon column in the **Alert** layout so titles and descriptions align |
|
|
884
828
|
|
|
885
|
-
###
|
|
829
|
+
### Regional spacing
|
|
886
830
|
|
|
887
|
-
- **Must** use the **spacing scale** for padding, margin, and `gap` between
|
|
831
|
+
- **Must** use the **spacing scale** for padding, margin, and `gap` between regions (`gap-*`, `p-*`, `m-*`) — see **Tokens → Size and dimensions**.
|
|
888
832
|
- **Should** keep major block **padding** and **gap** on **4px** multiples so control heights, radii, and typography line up visually.
|
|
889
833
|
- **Should** group related regions in **Card** (and **Separator** when two unrelated groups share a container) before mixing unrelated actions into the same band — see **Heuristics §6**.
|
|
890
834
|
- **Avoid** one-off pixel gutters that ignore the scale unless matching a fixed graphic asset.
|
|
891
835
|
|
|
892
836
|
### Responsive behavior
|
|
893
837
|
|
|
894
|
-
- **Should** treat viewport breakpoints as defined in Storybook — [Breakpoints](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--breakpoints) — and still sanity-check primary templates at about **768px**, **1024px**, and **1440px** in the Fusion shell or embedded contexts.
|
|
895
|
-
- **Should** use **container queries** for component-local layout where the preview shows it — [Container queries](https://cognitedata.github.io/aura/storybook/?path=/story/foundations-layout--container-queries).
|
|
896
838
|
- **Should** move secondary work into **Dialog** or a shell **Drawer** on narrow widths instead of compressing multi-column chrome.
|
|
897
|
-
- **Avoid** single-breakpoint layouts tuned only to a static design frame — use breakpoints,
|
|
839
|
+
- **Avoid** single-breakpoint layouts tuned only to a static design frame — use breakpoints, wrapping, and flexible sizing utilities where content must grow and shrink.
|
|
898
840
|
|
|
899
841
|
### Shell vs content
|
|
900
842
|
|
package/README.md
CHANGED
|
@@ -4,20 +4,20 @@ Aura exports Cognite's UI components, styles, utilities, and ESLint guidance for
|
|
|
4
4
|
|
|
5
5
|
## DESIGN.md (Google design.md linter)
|
|
6
6
|
|
|
7
|
-
[`DESIGN.md`](./DESIGN.md) is linted with [`@google/design.md`](https://www.npmjs.com/package/@google/design.md)
|
|
7
|
+
[`DESIGN.md`](./DESIGN.md) is linted with [`@google/design.md`](https://www.npmjs.com/package/@google/design.md) via `npx`, so Aura does not need a direct package dependency on the linter.
|
|
8
8
|
|
|
9
9
|
Published installs ship this spec at the package root; you can resolve it as `@cognite/aura/DESIGN.md` (for example with `import.meta.resolve` or your bundler’s raw import).
|
|
10
10
|
|
|
11
11
|
From `fusion/libs/aura`:
|
|
12
12
|
|
|
13
13
|
```sh
|
|
14
|
-
|
|
14
|
+
npx --yes @google/design.md lint ./DESIGN.md
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
From the Fusion workspace root:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
|
|
20
|
+
cd libs/aura && npx --yes @google/design.md lint ./DESIGN.md
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Or with Nx:
|