@datagouv/components-next 1.4.1-dev.1373.g379aceb6 → 1.4.1-dev.1375.ge1f9e509

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.
Files changed (81) hide show
  1. package/assets/main.css +4 -0
  2. package/dist/{Control-CeBb5PEu.js → Control-DPuXeUqi.js} +3 -12
  3. package/dist/{Datafair.client-Ci2WOgAS.js → Datafair.client-LlEgG7WU.js} +2 -3
  4. package/dist/{Image-CBQwYbQB.js → Image-DVWRoLLI.js} +7 -22
  5. package/dist/{ImagePreview.client-B4RtxuiJ.js → ImagePreview.client-Db5dmxMP.js} +2 -3
  6. package/dist/{JsonPreview.client-r7swv2fp.js → JsonPreview.client-DKy2AexC.js} +4 -6
  7. package/dist/{Layer-BPuffNS-.js → Layer-D_5tYbVm.js} +7 -9
  8. package/dist/{Map-QeL96qbQ.js → Map-CTBJEae_.js} +937 -967
  9. package/dist/{MapContainer.client-CxH1a8Tn.js → MapContainer.client-Clk9_bbS.js} +13 -15
  10. package/dist/{OSM-DT4I7v8A.js → OSM-B5Zc3qAf.js} +2 -3
  11. package/dist/{PdfPreview.client-BjeMcqcy.js → PdfPreview.client-D3wHTDb9.js} +130 -378
  12. package/dist/{PdfSkeleton-CVZxJaeL.js → PdfSkeleton-nas5Pmia.js} +2 -3
  13. package/dist/{Pmtiles.client-D8idR2l7.js → Pmtiles.client-NGYdeSJY.js} +151 -350
  14. package/dist/{PreviewError-Cx7CItT_.js → PreviewError-EeaGx3SL.js} +399 -392
  15. package/dist/{PreviewWrapper-Cd1RSmS-.js → PreviewWrapper-BhldDdXK.js} +2 -3
  16. package/dist/{ScaleLine-Cwwk9wJo.js → ScaleLine-C_tuJ6VG.js} +3 -4
  17. package/dist/Tile-8nHSuqcv.js +571 -0
  18. package/dist/{Tile-4WpHaLOZ.js → Tile-Bu5lF4M5.js} +8 -13
  19. package/dist/{TileImage-CZZ4lgsm.js → TileImage-CgO5alXc.js} +105 -113
  20. package/dist/{View-DWqx4Jqr.js → View-Dad8DfSD.js} +25 -51
  21. package/dist/{XmlPreview.client-cSebx8br.js → XmlPreview.client-CmGbc3c3.js} +5 -7
  22. package/dist/assets/maplibre-gl-worker-CEzvAyZY.js +10 -0
  23. package/dist/components-next.css +1 -1
  24. package/dist/components-next.js +15585 -15914
  25. package/dist/components.css +1 -1
  26. package/dist/{en-C_qOt4Jn.js → en-OIaJCts4.js} +1 -2
  27. package/dist/{france-DPcdJc84.js → france-BtSQqcqV.js} +5 -9
  28. package/dist/{hvd-ZlsiTVFh.js → hvd-CTia2VCz.js} +1 -2
  29. package/dist/{inspire-DZQ-yA5f.js → inspire-Cc-Kc4K-.js} +1 -2
  30. package/dist/{leaflet-src-lLkzhpcP.js → leaflet-src-BY_Zq0V0.js} +77 -126
  31. package/dist/{proj-DM6GW1n3.js → proj-COhZ08DR.js} +19 -37
  32. package/dist/{purify.es-D6pPunDo.js → purify.es-CGAWnSTR.js} +4 -27
  33. package/dist/{rolldown-runtime-CEFd7nDs.js → rolldown-runtime-DsPmjQRF.js} +2 -3
  34. package/dist/{sl-BxQ_ZY_w.js → sl-CKkMwQhf.js} +1 -2
  35. package/dist/{spd-Cs37HjuR.js → spd-Djcs02gw.js} +1 -2
  36. package/dist/{sr-JDtennFO.js → sr-DabGmchD.js} +1 -2
  37. package/dist/{src-D_UE0st7.js → src-D_o-aUzl.js} +1612 -2428
  38. package/dist/{text-clamp.esm-DRvX2Gzm.js → text-clamp.esm-DE3022VR.js} +3 -5
  39. package/dist/{transform-Ct1GejD-.js → transform-CNeEnSK9.js} +7 -13
  40. package/dist/{vue3-json-viewer-BJgUfh-l.js → vue3-json-viewer-CUx5EFVA.js} +1 -2
  41. package/dist/{vue3-xml-viewer.common-DbJwzvCC.js → vue3-xml-viewer.common-C0bbtsGT.js} +2 -3
  42. package/package.json +2 -2
  43. package/src/components/CardMedia.vue +42 -0
  44. package/src/components/ChartCard.vue +53 -59
  45. package/src/components/DataserviceCard.vue +69 -85
  46. package/src/components/DataserviceQualityInline.vue +4 -20
  47. package/src/components/DataserviceQualityTooltipContent.vue +57 -65
  48. package/src/components/DatasetCard.vue +80 -93
  49. package/src/components/DatasetQualityInline.vue +4 -20
  50. package/src/components/DatasetQualityTooltipContent.vue +60 -62
  51. package/src/components/DiscussionMessageCard.vue +19 -22
  52. package/src/components/ObjectCard.vue +89 -18
  53. package/src/components/ObjectCardBadge.vue +27 -16
  54. package/src/components/ObjectCardMeta.vue +15 -0
  55. package/src/components/ObjectCardMetric.vue +23 -0
  56. package/src/components/ObjectCardMetrics.vue +6 -0
  57. package/src/components/ObjectCardOwner.vue +170 -17
  58. package/src/components/ObjectCardQuality.vue +32 -0
  59. package/src/components/ObjectCardShortDescription.vue +1 -1
  60. package/src/components/OrganizationCard.vue +101 -69
  61. package/src/components/OrganizationNameInline.vue +49 -0
  62. package/src/components/OrganizationTypeBadge.vue +21 -0
  63. package/src/components/OwnerType.vue +1 -1
  64. package/src/components/OwnerTypeIcon.vue +7 -3
  65. package/src/components/PostCard.vue +31 -35
  66. package/src/components/ProgressBar.vue +6 -3
  67. package/src/components/QualityItem.vue +9 -18
  68. package/src/components/QualityScore.vue +7 -1
  69. package/src/components/ReuseCard.vue +114 -95
  70. package/src/components/ReuseDetails.vue +19 -29
  71. package/src/components/SchemaCard.vue +30 -27
  72. package/src/components/Search/GlobalSearch.vue +7 -4
  73. package/src/components/Toggletip.vue +24 -12
  74. package/src/components/Tooltip.vue +113 -29
  75. package/src/components/TopicCard.vue +69 -78
  76. package/src/main.ts +0 -4
  77. package/dist/Tile-BV44yf69.js +0 -574
  78. package/dist/assets/maplibre-gl-worker-C24SsKwV.js +0 -10
  79. package/src/components/ObjectCardHeader.vue +0 -42
  80. package/src/components/OrganizationHorizontalCard.vue +0 -87
  81. package/src/components/ReuseHorizontalCard.vue +0 -81
