corpushub-design-system 0.1.1 → 0.1.2

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.
@@ -5,17 +5,17 @@ export const SentenceTexts = {
5
5
  "label.tag": "Tag",
6
6
  "label.morphemes": "Morphemes",
7
7
  "label.empty": "-",
8
- "label.tier.original": "original",
9
- "label.tier.junction": "junction",
10
- "label.tier.segmentation": "segmentation",
11
- "label.tier.spelling": "spelling",
12
- "label.tier.expansion": "expansion",
13
- "label.tier.correction": "correction",
14
- "label.tier.punctuation": "punctuation",
15
- "label.tier.illegible": "illegible",
16
- "label.tier.modernization": "modernization",
17
- "label.tier.padronization": "standardization",
18
- "label.tier.inflection": "inflection",
8
+ "label.tier.original": "Original",
9
+ "label.tier.junction": "Junction",
10
+ "label.tier.segmentation": "Segmentation",
11
+ "label.tier.spelling": "Spelling",
12
+ "label.tier.expansion": "Expansion",
13
+ "label.tier.correction": "Correction",
14
+ "label.tier.punctuation": "Punctuation",
15
+ "label.tier.illegible": "Illegible",
16
+ "label.tier.modernization": "Modernization",
17
+ "label.tier.padronization": "Standardization",
18
+ "label.tier.inflection": "Inflection",
19
19
  },
20
20
  "pt-BR": {
21
21
  "label.word": "Palavra",
@@ -23,17 +23,17 @@ export const SentenceTexts = {
23
23
  "label.tag": "Etiqueta",
24
24
  "label.morphemes": "Morfemas",
25
25
  "label.empty": "-",
26
- "label.tier.original": "original",
27
- "label.tier.junction": "junção",
28
- "label.tier.segmentation": "segmentação",
29
- "label.tier.spelling": "grafia",
30
- "label.tier.expansion": "expansão",
31
- "label.tier.correction": "correção",
32
- "label.tier.punctuation": "pontuação",
33
- "label.tier.illegible": "ilegível",
34
- "label.tier.modernization": "modernização",
35
- "label.tier.padronization": "padronização",
36
- "label.tier.inflection": "flexão",
26
+ "label.tier.original": "Original",
27
+ "label.tier.junction": "Junção",
28
+ "label.tier.segmentation": "Segmentação",
29
+ "label.tier.spelling": "Grafia",
30
+ "label.tier.expansion": "Expansão",
31
+ "label.tier.correction": "Correção",
32
+ "label.tier.punctuation": "Pontuação",
33
+ "label.tier.illegible": "Ilegível",
34
+ "label.tier.modernization": "Modernização",
35
+ "label.tier.padronization": "Padronização",
36
+ "label.tier.inflection": "Flexão",
37
37
  },
38
38
  it: {
39
39
  "label.word": "Parola",
@@ -41,16 +41,16 @@ export const SentenceTexts = {
41
41
  "label.tag": "Etichetta",
42
42
  "label.morphemes": "Morfemi",
43
43
  "label.empty": "-",
44
- "label.tier.original": "originale",
45
- "label.tier.junction": "giunzione",
46
- "label.tier.segmentation": "segmentazione",
47
- "label.tier.spelling": "ortografia",
48
- "label.tier.expansion": "espansione",
49
- "label.tier.correction": "correzione",
50
- "label.tier.punctuation": "punteggiatura",
51
- "label.tier.illegible": "illeggibile",
52
- "label.tier.modernization": "modernizzazione",
53
- "label.tier.padronization": "standardizzazione",
54
- "label.tier.inflection": "flessione",
44
+ "label.tier.original": "Originale",
45
+ "label.tier.junction": "Giunzione",
46
+ "label.tier.segmentation": "Segmentazione",
47
+ "label.tier.spelling": "Ortografia",
48
+ "label.tier.expansion": "Espansione",
49
+ "label.tier.correction": "Correzione",
50
+ "label.tier.punctuation": "Punteggiatura",
51
+ "label.tier.illegible": "Illeggibile",
52
+ "label.tier.modernization": "Modernizzazione",
53
+ "label.tier.padronization": "Standardizzazione",
54
+ "label.tier.inflection": "Flessione",
55
55
  },
56
56
  };
@@ -25,12 +25,13 @@ const getTierLabelKey = (symbol) => {
25
25
  return `sentence:label.tier.${key}`;
26
26
  };
27
27
  const usesI18nLabel = (symbol) => isDefaultTierSymbol(symbol) || isStructuralEditionTier(symbol);
28
+ const capitalize = (value) => value ? value.charAt(0).toUpperCase() + value.slice(1) : value;
28
29
  const getStaticFallbackLabel = (symbol) => {
29
30
  const defaultDef = DEFAULT_EDITION_TIERS.find((tier) => tier.symbol === symbol);
30
31
  if (defaultDef?.label) {
31
32
  return defaultDef.label;
32
33
  }
33
- return getEditionTierName(symbol).toLowerCase();
34
+ return capitalize(getEditionTierName(symbol).toLowerCase());
34
35
  };
35
36
  const getTierLabel = (symbol, corpus, t) => {
36
37
  if (usesI18nLabel(symbol)) {
@@ -54,6 +55,10 @@ const isUnderSelected = (selected, tier, corpus) => {
54
55
  }
55
56
  return tierIndex <= selectedIndex;
56
57
  };
58
+ const STRUCTURAL_PAIR = [
59
+ StructuralEditionTiers.JUNCTION,
60
+ StructuralEditionTiers.SEGMENTATION,
61
+ ];
57
62
  const buildEditionGroups = (corpus) => {
58
63
  const tiers = getCorpusEditionTiers(corpus);
59
64
  const semi = tiers
@@ -62,20 +67,21 @@ const buildEditionGroups = (corpus) => {
62
67
  const modern = tiers
63
68
  .filter((tier) => tier.group === 'modernized')
64
69
  .map((tier) => tier.symbol);
70
+ const hasSemi = semi.length > 0;
65
71
  return [
66
72
  {
67
73
  id: 'diplomatic',
68
74
  labelKey: 'edition.group.diplomatic',
69
- // No selectable child levels — diplomatic is the original form itself.
70
- tiers: [],
75
+ // When no semi-diplomatic group, jun/seg are clickable under diplomatic.
76
+ tiers: hasSemi ? [] : [...STRUCTURAL_PAIR],
71
77
  defaultTier: StructuralEditionTiers.ORIGINAL,
72
78
  },
73
- ...(semi.length > 0
79
+ ...(hasSemi
74
80
  ? [
75
81
  {
76
82
  id: 'semiDiplomatic',
77
83
  labelKey: 'edition.group.semiDiplomatic',
78
- tiers: semi,
84
+ tiers: [...STRUCTURAL_PAIR, ...semi],
79
85
  defaultTier: semi[semi.length - 1],
80
86
  },
81
87
  ]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corpushub-design-system",
3
3
  "private": false,
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {