@tekkare/romulus 0.1.363 → 0.1.365

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/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.362",
7
+ "version": "0.1.363",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -88,6 +88,16 @@ function barWidth(row: RmHybridRow) {
88
88
  return `${Math.min((share(row) * 100) / reference.value, 100)}%`
89
89
  }
90
90
 
91
+ /**
92
+ * Une colonne `extra` arrive souvent deja formatee, part comprise :
93
+ * "53 298 (11.3 %)". La part finale entre parentheses est detachee pour
94
+ * prendre le meme gris que celle de la colonne valeur.
95
+ */
96
+ function splitShare(cell: string | number) {
97
+ const match = String(cell).match(/^(.*?)\s*(\([^()]*%\))$/)
98
+ return match ? { value: match[1], share: match[2] } : { value: cell, share: '' }
99
+ }
100
+
91
101
  function toggle() {
92
102
  showAll.value = !showAll.value
93
103
  emit('showState', showAll.value)
@@ -117,7 +127,8 @@ function toggle() {
117
127
  </span>
118
128
  </td>
119
129
  <td v-for="(cell, cellIndex) in row.extra ?? []" :key="cellIndex" class="rm-hybrid__value">
120
- {{ cell }}
130
+ {{ splitShare(cell).value }}
131
+ <span v-if="splitShare(cell).share" class="rm-hybrid__share">{{ splitShare(cell).share }}</span>
121
132
  </td>
122
133
  </tr>
123
134
  </tbody>
@@ -19,6 +19,11 @@ export type RmKpiBarItem = {
19
19
  legend: string
20
20
  /** Precision sous la legende. */
21
21
  subtitle?: string
22
+ /**
23
+ * Note d'aide : pose une icone (i) apres la legende, avec ce texte en bulle.
24
+ * Le clic sur l'icone emet `info` (ouvrir la note complete, par exemple).
25
+ */
26
+ info?: string
22
27
  }
23
28
 
24
29
  const props = withDefaults(
@@ -37,6 +42,8 @@ const props = withDefaults(
37
42
  { kpis: () => [], loading: false, tiles: 0 },
38
43
  )
39
44
 
45
+ const emit = defineEmits<{ info: [kpi: RmKpiBarItem, index: number] }>()
46
+
40
47
  /** Autant de tuiles que la barre en portera, sinon quatre. */
41
48
  const skeletonTiles = computed(() => props.tiles || props.kpis.length || 4)
42
49
 
@@ -66,7 +73,19 @@ function display(value: RmKpiBarItem['value']) {
66
73
  </div>
67
74
  <div class="rm-kpibar__text">
68
75
  <p class="rm-kpibar__value">{{ display(kpi.value) }}</p>
69
- <p class="rm-kpibar__legend">{{ kpi.legend }}</p>
76
+ <p class="rm-kpibar__legend">
77
+ {{ kpi.legend }}
78
+ <RmTooltip v-if="kpi.info" :text="kpi.info" max-width="320px" full>
79
+ <button
80
+ type="button"
81
+ class="rm-kpibar__info"
82
+ :aria-label="kpi.info"
83
+ @click="emit('info', kpi, index)"
84
+ >
85
+ <RmIcon name="Info" :size="12" />
86
+ </button>
87
+ </RmTooltip>
88
+ </p>
70
89
  <p v-if="kpi.subtitle" class="rm-kpibar__subtitle">{{ kpi.subtitle }}</p>
71
90
  </div>
72
91
  </div>
@@ -76,5 +95,5 @@ function display(value: RmKpiBarItem['value']) {
76
95
  </template>
77
96
 
78
97
  <style scoped>
79
- .rm-kpibar{background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-xs);color:var(--text-primary);flex-direction:column;font-family:var(--font-sans);padding:var(--space-16)}.rm-kpibar,.rm-kpibar__items{align-self:stretch;display:flex;gap:var(--space-16)}.rm-kpibar__items{align-items:center}.rm-kpibar__item{align-items:center;display:flex;flex:1 0 0;gap:var(--space-16);min-width:0}.rm-kpibar__icon{align-items:center;background:var(--bg-surface-3);border-radius:var(--radius-lg);color:var(--text-secondary);display:flex;flex:0 0 auto;justify-content:center;padding:var(--space-8)}.rm-kpibar__text{align-items:flex-start;display:flex;flex-direction:column;gap:var(--space-4);min-width:0}.rm-kpibar__value{color:var(--color-primary);font-family:var(--font-serif);font-size:var(--font-22);font-weight:var(--weight-bold);line-height:normal;margin:0}.rm-kpibar__legend{color:var(--text-secondary);font-size:var(--font-12);line-height:normal;margin:0}.rm-kpibar__subtitle{color:var(--text-muted);font-size:var(--font-11);line-height:1.3;margin:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
98
+ .rm-kpibar{background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-2xl);box-shadow:var(--shadow-xs);color:var(--text-primary);flex-direction:column;font-family:var(--font-sans);padding:var(--space-16)}.rm-kpibar,.rm-kpibar__items{align-self:stretch;display:flex;gap:var(--space-16)}.rm-kpibar__items{align-items:center}.rm-kpibar__item{align-items:center;display:flex;flex:1 0 0;gap:var(--space-16);min-width:0}.rm-kpibar__icon{align-items:center;background:var(--bg-surface-3);border-radius:var(--radius-lg);color:var(--text-secondary);display:flex;flex:0 0 auto;justify-content:center;padding:var(--space-8)}.rm-kpibar__text{align-items:flex-start;display:flex;flex-direction:column;gap:var(--space-4);min-width:0}.rm-kpibar__value{color:var(--color-primary);font-family:var(--font-serif);font-size:var(--font-22);font-weight:var(--weight-bold);line-height:normal;margin:0}.rm-kpibar__legend{color:var(--text-secondary);font-size:var(--font-12);line-height:normal;margin:0}.rm-kpibar__legend:has(.rm-kpibar__info){align-items:center;display:inline-flex;gap:var(--space-4)}.rm-kpibar__info{background:none;border:0;color:var(--color-primary);cursor:pointer;display:inline-flex;padding:0}.rm-kpibar__subtitle{color:var(--text-muted);font-size:var(--font-11);line-height:1.3;margin:0;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
80
99
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.363",
3
+ "version": "0.1.365",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",