@gravitee/graphene-core 2.52.0-feat-layout-content-width-tiers.35c2ff9 → 2.52.0-graphene-142-code-editor.aaa181c
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/USAGE_GUIDE.md +11 -145
- package/dist/CodeEditor-Cnn11Gx1.js +2010 -0
- package/dist/__stories__/fixtures/index.d.ts +1 -1
- package/dist/__stories__/fixtures/index.d.ts.map +1 -1
- package/dist/__stories__/fixtures/json-schema-form/code-editor.fixture.d.ts +14 -0
- package/dist/__stories__/fixtures/json-schema-form/code-editor.fixture.d.ts.map +1 -0
- package/dist/__stories__/fixtures/json-schema-form/index.d.ts +1 -0
- package/dist/__stories__/fixtures/json-schema-form/index.d.ts.map +1 -1
- package/dist/code-editor/index.js +2 -228
- package/dist/composed/AppLayout/AppLayout.d.ts +4 -17
- package/dist/composed/AppLayout/AppLayout.d.ts.map +1 -1
- package/dist/composed/CodeEditor/CodeEditor.d.ts.map +1 -1
- package/dist/composed/CodeEditor/setupCodeEditor.d.ts +34 -39
- package/dist/composed/CodeEditor/setupCodeEditor.d.ts.map +1 -1
- package/dist/composed/JsonSchemaForm/SchemaField.d.ts.map +1 -1
- package/dist/composed/JsonSchemaForm/fields/code-editor/CodeEditorField.d.ts +8 -0
- package/dist/composed/JsonSchemaForm/fields/code-editor/CodeEditorField.d.ts.map +1 -0
- package/dist/composed/JsonSchemaForm/models/json-schema.types.d.ts +5 -5
- package/dist/composed/JsonSchemaForm/models/json-schema.types.d.ts.map +1 -1
- package/dist/composed/JsonSchemaForm/utils/schemaShape.d.ts +2 -1
- package/dist/composed/JsonSchemaForm/utils/schemaShape.d.ts.map +1 -1
- package/dist/composed/LayoutSlots/LayoutSlotsContext.d.ts +1 -11
- package/dist/composed/LayoutSlots/LayoutSlotsContext.d.ts.map +1 -1
- package/dist/composed/LayoutSlots/use-layout-config.d.ts +0 -3
- package/dist/composed/LayoutSlots/use-layout-config.d.ts.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7636 -7626
- package/dist/styles/globals.css +1 -1
- package/dist/styles/tailwind-theme.css +0 -3
- package/dist/tokens/component.css +1 -3
- package/package.json +2 -2
- package/snippets/context-sidebar-detail-page.tsx +1 -10
- package/snippets/data-table-list-page.tsx +0 -5
- package/dist/Skeleton-C30qULzD.js +0 -1745
- package/dist/composed/PageContent/PageContent.d.ts +0 -60
- package/dist/composed/PageContent/PageContent.d.ts.map +0 -1
- package/dist/composed/PageContent/index.d.ts +0 -3
- package/dist/composed/PageContent/index.d.ts.map +0 -1
- package/dist/lib/view-transitions.d.ts +0 -14
- package/dist/lib/view-transitions.d.ts.map +0 -1
- package/snippets/creation-wizard-page.tsx +0 -121
- package/snippets/form-settings-page.tsx +0 -112
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
interface PageSectionProps {
|
|
3
|
-
/** Page content (forms, settings panels, card layouts). */
|
|
4
|
-
readonly children: ReactNode;
|
|
5
|
-
readonly className?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Constrains page content to a comfortable form width (80rem / 1280px),
|
|
9
|
-
* left-aligned within the default 100rem container.
|
|
10
|
-
*
|
|
11
|
-
* Use for settings pages, configuration forms, detail overviews, and
|
|
12
|
-
* any page where the primary content is NOT a full-width DataTable.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```tsx
|
|
16
|
-
* export function GeneralSettingsPage() {
|
|
17
|
-
* return (
|
|
18
|
-
* <PageSection>
|
|
19
|
-
* <h2>General</h2>
|
|
20
|
-
* <form>...</form>
|
|
21
|
-
* </PageSection>
|
|
22
|
-
* );
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
declare function PageSection({ children, className }: PageSectionProps): import("react").JSX.Element;
|
|
27
|
-
declare namespace PageSection {
|
|
28
|
-
var displayName: string;
|
|
29
|
-
}
|
|
30
|
-
interface PageFocusedProps {
|
|
31
|
-
/** Focused content (stepper, creation wizard, onboarding flow). */
|
|
32
|
-
readonly children: ReactNode;
|
|
33
|
-
readonly className?: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Constrains and centers page content for focused flows (56rem / 896px).
|
|
37
|
-
*
|
|
38
|
-
* Use for creation wizards, multi-step forms, onboarding sequences, and
|
|
39
|
-
* any task where the user is working through a focused linear flow.
|
|
40
|
-
* The centering signals "you are in a sub-task" and draws the eye inward.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* ```tsx
|
|
44
|
-
* export function CreateApiWizardPage() {
|
|
45
|
-
* return (
|
|
46
|
-
* <PageFocused>
|
|
47
|
-
* <StepProgress steps={steps} activeStep={step} />
|
|
48
|
-
* <StepContent />
|
|
49
|
-
* </PageFocused>
|
|
50
|
-
* );
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
declare function PageFocused({ children, className }: PageFocusedProps): import("react").JSX.Element;
|
|
55
|
-
declare namespace PageFocused {
|
|
56
|
-
var displayName: string;
|
|
57
|
-
}
|
|
58
|
-
export { PageFocused, PageSection };
|
|
59
|
-
export type { PageFocusedProps, PageSectionProps };
|
|
60
|
-
//# sourceMappingURL=PageContent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PageContent.d.ts","sourceRoot":"","sources":["../../../src/composed/PageContent/PageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,gBAAgB;IACxB,2DAA2D;IAC3D,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAE7D;kBAFQ,WAAW;;;AAMpB,UAAU,gBAAgB;IACxB,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,gBAAgB,+BAE7D;kBAFQ,WAAW;;;AAMpB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACpC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/composed/PageContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACzD,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wraps a state update in a View Transition so the browser captures
|
|
3
|
-
* a screenshot before mutation, eliminating overlay/flash artifacts
|
|
4
|
-
* during page navigation. Falls back to direct execution when the
|
|
5
|
-
* API is unavailable.
|
|
6
|
-
*
|
|
7
|
-
* Call this at the router level around your navigation action:
|
|
8
|
-
* ```tsx
|
|
9
|
-
* startLayoutTransition(() => navigate('/apis'));
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
declare function startLayoutTransition(update: () => void): void;
|
|
13
|
-
export { startLayoutTransition };
|
|
14
|
-
//# sourceMappingURL=view-transitions.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"view-transitions.d.ts","sourceRoot":"","sources":["../../src/lib/view-transitions.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,iBAAS,qBAAqB,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,IAAI,CASvD;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,121 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
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
|
-
}
|