@cratis/scene.blueprint.default 4.41.0 → 4.42.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/ComponentName.ts +9 -0
- package/defaultBlueprintComponents.ts +4 -1
- package/dist/cjs/ComponentName.js +3 -0
- package/dist/cjs/ComponentName.js.map +1 -1
- package/dist/cjs/defaultBlueprint.js +2 -0
- package/dist/cjs/defaultBlueprint.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponentMetadata.js +2 -0
- package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponents.js +8 -0
- package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
- package/dist/cjs/foundation/ActionButton.js.map +1 -1
- package/dist/cjs/foundation/ActionButtonControl.js +46 -0
- package/dist/cjs/foundation/ActionButtonControl.js.map +1 -0
- package/dist/cjs/foundation/DialogFrame.js +196 -0
- package/dist/cjs/foundation/DialogFrame.js.map +1 -0
- package/dist/cjs/foundation/FormScreenBody.js +13 -3
- package/dist/cjs/foundation/FormScreenBody.js.map +1 -1
- package/dist/cjs/foundation/Notice.js +51 -0
- package/dist/cjs/foundation/Notice.js.map +1 -0
- package/dist/cjs/foundation/formModel.js +1 -0
- package/dist/cjs/foundation/formModel.js.map +1 -1
- package/dist/cjs/foundation/foundationComponentMetadata.js +22 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
- package/dist/cjs/foundation/foundationDescriptors.js +89 -0
- package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
- package/dist/cjs/foundation/foundationSamples.js +29 -0
- package/dist/cjs/foundation/foundationSamples.js.map +1 -1
- package/dist/cjs/foundation/foundationStrings.js +3 -1
- package/dist/cjs/foundation/foundationStrings.js.map +1 -1
- package/dist/cjs/foundation/templates/dialogTemplates.js +254 -0
- package/dist/cjs/foundation/templates/dialogTemplates.js.map +1 -0
- package/dist/cjs/foundation/templates/index.js +18 -0
- package/dist/cjs/foundation/templates/index.js.map +1 -1
- package/dist/cjs/foundation/templates/stateScreenTemplates.js +252 -0
- package/dist/cjs/foundation/templates/stateScreenTemplates.js.map +1 -0
- package/dist/cjs/gallery/GalleryDialogPreview.js +62 -0
- package/dist/cjs/gallery/GalleryDialogPreview.js.map +1 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js +2 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/cjs/gallery/dialogTemplates.js +41 -36
- package/dist/cjs/gallery/dialogTemplates.js.map +1 -1
- package/dist/cjs/gallery/screens.js +4 -1
- package/dist/cjs/gallery/screens.js.map +1 -1
- package/dist/cjs/index.js +36 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/ComponentName.d.ts +3 -0
- package/dist/esm/ComponentName.d.ts.map +1 -1
- package/dist/esm/ComponentName.js +3 -0
- package/dist/esm/ComponentName.js.map +1 -1
- package/dist/esm/defaultBlueprint.js +2 -0
- package/dist/esm/defaultBlueprint.js.map +1 -1
- package/dist/esm/defaultBlueprintComponentMetadata.js +2 -0
- package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
- package/dist/esm/defaultBlueprintComponents.js +8 -0
- package/dist/esm/defaultBlueprintComponents.js.map +1 -1
- package/dist/esm/foundation/ActionButton.d.ts +1 -1
- package/dist/esm/foundation/ActionButton.d.ts.map +1 -1
- package/dist/esm/foundation/ActionButton.js.map +1 -1
- package/dist/esm/foundation/ActionButtonControl.d.ts +3 -0
- package/dist/esm/foundation/ActionButtonControl.d.ts.map +1 -0
- package/dist/esm/foundation/ActionButtonControl.js +44 -0
- package/dist/esm/foundation/ActionButtonControl.js.map +1 -0
- package/dist/esm/foundation/DialogFrame.d.ts +14 -0
- package/dist/esm/foundation/DialogFrame.d.ts.map +1 -0
- package/dist/esm/foundation/DialogFrame.js +190 -0
- package/dist/esm/foundation/DialogFrame.js.map +1 -0
- package/dist/esm/foundation/FormScreenBody.d.ts.map +1 -1
- package/dist/esm/foundation/FormScreenBody.js +13 -3
- package/dist/esm/foundation/FormScreenBody.js.map +1 -1
- package/dist/esm/foundation/Notice.d.ts +3 -0
- package/dist/esm/foundation/Notice.d.ts.map +1 -0
- package/dist/esm/foundation/Notice.js +49 -0
- package/dist/esm/foundation/Notice.js.map +1 -0
- package/dist/esm/foundation/formModel.d.ts +2 -1
- package/dist/esm/foundation/formModel.d.ts.map +1 -1
- package/dist/esm/foundation/formModel.js +1 -0
- package/dist/esm/foundation/formModel.js.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.js +22 -0
- package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -1
- package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -1
- package/dist/esm/foundation/foundationDescriptors.js +89 -0
- package/dist/esm/foundation/foundationDescriptors.js.map +1 -1
- package/dist/esm/foundation/foundationSamples.d.ts.map +1 -1
- package/dist/esm/foundation/foundationSamples.js +29 -0
- package/dist/esm/foundation/foundationSamples.js.map +1 -1
- package/dist/esm/foundation/foundationStrings.d.ts +2 -0
- package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
- package/dist/esm/foundation/foundationStrings.js +3 -1
- package/dist/esm/foundation/foundationStrings.js.map +1 -1
- package/dist/esm/foundation/index.d.ts +3 -0
- package/dist/esm/foundation/index.d.ts.map +1 -1
- package/dist/esm/foundation/index.js +3 -0
- package/dist/esm/foundation/index.js.map +1 -1
- package/dist/esm/foundation/templates/dialogTemplates.d.ts +20 -0
- package/dist/esm/foundation/templates/dialogTemplates.d.ts.map +1 -0
- package/dist/esm/foundation/templates/dialogTemplates.js +243 -0
- package/dist/esm/foundation/templates/dialogTemplates.js.map +1 -0
- package/dist/esm/foundation/templates/index.d.ts +2 -0
- package/dist/esm/foundation/templates/index.d.ts.map +1 -1
- package/dist/esm/foundation/templates/index.js +2 -0
- package/dist/esm/foundation/templates/index.js.map +1 -1
- package/dist/esm/foundation/templates/stateScreenTemplates.d.ts +8 -0
- package/dist/esm/foundation/templates/stateScreenTemplates.d.ts.map +1 -0
- package/dist/esm/foundation/templates/stateScreenTemplates.js +245 -0
- package/dist/esm/foundation/templates/stateScreenTemplates.js.map +1 -0
- package/dist/esm/gallery/FoundationDialogs.stories.d.ts +35 -0
- package/dist/esm/gallery/FoundationDialogs.stories.d.ts.map +1 -0
- package/dist/esm/gallery/FoundationDialogs.stories.js +38 -0
- package/dist/esm/gallery/FoundationDialogs.stories.js.map +1 -0
- package/dist/esm/gallery/GalleryDialogPreview.d.ts +17 -0
- package/dist/esm/gallery/GalleryDialogPreview.d.ts.map +1 -0
- package/dist/esm/gallery/GalleryDialogPreview.js +59 -0
- package/dist/esm/gallery/GalleryDialogPreview.js.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.js +2 -0
- package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -1
- package/dist/esm/gallery/dialogTemplates.d.ts.map +1 -1
- package/dist/esm/gallery/dialogTemplates.js +42 -37
- package/dist/esm/gallery/dialogTemplates.js.map +1 -1
- package/dist/esm/gallery/index.d.ts +1 -0
- package/dist/esm/gallery/index.d.ts.map +1 -1
- package/dist/esm/gallery/index.js +1 -0
- package/dist/esm/gallery/index.js.map +1 -1
- package/dist/esm/gallery/screens.d.ts.map +1 -1
- package/dist/esm/gallery/screens.js +4 -1
- package/dist/esm/gallery/screens.js.map +1 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/foundation/ActionButton.tsx +1 -1
- package/foundation/ActionButtonControl.tsx +37 -0
- package/foundation/DialogFrame.tsx +138 -0
- package/foundation/FormScreenBody.tsx +6 -3
- package/foundation/Notice.tsx +33 -0
- package/foundation/formModel.ts +1 -0
- package/foundation/foundationComponentMetadata.ts +3 -0
- package/foundation/foundationDescriptors.ts +41 -0
- package/foundation/foundationSamples.ts +3 -0
- package/foundation/foundationStrings.ts +2 -0
- package/foundation/index.ts +3 -0
- package/foundation/templates/dialogTemplates.ts +114 -0
- package/foundation/templates/index.ts +2 -0
- package/foundation/templates/stateScreenTemplates.ts +107 -0
- package/gallery/FoundationDialogs.stories.tsx +74 -0
- package/gallery/GalleryDialogPreview.tsx +68 -0
- package/gallery/dialogTemplates.ts +22 -17
- package/gallery/index.ts +1 -0
- package/gallery/screens.ts +3 -2
- package/package.json +8 -8
- package/sampleData/foundation-en.json +149 -0
- package/shell/layout.css +219 -0
- package/thumbnails/ConfirmDialog.svg +12 -0
- package/thumbnails/DetailDialog.svg +11 -0
- package/thumbnails/ErrorScreen.svg +11 -0
- package/thumbnails/FilterDialog.svg +16 -0
- package/thumbnails/ForbiddenScreen.svg +10 -0
- package/thumbnails/FormDialog.svg +12 -0
- package/thumbnails/LoginScreen.svg +12 -0
- package/thumbnails/LookupDialog.svg +13 -0
- package/thumbnails/NotFoundScreen.svg +9 -0
- package/thumbnails/QuickCreateDialog.svg +12 -0
- package/thumbnails/SideSheet.svg +13 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { SampleDataPack } from '@cratis/scene.model';
|
|
6
|
+
import { corePackage, mergePackageRegistries } from '@cratis/scene.react';
|
|
7
|
+
import { primeReactPackage } from '@cratis/scene.primereact';
|
|
8
|
+
import { defaultBlueprint } from '../defaultBlueprint';
|
|
9
|
+
import { ComponentState } from '../foundation';
|
|
10
|
+
import { GalleryDialogPreview } from './GalleryDialogPreview';
|
|
11
|
+
import { GalleryScreenPreview } from './GalleryScreenPreview';
|
|
12
|
+
import { TemplatePreviewState } from './TemplatePreviewState';
|
|
13
|
+
|
|
14
|
+
const registry = mergePackageRegistries([corePackage, primeReactPackage, defaultBlueprint]);
|
|
15
|
+
/** The foundation sample-data pack, fetched from where the package ships it (`sampleData/`), as a host's loader would. */
|
|
16
|
+
const packUrl = new URL('../sampleData/foundation-en.json', import.meta.url).href;
|
|
17
|
+
const loadPack = async () => ({ pack: await (await fetch(packUrl)).json() as SampleDataPack });
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The foundation dialogs and the auth and state screens (spec Part B 2.10 and 2.11) in each state, filled from the foundation sample-data pack: the data in the
|
|
21
|
+
* pack, an empty answer, and each of the standard states forced on the components that own them. A dialog opens in the box a host draws, which its frame takes on:
|
|
22
|
+
* focus handling, placement and its name.
|
|
23
|
+
*/
|
|
24
|
+
const meta = {
|
|
25
|
+
title: 'Blueprint/Foundation dialogs',
|
|
26
|
+
component: GalleryDialogPreview,
|
|
27
|
+
parameters: { layout: 'fullscreen' },
|
|
28
|
+
loaders: [loadPack],
|
|
29
|
+
render: (args, { loaded }) => <GalleryDialogPreview {...args} pack={loaded.pack as SampleDataPack} />,
|
|
30
|
+
args: { registry, dialogName: 'ConfirmDialog' },
|
|
31
|
+
tags: ['autodocs'],
|
|
32
|
+
} satisfies Meta<typeof GalleryDialogPreview>;
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
|
|
36
|
+
type Story = StoryObj<typeof meta>;
|
|
37
|
+
|
|
38
|
+
/** A destructive confirmation: the consequences listed, the confirming button naming what it does. */
|
|
39
|
+
export const Confirm: Story = {};
|
|
40
|
+
|
|
41
|
+
/** The short create form, six fields at most. */
|
|
42
|
+
export const QuickCreate: Story = { args: { dialogName: 'QuickCreateDialog' } };
|
|
43
|
+
|
|
44
|
+
/** The lookup with the pack's accounts. */
|
|
45
|
+
export const Lookup: Story = { args: { dialogName: 'LookupDialog' } };
|
|
46
|
+
|
|
47
|
+
/** The lookup when the query returns nothing: it says so in words. */
|
|
48
|
+
export const LookupEmpty: Story = { args: { dialogName: 'LookupDialog', state: TemplatePreviewState.Empty } };
|
|
49
|
+
|
|
50
|
+
/** The lookup while its query has not answered. */
|
|
51
|
+
export const LookupLoading: Story = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.Loading } } };
|
|
52
|
+
|
|
53
|
+
/** The lookup when its query failed: a message and a retry. */
|
|
54
|
+
export const LookupError: Story = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.Error, error: 'The server did not answer' } } };
|
|
55
|
+
|
|
56
|
+
/** The lookup for a user who may not see the accounts: what is missing, and none of the data. */
|
|
57
|
+
export const LookupNoPermission: Story = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.NoPermission, permissionSubject: 'the accounts' } } };
|
|
58
|
+
|
|
59
|
+
/** The lookup when part of it failed: the chrome stays, and the failed part is named. */
|
|
60
|
+
export const LookupPartial: Story = { args: { dialogName: 'LookupDialog', forceState: { state: ComponentState.Partial, failedRegions: ['Accounts'] } } };
|
|
61
|
+
|
|
62
|
+
/** A drawer from the side hosting a form. */
|
|
63
|
+
export const SideSheet: Story = { args: { dialogName: 'SideSheet' } };
|
|
64
|
+
|
|
65
|
+
/** The advanced filter builder; on a phone it fills the page. */
|
|
66
|
+
export const Filter: Story = { args: { dialogName: 'FilterDialog' } };
|
|
67
|
+
|
|
68
|
+
/** Every state screen, as a gallery screen: sign in, not found, forbidden and error. */
|
|
69
|
+
export const StateScreens: StoryObj<typeof GalleryScreenPreview> = {
|
|
70
|
+
loaders: [loadPack],
|
|
71
|
+
render: (args, { loaded }) => <GalleryScreenPreview {...args} registry={registry} pack={loaded.pack as SampleDataPack} />,
|
|
72
|
+
args: { screenName: 'LoginScreen' },
|
|
73
|
+
argTypes: { screenName: { control: 'select', options: ['LoginScreen', 'NotFoundScreen', 'ForbiddenScreen', 'ErrorScreen'] } },
|
|
74
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { DialogTemplate, SampleDataPack, Theme } from '@cratis/scene.model';
|
|
6
|
+
import { ComponentRegistry, SceneElementView } from '@cratis/scene.react';
|
|
7
|
+
import { LayoutConfigProvider, LayoutConfigState } from '../configuration';
|
|
8
|
+
import { previewComponents, previewTemplateComponent } from '../preview-host/PreviewTemplate';
|
|
9
|
+
import { LayoutThemeProvider, defaultBlueprintThemes } from '../themes';
|
|
10
|
+
import { externalComponent } from './elements';
|
|
11
|
+
import { ForcedComponentState, forceComponentState, galleryPreviewRegistry, queryResultsOf } from './GalleryScreenPreview';
|
|
12
|
+
import { galleryDialogTemplates } from './dialogTemplates';
|
|
13
|
+
import { galleryComponentCatalog, galleryPreviewProfile } from './previewProfile';
|
|
14
|
+
import { resolveElementComponentNames } from './resolveElementNames';
|
|
15
|
+
import { TemplatePreviewState } from './TemplatePreviewState';
|
|
16
|
+
|
|
17
|
+
/** One gallery dialog template by name, for a story or a host that opens a specific one. */
|
|
18
|
+
export const galleryDialogTemplate = (name: string): DialogTemplate | undefined => galleryDialogTemplates.find(template => template.name === name);
|
|
19
|
+
|
|
20
|
+
export interface GalleryDialogPreviewProps {
|
|
21
|
+
/** The name of the gallery dialog template to open. */
|
|
22
|
+
dialogName: string;
|
|
23
|
+
|
|
24
|
+
/** Configuration to start from. */
|
|
25
|
+
initialConfig?: Partial<LayoutConfigState>;
|
|
26
|
+
|
|
27
|
+
/** The themes the preview may switch between. Defaults to the two this blueprint ships. */
|
|
28
|
+
themes?: Theme[];
|
|
29
|
+
|
|
30
|
+
/** The component registry to render against. Defaults to `core` plus this blueprint's own components. */
|
|
31
|
+
registry?: ComponentRegistry;
|
|
32
|
+
|
|
33
|
+
/** The data state to show. Defaults to the seeded, populated records. */
|
|
34
|
+
state?: TemplatePreviewState;
|
|
35
|
+
|
|
36
|
+
/** The sample-data pack that stands in for the queries the template binds to. */
|
|
37
|
+
pack?: SampleDataPack;
|
|
38
|
+
|
|
39
|
+
/** A standard state (spec Part B 1.4) to force on every foundation component of the dialog that owns the five states. */
|
|
40
|
+
forceState?: ForcedComponentState;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Opens one gallery dialog template the way a host does: inside a `role="dialog" aria-modal="true"` element, with the template's content in the wrapper
|
|
45
|
+
* a screen's template gets. Nothing here is a preview-only path - the dialog is a real {@link DialogTemplate} rendered by the real `SceneElementView`,
|
|
46
|
+
* and the dialog's own frame gives the host element its focus handling, placement and labelling exactly as it does in an application.
|
|
47
|
+
*/
|
|
48
|
+
export function GalleryDialogPreview({ dialogName, initialConfig, themes = defaultBlueprintThemes, registry = galleryPreviewRegistry, state = TemplatePreviewState.Populated, pack, forceState }: GalleryDialogPreviewProps) {
|
|
49
|
+
const template = galleryDialogTemplate(dialogName);
|
|
50
|
+
if (!template) throw new Error(`The gallery has no dialog template named '${dialogName}'.`);
|
|
51
|
+
|
|
52
|
+
const element = useMemo(() => {
|
|
53
|
+
const composed = externalComponent(`dialog-${template.name}`, previewTemplateComponent, {}, template.content ?? {});
|
|
54
|
+
const resolved = resolveElementComponentNames(composed, galleryPreviewProfile, galleryComponentCatalog);
|
|
55
|
+
return forceState ? forceComponentState(resolved, forceState) : resolved;
|
|
56
|
+
}, [template, forceState]);
|
|
57
|
+
const full = useMemo(() => ({ ...registry, ...previewComponents }), [registry]);
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<LayoutConfigProvider initialConfig={initialConfig} storage={null}>
|
|
61
|
+
<LayoutThemeProvider themes={themes}>
|
|
62
|
+
<div role='dialog' aria-modal='true' aria-label={template.displayName ?? template.name} data-scene-dialog={template.name}>
|
|
63
|
+
<SceneElementView element={element} registry={full} resolveBinding={() => undefined} queryResults={queryResultsOf(pack, state)} />
|
|
64
|
+
</div>
|
|
65
|
+
</LayoutThemeProvider>
|
|
66
|
+
</LayoutConfigProvider>
|
|
67
|
+
);
|
|
68
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
4
|
import { DialogTemplate } from '@cratis/scene.model';
|
|
5
|
+
import { actionButton, closingDialog, dialogMetadata, foundationDialogTemplates } from '../foundation/templates/dialogTemplates';
|
|
5
6
|
import { TemplateSlotName } from './TemplateSlotName';
|
|
6
7
|
import { button, card, externalComponent, panel, text } from './elements';
|
|
7
8
|
import { field } from './widgets';
|
|
8
|
-
import { defaultBlueprintTemplateProvenance } from '../templateProvenance';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* The three dialog shapes an application repeats: confirm something destructive, capture a short form, and
|
|
@@ -17,23 +17,28 @@ import { defaultBlueprintTemplateProvenance } from '../templateProvenance';
|
|
|
17
17
|
* happens to be, so there is no parent slot for it to name.
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Confirm: one question, two answers, and enough context to answer it - the consequences listed, and the confirming button naming what it does
|
|
22
|
+
* (`Archive product`, never `OK`). A destructive confirmation takes the danger tone: the heading and border are drawn in the danger colors and the
|
|
23
|
+
* confirming button is the danger button. The components blueprint has a `ConfirmDialog` of its own for a command; a reference names the blueprint
|
|
24
|
+
* (`resolveTemplateReference`), so the two never collide.
|
|
25
|
+
*/
|
|
21
26
|
export const confirmDialogTemplate: DialogTemplate = {
|
|
22
27
|
name: 'ConfirmDialog',
|
|
23
28
|
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],
|
|
24
29
|
content: {
|
|
25
|
-
[TemplateSlotName.Header]: [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
],
|
|
30
|
+
[TemplateSlotName.Header]: [externalComponent('confirm-frame', 'dialogFrame', {
|
|
31
|
+
title: 'Archive this product?', message: 'Bamboo Watch will stop appearing in the catalog.', tone: 'danger',
|
|
32
|
+
consequences: ['Existing orders keep it', 'It can be restored from the archive'],
|
|
33
|
+
})],
|
|
34
|
+
[TemplateSlotName.Body]: [],
|
|
30
35
|
[TemplateSlotName.Actions]: [
|
|
31
|
-
panel('confirm-actions', [
|
|
36
|
+
panel('confirm-actions', [closingDialog(actionButton('confirm-no', { label: 'Keep it', emphasis: 'secondary' })), actionButton('confirm-yes', { label: 'Archive product', emphasis: 'danger' })]),
|
|
32
37
|
],
|
|
33
38
|
},
|
|
34
39
|
displayName: 'Confirmation dialog',
|
|
35
40
|
description: 'One question with the consequence spelled out, and a way back.',
|
|
36
|
-
metadata:
|
|
41
|
+
metadata: dialogMetadata('ConfirmDialog'),
|
|
37
42
|
};
|
|
38
43
|
|
|
39
44
|
/** Form: a short capture that does not deserve a page of its own. */
|
|
@@ -41,19 +46,19 @@ export const formDialogTemplate: DialogTemplate = {
|
|
|
41
46
|
name: 'FormDialog',
|
|
42
47
|
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],
|
|
43
48
|
content: {
|
|
44
|
-
[TemplateSlotName.Header]: [
|
|
49
|
+
[TemplateSlotName.Header]: [externalComponent('form-dialog-frame', 'dialogFrame', { title: 'Invite someone' })],
|
|
45
50
|
[TemplateSlotName.Body]: [
|
|
46
51
|
field('form-dialog-email', 'Email', 'inputText', { placeholder: 'them@contoso.com' }),
|
|
47
52
|
field('form-dialog-role', 'Role', 'dropdown', { options: ['Viewer', 'Editor', 'Administrator'] }),
|
|
48
53
|
field('form-dialog-message', 'Message', 'inputTextarea', { rows: 3 }),
|
|
49
54
|
],
|
|
50
55
|
[TemplateSlotName.Actions]: [
|
|
51
|
-
panel('form-dialog-actions', [button('form-dialog-
|
|
56
|
+
panel('form-dialog-actions', [closingDialog(button('form-dialog-cancel', 'Cancel', { severity: 'secondary' })), button('form-dialog-send', 'Send invitation', { severity: 'primary' })]),
|
|
52
57
|
],
|
|
53
58
|
},
|
|
54
59
|
displayName: 'Form dialog',
|
|
55
60
|
description: 'A handful of fields captured without leaving the page underneath.',
|
|
56
|
-
metadata:
|
|
61
|
+
metadata: dialogMetadata('FormDialog', true),
|
|
57
62
|
};
|
|
58
63
|
|
|
59
64
|
/** Detail: a record shown over the list it came from. */
|
|
@@ -61,7 +66,7 @@ export const detailDialogTemplate: DialogTemplate = {
|
|
|
61
66
|
name: 'DetailDialog',
|
|
62
67
|
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }, { name: TemplateSlotName.Actions }],
|
|
63
68
|
content: {
|
|
64
|
-
[TemplateSlotName.Header]: [
|
|
69
|
+
[TemplateSlotName.Header]: [externalComponent('detail-dialog-frame', 'dialogFrame', { title: 'ORD-4192' })],
|
|
65
70
|
[TemplateSlotName.Body]: [
|
|
66
71
|
card('detail-dialog-summary', [
|
|
67
72
|
text('detail-dialog-customer', 'Northwind Traders'),
|
|
@@ -71,13 +76,13 @@ export const detailDialogTemplate: DialogTemplate = {
|
|
|
71
76
|
],
|
|
72
77
|
[TemplateSlotName.SidePanel]: [externalComponent('detail-dialog-timeline', 'timeline', { align: 'left' })],
|
|
73
78
|
[TemplateSlotName.Actions]: [
|
|
74
|
-
panel('detail-dialog-actions', [button('detail-dialog-
|
|
79
|
+
panel('detail-dialog-actions', [closingDialog(button('detail-dialog-close', 'Close', { severity: 'secondary' })), button('detail-dialog-open', 'Open full record', { severity: 'primary', targetScreen: 'DetailView' })]),
|
|
75
80
|
],
|
|
76
81
|
},
|
|
77
82
|
displayName: 'Detail dialog',
|
|
78
83
|
description: 'A record over the list it came from, with a route to the full page.',
|
|
79
|
-
metadata:
|
|
84
|
+
metadata: dialogMetadata('DetailDialog', true),
|
|
80
85
|
};
|
|
81
86
|
|
|
82
|
-
/** The dialog templates this blueprint provides. */
|
|
83
|
-
export const galleryDialogTemplates: DialogTemplate[] = [confirmDialogTemplate, formDialogTemplate, detailDialogTemplate];
|
|
87
|
+
/** The dialog templates this blueprint provides: the three the gallery began with, and the foundation's quick create, lookup, side sheet and filter dialogs. */
|
|
88
|
+
export const galleryDialogTemplates: DialogTemplate[] = [confirmDialogTemplate, formDialogTemplate, detailDialogTemplate, ...foundationDialogTemplates];
|
package/gallery/index.ts
CHANGED
|
@@ -20,5 +20,6 @@ export * from './componentNames';
|
|
|
20
20
|
export * from './previewProfile';
|
|
21
21
|
export * from './resolveElementNames';
|
|
22
22
|
export * from './GalleryScreenPreview';
|
|
23
|
+
export * from './GalleryDialogPreview';
|
|
23
24
|
export * from './TemplatePreviewState';
|
|
24
25
|
export * from './applyTemplatePreviewState';
|
package/gallery/screens.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
3
|
|
|
4
4
|
import { Layout, Screen, ScreenTemplate } from '@cratis/scene.model';
|
|
5
|
-
import { foundationScreenTemplates } from '../foundation/templates';
|
|
5
|
+
import { foundationScreenTemplates, stateScreenTemplates } from '../foundation/templates';
|
|
6
6
|
import { LayoutName, appShellLayout, fullPageLayout } from '../layouts';
|
|
7
7
|
import { BreadcrumbEntry, applicationChrome, fullPageChrome } from './applicationChrome';
|
|
8
8
|
import { nestScreenTemplates, templateContentInLayout } from './composeScreen';
|
|
@@ -22,6 +22,7 @@ import { workspaceTemplates } from './workspaceTemplates';
|
|
|
22
22
|
*/
|
|
23
23
|
export const galleryScreenTemplates: ScreenTemplate[] = [
|
|
24
24
|
...foundationScreenTemplates,
|
|
25
|
+
...stateScreenTemplates,
|
|
25
26
|
...workspaceTemplates,
|
|
26
27
|
...supportTemplates,
|
|
27
28
|
...authTemplates,
|
|
@@ -30,7 +31,7 @@ export const galleryScreenTemplates: ScreenTemplate[] = [
|
|
|
30
31
|
];
|
|
31
32
|
|
|
32
33
|
/** Which layout each template renders inside - the application shell unless it is one of the chrome-less screens. */
|
|
33
|
-
const fullPageTemplateNames = new Set([...authTemplates, ...statusTemplates].map(template => template.name));
|
|
34
|
+
const fullPageTemplateNames = new Set([...authTemplates, ...statusTemplates, ...stateScreenTemplates].map(template => template.name));
|
|
34
35
|
|
|
35
36
|
/** The trail shown above each application-shell screen. */
|
|
36
37
|
const breadcrumbs: Record<string, BreadcrumbEntry[]> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cratis/scene.blueprint.default",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.42.0",
|
|
4
4
|
"description": "The default blueprint: application shell layouts, the screen and dialog templates that go inside them, the components that fill their slots, and two themes.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cratis",
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
"build-storybook": "storybook build"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@cratis/scene.engine": "4.
|
|
61
|
-
"@cratis/scene.model": "4.
|
|
62
|
-
"@cratis/scene.react": "4.
|
|
60
|
+
"@cratis/scene.engine": "4.42.0",
|
|
61
|
+
"@cratis/scene.model": "4.42.0",
|
|
62
|
+
"@cratis/scene.react": "4.42.0"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@cratis/scene.engine": "4.
|
|
66
|
-
"@cratis/scene.model": "4.
|
|
67
|
-
"@cratis/scene.primereact": "4.
|
|
68
|
-
"@cratis/scene.react": "4.
|
|
65
|
+
"@cratis/scene.engine": "4.42.0",
|
|
66
|
+
"@cratis/scene.model": "4.42.0",
|
|
67
|
+
"@cratis/scene.primereact": "4.42.0",
|
|
68
|
+
"@cratis/scene.react": "4.42.0",
|
|
69
69
|
"@primereact/core": "11.2.0",
|
|
70
70
|
"@primereact/headless": "11.2.0",
|
|
71
71
|
"@primeuix/themes": "^3.0.1",
|
|
@@ -507,6 +507,155 @@
|
|
|
507
507
|
"label": "Review"
|
|
508
508
|
}
|
|
509
509
|
]
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
"shape": "QuickCreateSections",
|
|
513
|
+
"rows": [
|
|
514
|
+
{
|
|
515
|
+
"id": "quick",
|
|
516
|
+
"title": "New contact",
|
|
517
|
+
"columns": 1,
|
|
518
|
+
"fields": [
|
|
519
|
+
{
|
|
520
|
+
"name": "name",
|
|
521
|
+
"label": "Name",
|
|
522
|
+
"required": true
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"name": "email",
|
|
526
|
+
"label": "Email",
|
|
527
|
+
"required": true
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"name": "company",
|
|
531
|
+
"label": "Company",
|
|
532
|
+
"type": "select",
|
|
533
|
+
"options": [
|
|
534
|
+
"Northgate Ltd",
|
|
535
|
+
"Harbour & Sons",
|
|
536
|
+
"Fjord Supply"
|
|
537
|
+
]
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"name": "phone",
|
|
541
|
+
"label": "Phone"
|
|
542
|
+
}
|
|
543
|
+
]
|
|
544
|
+
}
|
|
545
|
+
]
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"shape": "QuickCreateValues",
|
|
549
|
+
"rows": [
|
|
550
|
+
{}
|
|
551
|
+
]
|
|
552
|
+
},
|
|
553
|
+
{
|
|
554
|
+
"shape": "LookupColumns",
|
|
555
|
+
"rows": [
|
|
556
|
+
{
|
|
557
|
+
"field": "name",
|
|
558
|
+
"header": "Account"
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
"field": "owner",
|
|
562
|
+
"header": "Owner"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"field": "city",
|
|
566
|
+
"header": "City"
|
|
567
|
+
}
|
|
568
|
+
]
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"shape": "LookupRows",
|
|
572
|
+
"rows": [
|
|
573
|
+
{
|
|
574
|
+
"id": "a1",
|
|
575
|
+
"name": "Northgate Ltd",
|
|
576
|
+
"owner": "Ada Lovelace",
|
|
577
|
+
"city": "Oslo"
|
|
578
|
+
},
|
|
579
|
+
{
|
|
580
|
+
"id": "a2",
|
|
581
|
+
"name": "Harbour & Sons",
|
|
582
|
+
"owner": "Grace Hopper",
|
|
583
|
+
"city": "Bergen"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"id": "a3",
|
|
587
|
+
"name": "Fjord Supply",
|
|
588
|
+
"owner": "Linus Torvalds",
|
|
589
|
+
"city": "Tromsø"
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
"id": "a4",
|
|
593
|
+
"name": "Globex",
|
|
594
|
+
"owner": "Ada Lovelace",
|
|
595
|
+
"city": "Stavanger"
|
|
596
|
+
}
|
|
597
|
+
]
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
"shape": "SupportReference",
|
|
601
|
+
"rows": [
|
|
602
|
+
{
|
|
603
|
+
"id": "ERR-7F3A-92C1"
|
|
604
|
+
}
|
|
605
|
+
]
|
|
606
|
+
},
|
|
607
|
+
{
|
|
608
|
+
"shape": "SignInSections",
|
|
609
|
+
"rows": [
|
|
610
|
+
{
|
|
611
|
+
"id": "credentials",
|
|
612
|
+
"title": "Sign in",
|
|
613
|
+
"columns": 1,
|
|
614
|
+
"fields": [
|
|
615
|
+
{
|
|
616
|
+
"name": "email",
|
|
617
|
+
"label": "Email",
|
|
618
|
+
"required": true
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
"name": "password",
|
|
622
|
+
"label": "Password",
|
|
623
|
+
"type": "password",
|
|
624
|
+
"required": true
|
|
625
|
+
}
|
|
626
|
+
]
|
|
627
|
+
}
|
|
628
|
+
]
|
|
629
|
+
},
|
|
630
|
+
{
|
|
631
|
+
"shape": "SignInError",
|
|
632
|
+
"rows": [
|
|
633
|
+
{
|
|
634
|
+
"message": "The email or password is not right."
|
|
635
|
+
}
|
|
636
|
+
]
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"shape": "SignInValues",
|
|
640
|
+
"rows": [
|
|
641
|
+
{}
|
|
642
|
+
]
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
"shape": "DealFilter",
|
|
646
|
+
"rows": [
|
|
647
|
+
{
|
|
648
|
+
"operator": "and",
|
|
649
|
+
"conditions": [
|
|
650
|
+
{
|
|
651
|
+
"field": "status",
|
|
652
|
+
"operator": "is",
|
|
653
|
+
"value": "Open"
|
|
654
|
+
}
|
|
655
|
+
],
|
|
656
|
+
"groups": []
|
|
657
|
+
}
|
|
658
|
+
]
|
|
510
659
|
}
|
|
511
660
|
]
|
|
512
661
|
}
|