@tekkare/romulus 0.1.339 → 0.1.340

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.338",
7
+ "version": "0.1.339",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -58,6 +58,14 @@ const accordion = computed(() => props.record?.layout === "accordion");
58
58
 
59
59
  const documents = computed(() => props.record?.documents ?? []);
60
60
 
61
+ /**
62
+ * En onglets, les documents en sont un, apres les rubriques : sous un long
63
+ * texte ANSM, la liste tombait hors de l'ecran et passait inapercue.
64
+ */
65
+ const docsTab = computed(() => !accordion.value && documents.value.length > 0);
66
+ const docsTabIndex = computed(() => sections.value.length);
67
+ const tabCount = computed(() => sections.value.length + (docsTab.value ? 1 : 0));
68
+
61
69
  /** Apercu d'un PDF, dans la visionneuse commune aux tiroirs de documents. */
62
70
  const previewOpen = ref(false);
63
71
  const previewDoc = ref<{ name: string; url: string } | null>(null);
@@ -197,7 +205,7 @@ onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
197
205
  </template>
198
206
 
199
207
  <template v-else>
200
- <div v-if="sections.length > 1" class="rdr_tabs">
208
+ <div v-if="tabCount > 1" class="rdr_tabs">
201
209
  <button
202
210
  v-for="(section, index) in sections"
203
211
  :key="section.key"
@@ -208,15 +216,35 @@ onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
208
216
  >
209
217
  {{ section.label }}
210
218
  </button>
219
+ <button
220
+ v-if="docsTab"
221
+ type="button"
222
+ class="rdr_tab"
223
+ :class="{ is_active: active === docsTabIndex }"
224
+ @click="active = docsTabIndex"
225
+ >
226
+ Documents
227
+ <span class="rdr_docs_count">{{ documents.length }}</span>
228
+ </button>
211
229
  </div>
212
230
 
213
- <p class="rdr_text rdr_text--tab">{{ sections[active]?.body }}</p>
231
+ <div v-if="docsTab && active === docsTabIndex" class="rdr_docs rdr_docs--tab">
232
+ <RmFileRow
233
+ v-for="doc in documents"
234
+ :key="doc.key"
235
+ :name="doc.name"
236
+ :format="doc.preview ? 'pdf' : ''"
237
+ :action="doc.preview ? 'preview' : 'open'"
238
+ @select="openDocument(doc)"
239
+ />
240
+ </div>
241
+ <p v-else class="rdr_text rdr_text--tab">{{ sections[active]?.body }}</p>
214
242
  </template>
215
243
  </slot>
216
244
 
217
- <!-- Les documents valent pour l'enregistrement entier : hors des
218
- rubriques, comme dans le tiroir d'un avis HAS. -->
219
- <section v-if="documents.length" class="rdr_docs">
245
+ <!-- En accordeon (ou si un parent remplace le corps), les documents
246
+ restent a la suite, comme dans le tiroir d'un avis HAS. -->
247
+ <section v-if="documents.length && !docsTab" class="rdr_docs">
220
248
  <h3 class="rdr_docs_title">
221
249
  Documents
222
250
  <span class="rdr_docs_count">{{ documents.length }}</span>
@@ -303,6 +331,12 @@ onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
303
331
  border-top: 1px solid var(--light);
304
332
  }
305
333
 
334
+ .rdr_docs--tab {
335
+ margin-top: 0;
336
+ padding-top: 4px;
337
+ border-top: 0;
338
+ }
339
+
306
340
  .rdr_docs_title {
307
341
  display: flex;
308
342
  align-items: center;
@@ -415,6 +449,10 @@ onBeforeUnmount(() => document.removeEventListener("keydown", onKeydown));
415
449
  cursor: pointer;
416
450
  }
417
451
 
452
+ .rdr_tab .rdr_docs_count {
453
+ margin-left: 6px;
454
+ }
455
+
418
456
  .rdr_tab.is_active {
419
457
  border-bottom-color: var(--primary);
420
458
  background: color-mix(in srgb, var(--primary) 6%, transparent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.339",
3
+ "version": "0.1.340",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",