@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.
Files changed (105) hide show
  1. package/ComponentName.ts +9 -0
  2. package/defaultBlueprintComponents.ts +4 -1
  3. package/dist/cjs/ComponentName.js +3 -0
  4. package/dist/cjs/ComponentName.js.map +1 -1
  5. package/dist/cjs/defaultBlueprint.js +1 -0
  6. package/dist/cjs/defaultBlueprint.js.map +1 -1
  7. package/dist/cjs/defaultBlueprintComponentMetadata.js +1 -0
  8. package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
  9. package/dist/cjs/defaultBlueprintComponents.js +7 -1
  10. package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
  11. package/dist/cjs/foundation/ApprovalChainStepper.js +130 -0
  12. package/dist/cjs/foundation/ApprovalChainStepper.js.map +1 -0
  13. package/dist/cjs/foundation/OrgTree.js +188 -0
  14. package/dist/cjs/foundation/OrgTree.js.map +1 -0
  15. package/dist/cjs/foundation/PermissionMatrix.js +136 -0
  16. package/dist/cjs/foundation/PermissionMatrix.js.map +1 -0
  17. package/dist/cjs/foundation/approvalModel.js +87 -0
  18. package/dist/cjs/foundation/approvalModel.js.map +1 -0
  19. package/dist/cjs/foundation/foundationComponentMetadata.js +21 -0
  20. package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
  21. package/dist/cjs/foundation/foundationDescriptors.js +118 -0
  22. package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
  23. package/dist/cjs/foundation/foundationSamples.js +116 -0
  24. package/dist/cjs/foundation/foundationSamples.js.map +1 -1
  25. package/dist/cjs/foundation/foundationStrings.js +12 -1
  26. package/dist/cjs/foundation/foundationStrings.js.map +1 -1
  27. package/dist/cjs/foundation/orgModel.js +106 -0
  28. package/dist/cjs/foundation/orgModel.js.map +1 -0
  29. package/dist/cjs/foundation/permissionModel.js +84 -0
  30. package/dist/cjs/foundation/permissionModel.js.map +1 -0
  31. package/dist/cjs/index.js +26 -0
  32. package/dist/cjs/index.js.map +1 -1
  33. package/dist/esm/ComponentName.d.ts +4 -1
  34. package/dist/esm/ComponentName.d.ts.map +1 -1
  35. package/dist/esm/ComponentName.js +3 -0
  36. package/dist/esm/ComponentName.js.map +1 -1
  37. package/dist/esm/defaultBlueprint.js +1 -0
  38. package/dist/esm/defaultBlueprint.js.map +1 -1
  39. package/dist/esm/defaultBlueprintComponentMetadata.js +1 -0
  40. package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
  41. package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
  42. package/dist/esm/defaultBlueprintComponents.js +7 -1
  43. package/dist/esm/defaultBlueprintComponents.js.map +1 -1
  44. package/dist/esm/foundation/ApprovalChainStepper.d.ts +3 -0
  45. package/dist/esm/foundation/ApprovalChainStepper.d.ts.map +1 -0
  46. package/dist/esm/foundation/ApprovalChainStepper.js +128 -0
  47. package/dist/esm/foundation/ApprovalChainStepper.js.map +1 -0
  48. package/dist/esm/foundation/Foundation.stories.d.ts +8 -0
  49. package/dist/esm/foundation/Foundation.stories.d.ts.map +1 -1
  50. package/dist/esm/foundation/Foundation.stories.js +8 -0
  51. package/dist/esm/foundation/Foundation.stories.js.map +1 -1
  52. package/dist/esm/foundation/OrgTree.d.ts +3 -0
  53. package/dist/esm/foundation/OrgTree.d.ts.map +1 -0
  54. package/dist/esm/foundation/OrgTree.js +186 -0
  55. package/dist/esm/foundation/OrgTree.js.map +1 -0
  56. package/dist/esm/foundation/PermissionMatrix.d.ts +3 -0
  57. package/dist/esm/foundation/PermissionMatrix.d.ts.map +1 -0
  58. package/dist/esm/foundation/PermissionMatrix.js +134 -0
  59. package/dist/esm/foundation/PermissionMatrix.js.map +1 -0
  60. package/dist/esm/foundation/approvalModel.d.ts +27 -0
  61. package/dist/esm/foundation/approvalModel.d.ts.map +1 -0
  62. package/dist/esm/foundation/approvalModel.js +81 -0
  63. package/dist/esm/foundation/approvalModel.js.map +1 -0
  64. package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
  65. package/dist/esm/foundation/foundationComponentMetadata.js +21 -0
  66. package/dist/esm/foundation/foundationComponentMetadata.js.map +1 -1
  67. package/dist/esm/foundation/foundationDescriptors.d.ts.map +1 -1
  68. package/dist/esm/foundation/foundationDescriptors.js +118 -0
  69. package/dist/esm/foundation/foundationDescriptors.js.map +1 -1
  70. package/dist/esm/foundation/foundationSamples.d.ts.map +1 -1
  71. package/dist/esm/foundation/foundationSamples.js +116 -0
  72. package/dist/esm/foundation/foundationSamples.js.map +1 -1
  73. package/dist/esm/foundation/foundationStrings.d.ts +11 -0
  74. package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
  75. package/dist/esm/foundation/foundationStrings.js +12 -1
  76. package/dist/esm/foundation/foundationStrings.js.map +1 -1
  77. package/dist/esm/foundation/index.d.ts +6 -0
  78. package/dist/esm/foundation/index.d.ts.map +1 -1
  79. package/dist/esm/foundation/index.js +6 -0
  80. package/dist/esm/foundation/index.js.map +1 -1
  81. package/dist/esm/foundation/orgModel.d.ts +20 -0
  82. package/dist/esm/foundation/orgModel.d.ts.map +1 -0
  83. package/dist/esm/foundation/orgModel.js +99 -0
  84. package/dist/esm/foundation/orgModel.js.map +1 -0
  85. package/dist/esm/foundation/permissionModel.d.ts +24 -0
  86. package/dist/esm/foundation/permissionModel.d.ts.map +1 -0
  87. package/dist/esm/foundation/permissionModel.js +77 -0
  88. package/dist/esm/foundation/permissionModel.js.map +1 -0
  89. package/dist/esm/index.js +6 -0
  90. package/dist/esm/index.js.map +1 -1
  91. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  92. package/foundation/ApprovalChainStepper.tsx +66 -0
  93. package/foundation/Foundation.stories.tsx +8 -0
  94. package/foundation/OrgTree.tsx +101 -0
  95. package/foundation/PermissionMatrix.tsx +82 -0
  96. package/foundation/approvalModel.ts +88 -0
  97. package/foundation/foundationComponentMetadata.ts +3 -0
  98. package/foundation/foundationDescriptors.ts +74 -0
  99. package/foundation/foundationSamples.ts +30 -0
  100. package/foundation/foundationStrings.ts +11 -0
  101. package/foundation/index.ts +6 -0
  102. package/foundation/orgModel.ts +85 -0
  103. package/foundation/permissionModel.ts +85 -0
  104. package/package.json +8 -8
  105. package/shell/layout.css +184 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orgModel.js","sources":["../../../foundation/orgModel.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/** A person or unit in an organization, with who they report to. */\nexport interface OrgNode {\n id: string;\n label: string;\n title?: string;\n parentId?: string;\n}\n\n/** A node placed in the tree. */\nexport interface OrgTreeNode extends OrgNode {\n children: OrgTreeNode[];\n depth: number;\n}\n\n/** Reads nodes out of a property value, dropping entries without an id and keeping the first of a repeated id. */\nexport function readOrgNodes(value: unknown): OrgNode[] {\n if (!Array.isArray(value)) return [];\n\n const seen = new Set<string>();\n return value.flatMap((entry): OrgNode[] => {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) return [];\n const { id, label, title, parentId } = entry as Record<string, unknown>;\n if (typeof id !== 'string' || id.length === 0 || seen.has(id)) return [];\n seen.add(id);\n return [{ id, label: typeof label === 'string' && label.length > 0 ? label : id, ...(typeof title === 'string' ? { title } : {}), ...(typeof parentId === 'string' && parentId.length > 0 ? { parentId } : {}) }];\n });\n}\n\n/**\n * Builds the tree from the flat rows a query returns.\n *\n * Someone whose manager is not in the data becomes a root rather than vanishing, and a reporting cycle is broken at the node that closes it\n * - which becomes a root - so malformed data draws something and never loops. Siblings keep the order of the rows.\n */\nexport function buildOrgTree(nodes: OrgNode[]): OrgTreeNode[] {\n const known = new Set(nodes.map(node => node.id));\n const parentOf = new Map<string, string | undefined>(nodes.map(node => [node.id, node.parentId !== undefined && known.has(node.parentId) && node.parentId !== node.id ? node.parentId : undefined]));\n\n for (const node of nodes) {\n const path = new Set<string>([node.id]);\n for (let current = parentOf.get(node.id); current !== undefined; current = parentOf.get(current)) {\n if (path.has(current)) { parentOf.set(node.id, undefined); break; }\n path.add(current);\n }\n }\n\n const placed = new Map<string, OrgTreeNode>(nodes.map(node => [node.id, { ...node, children: [], depth: 0 }]));\n const roots: OrgTreeNode[] = [];\n for (const node of nodes) {\n const parent = parentOf.get(node.id);\n if (parent === undefined) roots.push(placed.get(node.id)!);\n else placed.get(parent)!.children.push(placed.get(node.id)!);\n }\n\n const assignDepth = (level: OrgTreeNode[], depth: number) => level.forEach(node => { node.depth = depth; assignDepth(node.children, depth + 1); });\n assignDepth(roots, 1);\n return roots;\n}\n\n/** The nodes that can be reached from the roots with the given expansion, in the order they are drawn. */\nexport function visibleNodes(roots: OrgTreeNode[], expanded: ReadonlySet<string>): OrgTreeNode[] {\n return roots.flatMap(node => [node, ...(expanded.has(node.id) ? visibleNodes(node.children, expanded) : [])]);\n}\n\n/** The ids of every node down to a depth: what is expanded when the tree first opens. */\nexport function expandedToDepth(roots: OrgTreeNode[], depth: number): Set<string> {\n const result = new Set<string>();\n const walk = (level: OrgTreeNode[]) => level.forEach(node => { if (node.depth < depth && node.children.length > 0) result.add(node.id); walk(node.children); });\n walk(roots);\n return result;\n}\n\n/** The number of people below a node, at any depth. */\nexport const descendantCount = (node: OrgTreeNode): number => node.children.reduce((sum, child) => sum + 1 + descendantCount(child), 0);\n\n/** For each node, the nodes that share its parent (itself included, in order) and its parent: what a tree needs for its set size and position, and for Left to go up. */\nexport function placements(roots: OrgTreeNode[]): Map<string, { siblings: OrgTreeNode[]; parent?: OrgTreeNode }> {\n const result = new Map<string, { siblings: OrgTreeNode[]; parent?: OrgTreeNode }>();\n const walk = (level: OrgTreeNode[], parent?: OrgTreeNode) => level.forEach(node => { result.set(node.id, { siblings: level, parent }); walk(node.children, node); });\n walk(roots);\n return result;\n}\n"],"names":["readOrgNodes","value","Array","isArray","seen","Set","flatMap","entry","id","label","title","parentId","length","has","add","buildOrgTree","nodes","known","map","node","parentOf","Map","undefined","path","current","get","set","placed","children","depth","roots","parent","push","assignDepth","level","forEach","visibleNodes","expanded","expandedToDepth","result","walk","descendantCount","reduce","sum","child","placements","siblings"],"mappings":";;AAAA;AACA;AAEA,wLAeO,SAASA,aAAaC,KAAc,EAAA;AACvC,IAAA,IAAI,CAACC,KAAAA,CAAMC,OAAO,CAACF,KAAAA,CAAAA,EAAQ,OAAO,EAAE;AAEpC,IAAA,MAAMG,OAAO,IAAIC,GAAAA,EAAAA;IACjB,OAAOJ,KAAAA,CAAMK,OAAO,CAAC,CAACC,KAAAA,GAAAA;QAClB,IAAI,OAAOA,KAAAA,KAAU,QAAA,IAAYA,KAAAA,KAAU,IAAA,IAAQL,MAAMC,OAAO,CAACI,KAAAA,CAAAA,EAAQ,OAAO,EAAE;QAClF,MAAM,EAAEC,EAAE,EAAEC,KAAK,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGJ,KAAAA;AACvC,QAAA,IAAI,OAAOC,EAAAA,KAAO,QAAA,IAAYA,EAAAA,CAAGI,MAAM,KAAK,CAAA,IAAKR,IAAAA,CAAKS,GAAG,CAACL,EAAAA,CAAAA,EAAK,OAAO,EAAE;AACxEJ,QAAAA,IAAAA,CAAKU,GAAG,CAACN,EAAAA,CAAAA;QACT,OAAO;AAAC,YAAA;AAAEA,gBAAAA,EAAAA;AAAIC,gBAAAA,KAAAA,EAAO,OAAOA,KAAAA,KAAU,QAAA,IAAYA,MAAMG,MAAM,GAAG,IAAIH,KAAAA,GAAQD,EAAAA;gBAAI,GAAI,OAAOE,UAAU,QAAA,GAAW;AAAEA,oBAAAA;AAAM,iBAAA,GAAI,EAAE;AAAG,gBAAA,GAAI,OAAOC,QAAAA,KAAa,QAAA,IAAYA,QAAAA,CAASC,MAAM,GAAG,CAAA,GAAI;AAAED,oBAAAA;AAAS,iBAAA,GAAI;AAAI;AAAE,SAAA;AACrN,IAAA,CAAA,CAAA;AACJ;AAEA;;;;;IAMO,SAASI,YAAAA,CAAaC,KAAgB,EAAA;IACzC,MAAM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ACnB,IAAA,MAAMmC,OAAO,CAACN,KAAAA,GAAyBA,KAAAA,CAAMC,OAAO,CAAChB,CAAAA,IAAAA,GAAAA;AAAU,YAAA,IAAIA,IAAAA,CAAKU,KAAK,GAAGA,KAAAA,IAASV,KAAKS,QAAQ,CAAChB,MAAM,GAAG,CAAA,EAAG2B,MAAAA,CAAOzB,GAAG,CAACK,KAAKX,EAAE,CAAA;AAAGgC,YAAAA,IAAAA,CAAKrB,KAAKS,QAAQ,CAAA;AAAG,QAAA,CAAA,CAAA;IAC7JY,IAAAA,CAAKV,KAAAA,CAAAA;IACL,OAAOS,MAAAA;AACX;AAEA,wDACO,MAAME,kBAAkB,CAACtB,IAAAA,GAA8BA,KAAKS,QAAQ,CAACc,MAAM,CAAC,CAACC,GAAAA,EAAKC,KAAAA,GAAUD,MAAM,CAAA,GAAIF,eAAAA,CAAgBG,QAAQ,CAAA;AAErI,0KACO,SAASC,UAAAA,CAAWf,KAAoB,EAAA;AAC3C,IAAA,MAAMS,SAAS,IAAIlB,GAAAA,EAAAA;AACnB,IAAA,MAAMmB,OAAO,CAACN,KAAAA,EAAsBH,SAAyBG,KAAAA,CAAMC,OAAO,CAAChB,CAAAA,IAAAA,GAAAA;AAAUoB,YAAAA,MAAAA,CAAOb,GAAG,CAACP,IAAAA,CAAKX,EAAE,EAAE;gBAAEsC,QAAAA,EAAUZ,KAAAA;AAAOH,gBAAAA;AAAO,aAAA,CAAA;YAAIS,IAAAA,CAAKrB,IAAAA,CAAKS,QAAQ,EAAET,IAAAA,CAAAA;AAAO,QAAA,CAAA,CAAA;IAClKqB,IAAAA,CAAKV,KAAAA,CAAAA;IACL,OAAOS,MAAAA;AACX;;;;;;;"}
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /** A role: a column of the matrix. */ const records = (value)=>Array.isArray(value) ? value.filter((entry)=>typeof entry === 'object' && entry !== null && !Array.isArray(entry)) : [];
6
+ /** Reads roles, dropping those without an id and repeated ids. */ function readRoles(value) {
7
+ const seen = new Set();
8
+ return records(value).flatMap((entry)=>{
9
+ if (typeof entry.id !== 'string' || entry.id.length === 0 || seen.has(entry.id)) return [];
10
+ seen.add(entry.id);
11
+ return [
12
+ {
13
+ id: entry.id,
14
+ label: typeof entry.label === 'string' && entry.label.length > 0 ? entry.label : entry.id
15
+ }
16
+ ];
17
+ });
18
+ }
19
+ /** Reads permissions, dropping those without an id and repeated ids. */ function readPermissions(value) {
20
+ const seen = new Set();
21
+ return records(value).flatMap((entry)=>{
22
+ if (typeof entry.id !== 'string' || entry.id.length === 0 || seen.has(entry.id)) return [];
23
+ seen.add(entry.id);
24
+ return [
25
+ {
26
+ id: entry.id,
27
+ label: typeof entry.label === 'string' && entry.label.length > 0 ? entry.label : entry.id,
28
+ ...typeof entry.group === 'string' && entry.group.length > 0 ? {
29
+ group: entry.group
30
+ } : {}
31
+ }
32
+ ];
33
+ });
34
+ }
35
+ /** Reads grants, keeping each pair once and only for a role and a permission that exist: a grant of something that was deleted is not shown as held. */ function readGrants(value, roles, permissions) {
36
+ const roleIds = new Set(roles.map((role)=>role.id));
37
+ const permissionIds = new Set(permissions.map((permission)=>permission.id));
38
+ const seen = new Set();
39
+ return records(value).flatMap((entry)=>{
40
+ const { role, permission } = entry;
41
+ if (typeof role !== 'string' || typeof permission !== 'string' || !roleIds.has(role) || !permissionIds.has(permission)) return [];
42
+ const key = `${role}\u0000${permission}`;
43
+ if (seen.has(key)) return [];
44
+ seen.add(key);
45
+ return [
46
+ {
47
+ role,
48
+ permission
49
+ }
50
+ ];
51
+ });
52
+ }
53
+ /** Whether a role holds a permission. */ const isGranted = (grants, role, permission)=>grants.some((grant)=>grant.role === role && grant.permission === permission);
54
+ /** Grants a permission to a role, or takes it away, leaving every other grant as it was. */ const setGrant = (grants, role, permission, granted)=>granted ? isGranted(grants, role, permission) ? grants : [
55
+ ...grants,
56
+ {
57
+ role,
58
+ permission
59
+ }
60
+ ] : grants.filter((grant)=>!(grant.role === role && grant.permission === permission));
61
+ /** Groups the permissions into runs by their group, in the order first seen, with the ungrouped ones in a run of their own. */ function sectionsOf(permissions) {
62
+ const sections = [];
63
+ for (const permission of permissions){
64
+ const section = sections.find((candidate)=>candidate.group === permission.group);
65
+ if (section) section.permissions.push(permission);
66
+ else sections.push({
67
+ ...permission.group === undefined ? {} : {
68
+ group: permission.group
69
+ },
70
+ permissions: [
71
+ permission
72
+ ]
73
+ });
74
+ }
75
+ return sections;
76
+ }
77
+
78
+ exports.isGranted = isGranted;
79
+ exports.readGrants = readGrants;
80
+ exports.readPermissions = readPermissions;
81
+ exports.readRoles = readRoles;
82
+ exports.sectionsOf = sectionsOf;
83
+ exports.setGrant = setGrant;
84
+ //# sourceMappingURL=permissionModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"permissionModel.js","sources":["../../../foundation/permissionModel.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/** A role: a column of the matrix. */\nexport interface MatrixRole {\n id: string;\n label: string;\n}\n\n/** A permission: a row of the matrix, optionally in a named group. */\nexport interface MatrixPermission {\n id: string;\n label: string;\n group?: string;\n}\n\n/** One role holding one permission. */\nexport interface MatrixGrant {\n role: string;\n permission: string;\n}\n\n/** A named run of permissions, for the group heading rows. */\nexport interface MatrixSection {\n group?: string;\n permissions: MatrixPermission[];\n}\n\nconst records = (value: unknown): Record<string, unknown>[] =>\n Array.isArray(value) ? value.filter((entry): entry is Record<string, unknown> => typeof entry === 'object' && entry !== null && !Array.isArray(entry)) : [];\n\n/** Reads roles, dropping those without an id and repeated ids. */\nexport function readRoles(value: unknown): MatrixRole[] {\n const seen = new Set<string>();\n return records(value).flatMap(entry => {\n if (typeof entry.id !== 'string' || entry.id.length === 0 || seen.has(entry.id)) return [];\n seen.add(entry.id);\n return [{ id: entry.id, label: typeof entry.label === 'string' && entry.label.length > 0 ? entry.label : entry.id }];\n });\n}\n\n/** Reads permissions, dropping those without an id and repeated ids. */\nexport function readPermissions(value: unknown): MatrixPermission[] {\n const seen = new Set<string>();\n return records(value).flatMap(entry => {\n if (typeof entry.id !== 'string' || entry.id.length === 0 || seen.has(entry.id)) return [];\n seen.add(entry.id);\n return [{ id: entry.id, label: typeof entry.label === 'string' && entry.label.length > 0 ? entry.label : entry.id, ...(typeof entry.group === 'string' && entry.group.length > 0 ? { group: entry.group } : {}) }];\n });\n}\n\n/** Reads grants, keeping each pair once and only for a role and a permission that exist: a grant of something that was deleted is not shown as held. */\nexport function readGrants(value: unknown, roles: MatrixRole[], permissions: MatrixPermission[]): MatrixGrant[] {\n const roleIds = new Set(roles.map(role => role.id));\n const permissionIds = new Set(permissions.map(permission => permission.id));\n const seen = new Set<string>();\n\n return records(value).flatMap(entry => {\n const { role, permission } = entry;\n if (typeof role !== 'string' || typeof permission !== 'string' || !roleIds.has(role) || !permissionIds.has(permission)) return [];\n const key = `${role}\\u0000${permission}`;\n if (seen.has(key)) return [];\n seen.add(key);\n return [{ role, permission }];\n });\n}\n\n/** Whether a role holds a permission. */\nexport const isGranted = (grants: MatrixGrant[], role: string, permission: string): boolean => grants.some(grant => grant.role === role && grant.permission === permission);\n\n/** Grants a permission to a role, or takes it away, leaving every other grant as it was. */\nexport const setGrant = (grants: MatrixGrant[], role: string, permission: string, granted: boolean): MatrixGrant[] =>\n granted ? (isGranted(grants, role, permission) ? grants : [...grants, { role, permission }]) : grants.filter(grant => !(grant.role === role && grant.permission === permission));\n\n/** Groups the permissions into runs by their group, in the order first seen, with the ungrouped ones in a run of their own. */\nexport function sectionsOf(permissions: MatrixPermission[]): MatrixSection[] {\n const sections: MatrixSection[] = [];\n for (const permission of permissions) {\n const section = sections.find(candidate => candidate.group === permission.group);\n if (section) section.permissions.push(permission);\n else sections.push({ ...(permission.group === undefined ? {} : { group: permission.group }), permissions: [permission] });\n }\n\n return sections;\n}\n"],"names":["records","value","Array","isArray","filter","entry","readRoles","seen","Set","flatMap","id","length","has","add","label","readPermissions","group","readGrants","roles","permissions","roleIds","map","role","permissionIds","permission","key","isGranted","grants","some","grant","setGrant","granted","sectionsOf","sections","section","find","candidate","push","undefined"],"mappings":";;AAAA;AACA;AAEA,uCAyBA,MAAMA,OAAAA,GAAU,CAACC,KAAAA,GACbC,MAAMC,OAAO,CAACF,KAAAA,CAAAA,GAASA,KAAAA,CAAMG,MAAM,CAAC,CAACC,KAAAA,GAA4C,OAAOA,KAAAA,KAAU,QAAA,IAAYA,KAAAA,KAAU,IAAA,IAAQ,CAACH,KAAAA,CAAMC,OAAO,CAACE,KAAAA,CAAAA,CAAAA,GAAU,EAAE;AAE/J,mEACO,SAASC,SAAAA,CAAUL,KAAc,EAAA;AACpC,IAAA,MAAMM,OAAO,IAAIC,GAAAA,EAAAA;AACjB,IAAA,OAAOR,OAAAA,CAAQC,KAAAA,CAAAA,CAAOQ,OAAO,CAACJ,CAAAA,KAAAA,GAAAA;AAC1B,QAAA,IAAI,OAAOA,KAAAA,CAAMK,EAAE,KAAK,QAAA,IAAYL,KAAAA,CAAMK,EAAE,CAACC,MAAM,KAAK,CAAA,IAAKJ,KAAKK,GAAG,CAACP,MAAMK,EAAE,CAAA,EAAG,OAAO,EAAE;QAC1FH,IAAAA,CAAKM,GAAG,CAACR,KAAAA,CAAMK,EAAE,CAAA;QACjB,OAAO;AAAC,YAAA;AAAEA,gBAAAA,EAAAA,EAAIL,MAAMK,EAAE;AAAEI,gBAAAA,KAAAA,EAAO,OAAOT,KAAAA,CAAMS,KAAK,KAAK,YAAYT,KAAAA,CAAMS,KAAK,CAACH,MAAM,GAAG,CAAA,GAAIN,KAAAA,CAAMS,KAAK,GAAGT,MAAMK;AAAG;AAAE,SAAA;AACxH,IAAA,CAAA,CAAA;AACJ;AAEA,yEACO,SAASK,eAAAA,CAAgBd,KAAc,EAAA;AAC1C,IAAA,MAAMM,OAAO,IAAIC,GAAAA,EAAAA;AACjB,IAAA,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;AACtD,IAAA,MAAMc,WAA4B,EAAE;IACpC,KAAK,MAAMT,cAAcL,WAAAA,CAAa;QAClC,MAAMe,OAAAA,GAAUD,QAAAA,CAASE,IAAI,CAACC,CAAAA,YAAaA,SAAAA,CAAUpB,KAAK,KAAKQ,UAAAA,CAAWR,KAAK,CAAA;AAC/E,QAAA,IAAIkB,OAAAA,EAASA,OAAAA,CAAQf,WAAW,CAACkB,IAAI,CAACb,UAAAA,CAAAA;AACjCS,aAAAA,QAAAA,CAASI,IAAI,CAAC;AAAE,YAAA,GAAIb,UAAAA,CAAWR,KAAK,KAAKsB,SAAAA,GAAY,EAAC,GAAI;AAAEtB,gBAAAA,KAAAA,EAAOQ,WAAWR;aAAO;YAAGG,WAAAA,EAAa;AAACK,gBAAAA;AAAW;AAAC,SAAA,CAAA;AAC3H,IAAA;IAEA,OAAOS,QAAAA;AACX;;;;;;;"}
package/dist/cjs/index.js CHANGED
@@ -83,6 +83,12 @@ var AvatarStack = require('./foundation/AvatarStack.js');
83
83
  var uploadModel = require('./foundation/uploadModel.js');
