tycho-components 0.41.4 → 0.41.6

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.
@@ -1,6 +1,7 @@
1
1
  export declare const CommentsTexts: {
2
2
  en: {
3
3
  "label.title.comments": string;
4
+ "label.header.add": string;
4
5
  "placeholder.comment.text": string;
5
6
  "placeholder.comment.title": string;
6
7
  "placeholder.comment.person": string;
@@ -40,6 +41,7 @@ export declare const CommentsTexts: {
40
41
  };
41
42
  "pt-BR": {
42
43
  "label.title.comments": string;
44
+ "label.header.add": string;
43
45
  "placeholder.comment.text": string;
44
46
  "placeholder.comment.title": string;
45
47
  "placeholder.comment.person": string;
@@ -79,6 +81,7 @@ export declare const CommentsTexts: {
79
81
  };
80
82
  it: {
81
83
  "label.title.comments": string;
84
+ "label.header.add": string;
82
85
  "placeholder.comment.text": string;
83
86
  "placeholder.comment.title": string;
84
87
  "placeholder.comment.person": string;
@@ -1,6 +1,7 @@
1
1
  export const CommentsTexts = {
2
2
  en: {
3
3
  "label.title.comments": "Comments",
4
+ "label.header.add": "Add a comment",
4
5
  "placeholder.comment.text": "Your comment",
5
6
  "placeholder.comment.title": "Title (optional)",
6
7
  "placeholder.comment.person": "Select person",
@@ -40,6 +41,7 @@ export const CommentsTexts = {
40
41
  },
41
42
  "pt-BR": {
42
43
  "label.title.comments": "Comentários",
44
+ "label.header.add": "Adicionar um comentário",
43
45
  "placeholder.comment.text": "Sua comentário",
44
46
  "placeholder.comment.title": "Título (opcional)",
45
47
  "placeholder.comment.person": "Selecione a pessoa",
@@ -79,6 +81,7 @@ export const CommentsTexts = {
79
81
  },
80
82
  it: {
81
83
  "label.title.comments": "Commenti",
84
+ "label.header.add": "Aggiungi un commento",
82
85
  "placeholder.comment.text": "Il tuo commento",
83
86
  "placeholder.comment.title": "Titolo (facoltativo)",
84
87
  "placeholder.comment.person": "Seleziona persona",
@@ -87,15 +87,15 @@ export default function CommentAdd({ uid, mode, users, references, keywords, com
87
87
  createdForm.setValue('requested', current.filter((id) => id !== uidToRemove), { shouldDirty: true });
88
88
  };
89
89
  const availableUsers = users.filter((user) => !requested.includes(user.uid));
90
- return (_jsxs("div", { className: "comment-add-container", children: [_jsx("div", { className: "form-tabs", children: _jsxs(Tabs, { value: activeTab, onChange: (_, next) => setActiveTab(next), children: [_jsx(Tab, { label: t('tab.write'), value: "write" }), _jsx(Tab, { label: t('tab.preview'), value: "preview" })] }) }), activeTab === 'write' ? (_jsx("div", { className: "form-editor", "data-color-mode": "light", children: _jsx(MDEditor, { height: 220, value: value, preview: "edit", onChange: (next) => createdForm.setValue('value', next || '', {
91
- shouldValidate: true,
92
- shouldDirty: true,
93
- }), textareaProps: {
94
- placeholder: t('placeholder.comment.text'),
95
- } }) })) : (_jsx("div", { className: "form-preview", "data-color-mode": "light", children: value.trim() ? (_jsx(MDEditor.Markdown, { source: value })) : (_jsx("span", { className: "preview-empty", children: t('placeholder.preview.empty') })) })), _jsxs("div", { className: "form-footer", children: [_jsx(SelectField, { label: reply ? t('input.user.reply') : t('input.user'), attr: "userPicker", createdForm: createdForm, placeholder: t('common:generic.placeholder.select'), options: FormUtils.convertList(availableUsers, 'name', 'uid'), showEndAdornment: false, onChange: handleUserPick }), requested.length > 0 && (_jsx("div", { className: "selected-users", children: requested.map((userUid) => {
96
- const user = users.find((u) => u.uid === userUid);
97
- return (_jsxs("div", { className: "selected-user", children: [_jsx("span", { className: "name", children: user?.name || userUid }), _jsx(IconButton, { name: "close", size: "x-small", mode: "ghost", onClick: () => handleRemoveUser(userUid) })] }, userUid));
98
- }) })), _jsxs("div", { className: "buttons", children: [_jsx(Button, { onClick: onClose, text: t('button.discard'), color: "danger", size: "small" }), _jsx(Button, { onClick: comment ? handleUpdate : handleAdd, text: comment ? t('label.button.update') : t('label.button.add'), disabled: !createdForm.formState.isValid, size: "small" })] })] })] }));
90
+ return (_jsxs("div", { className: "comment-add-container", children: [_jsx("div", { className: "header", children: t('label.header.add') }), _jsxs("div", { className: "body", children: [_jsx("div", { className: "form-tabs", children: _jsxs(Tabs, { value: activeTab, onChange: (_, next) => setActiveTab(next), children: [_jsx(Tab, { label: t('tab.write'), value: "write" }), _jsx(Tab, { label: t('tab.preview'), value: "preview" })] }) }), activeTab === 'write' ? (_jsx("div", { className: "form-editor", "data-color-mode": "light", children: _jsx(MDEditor, { height: 220, value: value, preview: "edit", onChange: (next) => createdForm.setValue('value', next || '', {
91
+ shouldValidate: true,
92
+ shouldDirty: true,
93
+ }), textareaProps: {
94
+ placeholder: t('placeholder.comment.text'),
95
+ } }) })) : (_jsx("div", { className: "form-preview", "data-color-mode": "light", children: value.trim() ? (_jsx(MDEditor.Markdown, { source: value })) : (_jsx("span", { className: "preview-empty", children: t('placeholder.preview.empty') })) })), _jsxs("div", { className: "form-footer", children: [_jsx(SelectField, { label: reply ? t('input.user.reply') : t('input.user'), attr: "userPicker", createdForm: createdForm, placeholder: t('common:generic.placeholder.select'), options: FormUtils.convertList(availableUsers, 'name', 'uid'), showEndAdornment: false, onChange: handleUserPick }), requested.length > 0 && (_jsx("div", { className: "selected-users", children: requested.map((userUid) => {
96
+ const user = users.find((u) => u.uid === userUid);
97
+ return (_jsxs("div", { className: "selected-user", children: [_jsx("span", { className: "name", children: user?.name || userUid }), _jsx(IconButton, { name: "close", size: "x-small", mode: "ghost", onClick: () => handleRemoveUser(userUid) })] }, userUid));
98
+ }) })), _jsxs("div", { className: "buttons", children: [_jsx(Button, { onClick: onClose, text: t('button.discard'), color: "danger", size: "small" }), _jsx(Button, { onClick: comment ? handleUpdate : handleAdd, text: comment ? t('label.button.update') : t('label.button.add'), disabled: !createdForm.formState.isValid, size: "small" })] })] })] })] }));
99
99
  }
100
100
  const getFormSchema = (t) => yup.object().shape({
101
101
  id: yup.string().optional(),
@@ -1,124 +1,134 @@
1
1
  .comment-add-container {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- margin-bottom: var(--spacing-200);
5
- border: 1px solid var(--border-subtle-1);
6
- border-radius: var(--radius-200);
7
- overflow: hidden;
8
- background-color: var(--background-default);
9
4
  margin-top: 16px;
5
+ gap: 8px;
10
6
 
11
- .form-tabs {
12
- padding: 0 var(--spacing-150);
13
- background-color: var(--layer-hover-2);
14
- border-bottom: 1px solid var(--border-subtle-1);
7
+ .header {
8
+ @include body-medium-2;
9
+ }
15
10
 
16
- .MuiTabs-root {
17
- min-height: unset;
18
- }
11
+ .body {
12
+ display: flex;
13
+ flex-direction: column;
14
+ margin-bottom: var(--spacing-200);
15
+ border: 1px solid var(--border-subtle-1);
16
+ border-radius: var(--radius-200);
17
+ overflow: hidden;
18
+ background-color: var(--background-default);
19
19
 
20
- .MuiTabs-indicator {
21
- background-color: var(--border-hover);
22
- }
20
+ .form-tabs {
21
+ padding: 0 var(--spacing-150);
22
+ background-color: var(--layer-hover-2);
23
+ border-bottom: 1px solid var(--border-subtle-1);
23
24
 
24
- .MuiTab-root {
25
- @include label-medium-1;
26
- min-height: unset;
27
- min-width: unset;
28
- padding: var(--spacing-100) var(--spacing-150);
29
- text-transform: none;
30
- color: var(--text-secondary);
25
+ .MuiTabs-root {
26
+ min-height: unset;
27
+ }
31
28
 
32
- &.Mui-selected {
33
- color: var(--text-primary);
29
+ .MuiTabs-indicator {
30
+ background-color: var(--border-hover);
31
+ }
32
+
33
+ .MuiTab-root {
34
+ @include label-medium-1;
35
+ min-height: unset;
36
+ min-width: unset;
37
+ padding: var(--spacing-100) var(--spacing-150);
38
+ text-transform: none;
39
+ color: var(--text-secondary);
40
+
41
+ &.Mui-selected {
42
+ color: var(--text-primary);
43
+ }
34
44
  }
35
45
  }
36
- }
37
46
 
38
- .form-editor {
39
- .w-md-editor {
40
- border: none;
41
- border-radius: 0;
42
- box-shadow: none;
47
+ .form-editor {
48
+ .w-md-editor {
49
+ border: none;
50
+ border-radius: 0;
51
+ box-shadow: none;
43
52
 
44
- .w-md-editor-toolbar {
45
- border-bottom: 1px solid var(--border-subtle-1);
46
- background-color: var(--background-default);
47
- padding: var(--spacing-050) var(--spacing-100);
53
+ .w-md-editor-toolbar {
54
+ border-bottom: 1px solid var(--border-subtle-1);
55
+ background-color: var(--background-default);
56
+ padding: var(--spacing-050) var(--spacing-100);
48
57
 
49
- li button {
50
- padding: 0 var(--spacing-050);
58
+ li button {
59
+ padding: 0 var(--spacing-050);
51
60
 
52
- > svg {
53
- width: 16px;
54
- height: 16px;
61
+ > svg {
62
+ width: 16px;
63
+ height: 16px;
64
+ }
55
65
  }
56
66
  }
57
- }
58
67
 
59
- .w-md-editor-content {
60
- background-color: var(--background-default);
68
+ .w-md-editor-content {
69
+ background-color: var(--background-default);
70
+ }
61
71
  }
62
72
  }
63
- }
64
-
65
- .form-preview {
66
- min-height: 220px;
67
- padding: var(--spacing-150);
68
- background-color: var(--background-default);
69
73
 
70
- .preview-empty {
71
- @include helper-small-1;
72
- color: var(--text-tertiary);
73
- }
74
+ .form-preview {
75
+ min-height: 220px;
76
+ padding: var(--spacing-150);
77
+ background-color: var(--background-default);
74
78
 
75
- .wmde-markdown {
76
- background: transparent;
77
- }
78
- }
79
-
80
- .form-footer {
81
- display: flex;
82
- flex-direction: column;
83
- gap: var(--spacing-100);
84
- padding: var(--spacing-150);
85
- border-top: 1px solid var(--border-subtle-1);
86
- background-color: var(--background-default);
79
+ .preview-empty {
80
+ @include helper-small-1;
81
+ color: var(--text-tertiary);
82
+ }
87
83
 
88
- > .ds-select-text {
89
- margin-bottom: 0;
84
+ .wmde-markdown {
85
+ background: transparent;
86
+ }
90
87
  }
91
88
 
92
- .selected-users {
89
+ .form-footer {
93
90
  display: flex;
94
- flex-wrap: wrap;
91
+ flex-direction: column;
95
92
  gap: var(--spacing-100);
96
- }
93
+ padding: var(--spacing-150);
94
+ border-top: 1px solid var(--border-subtle-1);
95
+ background-color: var(--background-default);
97
96
 
98
- .selected-user {
99
- display: inline-flex;
100
- align-items: center;
101
- gap: var(--spacing-050);
102
- padding: 4px 8px;
103
- border: 1px solid var(--border-subtle-1);
104
- border-radius: var(--radius-100);
105
- background-color: var(--layer-hover-2);
97
+ > .ds-select-text {
98
+ margin-bottom: 0;
99
+ }
106
100
 
107
- .name {
108
- @include label-small-1;
109
- color: var(--text-primary);
101
+ .selected-users {
102
+ display: flex;
103
+ flex-wrap: wrap;
104
+ gap: var(--spacing-100);
110
105
  }
111
106
 
112
- .ds-icon-button.x-small {
113
- width: 16px;
114
- height: 16px;
107
+ .selected-user {
108
+ display: inline-flex;
109
+ align-items: center;
110
+ gap: var(--spacing-050);
111
+ padding: 4px 8px;
112
+ border: 1px solid var(--border-subtle-1);
113
+ border-radius: var(--radius-100);
114
+ background-color: var(--layer-hover-2);
115
+
116
+ .name {
117
+ @include label-small-1;
118
+ color: var(--text-primary);
119
+ }
120
+
121
+ .ds-icon-button.x-small {
122
+ width: 16px;
123
+ height: 16px;
124
+ }
115
125
  }
116
- }
117
126
 
118
- > .buttons {
119
- display: flex;
120
- justify-content: flex-end;
121
- gap: var(--spacing-100);
127
+ > .buttons {
128
+ display: flex;
129
+ justify-content: flex-end;
130
+ gap: var(--spacing-100);
131
+ }
122
132
  }
123
133
  }
124
134
  }
@@ -5,8 +5,8 @@ const LAST_DOCKED_STORAGE_KEY = 'tycho-comments-last-docked';
5
5
  const DRAWER_MIN_WIDTH = 320;
6
6
  const DRAWER_MIN_HEIGHT = 200;
7
7
  const POPUP_NAME = 'tycho-comments';
8
- const POPUP_MIN_WIDTH = 960;
9
- const POPUP_MIN_HEIGHT = 720;
8
+ const POPUP_MIN_WIDTH = 672;
9
+ const POPUP_MIN_HEIGHT = 576;
10
10
  const isDockPosition = (value) => value === 'left' ||
11
11
  value === 'right' ||
12
12
  value === 'bottom' ||
@@ -135,8 +135,8 @@ const getUndockedPopupSize = () => {
135
135
  }
136
136
  const availWidth = window.screen.availWidth || window.outerWidth;
137
137
  const availHeight = window.screen.availHeight || window.outerHeight;
138
- const width = Math.min(Math.max(Math.round(availWidth * 0.75), POPUP_MIN_WIDTH), availWidth - 40);
139
- const height = Math.min(Math.max(Math.round(availHeight * 0.85), POPUP_MIN_HEIGHT), availHeight - 40);
138
+ const width = Math.min(Math.max(Math.round(availWidth * 0.525), POPUP_MIN_WIDTH), availWidth - 40);
139
+ const height = Math.min(Math.max(Math.round(availHeight * 0.68), POPUP_MIN_HEIGHT), availHeight - 40);
140
140
  return { width, height };
141
141
  };
142
142
  const copyStylesToPopup = (popup) => {
@@ -7,8 +7,6 @@ type Props = {
7
7
  onClose: () => void;
8
8
  mode: 'lexicon' | 'corpus' | 'parser';
9
9
  onChange?: (a: Comment[]) => void;
10
- /** Opens the add-comment panel on mount (useful in Storybook). */
11
- initialOpenAdd?: boolean;
12
10
  };
13
- export default function Comments({ uid, keywords, references, mode, onClose, onChange, initialOpenAdd, }: Props): import("react").JSX.Element;
11
+ export default function Comments({ uid, keywords, references, mode, onClose, onChange, }: Props): import("react").JSX.Element;
14
12
  export {};
@@ -26,9 +26,9 @@ function CommentsHeader({ hasEditAccess, onToggleAdd, onClose, dockMenuOptions,
26
26
  const { t } = useTranslation('comments');
27
27
  return (_jsxs("div", { className: "header", children: [_jsx(IconButton, { name: "close", size: "small", mode: "ghost", onClick: onClose }), _jsx("span", { className: "title", children: t('label.title.comments') }), _jsxs("div", { className: "actions", children: [hasEditAccess && (_jsx(Button, { text: t('button.add'), icon: "add", mode: "outlined", size: "small", className: "edit-button", onClick: onToggleAdd })), _jsx(DropdownMenu, { list: dockMenuOptions })] })] }));
28
28
  }
29
- export default function Comments({ uid, keywords, references, mode, onClose, onChange, initialOpenAdd = false, }) {
29
+ export default function Comments({ uid, keywords, references, mode, onClose, onChange, }) {
30
30
  const { t } = useTranslation('comments');
31
- const [openAddComment, setOpenAddComment] = useState(initialOpenAdd);
31
+ const [openAddComment, setOpenAddComment] = useState(false);
32
32
  const [comment, setComment] = useState();
33
33
  const [comments, setComments] = useState();
34
34
  const [users, setUsers] = useState([]);
@@ -66,7 +66,8 @@ const buildEditionGroups = (corpus) => {
66
66
  {
67
67
  id: 'diplomatic',
68
68
  labelKey: 'edition.group.diplomatic',
69
- tiers: [StructuralEditionTiers.ORIGINAL],
69
+ // No selectable child levels — diplomatic is the original form itself.
70
+ tiers: [],
70
71
  defaultTier: StructuralEditionTiers.ORIGINAL,
71
72
  },
72
73
  ...(semi.length > 0
@@ -94,7 +95,7 @@ const buildEditionGroups = (corpus) => {
94
95
  const getUngroupedEditionTiers = (corpus) => getCorpusEditionTiers(corpus)
95
96
  .filter((tier) => tier.group !== 'semiDiplomatic' && tier.group !== 'modernized')
96
97
  .map((tier) => tier.symbol);
97
- const findGroupForTier = (tier, corpus) => buildEditionGroups(corpus).find((group) => group.tiers.includes(tier));
98
+ const findGroupForTier = (tier, corpus) => buildEditionGroups(corpus).find((group) => group.tiers.includes(tier) || group.defaultTier === tier);
98
99
  const isAbbreviationTier = (symbol, corpus) => getCorpusEditionTiers(corpus).some((tier) => tier.symbol === symbol && tier.abbreviation);
99
100
  const validateEditionTiers = (tiers) => {
100
101
  const symbols = new Set();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.41.4",
4
+ "version": "0.41.6",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {