@gravitee/graphene-core 2.51.0 → 2.52.0-feat-layout-content-width-tiers.35c2ff9

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.
@@ -118,6 +118,9 @@
118
118
 
119
119
  /* ── Layout ─────────────────────────────────────── */
120
120
  --container-content: var(--content-max-width);
121
+ --max-width-content: var(--content-max-width);
122
+ --max-width-form: var(--content-form-width);
123
+ --max-width-focused: var(--content-focused-width);
121
124
 
122
125
  /* ── Radius ──────────────────────────────────────── */
123
126
  --radius-sm: calc(var(--radius) - 0.125rem);
@@ -23,7 +23,9 @@
23
23
 
24
24
  /* ── Content area ────────────────────────────────── */
25
25
  --content-padding: var(--graphene-spacing-6);
26
- --content-max-width: 80rem;
26
+ --content-max-width: 100rem;
27
+ --content-form-width: 80rem;
28
+ --content-focused-width: 56rem;
27
29
 
28
30
  /* ── Derived layout ────────────────────────────── */
29
31
  --sidebar-height: 100svh;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravitee/graphene-core",
3
- "version": "2.51.0",
3
+ "version": "2.52.0-feat-layout-content-width-tiers.35c2ff9",
4
4
  "type": "module",
5
5
  "description": "Gravitee's Graphene design system: accessible React components, design tokens, icons, and shared ESLint/TypeScript configs. Built on shadcn/ui and Tailwind.",
6
6
  "keywords": [
@@ -95,6 +95,7 @@
95
95
  },