84
84
  var FileUploaderHandler = require('./foundation/FileUploaderHandler.js');
85
85
  var FileUploader = require('./foundation/FileUploader.js');
86
+ var approvalModel = require('./foundation/approvalModel.js');
87
+ var ApprovalChainStepper = require('./foundation/ApprovalChainStepper.js');
88
+ var orgModel = require('./foundation/orgModel.js');
89
+ var OrgTree = require('./foundation/OrgTree.js');
90
+ var permissionModel = require('./foundation/permissionModel.js');
91
+ var PermissionMatrix = require('./foundation/PermissionMatrix.js');
86
92
  var foundationDescriptors = require('./foundation/foundationDescriptors.js');
87
93
  var foundationComponentMetadata = require('./foundation/foundationComponentMetadata.js');
88
94
  var foundationSamples = require('./foundation/foundationSamples.js');
@@ -349,6 +355,26 @@ exports.matchesAccept = uploadModel.matchesAccept;
349
355
  exports.FileUploaderHandlerProvider = FileUploaderHandler.FileUploaderHandlerProvider;
350
356
  exports.useFileUploaderHandler = FileUploaderHandler.useFileUploaderHandler;
351
357
  exports.FileUploader = FileUploader.FileUploader;
358
+ exports.ApprovalState = approvalModel.ApprovalState;
359
+ exports.ChainOutcome = approvalModel.ChainOutcome;
360
+ exports.chainOutcome = approvalModel.chainOutcome;
361
+ exports.effectiveSteps = approvalModel.effectiveSteps;
362
+ exports.readSteps = approvalModel.readSteps;
363
+ exports.ApprovalChainStepper = ApprovalChainStepper.ApprovalChainStepper;
364
+ exports.buildOrgTree = orgModel.buildOrgTree;
365
+ exports.descendantCount = orgModel.descendantCount;
366
+ exports.expandedToDepth = orgModel.expandedToDepth;
367
+ exports.placements = orgModel.placements;
368
+ exports.readOrgNodes = orgModel.readOrgNodes;
369
+ exports.visibleNodes = orgModel.visibleNodes;
370
+ exports.OrgTree = OrgTree.OrgTree;
371
+ exports.isGranted = permissionModel.isGranted;
372
+ exports.readGrants = permissionModel.readGrants;
373
+ exports.readPermissions = permissionModel.readPermissions;
374
+ exports.readRoles = permissionModel.readRoles;
375
+ exports.sectionsOf = permissionModel.sectionsOf;
376
+ exports.setGrant = permissionModel.setGrant;
377
+ exports.PermissionMatrix = PermissionMatrix.PermissionMatrix;
352
378
  exports.bindable = foundationDescriptors.bindable;
