@cratis/scene.blueprint.default 4.35.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 +21 -0
- package/defaultBlueprintComponents.ts +8 -1
- package/dist/cjs/ComponentName.js +7 -0
- package/dist/cjs/ComponentName.js.map +1 -1
- package/dist/cjs/defaultBlueprint.js +2 -0
- package/dist/cjs/defaultBlueprint.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponentMetadata.js +2 -0
- package/dist/cjs/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/cjs/defaultBlueprintComponents.js +15 -1
- package/dist/cjs/defaultBlueprintComponents.js.map +1 -1
- package/dist/cjs/foundation/ActivityFeed.js +122 -0
- package/dist/cjs/foundation/ActivityFeed.js.map +1 -0
- package/dist/cjs/foundation/ApprovalChainStepper.js +130 -0
- package/dist/cjs/foundation/ApprovalChainStepper.js.map +1 -0
- package/dist/cjs/foundation/AvatarStack.js +73 -0
- package/dist/cjs/foundation/AvatarStack.js.map +1 -0
- package/dist/cjs/foundation/ChecklistSection.js +174 -0
- package/dist/cjs/foundation/ChecklistSection.js.map +1 -0
- package/dist/cjs/foundation/FileUploader.js +218 -0
- package/dist/cjs/foundation/FileUploader.js.map +1 -0
- package/dist/cjs/foundation/FileUploaderHandler.js +17 -0
- package/dist/cjs/foundation/FileUploaderHandler.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/activityModel.js +63 -0
- package/dist/cjs/foundation/activityModel.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/avatarModel.js +42 -0
- package/dist/cjs/foundation/avatarModel.js.map +1 -0
- package/dist/cjs/foundation/checklistModel.js +59 -0
- package/dist/cjs/foundation/checklistModel.js.map +1 -0
- package/dist/cjs/foundation/formatting.js +11 -0
- package/dist/cjs/foundation/formatting.js.map +1 -1
- package/dist/cjs/foundation/foundationComponentMetadata.js +47 -0
- package/dist/cjs/foundation/foundationComponentMetadata.js.map +1 -1
- package/dist/cjs/foundation/foundationDescriptors.js +246 -0
- package/dist/cjs/foundation/foundationDescriptors.js.map +1 -1
- package/dist/cjs/foundation/foundationSamples.js +230 -0
- package/dist/cjs/foundation/foundationSamples.js.map +1 -1
- package/dist/cjs/foundation/foundationStrings.js +27 -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/foundation/uploadModel.js +71 -0
- package/dist/cjs/foundation/uploadModel.js.map +1 -0
- package/dist/cjs/index.js +59 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/ComponentName.d.ts +8 -1
- package/dist/esm/ComponentName.d.ts.map +1 -1
- package/dist/esm/ComponentName.js +7 -0
- package/dist/esm/ComponentName.js.map +1 -1
- package/dist/esm/defaultBlueprint.js +2 -0
- package/dist/esm/defaultBlueprint.js.map +1 -1
- package/dist/esm/defaultBlueprintComponentMetadata.js +2 -0
- package/dist/esm/defaultBlueprintComponentMetadata.js.map +1 -1
- package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -1
- package/dist/esm/defaultBlueprintComponents.js +15 -1
- package/dist/esm/defaultBlueprintComponents.js.map +1 -1
- package/dist/esm/foundation/ActivityFeed.d.ts +3 -0
- package/dist/esm/foundation/ActivityFeed.d.ts.map +1 -0
- package/dist/esm/foundation/ActivityFeed.js +120 -0
- package/dist/esm/foundation/ActivityFeed.js.map +1 -0
- 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/AvatarStack.d.ts +3 -0
- package/dist/esm/foundation/AvatarStack.d.ts.map +1 -0
- package/dist/esm/foundation/AvatarStack.js +71 -0
- package/dist/esm/foundation/AvatarStack.js.map +1 -0
- package/dist/esm/foundation/ChecklistSection.d.ts +3 -0
- package/dist/esm/foundation/ChecklistSection.d.ts.map +1 -0
- package/dist/esm/foundation/ChecklistSection.js +172 -0
- package/dist/esm/foundation/ChecklistSection.js.map +1 -0
- package/dist/esm/foundation/FileUploader.d.ts +3 -0
- package/dist/esm/foundation/FileUploader.d.ts.map +1 -0
- package/dist/esm/foundation/FileUploader.js +216 -0
- package/dist/esm/foundation/FileUploader.js.map +1 -0
- package/dist/esm/foundation/FileUploaderHandler.d.ts +8 -0
- package/dist/esm/foundation/FileUploaderHandler.d.ts.map +1 -0
- package/dist/esm/foundation/FileUploaderHandler.js +14 -0
- package/dist/esm/foundation/FileUploaderHandler.js.map +1 -0
- package/dist/esm/foundation/Foundation.stories.d.ts +16 -0
- package/dist/esm/foundation/Foundation.stories.d.ts.map +1 -1
- package/dist/esm/foundation/Foundation.stories.js +16 -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/activityModel.d.ts +22 -0
- package/dist/esm/foundation/activityModel.d.ts.map +1 -0
- package/dist/esm/foundation/activityModel.js +58 -0
- package/dist/esm/foundation/activityModel.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/avatarModel.d.ts +11 -0
- package/dist/esm/foundation/avatarModel.d.ts.map +1 -0
- package/dist/esm/foundation/avatarModel.js +38 -0
- package/dist/esm/foundation/avatarModel.js.map +1 -0
- package/dist/esm/foundation/checklistModel.d.ts +17 -0
- package/dist/esm/foundation/checklistModel.d.ts.map +1 -0
- package/dist/esm/foundation/checklistModel.js +53 -0
- package/dist/esm/foundation/checklistModel.js.map +1 -0
- package/dist/esm/foundation/formatting.d.ts +1 -0
- package/dist/esm/foundation/formatting.d.ts.map +1 -1
- package/dist/esm/foundation/formatting.js +11 -1
- package/dist/esm/foundation/formatting.js.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.d.ts.map +1 -1
- package/dist/esm/foundation/foundationComponentMetadata.js +47 -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 +246 -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 +230 -0
- package/dist/esm/foundation/foundationSamples.js.map +1 -1
- package/dist/esm/foundation/foundationStrings.d.ts +26 -0
- package/dist/esm/foundation/foundationStrings.d.ts.map +1 -1
- package/dist/esm/foundation/foundationStrings.js +27 -1
- package/dist/esm/foundation/foundationStrings.js.map +1 -1
- package/dist/esm/foundation/index.d.ts +15 -0
- package/dist/esm/foundation/index.d.ts.map +1 -1
- package/dist/esm/foundation/index.js +15 -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/foundation/uploadModel.d.ts +31 -0
- package/dist/esm/foundation/uploadModel.d.ts.map +1 -0
- package/dist/esm/foundation/uploadModel.js +65 -0
- package/dist/esm/foundation/uploadModel.js.map +1 -0
- package/dist/esm/index.js +16 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/foundation/ActivityFeed.tsx +61 -0
- package/foundation/ApprovalChainStepper.tsx +66 -0
- package/foundation/AvatarStack.tsx +43 -0
- package/foundation/ChecklistSection.tsx +80 -0
- package/foundation/FileUploader.tsx +122 -0
- package/foundation/FileUploaderHandler.tsx +22 -0
- package/foundation/Foundation.stories.tsx +16 -0
- package/foundation/OrgTree.tsx +101 -0
- package/foundation/PermissionMatrix.tsx +82 -0
- package/foundation/activityModel.ts +65 -0
- package/foundation/approvalModel.ts +88 -0
- package/foundation/avatarModel.ts +36 -0
- package/foundation/checklistModel.ts +62 -0
- package/foundation/formatting.ts +9 -0
- package/foundation/foundationComponentMetadata.ts +7 -0
- package/foundation/foundationDescriptors.ts +153 -0
- package/foundation/foundationSamples.ts +59 -0
- package/foundation/foundationStrings.ts +26 -0
- package/foundation/index.ts +15 -0
- package/foundation/orgModel.ts +85 -0
- package/foundation/permissionModel.ts +85 -0
- package/foundation/uploadModel.ts +66 -0
- package/package.json +8 -8
- package/shell/layout.css +418 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChecklistSection.js","sources":["../../../foundation/ChecklistSection.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 { useEffect, useMemo, useState } from 'react';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { ChecklistGroup, completed, doneTaskIds, isOverdue, readChecklist, toggleTask } from './checklistModel';\nimport { ComponentState, readComponentState } from './ComponentState';\nimport { FoundationIcon } from './FoundationIcon';\nimport { formatDate, readLocale } from './formatting';\nimport { formatText, readFoundationStrings } from './foundationStrings';\nimport { readPermissionRule } from './PermissionRule';\nimport { FoundationFrame } from './StateFrame';\n\n/**\n * The `checklistSection` component: sections of tasks, each with its owner and due date, and a progress bar per section.\n *\n * `sections` give the structure (`title`, and `items` with `id`, `label`, `owner`, `due`, `done`). Ticking a task publishes the ids of all\n * done tasks as the `value` output and runs the behaviors attached to the element. An open task past its due date says \"Overdue\" in\n * words as well as in color. Progress is a labelled progress bar, so \"2 of 5 complete\" is read, not just seen. With `editPermission`\n * not enabled the tasks are shown and cannot be changed.\n */\nexport function ChecklistSection({ element, interactions, bindingOutputs }: RegisteredComponentProps) {\n const supplied = useMemo(() => readChecklist(element.properties.sections), [element.properties.sections]);\n const suppliedKey = JSON.stringify(supplied);\n const [groups, setGroups] = useState<ChecklistGroup[]>(supplied);\n const strings = readFoundationStrings(element);\n const locale = readLocale(element);\n const state = readComponentState(element, supplied.some(group => group.items.length > 0));\n const locked = readPermissionRule(element, 'editPermission') !== 'enabled';\n const now = useMemo(() => (typeof element.properties.today === 'string' ? new Date(element.properties.today) : new Date()), [element.properties.today]);\n\n useEffect(() => setGroups(supplied), [suppliedKey]);\n useValueOutput(bindingOutputs, doneTaskIds(groups));\n\n return (\n <FoundationFrame element={element} interactions={interactions} name='checklist' state={state} skeleton={[40, 100, 90, 95]}>\n {(state === ComponentState.Ready || state === ComponentState.Partial) && groups.map((group, groupIndex) => {\n const done = completed(group);\n const total = group.items.length;\n return (\n <section key={group.title + groupIndex} className='foundation-checklist-group' aria-labelledby={`${element.id}-group-${groupIndex}`}>\n <header className='foundation-checklist-header'>\n <h3 id={`${element.id}-group-${groupIndex}`}>{group.title}</h3>\n <span className='foundation-count'>{formatText(strings.checklistProgress, { done, total })}</span>\n </header>\n <div className='foundation-progress' role='progressbar' aria-label={formatText(strings.checklistItemProgress, { title: group.title })}\n aria-valuemin={0} aria-valuemax={total} aria-valuenow={done} aria-valuetext={formatText(strings.checklistProgress, { done, total })}>\n <span className='foundation-progress-bar' style={{ inlineSize: total === 0 ? '0%' : `${(done / total) * 100}%` }} />\n </div>\n {total === 0 ? <p className='foundation-count'>{strings.checklistNone}</p> : (\n <ul className='foundation-checklist-items'>\n {group.items.map(item => {\n const overdue = isOverdue(item, now);\n return (\n <li key={item.id} className='foundation-checklist-item' data-done={item.done} data-overdue={overdue}>\n <label className='foundation-check'>\n <input type='checkbox' checked={item.done} disabled={locked} onChange={() => { setGroups(toggleTask(groups, item.id)); interactions?.onChange?.(); }} />\n <span className='foundation-checklist-label'>{item.label}</span>\n </label>\n <span className='foundation-checklist-meta'>\n {item.owner && <span><span className='foundation-visually-hidden'>{`${strings.checklistOwner}: `}</span><FoundationIcon name='user' /> {item.owner}</span>}\n {item.due && (\n <span>\n <span className='foundation-visually-hidden'>{`${strings.checklistDue}: `}</span>\n <time dateTime={item.due}>{formatDate(item.due, locale)}</time>\n {overdue && <strong className='foundation-overdue'> · <FoundationIcon name='alert' /> {strings.checklistOverdue}</strong>}\n </span>\n )}\n </span>\n </li>\n );\n })}\n </ul>\n )}\n </section>\n );\n })}\n </FoundationFrame>\n );\n}\n"],"names":["ChecklistSection","element","interactions","bindingOutputs","supplied","useMemo","readChecklist","properties","sections","suppliedKey","JSON","stringify","groups","setGroups","useState","strings","readFoundationStrings","locale","readLocale","state","readComponentState","some","group","items","length","locked","readPermissionRule","now","today","Date","useEffect","useValueOutput","doneTaskIds","_jsx","FoundationFrame","name","skeleton","ComponentState","Ready","Partial","map","groupIndex","done","completed","total","_jsxs","section","className","aria-labelledby","id","header","h3","title","span","formatText","checklistProgress","div","role","aria-label","checklistItemProgress","aria-valuemin","aria-valuemax","aria-valuenow","aria-valuetext","style","inlineSize","p","checklistNone","ul","item","overdue","isOverdue","li","data-done","data-overdue","label","input","type","checked","disabled","onChange","toggleTask","owner","checklistOwner","FoundationIcon","due","checklistDue","time","dateTime","formatDate","strong","checklistOverdue"],"mappings":";;;;;;;;;;;AAaA;;;;;;;IAQO,SAASA,gBAAAA,CAAiB,EAAEC,OAAO,EAAEC,YAAY,EAAEC,cAAc,EAA4B,EAAA;IAChG,MAAMC,QAAAA,GAAWC,QAAQ,IAAMC,aAAAA,CAAcL,QAAQM,UAAU,CAACC,QAAQ,CAAA,EAAG;QAACP,OAAAA,CAAQM,UAAU,CAACC;AAAS,KAAA,CAAA;IACxG,MAAMC,WAAAA,GAAcC,IAAAA,CAAKC,SAAS,CAACP,QAAAA,CAAAA;AACnC,IAAA,MAAM,CAACQ,MAAAA,EAAQC,SAAAA,CAAU,GAAGC,QAAAA,CAA2BV,QAAAA,CAAAA;AACvD,IAAA,MAAMW,UAAUC,qBAAAA,CAAsBf,OAAAA,CAAAA;AACtC,IAAA,MAAMgB,SAASC,UAAAA,CAAWjB,OAAAA,CAAAA;AAC1B,IAAA,MAAMkB,KAAAA,GAAQC,kBAAAA,CAAmBnB,OAAAA,EAASG,QAAAA,CAASiB,IAAI,CAACC,CAAAA,KAAAA,GAASA,KAAAA,CAAMC,KAAK,CAACC,MAAM,GAAG,CAAA,CAAA,CAAA;IACtF,MAAMC,MAAAA,GAASC,kBAAAA,CAAmBzB,OAAAA,EAAS,gBAAA,CAAA,KAAsB,SAAA;AACjE,IAAA,MAAM0B,MAAMtB,OAAAA,CAAQ,IAAO,OAAOJ,OAAAA,CAAQM,UAAU,CAACqB,KAAK,KAAK,QAAA,GAAW,IAAIC,KAAK5B,OAAAA,CAAQM,UAAU,CAACqB,KAAK,CAAA,GAAI,IAAIC,IAAAA,EAAAA,EAAS;QAAC5B,OAAAA,CAAQM,UAAU,CAACqB;AAAM,KAAA,CAAA;IAEtJE,SAAAA,CAAU,IAAMjB,UAAUT,QAAAA,CAAAA,EAAW;AAAC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AAAA,CAAKgB,GAAG,EAAEpE,MAAAA;;AAC/CqD,oDAAAA,OAAAA,kBAAWzB,IAAA,CAAC6C,QAAAA,EAAAA;wDAAO3C,SAAAA,EAAU,oBAAA;;AAAqB,4DAAA,KAAA;0EAAGd,GAAA,CAACmD,cAAAA,EAAAA;gEAAejD,IAAAA,EAAK;;AAAU,4DAAA,GAAA;AAAEpB,4DAAAA,OAAAA,CAAQ4E;;;;;;;;AAXtGtB,6BAAAA,EAAAA,IAAAA,CAAKpB,EAAE,CAAA;AAiBxB,wBAAA,CAAA;;;AA/BE3B,aAAAA,EAAAA,KAAAA,CAAM8B,KAAK,GAAGX,UAAAA,CAAAA;AAoCpC,QAAA,CAAA;;AAGZ;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUploader.d.ts","sourceRoot":"","sources":["../../../foundation/FileUploader.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAkB,MAAM,qBAAqB,CAAC;AA0B/E,wBAAgB,YAAY,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,wBAAwB,+BA2F/F"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef } from 'react';
|
|
3
|
+
import { useValueOutput } from '@cratis/scene.react';
|
|
4
|
+
import { readOptionalString } from '../shell/elementProperties.js';
|
|
5
|
+
import { ActionButton } from './ActionButton.js';
|
|
6
|
+
import { readComponentState, ComponentState } from './ComponentState.js';
|
|
7
|
+
import { useFileUploaderHandler } from './FileUploaderHandler.js';
|
|
8
|
+
import { FoundationIcon } from './FoundationIcon.js';
|
|
9
|
+
import { readLocale } from './formatting.js';
|
|
10
|
+
import { readFoundationStrings, formatText } from './foundationStrings.js';
|
|
11
|
+
import { readPermissionRule } from './PermissionRule.js';
|
|
12
|
+
import { FoundationFrame } from './StateFrame.js';
|
|
13
|
+
import { formatBytes, UploadStatus, checkSelection, UploadRefusal } from './uploadModel.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The `fileUploader` component: a drop zone and a button to choose files, checked against type and size before anything is sent.
|
|
17
|
+
*
|
|
18
|
+
* `accept` is an `accept` list, `maxSizeMb` the largest file, and `multiple` whether more than one is allowed. The zone is a real file
|
|
19
|
+
* input behind a labelled button, so it works from the keyboard and with a screen reader; dropping onto it does the same as choosing.
|
|
20
|
+
* Refusals are announced with their reason. Accepted files are listed with a remove button and a status in words; the selection
|
|
21
|
+
* (name, size, type) is published as the `value` output. With a `FileUploaderHandlerProvider` in scope the files are sent through it and
|
|
22
|
+
* marked uploading, done or failed; without one the component only collects. `actionPermission` gates choosing files.
|
|
23
|
+
*/ function FileUploader({ element, interactions, bindingOutputs }) {
|
|
24
|
+
const strings = readFoundationStrings(element);
|
|
25
|
+
const locale = readLocale(element);
|
|
26
|
+
const handler = useFileUploaderHandler();
|
|
27
|
+
const [entries, setEntries] = useState([]);
|
|
28
|
+
const [problems, setProblems] = useState([]);
|
|
29
|
+
const [dragging, setDragging] = useState(false);
|
|
30
|
+
const input = useRef(null);
|
|
31
|
+
const accept = readOptionalString(element, 'accept') ?? '';
|
|
32
|
+
const maximumBytes = (typeof element.properties.maxSizeMb === 'number' ? element.properties.maxSizeMb : 0) * 1024 * 1024;
|
|
33
|
+
const multiple = element.properties.multiple !== false;
|
|
34
|
+
const rule = readPermissionRule(element, 'actionPermission');
|
|
35
|
+
const state = readComponentState(element, true);
|
|
36
|
+
const serverUrl = readOptionalString(element, 'serverUrl');
|
|
37
|
+
useValueOutput(bindingOutputs, entries.map((entry)=>({
|
|
38
|
+
name: entry.file.name,
|
|
39
|
+
size: entry.file.size,
|
|
40
|
+
type: entry.file.type,
|
|
41
|
+
status: entry.status
|
|
42
|
+
})));
|
|
43
|
+
const send = async (files)=>{
|
|
44
|
+
if (!handler) return;
|
|
45
|
+
const mark = (status)=>setEntries((current)=>current.map((entry)=>files.includes(entry.file) ? {
|
|
46
|
+
...entry,
|
|
47
|
+
status
|
|
48
|
+
} : entry));
|
|
49
|
+
mark(UploadStatus.Uploading);
|
|
50
|
+
try {
|
|
51
|
+
await handler(files, serverUrl);
|
|
52
|
+
mark(UploadStatus.Done);
|
|
53
|
+
} catch {
|
|
54
|
+
mark(UploadStatus.Failed);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const take = (chosen)=>{
|
|
58
|
+
const { accepted, refused } = checkSelection(chosen, {
|
|
59
|
+
accept,
|
|
60
|
+
maximumBytes,
|
|
61
|
+
multiple
|
|
62
|
+
}, entries.length);
|
|
63
|
+
setProblems(refused.map(({ file, reason })=>reason === UploadRefusal.WrongType ? formatText(strings.uploadWrongType, {
|
|
64
|
+
name: file.name
|
|
65
|
+
}) : reason === UploadRefusal.TooLarge ? formatText(strings.uploadTooLarge, {
|
|
66
|
+
name: file.name,
|
|
67
|
+
limit: formatBytes(maximumBytes, locale)
|
|
68
|
+
}) : strings.uploadSingle));
|
|
69
|
+
if (accepted.length === 0) return;
|
|
70
|
+
setEntries((current)=>[
|
|
71
|
+
...current,
|
|
72
|
+
...accepted.map((file)=>({
|
|
73
|
+
file,
|
|
74
|
+
status: UploadStatus.Queued
|
|
75
|
+
}))
|
|
76
|
+
]);
|
|
77
|
+
interactions?.onChange?.();
|
|
78
|
+
void send(accepted);
|
|
79
|
+
};
|
|
80
|
+
const choose = (event)=>{
|
|
81
|
+
take(Array.from(event.target.files ?? []));
|
|
82
|
+
event.target.value = '';
|
|
83
|
+
};
|
|
84
|
+
const drop = (event)=>{
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
setDragging(false);
|
|
87
|
+
if (rule === 'enabled') take(Array.from(event.dataTransfer.files));
|
|
88
|
+
};
|
|
89
|
+
const statusText = {
|
|
90
|
+
queued: strings.uploadQueued,
|
|
91
|
+
uploading: strings.uploadUploading,
|
|
92
|
+
done: strings.uploadDone,
|
|
93
|
+
failed: strings.uploadFailed
|
|
94
|
+
};
|
|
95
|
+
const limits = [
|
|
96
|
+
accept ? formatText(strings.uploadAccepts, {
|
|
97
|
+
types: accept
|
|
98
|
+
}) : '',
|
|
99
|
+
maximumBytes > 0 ? formatText(strings.uploadLimits, {
|
|
100
|
+
limit: formatBytes(maximumBytes, locale)
|
|
101
|
+
}) : ''
|
|
102
|
+
].filter(Boolean).join(' · ');
|
|
103
|
+
return /*#__PURE__*/ jsx(FoundationFrame, {
|
|
104
|
+
element: element,
|
|
105
|
+
interactions: interactions,
|
|
106
|
+
name: "file-uploader",
|
|
107
|
+
state: state,
|
|
108
|
+
skeleton: [
|
|
109
|
+
100,
|
|
110
|
+
40
|
|
111
|
+
],
|
|
112
|
+
children: state !== ComponentState.Loading && /*#__PURE__*/ jsxs(Fragment, {
|
|
113
|
+
children: [
|
|
114
|
+
/*#__PURE__*/ jsxs("div", {
|
|
115
|
+
className: "foundation-dropzone",
|
|
116
|
+
"data-dragging": dragging,
|
|
117
|
+
onDragOver: (event)=>{
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
setDragging(true);
|
|
120
|
+
},
|
|
121
|
+
onDragLeave: ()=>setDragging(false),
|
|
122
|
+
onDrop: drop,
|
|
123
|
+
children: [
|
|
124
|
+
/*#__PURE__*/ jsx(FoundationIcon, {
|
|
125
|
+
name: "upload"
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ jsx("span", {
|
|
128
|
+
children: strings.uploadDrop
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ jsx("input", {
|
|
131
|
+
ref: input,
|
|
132
|
+
className: "foundation-visually-hidden",
|
|
133
|
+
type: "file",
|
|
134
|
+
tabIndex: -1,
|
|
135
|
+
accept: accept || undefined,
|
|
136
|
+
multiple: multiple,
|
|
137
|
+
disabled: rule !== 'enabled',
|
|
138
|
+
onChange: choose,
|
|
139
|
+
"aria-hidden": "true"
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ jsx(ActionButton, {
|
|
142
|
+
rule: rule,
|
|
143
|
+
emphasis: "secondary",
|
|
144
|
+
disabledReason: strings.disabledNoPermission,
|
|
145
|
+
onClick: ()=>input.current?.click(),
|
|
146
|
+
children: strings.uploadBrowse
|
|
147
|
+
}),
|
|
148
|
+
limits && /*#__PURE__*/ jsx("span", {
|
|
149
|
+
className: "foundation-count",
|
|
150
|
+
children: limits
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
}),
|
|
154
|
+
/*#__PURE__*/ jsx("div", {
|
|
155
|
+
"aria-live": "polite",
|
|
156
|
+
className: "foundation-upload-problems",
|
|
157
|
+
children: problems.map((problem)=>/*#__PURE__*/ jsx("p", {
|
|
158
|
+
className: "foundation-message-text",
|
|
159
|
+
"data-tone": "danger",
|
|
160
|
+
children: problem
|
|
161
|
+
}, problem))
|
|
162
|
+
}),
|
|
163
|
+
entries.length > 0 && /*#__PURE__*/ jsx("ul", {
|
|
164
|
+
className: "foundation-upload-list",
|
|
165
|
+
"aria-label": strings.uploadSelected,
|
|
166
|
+
children: entries.map((entry, index)=>/*#__PURE__*/ jsxs("li", {
|
|
167
|
+
className: "foundation-upload-item",
|
|
168
|
+
"data-status": entry.status,
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ jsx(FoundationIcon, {
|
|
171
|
+
name: "file"
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ jsx("span", {
|
|
174
|
+
className: "foundation-upload-name",
|
|
175
|
+
children: entry.file.name
|
|
176
|
+
}),
|
|
177
|
+
/*#__PURE__*/ jsx("span", {
|
|
178
|
+
className: "foundation-count",
|
|
179
|
+
children: formatBytes(entry.file.size, locale)
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ jsx("span", {
|
|
182
|
+
className: "foundation-upload-status",
|
|
183
|
+
children: statusText[entry.status]
|
|
184
|
+
}),
|
|
185
|
+
entry.status === UploadStatus.Failed && /*#__PURE__*/ jsx("button", {
|
|
186
|
+
type: "button",
|
|
187
|
+
className: "foundation-link",
|
|
188
|
+
onClick: ()=>void send([
|
|
189
|
+
entry.file
|
|
190
|
+
]),
|
|
191
|
+
children: strings.retry
|
|
192
|
+
}),
|
|
193
|
+
/*#__PURE__*/ jsx("button", {
|
|
194
|
+
type: "button",
|
|
195
|
+
className: "foundation-icon-button",
|
|
196
|
+
"aria-label": formatText(strings.uploadRemove, {
|
|
197
|
+
name: entry.file.name
|
|
198
|
+
}),
|
|
199
|
+
onClick: ()=>{
|
|
200
|
+
setEntries((current)=>current.filter((existing)=>existing !== entry));
|
|
201
|
+
interactions?.onChange?.();
|
|
202
|
+
},
|
|
203
|
+
children: /*#__PURE__*/ jsx(FoundationIcon, {
|
|
204
|
+
name: "close"
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
}, entry.file.name + index))
|
|
209
|
+
})
|
|
210
|
+
]
|
|
211
|
+
})
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export { FileUploader };
|
|
216
|
+
//# sourceMappingURL=FileUploader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUploader.js","sources":["../../../foundation/FileUploader.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 { ChangeEvent, DragEvent, useRef, useState } from 'react';\nimport { RegisteredComponentProps, useValueOutput } from '@cratis/scene.react';\nimport { readOptionalString } from '../shell/elementProperties';\nimport { ActionButton } from './ActionButton';\nimport { ComponentState, readComponentState } from './ComponentState';\nimport { useFileUploaderHandler } from './FileUploaderHandler';\nimport { FoundationIcon } from './FoundationIcon';\nimport { readLocale } from './formatting';\nimport { formatText, readFoundationStrings } from './foundationStrings';\nimport { readPermissionRule } from './PermissionRule';\nimport { FoundationFrame } from './StateFrame';\nimport { UploadRefusal, UploadStatus, checkSelection, formatBytes } from './uploadModel';\n\ninterface Entry {\n file: File;\n status: UploadStatus;\n}\n\n/**\n * The `fileUploader` component: a drop zone and a button to choose files, checked against type and size before anything is sent.\n *\n * `accept` is an `accept` list, `maxSizeMb` the largest file, and `multiple` whether more than one is allowed. The zone is a real file\n * input behind a labelled button, so it works from the keyboard and with a screen reader; dropping onto it does the same as choosing.\n * Refusals are announced with their reason. Accepted files are listed with a remove button and a status in words; the selection\n * (name, size, type) is published as the `value` output. With a `FileUploaderHandlerProvider` in scope the files are sent through it and\n * marked uploading, done or failed; without one the component only collects. `actionPermission` gates choosing files.\n */\nexport function FileUploader({ element, interactions, bindingOutputs }: RegisteredComponentProps) {\n const strings = readFoundationStrings(element);\n const locale = readLocale(element);\n const handler = useFileUploaderHandler();\n const [entries, setEntries] = useState<Entry[]>([]);\n const [problems, setProblems] = useState<string[]>([]);\n const [dragging, setDragging] = useState(false);\n const input = useRef<HTMLInputElement>(null);\n const accept = readOptionalString(element, 'accept') ?? '';\n const maximumBytes = (typeof element.properties.maxSizeMb === 'number' ? element.properties.maxSizeMb : 0) * 1024 * 1024;\n const multiple = element.properties.multiple !== false;\n const rule = readPermissionRule(element, 'actionPermission');\n const state = readComponentState(element, true);\n const serverUrl = readOptionalString(element, 'serverUrl');\n\n useValueOutput(bindingOutputs, entries.map(entry => ({ name: entry.file.name, size: entry.file.size, type: entry.file.type, status: entry.status })));\n\n const send = async (files: File[]) => {\n if (!handler) return;\n const mark = (status: UploadStatus) => setEntries(current => current.map(entry => (files.includes(entry.file) ? { ...entry, status } : entry)));\n mark(UploadStatus.Uploading);\n try {\n await handler(files, serverUrl);\n mark(UploadStatus.Done);\n } catch {\n mark(UploadStatus.Failed);\n }\n };\n\n const take = (chosen: File[]) => {\n const { accepted, refused } = checkSelection(chosen, { accept, maximumBytes, multiple }, entries.length);\n setProblems(refused.map(({ file, reason }) => reason === UploadRefusal.WrongType ? formatText(strings.uploadWrongType, { name: file.name })\n : reason === UploadRefusal.TooLarge ? formatText(strings.uploadTooLarge, { name: file.name, limit: formatBytes(maximumBytes, locale) }) : strings.uploadSingle));\n if (accepted.length === 0) return;\n\n setEntries(current => [...current, ...accepted.map(file => ({ file, status: UploadStatus.Queued }))]);\n interactions?.onChange?.();\n void send(accepted);\n };\n\n const choose = (event: ChangeEvent<HTMLInputElement>) => {\n take(Array.from(event.target.files ?? []));\n event.target.value = '';\n };\n const drop = (event: DragEvent) => {\n event.preventDefault();\n setDragging(false);\n if (rule === 'enabled') take(Array.from(event.dataTransfer.files));\n };\n const statusText: Record<UploadStatus, string> = {\n queued: strings.uploadQueued, uploading: strings.uploadUploading, done: strings.uploadDone, failed: strings.uploadFailed,\n };\n const limits = [accept ? formatText(strings.uploadAccepts, { types: accept }) : '', maximumBytes > 0 ? formatText(strings.uploadLimits, { limit: formatBytes(maximumBytes, locale) }) : ''].filter(Boolean).join(' · ');\n\n return (\n <FoundationFrame element={element} interactions={interactions} name='file-uploader' state={state} skeleton={[100, 40]}>\n {state !== ComponentState.Loading && (\n <>\n <div className='foundation-dropzone' data-dragging={dragging} onDragOver={event => { event.preventDefault(); setDragging(true); }} onDragLeave={() => setDragging(false)} onDrop={drop}>\n <FoundationIcon name='upload' />\n <span>{strings.uploadDrop}</span>\n <input ref={input} className='foundation-visually-hidden' type='file' tabIndex={-1} accept={accept || undefined} multiple={multiple} disabled={rule !== 'enabled'} onChange={choose} aria-hidden='true' />\n <ActionButton rule={rule} emphasis='secondary' disabledReason={strings.disabledNoPermission} onClick={() => input.current?.click()}>\n {strings.uploadBrowse}\n </ActionButton>\n {limits && <span className='foundation-count'>{limits}</span>}\n </div>\n <div aria-live='polite' className='foundation-upload-problems'>\n {problems.map(problem => <p key={problem} className='foundation-message-text' data-tone='danger'>{problem}</p>)}\n </div>\n {entries.length > 0 && (\n <ul className='foundation-upload-list' aria-label={strings.uploadSelected}>\n {entries.map((entry, index) => (\n <li key={entry.file.name + index} className='foundation-upload-item' data-status={entry.status}>\n <FoundationIcon name='file' />\n <span className='foundation-upload-name'>{entry.file.name}</span>\n <span className='foundation-count'>{formatBytes(entry.file.size, locale)}</span>\n <span className='foundation-upload-status'>{statusText[entry.status]}</span>\n {entry.status === UploadStatus.Failed && <button type='button' className='foundation-link' onClick={() => void send([entry.file])}>{strings.retry}</button>}\n <button type='button' className='foundation-icon-button' aria-label={formatText(strings.uploadRemove, { name: entry.file.name })}\n onClick={() => { setEntries(current => current.filter(existing => existing !== entry)); interactions?.onChange?.(); }}>\n <FoundationIcon name='close' />\n </button>\n </li>\n ))}\n </ul>\n )}\n </>\n )}\n </FoundationFrame>\n );\n}\n"],"names":["FileUploader","element","interactions","bindingOutputs","strings","readFoundationStrings","locale","readLocale","handler","useFileUploaderHandler","entries","setEntries","useState","problems","setProblems","dragging","setDragging","input","useRef","accept","readOptionalString","maximumBytes","properties","maxSizeMb","multiple","rule","readPermissionRule","state","readComponentState","serverUrl","useValueOutput","map","entry","name","file","size","type","status","send","files","mark","current","includes","UploadStatus","Uploading","Done","Failed","take","chosen","accepted","refused","checkSelection","length","reason","UploadRefusal","WrongType","formatText","uploadWrongType","TooLarge","uploadTooLarge","limit","formatBytes","uploadSingle","Queued","onChange","choose","event","Array","from","target","value","drop","preventDefault","dataTransfer","statusText","queued","uploadQueued","uploading","uploadUploading","done","uploadDone","failed","uploadFailed","limits","uploadAccepts","types","uploadLimits","filter","Boolean","join","_jsx","FoundationFrame","skeleton","ComponentState","Loading","_jsxs","_Fragment","div","className","data-dragging","onDragOver","onDragLeave","onDrop","FoundationIcon","span","uploadDrop","ref","tabIndex","undefined","disabled","aria-hidden","ActionButton","emphasis","disabledReason","disabledNoPermission","onClick","click","uploadBrowse","aria-live","problem","p","data-tone","ul","aria-label","uploadSelected","index","li","data-status","button","retry","uploadRemove","existing"],"mappings":";;;;;;;;;;;;;;AAqBA;;;;;;;;IASO,SAASA,YAAAA,CAAa,EAAEC,OAAO,EAAEC,YAAY,EAAEC,cAAc,EAA4B,EAAA;AAC5F,IAAA,MAAMC,UAAUC,qBAAAA,CAAsBJ,OAAAA,CAAAA;AACtC,IAAA,MAAMK,SAASC,UAAAA,CAAWN,OAAAA,C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8D,QAAAA,IAAAA;AAAc,oCAAA,CAAA;AACpH,oCAAA,QAAA,gBAAA0B,GAAA,CAACa,cAAAA,EAAAA;wCAAetE,IAAAA,EAAK;;;;2BARpBD,KAAAA,CAAME,IAAI,CAACD,IAAI,GAAG4F,KAAAA,CAAAA;;;;;AAkB3D;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type FileUploaderHandler = (files: File[], serverUrl?: string) => Promise<void>;
|
|
3
|
+
export declare function FileUploaderHandlerProvider({ handler, children }: {
|
|
4
|
+
handler?: FileUploaderHandler;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare const useFileUploaderHandler: () => FileUploaderHandler | undefined;
|
|
8
|
+
//# sourceMappingURL=FileUploaderHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUploaderHandler.d.ts","sourceRoot":"","sources":["../../../foundation/FileUploaderHandler.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAA6B,MAAM,OAAO,CAAC;AAQ7D,MAAM,MAAM,mBAAmB,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAKvF,wBAAgB,2BAA2B,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE;IAAE,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAAC,QAAQ,EAAE,SAAS,CAAA;CAAE,+BAExH;AAGD,eAAO,MAAM,sBAAsB,QAAO,mBAAmB,GAAG,SAAgC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, createContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const Context = /*#__PURE__*/ createContext(undefined);
|
|
5
|
+
/** Provides the upload handler to the file uploaders below it. */ function FileUploaderHandlerProvider({ handler, children }) {
|
|
6
|
+
return /*#__PURE__*/ jsx(Context.Provider, {
|
|
7
|
+
value: handler,
|
|
8
|
+
children: children
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
/** The handler in scope, if any. */ const useFileUploaderHandler = ()=>useContext(Context);
|
|
12
|
+
|
|
13
|
+
export { FileUploaderHandlerProvider, useFileUploaderHandler };
|
|
14
|
+
//# sourceMappingURL=FileUploaderHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileUploaderHandler.js","sources":["../../../foundation/FileUploaderHandler.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 { ReactNode, createContext, useContext } from 'react';\n\n/**\n * What sends the accepted files somewhere: a host's server client, kept out of the portable package.\n *\n * The signature is the one `@cratis/scene.primereact` uses for its `fileUpload`, so a host hands the same function to both. A handler that\n * rejects marks the files as failed, with a retry; without a handler the uploader only collects and publishes the selection.\n */\nexport type FileUploaderHandler = (files: File[], serverUrl?: string) => Promise<void>;\n\nconst Context = createContext<FileUploaderHandler | undefined>(undefined);\n\n/** Provides the upload handler to the file uploaders below it. */\nexport function FileUploaderHandlerProvider({ handler, children }: { handler?: FileUploaderHandler; children: ReactNode }) {\n return <Context.Provider value={handler}>{children}</Context.Provider>;\n}\n\n/** The handler in scope, if any. */\nexport const useFileUploaderHandler = (): FileUploaderHandler | undefined => useContext(Context);\n"],"names":["Context","createContext","undefined","FileUploaderHandlerProvider","handler","children","_jsx","Provider","value","useFileUploaderHandler","useContext"],"mappings":";;;AAaA,MAAMA,wBAAUC,aAAAA,CAA+CC,SAAAA,CAAAA;AAE/D,mEACO,SAASC,2BAAAA,CAA4B,EAAEC,OAAO,EAAEC,QAAQ,EAA0D,EAAA;IACrH,qBAAOC,GAAA,CAACN,QAAQO,QAAQ,EAAA;QAACC,KAAAA,EAAOJ,OAAAA;AAAUC,QAAAA,QAAAA,EAAAA;;AAC9C;AAEA,qCACO,MAAMI,sBAAAA,GAAyB,IAAuCC,WAAWV,OAAAA;;"}
|
|
@@ -34,4 +34,20 @@ export declare const ColumnChooserLight: Story;
|
|
|
34
34
|
export declare const ColumnChooserDark: Story;
|
|
35
35
|
export declare const SavedViewsMenuLight: Story;
|
|
36
36
|
export declare const SavedViewsMenuDark: Story;
|
|
37
|
+
export declare const ChecklistLight: Story;
|
|
38
|
+
export declare const ChecklistDark: Story;
|
|
39
|
+
export declare const ActivityFeedLight: Story;
|
|
40
|
+
export declare const ActivityFeedDark: Story;
|
|
41
|
+
export declare const AvatarStackLight: Story;
|
|
42
|
+
export declare const AvatarStackDark: Story;
|
|
43
|
+
export declare const FileUploaderLight: Story;
|
|
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;
|
|
37
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;AACx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AE,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"}
|
|
@@ -31,4 +31,20 @@ export const ColumnChooserLight = { args: { component: ComponentName.ColumnChoos
|
|
|
31
31
|
export const ColumnChooserDark = { args: { component: ComponentName.ColumnChooser, theme: 'dark' } };
|
|
32
32
|
export const SavedViewsMenuLight = { args: { component: ComponentName.SavedViewsMenu, theme: 'light' } };
|
|
33
33
|
export const SavedViewsMenuDark = { args: { component: ComponentName.SavedViewsMenu, theme: 'dark' } };
|
|
34
|
+
export const ChecklistLight = { args: { component: ComponentName.ChecklistSection, theme: 'light' } };
|
|
35
|
+
export const ChecklistDark = { args: { component: ComponentName.ChecklistSection, theme: 'dark' } };
|
|
36
|
+
export const ActivityFeedLight = { args: { component: ComponentName.ActivityFeed, theme: 'light' } };
|
|
37
|
+
export const ActivityFeedDark = { args: { component: ComponentName.ActivityFeed, theme: 'dark' } };
|
|
38
|
+
export const AvatarStackLight = { args: { component: ComponentName.AvatarStack, theme: 'light' } };
|
|
39
|
+
export const AvatarStackDark = { args: { component: ComponentName.AvatarStack, theme: 'dark' } };
|
|
40
|
+
export const FileUploaderLight = { args: { component: ComponentName.FileUploader, theme: 'light' } };
|
|
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' } } };
|
|
34
50
|
//# sourceMappingURL=Foundation.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Foundation.stories.js","sourceRoot":"","sources":["../../../foundation/Foundation.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAMtD,MAAM,IAAI,GAAG;IACT,K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AE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC;AAC1R,MAAM,CAAC,MAAM,4BAA4B,GAAU,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,aAAa,CAAC,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OrgTree.d.ts","sourceRoot":"","sources":["../../../foundation/OrgTree.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,wBAAwB,EAAkB,MAAM,qBAAqB,CAAC;AAe/E,wBAAgB,OAAO,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,EAAE,wBAAwB,+BAiF1F"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo, useState, useEffect } from 'react';
|
|
3
|
+
import { useValueOutput } from '@cratis/scene.react';
|
|
4
|
+
import { readComponentState, ComponentState } from './ComponentState.js';
|
|
5
|
+
import { FoundationIcon } from './FoundationIcon.js';
|
|
6
|
+
import { readFoundationStrings, formatText } from './foundationStrings.js';
|
|
7
|
+
import { readOrgNodes, buildOrgTree, expandedToDepth, visibleNodes, placements, descendantCount } from './orgModel.js';
|
|
8
|
+
import { FoundationFrame } from './StateFrame.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The `orgTree` component: an organization as an expandable tree of people and units.
|
|
12
|
+
*
|
|
13
|
+
* `nodes` are flat rows - `id`, `label`, `title`, `parentId` - as a query returns them; the tree is built from them, so someone whose manager is
|
|
14
|
+
* 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,
|
|
15
|
+
* 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
|
|
16
|
+
* has in words. The selected id is published as the `value` output; `expandedDepth` is how many levels are open at first.
|
|
17
|
+
*/ function OrgTree({ element, interactions, bindingOutputs }) {
|
|
18
|
+
const nodes = useMemo(()=>readOrgNodes(element.properties.nodes), [
|
|
19
|
+
element.properties.nodes
|
|
20
|
+
]);
|
|
21
|
+
const roots = useMemo(()=>buildOrgTree(nodes), [
|
|
22
|
+
nodes
|
|
23
|
+
]);
|
|
24
|
+
const depth = typeof element.properties.expandedDepth === 'number' ? element.properties.expandedDepth : 2;
|
|
25
|
+
const initial = useMemo(()=>expandedToDepth(roots, depth), [
|
|
26
|
+
roots,
|
|
27
|
+
depth
|
|
28
|
+
]);
|
|
29
|
+
const [expanded, setExpanded] = useState(initial);
|
|
30
|
+
const [selected, setSelected] = useState(typeof element.properties.selected === 'string' ? element.properties.selected : undefined);
|
|
31
|
+
const [focused, setFocused] = useState(undefined);
|
|
32
|
+
const strings = readFoundationStrings(element);
|
|
33
|
+
const state = readComponentState(element, nodes.length > 0);
|
|
34
|
+
const visible = visibleNodes(roots, expanded);
|
|
35
|
+
const placed = useMemo(()=>placements(roots), [
|
|
36
|
+
roots
|
|
37
|
+
]);
|
|
38
|
+
const tabStop = visible.find((node)=>node.id === focused)?.id ?? visible.find((node)=>node.id === selected)?.id ?? visible[0]?.id;
|
|
39
|
+
const emptyElement = state === ComponentState.Empty ? {
|
|
40
|
+
...element,
|
|
41
|
+
properties: {
|
|
42
|
+
emptyHeadline: strings.orgNone,
|
|
43
|
+
...element.properties
|
|
44
|
+
}
|
|
45
|
+
} : element;
|
|
46
|
+
useEffect(()=>setExpanded(initial), [
|
|
47
|
+
initial
|
|
48
|
+
]);
|
|
49
|
+
useValueOutput(bindingOutputs, selected);
|
|
50
|
+
const move = (node, event)=>{
|
|
51
|
+
const index = visible.indexOf(node);
|
|
52
|
+
const focus = (target)=>{
|
|
53
|
+
if (!target) return;
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
setFocused(target.id);
|
|
56
|
+
requestAnimationFrame(()=>document.getElementById(`${element.id}-${target.id}`)?.focus());
|
|
57
|
+
};
|
|
58
|
+
const toggle = (open)=>setExpanded((current)=>{
|
|
59
|
+
const next = new Set(current);
|
|
60
|
+
if (open) next.add(node.id);
|
|
61
|
+
else next.delete(node.id);
|
|
62
|
+
return next;
|
|
63
|
+
});
|
|
64
|
+
const parent = placed.get(node.id)?.parent;
|
|
65
|
+
switch(event.key){
|
|
66
|
+
case 'ArrowDown':
|
|
67
|
+
focus(visible[index + 1]);
|
|
68
|
+
break;
|
|
69
|
+
case 'ArrowUp':
|
|
70
|
+
focus(visible[index - 1]);
|
|
71
|
+
break;
|
|
72
|
+
case 'Home':
|
|
73
|
+
focus(visible[0]);
|
|
74
|
+
break;
|
|
75
|
+
case 'End':
|
|
76
|
+
focus(visible[visible.length - 1]);
|
|
77
|
+
break;
|
|
78
|
+
case 'ArrowRight':
|
|
79
|
+
if (node.children.length > 0 && !expanded.has(node.id)) {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
toggle(true);
|
|
82
|
+
} else focus(node.children[0]);
|
|
83
|
+
break;
|
|
84
|
+
case 'ArrowLeft':
|
|
85
|
+
if (node.children.length > 0 && expanded.has(node.id)) {
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
toggle(false);
|
|
88
|
+
} else focus(parent);
|
|
89
|
+
break;
|
|
90
|
+
case 'Enter':
|
|
91
|
+
case ' ':
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
setSelected(node.id);
|
|
94
|
+
interactions?.onSelect?.();
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return /*#__PURE__*/ jsx(FoundationFrame, {
|
|
99
|
+
element: emptyElement,
|
|
100
|
+
interactions: interactions,
|
|
101
|
+
name: "org-tree",
|
|
102
|
+
state: state,
|
|
103
|
+
skeleton: [
|
|
104
|
+
50,
|
|
105
|
+
70,
|
|
106
|
+
70,
|
|
107
|
+
60
|
|
108
|
+
],
|
|
109
|
+
children: (state === ComponentState.Ready || state === ComponentState.Partial) && /*#__PURE__*/ jsx("ul", {
|
|
110
|
+
role: "tree",
|
|
111
|
+
"aria-label": strings.orgTree,
|
|
112
|
+
className: "foundation-tree",
|
|
113
|
+
children: visible.map((node)=>{
|
|
114
|
+
const siblings = placed.get(node.id)?.siblings ?? [
|
|
115
|
+
node
|
|
116
|
+
];
|
|
117
|
+
const reports = descendantCount(node);
|
|
118
|
+
const open = expanded.has(node.id);
|
|
119
|
+
return /*#__PURE__*/ jsxs("li", {
|
|
120
|
+
id: `${element.id}-${node.id}`,
|
|
121
|
+
role: "treeitem",
|
|
122
|
+
tabIndex: node.id === tabStop ? 0 : -1,
|
|
123
|
+
"aria-level": node.depth,
|
|
124
|
+
"aria-setsize": siblings.length,
|
|
125
|
+
"aria-posinset": siblings.findIndex((sibling)=>sibling.id === node.id) + 1,
|
|
126
|
+
"aria-expanded": node.children.length > 0 ? open : undefined,
|
|
127
|
+
"aria-selected": node.id === selected,
|
|
128
|
+
className: "foundation-tree-item",
|
|
129
|
+
"data-selected": node.id === selected,
|
|
130
|
+
style: {
|
|
131
|
+
paddingInlineStart: `calc(var(--foundation-space-4) * ${node.depth - 1})`
|
|
132
|
+
},
|
|
133
|
+
onKeyDown: (event)=>move(node, event),
|
|
134
|
+
onFocus: ()=>setFocused(node.id),
|
|
135
|
+
onClick: ()=>{
|
|
136
|
+
setSelected(node.id);
|
|
137
|
+
interactions?.onSelect?.();
|
|
138
|
+
},
|
|
139
|
+
children: [
|
|
140
|
+
node.children.length > 0 ? /*#__PURE__*/ jsx("button", {
|
|
141
|
+
type: "button",
|
|
142
|
+
tabIndex: -1,
|
|
143
|
+
className: "foundation-icon-button",
|
|
144
|
+
"aria-hidden": "true",
|
|
145
|
+
onClick: (event)=>{
|
|
146
|
+
event.stopPropagation();
|
|
147
|
+
setExpanded((current)=>{
|
|
148
|
+
const next = new Set(current);
|
|
149
|
+
if (open) next.delete(node.id);
|
|
150
|
+
else next.add(node.id);
|
|
151
|
+
return next;
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
children: /*#__PURE__*/ jsx(FoundationIcon, {
|
|
155
|
+
name: open ? 'chevron-down' : 'chevron-right'
|
|
156
|
+
})
|
|
157
|
+
}) : /*#__PURE__*/ jsx("span", {
|
|
158
|
+
className: "foundation-tree-spacer"
|
|
159
|
+
}),
|
|
160
|
+
/*#__PURE__*/ jsxs("span", {
|
|
161
|
+
className: "foundation-tree-text",
|
|
162
|
+
children: [
|
|
163
|
+
/*#__PURE__*/ jsx("strong", {
|
|
164
|
+
children: node.label
|
|
165
|
+
}),
|
|
166
|
+
node.title && /*#__PURE__*/ jsx("span", {
|
|
167
|
+
className: "foundation-count",
|
|
168
|
+
children: node.title
|
|
169
|
+
})
|
|
170
|
+
]
|
|
171
|
+
}),
|
|
172
|
+
reports > 0 && /*#__PURE__*/ jsx("span", {
|
|
173
|
+
className: "foundation-count",
|
|
174
|
+
children: formatText(strings.orgReports, {
|
|
175
|
+
count: reports
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}, node.id);
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export { OrgTree };
|
|
186
|
+
//# sourceMappingURL=OrgTree.js.map
|