96
96
  "peerDependencies": {
97
97
  "@fontsource/dm-sans": ">=5.0.0",
98
+ "@gravitee/graphene-core": "2.52.0-feat-layout-content-width-tiers.35c2ff9",
98
99
  "@monaco-editor/react": "^4.7.0",
99
100
  "@tanstack/react-table": "^8.0.0",
100
101
  "@testing-library/dom": ">=10.0.0",
@@ -77,7 +77,16 @@ export function ResourceDetailPage({
77
77
  );
78
78
  }
79
79
 
80
- // 3. With LayoutSlots (module federation):
80
+ // 3. Content width tier:
81
+ // Detail pages use the **default** content tier (80rem / 1280px). No
82
+ // useLayoutConfig call is needed for width — AppLayout applies it automatically.
83
+ // Do NOT set max-w-* classes on page wrappers.
84
+ //
85
+ // Use contentVariant: 'wide' only for DataTable list pages (see data-table-list-page snippet).
86
+ // Use contentVariant: 'full-bleed' only for tool layouts (Policy Studio) or
87
+ // observability pages (dashboards, log/trace explorers).
88
+
89
+ // 4. With LayoutSlots (module federation):
81
90
  // If using useLayoutConfig instead of direct props, push the sidebar from
82
91
  // inside your module component. The host owns appContext in ContentHeader;
83
92
  // modules only set breadcrumbs, leading, and contextSidebar.
@@ -0,0 +1,121 @@
1
+ // Snippet: Creation wizard / stepper page with PageFocused
2
+ //
3
+ // Use when building a multi-step creation flow, onboarding sequence,
4
+ // or any focused linear task (Create API, Create Agent, Import, etc.).
5
+ //
6
+ // Content width: Wrap in <PageFocused> to constrain to 56rem (896px)
7
+ // and center within the container. The centering signals to the user
8
+ // that they are in a focused sub-task.
9
+ //
10
+ // Do NOT use for:
11
+ // - Regular settings/form pages (use <PageSection>)
12
+ // - DataTable list pages (use the full container — no wrapper)
13
+ // - Inline editing within a detail view (use <PageSection>)
14
+ //
15
+ // Decision rule: If the user navigated INTO a creation/wizard flow → <PageFocused>.
16
+
17
+ import { useState } from 'react';
18
+ import { Button, Card, CardContent, Field, Input, Label, PageFocused, Separator } from '@gravitee/graphene-core';
19
+ import { ArrowLeftIcon, ArrowRightIcon, RocketIcon } from '@gravitee/graphene-core/icons';
20
+
21
+ // Replace with your actual step definitions
22
+ const STEPS = ['Details', 'Configure', 'Review'] as const;
23
+
24
+ export function CreateResourceWizardPage() {
25
+ const [step, setStep] = useState(0);
26
+ const isLastStep = step === STEPS.length - 1;
27
+
28
+ function handleNext() {
29
+ if (isLastStep) {
30
+ // Replace with your create mutation
31
+ return;
32
+ }
33
+ setStep((s) => s + 1);
34
+ }
35
+
36
+ function handleBack() {
37
+ if (step === 0) {
38
+ // Replace with your navigation back
39
+ return;
40
+ }
41
+ setStep((s) => s - 1);
42
+ }
43
+
44
+ return (
45
+ <PageFocused>
46
+ <div className="space-y-6">
47
+ {/* Step indicator */}
48
+ <nav aria-label="Progress" className="flex items-center justify-center gap-2">
49
+ {STEPS.map((label, i) => (
50
+ <div key={label} className="flex items-center gap-2">
51
+ <div className="flex items-center gap-1.5">
52
+ <div
53
+ className={`flex size-6 items-center justify-center rounded-full text-xs font-medium ${
54
+ i <= step ? 'bg-primary text-primary-foreground' : 'border border-border text-muted-foreground'
55
+ }`}
56
+ >
57
+ {i + 1}
58
+ </div>
59
+ <span className={`text-sm ${i <= step ? 'font-medium' : 'text-muted-foreground'}`}>{label}</span>
60
+ </div>
61
+ {i < STEPS.length - 1 && <div className="h-px w-8 bg-border" />}
62
+ </div>
63
+ ))}
64
+ </nav>
65
+
66
+ {/* Step content */}
67
+ <Card>
68
+ <CardContent className="space-y-4 pt-6">
69
+ {step === 0 && (
70
+ <>
71
+ <Field>
72
+ <Label>Resource name</Label>
73
+ <Input placeholder="Enter a name" />
74
+ </Field>
75
+ <Field>
76
+ <Label>Description</Label>
77
+ <Input placeholder="Optional description" />
78
+ </Field>
79
+ </>
80
+ )}
81
+ {step === 1 && (
82
+ <Field>
83
+ <Label>Configuration</Label>
84
+ <Input placeholder="Enter configuration value" />
85
+ </Field>
86
+ )}
87
+ {step === 2 && (
88
+ <div className="space-y-2">
89
+ <p className="text-sm font-medium">Review your configuration</p>
90
+ <p className="text-sm text-muted-foreground">Confirm the details below before creating.</p>
91
+ </div>
92
+ )}
93
+ </CardContent>
94
+ </Card>
95
+
96
+ <Separator />
97
+
98
+ {/* Navigation buttons */}
99
+ <div className="flex items-center justify-between">
100
+ <Button variant="outline" onClick={handleBack}>
101
+ <ArrowLeftIcon className="size-4" aria-hidden />
102
+ {step === 0 ? 'Cancel' : 'Back'}
103
+ </Button>
104
+ <Button onClick={handleNext}>
105
+ {isLastStep ? (
106
+ <>
107
+ <RocketIcon className="size-4" aria-hidden />
108
+ Create
109
+ </>
110
+ ) : (
111
+ <>
112
+ Next
113
+ <ArrowRightIcon className="size-4" aria-hidden />
114
+ </>
115
+ )}
116
+ </Button>
117
+ </div>
118
+ </div>
119
+ </PageFocused>
120
+ );
121
+ }
@@ -3,6 +3,11 @@
3
3
  // Use when building a list page for server-paginated entity data (APIs, Applications,
4
4
  // Policies, Agents, Plans, etc.) — any CRUD list where users manage entities.
5
5
  //
6
+ // Content width: DataTable list pages use the full default container (100rem / 1600px).
7
+ // No `useLayoutConfig` call needed — the default container is already 100rem.
8
+ // Do NOT wrap in <PageSection> — tables should fill the available width.
9
+ // Do NOT set max-w-* classes on page wrappers — the design system handles it.
10
+ //
6
11
  // Do NOT use for:
7
12
  // - Static key-value detail panels (use raw Table)
8
13
  // - Time-series/triage explorers (logs, traces) — see Record Explorer pattern (deferred)
@@ -0,0 +1,112 @@
1
+ // Snippet: Form / Settings page with PageSection
2
+ //
3
+ // Use when building a settings, configuration, or form-based page inside
4
+ // a resource detail view (General settings, CORS config, Notifications, etc.).
5
+ //
6
+ // Content width: Wrap in <PageSection> to constrain to 80rem (1280px),
7
+ // left-aligned within the default 100rem container. This keeps forms
8
+ // readable and prevents inputs from stretching too wide.
9
+ //
10
+ // Do NOT use for:
11
+ // - DataTable list pages (use the full container — no wrapper)
12
+ // - Creation wizards / steppers (use <PageFocused> instead)
13
+ // - Tool layouts like Policy Studio (use contentVariant: 'full-bleed')
14
+ //
15
+ // Decision rule: If the page is primarily forms, cards, or settings → <PageSection>.
16
+
17
+ import { useState } from 'react';
18
+ import {
19
+ Button,
20
+ Card,
21
+ CardContent,
22
+ CardDescription,
23
+ CardHeader,
24
+ CardTitle,
25
+ Field,
26
+ Input,
27
+ Label,
28
+ PageSection,
29
+ Separator,
30
+ Switch,
31
+ Textarea,
32
+ } from '@gravitee/graphene-core';
33
+
34
+ // Replace with your actual form state management (react-hook-form, etc.)
35
+ interface FormState {
36
+ name: string;
37
+ description: string;
38
+ enableFeature: boolean;
39
+ }
40
+
41
+ export function SettingsPage() {
42
+ const [form, setForm] = useState<FormState>({
43
+ name: '',
44
+ description: '',
45
+ enableFeature: false,
46
+ });
47
+ const [saving, setSaving] = useState(false);
48
+
49
+ function handleSave() {
50
+ setSaving(true);
51
+ // Replace with your API call
52
+ setTimeout(() => setSaving(false), 1000);
53
+ }
54
+
55
+ return (
56
+ <PageSection>
57
+ <div className="space-y-6">
58
+ <div>
59
+ <h2 className="text-lg font-semibold">General Settings</h2>
60
+ <p className="text-sm text-muted-foreground">Configure general settings for this resource.</p>
61
+ </div>
62
+
63
+ <Separator />
64
+
65
+ <Card>
66
+ <CardHeader>
67
+ <CardTitle>Details</CardTitle>
68
+ <CardDescription>Basic information about this resource.</CardDescription>
69
+ </CardHeader>
70
+ <CardContent className="space-y-4">
71
+ <Field>
72
+ <Label>Name</Label>
73
+ <Input
74
+ value={form.name}
75
+ onChange={(e) => setForm((f) => ({ ...f, name: e.target.value }))}
76
+ placeholder="Enter name"
77
+ />
78
+ </Field>
79
+
80
+ <Field>
81
+ <Label>Description</Label>
82
+ <Textarea
83
+ value={form.description}
84
+ onChange={(e) => setForm((f) => ({ ...f, description: e.target.value }))}
85
+ placeholder="Optional description"
86
+ rows={3}
87
+ />
88
+ </Field>
89
+
90
+ <div className="flex items-center justify-between rounded-lg border p-3">
91
+ <div className="space-y-0.5">
92
+ <Label>Enable feature</Label>
93
+ <p className="text-xs text-muted-foreground">Toggle this feature on or off.</p>
94
+ </div>
95
+ <Switch
96
+ checked={form.enableFeature}
97
+ onCheckedChange={(checked) => setForm((f) => ({ ...f, enableFeature: checked }))}
98
+ />
99
+ </div>
100
+ </CardContent>
101
+ </Card>
102
+
103
+ <div className="flex gap-2">
104
+ <Button onClick={handleSave} disabled={saving}>
105
+ {saving ? 'Saving…' : 'Save changes'}
106
+ </Button>
107
+ <Button variant="outline">Cancel</Button>
108
+ </div>
109
+ </div>
110
+ </PageSection>
111
+ );
112
+ }