353
379
  exports.foundationDescriptors = foundationDescriptors.foundationDescriptors;
354
380
  exports.list = foundationDescriptors.list;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -26,6 +26,9 @@ export declare enum ComponentName {
26
26
  ChecklistSection = "checklistSection",
27
27
  ActivityFeed = "activityFeed",
28
28
  AvatarStack = "avatarStack",
29
- FileUploader = "fileUploader"
29
+ FileUploader = "fileUploader",
30
+ ApprovalChainStepper = "approvalChainStepper",
31
+ OrgTree = "orgTree",
32
+ PermissionMatrix = "permissionMatrix"
30
33
  }
31
34
  //# sourceMappingURL=ComponentName.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComponentName.d.ts","sourceRoot":"","sources":["../../ComponentName.ts"],"names":[],"mappings":"AAWA,oBAAY,aAAa;IAErB,QAAQ,aAAa;IAGrB,aAAa,kBAAkB;IAG/B,MAAM,WAAW;IAGjB,OAAO,YAAY;IAGnB,IAAI,SAAS;IAGb,QAAQ,aAAa;IAGrB,UAAU,eAAe;IAGzB,MAAM,WAAW;IAGjB,UAAU,eAAe;IAGzB,WAAW,gBAAgB;IAG3B,UAAU,eAAe;IAGzB,IAAI,SAAS;IAGb,IAAI,SAAS;IAGb,QAAQ,aAAa;IAGrB,aAAa,kBAAkB;IAG/B,kBAAkB,uBAAuB;IAGzC,UAAU,eAAe;IAGzB,QAAQ,aAAa;IAGrB,SAAS,cAAc;IAGvB,UAAU,eAAe;IAGzB,YAAY,iBAAiB;IAG7B,aAAa,kBAAkB;IAG/B,aAAa,kBAAkB;IAG/B,cAAc,mBAAmB;IAGjC,gBAAgB,qBAAqB;IAGrC,YAAY,iBAAiB;IAG7B,WAAW,gBAAgB;IAG3B,YAAY,iBAAiB;CAChC"}