@@ -1,90 +1,122 @@
1
1
  <template>
2
- <div class="border border-gray-default bg-white relative fr-enlarge-link">
3
- <div class="h-[4.5rem] pt-4 px-4 bg-blue-lighter" />
4
- <div class="px-4 pb-4 pt-5 mt-2">
5
- <div class="inline-flex border border-gray-default p-1.5 absolute top-4 left-4 bg-white">
2
+ <ObjectCard
3
+ :url="organization.page"
4
+ :stacked="!horizontal"
5
+ >
6
+ <template
7
+ v-if="!horizontal"
8
+ #cover
9
+ >
10
+ <div
11
+ data-testid="organization-banner"
12
+ class="h-16"
13
+ :class="{ 'bg-gray-some': !bannerColor }"
14
+ :style="bannerColor ? { backgroundColor: bannerColor } : undefined"
15
+ aria-hidden="true"
16
+ >
6
17
  <img
7
- :src="organization.logo_thumbnail"
8
- width="64"
9
- height="64"
18
+ v-if="bannerImage && !bannerFailed"
19
+ :src="bannerImage"
10
20
  alt=""
11
21
  loading="lazy"
22
+ class="size-full object-cover"
23
+ :style="{ objectPosition: `center ${bannerPosition}%` }"
24
+ @error="bannerFailed = true"
12
25
  >
13
26
  </div>
