corpushub-design-system 0.0.11 → 0.0.13

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.
@@ -34,6 +34,12 @@ export declare function resolveBrandLogoShort(options?: {
34
34
  brandId?: string;
35
35
  origin?: string;
36
36
  }): string;
37
+ /**
38
+ * Brand YouTube channel URL for shell CTAs (Help modal, etc.).
39
+ */
40
+ export declare function resolveBrandYoutube(options?: {
41
+ brandId?: string;
42
+ }): string;
37
43
  /**
38
44
  * Resolve platform branding for a front-end app.
39
45
  * Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
@@ -35,11 +35,11 @@ export function brandAssetBase(brandId, originRaw) {
35
35
  return `${origin}/brands/${brandId}`;
36
36
  }
37
37
  function resolveBrandId(raw) {
38
- return raw?.toLowerCase() === 'corpushub' ? 'corpushub' : 'tycho';
38
+ return raw?.toLowerCase() === 'tycho' ? 'tycho' : 'corpushub';
39
39
  }
40
40
  function readEnvBrandId() {
41
41
  try {
42
- return import.meta.env?.VITE_APP_BRAND;
42
+ return import.meta.env.VITE_APP_BRAND;
43
43
  }
44
44
  catch {
45
45
  return undefined;
@@ -47,7 +47,7 @@ function readEnvBrandId() {
47
47
  }
48
48
  function readEnvOrigin() {
49
49
  try {
50
- return import.meta.env?.VITE_APP_ORIGIN;
50
+ return import.meta.env.VITE_APP_ORIGIN;
51
51
  }
52
52
  catch {
53
53
  return undefined;
@@ -71,6 +71,13 @@ export function resolveBrandLogoShort(options) {
71
71
  const origin = options?.origin ?? readEnvOrigin();
72
72
  return `${brandAssetBase(id, origin)}/logo-short.png`;
73
73
  }
74
+ /**
75
+ * Brand YouTube channel URL for shell CTAs (Help modal, etc.).
76
+ */
77
+ export function resolveBrandYoutube(options) {
78
+ const id = resolveBrandId(options?.brandId ?? readEnvBrandId());
79
+ return YOUTUBE_BY_BRAND[id];
80
+ }
74
81
  /**
75
82
  * Resolve platform branding for a front-end app.
76
83
  * Pass `options` from Vite plugins (Node) where `import.meta.env` may be unavailable.
@@ -9,12 +9,12 @@ export type { TokenAuthResponse } from './auth/authApi';
9
9
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
10
10
  export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
11
11
  export type { ApiErrorHandled, ApplyAuthErrorHandlingOptions, AuthErrorHandled, AuthErrorHandling, CreateApiClientOptions, ServerErrorHandling, } from './api';
12
- export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, } from './brand';
12
+ export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, resolveBrandYoutube, } from './brand';
13
13
  export type { AppCode, BrandConfig, BrandId } from './brand';
14
14
  export { default as ProfileService } from './services/ProfileService';
15
15
  export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
16
16
  export { TOUR_FALLBACK_LOCALE, TOUR_LOCALES, buildAnchorMap, buildDriveSteps, createTourDriver, defaultMatchPathnames, flattenWorkflowSteps, getWorkflowsForPath, hasMatchingWorkflow, loadKnowledgeBase, localizeKnowledgeBase, pickLocalizedString, resolveAnchor, resolveAnchorById, resolveTourLocale, useDriverTour, waitForSelector, } from './tour';
17
- export type { AnchorSelector, Driver, KnowledgeBase, KnowledgeBaseRaw, LocalizedString, PopoverSide, ResolveKnowledgeBaseUrl, TourAnchor, TourButtonLabels, TourStep, TourStepCopy, TourStepStructural, TourWorkflow, TourWorkflowRaw, UseDriverTourOptions, } from './tour';
17
+ export type { AnchorSelector, DriveStep, Driver, KnowledgeBase, KnowledgeBaseRaw, LocalizedString, PopoverSide, ResolveKnowledgeBaseUrl, TourAnchor, TourButtonLabels, TourStep, TourStepCopy, TourStepStructural, TourWorkflow, TourWorkflowRaw, UseDriverTourOptions, } from './tour';
18
18
  export { AccessRoleName, AccessStatusName, EMPTY_ACCESS } from './types/Access';
19
19
  export type { default as Access, AccessMode, AccessRole, AccessStatus, } from './types/Access';
20
20
  export { conlluAttributes } from './types/Conllu';
@@ -7,7 +7,7 @@ export { buildCrossAppRedirectUrl, clearLocalhostJwtHandoff, isLocalDevHost, per
7
7
  export { installAuthRefreshInterceptor } from './auth/installAuthRefreshInterceptor';
8
8
  export { commonLocalization, commonResources, featureResources, mergeResources, } from './Localization';
9
9
  export { applyAuthErrorHandling, createApiClient, dispatchAccessDeniedError, dispatchApiError, dispatchClientError, dispatchServerApiError, isAccessDeniedApiError, isHandledApiError, isHandledAuthError, markApiErrorHandled, markAuthErrorHandled, parserApiBase, lexiconApiBase, platformApi, resolveAccessDeniedMessage, } from './api';
10
- export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, } from './brand';
10
+ export { brandAssetBase, brandFromEnv, createBrand, resolveBrandLogo, resolveBrandLogoShort, resolveBrandYoutube, } from './brand';
11
11
  export { default as ProfileService } from './services/ProfileService';
12
12
  export { getCommonDispatch, registerCommonDispatch, } from './store/commonDispatchBridge';
13
13
  export { TOUR_FALLBACK_LOCALE, TOUR_LOCALES, buildAnchorMap, buildDriveSteps, createTourDriver, defaultMatchPathnames, flattenWorkflowSteps, getWorkflowsForPath, hasMatchingWorkflow, loadKnowledgeBase, localizeKnowledgeBase, pickLocalizedString, resolveAnchor, resolveAnchorById, resolveTourLocale, useDriverTour, waitForSelector, } from './tour';
@@ -7,12 +7,15 @@ export declare const HelpTexts: {
7
7
  'title.autoOpen': string;
8
8
  'title.resources': string;
9
9
  'title.feedback': string;
10
+ 'title.youtube': string;
10
11
  'button.tour': string;
11
12
  'button.tour.stop': string;
12
13
  'button.updateLiveTourPreference': string;
14
+ 'button.youtube': string;
13
15
  'description.tutorials': string;
14
16
  'description.tour': string;
15
17
  'description.feedback': string;
18
+ 'description.youtube': string;
16
19
  'tour.step.1': string;
17
20
  'tour.step.2': string;
18
21
  'tour.step.3': string;
@@ -30,12 +33,15 @@ export declare const HelpTexts: {
30
33
  'title.autoOpen': string;
31
34
  'title.resources': string;
32
35
  'title.feedback': string;
36
+ 'title.youtube': string;
33
37
  'button.tour': string;
34
38
  'button.tour.stop': string;
35
39
  'button.updateLiveTourPreference': string;
40
+ 'button.youtube': string;
36
41
  'description.tutorials': string;
37
42
  'description.tour': string;
38
43
  'description.feedback': string;
44
+ 'description.youtube': string;
39
45
  'tour.step.1': string;
40
46
  'tour.step.2': string;
41
47
  'tour.step.3': string;
@@ -53,12 +59,15 @@ export declare const HelpTexts: {
53
59
  'title.autoOpen': string;
54
60
  'title.resources': string;
55
61
  'title.feedback': string;
62
+ 'title.youtube': string;
56
63
  'button.tour': string;
57
64
  'button.tour.stop': string;
58
65
  'button.updateLiveTourPreference': string;
66
+ 'button.youtube': string;
59
67
  'description.tutorials': string;
60
68
  'description.tour': string;
61
69
  'description.feedback': string;
70
+ 'description.youtube': string;
62
71
  'tour.step.1': string;
63
72
  'tour.step.2': string;
64
73
  'tour.step.3': string;
@@ -7,12 +7,15 @@ export const HelpTexts = {
7
7
  'title.autoOpen': 'Enable Auto-Open',
8
8
  'title.resources': 'Resources',
9
9
  'title.feedback': 'Send feedback',
10
+ 'title.youtube': 'Watch on YouTube',
10
11
  'button.tour': 'Start Live Tour',
11
12
  'button.tour.stop': 'Stop Live Tour',
12
13
  'button.updateLiveTourPreference': 'Update preference',
14
+ 'button.youtube': 'Open channel',
13
15
  'description.tutorials': 'Access our comprehensive tutorials and documentation',
14
16
  'description.tour': 'Walk through the main areas of this page with an interactive guided tour.',
15
17
  'description.feedback': 'Comments, bugs, ideas — we read every message and include page context automatically.',
18
+ 'description.youtube': 'Short walkthroughs, tips, and product updates — jump into the channel.',
16
19
  'tour.step.1': 'Highlights key controls on the current page',
17
20
  'tour.step.2': 'Explains what each area is for',
18
21
  'tour.step.3': 'Takes only a couple of minutes',
@@ -30,12 +33,15 @@ export const HelpTexts = {
30
33
  'title.autoOpen': 'Ativar Abertura Automática',
31
34
  'title.resources': 'Recursos',
32
35
  'title.feedback': 'Enviar feedback',
36
+ 'title.youtube': 'Assista no YouTube',
33
37
  'button.tour': 'Iniciar Tour ao Vivo',
34
38
  'button.tour.stop': 'Parar Tour ao Vivo',
35
39
  'button.updateLiveTourPreference': 'Atualizar preferência',
40
+ 'button.youtube': 'Abrir canal',
36
41
  'description.tutorials': 'Acesse nossos tutoriais abrangentes e documentação',
37
42
  'description.tour': 'Percorra as áreas principais desta página com um tour guiado interativo.',
38
43
  'description.feedback': 'Comentários, bugs, ideias — lemos cada mensagem e incluímos o contexto da página automaticamente.',
44
+ 'description.youtube': 'Tutoriais curtos, dicas e novidades do produto — confira o canal.',
39
45
  'tour.step.1': 'Destaca os controles principais da página atual',
40
46
  'tour.step.2': 'Explica para que serve cada área',
41
47
  'tour.step.3': 'Leva só alguns minutos',
@@ -53,12 +59,15 @@ export const HelpTexts = {
53
59
  'title.autoOpen': 'Abilita Apertura Automatica',
54
60
  'title.resources': 'Risorse',
55
61
  'title.feedback': 'Invia feedback',
62
+ 'title.youtube': 'Guarda su YouTube',
56
63
  'button.tour': 'Avvia Tour Interattivo',
57
64
  'button.tour.stop': 'Ferma Tour Interattivo',
58
65
  'button.updateLiveTourPreference': 'Aggiorna la preferenza',
66
+ 'button.youtube': 'Apri il canale',
59
67
  'description.tutorials': 'Accedi ai nostri tutorial completi e alla documentazione',
60
68
  'description.tour': 'Esplora le aree principali di questa pagina con un tour guidato interattivo.',
61
69
  'description.feedback': 'Commenti, bug, idee — leggiamo ogni messaggio e includiamo automaticamente il contesto della pagina.',
70
+ 'description.youtube': 'Tutorial brevi, consigli e novità sul prodotto — apri il canale.',
62
71
  'tour.step.1': 'Evidenzia i controlli chiave della pagina corrente',
63
72
  'tour.step.2': 'Spiega a cosa serve ciascuna area',
64
73
  'tour.step.3': 'Richiede solo un paio di minuti',
@@ -4,4 +4,4 @@ export { buildDriveSteps, createTourDriver, hasMatchingWorkflow, } from './drive
4
4
  export { localizeKnowledgeBase, pickLocalizedString, resolveTourLocale, TOUR_FALLBACK_LOCALE, TOUR_LOCALES, } from './localizeKnowledgeBase';
5
5
  export { resolveAnchor, resolveAnchorById, waitForSelector, } from './anchorResolver';
6
6
  export type { AnchorSelector, KnowledgeBase, KnowledgeBaseRaw, LocalizedString, PopoverSide, ResolveKnowledgeBaseUrl, TourAnchor, TourButtonLabels, TourStep, TourStepCopy, TourStepStructural, TourWorkflow, TourWorkflowRaw, UseDriverTourOptions, } from './types';
7
- export type { Driver } from 'driver.js';
7
+ export type { DriveStep, Driver } from 'driver.js';
@@ -2,5 +2,5 @@ import './style.scss';
2
2
  import { CollapsedPageRenderElement, PageRenderElement, PageRenderViewProps } from './types';
3
3
  /** Ensure PARTICIPANT elements carry a sentence uid (API or next-token look-ahead). */