1
+ {"version":3,"file":"ComponentName.d.ts","sourceRoot":"","sources":["../../ComponentName.ts"],"names":[],"mappings":"AAWA,oBAAY,aAAa;IAErB,QAAQ,aAAa;IAGrB,aAAa,kBAAkB;IAG/B,MAAM,WAAW;IAGjB,OAAO,YAAY;IAGnB,IAAI,SAAS;IAGb,QAAQ,aAAa;IAGrB,UAAU,eAAe;IAGzB,MAAM,WAAW;IAGjB,UAAU,eAAe;IAGzB,WAAW,gBAAgB;IAG3B,UAAU,eAAe;IAGzB,IAAI,SAAS;IAGb,IAAI,SAAS;IAGb,QAAQ,aAAa;IAGrB,aAAa,kBAAkB;IAG/B,kBAAkB,uBAAuB;IAGzC,UAAU,eAAe;IAGzB,QAAQ,aAAa;IAGrB,SAAS,cAAc;IAGvB,UAAU,eAAe;IAGzB,YAAY,iBAAiB;IAG7B,aAAa,kBAAkB;IAG/B,aAAa,kBAAkB;IAG/B,cAAc,mBAAmB;IAGjC,gBAAgB,qBAAqB;IAGrC,YAAY,iBAAiB;IAG7B,WAAW,gBAAgB;IAG3B,YAAY,iBAAiB;IAG7B,oBAAoB,yBAAyB;IAG7C,OAAO,YAAY;IAGnB,gBAAgB,qBAAqB;CACxC"}
@@ -36,6 +36,9 @@
36
36
  /** What happened to a record, grouped by day. */ ComponentName["ActivityFeed"] = "activityFeed";