14
- <div class="mb-0.5 font-bold">
15
- <AppLink
16
- :to="organization.page"
17
- class="overflow-hidden"
18
- >
19
- <OrganizationNameWithCertificate
20
- :show-type="false"
21
- :organization
22
- />
23
- </AppLink>
24
- </div>
25
- <div class="mb-2 flex flex-wrap gap-1 items-center">
26
- <template v-if="type !== 'other'">
27
- <OwnerType
28
- class="mb-0 text-sm"
29
- :type
30
- />
31
- <RiSubtractLine
32
- aria-hidden="true"
33
- class="size-4 fill-gray-medium"
34
- />
35
- </template>
36
- <div>
37
- <div
38
- v-if="'metrics' in organization"
39
- class="text-gray-medium flex items-center text-sm gap-0.5"
40
- :aria-label="t('{datasets} jeux de données, {dataservices} API et {reuses} réutilisations', {
41
- datasets: organization.metrics.datasets,
42
- dataservices: organization.metrics.dataservices,
43
- reuses: organization.metrics.reuses,
44
- })"
45
- >
46
- <RiDatabase2Line
47
- aria-hidden="true"
48
- class="size-4 -mt-1"
49
- /> {{ organization.metrics.datasets }}
50
- <RiTerminalLine
51
- aria-hidden="true"
52
- class="size-4 -mt-1 ml-1"
53
- /> {{ organization.metrics.dataservices }}
54
- <RiLineChartLine
55
- aria-hidden="true"
56
- class="size-4 -mt-1 ml-1"
57
- /> {{ organization.metrics.reuses }}
58
- </div>
59
- </div>
60
- </div>
61
- <div class="mt-1 mb-0">
62
- <TextClamp
63
- v-if="'description' in organization"
64
- :text="removeMarkdownSync(organization.description)"
65
- :max-lines="3"
27
+ </template>
28
+ <template #media>
29
+ <OrganizationLogo
30
+ :organization
31
+ size-class="size-12 p-1"
32
+ />
33
+ </template>
34
+ <template #title>
35
+ <OrganizationNameInline
36
+ :organization
37
+ :show-type="false"
38
+ />
39
+ </template>
40
+ <template
41
+ v-if="type !== OTHER"
42
+ #badge
43
+ >
44
+ <OrganizationTypeBadge
45
+ :type
46
+ class="max-[480px]:hidden"
47
+ />
48
+ </template>
49
+
50
+ <ObjectCardMeta
51
+ v-if="'metrics' in organization"
52
+ class="mt-1 max-[480px]:hidden"
53
+ >
54
+ <ObjectCardMetrics>
55
+ <ObjectCardMetric
56
+ :icon="RiDatabase2Line"
57
+ :value="organization.metrics.datasets"
58
+ :label="t('{n} jeux de données | {n} jeu de données | {n} jeux de données', organization.metrics.datasets)"
66
59
  />
67
- </div>
68
- </div>
69
- </div>
60
+ <ObjectCardMetric
61
+ :icon="RiTerminalLine"
62
+ :value="organization.metrics.dataservices"
63
+ :label="t('{n} API', organization.metrics.dataservices)"
64
+ />
65
+ <ObjectCardMetric
66
+ :icon="RiLineChartLine"
67
+ :value="organization.metrics.reuses"
68
+ :label="t('{n} réutilisations | {n} réutilisation | {n} réutilisations', organization.metrics.reuses)"
69
+ />
70
+ <ObjectCardMetric
71
+ :icon="RiStarLine"
72
+ :value="organization.metrics.followers"
73
+ :label="t('{n} abonnés | {n} abonné | {n} abonnés', organization.metrics.followers)"
74
+ />
75
+ </ObjectCardMetrics>
76
+ </ObjectCardMeta>
77
+ <ObjectCardShortDescription
78
+ v-if="'description' in organization"
79
+ :text="organization.description"
80
+ class="mt-1 max-md:hidden"
81
+ />
82
+ </ObjectCard>
70
83
  </template>
71
84
 
72
85
  <script setup lang="ts">
73
- import { RiLineChartLine, RiDatabase2Line, RiTerminalLine, RiSubtractLine } from '@remixicon/vue'
74
- import { computed } from 'vue'
75
- import { removeMarkdownSync } from '../functions/markdown'
76
- import { getOrganizationType } from '../functions/organizations'
86
+ import { computed, ref, watch } from 'vue'
87
+ import { RiDatabase2Line, RiLineChartLine, RiStarLine, RiTerminalLine } from '@remixicon/vue'
88
+ import { getOrganizationType, OTHER } from '../functions/organizations'
77
89
  import type { Organization, OrganizationReference } from '../types/organizations'