4
4
  export declare function withParticipantSentenceUids(elements: PageRenderElement[]): PageRenderElement[];
5
- export default function PageRenderView({ elements, selectedTier, corpus, displayTags, showLineNumbers, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }: PageRenderViewProps): import("react").JSX.Element;
5
+ export default function PageRenderView({ elements, selectedTier, corpus, displayTags, showLineNumbers, showSectionLabels, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, getSectionLabel, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }: PageRenderViewProps): import("react").JSX.Element;
6
6
  export declare function findPunctuationAfterCollapsedJunction(items: CollapsedPageRenderElement[], junctionIndex: number): number | undefined;
@@ -24,7 +24,7 @@ export function withParticipantSentenceUids(elements) {
24
24
  return element;
25
25
  });
26
26
  }
27
- export default function PageRenderView({ elements, selectedTier, corpus, displayTags = false, showLineNumbers = true, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
27
+ export default function PageRenderView({ elements, selectedTier, corpus, displayTags = false, showLineNumbers = true, showSectionLabels = true, highlightSentenceUid, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, getSectionLabel, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
28
28
  const elementsWithUids = useMemo(() => withParticipantSentenceUids(elements), [elements]);
29
29
  const collapsed = collapseElementsForTier(elementsWithUids, selectedTier, corpus);
30
30
  const punctuationBeforeBreak = new Map();
@@ -36,8 +36,30 @@ export default function PageRenderView({ elements, selectedTier, corpus, display
36
36
  punctuationBeforeBreak.set(index, punctuationIndex);
37
37
  punctuationIndexes.add(punctuationIndex);
38
38
  });
39
+ const sectionLabelByItemKey = useMemo(() => {
40
+ const labels = new Map();
41
+ if (!showSectionLabels || !getSectionLabel)
42
+ return labels;
43
+ const seenSentences = new Set();
44
+ for (const item of collapsed) {
45
+ if (!isTokenBearingItem(item))
46
+ continue;
47
+ const uid = sentenceUidForItem(item);
48
+ if (!uid || seenSentences.has(uid))
49
+ continue;
50
+ // Skip empty categories / hidden tokens so the chip floats over the
51
+ // first actually displayed word of the sentence.
52
+ if (!isVisibleSectionHost(item, displayTags))
53
+ continue;
54
+ seenSentences.add(uid);
55
+ const label = getSectionLabel(uid);
56
+ if (label)
57
+ labels.set(item.key, label);
58
+ }
59
+ return labels;
60
+ }, [collapsed, displayTags, getSectionLabel, showSectionLabels]);
39
61
  const renderItem = (item) => (_jsx(PageRenderElementItem, { item: item, highlight: highlightSentenceUid != null &&
40
- sentenceUidForItem(item) === highlightSentenceUid, showLineNumbers: showLineNumbers, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, getParticipantName: getParticipantName, getParticipantColor: getParticipantColor, onTokenClick: onTokenClick, onTokenHover: onTokenHover, onParticipantHover: onParticipantHover, onParticipantClick: onParticipantClick, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }, item.key));
62
+ sentenceUidForItem(item) === highlightSentenceUid, showLineNumbers: showLineNumbers, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, getParticipantName: getParticipantName, getParticipantColor: getParticipantColor, sectionLabel: sectionLabelByItemKey.get(item.key), onTokenClick: onTokenClick, onTokenHover: onTokenHover, onParticipantHover: onParticipantHover, onParticipantClick: onParticipantClick, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }, item.key));
41
63
  return (_jsx("div", { className: "page-render-elements", children: collapsed.map((item, index) => {
42
64
  if (punctuationIndexes.has(index))
43
65
  return null;
@@ -82,9 +104,40 @@ function sentenceUidForItem(item) {
82
104
  return item.element.uid;
83
105
  return undefined;
84
106
  }
85
- function PageRenderElementItem({ item, highlight, showLineNumbers, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
107
+ function isTokenBearingItem(item) {
108
+ if (item.kind === 'collapsedJunction')
109
+ return true;
110
+ if (item.kind !== 'single' || !item.element.token)
111
+ return false;
112
+ return (item.element.type === PageRenderElementType.TOKEN ||
113
+ item.element.type === PageRenderElementType.JUNCTION_SPLIT ||
114
+ item.element.type === PageRenderElementType.MARK);
115
+ }
116
+ function tokenRefForItem(item) {
117
+ if (item.kind === 'collapsedJunction')
118
+ return item.token;
119
+ return item.element.token;
120
+ }
121
+ /** Matches TokenNode visibility: marks always show; empty categories do not. */
122
+ function isVisibleSectionHost(item, displayTags) {
123
+ const ref = tokenRefForItem(item);
124
+ if (!ref)
125
+ return false;
126
+ const isMark = item.kind === 'single' &&
127
+ item.element.type === PageRenderElementType.MARK;
128
+ if (isMark)
129
+ return true;
130
+ if (!isTokenRefVisible(ref))
131
+ return false;
132
+ // Same rule as TokenNode: split pieces of empty categories are hidden
133
+ // when POS tags are off.
134
+ if (ref.ec && ref.split && !displayTags)
135
+ return false;
136
+ return true;
137
+ }
138
+ function PageRenderElementItem({ item, highlight, showLineNumbers, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, getParticipantName, getParticipantColor, sectionLabel, onTokenClick, onTokenHover, onParticipantHover, onParticipantClick, wrapToken, renderTokenSuffix, }) {
86
139
  if (item.kind === 'collapsedJunction') {
87
- return (_jsx(TokenNode, { refToken: item.token, splitIdx: item.splitIdx ?? 0, isSplit: true, isCollapsedJunction: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
140
+ return (_jsx(TokenNode, { refToken: item.token, splitIdx: item.splitIdx ?? 0, isSplit: true, isCollapsedJunction: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
88
141
  }
89
142
  const { element } = item;
90
143
  switch (element.type) {
@@ -112,20 +165,20 @@ function PageRenderElementItem({ item, highlight, showLineNumbers, displayTags,
112
165
  case PageRenderElementType.MARK:
113
166
  if (!element.token)
114
167
  return null;
115
- return (_jsx(TokenNode, { refToken: element.token, splitIdx: undefined, isMark: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
168
+ return (_jsx(TokenNode, { refToken: element.token, splitIdx: undefined, isMark: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
116
169
  case PageRenderElementType.JUNCTION_SPLIT:
117
170
  if (!element.token)
118
171
  return null;
119
- return (_jsx(TokenNode, { refToken: element.token, splitIdx: element.idx ?? 0, isSplit: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
172
+ return (_jsx(TokenNode, { refToken: element.token, splitIdx: element.idx ?? 0, isSplit: true, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
120
173
  case PageRenderElementType.TOKEN:
121
174
  if (!element.token)
122
175
  return null;
123
- return (_jsx(TokenNode, { refToken: element.token, splitIdx: undefined, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
176
+ return (_jsx(TokenNode, { refToken: element.token, splitIdx: undefined, highlight: highlight, displayTags: displayTags, activeTokenKey: activeTokenKey, selectedTokenKeys: selectedTokenKeys, tokenSelectionKey: tokenSelectionKey, getDisplayValue: getDisplayValue, getTokenStyle: getTokenStyle, getTokenClassName: getTokenClassName, isTokenEdited: isTokenEdited, sectionLabel: sectionLabel, onTokenClick: onTokenClick, onTokenHover: onTokenHover, wrapToken: wrapToken, renderTokenSuffix: renderTokenSuffix }));
124
177
  default:
125
178
  return null;
126
179
  }
127
180
  }
128
- function TokenNode({ refToken, splitIdx, isSplit = false, isMark = false, isCollapsedJunction = false, highlight, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, onTokenClick, onTokenHover, wrapToken, renderTokenSuffix, }) {
181
+ function TokenNode({ refToken, splitIdx, isSplit = false, isMark = false, isCollapsedJunction = false, highlight, displayTags, activeTokenKey, selectedTokenKeys, tokenSelectionKey, getDisplayValue, getTokenStyle, getTokenClassName, isTokenEdited, sectionLabel, onTokenClick, onTokenHover, wrapToken, renderTokenSuffix, }) {
129
182
  const token = tokenRefToToken(refToken);
130
183
  const displaySplits = Boolean(token.ec && token.split && !displayTags);
131
184
  const visible = isMark || isTokenRefVisible(refToken);
@@ -161,5 +214,10 @@ function TokenNode({ refToken, splitIdx, isSplit = false, isMark = false, isColl
161
214
  onTokenClick(refToken, splitIdx, 'sentence', clickModifiers(event));
162
215
  }
163
216
  : undefined, onMouseEnter: () => onTokenHover?.(refToken.uid), onMouseLeave: () => onTokenHover?.(undefined), children: [getDisplayValue(token, splitIdx), displayTags && (_jsxs("b", { className: "tag", children: ["/", token.split ? token.split.t : token.t] })), renderTokenSuffix?.(refToken, token, ctx)] }));
164
- return (_jsx(_Fragment, { children: wrapToken ? wrapToken(refToken, token, content, ctx) : content }));
217
+ const tokenNode = wrapToken
218
+ ? wrapToken(refToken, token, content, ctx)
219
+ : content;
220
+ if (!sectionLabel)
221
+ return _jsx(_Fragment, { children: tokenNode });
222
+ return (_jsxs("span", { className: "section-anchor", children: [_jsx("span", { className: "section", children: sectionLabel }), tokenNode] }));
165
223
  }
@@ -21,7 +21,7 @@
21
21
  }
22
22
 
23
23
  .mark {
24
- font-family: "Georgia", serif;
24
+ font-family: 'Georgia', serif;
25
25
  cursor: pointer;
26
26
  @include body-xmedium-1;
27
27
  display: inline-flex;
@@ -30,7 +30,6 @@
30
30
  margin-bottom: var(--spacing-050);
31
31
  width: auto;
32
32
  background-color: var(--layer-semantic-info);
33
- line-height: var(--spacing-300);
34
33
 
35
34
  &.selected {
36
35
  background-color: var(--layer-semantic-info);
@@ -39,13 +38,12 @@
39
38
  }
40
39
 
41
40
  .token {
42
- font-family: "Georgia", serif;
41
+ font-family: 'Georgia', serif;
43
42
  cursor: pointer;
44
43
  @include body-xmedium-1;
45
44
  display: inline-flex;
46
45
  align-items: center;
47
46
  height: var(--spacing-300);
48
- line-height: var(--spacing-300);
49
47
  min-height: 0;
50
48
  padding: 0 var(--spacing-050);
51
49
  margin-bottom: var(--spacing-050);
@@ -63,7 +61,9 @@
63
61
  }
64
62
 
65
63
  &.edited {
66
- border-bottom: 1px dashed var(--text-on-color-accent);
64
+ //border-bottom: 1px dashed var(--text-on-color-accent);
65
+ text-decoration: underline dashed var(--text-on-color-accent);
66
+ text-underline-offset: 4px;
67
67
  }
68
68
 
69
69
  &.review {
@@ -106,4 +106,26 @@
106
106
  cursor: pointer;
107
107
  height: var(--spacing-300);
108
108
  }
109
+
110
+ .section-anchor {
111
+ position: relative;
112
+ display: inline-flex;
113
+ align-items: center;
114
+ }
115
+
116
+ .section {
117
+ position: absolute;
118
+ left: 0;
119
+ bottom: calc(100% - var(--spacing-050));
120
+ z-index: 1;
121
+ pointer-events: none;
122
+ white-space: nowrap;
123
+ border-radius: var(--radius-100);
124
+ padding: 0 var(--spacing-050);
125
+ background-color: var(--layer-semantic-info);
126
+ border: 1px solid var(--semantic-info-70);
127
+ color: var(--text-primary);
128
+ line-height: 1.2;
129
+ @include helper-small-1;
130
+ }
109
131
  }
@@ -68,6 +68,8 @@ export type PageRenderViewProps = {
68
68
  document?: Document | null;
69
69
  displayTags?: boolean;
70
70
  showLineNumbers?: boolean;
71
+ /** When false, section/block labels are hidden. Defaults to true. */
72
+ showSectionLabels?: boolean;
71
73
  highlightSentenceUid?: string;
72
74
  activeTokenKey?: string;
73
75
  selectedTokenKeys?: Set<string>;
@@ -78,6 +80,8 @@ export type PageRenderViewProps = {
78
80
  isTokenEdited?: (token: Token) => boolean;
79
81
  getParticipantName?: (code: string) => string;
80
82
  getParticipantColor?: (code: string) => string | undefined;
83
+ /** Section/block label for a sentence uid; shown once before that sentence's first token. */
84
+ getSectionLabel?: (sentenceUid: string) => string | undefined;
81
85
  onTokenClick?: (ref: TokenRef, splitIdx: number | undefined, source: TokenClickSource, modifiers: TokenClickModifiers) => void;
82
86
  onTokenHover?: (sentenceUid: string | undefined) => void;
83
87
  onParticipantHover?: (code: string | undefined) => void;
@@ -42,7 +42,7 @@ export default function AsyncSelectField({ className, attr, label, createdForm,
42
42
  }
43
43
  }, []);
44
44
  const hasError = () => !!createdForm.formState.errors[attr];
45
- const getClassNames = cx('ds-select-text', className, {
45
+ const getClassNames = cx('ds-async-select-text', className, {
46
46
  disabled: disabled,
47
47
  });
48
48
  useEffect(() => {
@@ -95,7 +95,7 @@ export default function AsyncSelectField({ className, attr, label, createdForm,
95
95
  field.onChange(trimmed);
96
96
  onChange?.(attr, trimmed);
97
97
  };
98
- return (_jsxs("div", { className: getClassNames, children: [_jsxs("div", { className: "ds-select-text__autofill-trap", "aria-hidden": "true", children: [_jsx("input", { type: "text", tabIndex: -1, autoComplete: "username", name: `${autoCompleteToken}-username`, defaultValue: "" }), _jsx("input", { type: "password", tabIndex: -1, autoComplete: "new-password", name: `${autoCompleteToken}-password`, defaultValue: "" })] }), _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: selectAutocompleteTheme(outerTheme, {
98
+ return (_jsxs("div", { className: getClassNames, children: [_jsxs("div", { className: "ds-async-select-text__autofill-trap", "aria-hidden": "true", children: [_jsx("input", { type: "text", tabIndex: -1, autoComplete: "username", name: `${autoCompleteToken}-username`, defaultValue: "" }), _jsx("input", { type: "password", tabIndex: -1, autoComplete: "new-password", name: `${autoCompleteToken}-password`, defaultValue: "" })] }), _jsx(Controller, { name: fieldName, control: createdForm.control, render: ({ field }) => (_jsxs(ThemeProvider, { theme: selectAutocompleteTheme(outerTheme, {
99
99
  hasLabel: !!label,
100
100
  }), children: [_jsx(FormControl, { fullWidth: true, variant: "filled", disabled: disabled, children: _jsx(Autocomplete, { multiple: multiple, freeSolo: freeSolo, disableCloseOnSelect: multiple, value: field.value ?? (multiple ? [] : null), onChange: (_event, newValue) => {
101
101
  field.onChange(newValue);
@@ -1,32 +1,32 @@
1
- .ds-select-text {
2
- width: 100%;
3
- position: relative;
4
-
5
- &.disabled {
6
- color: var(--text-on-disabled);
7
- cursor: not-allowed;
8
-
9
- input {
10
- cursor: not-allowed;
11
- }
12
- }
13
-
14
- &__autofill-trap {
15
- position: absolute;
16
- width: 0;
17
- height: 0;
18
- overflow: hidden;
19
- opacity: 0;
20
- pointer-events: none;
21
- }
22
- }
23
-
24
- .validation-message {
25
- @include helper-small-1;
26
- margin-top: 4px;
27
-
28
- &.error {
29
- color: var(--text-error);
30
- }
31
- }
1
+ .ds-async-select-text {
2
+ width: 100%;
3
+ position: relative;
4
+
5
+ &.disabled {
6
+ color: var(--text-on-disabled);
7
+ cursor: not-allowed;
8
+
9
+ input {
10
+ cursor: not-allowed;
11
+ }
12
+ }
13
+
14
+ &__autofill-trap {
15
+ position: absolute;
16
+ width: 0;
17
+ height: 0;
18
+ overflow: hidden;
19
+ opacity: 0;
20
+ pointer-events: none;
21
+ }
22
+ }
23
+
24
+ .validation-message {
25
+ @include helper-small-1;
26
+ margin-top: 4px;
27
+
28
+ &.error {
29
+ color: var(--text-error);
30
+ }
31
+ }
32
32
 
@@ -1,11 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useTranslation } from 'react-i18next';
3
+ import { resolveBrandYoutube } from '../../../configs/brand';
3
4
  import { Button } from '../../../primitives';
5
+ import youtubeMark from '../HeaderApps/youtube.png';
4
6
  export default function HelpModalSideColumn({ helpActions, onClose }) {
5
7
  const { t } = useTranslation('help');
8
+ const youtubeUrl = resolveBrandYoutube();
6
9
  const handleCustomAction = (item) => {
7
10
  item.action();
8
11
  onClose();
9
12
  };
10
- return (_jsx("div", { className: "help-modal__side", children: helpActions.length > 0 ? (_jsxs("section", { className: "help-modal__resources", "aria-labelledby": "help-resources-title", children: [_jsx("h2", { id: "help-resources-title", className: "help-modal__section-title", children: t('title.resources') }), _jsx("ul", { className: "help-modal__action-list", children: helpActions.map((item, idx) => (_jsxs("li", { className: "help-modal__action-item", children: [_jsxs("div", { className: "help-modal__action-copy", children: [_jsx("div", { className: "help-modal__action-title", children: item.title }), _jsx("div", { className: "help-modal__action-desc", children: item.desc })] }), _jsx(Button, { text: t('button.open'), size: "x-small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx))) })] })) : (_jsxs("section", { className: "help-modal__resources help-modal__resources--empty", children: [_jsx("h2", { className: "help-modal__section-title", children: t('title.resources') }), _jsx("p", { className: "help-modal__section-desc", children: t('resources.empty') })] })) }));
13
+ const handleYoutubeOpen = () => {
14
+ window.open(youtubeUrl, '_blank', 'noopener,noreferrer');
15
+ onClose();
16
+ };
17
+ return (_jsxs("div", { className: "help-modal__side", children: [helpActions.length > 0 ? (_jsxs("section", { className: "help-modal__resources", "aria-labelledby": "help-resources-title", children: [_jsx("h2", { id: "help-resources-title", className: "help-modal__section-title", children: t('title.resources') }), _jsx("ul", { className: "help-modal__action-list", children: helpActions.map((item, idx) => (_jsxs("li", { className: "help-modal__action-item", children: [_jsxs("div", { className: "help-modal__action-copy", children: [_jsx("div", { className: "help-modal__action-title", children: item.title }), _jsx("div", { className: "help-modal__action-desc", children: item.desc })] }), _jsx(Button, { text: t('button.open'), size: "x-small", mode: "outlined", icon: "keyboard_arrow_right", onClick: () => handleCustomAction(item) })] }, idx))) })] })) : (_jsxs("section", { className: "help-modal__resources help-modal__resources--empty", children: [_jsx("h2", { className: "help-modal__section-title", children: t('title.resources') }), _jsx("p", { className: "help-modal__section-desc", children: t('resources.empty') })] })), youtubeUrl && (_jsxs("section", { className: "help-modal__youtube", "aria-labelledby": "help-youtube-title", children: [_jsxs("div", { className: "help-modal__youtube-copy", children: [_jsx("h2", { id: "help-youtube-title", className: "help-modal__youtube-title", children: t('title.youtube') }), _jsx("p", { className: "help-modal__youtube-desc", children: t('description.youtube') }), _jsx(Button, { text: t('button.youtube'), size: "small", icon: "open_in_new", onClick: handleYoutubeOpen })] }), _jsx("div", { className: "help-modal__youtube-media", children: _jsx("img", { src: youtubeMark, alt: "", className: "help-modal__youtube-mark" }) })] }))] }));
11
18
  }
@@ -109,10 +109,85 @@
109
109
  &__side {
110
110
  display: flex;
111
111
  flex-direction: column;
112
+ gap: var(--spacing-200);
112
113
  min-height: 0;
113
114
  overflow-y: auto;
114
115
  }
115
116
 
117
+ &__youtube {
118
+ display: grid;
119
+ grid-template-columns: minmax(0, 1fr) auto;
120
+ gap: var(--spacing-200);
121
+ align-items: center;
122
+ padding: 16px;
123
+ border: 1px solid rgba(255, 255, 255, 0.08);
124
+ border-radius: var(--radius-200);
125
+ background:
126
+ radial-gradient(
127
+ 120% 140% at 100% 0%,
128
+ rgba(255, 0, 0, 0.28) 0%,
129
+ transparent 55%
130
+ ),
131
+ linear-gradient(145deg, #1a1c22 0%, #111318 100%);
132
+ color: #f5f6f8;
133
+ overflow: hidden;
134
+ animation: help-youtube-rise 320ms ease-out;
135
+ }
136
+
137
+ &__youtube-copy {
138
+ display: flex;
139
+ flex-direction: column;
140
+ gap: var(--spacing-100);
141
+ min-width: 0;
142
+ }
143
+
144
+ &__youtube-title {
145
+ margin: 0;
146
+ @include subtitle-medium-2;
147
+ color: #ffffff;
148
+ }
149
+
150
+ &__youtube-desc {
151
+ margin: 0;
152
+ @include body-medium-1;
153
+ color: rgba(245, 246, 248, 0.78);
154
+ }
155
+
156
+ &__youtube-media {
157
+ display: flex;
158
+ align-items: center;
159
+ justify-content: center;
160
+ flex-shrink: 0;
161
+ }
162
+
163
+ &__youtube-mark {
164
+ display: block;
165
+ width: 56px;
166
+ height: 56px;
167
+ object-fit: contain;
168
+ filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.35));
169
+ transition: transform 180ms ease, filter 180ms ease;
170
+ }
171
+
172
+ &__youtube:hover &__youtube-mark {
173
+ transform: translateY(-2px) scale(1.04);
174
+ filter: drop-shadow(0 10px 18px rgba(255, 0, 0, 0.28));
175
+ }
176
+
177
+ &__youtube .ds-button.filled {
178
+ align-self: flex-start;
179
+ margin-top: var(--spacing-050);
180
+ background: #ff0000;
181
+ border: 1px solid #ff0000;
182
+ color: #ffffff;
183
+
184
+ &:hover {
185
+ background: #e60000;
186
+ border-color: #e60000;
187
+ color: #ffffff;
188
+ }
189
+ }
190
+
116
191
  &__resources,
117
192
  &__feedback {
118
193
  display: flex;
@@ -206,6 +281,17 @@
206
281
  }
207
282
  }
208
283
 
284
+ @keyframes help-youtube-rise {
285
+ from {
286
+ opacity: 0;
287
+ transform: translateY(8px);
288
+ }
289
+ to {
290
+ opacity: 1;
291
+ transform: translateY(0);
292
+ }
293
+ }
294
+
209
295
  @media (max-width: 1366px) {
210
296
  .help-modal {
211
297
  &__tour-body {
@@ -252,10 +338,19 @@
252
338
 
253
339
  &__tour,
254
340
  &__resources,
255
- &__feedback {
341
+ &__feedback,
342
+ &__youtube {
256
343
  padding: var(--spacing-200);
257
344
  }
258
345
 
346
+ &__youtube {
347
+ grid-template-columns: 1fr;
348
+ }
349
+
350
+ &__youtube-media {
351
+ justify-content: flex-start;
352
+ }
353
+
259
354
  &__tour-image {
260
355
  max-width: 200px;
261
356
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corpushub-design-system",
3
3
  "private": false,
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {