@cratis/scene.blueprint.default 4.36.0 → 4.37.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 +1 -0
- package/dist/cjs/defaultBlueprint.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponentMetadata.js +1 -0
- package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponents.js +7 -1
- package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
- package/dist/cjs/foundation/ApprovalChainStepper.js +130 -0
- package/dist/cjs/foundation/ApprovalChainStepper.js.map +1 -0
- package/dist/cjs/foundation/OrgTree.js +188 -0
- package/dist/cjs/foundation/OrgTree.js.map +1 -0
- package/dist/cjs/foundation/PermissionMatrix.js +136 -0
- package/dist/cjs/foundation/PermissionMatrix.js.map +1 -0
- package/dist/cjs/foundation/approvalModel.js +87 -0
- package/dist/cjs/foundation/approvalModel.js.map +1 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js +21 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
- package/dist/cjs/foundation/foundationDescriptors.js +118 -0
- package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
- package/dist/cjs/foundation/foundationSamples.js +116 -0
- package/dist/cjs/foundation/foundationSamples.js.map +1 -1
- package/dist/cjs/foundation/foundationStrings.js +12 -1
- package/dist/cjs/foundation/foundationStrings.js.map +1 -1
- package/dist/cjs/foundation/orgModel.js +106 -0
- package/dist/cjs/foundation/orgModel.js.map +1 -0
- package/dist/cjs/foundation/permissionModel.js +84 -0
- package/dist/cjs/foundation/permissionModel.js.map +1 -0
- package/dist/cjs/index.js +26 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/ComponentName.d.ts +4 -1
- 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 +1 -0
- package/dist/esm/defaultBlueprint.js.map +1 -1
- package/dist/esm/defaultBlueprintComponentMetadata.js +1 -0
- package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
- package/dist/esm/defaultBlueprintComponents.js +7 -1
- package/dist/esm/defaultBlueprintComponents.js.map +1 -1
- package/dist/esm/foundation/ApprovalChainStepper.d.ts +3 -0
- package/dist/esm/foundation/ApprovalChainStepper.d.ts.map +1 -0
- package/dist/esm/foundation/ApprovalChainStepper.js +128 -0
- package/dist/esm/foundation/ApprovalChainStepper.js.map +1 -0
- package/dist/esm/foundation/Foundation.stories.d.ts +8 -0
- package/dist/esm/foundation/Foundation.stories.d.ts.map +1 -1
- package/dist/esm/foundation/Foundation.stories.js +8 -0
- package/dist/esm/foundation/Foundation.stories.js.map +1 -1
- package/dist/esm/foundation/OrgTree.d.ts +3 -0
- package/dist/esm/foundation/OrgTree.d.ts.map +1 -0
- package/dist/esm/foundation/OrgTree.js +186 -0
- package/dist/esm/foundation/OrgTree.js.map +1 -0
- package/dist/esm/foundation/PermissionMatrix.d.ts +3 -0
- package/dist/esm/foundation/PermissionMatrix.d.ts.map +1 -0
- package/dist/esm/foundation/PermissionMatrix.js +134 -0
- package/dist/esm/foundation/PermissionMatrix.js.map +1 -0
- package/dist/esm/foundation/approvalModel.d.ts +27 -0
- package/dist/esm/foundation/approvalModel.d.ts.map +1 -0
- package/dist/esm/foundation/approvalModel.js +81 -0
- package/dist/esm/foundation/approvalModel.js.map +1 -0
- package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.js +21 -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 +118 -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 +116 -0
- package/dist/esm/foundation/foundationSamples.js.map +1 -1
- package/dist/esm/foundation/foundationStrings.d.ts +11 -0
- package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
- package/dist/esm/foundation/foundationStrings.js +12 -1
- package/dist/esm/foundation/foundationStrings.js.map +1 -1
- package/dist/esm/foundation/index.d.ts +6 -0
- package/dist/esm/foundation/index.d.ts.map +1 -1
- package/dist/esm/foundation/index.js +6 -0
- package/dist/esm/foundation/index.js.map +1 -1
- package/dist/esm/foundation/orgModel.d.ts +20 -0
- package/dist/esm/foundation/orgModel.d.ts.map +1 -0
- package/dist/esm/foundation/orgModel.js +99 -0
- package/dist/esm/foundation/orgModel.js.map +1 -0
- package/dist/esm/foundation/permissionModel.d.ts +24 -0
- package/dist/esm/foundation/permissionModel.d.ts.map +1 -0
- package/dist/esm/foundation/permissionModel.js +77 -0
- package/dist/esm/foundation/permissionModel.js.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/foundation/ApprovalChainStepper.tsx +66 -0
- package/foundation/Foundation.stories.tsx +8 -0
- package/foundation/OrgTree.tsx +101 -0
- package/foundation/PermissionMatrix.tsx +82 -0
- package/foundation/approvalModel.ts +88 -0
- package/foundation/foundationComponentMetadata.ts +3 -0
- package/foundation/foundationDescriptors.ts +74 -0
- package/foundation/foundationSamples.ts +30 -0
- package/foundation/foundationStrings.ts +11 -0
- package/foundation/index.ts +6 -0
- package/foundation/orgModel.ts +85 -0
- package/foundation/permissionModel.ts +85 -0
- package/package.json +8 -8
- package/shell/layout.css +184 -0
package/ComponentName.ts
CHANGED
|
@@ -93,4 +93,13 @@ export enum ComponentName {
|
|
|
93
93
|
|
|
94
94
|
/** A drop zone and file picker with type and size checks. */
|
|
95
95
|
FileUploader = 'fileUploader',
|
|
96
|
+
|
|
97
|
+
/** The steps a request goes through, who decides each, and where it stands. */
|
|
98
|
+
ApprovalChainStepper = 'approvalChainStepper',
|
|
99
|
+
|
|
100
|
+
/** An organization as an expandable tree. */
|
|
101
|
+
OrgTree = 'orgTree',
|
|
102
|
+
|
|
103
|
+
/** Roles across, permissions down, a checkbox where they meet. */
|
|
104
|
+
PermissionMatrix = 'permissionMatrix',
|
|
96
105
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { ComponentRegistry, componentRegistryKey } from '@cratis/scene.react';
|
|
5
5
|
import { ComponentName } from './ComponentName';
|
|
6
6
|
import { defaultBlueprintName } from './packageName';
|
|
7
|
-
import { ActivityFeed, AvatarStack, ChartWrapper, ChecklistSection, ColumnChooser, FileUploader, EmptyState, FilterBuilder, SavedViewsMenu, StatCard, StatusChip, TrendChip } from './foundation';
|
|
7
|
+
import { ActivityFeed, ApprovalChainStepper, AvatarStack, ChartWrapper, ChecklistSection, ColumnChooser, FileUploader, EmptyState, FilterBuilder, OrgTree, PermissionMatrix, SavedViewsMenu, StatCard, StatusChip, TrendChip } from './foundation';
|
|
8
8
|
import {
|
|
9
9
|
AppShell,
|
|
10
10
|
Breadcrumb,
|
|
@@ -61,4 +61,7 @@ export const defaultBlueprintComponents: ComponentRegistry = {
|
|
|
61
61
|
[componentRegistryKey(defaultBlueprintName, ComponentName.ActivityFeed)]: ActivityFeed,
|
|
62
62
|
[componentRegistryKey(defaultBlueprintName, ComponentName.AvatarStack)]: AvatarStack,
|
|
63
63
|
[componentRegistryKey(defaultBlueprintName, ComponentName.FileUploader)]: FileUploader,
|
|
64
|
+
[componentRegistryKey(defaultBlueprintName, ComponentName.ApprovalChainStepper)]: ApprovalChainStepper,
|
|
65
|
+
[componentRegistryKey(defaultBlueprintName, ComponentName.OrgTree)]: OrgTree,
|
|
66
|
+
[componentRegistryKey(defaultBlueprintName, ComponentName.PermissionMatrix)]: PermissionMatrix,
|
|
64
67
|
};
|
|
@@ -38,6 +38,9 @@
|
|
|
38
38
|
/** What happened to a record, grouped by day. */ ComponentName["ActivityFeed"] = "activityFeed";
|
|
39
39
|
/** Overlapping avatars for the people on a record. */ ComponentName["AvatarStack"] = "avatarStack";
|
|
40
40
|
/** A drop zone and file picker with type and size checks. */ ComponentName["FileUploader"] = "fileUploader";
|
|
41
|
+
/** The steps a request goes through, who decides each, and where it stands. */ ComponentName["ApprovalChainStepper"] = "approvalChainStepper";
|
|
42
|
+
/** An organization as an expandable tree. */ ComponentName["OrgTree"] = "orgTree";
|
|
43
|
+
/** Roles across, permissions down, a checkbox where they meet. */ ComponentName["PermissionMatrix"] = "permissionMatrix";
|
|
41
44
|
return ComponentName;
|
|
42
45
|
}({});
|
|
43
46
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComponentName.js","sources":["../../ComponentName.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * The bare names this package declares components under.\n *\n * A page template writes a bare name and `resolveComponentName` decides which active package wins it, so\n * these names are public API: renaming one breaks every template that referenced it, in this package and\n * in anyone else's. Keeping them in one enum means the manifest, the registry and every template\n * reference the same symbol, and the specs can prove all three agree rather than hoping they do.\n */\nexport enum ComponentName {\n /** The application shell - topbar, sidebar, breadcrumb, content, footer and an optional right panel. */\n AppShell = 'appShell',\n\n /** The chrome-less shell - content, an optional branding aside, and the configurator. */\n FullPageShell = 'fullPageShell',\n\n /** The fixed strip across the top of the application shell. */\n Topbar = 'topbar',\n\n /** The sidebar's own chrome, inside the shell-positioned panel. */\n Sidebar = 'sidebar',\n\n /** A navigation list. */\n Menu = 'menu',\n\n /** One entry in a navigation list, optionally with a submenu. */\n MenuItem = 'menuItem',\n\n /** The trail above the content. */\n Breadcrumb = 'breadcrumb',\n\n /** The strip below the content. */\n Footer = 'footer',\n\n /** The inspector panel down the right-hand edge. */\n RightPanel = 'rightPanel',\n\n /** The floating configurator: color scheme, layout mode, menu theme and theme. */\n ConfigPanel = 'configPanel',\n\n /** A screen's title, subtitle and actions. */\n PageHeader = 'pageHeader',\n\n /** The scrim behind a floating sidebar, which also closes it. */\n Mask = 'mask',\n\n /** The brand mark. */\n Logo = 'logo',\n\n /** The signed-in user's avatar and menu. */\n UserMenu = 'userMenu',\n\n /** Switches between the themes a host offers. */\n ThemeSwitcher = 'themeSwitcher',\n\n /** Switches between the layout modes. */\n LayoutModeSwitcher = 'layoutModeSwitcher',\n\n /** An icon, a headline, a hint and one primary action: what a region says when it has nothing to show. */\n EmptyState = 'emptyState',\n\n /** One key figure with its label, trend and comparison period. */\n StatCard = 'statCard',\n\n /** A change drawn as a direction, a magnitude and whether it is good. */\n TrendChip = 'trendChip',\n\n /** A status as a semantic color, an icon and its text. */\n StatusChip = 'statusChip',\n\n /** One chart - line, bar, stacked, donut or funnel - with its legend and a table of the same data. */\n ChartWrapper = 'chartWrapper',\n\n /** Conditions on fields, joined by AND or OR in nested groups. */\n FilterBuilder = 'filterBuilder',\n\n /** Which columns a table shows, and in what order. */\n ColumnChooser = 'columnChooser',\n\n /** A list's saved views as a menu button. */\n SavedViewsMenu = 'savedViewsMenu',\n\n /** Sections of tasks with owner, due date and progress. */\n ChecklistSection = 'checklistSection',\n\n /** What happened to a record, grouped by day. */\n ActivityFeed = 'activityFeed',\n\n /** Overlapping avatars for the people on a record. */\n AvatarStack = 'avatarStack',\n\n /** A drop zone and file picker with type and size checks. */\n FileUploader = 'fileUploader',\n}\n"],"names":["ComponentName"],"mappings":";;AAAA;AACA;AAEA;;;;;;;IAQO,IAAKA,aAAAA,iBAAAA,SAAAA,aAAAA,EAAAA;6GAC8F,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;8FAGf,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;oEAG1B,aAAA,CAAA,QAAA,CAAA,GAAA,QAAA;wEAGI,aAAA,CAAA,SAAA,CAAA,GAAA,SAAA;8BAG1C,aAAA,CAAA,MAAA,CAAA,GAAA,MAAA;sEAGwC,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;wCAG9B,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;wCAGA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAA;yDAGiB,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;uFAG8B,aAAA,CAAA,aAAA,CAAA,GAAA,aAAA;mDAGpC,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;sEAGmB,aAAA,CAAA,MAAA,CAAA,GAAA,MAAA;2BAG3C,aAAA,CAAA,MAAA,CAAA,GAAA,MAAA;iDAGsB,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;sDAGK,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;8CAGR,aAAA,CAAA,oBAAA,CAAA,GAAA,oBAAA;+GAGiE,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;uEAGxC,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;8EAGO,aAAA,CAAA,WAAA,CAAA,GAAA,WAAA;+DAGf,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;2GAG4C,aAAA,CAAA,cAAA,CAAA,GAAA,cAAA;uEAGpC,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;2DAGZ,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;kDAGT,aAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;gEAGc,aAAA,CAAA,kBAAA,CAAA,GAAA,kBAAA;sDAGV,aAAA,CAAA,cAAA,CAAA,GAAA,cAAA;2DAGK,aAAA,CAAA,aAAA,CAAA,GAAA,aAAA;kEAGO,aAAA,CAAA,cAAA,CAAA,GAAA,cAAA;
|
|
1
|
+
{"version":3,"file":"ComponentName.js","sources":["../../ComponentName.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/**\n * The bare names this package declares components under.\n *\n * A page template writes a bare name and `resolveComponentName` decides which active package wins it, so\n * these names are public API: renaming one breaks every template that referenced it, in this package and\n * in anyone else's. Keeping them in one enum means the manifest, the registry and every template\n * reference the same symbol, and the specs can prove all three agree rather than hoping they do.\n */\nexport enum ComponentName {\n /** The application shell - topbar, sidebar, breadcrumb, content, footer and an optional right panel. */\n AppShell = 'appShell',\n\n /** The chrome-less shell - content, an optional branding aside, and the configurator. */\n FullPageShell = 'fullPageShell',\n\n /** The fixed strip across the top of the application shell. */\n Topbar = 'topbar',\n\n /** The sidebar's own chrome, inside the shell-positioned panel. */\n Sidebar = 'sidebar',\n\n /** A navigation list. */\n Menu = 'menu',\n\n /** One entry in a navigation list, optionally with a submenu. */\n MenuItem = 'menuItem',\n\n /** The trail above the content. */\n Breadcrumb = 'breadcrumb',\n\n /** The strip below the content. */\n Footer = 'footer',\n\n /** The inspector panel down the right-hand edge. */\n RightPanel = 'rightPanel',\n\n /** The floating configurator: color scheme, layout mode, menu theme and theme. */\n ConfigPanel = 'configPanel',\n\n /** A screen's title, subtitle and actions. */\n PageHeader = 'pageHeader',\n\n /** The scrim behind a floating sidebar, which also closes it. */\n Mask = 'mask',\n\n /** The brand mark. */\n Logo = 'logo',\n\n /** The signed-in user's avatar and menu. */\n UserMenu = 'userMenu',\n\n /** Switches between the themes a host offers. */\n ThemeSwitcher = 'themeSwitcher',\n\n /** Switches between the layout modes. */\n LayoutModeSwitcher = 'layoutModeSwitcher',\n\n /** An icon, a headline, a hint and one primary action: what a region says when it has nothing to show. */\n EmptyState = 'emptyState',\n\n /** One key figure with its label, trend and comparison period. */\n StatCard = 'statCard',\n\n /** A change drawn as a direction, a magnitude and whether it is good. */\n TrendChip = 'trendChip',\n\n /** A status as a semantic color, an icon and its text. */\n StatusChip = 'statusChip',\n\n /** One chart - line, bar, stacked, donut or funnel - with its legend and a table of the same data. */\n ChartWrapper = 'chartWrapper',\n\n /** Conditions on fields, joined by AND or OR in nested groups. */\n FilterBuilder = 'filterBuilder',\n\n /** Which columns a table shows, and in what order. */\n ColumnChooser = 'columnChooser',\n\n /** A list's saved views as a menu button. */\n SavedViewsMenu = 'savedViewsMenu',\n\n /** Sections of tasks with owner, due date and progress. */\n ChecklistSection = 'checklistSection',\n\n /** What happened to a record, grouped by day. */\n ActivityFeed = 'activityFeed',\n\n /** Overlapping avatars for the people on a record. */\n AvatarStack = 'avatarStack',\n\n /** A drop zone and file picker with type and size checks. */\n FileUploader = 'fileUploader',\n\n /** The steps a request goes through, who decides each, and where it stands. */\n ApprovalChainStepper = 'approvalChainStepper',\n\n /** An organization as an expandable tree. */\n OrgTree = 'orgTree',\n\n /** Roles across, permissions down, a checkbox where they meet. */\n PermissionMatrix = 'permissionMatrix',\n}\n"],"names":["ComponentName"],"mappings":";;AAAA;AACA;AAEA;;;;;;;IAQO,IAAKA,aAAAA,iBAAAA,SAAAA,aAAAA,EAAAA;6GAC8F,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;8FAGf,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;oEAG1B,aAAA,CAAA,QAAA,CAAA,GAAA,QAAA;wEAGI,aAAA,CAAA,SAAA,CAAA,GAAA,SAAA;8BAG1C,aAAA,CAAA,MAAA,CAAA,GAAA,MAAA;sEAGwC,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;wCAG9B,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;wCAGA,aAAA,CAAA,QAAA,CAAA,GAAA,QAAA;yDAGiB,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;uFAG8B,aAAA,CAAA,aAAA,CAAA,GAAA,aAAA;mDAGpC,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;sEAGmB,aAAA,CAAA,MAAA,CAAA,GAAA,MAAA;2BAG3C,aAAA,CAAA,MAAA,CAAA,GAAA,MAAA;iDAGsB,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;sDAGK,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;8CAGR,aAAA,CAAA,oBAAA,CAAA,GAAA,oBAAA;+GAGiE,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;uEAGxC,aAAA,CAAA,UAAA,CAAA,GAAA,UAAA;8EAGO,aAAA,CAAA,WAAA,CAAA,GAAA,WAAA;+DAGf,aAAA,CAAA,YAAA,CAAA,GAAA,YAAA;2GAG4C,aAAA,CAAA,cAAA,CAAA,GAAA,cAAA;uEAGpC,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;2DAGZ,aAAA,CAAA,eAAA,CAAA,GAAA,eAAA;kDAGT,aAAA,CAAA,gBAAA,CAAA,GAAA,gBAAA;gEAGc,aAAA,CAAA,kBAAA,CAAA,GAAA,kBAAA;sDAGV,aAAA,CAAA,cAAA,CAAA,GAAA,cAAA;2DAGK,aAAA,CAAA,aAAA,CAAA,GAAA,aAAA;kEAGO,aAAA,CAAA,cAAA,CAAA,GAAA,cAAA;oFAGkB,aAAA,CAAA,sBAAA,CAAA,GAAA,sBAAA;kDAGlC,aAAA,CAAA,SAAA,CAAA,GAAA,SAAA;uEAGqB,aAAA,CAAA,kBAAA,CAAA,GAAA,kBAAA;AA3FxDA,IAAAA,OAAAA,aAAAA;AA6FX,CAAA,CAAA,EAAA;;"}
|
|
@@ -8,6 +8,7 @@ require('./foundation/ComponentState.js');
|
|
|
8
8
|
require('react/jsx-runtime');
|
|
9
9
|
require('react');
|
|
10
10
|
require('./foundation/ActivityFeed.js');
|
|
11
|
+
require('./foundation/ApprovalChainStepper.js');
|
|
11
12
|
var foundationDescriptors = require('./foundation/foundationDescriptors.js');
|
|
12
13
|
require('./foundation/foundationComponentMetadata.js');
|
|
13
14
|
require('./foundation/foundationSamples.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultBlueprint.js","sources":["../../defaultBlueprint.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle, describeComponents } from '@cratis/scene.react';\nimport { ComponentName } from './ComponentName';\nimport { defaultBlueprintComponentMetadata } from './defaultBlueprintComponentMetadata';\nimport { foundationDescriptors } from './foundation';\nimport { defaultBlueprintComponents } from './defaultBlueprintComponents';\nimport { galleryDialogTemplates, galleryScreenTemplates, galleryScreens } from './gallery';\nimport { LayoutName, defaultLayouts } from './layouts';\nimport { defaultBlueprintName } from './packageName';\nimport { defaultBlueprintThemes } from './themes';\n\n/**\n * The default blueprint's declaration.\n *\n * A blueprint is the package an application picks once to get a coherent shape: the {@link Layout}s that\n * are its base navigational look, the {@link ScreenTemplate}s and {@link DialogTemplate}s that go inside\n * them, the components that fill their slots, and the themes that color all of it. Picking the parts\n * separately is how an application ends up with a sidebar from one design language and a form from\n * another.\n *\n * The dependency list is what makes a blueprint honest about what it is built from. This one declares\n * PrimeReact - the shell's buttons, breadcrumb, overlay menu and drawer are PrimeReact 10 components - and\n * Cratis Components, which its screen templates fill their content with. A profile that activated this\n * blueprint without them would render a shell whose every control was a dashed red placeholder, and\n * `resolvePackageDependencies` exists to catch that when the profile is configured rather than when\n * someone opens the page.\n *\n * `layouts` lists only true application shells. A dashboard, a CRUD list or a sign-in screen is a screen\n * template, not a layout, and is listed as one.\n */\nexport const defaultBlueprintManifest: ScenePackage = {\n name: defaultBlueprintName,\n version: '1.0.0',\n kind: PackageKind.Blueprint,\n dependencies: [{ name: 'PrimeReact' }, { name: 'Cratis.Components' }],\n components: Object.values(ComponentName),\n layouts: Object.values(LayoutName),\n screenTemplates: galleryScreenTemplates.map(template => template.name),\n dialogTemplates: galleryDialogTemplates.map(template => template.name),\n themes: defaultBlueprintThemes.map(theme => theme.name),\n displayName: 'Cratis Default Blueprint',\n description: 'Application shells with eight menu modes, the components that fill their slots, and a full screen and dialog template set.',\n module: '@cratis/scene.blueprint.default',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The default blueprint as a loadable bundle.\n *\n * The manifest names things; this provides them. `validatePackageBundle` is what proves the two agree, and\n * this package's specs run it - a manifest promising a component the bundle never registered renders as a\n * dashed red placeholder somewhere deep inside a screen, a long way from the declaration that caused it.\n *\n * The screens are the gallery: real {@link Screen} instances naming a layout, a screen template and the\n * content that fills it, so a preview boots them through the real engine as a working miniature\n * application rather than a set of pictures.\n */\nexport const defaultBlueprint: ScenePackageBundle = {\n manifest: defaultBlueprintManifest,\n components: defaultBlueprintComponents,\n layouts: defaultLayouts,\n screenTemplates: galleryScreenTemplates,\n dialogTemplates: galleryDialogTemplates,\n screens: galleryScreens,\n themes: defaultBlueprintThemes,\n descriptors: describeComponents(defaultBlueprintManifest.name, foundationDescriptors, defaultBlueprintComponentMetadata),\n};\n"],"names":["defaultBlueprintManifest","name","defaultBlueprintName","version","kind","PackageKind","Blueprint","dependencies","components","Object","values","ComponentName","layouts","LayoutName","screenTemplates","galleryScreenTemplates","map","template","dialogTemplates","galleryDialogTemplates","themes","defaultBlueprintThemes","theme","displayName","description","module","license","licenseUrl","defaultBlueprint","manifest","defaultBlueprintComponents","defaultLayouts","screens","galleryScreens","descriptors","describeComponents","foundationDescriptors","defaultBlueprintComponentMetadata"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultBlueprint.js","sources":["../../defaultBlueprint.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PackageKind, ScenePackage } from '@cratis/scene.model';\nimport { ScenePackageBundle, describeComponents } from '@cratis/scene.react';\nimport { ComponentName } from './ComponentName';\nimport { defaultBlueprintComponentMetadata } from './defaultBlueprintComponentMetadata';\nimport { foundationDescriptors } from './foundation';\nimport { defaultBlueprintComponents } from './defaultBlueprintComponents';\nimport { galleryDialogTemplates, galleryScreenTemplates, galleryScreens } from './gallery';\nimport { LayoutName, defaultLayouts } from './layouts';\nimport { defaultBlueprintName } from './packageName';\nimport { defaultBlueprintThemes } from './themes';\n\n/**\n * The default blueprint's declaration.\n *\n * A blueprint is the package an application picks once to get a coherent shape: the {@link Layout}s that\n * are its base navigational look, the {@link ScreenTemplate}s and {@link DialogTemplate}s that go inside\n * them, the components that fill their slots, and the themes that color all of it. Picking the parts\n * separately is how an application ends up with a sidebar from one design language and a form from\n * another.\n *\n * The dependency list is what makes a blueprint honest about what it is built from. This one declares\n * PrimeReact - the shell's buttons, breadcrumb, overlay menu and drawer are PrimeReact 10 components - and\n * Cratis Components, which its screen templates fill their content with. A profile that activated this\n * blueprint without them would render a shell whose every control was a dashed red placeholder, and\n * `resolvePackageDependencies` exists to catch that when the profile is configured rather than when\n * someone opens the page.\n *\n * `layouts` lists only true application shells. A dashboard, a CRUD list or a sign-in screen is a screen\n * template, not a layout, and is listed as one.\n */\nexport const defaultBlueprintManifest: ScenePackage = {\n name: defaultBlueprintName,\n version: '1.0.0',\n kind: PackageKind.Blueprint,\n dependencies: [{ name: 'PrimeReact' }, { name: 'Cratis.Components' }],\n components: Object.values(ComponentName),\n layouts: Object.values(LayoutName),\n screenTemplates: galleryScreenTemplates.map(template => template.name),\n dialogTemplates: galleryDialogTemplates.map(template => template.name),\n themes: defaultBlueprintThemes.map(theme => theme.name),\n displayName: 'Cratis Default Blueprint',\n description: 'Application shells with eight menu modes, the components that fill their slots, and a full screen and dialog template set.',\n module: '@cratis/scene.blueprint.default',\n license: 'MIT',\n licenseUrl: 'https://github.com/Cratis/Scene/blob/main/LICENSE',\n};\n\n/**\n * The default blueprint as a loadable bundle.\n *\n * The manifest names things; this provides them. `validatePackageBundle` is what proves the two agree, and\n * this package's specs run it - a manifest promising a component the bundle never registered renders as a\n * dashed red placeholder somewhere deep inside a screen, a long way from the declaration that caused it.\n *\n * The screens are the gallery: real {@link Screen} instances naming a layout, a screen template and the\n * content that fills it, so a preview boots them through the real engine as a working miniature\n * application rather than a set of pictures.\n */\nexport const defaultBlueprint: ScenePackageBundle = {\n manifest: defaultBlueprintManifest,\n components: defaultBlueprintComponents,\n layouts: defaultLayouts,\n screenTemplates: galleryScreenTemplates,\n dialogTemplates: galleryDialogTemplates,\n screens: galleryScreens,\n themes: defaultBlueprintThemes,\n descriptors: describeComponents(defaultBlueprintManifest.name, foundationDescriptors, defaultBlueprintComponentMetadata),\n};\n"],"names":["defaultBlueprintManifest","name","defaultBlueprintName","version","kind","PackageKind","Blueprint","dependencies","components","Object","values","ComponentName","layouts","LayoutName","screenTemplates","galleryScreenTemplates","map","template","dialogTemplates","galleryDialogTemplates","themes","defaultBlueprintThemes","theme","displayName","description","module","license","licenseUrl","defaultBlueprint","manifest","defaultBlueprintComponents","defaultLayouts","screens","galleryScreens","descriptors","describeComponents","foundationDescriptors","defaultBlueprintComponentMetadata"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAaA;;;;;;;;;;;;;;;;;;UAmBaA,wBAAAA,GAAyC;IAClDC,IAAAA,EAAMC,gCAAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,wBAAYC,SAAS;IAC3BC,YAAAA,EAAc;AAAC,QAAA;YAAEN,IAAAA,EAAM;AAAa,SAAA;AAAG,QAAA;YAAEA,IAAAA,EAAM;AAAoB;AAAE,KAAA;IACrEO,UAAAA,EAAYC,MAAAA,CAAOC,MAAM,CAACC,2BAAAA,CAAAA;IAC1BC,OAAAA,EAASH,MAAAA,CAAOC,MAAM,CAACG,qBAAAA,CAAAA;AACvBC,IAAAA,eAAAA,EAAiBC,+BAAuBC,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAAShB,IAAI,CAAA;AACrEiB,IAAAA,eAAAA,EAAiBC,uCAAuBH,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAAShB,IAAI,CAAA;AACrEmB,IAAAA,MAAAA,EAAQC,8CAAuBL,GAAG,CAACM,CAAAA,KAAAA,GAASA,MAAMrB,IAAI,CAAA;IACtDsB,WAAAA,EAAa,0BAAA;IACbC,WAAAA,EAAa,4HAAA;IACbC,MAAAA,EAAQ,iCAAA;IACRC,OAAAA,EAAS,KAAA;IACTC,UAAAA,EAAY;AAChB;AAEA;;;;;;;;;;UAWaC,gBAAAA,GAAuC;IAChDC,QAAAA,EAAU7B,wBAAAA;IACVQ,UAAAA,EAAYsB,qDAAAA;IACZlB,OAAAA,EAASmB,6BAAAA;IACTjB,eAAAA,EAAiBC,8BAAAA;IACjBG,eAAAA,EAAiBC,sCAAAA;IACjBa,OAAAA,EAASC,sBAAAA;IACTb,MAAAA,EAAQC,6CAAAA;AACRa,IAAAA,WAAAA,EAAaC,8BAAAA,CAAmBnC,wBAAAA,CAAyBC,IAAI,EAAEmC,2CAAAA,EAAuBC,mEAAAA;AAC1F;;;"}
|
|
@@ -6,6 +6,7 @@ require('react/jsx-runtime');
|
|
|
6
6
|
require('react');
|
|
7
7
|
var scene_react = require('@cratis/scene.react');
|
|
8
8
|
require('./foundation/ActivityFeed.js');
|
|
9
|
+
require('./foundation/ApprovalChainStepper.js');
|
|
9
10
|
require('./foundation/foundationDescriptors.js');
|
|
10
11
|
var foundationComponentMetadata = require('./foundation/foundationComponentMetadata.js');
|
|
11
12
|
require('./foundation/foundationSamples.js');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultBlueprintComponentMetadata.js","sources":["../../defaultBlueprintComponentMetadata.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentCategory } from '@cratis/scene.model';\nimport { foundationComponentMetadata } from './foundation';\nimport { ComponentMetadata, componentMetadata as m, navigationDesignMode } from '@cratis/scene.react';\n\n/** The category, icon, keywords and picker badge of every component of the package (CMP1), keyed by bare component name. */\nexport const defaultBlueprintComponentMetadata: Record<string, ComponentMetadata> = {\n ...foundationComponentMetadata,\n appShell: m('Application shell', ComponentCategory.Layout, 'app-window', ['layout', 'frame', 'chrome']),\n fullPageShell: m('Full page shell', ComponentCategory.Layout, 'maximize', ['layout', 'fullscreen', 'frame']),\n topbar: m('Topbar', ComponentCategory.Navigation, 'panel-top', ['header', 'top bar', 'navigation'], 'Tp', navigationDesignMode()),\n sidebar: m('Side bar', ComponentCategory.Navigation, 'panel-left', ['navigation', 'menu', 'side panel'], 'Sb', navigationDesignMode({ sidebar: true })),\n menu: m('Menu', ComponentCategory.Navigation, 'menu', ['navigation', 'list', 'links']),\n menuItem: m('Menu item', ComponentCategory.Navigation, 'minus', ['link', 'entry', 'navigation']),\n breadcrumb: m('Breadcrumbs', ComponentCategory.Navigation, 'chevron-right', ['trail', 'path', 'navigation']),\n footer: m('Footer', ComponentCategory.Layout, 'panel-bottom', ['bottom', 'page footer']),\n rightPanel: m('Right panel', ComponentCategory.Layout, 'panel-right', ['side panel', 'drawer', 'aside']),\n configPanel: m('Config panel', ComponentCategory.Layout, 'settings', ['settings', 'layout options', 'preferences']),\n pageHeader: m('Page header', ComponentCategory.Layout, 'heading', ['title', 'header', 'page title']),\n mask: m('Mask', ComponentCategory.Feedback, 'layers', ['overlay', 'scrim', 'backdrop']),\n logo: m('Logo', ComponentCategory.DataDisplay, 'badge', ['brand', 'identity', 'image']),\n userMenu: m('User menu', ComponentCategory.Actions, 'circle-user', ['account', 'profile', 'sign out']),\n themeSwitcher: m('Theme switcher', ComponentCategory.Actions, 'palette', ['theme', 'dark mode', 'colors']),\n layoutModeSwitcher: m('Layout mode switcher', ComponentCategory.Actions, 'layout-dashboard', ['layout', 'mode', 'navigation style']),\n};\n"],"names":["defaultBlueprintComponentMetadata","foundationComponentMetadata","appShell","m","ComponentCategory","Layout","fullPageShell","topbar","Navigation","navigationDesignMode","sidebar","menu","menuItem","breadcrumb","footer","rightPanel","configPanel","pageHeader","mask","Feedback","logo","DataDisplay","userMenu","Actions","themeSwitcher","layoutModeSwitcher"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultBlueprintComponentMetadata.js","sources":["../../defaultBlueprintComponentMetadata.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentCategory } from '@cratis/scene.model';\nimport { foundationComponentMetadata } from './foundation';\nimport { ComponentMetadata, componentMetadata as m, navigationDesignMode } from '@cratis/scene.react';\n\n/** The category, icon, keywords and picker badge of every component of the package (CMP1), keyed by bare component name. */\nexport const defaultBlueprintComponentMetadata: Record<string, ComponentMetadata> = {\n ...foundationComponentMetadata,\n appShell: m('Application shell', ComponentCategory.Layout, 'app-window', ['layout', 'frame', 'chrome']),\n fullPageShell: m('Full page shell', ComponentCategory.Layout, 'maximize', ['layout', 'fullscreen', 'frame']),\n topbar: m('Topbar', ComponentCategory.Navigation, 'panel-top', ['header', 'top bar', 'navigation'], 'Tp', navigationDesignMode()),\n sidebar: m('Side bar', ComponentCategory.Navigation, 'panel-left', ['navigation', 'menu', 'side panel'], 'Sb', navigationDesignMode({ sidebar: true })),\n menu: m('Menu', ComponentCategory.Navigation, 'menu', ['navigation', 'list', 'links']),\n menuItem: m('Menu item', ComponentCategory.Navigation, 'minus', ['link', 'entry', 'navigation']),\n breadcrumb: m('Breadcrumbs', ComponentCategory.Navigation, 'chevron-right', ['trail', 'path', 'navigation']),\n footer: m('Footer', ComponentCategory.Layout, 'panel-bottom', ['bottom', 'page footer']),\n rightPanel: m('Right panel', ComponentCategory.Layout, 'panel-right', ['side panel', 'drawer', 'aside']),\n configPanel: m('Config panel', ComponentCategory.Layout, 'settings', ['settings', 'layout options', 'preferences']),\n pageHeader: m('Page header', ComponentCategory.Layout, 'heading', ['title', 'header', 'page title']),\n mask: m('Mask', ComponentCategory.Feedback, 'layers', ['overlay', 'scrim', 'backdrop']),\n logo: m('Logo', ComponentCategory.DataDisplay, 'badge', ['brand', 'identity', 'image']),\n userMenu: m('User menu', ComponentCategory.Actions, 'circle-user', ['account', 'profile', 'sign out']),\n themeSwitcher: m('Theme switcher', ComponentCategory.Actions, 'palette', ['theme', 'dark mode', 'colors']),\n layoutModeSwitcher: m('Layout mode switcher', ComponentCategory.Actions, 'layout-dashboard', ['layout', 'mode', 'navigation style']),\n};\n"],"names":["defaultBlueprintComponentMetadata","foundationComponentMetadata","appShell","m","ComponentCategory","Layout","fullPageShell","topbar","Navigation","navigationDesignMode","sidebar","menu","menuItem","breadcrumb","footer","rightPanel","configPanel","pageHeader","mask","Feedback","logo","DataDisplay","userMenu","Actions","themeSwitcher","layoutModeSwitcher"],"mappings":";;;;;;;;;;;;;;AAAA;AACA;AAMA,6HACO,MAAMA,iCAAAA,GAAuE;AAChF,IAAA,GAAGC,uDAA2B;AAC9BC,IAAAA,QAAAA,EAAUC,6BAAAA,CAAE,mBAAA,EAAqBC,6BAAAA,CAAkBC,MAAM,EAAE,YAAA,EAAc;AAAC,QAAA,QAAA;AAAU,QAAA,OAAA;AAAS,QAAA;AAAS,KAAA,CAAA;AACtGC,IAAAA,aAAAA,EAAeH,6BAAAA,CAAE,iBAAA,EAAmBC,6BAAAA,CAAkBC,MAAM,EAAE,UAAA,EAAY;AAAC,QAAA,QAAA;AAAU,QAAA,YAAA;AAAc,QAAA;AAAQ,KAAA,CAAA;AAC3GE,IAAAA,MAAAA,EAAQJ,6BAAAA,CAAE,QAAA,EAAUC,6BAAAA,CAAkBI,UAAU,EAAE,WAAA,EAAa;AAAC,QAAA,QAAA;AAAU,QAAA,SAAA;AAAW,QAAA;AAAa,KAAA,EAAE,IAAA,EAAMC,gCAAAA,EAAAA,CAAAA;AAC1GC,IAAAA,OAAAA,EAASP,6BAAAA,CAAE,UAAA,EAAYC,6BAAAA,CAAkBI,UAAU,EAAE,YAAA,EAAc;AAAC,QAAA,YAAA;AAAc,QAAA,MAAA;AAAQ,QAAA;AAAa,KAAA,EAAE,MAAMC,gCAAAA,CAAqB;QAAEC,OAAAA,EAAS;AAAK,KAAA,CAAA,CAAA;AACpJC,IAAAA,IAAAA,EAAMR,6BAAAA,CAAE,MAAA,EAAQC,6BAAAA,CAAkBI,UAAU,EAAE,MAAA,EAAQ;AAAC,QAAA,YAAA;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AE,MAAA,EAAQC,6BAAAA,CAAkBiB,WAAW,EAAE,OAAA,EAAS;AAAC,QAAA,OAAA;AAAS,QAAA,UAAA;AAAY,QAAA;AAAQ,KAAA,CAAA;AACtFC,IAAAA,QAAAA,EAAUnB,6BAAAA,CAAE,WAAA,EAAaC,6BAAAA,CAAkBmB,OAAO,EAAE,aAAA,EAAe;AAAC,QAAA,SAAA;AAAW,QAAA,SAAA;AAAW,QAAA;AAAW,KAAA,CAAA;AACrGC,IAAAA,aAAAA,EAAerB,6BAAAA,CAAE,gBAAA,EAAkBC,6BAAAA,CAAkBmB,OAAO,EAAE,SAAA,EAAW;AAAC,QAAA,OAAA;AAAS,QAAA,WAAA;AAAa,QAAA;AAAS,KAAA,CAAA;AACzGE,IAAAA,kBAAAA,EAAoBtB,6BAAAA,CAAE,sBAAA,EAAwBC,6BAAAA,CAAkBmB,OAAO,EAAE,kBAAA,EAAoB;AAAC,QAAA,QAAA;AAAU,QAAA,MAAA;AAAQ,QAAA;AAAmB,KAAA;AACvI;;"}
|
|
@@ -18,6 +18,9 @@ var ChecklistSection = require('./foundation/ChecklistSection.js');
|
|
|
18
18
|
var ActivityFeed = require('./foundation/ActivityFeed.js');
|
|
19
19
|
var AvatarStack = require('./foundation/AvatarStack.js');
|
|
20
20
|
var FileUploader = require('./foundation/FileUploader.js');
|
|
21
|
+
var ApprovalChainStepper = require('./foundation/ApprovalChainStepper.js');
|
|
22
|
+
var OrgTree = require('./foundation/OrgTree.js');
|
|
23
|
+
var PermissionMatrix = require('./foundation/PermissionMatrix.js');
|
|
21
24
|
require('./foundation/foundationDescriptors.js');
|
|
22
25
|
require('./foundation/foundationComponentMetadata.js');
|
|
23
26
|
require('./foundation/foundationSamples.js');
|
|
@@ -75,7 +78,10 @@ var LayoutModeSwitcher = require('./shell/LayoutModeSwitcher.js');
|
|
|
75
78
|
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.ChecklistSection)]: ChecklistSection.ChecklistSection,
|
|
76
79
|
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.ActivityFeed)]: ActivityFeed.ActivityFeed,
|
|
77
80
|
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.AvatarStack)]: AvatarStack.AvatarStack,
|
|
78
|
-
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.FileUploader)]: FileUploader.FileUploader
|
|
81
|
+
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.FileUploader)]: FileUploader.FileUploader,
|
|
82
|
+
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.ApprovalChainStepper)]: ApprovalChainStepper.ApprovalChainStepper,
|
|
83
|
+
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.OrgTree)]: OrgTree.OrgTree,
|
|
84
|
+
[scene_react.componentRegistryKey(packageName.defaultBlueprintName, ComponentName.ComponentName.PermissionMatrix)]: PermissionMatrix.PermissionMatrix
|
|
79
85
|
};
|
|
80
86
|
|
|
81
87
|
exports.defaultBlueprintComponents = defaultBlueprintComponents;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultBlueprintComponents.js","sources":["../../defaultBlueprintComponents.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentRegistry, componentRegistryKey } from '@cratis/scene.react';\nimport { ComponentName } from './ComponentName';\nimport { defaultBlueprintName } from './packageName';\nimport { ActivityFeed, AvatarStack, ChartWrapper, ChecklistSection, ColumnChooser, FileUploader, EmptyState, FilterBuilder, SavedViewsMenu, StatCard, StatusChip, TrendChip } from './foundation';\nimport {\n AppShell,\n Breadcrumb,\n ConfigPanel,\n Footer,\n FullPageShell,\n LayoutModeSwitcher,\n Logo,\n Mask,\n Menu,\n MenuItem,\n PageHeader,\n RightPanel,\n Sidebar,\n ThemeSwitcher,\n Topbar,\n UserMenu,\n} from './shell';\n\n/**\n * The components this package registers, keyed the way the renderer looks them up.\n *\n * Every key is built with `componentRegistryKey` rather than written out, because the separator between\n * package and component name is the registry's own business - it is deliberately not the `.` a screen uses\n * to qualify a name, so that a package name containing dots stays unambiguous. Building a key by hand is\n * how a component ends up registered under something no lookup will ever produce.\n */\nexport const defaultBlueprintComponents: ComponentRegistry = {\n [componentRegistryKey(defaultBlueprintName, ComponentName.AppShell)]: AppShell,\n [componentRegistryKey(defaultBlueprintName, ComponentName.FullPageShell)]: FullPageShell,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Topbar)]: Topbar,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Sidebar)]: Sidebar,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Menu)]: Menu,\n [componentRegistryKey(defaultBlueprintName, ComponentName.MenuItem)]: MenuItem,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Breadcrumb)]: Breadcrumb,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Footer)]: Footer,\n [componentRegistryKey(defaultBlueprintName, ComponentName.RightPanel)]: RightPanel,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ConfigPanel)]: ConfigPanel,\n [componentRegistryKey(defaultBlueprintName, ComponentName.PageHeader)]: PageHeader,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Mask)]: Mask,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Logo)]: Logo,\n [componentRegistryKey(defaultBlueprintName, ComponentName.UserMenu)]: UserMenu,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ThemeSwitcher)]: ThemeSwitcher,\n [componentRegistryKey(defaultBlueprintName, ComponentName.LayoutModeSwitcher)]: LayoutModeSwitcher,\n [componentRegistryKey(defaultBlueprintName, ComponentName.EmptyState)]: EmptyState,\n [componentRegistryKey(defaultBlueprintName, ComponentName.StatCard)]: StatCard,\n [componentRegistryKey(defaultBlueprintName, ComponentName.TrendChip)]: TrendChip,\n [componentRegistryKey(defaultBlueprintName, ComponentName.StatusChip)]: StatusChip,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ChartWrapper)]: ChartWrapper,\n [componentRegistryKey(defaultBlueprintName, ComponentName.FilterBuilder)]: FilterBuilder,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ColumnChooser)]: ColumnChooser,\n [componentRegistryKey(defaultBlueprintName, ComponentName.SavedViewsMenu)]: SavedViewsMenu,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ChecklistSection)]: ChecklistSection,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ActivityFeed)]: ActivityFeed,\n [componentRegistryKey(defaultBlueprintName, ComponentName.AvatarStack)]: AvatarStack,\n [componentRegistryKey(defaultBlueprintName, ComponentName.FileUploader)]: FileUploader,\n};\n"],"names":["defaultBlueprintComponents","componentRegistryKey","defaultBlueprintName","ComponentName","AppShell","FullPageShell","Topbar","Sidebar","Menu","MenuItem","Breadcrumb","Footer","RightPanel","ConfigPanel","PageHeader","Mask","Logo","UserMenu","ThemeSwitcher","LayoutModeSwitcher","EmptyState","StatCard","TrendChip","StatusChip","ChartWrapper","FilterBuilder","ColumnChooser","SavedViewsMenu","ChecklistSection","ActivityFeed","AvatarStack","FileUploader"],"mappings":"
|
|
1
|
+
{"version":3,"file":"defaultBlueprintComponents.js","sources":["../../defaultBlueprintComponents.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ComponentRegistry, componentRegistryKey } from '@cratis/scene.react';\nimport { ComponentName } from './ComponentName';\nimport { defaultBlueprintName } from './packageName';\nimport { ActivityFeed, ApprovalChainStepper, AvatarStack, ChartWrapper, ChecklistSection, ColumnChooser, FileUploader, EmptyState, FilterBuilder, OrgTree, PermissionMatrix, SavedViewsMenu, StatCard, StatusChip, TrendChip } from './foundation';\nimport {\n AppShell,\n Breadcrumb,\n ConfigPanel,\n Footer,\n FullPageShell,\n LayoutModeSwitcher,\n Logo,\n Mask,\n Menu,\n MenuItem,\n PageHeader,\n RightPanel,\n Sidebar,\n ThemeSwitcher,\n Topbar,\n UserMenu,\n} from './shell';\n\n/**\n * The components this package registers, keyed the way the renderer looks them up.\n *\n * Every key is built with `componentRegistryKey` rather than written out, because the separator between\n * package and component name is the registry's own business - it is deliberately not the `.` a screen uses\n * to qualify a name, so that a package name containing dots stays unambiguous. Building a key by hand is\n * how a component ends up registered under something no lookup will ever produce.\n */\nexport const defaultBlueprintComponents: ComponentRegistry = {\n [componentRegistryKey(defaultBlueprintName, ComponentName.AppShell)]: AppShell,\n [componentRegistryKey(defaultBlueprintName, ComponentName.FullPageShell)]: FullPageShell,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Topbar)]: Topbar,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Sidebar)]: Sidebar,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Menu)]: Menu,\n [componentRegistryKey(defaultBlueprintName, ComponentName.MenuItem)]: MenuItem,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Breadcrumb)]: Breadcrumb,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Footer)]: Footer,\n [componentRegistryKey(defaultBlueprintName, ComponentName.RightPanel)]: RightPanel,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ConfigPanel)]: ConfigPanel,\n [componentRegistryKey(defaultBlueprintName, ComponentName.PageHeader)]: PageHeader,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Mask)]: Mask,\n [componentRegistryKey(defaultBlueprintName, ComponentName.Logo)]: Logo,\n [componentRegistryKey(defaultBlueprintName, ComponentName.UserMenu)]: UserMenu,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ThemeSwitcher)]: ThemeSwitcher,\n [componentRegistryKey(defaultBlueprintName, ComponentName.LayoutModeSwitcher)]: LayoutModeSwitcher,\n [componentRegistryKey(defaultBlueprintName, ComponentName.EmptyState)]: EmptyState,\n [componentRegistryKey(defaultBlueprintName, ComponentName.StatCard)]: StatCard,\n [componentRegistryKey(defaultBlueprintName, ComponentName.TrendChip)]: TrendChip,\n [componentRegistryKey(defaultBlueprintName, ComponentName.StatusChip)]: StatusChip,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ChartWrapper)]: ChartWrapper,\n [componentRegistryKey(defaultBlueprintName, ComponentName.FilterBuilder)]: FilterBuilder,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ColumnChooser)]: ColumnChooser,\n [componentRegistryKey(defaultBlueprintName, ComponentName.SavedViewsMenu)]: SavedViewsMenu,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ChecklistSection)]: ChecklistSection,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ActivityFeed)]: ActivityFeed,\n [componentRegistryKey(defaultBlueprintName, ComponentName.AvatarStack)]: AvatarStack,\n [componentRegistryKey(defaultBlueprintName, ComponentName.FileUploader)]: FileUploader,\n [componentRegistryKey(defaultBlueprintName, ComponentName.ApprovalChainStepper)]: ApprovalChainStepper,\n [componentRegistryKey(defaultBlueprintName, ComponentName.OrgTree)]: OrgTree,\n [componentRegistryKey(defaultBlueprintName, ComponentName.PermissionMatrix)]: PermissionMatrix,\n};\n"],"names":["defaultBlueprintComponents","componentRegistryKey","defaultBlueprintName","ComponentName","AppShell","FullPageShell","Topbar","Sidebar","Menu","MenuItem","Breadcrumb","Footer","RightPanel","ConfigPanel","PageHeader","Mask","Logo","UserMenu","ThemeSwitcher","LayoutModeSwitcher","EmptyState","StatCard","TrendChip","StatusChip","ChartWrapper","FilterBuilder","ColumnChooser","SavedViewsMenu","ChecklistSection","ActivityFeed","AvatarStack","FileUploader","ApprovalChainStepper","OrgTree","PermissionMatrix"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAyBA;;;;;;;UAQaA,0BAAAA,GAAgD;AACzD,IAAA,CAACC,gCAAAA,CAAqBC,gCAAAA,EAAsBC,2BAAAA,CAAcC,QAAQ,IAAIA,iBAAAA;AACtE,IAAA,C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AA,CAAqBC,gCAAAA,EAAsBC,2BAAAA,CAAc6B,oBAAoB,IAAIA,yCAAAA;AAClF,IAAA,CAAC/B,gCAAAA,CAAqBC,gCAAAA,EAAsBC,2BAAAA,CAAc8B,OAAO,IAAIA,eAAAA;AACrE,IAAA,CAAChC,gCAAAA,CAAqBC,gCAAAA,EAAsBC,2BAAAA,CAAc+B,gBAAgB,IAAIA;AAClF;;"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var approvalModel = require('./approvalModel.js');
|
|
6
|
+
var ComponentState = require('./ComponentState.js');
|
|
7
|
+
var FoundationIcon = require('./FoundationIcon.js');
|
|
8
|
+
var formatting = require('./formatting.js');
|
|
9
|
+
var foundationStrings = require('./foundationStrings.js');
|
|
10
|
+
var StateFrame = require('./StateFrame.js');
|
|
11
|
+
|
|
12
|
+
const icons = {
|
|
13
|
+
[approvalModel.ApprovalState.Pending]: 'circle',
|
|
14
|
+
[approvalModel.ApprovalState.Current]: 'clock',
|
|
15
|
+
[approvalModel.ApprovalState.Approved]: 'check',
|
|
16
|
+
[approvalModel.ApprovalState.Rejected]: 'close',
|
|
17
|
+
[approvalModel.ApprovalState.Skipped]: 'minus'
|
|
18
|
+
};
|
|
19
|
+
const tones = {
|
|
20
|
+
[approvalModel.ApprovalState.Pending]: 'neutral',
|
|
21
|
+
[approvalModel.ApprovalState.Current]: 'info',
|
|
22
|
+
[approvalModel.ApprovalState.Approved]: 'success',
|
|
23
|
+
[approvalModel.ApprovalState.Rejected]: 'danger',
|
|
24
|
+
[approvalModel.ApprovalState.Skipped]: 'neutral'
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* The `approvalChainStepper` component: the steps a request goes through, who decides each, and where it stands.
|
|
28
|
+
*
|
|
29
|
+
* `steps` are written in order with a `label`, an `approver`, a `state` (pending, current, approved, rejected, skipped), and when it was
|
|
30
|
+
* decided (`at`) and a `comment`. The chain applies its own rules - a rejection stops the chain and the steps after it read "Not reached", and
|
|
31
|
+
* with no current step the first undecided one is it - so a request page needs no logic of its own. Every step says its state in words as
|
|
32
|
+
* well as by icon and color, the current step carries `aria-current="step"`, and the whole is an ordered list with the overall outcome
|
|
33
|
+
* stated above it. `orientation` is `horizontal` or `vertical`; below a phone's width it is always vertical.
|
|
34
|
+
*/ function ApprovalChainStepper({ element, interactions }) {
|
|
35
|
+
const written = react.useMemo(()=>approvalModel.readSteps(element.properties.steps), [
|
|
36
|
+
element.properties.steps
|
|
37
|
+
]);
|
|
38
|
+
const steps = react.useMemo(()=>approvalModel.effectiveSteps(written), [
|
|
39
|
+
written
|
|
40
|
+
]);
|
|
41
|
+
const outcome = approvalModel.chainOutcome(written);
|
|
42
|
+
const strings = foundationStrings.readFoundationStrings(element);
|
|
43
|
+
const locale = formatting.readLocale(element);
|
|
44
|
+
const state = ComponentState.readComponentState(element, written.length > 0);
|
|
45
|
+
const stateText = {
|
|
46
|
+
pending: strings.approvalPending,
|
|
47
|
+
current: strings.approvalCurrent,
|
|
48
|
+
approved: strings.approvalApproved,
|
|
49
|
+
rejected: strings.approvalRejected,
|
|
50
|
+
skipped: strings.approvalSkipped
|
|
51
|
+
};
|
|
52
|
+
const outcomeText = {
|
|
53
|
+
approved: strings.approvalOutcomeApproved,
|
|
54
|
+
rejected: strings.approvalOutcomeRejected,
|
|
55
|
+
inProgress: strings.approvalOutcomeInProgress,
|
|
56
|
+
pending: strings.approvalOutcomePending
|
|
57
|
+
};
|
|
58
|
+
return /*#__PURE__*/ jsxRuntime.jsx(StateFrame.FoundationFrame, {
|
|
59
|
+
element: element,
|
|
60
|
+
interactions: interactions,
|
|
61
|
+
name: "approval-chain",
|
|
62
|
+
state: state,
|
|
63
|
+
skeleton: [
|
|
64
|
+
100,
|
|
65
|
+
100
|
|
66
|
+
],
|
|
67
|
+
children: (state === ComponentState.ComponentState.Ready || state === ComponentState.ComponentState.Partial) && /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
68
|
+
children: [
|
|
69
|
+
/*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
70
|
+
className: "foundation-approval-outcome",
|
|
71
|
+
"data-outcome": outcome,
|
|
72
|
+
children: outcomeText[outcome]
|
|
73
|
+
}),
|
|
74
|
+
/*#__PURE__*/ jsxRuntime.jsx("ol", {
|
|
75
|
+
className: "foundation-approval-steps",
|
|
76
|
+
"aria-label": strings.approvalChain,
|
|
77
|
+
"data-orientation": element.properties.orientation === 'vertical' ? 'vertical' : 'horizontal',
|
|
78
|
+
children: steps.map((step, index)=>/*#__PURE__*/ jsxRuntime.jsxs("li", {
|
|
79
|
+
className: "foundation-approval-step",
|
|
80
|
+
"data-state": step.state,
|
|
81
|
+
"aria-current": step.state === approvalModel.ApprovalState.Current ? 'step' : undefined,
|
|
82
|
+
children: [
|
|
83
|
+
/*#__PURE__*/ jsxRuntime.jsxs("span", {
|
|
84
|
+
className: "foundation-chip",
|
|
85
|
+
"data-tone": tones[step.state],
|
|
86
|
+
children: [
|
|
87
|
+
/*#__PURE__*/ jsxRuntime.jsx(FoundationIcon.FoundationIcon, {
|
|
88
|
+
name: icons[step.state]
|
|
89
|
+
}),
|
|
90
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
91
|
+
children: step.notReached ? strings.approvalNotReached : stateText[step.state]
|
|
92
|
+
})
|
|
93
|
+
]
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ jsxRuntime.jsxs("strong", {
|
|
96
|
+
className: "foundation-approval-label",
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
99
|
+
className: "foundation-visually-hidden",
|
|
100
|
+
children: `${foundationStrings.formatText(strings.approvalStep, {
|
|
101
|
+
n: index + 1,
|
|
102
|
+
total: steps.length
|
|
103
|
+
})}: `
|
|
104
|
+
}),
|
|
105
|
+
step.label
|
|
106
|
+
]
|
|
107
|
+
}),
|
|
108
|
+
step.approver && /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
109
|
+
className: "foundation-count",
|
|
110
|
+
children: step.approver
|
|
111
|
+
}),
|
|
112
|
+
step.at && /*#__PURE__*/ jsxRuntime.jsx("time", {
|
|
113
|
+
className: "foundation-count",
|
|
114
|
+
dateTime: step.at,
|
|
115
|
+
children: formatting.formatDate(step.at, locale, true)
|
|
116
|
+
}),
|
|
117
|
+
step.comment && /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
118
|
+
className: "foundation-approval-comment",
|
|
119
|
+
children: step.comment
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}, step.label + index))
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
exports.ApprovalChainStepper = ApprovalChainStepper;
|
|
130
|
+
//# sourceMappingURL=ApprovalChainStepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApprovalChainStepper.js","sources":["../../../foundation/ApprovalChainStepper.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useMemo } from 'react';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { ApprovalState, ChainOutcome, chainOutcome, effectiveSteps, readSteps } from './approvalModel';\nimport { ComponentState, readComponentState } from './ComponentState';\nimport { FoundationIcon, FoundationIconName } from './FoundationIcon';\nimport { formatDate, readLocale } from './formatting';\nimport { formatText, readFoundationStrings } from './foundationStrings';\nimport { FoundationFrame } from './StateFrame';\n\nconst icons: Record<ApprovalState, FoundationIconName> = {\n [ApprovalState.Pending]: 'circle', [ApprovalState.Current]: 'clock', [ApprovalState.Approved]: 'check', [ApprovalState.Rejected]: 'close', [ApprovalState.Skipped]: 'minus',\n};\nconst tones: Record<ApprovalState, string> = {\n [ApprovalState.Pending]: 'neutral', [ApprovalState.Current]: 'info', [ApprovalState.Approved]: 'success', [ApprovalState.Rejected]: 'danger', [ApprovalState.Skipped]: 'neutral',\n};\n\n/**\n * The `approvalChainStepper` component: the steps a request goes through, who decides each, and where it stands.\n *\n * `steps` are written in order with a `label`, an `approver`, a `state` (pending, current, approved, rejected, skipped), and when it was\n * decided (`at`) and a `comment`. The chain applies its own rules - a rejection stops the chain and the steps after it read \"Not reached\", and\n * with no current step the first undecided one is it - so a request page needs no logic of its own. Every step says its state in words as\n * well as by icon and color, the current step carries `aria-current=\"step\"`, and the whole is an ordered list with the overall outcome\n * stated above it. `orientation` is `horizontal` or `vertical`; below a phone's width it is always vertical.\n */\nexport function ApprovalChainStepper({ element, interactions }: RegisteredComponentProps) {\n const written = useMemo(() => readSteps(element.properties.steps), [element.properties.steps]);\n const steps = useMemo(() => effectiveSteps(written), [written]);\n const outcome = chainOutcome(written);\n const strings = readFoundationStrings(element);\n const locale = readLocale(element);\n const state = readComponentState(element, written.length > 0);\n const stateText: Record<ApprovalState, string> = {\n pending: strings.approvalPending, current: strings.approvalCurrent, approved: strings.approvalApproved, rejected: strings.approvalRejected, skipped: strings.approvalSkipped,\n };\n const outcomeText: Record<ChainOutcome, string> = {\n approved: strings.approvalOutcomeApproved, rejected: strings.approvalOutcomeRejected, inProgress: strings.approvalOutcomeInProgress, pending: strings.approvalOutcomePending,\n };\n\n return (\n <FoundationFrame element={element} interactions={interactions} name='approval-chain' state={state} skeleton={[100, 100]}>\n {(state === ComponentState.Ready || state === ComponentState.Partial) && (\n <>\n <p className='foundation-approval-outcome' data-outcome={outcome}>{outcomeText[outcome]}</p>\n <ol className='foundation-approval-steps' aria-label={strings.approvalChain} data-orientation={element.properties.orientation === 'vertical' ? 'vertical' : 'horizontal'}>\n {steps.map((step, index) => (\n <li key={step.label + index} className='foundation-approval-step' data-state={step.state} aria-current={step.state === ApprovalState.Current ? 'step' : undefined}>\n <span className='foundation-chip' data-tone={tones[step.state]}><FoundationIcon name={icons[step.state]} /><span>{step.notReached ? strings.approvalNotReached : stateText[step.state]}</span></span>\n <strong className='foundation-approval-label'>\n <span className='foundation-visually-hidden'>{`${formatText(strings.approvalStep, { n: index + 1, total: steps.length })}: `}</span>\n {step.label}\n </strong>\n {step.approver && <span className='foundation-count'>{step.approver}</span>}\n {step.at && <time className='foundation-count' dateTime={step.at}>{formatDate(step.at, locale, true)}</time>}\n {step.comment && <span className='foundation-approval-comment'>{step.comment}</span>}\n </li>\n ))}\n </ol>\n </>\n )}\n </FoundationFrame>\n );\n}\n"],"names":["icons","ApprovalState","Pending","Current","Approved","Rejected","Skipped","tones","ApprovalChainStepper","element","interactions","written","useMemo","readSteps","properties","steps","effectiveSteps","outcome","chainOutcome","strings","readFoundationStrings","locale","readLocale","state","readComponentState","length","stateText","pending","approvalPending","current","approvalCurrent","approved","approvalApproved","rejected","approvalRejected","skipped","approvalSkipped","outcomeText","approvalOutcomeApproved","approvalOutcomeRejected","inProgress","approvalOutcomeInProgress","approvalOutcomePending","_jsx","FoundationFrame","name","skeleton","ComponentState","Ready","Partial","_jsxs","_Fragment","p","className","data-outcome","ol","aria-label","approvalChain","data-orientation","orientation","map","step","index","li","data-state","aria-current","undefined","span","data-tone","FoundationIcon","notReached","approvalNotReached","strong","formatText","approvalStep","n","total","label","approver","at","time","dateTime","formatDate","comment"],"mappings":";;;;;;;;;;;AAYA,MAAMA,KAAAA,GAAmD;IACrD,CAACC,2BAAAA,CAAcC,OAAO,GAAG,QAAA;IAAU,CAACD,2BAAAA,CAAcE,OAAO,GAAG,OAAA;IAAS,CAACF,2BAAAA,CAAcG,QAAQ,GAAG,OAAA;IAAS,CAACH,2BAAAA,CAAcI,QAAQ,GAAG,OAAA;IAAS,CAACJ,2BAAAA,CAAcK,OAAO,GAAG;AACxK,CAAA;AACA,MAAMC,KAAAA,GAAuC;IACzC,CAACN,2BAAAA,CAAcC,OAAO,GAAG,SAAA;IAAW,CAACD,2BAAAA,CAAcE,OAAO,GAAG,MAAA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+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var scene_react = require('@cratis/scene.react');
|
|
6
|
+
var ComponentState = require('./ComponentState.js');
|
|
7
|
+
var FoundationIcon = require('./FoundationIcon.js');
|
|
8
|
+
var foundationStrings = require('./foundationStrings.js');
|
|
9
|
+
var orgModel = require('./orgModel.js');
|
|
10
|
+
var StateFrame = require('./StateFrame.js');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The `orgTree` component: an organization as an expandable tree of people and units.
|
|
14
|
+
*
|
|
15
|
+
* `nodes` are flat rows - `id`, `label`, `title`, `parentId` - as a query returns them; the tree is built from them, so someone whose manager is
|
|
16
|
+
* missing becomes a root and a reporting cycle is cut instead of looping. It follows the ARIA tree pattern: one tab stop, Up and Down move,
|
|
17
|
+
* Right expands or enters, Left collapses or goes to the parent, Home and End jump, Enter or Space selects. Each item says how many reports it
|
|
18
|
+
* has in words. The selected id is published as the `value` output; `expandedDepth` is how many levels are open at first.
|
|
19
|
+
*/ function OrgTree({ element, interactions, bindingOutputs }) {
|
|
20
|
+
const nodes = react.useMemo(()=>orgModel.readOrgNodes(element.properties.nodes), [
|
|
21
|
+
element.properties.nodes
|
|
22
|
+
]);
|
|
23
|
+
const roots = react.useMemo(()=>orgModel.buildOrgTree(nodes), [
|
|
24
|
+
nodes
|
|
25
|
+
]);
|
|
26
|
+
const depth = typeof element.properties.expandedDepth === 'number' ? element.properties.expandedDepth : 2;
|
|
27
|
+
const initial = react.useMemo(()=>orgModel.expandedToDepth(roots, depth), [
|
|
28
|
+
roots,
|
|
29
|
+
depth
|
|
30
|
+
]);
|
|
31
|
+
const [expanded, setExpanded] = react.useState(initial);
|
|
32
|
+
const [selected, setSelected] = react.useState(typeof element.properties.selected === 'string' ? element.properties.selected : undefined);
|
|
33
|
+
const [focused, setFocused] = react.useState(undefined);
|
|
34
|
+
const strings = foundationStrings.readFoundationStrings(element);
|
|
35
|
+
const state = ComponentState.readComponentState(element, nodes.length > 0);
|
|
36
|
+
const visible = orgModel.visibleNodes(roots, expanded);
|
|
37
|
+
const placed = react.useMemo(()=>orgModel.placements(roots), [
|
|
38
|
+
roots
|
|
39
|
+
]);
|
|
40
|
+
const tabStop = visible.find((node)=>node.id === focused)?.id ?? visible.find((node)=>node.id === selected)?.id ?? visible[0]?.id;
|
|
41
|
+
const emptyElement = state === ComponentState.ComponentState.Empty ? {
|
|
42
|
+
...element,
|
|
43
|
+
properties: {
|
|
44
|
+
emptyHeadline: strings.orgNone,
|
|
45
|
+
...element.properties
|
|
46
|
+
}
|
|
47
|
+
} : element;
|
|
48
|
+
react.useEffect(()=>setExpanded(initial), [
|
|
49
|
+
initial
|
|
50
|
+
]);
|
|
51
|
+
scene_react.useValueOutput(bindingOutputs, selected);
|
|
52
|
+
const move = (node, event)=>{
|
|
53
|
+
const index = visible.indexOf(node);
|
|
54
|
+
const focus = (target)=>{
|
|
55
|
+
if (!target) return;
|
|
56
|
+
event.preventDefault();
|
|
57
|
+
setFocused(target.id);
|
|
58
|
+
requestAnimationFrame(()=>document.getElementById(`${element.id}-${target.id}`)?.focus());
|
|
59
|
+
};
|
|
60
|
+
const toggle = (open)=>setExpanded((current)=>{
|
|
61
|
+
const next = new Set(current);
|
|
62
|
+
if (open) next.add(node.id);
|
|
63
|
+
else next.delete(node.id);
|
|
64
|
+
return next;
|
|
65
|
+
});
|
|
66
|
+
const parent = placed.get(node.id)?.parent;
|
|
67
|
+
switch(event.key){
|
|
68
|
+
case 'ArrowDown':
|
|
69
|
+
focus(visible[index + 1]);
|
|
70
|
+
break;
|
|
71
|
+
case 'ArrowUp':
|
|
72
|
+
focus(visible[index - 1]);
|
|
73
|
+
break;
|
|
74
|
+
case 'Home':
|
|
75
|
+
focus(visible[0]);
|
|
76
|
+
break;
|
|
77
|
+
case 'End':
|
|
78
|
+
focus(visible[visible.length - 1]);
|
|
79
|
+
break;
|
|
80
|
+
case 'ArrowRight':
|
|
81
|
+
if (node.children.length > 0 && !expanded.has(node.id)) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
toggle(true);
|
|
84
|
+
} else focus(node.children[0]);
|
|
85
|
+
break;
|
|
86
|
+
case 'ArrowLeft':
|
|
87
|
+
if (node.children.length > 0 && expanded.has(node.id)) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
toggle(false);
|
|
90
|
+
} else focus(parent);
|
|
91
|
+
break;
|
|
92
|
+
case 'Enter':
|
|
93
|
+
case ' ':
|
|
94
|
+
event.preventDefault();
|
|
95
|
+
setSelected(node.id);
|
|
96
|
+
interactions?.onSelect?.();
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return /*#__PURE__*/ jsxRuntime.jsx(StateFrame.FoundationFrame, {
|
|
101
|
+
element: emptyElement,
|
|
102
|
+
interactions: interactions,
|
|
103
|
+
name: "org-tree",
|
|
104
|
+
state: state,
|
|
105
|
+
skeleton: [
|
|
106
|
+
50,
|
|
107
|
+
70,
|
|
108
|
+
70,
|
|
109
|
+
60
|
|
110
|
+
],
|
|
111
|
+
children: (state === ComponentState.ComponentState.Ready || state === ComponentState.ComponentState.Partial) && /*#__PURE__*/ jsxRuntime.jsx("ul", {
|
|
112
|
+
role: "tree",
|
|
113
|
+
"aria-label": strings.orgTree,
|
|
114
|
+
className: "foundation-tree",
|
|
115
|
+
children: visible.map((node)=>{
|
|
116
|
+
const siblings = placed.get(node.id)?.siblings ?? [
|
|
117
|
+
node
|
|
118
|
+
];
|
|
119
|
+
const reports = orgModel.descendantCount(node);
|
|
120
|
+
const open = expanded.has(node.id);
|
|
121
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("li", {
|
|
122
|
+
id: `${element.id}-${node.id}`,
|
|
123
|
+
role: "treeitem",
|
|
124
|
+
tabIndex: node.id === tabStop ? 0 : -1,
|
|
125
|
+
"aria-level": node.depth,
|
|
126
|
+
"aria-setsize": siblings.length,
|
|
127
|
+
"aria-posinset": siblings.findIndex((sibling)=>sibling.id === node.id) + 1,
|
|
128
|
+
"aria-expanded": node.children.length > 0 ? open : undefined,
|
|
129
|
+
"aria-selected": node.id === selected,
|
|
130
|
+
className: "foundation-tree-item",
|
|
131
|
+
"data-selected": node.id === selected,
|
|
132
|
+
style: {
|
|
133
|
+
paddingInlineStart: `calc(var(--foundation-space-4) * ${node.depth - 1})`
|
|
134
|
+
},
|
|
135
|
+
onKeyDown: (event)=>move(node, event),
|
|
136
|
+
onFocus: ()=>setFocused(node.id),
|
|
137
|
+
onClick: ()=>{
|
|
138
|
+
setSelected(node.id);
|
|
139
|
+
interactions?.onSelect?.();
|
|
140
|
+
},
|
|
141
|
+
children: [
|
|
142
|
+
node.children.length > 0 ? /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
143
|
+
type: "button",
|
|
144
|
+
tabIndex: -1,
|
|
145
|
+
className: "foundation-icon-button",
|
|
146
|
+
"aria-hidden": "true",
|
|
147
|
+
onClick: (event)=>{
|
|
148
|
+
event.stopPropagation();
|
|
149
|
+
setExpanded((current)=>{
|
|
150
|
+
const next = new Set(current);
|
|
151
|
+
if (open) next.delete(node.id);
|
|
152
|
+
else next.add(node.id);
|
|
153
|
+
return next;
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(FoundationIcon.FoundationIcon, {
|
|
157
|
+
name: open ? 'chevron-down' : 'chevron-right'
|
|
158
|
+
})
|
|
159
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
160
|
+
className: "foundation-tree-spacer"
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ jsxRuntime.jsxs("span", {
|
|
163
|
+
className: "foundation-tree-text",
|
|
164
|
+
children: [
|
|
165
|
+
/*#__PURE__*/ jsxRuntime.jsx("strong", {
|
|
166
|
+
children: node.label
|
|
167
|
+
}),
|
|
168
|
+
node.title && /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
169
|
+
className: "foundation-count",
|
|
170
|
+
children: node.title
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
}),
|
|
174
|
+
reports > 0 && /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
175
|
+
className: "foundation-count",
|
|
176
|
+
children: foundationStrings.formatText(strings.orgReports, {
|
|
177
|
+
count: reports
|
|
178
|
+
})
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
}, node.id);
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
exports.OrgTree = OrgTree;
|
|
188
|
+
//# sourceMappingURL=OrgTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrgTree.js","sources":["../../../foundation/OrgTree.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { KeyboardEvent, useEffect, useMemo, useState } from 'react';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { ComponentState, readComponentState } from './ComponentState';\nimport { FoundationIcon } from './FoundationIcon';\nimport { formatText, readFoundationStrings } from './foundationStrings';\nimport { descendantCount, expandedToDepth, OrgTreeNode, buildOrgTree, placements, readOrgNodes, visibleNodes } from './orgModel';\nimport { FoundationFrame } from './StateFrame';\n\n/**\n * The `orgTree` component: an organization as an expandable tree of people and units.\n *\n * `nodes` are flat rows - `id`, `label`, `title`, `parentId` - as a query returns them; the tree is built from them, so someone whose manager is\n * missing becomes a root and a reporting cycle is cut instead of looping. It follows the ARIA tree pattern: one tab stop, Up and Down move,\n * Right expands or enters, Left collapses or goes to the parent, Home and End jump, Enter or Space selects. Each item says how many reports it\n * has in words. The selected id is published as the `value` output; `expandedDepth` is how many levels are open at first.\n */\nexport function OrgTree({ element, interactions, bindingOutputs }: RegisteredComponentProps) {\n const nodes = useMemo(() => readOrgNodes(element.properties.nodes), [element.properties.nodes]);\n const roots = useMemo(() => buildOrgTree(nodes), [nodes]);\n const depth = typeof element.properties.expandedDepth === 'number' ? element.properties.expandedDepth : 2;\n const initial = useMemo(() => expandedToDepth(roots, depth), [roots, depth]);\n const [expanded, setExpanded] = useState<Set<string>>(initial);\n const [selected, setSelected] = useState<string | undefined>(typeof element.properties.selected === 'string' ? element.properties.selected : undefined);\n const [focused, setFocused] = useState<string | undefined>(undefined);\n const strings = readFoundationStrings(element);\n const state = readComponentState(element, nodes.length > 0);\n const visible = visibleNodes(roots, expanded);\n const placed = useMemo(() => placements(roots), [roots]);\n const tabStop = visible.find(node => node.id === focused)?.id ?? visible.find(node => node.id === selected)?.id ?? visible[0]?.id;\n const emptyElement = state === ComponentState.Empty ? { ...element, properties: { emptyHeadline: strings.orgNone, ...element.properties } } : element;\n\n useEffect(() => setExpanded(initial), [initial]);\n useValueOutput(bindingOutputs, selected);\n\n const move = (node: OrgTreeNode, event: KeyboardEvent) => {\n const index = visible.indexOf(node);\n const focus = (target: OrgTreeNode | undefined) => {\n if (!target) return;\n event.preventDefault();\n setFocused(target.id);\n requestAnimationFrame(() => document.getElementById(`${element.id}-${target.id}`)?.focus());\n };\n const toggle = (open: boolean) => setExpanded(current => { const next = new Set(current); if (open) next.add(node.id); else next.delete(node.id); return next; });\n const parent = placed.get(node.id)?.parent;\n\n switch (event.key) {\n case 'ArrowDown': focus(visible[index + 1]); break;\n case 'ArrowUp': focus(visible[index - 1]); break;\n case 'Home': focus(visible[0]); break;\n case 'End': focus(visible[visible.length - 1]); break;\n case 'ArrowRight':\n if (node.children.length > 0 && !expanded.has(node.id)) { event.preventDefault(); toggle(true); } else focus(node.children[0]);\n break;\n case 'ArrowLeft':\n if (node.children.length > 0 && expanded.has(node.id)) { event.preventDefault(); toggle(false); } else focus(parent);\n break;\n case 'Enter':\n case ' ':\n event.preventDefault();\n setSelected(node.id);\n interactions?.onSelect?.();\n break;\n default: break;\n }\n };\n\n return (\n <FoundationFrame element={emptyElement} interactions={interactions} name='org-tree' state={state} skeleton={[50, 70, 70, 60]}>\n {(state === ComponentState.Ready || state === ComponentState.Partial) && (\n <ul role='tree' aria-label={strings.orgTree} className='foundation-tree'>\n {visible.map(node => {\n const siblings = placed.get(node.id)?.siblings ?? [node];\n const reports = descendantCount(node);\n const open = expanded.has(node.id);\n return (\n <li key={node.id} id={`${element.id}-${node.id}`} role='treeitem' tabIndex={node.id === tabStop ? 0 : -1} aria-level={node.depth}\n aria-setsize={siblings.length} aria-posinset={siblings.findIndex(sibling => sibling.id === node.id) + 1} aria-expanded={node.children.length > 0 ? open : undefined} aria-selected={node.id === selected}\n className='foundation-tree-item' data-selected={node.id === selected} style={{ paddingInlineStart: `calc(var(--foundation-space-4) * ${node.depth - 1})` }}\n onKeyDown={event => move(node, event)} onFocus={() => setFocused(node.id)} onClick={() => { setSelected(node.id); interactions?.onSelect?.(); }}>\n {node.children.length > 0 ? (\n <button type='button' tabIndex={-1} className='foundation-icon-button' aria-hidden='true'\n onClick={event => { event.stopPropagation(); setExpanded(current => { const next = new Set(current); if (open) next.delete(node.id); else next.add(node.id); return next; }); }}>\n <FoundationIcon name={open ? 'chevron-down' : 'chevron-right'} />\n </button>\n ) : <span className='foundation-tree-spacer' />}\n <span className='foundation-tree-text'>\n <strong>{node.label}</strong>\n {node.title && <span className='foundation-count'>{node.title}</span>}\n </span>\n {reports > 0 && <span className='foundation-count'>{formatText(strings.orgReports, { count: reports })}</span>}\n </li>\n );\n })}\n </ul>\n )}\n </FoundationFrame>\n );\n}\n"],"names":["OrgTree","element","interactions","bindingOutputs","nodes","useMemo","readOrgNodes","properties","roots","buildOrgTree","depth","expandedDepth","initial","expandedToDepth","expanded","setExpanded","useState","selected","setSelected","undefined","focused","setFocused","strings","readFoundationStrings","state","readComponentState","length","visible","visibleNodes","placed","placements","tabStop","find","node","id","emptyElement","ComponentState","Empty","emptyHeadline","orgNone","useEffect","useValueOutput","move","event","index","indexOf","focus","target","preventDefault","requestAnimationFrame","document","getElementById","toggle","open","current","next","Set","add","delete","parent","get","key","children","has","onSelect","_jsx","FoundationFrame","name","skeleton","Ready","Partial","ul","role","aria-label","orgTree","className","map","siblings","reports","descendantCount","_jsxs","li","tabIndex","aria-level","aria-setsize","aria-posinset","findIndex","sibling","aria-expanded","aria-selected","data-selected","style","paddingInlineStart","onKeyDown","onFocus","onClick","button","type","aria-hidden","stopPropagation","FoundationIcon","span","strong","label","title","formatText","orgReports","count"],"mappings":";;;;;;;;;;;AAWA;;;;;;;IAQO,SAASA,OAAAA,CAAQ,EAAEC,OAAO,EAAEC,YAAY,EAAEC,cAAc,EAA4B,EAAA;IACvF,MAAMC,KAAAA,GAAQC,cAAQ,IAAMC,qBAAAA,CAAaL,QAAQM,UAAU,CAACH,KAAK,CAAA,EAAG;QAACH,OAAAA,CAAQM,UAAU,CAACH;AAAM,KAAA,CAAA;AAC9F,IAAA,MAAMI,KAAAA,GAAQH,aAAAA,CAAQ,IAAMI,qBAAAA,CAAaL,KAAAA,CAAAA,EAAQ;AAACA,QAAAA;AAAM,KAAA,CAAA;AACxD,IAAA,MAAMM,KAAAA,GAAQ,OAAOT,OAAAA,CAAQM,UAAU,CAACI,aAAa,KAAK,QAAA,GAAWV,OAAAA,CAAQM,UAAU,CAACI,aAAa,GAAG,CAAA;AACxG,IAAA,MAAMC,OAAAA,GAAUP,aAAAA,CAAQ,IAAMQ,wBAAAA,CAAgBL,OAAOE,KAAAA,CAAAA,EAAQ;AAACF,QAAAA,KAAAA;AAAOE,QAAAA;AAAM,KAAA,CAAA;AAC3E,IAAA,MAAM,CAACI,QAAAA,EAAUC,WAAAA,CAAY,GAAGC,cAAAA,CAAsBJ,OAAAA,CAAAA;AACtD,IAAA,MAAM,CAACK,QAAAA,EAAUC,WAAAA,CAAY,GAAGF,cAAAA,CAA6B,OAAOf,OAAAA,CAAQM,UAAU,CAACU,QAAQ,KAAK,QAAA,GAAWhB,OAAAA,CAAQM,UAAU,CAACU,QAAQ,GAAGE,SAAAA,CAAAA;AAC7I,IAAA,MAAM,CAACC,OAAAA,EAASC,UAAAA,C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