37
37
  /** Overlapping avatars for the people on a record. */ ComponentName["AvatarStack"] = "avatarStack";
38
38
  /** A drop zone and file picker with type and size checks. */ ComponentName["FileUploader"] = "fileUploader";
39
+ /** The steps a request goes through, who decides each, and where it stands. */ ComponentName["ApprovalChainStepper"] = "approvalChainStepper";
40
+ /** An organization as an expandable tree. */ ComponentName["OrgTree"] = "orgTree";
41
+ /** Roles across, permissions down, a checkbox where they meet. */ ComponentName["PermissionMatrix"] = "permissionMatrix";
39
42
  return ComponentName;
40
43
  }({});
41
44
 
@@ -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;AAlFnDA,IAAAA,OAAAA,aAAAA;AAoFX,CAAA,CAAA,EAAA;;"}
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;;"}
@@ -6,6 +6,7 @@ import './foundation/ComponentState.js';
6
6
  import 'react/jsx-runtime';
7
7
  import 'react';
8
8
  import './foundation/ActivityFeed.js';
9
+ import './foundation/ApprovalChainStepper.js';
9
10
  import { foundationDescriptors } from './foundation/foundationDescriptors.js';
10
11
  import './foundation/foundationComponentMetadata.js';
11
12
  import './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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAaA;;;;;;;;;;;;;;;;;;UAmBaA,wBAAAA,GAAyC;IAClDC,IAAAA,EAAMC,oBAAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,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,aAAAA,CAAAA;IAC1BC,OAAAA,EAASH,MAAAA,CAAOC,MAAM,CAACG,UAAAA,CAAAA;AACvBC,IAAAA,eAAAA,EAAiBC,uBAAuBC,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAAShB,IAAI,CAAA;AACrEiB,IAAAA,eAAAA,EAAiBC,uBAAuBH,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAAShB,IAAI,CAAA;AACrEmB,IAAAA,MAAAA,EAAQC,uBAAuBL,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,0BAAAA;IACZlB,OAAAA,EAASmB,cAAAA;IACTjB,eAAAA,EAAiBC,sBAAAA;IACjBG,eAAAA,EAAiBC,sBAAAA;IACjBa,OAAAA,EAASC,cAAAA;IACTb,MAAAA,EAAQC,sBAAAA;AACRa,IAAAA,WAAAA,EAAaC,kBAAAA,CAAmBnC,wBAAAA,CAAyBC,IAAI,EAAEmC,qBAAAA,EAAuBC,iCAAAA;AAC1F;;"}
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,oBAAAA;IACNC,OAAAA,EAAS,OAAA;AACTC,IAAAA,IAAAA,EAAMC,YAAYC,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,aAAAA,CAAAA;IAC1BC,OAAAA,EAASH,MAAAA,CAAOC,MAAM,CAACG,UAAAA,CAAAA;AACvBC,IAAAA,eAAAA,EAAiBC,uBAAuBC,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAAShB,IAAI,CAAA;AACrEiB,IAAAA,eAAAA,EAAiBC,uBAAuBH,GAAG,CAACC,CAAAA,QAAAA,GAAYA,SAAShB,IAAI,CAAA;AACrEmB,IAAAA,MAAAA,EAAQC,uBAAuBL,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,0BAAAA;IACZlB,OAAAA,EAASmB,cAAAA;IACTjB,eAAAA,EAAiBC,sBAAAA;IACjBG,eAAAA,EAAiBC,sBAAAA;IACjBa,OAAAA,EAASC,cAAAA;IACTb,MAAAA,EAAQC,sBAAAA;AACRa,IAAAA,WAAAA,EAAaC,kBAAAA,CAAmBnC,wBAAAA,CAAyBC,IAAI,EAAEmC,qBAAAA,EAAuBC,iCAAAA;AAC1F;;"}
@@ -4,6 +4,7 @@ import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import { componentMetadata, navigationDesignMode } from '@cratis/scene.react';
6
6
  import './foundation/ActivityFeed.js';