78
- import OwnerType from './OwnerType.vue'
79
- import OrganizationNameWithCertificate from './OrganizationNameWithCertificate.vue'
80
- import AppLink from './AppLink.vue'
81
90
  import { useTranslation } from '../composables/useTranslation'
91
+ import ObjectCard from './ObjectCard.vue'
92
+ import ObjectCardMeta from './ObjectCardMeta.vue'
93
+ import ObjectCardMetric from './ObjectCardMetric.vue'
94
+ import ObjectCardMetrics from './ObjectCardMetrics.vue'
95
+ import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
96
+ import OrganizationLogo from './OrganizationLogo.vue'
97
+ import OrganizationNameInline from './OrganizationNameInline.vue'
98
+ import OrganizationTypeBadge from './OrganizationTypeBadge.vue'
82
99
 
83
100
  const props = defineProps<{
84
101
  organization: Organization | OrganizationReference
102
+ /**
103
+ * Puts the logo beside the content, without the banner, for full-width lists.
104
+ * The card falls back to the vertical layout when it gets too narrow.
105
+ */
106
+ horizontal?: boolean
85
107
  }>()
86
108
 
87
109
  const { t } = useTranslation()
88
110
 
89
111
  const type = computed(() => getOrganizationType(props.organization))
112
+
113
+ const bannerColor = computed(() => 'banner_color' in props.organization ? props.organization.banner_color : null)
114
+ const bannerImage = computed(() => 'banner_image' in props.organization ? props.organization.banner_image : null)
115
+ const bannerPosition = computed(() => 'banner_image_position' in props.organization ? (props.organization.banner_image_position ?? 50) : 50)
116
+
117
+ // A broken banner falls back to the plain color instead of the browser's broken image icon.
118
+ const bannerFailed = ref(false)
119
+ watch(bannerImage, () => {
120
+ bannerFailed.value = false
121
+ })
90
122
  </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <span class="min-w-0 [overflow-wrap:anywhere]">
3
+ <OwnerTypeIcon
4
+ v-if="showType"
5
+ :type="getOrganizationType(organization)"
6
+ size-class="size-4 inline-block align-[-2px] me-1"
7
+ />{{ organization.name }}<span
8
+ v-if="isOrganizationCertified(organization)"
9
+ class="relative z-2 ms-1 inline-flex align-[-2px]"
10
+ >
11
+ <Tooltip as="span">
12
+ <RiCheckboxCircleLine
13
+ class="size-4 block"
14
+ aria-hidden="true"
15
+ />
16
+ <span class="sr-only">{{ certifiedLabel }}</span>
17
+ <template #tooltip>
18
+ <p class="text-sm font-normal mb-0">
19
+ {{ certifiedLabel }}
20
+ </p>
21
+ </template>
22
+ </Tooltip>
23
+ </span>
24
+ </span>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import { computed } from 'vue'
29
+ import { RiCheckboxCircleLine } from '@remixicon/vue'
30
+ import { getOrganizationType, isOrganizationCertified } from '../functions/organizations'
31
+ import type { Organization, OrganizationReference } from '../types/organizations'
32
+ import { useComponentsConfig } from '../config'
33
+ import { useTranslation } from '../composables/useTranslation'
34
+ import OwnerTypeIcon from './OwnerTypeIcon.vue'
35
+ import Tooltip from './Tooltip.vue'
36
+
37
+ // Organization name flowing in a text: it wraps over several lines, the certificate follows
38
+ // its last word, and it inherits the font and the color of its container.
39
+ withDefaults(defineProps<{
40
+ organization: Organization | OrganizationReference
41
+ showType?: boolean
42
+ }>(), {
43
+ showType: true,
44
+ })
45
+
46
+ const config = useComponentsConfig()
47
+ const { t } = useTranslation()
48
+ const certifiedLabel = computed(() => t(`L'identité de ce service public est certifiée par {certifier}`, { certifier: config.name }))
49
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <ObjectCardBadge
3
+ v-if="organizationType.type !== OTHER"
4
+ :icon="organizationType.icon"
5
+ :tone="type === PUBLIC_SERVICE || type === LOCAL_AUTHORITY ? 'info' : 'neutral'"
6
+ >
7
+ {{ organizationType.label }}
8
+ </ObjectCardBadge>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { computed } from 'vue'
13
+ import { findOrganizationType, LOCAL_AUTHORITY, OTHER, PUBLIC_SERVICE, type OrganizationTypes } from '../functions/organizations'
14
+ import ObjectCardBadge from './ObjectCardBadge.vue'
15
+
16
+ const props = defineProps<{
17
+ type: OrganizationTypes
18
+ }>()
19
+
20
+ const organizationType = computed(() => findOrganizationType(props.type))
21
+ </script>
@@ -2,7 +2,7 @@
2
2
  <div :class="`${colorClass} flex items-center gap-1`">
