tycho-components 0.7.16 → 0.7.17
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/dist/AppCard/AppCard.d.ts +10 -0
- package/dist/AppCard/AppCard.js +6 -0
- package/dist/AppCard/index.d.ts +2 -0
- package/dist/AppCard/index.js +2 -0
- package/dist/AppCard/style.scss +26 -0
- package/dist/AppEditable/AppEditable.js +2 -3
- package/dist/AppEditable/style.scss +4 -6
- package/dist/Header/HeaderReplaceAll/HeaderReplaceAll.js +2 -4
- package/dist/Participants/Participants.js +5 -6
- package/dist/Participants/style.scss +1 -7
- package/dist/TreeView/TreeView.js +14 -17
- package/dist/TreeView/TreeViewSearch/TreeViewSearchField.js +1 -1
- package/dist/TreeView/style.scss +4 -9
- package/package.json +2 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DropdownMenuItem } from 'tycho-storybook/dist/DropdownMenu/DropdownMenu';
|
|
2
|
+
import './style.scss';
|
|
3
|
+
type Props = {
|
|
4
|
+
title: string | React.ReactNode;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
footer?: React.ReactNode;
|
|
7
|
+
options?: DropdownMenuItem[];
|
|
8
|
+
};
|
|
9
|
+
export default function AppCard({ title, content, footer, options, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DropdownMenu } from 'tycho-storybook';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
export default function AppCard({ title, content, footer, options, }) {
|
|
5
|
+
return (_jsxs("div", { className: "app-card-container", children: [_jsxs("div", { className: "header", children: [_jsx("div", { className: "title", children: title }), options && (_jsx(DropdownMenu, { list: options }))] }), _jsx("div", { className: "body", children: content }), footer && (_jsx("div", { className: "footer", children: footer }))] }));
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.app-card-container {
|
|
2
|
+
border: 1px solid var(--border-subtle-1);
|
|
3
|
+
border-radius: var(--radius-100);
|
|
4
|
+
|
|
5
|
+
> .header {
|
|
6
|
+
display: flex;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
padding: 8px 16px;
|
|
10
|
+
background-color: var(--layer-layer-2);
|
|
11
|
+
border-bottom: 1px solid var(--border-subtle-1);
|
|
12
|
+
|
|
13
|
+
> .title {
|
|
14
|
+
@include label-large-2;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
> .body {
|
|
19
|
+
padding: 16px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
> .footer {
|
|
23
|
+
padding: 8px 16px;
|
|
24
|
+
border-top: 1px solid var(--border-subtle-1);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
2
|
import { format } from 'date-fns-tz';
|
|
5
3
|
import { useCallback } from 'react';
|
|
6
4
|
import EasyEdit from 'react-easy-edit';
|
|
7
5
|
import { useTranslation } from 'react-i18next';
|
|
8
6
|
import Switch from 'react-switch';
|
|
7
|
+
import { Icon, Tooltip } from 'tycho-storybook';
|
|
9
8
|
import AppColorpicker from '../AppColorpicker';
|
|
10
9
|
import './style.scss';
|
|
11
10
|
// Utility to safely get nested values via a dotted path
|
|
@@ -101,5 +100,5 @@ export default function AppEditable({ translation, fields, item, save, group, cl
|
|
|
101
100
|
};
|
|
102
101
|
return (_jsx(_Fragment, { children: fields.map((field, idx) => (_jsxs("div", { className: `editable-container ${className || ''}`, children: [_jsxs("div", { className: "title", children: [_jsxs("h6", { children: [field.title
|
|
103
102
|
? field.title
|
|
104
|
-
: t(`${translation}:${group || ''}.field.${field.name}`), field.required && _jsx("span", { children: "*" })] }), field.tooltip && (_jsx(
|
|
103
|
+
: t(`${translation}:${group || ''}.field.${field.name}`), field.required && _jsx("span", { children: "*" })] }), field.tooltip && (_jsx(Tooltip, { title: t(`${translation}:${group || ''}.tooltip.${field.name}`), children: _jsx("span", { children: _jsx(Icon, { name: 'help', className: "info", size: "x-small" }) }) }))] }), renderField(field)] }, idx))) }));
|
|
105
104
|
}
|
|
@@ -11,8 +11,6 @@
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
.info {
|
|
14
|
-
width: 16px;
|
|
15
|
-
height: 16px;
|
|
16
14
|
margin-left: var(--spacing-xsmall);
|
|
17
15
|
cursor: pointer;
|
|
18
16
|
}
|
|
@@ -35,7 +33,7 @@
|
|
|
35
33
|
.textarea-code {
|
|
36
34
|
.easy-edit-inline-wrapper .easy-edit-component-wrapper {
|
|
37
35
|
textarea {
|
|
38
|
-
font-family:
|
|
36
|
+
font-family: 'Courier New', Courier, monospace;
|
|
39
37
|
height: 300px;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
@@ -65,7 +63,7 @@
|
|
|
65
63
|
font-size: var(--font-size-body);
|
|
66
64
|
margin-bottom: var(--spacing-xxsmall);
|
|
67
65
|
|
|
68
|
-
input[type=
|
|
66
|
+
input[type='checkbox'] {
|
|
69
67
|
margin-right: 8px;
|
|
70
68
|
}
|
|
71
69
|
}
|
|
@@ -80,12 +78,12 @@
|
|
|
80
78
|
padding-right: var(--spacing-xsmall);
|
|
81
79
|
padding-left: var(--spacing-xsmall);
|
|
82
80
|
|
|
83
|
-
&[name=
|
|
81
|
+
&[name='save'] {
|
|
84
82
|
background-color: var(--color-confirmed);
|
|
85
83
|
color: var(--color-surface);
|
|
86
84
|
}
|
|
87
85
|
|
|
88
|
-
&[name=
|
|
86
|
+
&[name='cancel'] {
|
|
89
87
|
background-color: var(--color-error);
|
|
90
88
|
color: var(--color-surface);
|
|
91
89
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { faArrowsRotate } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
2
|
import { useState } from 'react';
|
|
5
3
|
import { Button, OverlayTrigger, Popover } from 'react-bootstrap';
|
|
6
4
|
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import { getCurrentInput, getCurrentOnChange } from 'tycho-storybook';
|
|
5
|
+
import { IconButton, getCurrentInput, getCurrentOnChange } from 'tycho-storybook';
|
|
8
6
|
import './style.scss';
|
|
9
7
|
export default function HeaderReplaceAll() {
|
|
10
8
|
const { t } = useTranslation('header');
|
|
@@ -27,5 +25,5 @@ export default function HeaderReplaceAll() {
|
|
|
27
25
|
}
|
|
28
26
|
};
|
|
29
27
|
const popoverReplace = (_jsx(Popover, { className: "popover-replace", children: _jsxs(Popover.Body, { children: [_jsx("input", { type: "text", placeholder: t('replace.find.placeholder'), value: findValue, onChange: (e) => setFindValue(e.target.value) }), _jsx("input", { type: "text", placeholder: t('replace.placeholder'), value: replaceValue, onChange: (e) => setReplaceValue(e.target.value) }), _jsx(Button, { size: "sm", onClick: handleReplaceAll, children: "confirm" })] }) }));
|
|
30
|
-
return (_jsx(OverlayTrigger, { placement: "bottom", trigger: "click", overlay: popoverReplace, rootClose: true, children: _jsx(
|
|
28
|
+
return (_jsx(OverlayTrigger, { placement: "bottom", trigger: "click", overlay: popoverReplace, rootClose: true, children: _jsx(IconButton, { name: "autorenew", size: "small", title: t('replace.all.tooltip') }) }));
|
|
31
29
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { faPlus, faTrash } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
2
|
import { useEffect, useState } from 'react';
|
|
5
|
-
import {
|
|
3
|
+
import { Form } from 'react-bootstrap';
|
|
6
4
|
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import { Button } from 'tycho-storybook';
|
|
7
6
|
import AppEditable from '../AppEditable';
|
|
8
7
|
import { useMessageUtils } from '../configs/useMessageUtils';
|
|
9
8
|
import ParticipantCreate from './ParticipantCreate';
|
|
@@ -40,12 +39,12 @@ export default function Participants({ document, participants, onChange, useChat
|
|
|
40
39
|
if (participants.length > 0)
|
|
41
40
|
setParticipant(participants[0]);
|
|
42
41
|
}, []);
|
|
43
|
-
return (_jsxs("div", { className: "participants-container", children: [_jsxs("div", { className: "header", children: [_jsx("h3", { children: t('label.title') }), _jsx("div", { className: "actions", children:
|
|
42
|
+
return (_jsxs("div", { className: "participants-container", children: [_jsxs("div", { className: "header", children: [_jsx("h3", { children: t('label.title') }), _jsx("div", { className: "actions", children: _jsx(Button, { icon: "add", text: t('button.label.add'), onClick: () => setOpenCreate(true), size: "small", mode: "outlined" }) })] }), _jsx("div", { className: "body", children: participant && (_jsxs(_Fragment, { children: [_jsx(Form.Select, { onChange: (e) => setParticipant(participants[Number(e.target.value)]), value: participant
|
|
44
43
|
? participants.findIndex((p) => p.code === participant.code)
|
|
45
|
-
: 0, children: participants.map((el, idx) => (_jsx("option", { value: idx, children: `${el.code} - ${el.name}` }, idx))) }), _jsx(AppEditable, { translation: "participants", group: "participant", save: handleSave, item: { ...participant, uid: document }, fields: PARTICIPANT_FIELDS, className: "fields", reference: "code" }), useChat && (_jsx(AppEditable, { translation: "participants", group: "participant", save: handleSave, item: { ...participant, uid: document }, fields: CHAT_FIELDS, className: "fields", reference: "code" })), _jsx("div", { className: "footer", children:
|
|
44
|
+
: 0, children: participants.map((el, idx) => (_jsx("option", { value: idx, children: `${el.code} - ${el.name}` }, idx))) }), _jsx(AppEditable, { translation: "participants", group: "participant", save: handleSave, item: { ...participant, uid: document }, fields: PARTICIPANT_FIELDS, className: "fields", reference: "code" }), useChat && (_jsx(AppEditable, { translation: "participants", group: "participant", save: handleSave, item: { ...participant, uid: document }, fields: CHAT_FIELDS, className: "fields", reference: "code" })), _jsx("div", { className: "footer", children: _jsx(Button, { icon: "delete", text: t('common:button.remove'), size: "small", className: "danger", onClick: () => {
|
|
46
45
|
setParticipant(participant);
|
|
47
46
|
setOpenRemove(true);
|
|
48
|
-
}
|
|
47
|
+
} }) })] })) }), participant && openRemove && (_jsx(ParticipantRemove, { document: document, onChange: (list) => {
|
|
49
48
|
onChange(list);
|
|
50
49
|
setParticipant(list.length > 0 ? list[0] : undefined);
|
|
51
50
|
setOpenRemove(false);
|
|
@@ -1,18 +1,12 @@
|
|
|
1
1
|
.participants-container {
|
|
2
2
|
.header {
|
|
3
3
|
display: flex;
|
|
4
|
+
align-items: center;
|
|
4
5
|
background-color: var(--color-secondary);
|
|
5
6
|
padding: 8px 16px;
|
|
6
7
|
|
|
7
8
|
.actions {
|
|
8
9
|
margin-left: auto;
|
|
9
|
-
margin-top: auto;
|
|
10
|
-
margin-bottom: auto;
|
|
11
|
-
|
|
12
|
-
.action {
|
|
13
|
-
border: var(--border-default);
|
|
14
|
-
padding: 0px 16px;
|
|
15
|
-
}
|
|
16
10
|
}
|
|
17
11
|
}
|
|
18
12
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { faDiagramProject, faDownload, faExpand, faInfoCircle, faMagnifyingGlass, faUpRightAndDownLeftFromCenter, } from '@fortawesome/free-solid-svg-icons';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
2
|
import { saveAs } from 'file-saver';
|
|
5
3
|
import html2canvas from 'html2canvas';
|
|
6
4
|
import { useEffect, useState } from 'react';
|
|
7
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { IconButton } from 'tycho-storybook';
|
|
8
7
|
import AppPlaceholder from '../AppPlaceholder';
|
|
9
8
|
import DateUtils from '../functions/DateUtils';
|
|
10
9
|
import SentenceUtils from '../functions/SentenceUtils';
|
|
@@ -117,13 +116,12 @@ export default function TreeView({ struct, expression, selector = 'canvas-tree',
|
|
|
117
116
|
if (invalid) {
|
|
118
117
|
return (_jsx(AppPlaceholder, { text: placeholder || t('placeholder.sentence.notparsed') }));
|
|
119
118
|
}
|
|
120
|
-
return (_jsxs("div", { className: "tree-view-container", children: [cy &&
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}), showSearchModal && cy && (_jsx(TreeViewSearch, { struct: struct, cy: cy, onClose: closeSearchModal, searchCriteria: searchCriteria, setSearchCriteria: setSearchCriteria })), _jsx("div", { id: selector, className: "canvas-tree" }), showInfo && (_jsxs("div", { className: "info", children: [_jsx("span", { children: SentenceUtils.getAsText(struct) }), translations &&
|
|
119
|
+
return (_jsxs("div", { className: "tree-view-container", children: [_jsx("div", { className: "floating-buttons", children: cy &&
|
|
120
|
+
getButtons(generateImage, reset, onClickExpression || downloadPsd, toggleInfo, onExpand, expression, openSearchModal)
|
|
121
|
+
.filter((btn) => btn.condition)
|
|
122
|
+
.map((btn, i) => {
|
|
123
|
+
return (_jsx(IconButton, { name: btn.icon, title: t(btn.title), onClick: btn.onClick, size: "small", mode: "ghost" }, i));
|
|
124
|
+
}) }), showSearchModal && cy && (_jsx(TreeViewSearch, { struct: struct, cy: cy, onClose: closeSearchModal, searchCriteria: searchCriteria, setSearchCriteria: setSearchCriteria })), _jsx("div", { id: selector, className: "canvas-tree" }), showInfo && (_jsxs("div", { className: "info", children: [_jsx("span", { children: SentenceUtils.getAsText(struct) }), translations &&
|
|
127
125
|
Object.entries(translations).map(([k, v]) => (_jsxs("div", { className: "translation", children: [_jsxs("b", { children: [k, ":"] }), _jsx("span", { children: v })] }, k))), struct.parsed && (_jsxs("span", { className: "date", children: [t('date.parsed'), ' ', DateUtils.formatDateTime(struct.parsed, 'dd/MM/yyyy HH:mm:ss')] }))] }))] }));
|
|
128
126
|
}
|
|
129
127
|
const getButtons = (generateImage, reset, downloadPsd, toggleInfo, onExpand, expression, openSearchModal) => [
|
|
@@ -131,37 +129,36 @@ const getButtons = (generateImage, reset, downloadPsd, toggleInfo, onExpand, exp
|
|
|
131
129
|
condition: true,
|
|
132
130
|
title: 'button.download.tree',
|
|
133
131
|
onClick: generateImage,
|
|
134
|
-
icon:
|
|
132
|
+
icon: 'download',
|
|
135
133
|
},
|
|
136
134
|
{
|
|
137
135
|
condition: true,
|
|
138
136
|
title: 'button.recenter.tree',
|
|
139
137
|
onClick: reset,
|
|
140
|
-
icon:
|
|
138
|
+
icon: 'fullscreen',
|
|
141
139
|
},
|
|
142
140
|
{
|
|
143
141
|
condition: !!expression,
|
|
144
142
|
title: 'button.download.penn',
|
|
145
143
|
onClick: downloadPsd,
|
|
146
|
-
icon:
|
|
147
|
-
extraClass: 'fa-rotate-90',
|
|
144
|
+
icon: 'graph_4',
|
|
148
145
|
},
|
|
149
146
|
{
|
|
150
147
|
condition: !!onExpand,
|
|
151
148
|
title: 'button.expand.tree',
|
|
152
|
-
onClick: onExpand,
|
|
153
|
-
icon:
|
|
149
|
+
onClick: onExpand || (() => { }),
|
|
150
|
+
icon: 'open_in_full',
|
|
154
151
|
},
|
|
155
152
|
{
|
|
156
153
|
condition: true,
|
|
157
154
|
title: 'button.info',
|
|
158
155
|
onClick: toggleInfo,
|
|
159
|
-
icon:
|
|
156
|
+
icon: 'info',
|
|
160
157
|
},
|
|
161
158
|
{
|
|
162
159
|
condition: true,
|
|
163
160
|
title: 'button.search',
|
|
164
161
|
onClick: openSearchModal || (() => { }),
|
|
165
|
-
icon:
|
|
162
|
+
icon: 'search',
|
|
166
163
|
},
|
|
167
164
|
];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from 'react-i18next';
|
|
3
|
-
import './style.scss';
|
|
4
3
|
import { Icon, IconButton, Tag } from 'tycho-storybook';
|
|
4
|
+
import './style.scss';
|
|
5
5
|
export default function TreeViewSearchField({ label, value, badges, onValueChange, onAddBadge, onRemoveBadge, }) {
|
|
6
6
|
const { t } = useTranslation('tree');
|
|
7
7
|
const handleKeyPress = (e) => {
|
package/dist/TreeView/style.scss
CHANGED
|
@@ -10,18 +10,13 @@
|
|
|
10
10
|
border-radius: var(--border-radius-button);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
.floating-
|
|
13
|
+
.floating-buttons {
|
|
14
|
+
display: flex;
|
|
14
15
|
position: absolute;
|
|
15
16
|
top: 16px;
|
|
17
|
+
right: 16px;
|
|
16
18
|
z-index: 1100;
|
|
17
|
-
|
|
18
|
-
border: none;
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
|
|
21
|
-
svg {
|
|
22
|
-
width: 24px;
|
|
23
|
-
height: 24px;
|
|
24
|
-
}
|
|
19
|
+
gap: 8px;
|
|
25
20
|
}
|
|
26
21
|
|
|
27
22
|
.info {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tycho-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.17",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -16,10 +16,6 @@
|
|
|
16
16
|
"dist/"
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@fortawesome/fontawesome-svg-core": "^6.4.2",
|
|
20
|
-
"@fortawesome/free-regular-svg-icons": "^6.4.2",
|
|
21
|
-
"@fortawesome/free-solid-svg-icons": "^6.4.2",
|
|
22
|
-
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
23
19
|
"@tanstack/react-table": "^8.20.6",
|
|
24
20
|
"axios": "^1.13.2",
|
|
25
21
|
"classnames": "^2.5.1",
|
|
@@ -51,7 +47,7 @@
|
|
|
51
47
|
"react-hook-form": "^7.45.2",
|
|
52
48
|
"react-i18next": "^13.0.2",
|
|
53
49
|
"react-router-dom": "^6.14.2",
|
|
54
|
-
"tycho-storybook": "0.4.
|
|
50
|
+
"tycho-storybook": "0.4.15",
|
|
55
51
|
"yup": "^1.2.0"
|
|
56
52
|
},
|
|
57
53
|
"devDependencies": {
|