7
+ import './foundation/ApprovalChainStepper.js';
7
8
  import './foundation/foundationDescriptors.js';
8
9
  import { foundationComponentMetadata } from './foundation/foundationComponentMetadata.js';
9
10
  import './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":";;;;;;;;;;;AAAA;AACA;AAMA,6HACO,MAAMA,iCAAAA,GAAuE;AAChF,IAAA,GAAGC,2BAA2B;AAC9BC,IAAAA,QAAAA,EAAUC,iBAAAA,CAAE,mBAAA,EAAqBC,iBAAAA,CAAkBC,MAAM,EAAE,YAAA,EAAc;AAAC,QAAA,QAAA;AAAU,QAAA,OAAA;AAAS,QAAA;AAAS,KAAA,CAAA;AACtGC,IAAAA,aAAAA,EAAeH,iBAAAA,CAAE,iBAAA,EAAmBC,iBAAAA,CAAkBC,MAAM,EAAE,UAAA,EAAY;AAAC,QAAA,QAAA;AAAU,QAAA,YAAA;AAAc,QAAA;AAAQ,KAAA,CAAA;AAC3GE,IAAA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intComponentMetadata.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,2BAA2B;AAC9BC,IAAAA,QAAAA,EAAUC,iBAAAA,CAAE,mBAAA,EAAqBC,iBAAAA,CAAkBC,MAAM,EAAE,YAAA,EAAc;AAAC,QAAA,QAAA;AAAU,QAAA,OAAA;AAAS,QAAA;AAAS,KAAA,CAAA;AACtGC,IAAAA,aAAAA,EAAeH,iBAAAA,CAAE,iBAAA,EAAmBC,iBAAAA,CAAkBC,MAAM,EAAE,UAAA,EAAY;AAAC,QAAA,QAAA;AAAU,QAAA,YAAA;AAAc,QAAA;AAAQ,KAAA,CAAA;AAC3GE,IAAAA,MAAAA,EAAQJ,iBAAAA,CAAE,QAAA,EAAUC,iBAAAA,CAAkBI,UAAU,EAAE,WAAA,EAAa;AAAC,QAAA,QAAA;AAAU,QAAA,SAAA;AAAW,QAAA;AAAa,KAAA,EAAE,IAAA,EAAMC,oBAAAA,EAAAA,CAAAA;AAC1GC,IAAAA,OAAAA,EAASP,iBAAAA,CAAE,UAAA,EAAYC,iBAAAA,CAAkBI,UAAU,EAAE,YAAA,EAAc;AAAC,QAAA,YAAA;AAAc,QAAA,MAAA;AAAQ,QAAA;AAAa,KAAA,EAAE,MAAMC,oBAAAA,CAAqB;QAAEC,OAAAA,EAAS;AAAK,KAAA,CAAA,CAAA;AACpJC,IAAAA,IAAAA,EAAMR,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkB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AAA;AACtFC,IAAAA,IAAAA,EAAMjB,iBAAAA,CAAE,MAAA,EAAQC,iBAAAA,CAAkBiB,WAAW,EAAE,OAAA,EAAS;AAAC,QAAA,OAAA;AAAS,QAAA,UAAA;AAAY,QAAA;AAAQ,KAAA,CAAA;AACtFC,IAAAA,QAAAA,EAAUnB,iBAAAA,CAAE,WAAA,EAAaC,iBAAAA,CAAkBmB,OAAO,EAAE,aAAA,EAAe;AAAC,QAAA,SAAA;AAAW,QAAA,SAAA;AAAW,QAAA;AAAW,KAAA,CAAA;AACrGC,IAAAA,aAAAA,EAAerB,iBAAAA,CAAE,gBAAA,EAAkBC,iBAAAA,CAAkBmB,OAAO,EAAE,SAAA,EAAW;AAAC,QAAA,OAAA;AAAS,QAAA,WAAA;AAAa,QAAA;AAAS,KAAA,CAAA;AACzGE,IAAAA,kBAAAA,EAAoBtB,iBAAAA,CAAE,sBAAA,EAAwBC,iBAAAA,CAAkBmB,OAAO,EAAE,kBAAA,EAAoB;AAAC,QAAA,QAAA;AAAU,QAAA,MAAA;AAAQ,QAAA;AAAmB,KAAA;AACvI;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultBlueprintComponents.d.ts","sourceRoot":"","sources":["../../defaultBlueprintComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AA+B9E,eAAO,MAAM,0BAA0B,EAAE,iBA6BxC,CAAC"}
1
+ {"version":3,"file":"defaultBlueprintComponents.d.ts","sourceRoot":"","sources":["../../defaultBlueprintComponents.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAwB,MAAM,qBAAqB,CAAC;AA+B9E,eAAO,MAAM,0BAA0B,EAAE,iBAgCxC,CAAC"}
@@ -16,6 +16,9 @@ import { ChecklistSection } from './foundation/ChecklistSection.js';
16
16
  import { ActivityFeed } from './foundation/ActivityFeed.js';
17
17
  import { AvatarStack } from './foundation/AvatarStack.js';
18
18
  import { FileUploader } from './foundation/FileUploader.js';
19
+ import { ApprovalChainStepper } from './foundation/ApprovalChainStepper.js';
20
+ import { OrgTree } from './foundation/OrgTree.js';
21
+ import { PermissionMatrix } from './foundation/PermissionMatrix.js';
19
22
  import './foundation/foundationDescriptors.js';
20
23
  import './foundation/foundationComponentMetadata.js';
21
24
  import './foundation/foundationSamples.js';
@@ -73,7 +76,10 @@ import { LayoutModeSwitcher } from './shell/LayoutModeSwitcher.js';
73
76
  [componentRegistryKey(defaultBlueprintName, ComponentName.ChecklistSection)]: ChecklistSection,
74
77
  [componentRegistryKey(defaultBlueprintName, ComponentName.ActivityFeed)]: ActivityFeed,
75
78
  [componentRegistryKey(defaultBlueprintName, ComponentName.AvatarStack)]: AvatarStack,
76
- [componentRegistryKey(defaultBlueprintName, ComponentName.FileUploader)]: FileUploader
79
+ [componentRegistryKey(defaultBlueprintName, ComponentName.FileUploader)]: FileUploader,
80
+ [componentRegistryKey(defaultBlueprintName, ComponentName.ApprovalChainStepper)]: ApprovalChainStepper,
81
+ [componentRegistryKey(defaultBlueprintName, ComponentName.OrgTree)]: OrgTree,
82
+ [componentRegistryKey(defaultBlueprintName, ComponentName.PermissionMatrix)]: PermissionMatrix
77
83
  };
78
84
 