3
3
  <OwnerTypeIcon
4
4
  :type="type"
5
- class="size-4"
5
+ size-class="size-4"
6
6
  />
7
7
  <div :class="sizeClass">
8
8
  {{ name }}
@@ -2,7 +2,8 @@
2
2
  <component
3
3
  :is="icon"
4
4
  v-if="icon"
5
- class="size-3.5 flex-none"
5
+ class="flex-none"
6
+ :class="sizeClass"
6
7
  aria-hidden="true"
7
8
  />
8
9
  </template>
@@ -11,9 +12,12 @@
11
12
  import { computed } from 'vue'
12
13
  import { findOrganizationType, type OrganizationTypes, type UserType } from '../functions/organizations'
13
14
 
14
- const props = defineProps<{
15
+ const props = withDefaults(defineProps<{
15
16
  type: OrganizationTypes | UserType
16
- }>()
17
+ sizeClass?: string
18
+ }>(), {
19
+ sizeClass: 'size-3.5',
20
+ })
17
21
 
18
22
  const icon = computed(() => findOrganizationType(props.type).icon)
19
23
  </script>
@@ -1,43 +1,39 @@
1
1
  <template>
2
- <ObjectCard media-size="lg">
2
+ <ObjectCard
3
+ :url="postUrl || post.page || '#'"
4
+ :icon="RiArticleLine"
5
+ media-size="lg"
6
+ >
3
7
  <template #media>
4
- <img
5
- v-if="post.image"
8
+ <CardMedia
6
9
  :src="post.image"
7
- class="w-full h-full object-cover"
8
10
  :alt="post.name"
9
- >
10
- <Placeholder
11
- v-else
12
- type="Dataset"
13
- class="w-full h-full"
11
+ kind="post"
14
12
  />
15
13
  </template>
16
-
17
- <ObjectCardHeader
18
- :icon="RiArticleLine"
19
- :url="postUrl || post.page || '#'"
20
- >
14
+ <template #title>
21
15
  {{ post.name }}
22
- </ObjectCardHeader>
23
-
24
- <ObjectCardShortDescription :text="post.headline || post.content" />
25
-
26
- <TranslationT
27
- v-if="post.published || post.created_at"
28
- tag="div"
29
- class="text-sm text-gray-medium mt-1"
30
- keypath="Publié {date}"
31
- >
32
- <template #date>
33
- <FormattedDate
34
- :date="post.published || post.created_at"
35
- format="relative"
36
- :options="{ dateStyle: 'long', timeStyle: 'short' }"
37
- />
38
- </template>
39
- </TranslationT>
16
+ </template>
40
17
 
18
+ <ObjectCardMeta v-if="post.published || post.created_at">
19
+ <TranslationT
20
+ tag="span"
21
+ class="tabular-nums"
22
+ keypath="Publié {date}"
23
+ >
24
+ <template #date>
25
+ <FormattedDate
26
+ :date="post.published || post.created_at"
27
+ format="relative"
28
+ :options="{ dateStyle: 'long', timeStyle: 'short' }"
29
+ />
30
+ </template>
31
+ </TranslationT>
32
+ </ObjectCardMeta>
33
+ <ObjectCardShortDescription
34
+ :text="post.headline || post.content"
35
+ class="max-md:hidden"
36
+ />
41
37
  <slot />
42
38
  </ObjectCard>
43
39
  </template>
@@ -46,11 +42,11 @@
46
42
  import { RiArticleLine } from '@remixicon/vue'
47
43
  import type { RouteLocationRaw } from 'vue-router'
48
44
  import type { Post } from '../types/posts'