79
85
  export { 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAyBA;;;;;;;UAQaA,0BAAAA,GAAgD;AACzD,IAAA,CAACC,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcC,QAAQ,IAAIA,QAAAA;AACtE,IAAA,CAACH,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcE,aAAa,IAAIA,aAAAA;AAC3E,IAAA,CAACJ,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcG,MAAM,IAAIA,MAAAA;AACpE,IAAA,CAACL,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,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,QAAQ,IAAIA,QAAAA;AACtE,IAAA,CAACpB,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcmB,SAAS,IAAIA,SAAAA;AACvE,IAAA,CAACrB,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcoB,UAAU,IAAIA,UAAAA;AACxE,IAAA,CAACtB,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcqB,YAAY,IAAIA,YAAAA;AAC1E,IAAA,CAACvB,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcsB,aAAa,IAAIA,aAAAA;AAC3E,IAAA,CAACxB,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcuB,aAAa,IAAIA,aAAAA;AAC3E,IAAA,CAACzB,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcwB,cAAc,IAAIA,cAAAA;AAC5E,IAAA,CAAC1B,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAcyB,gBAAgB,IAAIA,gBAAAA;AAC9E,IAAA,CAAC3B,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAc0B,YAAY,IAAIA,YAAAA;AAC1E,IAAA,CAAC5B,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAc2B,WAAW,IAAIA,WAAAA;AACzE,IAAA,CAAC7B,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAc4B,YAAY,IAAIA;AAC9E;;"}
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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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7B,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAc4B,YAAY,IAAIA,YAAAA;AAC1E,IAAA,CAAC9B,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAc6B,oBAAoB,IAAIA,oBAAAA;AAClF,IAAA,CAAC/B,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAc8B,OAAO,IAAIA,OAAAA;AACrE,IAAA,CAAChC,oBAAAA,CAAqBC,oBAAAA,EAAsBC,aAAAA,CAAc+B,gBAAgB,IAAIA;AAClF;;"}
@@ -0,0 +1,3 @@
1
+ import { RegisteredComponentProps } from '@cratis/scene.react';
2
+ export declare function ApprovalChainStepper({ element, interactions }: RegisteredComponentProps): import("react").JSX.Element;
3
+ //# sourceMappingURL=ApprovalChainStepper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApprovalChainStepper.d.ts","sourceRoot":"","sources":["../../../foundation/ApprovalChainStepper.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAwB/D,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,wBAAwB,+BAqCvF"}
@@ -0,0 +1,128 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
3
+ import { readSteps, effectiveSteps, chainOutcome, ApprovalState } from './approvalModel.js';
4
+ import { readComponentState, ComponentState } from './ComponentState.js';
5
+ import { FoundationIcon } from './FoundationIcon.js';
6
+ import { readLocale, formatDate } from './formatting.js';
7
+ import { readFoundationStrings, formatText } from './foundationStrings.js';
8
+ import { FoundationFrame } from './StateFrame.js';
9
+
10
+ const icons = {
11
+ [ApprovalState.Pending]: 'circle',
12
+ [ApprovalState.Current]: 'clock',
13
+ [ApprovalState.Approved]: 'check',
14
+ [ApprovalState.Rejected]: 'close',
15
+ [ApprovalState.Skipped]: 'minus'
16
+ };
17
+ const tones = {
18
+ [ApprovalState.Pending]: 'neutral',
19
+ [ApprovalState.Current]: 'info',
20
+ [ApprovalState.Approved]: 'success',
21
+ [ApprovalState.Rejected]: 'danger',
22
+ [ApprovalState.Skipped]: 'neutral'
23
+ };
24
+ /**
25
+ * The `approvalChainStepper` component: the steps a request goes through, who decides each, and where it stands.
26
+ *
27
+ * `steps` are written in order with a `label`, an `approver`, a `state` (pending, current, approved, rejected, skipped), and when it was
28
+ * 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
29
+ * 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
30
+ * well as by icon and color, the current step carries `aria-current="step"`, and the whole is an ordered list with the overall outcome
31
+ * stated above it. `orientation` is `horizontal` or `vertical`; below a phone's width it is always vertical.
32
+ */ function ApprovalChainStepper({ element, interactions }) {
33
+ const written = useMemo(()=>readSteps(element.properties.steps), [
34
+ element.properties.steps
35
+ ]);
36
+ const steps = useMemo(()=>effectiveSteps(written), [
37
+ written
38
+ ]);
39
+ const outcome = chainOutcome(written);
40
+ const strings = readFoundationStrings(element);
41
+ const locale = readLocale(element);
42
+ const state = readComponentState(element, written.length > 0);
43
+ const stateText = {
44
+ pending: strings.approvalPending,
45
+ current: strings.approvalCurrent,
46
+ approved: strings.approvalApproved,
47
+ rejected: strings.approvalRejected,
48
+ skipped: strings.approvalSkipped
49
+ };
50
+ const outcomeText = {
51
+ approved: strings.approvalOutcomeApproved,
52
+ rejected: strings.approvalOutcomeRejected,
53
+ inProgress: strings.approvalOutcomeInProgress,
54
+ pending: strings.approvalOutcomePending
55
+ };
56
+ return /*#__PURE__*/ jsx(FoundationFrame, {
57
+ element: element,
58
+ interactions: interactions,
59
+ name: "approval-chain",
60
+ state: state,
61
+ skeleton: [
62
+ 100,
63
+ 100
64
+ ],
65
+ children: (state === ComponentState.Ready || state === ComponentState.Partial) && /*#__PURE__*/ jsxs(Fragment, {
66
+ children: [
67
+ /*#__PURE__*/ jsx("p", {
68
+ className: "foundation-approval-outcome",
69
+ "data-outcome": outcome,
70
+ children: outcomeText[outcome]
71
+ }),
72
+ /*#__PURE__*/ jsx("ol", {
73
+ className: "foundation-approval-steps",
74
+ "aria-label": strings.approvalChain,
75
+ "data-orientation": element.properties.orientation === 'vertical' ? 'vertical' : 'horizontal',
76
+ children: steps.map((step, index)=>/*#__PURE__*/ jsxs("li", {
77
+ className: "foundation-approval-step",
78
+ "data-state": step.state,
79
+ "aria-current": step.state === ApprovalState.Current ? 'step' : undefined,
80
+ children: [
81
+ /*#__PURE__*/ jsxs("span", {
82
+ className: "foundation-chip",
83
+ "data-tone": tones[step.state],
84
+ children: [
85
+ /*#__PURE__*/ jsx(FoundationIcon, {
86
+ name: icons[step.state]
87
+ }),
88
+ /*#__PURE__*/ jsx("span", {
89
+ children: step.notReached ? strings.approvalNotReached : stateText[step.state]
90
+ })
91
+ ]
92
+ }),
93
+ /*#__PURE__*/ jsxs("strong", {
94
+ className: "foundation-approval-label",
95
+ children: [
96
+ /*#__PURE__*/ jsx("span", {
97
+ className: "foundation-visually-hidden",
98
+ children: `${formatText(strings.approvalStep, {
99
+ n: index + 1,
100
+ total: steps.length
101
+ })}: `
102
+ }),
103
+ step.label
104
+ ]
105
+ }),
106
+ step.approver && /*#__PURE__*/ jsx("span", {
107
+ className: "foundation-count",
108
+ children: step.approver
109
+ }),
110
+ step.at && /*#__PURE__*/ jsx("time", {
111
+ className: "foundation-count",
112
+ dateTime: step.at,
113
+ children: formatDate(step.at, locale, true)
114
+ }),
115
+ step.comment && /*#__PURE__*/ jsx("span", {
116
+ className: "foundation-approval-comment",
117
+ children: step.comment
118
+ })
119
+ ]
120
+ }, step.label + index))
121
+ })
122
+ ]
123
+ })
124
+ });
125
+ }
126
+
127
+ export { ApprovalChainStepper };
128
+ //# 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,aAAAA,CAAcC,OAAO,GAAG,QAAA;IAAU,CAACD,aAAAA,CAAcE,OAAO,GAAG,OAAA;IAAS,CAACF,aAAAA,CAAcG,QAAQ,GAAG,OAAA;IAAS,CAACH,aAAAA,CAAcI,QAAQ,GAAG,OAAA;IAAS,CAACJ,aAAAA,CAAcK,OAAO,GAAG;AACxK,CAAA;AACA,MAAMC,KAAAA,GAAuC;IACzC,CAACN,aAAAA,CAAcC,OAAO,GAAG,SAAA;IAAW,CAACD,aAAAA,CAAcE,OAAO,GAAG,MAAA;IAAQ,CAACF,aAAAA,CAAcG,QAAQ,GAAG,SAAA;IAAW,CAACH,aAAAA,CAAcI,QAAQ,GAAG,QAAA;IAAU,CAACJ,aAAAA,CAAcK,OAAO,GAAG;AAC3K,CAAA;AAEA;;;;;;;;AAQC,IACM,SAASE,oBAAAA,CAAqB,EAAEC,OAAO,EAAEC,YAAY,EAA4B,EAAA;IACpF,MAAMC,OAAAA,GAAUC,QAAQ,IAAMC,SAAAA,CAAUJ,QAAQK,UAAU,CAACC,KAAK,CAAA,EAAG;QAACN,OAAAA,CAAQK,UAAU,CAACC;AAAM,KAAA,CAAA;AAC7F,IAAA,MAAMA,KAAAA,GAAQH,OAAAA,CAAQ,IAAMI,cAAAA,CAAeL,OAAAA,CAAAA,EAAU;AAACA,QAAAA;AAAQ,KAAA,CAAA;AAC9D,IAAA,MAAMM,UAAUC,YAAAA,CAAaP,OAAAA,CAAAA;AAC7B,IAAA,MAAMQ,UAAUC,qBAAAA,CAAsBX,OAAAA,CAAAA;AACtC,IAAA,MAAMY,SAASC,UAAAA,CAAWb,OAAAA,CAAAA;AAC1B,IAAA,MAAMc,KAAAA,GAAQC,kBAAAA,CAAmBf,OAAAA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AAA,CAACqC,MAAAA,EAAAA;oCAAK3B,SAAAA,EAAU,kBAAA;AAAmB4B,oCAAAA,QAAAA,EAAUpB,KAAKkB,EAAE;8CAAGG,UAAAA,CAAWrB,IAAAA,CAAKkB,EAAE,EAAE1D,MAAAA,EAAQ,IAAA;;gCAC9FwC,IAAAA,CAAKsB,OAAO,kBAAIxC,GAAA,CAACwB,MAAAA,EAAAA;oCAAKd,SAAAA,EAAU,6BAAA;AAA+BQ,oCAAAA,QAAAA,EAAAA,IAAAA,CAAKsB;;;AARhEtB,yBAAAA,EAAAA,IAAAA,CAAKgB,KAAK,GAAGf,KAAAA,CAAAA;;;;;AAgBlD;;"}
@@ -42,4 +42,12 @@ export declare const AvatarStackLight: Story;
42
42
  export declare const AvatarStackDark: Story;
43
43
  export declare const FileUploaderLight: Story;
44
44
  export declare const FileUploaderDark: Story;
45
+ export declare const ApprovalChainLight: Story;
46
+ export declare const ApprovalChainDark: Story;
47
+ export declare const OrgTreeLight: Story;
48
+ export declare const OrgTreeDark: Story;
49
+ export declare const PermissionMatrixLight: Story;
50
+ export declare const PermissionMatrixDark: Story;
51
+ export declare const ApprovalChainRejectedLight: Story;
52
+ export declare const PermissionMatrixReadOnlyDark: Story;
45
53
  //# sourceMappingURL=Foundation.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Foundation.stories.d.ts","sourceRoot":"","sources":["../../../foundation/Foundation.stories.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,QAAA,MAAM,IAAI;;;;QAGQ,MAAM;;CACiB,CAAC;eAE3B,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,eAAe,EAAE,KAAyE,CAAC;AACxG,eAAO,MAAM,cAAc,EAAE,KAAwE,CAAC;AACtG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G,CAAC;AACvI,eAAO,MAAM,gBAAgB,EAAE,KAA2N,CAAC;AAC3P,eAAO,MAAM,eAAe,EAAE,KAA0N,CAAC;AACzP,eAAO,MAAM,kBAAkB,EAAE,KAA4E,CAAC;AAC9G,eAAO,MAAM,iBAAiB,EAAE,KAA2E,CAAC;AAC5G,eAAO,MAAM,kBAAkB,EAAE,KAA4E,CAAC;AAC9G,eAAO,MAAM,iBAAiB,EAAE,KAA2E,CAAC;AAC5G,eAAO,MAAM,mBAAmB,EAAE,KAA6E,CAAC;AAChH,eAAO,MAAM,kBAAkB,EAAE,KAA4E,CAAC;AAC9G,eAAO,MAAM,cAAc,EAAE,KAA+E,CAAC;AAC7G,eAAO,MAAM,aAAa,EAAE,KAA8E,CAAC;AAC3G,eAAO,MAAM,iBAAiB,EAAE,KAA2E,CAAC;AAC5G,eAAO,MAAM,gBAAgB,EAAE,KAA0E,CAAC;AAC1G,eAAO,MAAM,gBAAgB,EAAE,KAA0E,CAAC;AAC1G,eAAO,MAAM,eAAe,EAAE,KAAyE,CAAC;AACxG,eAAO,MAAM,iBAAiB,EAAE,KAA2E,CAAC;AAC5G,eAAO,MAAM,gBAAgB,EAAE,KAA0E,CAAC;AAC1G,eAAO,MAAM,kBAAkB,EAAE,KAAmF,CAAC;AACrH,eAAO,MAAM,iBAAiB,EAAE,KAAkF,CAAC;AACnH,eAAO,MAAM,YAAY,EAAE,KAAsE,CAAC;AAClG,eAAO,MAAM,WAAW,EAAE,KAAqE,CAAC;AAChG,eAAO,MAAM,qBAAqB,EAAE,KAA+E,CAAC;AACpH,eAAO,MAAM,oBAAoB,EAAE,KAA8E,CAAC;AAClH,eAAO,MAAM,0BAA0B,EAAE,KAAgP,CAAC;AAC1R,eAAO,MAAM,4BAA4B,EAAE,KAA0H,CAAC"}
@@ -39,4 +39,12 @@ export const AvatarStackLight = { args: { component: ComponentName.AvatarStack,
39
39
  export const AvatarStackDark = { args: { component: ComponentName.AvatarStack, theme: 'dark' } };
40
40
  export const FileUploaderLight = { args: { component: ComponentName.FileUploader, theme: 'light' } };
41
41
  export const FileUploaderDark = { args: { component: ComponentName.FileUploader, theme: 'dark' } };
42
+ export const ApprovalChainLight = { args: { component: ComponentName.ApprovalChainStepper, theme: 'light' } };
43
+ export const ApprovalChainDark = { args: { component: ComponentName.ApprovalChainStepper, theme: 'dark' } };
44
+ export const OrgTreeLight = { args: { component: ComponentName.OrgTree, theme: 'light' } };
45
+ export const OrgTreeDark = { args: { component: ComponentName.OrgTree, theme: 'dark' } };
46
+ export const PermissionMatrixLight = { args: { component: ComponentName.PermissionMatrix, theme: 'light' } };
47
+ export const PermissionMatrixDark = { args: { component: ComponentName.PermissionMatrix, theme: 'dark' } };
48
+ export const ApprovalChainRejectedLight = { args: { component: ComponentName.ApprovalChainStepper, theme: 'light', properties: { steps: [{ label: 'Team lead', state: 'approved' }, { label: 'Finance', state: 'rejected', comment: 'Over budget.' }, { label: 'Director' }] } } };
49
+ export const PermissionMatrixReadOnlyDark = { args: { component: ComponentName.PermissionMatrix, theme: 'dark', properties: { editPermission: 'disabled' } } };
42
50
  //# sourceMappingURL=Foundation.stories.js.map