49
- import Placeholder from './Placeholder.vue'
45
+ import CardMedia from './CardMedia.vue'
46
+ import FormattedDate from './FormattedDate.vue'
50
47
  import ObjectCard from './ObjectCard.vue'
51
- import ObjectCardHeader from './ObjectCardHeader.vue'
48
+ import ObjectCardMeta from './ObjectCardMeta.vue'
52
49
  import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
53
- import FormattedDate from './FormattedDate.vue'
54
50
  import TranslationT from './TranslationT.vue'
55
51
 
56
52
  defineProps<{
@@ -4,11 +4,12 @@
4
4
  :aria-valuenow="value"
5
5
  aria-valuemin="0"
6
6
  :aria-valuemax="max"
7
- class="min-w-20 h-2.5 rounded-lg border border-gray-default bg-[#f5f5f5] overflow-hidden"
7
+ class="overflow-hidden"
8
+ :class="compact ? 'w-16 h-1.5 rounded bg-gray-default' : 'min-w-20 h-2.5 rounded-lg border border-gray-default bg-[#f5f5f5]'"
8
9
  >
9
10
  <div
10
- class="h-full rounded-lg"
11
- :class="barClass"
11
+ class="h-full"
12
+ :class="[barClass, compact ? 'rounded' : 'rounded-lg']"
12
13
  :style="{ width: percentage + '%' }"
13
14
  />
14
15
  <slot />
@@ -22,6 +23,8 @@ const props = withDefaults(defineProps<{
22
23
  value: number
23
24
  max?: number
24
25
  barClass?: string
26
+ // Thin variant used inline in a line of text
27
+ compact?: boolean
25
28
  }>(), {
26
29
  max: 1,
27
30
  barClass: '',
@@ -1,29 +1,20 @@
1
1
  <template>
2
- <li>
3
- <p
4
- v-if="passed"
5
- class="fr-my-0 text-sm"
6
- >
7
- <span
8
- class="fr-icon-check-line"
2
+ <li class="p-0 m-0">
3
+ <p class="flex items-start gap-2 m-0 text-sm/[22px] text-gray-title">
4
+ <component
5
+ :is="passed ? RiCheckLine : RiAlertLine"
6
+ class="size-4 mt-[3px] flex-none"
7
+ :class="passed ? 'text-new-success' : 'text-new-warning'"
9
8
  aria-hidden="true"
10
9
  />
11
- {{ messagePassed }}
12
- </p>
13
- <p
14
- v-else
15
- class="my-0 text-gray-medium text-sm"
16
- >
17
- <span
18
- class="fr-icon-warning-line"
19
- aria-hidden="true"
20
- />
21
- {{ messageFailed }}
10
+ <span class="min-w-0 [overflow-wrap:anywhere]">{{ passed ? messagePassed : messageFailed }}</span>
22
11
  </p>
23
12
  </li>
24
13
  </template>
25
14
 
26
15
  <script setup lang="ts">
16
+ import { RiAlertLine, RiCheckLine } from '@remixicon/vue'
17
+
27
18
  defineProps<{
28
19
  passed?: boolean | null
29
20
  messagePassed: string
@@ -3,7 +3,8 @@
3
3
  :value="score"
4
4
  :max="quality_max_score"
5
5
  :aria-label="score >= high ? t('Bon') : t('À améliorer')"
6
- :bar-class="score >= high ? 'bg-success-dark' : 'bg-gray-low'"
6
+ :bar-class="barClass"
7
+ :compact
7
8
  :class="props.class"
8
9
  >
9
10
  <span class="sr-only">
@@ -22,6 +23,7 @@ import ProgressBar from './ProgressBar.vue'
22
23
  const props = withDefaults(defineProps<{
23
24
  score: number
24
25
  class?: string
26
+ compact?: boolean
25
27
  }>(), {
26
28
  class: '',
27
29
  })
@@ -29,4 +31,8 @@ const quality_max_score = 1
29
31
  const high = quality_max_score * 2 / 3
30
32
  const { t, locale } = useTranslation()
31
33
  const calculatedScore = computed(() => new Intl.NumberFormat(locale, { style: 'percent' }).format(props.score))
34
+ const barClass = computed(() => {
35
+ if (props.score >= high) return props.compact ? 'bg-new-success' : 'bg-success-dark'
36
+ return props.compact ? 'bg-new-gray-medium-clic' : 'bg-gray-low'
37
+ })
32
38
  </script>