@datagouv/components-next 1.5.1-dev.1398.g03d927e4 → 1.5.1-dev.1399.g35c3eb9f

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 (40) hide show
  1. package/dist/{Datafair.client-Dy9xu8CW.js → Datafair.client-CQNxPvZt.js} +1 -1
  2. package/dist/{ImagePreview.client-CwAd1LgO.js → ImagePreview.client-DbkBb47d.js} +1 -1
  3. package/dist/{JsonPreview.client-B_3llbkW.js → JsonPreview.client-Ba-_lUCj.js} +2 -2
  4. package/dist/{MapContainer.client-AMALm4aj.js → MapContainer.client-BsJGdnP2.js} +1 -1
  5. package/dist/{PdfPreview.client-BzcjEgi5.js → PdfPreview.client-CJbZbXds.js} +3 -3
  6. package/dist/{PdfSkeleton-CEK7DOge.js → PdfSkeleton-sY8nI3Lv.js} +1 -1
  7. package/dist/{Pmtiles.client-C8SVSeQV.js → Pmtiles.client-Wea3YvTU.js} +7 -7
  8. package/dist/{PreviewError-DOcS8Jau.js → PreviewError-BzUvwX47.js} +249 -247
  9. package/dist/{PreviewWrapper-CdSsdB9s.js → PreviewWrapper-CwOJqQSn.js} +1 -1
  10. package/dist/{XmlPreview.client-BnIm8NMm.js → XmlPreview.client-xXdnrUCW.js} +2 -2
  11. package/dist/components-next.css +1 -1
  12. package/dist/components-next.js +10072 -9895
  13. package/dist/components.css +1 -1
  14. package/dist/{france-DjD07ZB4.js → france-BYzDEL-I.js} +23 -23
  15. package/package.json +1 -1
  16. package/src/components/AccessTypeBadge.vue +46 -0
  17. package/src/components/Badge.vue +74 -0
  18. package/src/components/ChartBadge.vue +17 -0
  19. package/src/components/ChartCard.vue +4 -17
  20. package/src/components/DataserviceBadge.vue +17 -0
  21. package/src/components/DataserviceCard.vue +12 -31
  22. package/src/components/DatasetBadge.vue +17 -0
  23. package/src/components/DatasetCard.vue +11 -15
  24. package/src/components/DatasetInformation/DatasetInformationSection.vue +3 -7
  25. package/src/components/DatasetInformation/DatasetSchemaSection.vue +1 -4
  26. package/src/components/DatasetLabelTag.vue +4 -15
  27. package/src/components/LicenseBadge.vue +7 -12
  28. package/src/components/ObjectStatusBadge.vue +47 -0
  29. package/src/components/OrganizationBadge.vue +24 -0
  30. package/src/components/OrganizationTypeBadge.vue +5 -4
  31. package/src/components/ResourceAccordion/SchemaBadge.vue +6 -2
  32. package/src/components/ReuseBadge.vue +17 -0
  33. package/src/components/ReuseCard.vue +5 -20
  34. package/src/components/SchemaCard.vue +1 -5
  35. package/src/components/StatBox.vue +5 -3
  36. package/src/components/Tag.vue +61 -15
  37. package/src/functions/objectStatus.ts +34 -0
  38. package/src/main.ts +25 -3
  39. package/src/types/ui.ts +2 -0
  40. package/src/components/ObjectCardBadge.vue +0 -33
@@ -0,0 +1,24 @@
1
+ <template>
2
+ <Badge
3
+ v-if="organization.deleted"
4
+ tone="danger"
5
+ :icon="RiDeleteBinLine"
6
+ medium
7
+ >
8
+ {{ t('Supprimée') }}
9
+ </Badge>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { RiDeleteBinLine } from '@remixicon/vue'
14
+ import { useTranslation } from '../composables/useTranslation'
15
+ import type { Organization } from '../types/organizations'
16
+ import Badge from './Badge.vue'
17
+
18
+ // An active organization has no status worth showing: only a deleted one gets a badge
19
+ defineProps<{
20
+ organization: Organization
21
+ }>()
22
+
23
+ const { t } = useTranslation()
24
+ </script>
@@ -1,17 +1,18 @@
1
1
  <template>
2
- <ObjectCardBadge
2
+ <Badge
3
3
  v-if="organizationType.type !== OTHER"
4
4
  :icon="organizationType.icon"
5
- :tone="type === PUBLIC_SERVICE || type === LOCAL_AUTHORITY ? 'info' : 'neutral'"
5
+ :tone="type === PUBLIC_SERVICE || type === LOCAL_AUTHORITY ? 'primary' : 'neutral'"
6
+ medium
6
7
  >
7
8
  {{ organizationType.label }}
8
- </ObjectCardBadge>
9
+ </Badge>
9
10
  </template>
10
11
 
11
12
  <script setup lang="ts">
12
13
  import { computed } from 'vue'
13
14
  import { findOrganizationType, LOCAL_AUTHORITY, OTHER, PUBLIC_SERVICE, type OrganizationTypes } from '../functions/organizations'
14
- import ObjectCardBadge from './ObjectCardBadge.vue'
15
+ import Badge from './Badge.vue'
15
16
 
16
17
  const props = defineProps<{
17
18
  type: OrganizationTypes
@@ -81,8 +81,11 @@
81
81
  </template>
82
82
  </Toggletip>
83
83
  <span class="mr-1 text-gray-medium">{{ t("Schéma:") }}</span>
84
- <span class="flex items-center bg-danger-lightest rounded-xl">
85
- <span class="fr-tag fr-tag--sm">{{ title }}</span>
84
+ <span
85
+ class="flex items-center rounded-xl"
86
+ :class="{ 'bg-danger-lightest': validataStatus === 'warnings' || validataStatus === 'ko' }"
87
+ >
88
+ <Tag>{{ title }}</Tag>
86
89
  <span
87
90
  v-if="validataStatus === 'warnings'"
88
91
  class="flex items-center padding-sm"
@@ -105,6 +108,7 @@
105
108
  import { RiInformationLine } from '@remixicon/vue'
106
109
  import { computed, onMounted, ref } from 'vue'
107
110
  import type { Resource } from '../../types/resources'
111
+ import Tag from '../Tag.vue'
108
112
  import Toggletip from '../Toggletip.vue'
109
113
  import { findSchemaInCatalog, useGetCatalog, useGetSchemaDocumentation, useGetSchemaValidationUrl } from '../../functions/schemas'
110
114
  import { useTranslation } from '../../composables/useTranslation'
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <ObjectStatusBadge
3
+ :status="getReuseStatus(reuse)"
4
+ :size
5
+ />
6
+ </template>
7
+
8
+ <script setup lang="ts">
9
+ import { getReuseStatus } from '../functions/objectStatus'
10
+ import type { Reuse, ReuseV2 } from '../types/reuses'
11
+ import ObjectStatusBadge from './ObjectStatusBadge.vue'
12
+
13
+ defineProps<{
14
+ reuse: Reuse | ReuseV2
15
+ size?: 'xs' | 'sm'
16
+ }>()
17
+ </script>
@@ -32,23 +32,10 @@
32
32
  {{ reuse.title }}
33
33
  </template>
34
34
  <template
35
- v-if="reuse.private || reuse.archived"
35
+ v-if="getReuseStatus(reuse) !== 'public'"
36
36
  #badge
37
37
  >
38
- <span class="flex flex-wrap gap-1">
39
- <ObjectCardBadge
40
- v-if="reuse.private"
41
- :icon="RiLockLine"
42
- >
43
- {{ t('Brouillon') }}
44
- </ObjectCardBadge>
45
- <ObjectCardBadge
46
- v-if="reuse.archived"
47
- :icon="RiArchiveLine"
48
- >
49
- {{ t('Archivé') }}
50
- </ObjectCardBadge>
51
- </span>
38
+ <ReuseBadge :reuse />
52
39
  </template>
53
40
 
54
41
  <ObjectCardOwner
@@ -85,18 +72,18 @@
85
72
  </template>
86
73
 
87
74
  <script setup lang="ts">
88
- import { RiArchiveLine, RiLineChartLine, RiLockLine } from '@remixicon/vue'
75
+ import { RiLineChartLine } from '@remixicon/vue'
89
76
  import type { RouteLocationRaw } from 'vue-router'
77
+ import { getReuseStatus } from '../functions/objectStatus'
90
78
  import type { Reuse, ReuseV2 } from '../types/reuses'
91
79
  import type { TitleTag } from '../types/ui'
92
- import { useTranslation } from '../composables/useTranslation'
93
80
  import CardMedia from './CardMedia.vue'
94
81
  import FormattedDate from './FormattedDate.vue'
95
82
  import ObjectCard from './ObjectCard.vue'
96
83
  import ObjectCardShortDescription from './ObjectCardShortDescription.vue'
97
- import ObjectCardBadge from './ObjectCardBadge.vue'
98
84
  import ObjectCardMeta from './ObjectCardMeta.vue'
99
85
  import ObjectCardOwner from './ObjectCardOwner.vue'
86
+ import ReuseBadge from './ReuseBadge.vue'
100
87
  import ReuseDetails from './ReuseDetails.vue'
101
88
  import TranslationT from './TranslationT.vue'
102
89
 
@@ -129,6 +116,4 @@ withDefaults(
129
116
  titleTag: 'h3',
130
117
  },
131
118
  )
132
-
133
- const { t } = useTranslation()
134
119
  </script>
@@ -21,14 +21,10 @@
21
21
  <Tag
22
22
  v-for="label in schema.labels"
23
23
  :key="label"
24
- type="secondary"
25
24
  >
26
25
  {{ t('Label :') }} {{ label }}
27
26
  </Tag>
28
- <Tag
29
- v-if="schema.schema_type"
30
- type="secondary"
31
- >
27
+ <Tag v-if="schema.schema_type">
32
28
  {{ t('Standard :') }} {{ schema.schema_type }}
33
29
  </Tag>
34
30
  </div>
@@ -144,9 +144,10 @@
144
144
  />
145
145
  </div>
146
146
  </div>
147
- <p
147
+ <Badge
148
148
  v-if="lastValue && lastMonth"
149
- class="mt-2 gap-1 font-normal normal-case fr-badge fr-badge--no-icon fr-badge--success"
149
+ tone="success"
150
+ class="mt-2"
150
151
  >
151
152
  <strong>
152
153
  + {{ summarize(lastValue, 2) }}
@@ -156,13 +157,14 @@
156
157
  :date="lastMonth"
157
158
  :options="{ dateStyle: undefined, year: 'numeric', month: 'short', day: undefined }"
158
159
  />
159
- </p>
160
+ </Badge>
160
161
  </div>
161
162
  </template>
162
163
 
163
164
  <script setup lang="ts">
164
165
  import { computed } from 'vue'
165
166
  import { ContentLoader } from 'vue-content-loader'
167
+ import Badge from './Badge.vue'
166
168
  import FormattedDate from './FormattedDate.vue'
167
169
  import { summarize } from '../functions/helpers'
168
170
  import { useTranslation } from '../composables/useTranslation'
@@ -1,30 +1,76 @@
1
1
  <template>
2
- <span
3
- class="inline-flex items-center space-x-1 text-xs rounded-xl px-2 py-0.5"
4
- :class="classes"
2
+ <component
3
+ :is="to ? AppLink : isButton ? 'button' : 'span'"
4
+ :to
5
+ :type="isButton ? 'button' : undefined"
6
+ :aria-pressed="pressed"
7
+ @click="toggle"
8
+ class="inline-flex items-center gap-1 max-w-full min-h-6 py-0.5 rounded-xl shadow-[inset_0_0_0_1px_var(--border-default-grey)] text-xs/[18px] font-normal"
9
+ :class="[stateClasses, displayedIcon && typeof displayedIcon !== 'string' ? 'pl-1.5 pr-2' : 'px-2']"
5
10
  >
11
+ <img
12
+ v-if="typeof displayedIcon === 'string'"
13
+ :src="displayedIcon"
14
+ alt=""
15
+ class="size-3.5 flex-none object-contain"
16
+ >
6
17
  <component
7
- :is="icon"
8
- v-if="icon"
9
- class="size-3"
18
+ :is="displayedIcon"
19
+ v-else-if="displayedIcon"
20
+ class="size-3.5 flex-none"
21
+ aria-hidden="true"
10
22
  />
11
- <span class="-mt-px">
23
+ <span class="min-w-0 [overflow-wrap:anywhere] [text-box:trim-both_cap_alphabetic]">
24
+ <!-- Gives the button an accessible name built from its own content: "Supprimer transport" -->
25
+ <span
26
+ v-if="dismissible"
27
+ class="sr-only"
28
+ >{{ `${t('Supprimer')} ` }}</span>
12
29
  <slot />
13
30
  </span>
14
- </span>
31
+ </component>
15
32
  </template>
16
33
 
17
34
  <script setup lang="ts">
18
- import { computed, type Component } from 'vue'
35
+ import { RiCloseLine } from '@remixicon/vue'
36
+ import { computed, useAttrs, type Component } from 'vue'
37
+ import type { RouteLocationRaw } from 'vue-router'
38
+ import { useTranslation } from '../composables/useTranslation'
39
+ import AppLink from './AppLink.vue'
19
40
 
20
41
  const props = defineProps<{
21
- icon?: Component
22
- type: 'secondary'
42
+ // A string is an image URL, e.g. the SVG of a dataset label
43
+ icon?: Component | string
44
+ to?: RouteLocationRaw
45
+ // Removes the tag on click: shows a cross in place of the icon
46
+ dismissible?: boolean
23
47
  }>()
24
48
 
25
- const classes = computed(() => {
26
- return {
27
- secondary: 'text-gray-title bg-gray-lower',
28
- }[props.type]
49
+ // Left unbound, the tag is not a toggle and gets no aria-pressed at all
50
+ const pressed = defineModel<boolean | undefined>('pressed', { default: undefined })
51
+
52
+ const { t } = useTranslation()
53
+ const attrs = useAttrs()
54
+ const isButton = computed(() => !props.to && (props.dismissible || !!attrs.onClick || pressed.value !== undefined))
55
+ const displayedIcon = computed(() => props.dismissible ? RiCloseLine : props.icon)
56
+
57
+ function toggle() {
58
+ if (pressed.value !== undefined) pressed.value = !pressed.value
59
+ }
60
+
61
+ const stateClasses = computed(() => {
62
+ if (pressed.value) {
63
+ return 'text-(--text-inverted-blue-france) bg-(--background-action-high-blue-france) focus-visible:outline-(--border-active-blue-france)'
64
+ }
65
+ if (props.to || isButton.value) {
66
+ return [
67
+ 'text-(--text-label-grey) bg-transparent bg-none',
68
+ 'hover:text-(--text-action-high-blue-france) hover:bg-(--background-action-low-blue-france)',
69
+ 'focus-visible:text-(--text-action-high-blue-france) focus-visible:bg-(--background-action-low-blue-france) focus-visible:outline-(--border-active-blue-france)',
70
+ 'active:bg-(--background-action-low-blue-france-active)',
71
+ 'disabled:text-(--text-disabled-grey) disabled:bg-(--background-disabled-grey)',
72
+ ].join(' ')
73
+ }
74
+ return 'text-(--text-label-grey) bg-transparent'
29
75
  })
30
76
  </script>
@@ -0,0 +1,34 @@
1
+ import type { Dataset, DatasetV2, DatasetV2WithFullObject } from '../types/datasets'
2
+ import type { Dataservice } from '../types/dataservices'
3
+ import type { Reuse, ReuseV2 } from '../types/reuses'
4
+ import type { Chart } from '../types/visualizations'
5
+
6
+ // Publication status shared by every published object, from the most to the least prominent
7
+ export type ObjectStatus = 'deleted' | 'archived' | 'private' | 'public'
8
+
9
+ export function getDatasetStatus(dataset: Dataset | DatasetV2 | DatasetV2WithFullObject): ObjectStatus {
10
+ if (dataset.deleted) return 'deleted'
11
+ if (dataset.archived) return 'archived'
12
+ if (dataset.private) return 'private'
13
+ return 'public'
14
+ }
15
+
16
+ export function getDataserviceStatus(dataservice: Dataservice): ObjectStatus {
17
+ if (dataservice.deleted_at) return 'deleted'
18
+ if (dataservice.archived_at) return 'archived'
19
+ if (dataservice.private) return 'private'
20
+ return 'public'
21
+ }
22
+
23
+ export function getReuseStatus(reuse: Reuse | ReuseV2): ObjectStatus {
24
+ if (reuse.deleted) return 'deleted'
25
+ if (reuse.archived) return 'archived'
26
+ if (reuse.private) return 'private'
27
+ return 'public'
28
+ }
29
+
30
+ export function getChartStatus(chart: Chart): ObjectStatus {
31
+ if (chart.deleted_at) return 'deleted'
32
+ if (chart.private) return 'private'
33
+ return 'public'
34
+ }
package/src/main.ts CHANGED
@@ -2,7 +2,7 @@ import type { App, Plugin } from 'vue'
2
2
  import type { Activity, ActivityKey } from './types/activity.js'
3
3
  import type { PaginatedArray } from './types/api.js'
4
4
  import type { ContactPoint, ContactPointRole } from './types/contact_point.js'
5
- import type { Badge, Badges, TranslatedBadge } from './types/badges'
5
+ import type { Badge as BadgeObject, Badges, TranslatedBadge } from './types/badges'
6
6
  import type { DatasetReference, Dataset, DatasetV2, DatasetV2WithFullObject, NewDataset, Quality, Rel } from './types/datasets'
7
7
  import type { DataserviceReference, NewDataservice, Dataservice } from './types/dataservices'
8
8
  import type { AccessType, AccessAudience, AccessAudienceCondition, AccessAudienceType, WithAccessType, AccessTypeForm } from './types/access_types'
@@ -20,7 +20,7 @@ import type { RegisteredSchema, Schema, SchemaDetails, SchemaField, SchemaPath,
20
20
  import type { TopicV2, TopicElement, TopicElementClass, TopicElementRel } from './types/topics'
21
21
  import type { CommunityResource, FileResourceFileType, RemoteResourceFileType, ResourceFileType, ResourceGroup, ResourceType, Resource } from './types/resources'
22
22
  import type { Site } from './types/site'
23
- import type { Weight, WellType } from './types/ui'
23
+ import type { BadgeTone, Weight, WellType } from './types/ui'
24
24
  import type { User, UserReference } from './types/users'
25
25
  import type { Report, ReportSubject, ReportReason } from './types/reports'
26
26
  import type { Chart, ChartForm, ChartForApi, FilterCondition, Filter, AndFilters, OrFilters, GenericFilter, XAxisType, XAxisSortBy, SortDirection, XAxis, XAxisForm, UnitPosition, YAxis, DataSeriesType, DataSeries, DataSeriesForm, CombinedSort, ColumnDefinition, ColumnsDefinition } from './types/visualizations'
@@ -30,6 +30,7 @@ import { getDefaultDatasetConfig, getDefaultDataserviceConfig, getDefaultReuseCo
30
30
  import { useSearchFilter } from './composables/useSearchFilter'
31
31
  import type { UseSearchFilterOptions } from './composables/useSearchFilter'
32
32
 
33
+ import AccessTypeBadge from './components/AccessTypeBadge.vue'
33
34
  import ActivityActor from './components/ActivityList/ActivityActor.vue'
34
35
  import ActivityList from './components/ActivityList/ActivityList.vue'
35
36
  import UserActivityList from './components/ActivityList/UserActivityList.vue'
@@ -37,14 +38,18 @@ import AnimatedLoader from './components/AnimatedLoader.vue'
37
38
  import AppLink from './components/AppLink.vue'
38
39
  import Avatar from './components/Avatar.vue'
39
40
  import AvatarWithName from './components/AvatarWithName.vue'
41
+ import Badge from './components/Badge.vue'
40
42
  import BannerAction from './components/BannerAction.vue'
41
43
  import BrandedButton from './components/BrandedButton.vue'
44
+ import ChartBadge from './components/ChartBadge.vue'
42
45
  import ChartCard from './components/ChartCard.vue'
43
46
  import CopyButton from './components/CopyButton.vue'
47
+ import DataserviceBadge from './components/DataserviceBadge.vue'
44
48
  import DataserviceCard from './components/DataserviceCard.vue'
45
49
  import DataserviceQuality from './components/DataserviceQuality.vue'
46
50
  import DataserviceQualityInline from './components/DataserviceQualityInline.vue'
47
51
  import DataserviceQualityTooltipContent from './components/DataserviceQualityTooltipContent.vue'
52
+ import DatasetBadge from './components/DatasetBadge.vue'
48
53
  import DatasetCard from './components/DatasetCard.vue'
49
54
  import DataStructure from './components/ResourceAccordion/DataStructure.vue'
50
55
  import Downloads from './components/ResourceAccordion/Downloads.vue'
@@ -68,7 +73,10 @@ import ExtraAccordion from './components/ExtraAccordion.vue'
68
73
  import LabelTag from './components/DatasetLabelTag.vue'
69
74
  import LoadingBlock from './components/LoadingBlock.vue'
70
75
  import MarkdownViewer from './components/MarkdownViewer.vue'
76
+ import ObjectStatusBadge from './components/ObjectStatusBadge.vue'
77
+ import OrganizationBadge from './components/OrganizationBadge.vue'
71
78
  import OrganizationCard from './components/OrganizationCard.vue'
79
+ import OrganizationTypeBadge from './components/OrganizationTypeBadge.vue'
72
80
  import ObjectCardOwner from './components/ObjectCardOwner.vue'
73
81
  import OrganizationLogo from './components/OrganizationLogo.vue'
74
82
  import OrganizationNameWithCertificate from './components/OrganizationNameWithCertificate.vue'
@@ -88,6 +96,7 @@ import ResourceExplorer from './components/ResourceExplorer/ResourceExplorer.vue
88
96
  import ResourceExplorerSidebar from './components/ResourceExplorer/ResourceExplorerSidebar.vue'
89
97
  import ResourceExplorerViewer from './components/ResourceExplorer/ResourceExplorerViewer.vue'
90
98
  import OpenApiViewer from './components/OpenApiViewer/OpenApiViewer.vue'
99
+ import ReuseBadge from './components/ReuseBadge.vue'
91
100
  import ReuseCard from './components/ReuseCard.vue'
92
101
  import ReuseDetails from './components/ReuseDetails.vue'
93
102
  import SchemaCard from './components/SchemaCard.vue'
@@ -121,6 +130,9 @@ import { useTranslation } from './composables/useTranslation'
121
130
 
122
131
  export type { SegmentedControlOption } from './components/SegmentedControl.vue'
123
132
 
133
+ // Same name as the Badge component on purpose: as a type, `Badge` is the udata badge (spd, hvd, certified…)
134
+ export type Badge = BadgeObject
135
+
124
136
  export { Toaster, toast } from 'vue-sonner'
125
137
 
126
138
  export * from './composables/useActiveDescendant'
@@ -143,6 +155,7 @@ export * from './functions/markdown'
143
155
  export * from './functions/matomo'
144
156
  export * from './functions/metrics'
145
157
  export * from './functions/never'
158
+ export * from './functions/objectStatus'
146
159
  export * from './functions/organizations'
147
160
  export * from './functions/owned'
148
161
  export * from './functions/previewErrors'
@@ -182,7 +195,7 @@ export type {
182
195
  AccessTypeForm,
183
196
  Activity,
184
197
  ActivityKey,
185
- Badge,
198
+ BadgeTone,
186
199
  Badges,
187
200
  CommunityResource,
188
201
  ContactPoint,
@@ -356,20 +369,25 @@ const datagouv: Plugin<PluginConfig> = {
356
369
  export {
357
370
  datagouv,
358
371
  useComponentsConfig,
372
+ AccessTypeBadge,
359
373
  ActivityActor,
360
374
  ActivityList,
361
375
  AnimatedLoader,
362
376
  AppLink,
363
377
  Avatar,
364
378
  AvatarWithName,
379
+ Badge,
365
380
  BannerAction,
366
381
  BrandedButton,
382
+ ChartBadge,
367
383
  ChartCard,
368
384
  CopyButton,
385
+ DataserviceBadge,
369
386
  DataserviceCard,
370
387
  DataserviceQuality,
371
388
  DataserviceQualityInline,
372
389
  DataserviceQualityTooltipContent,
390
+ DatasetBadge,
373
391
  DatasetCard,
374
392
  DataStructure,
375
393
  Downloads,
@@ -396,7 +414,10 @@ export {
396
414
  LoadingBlock,
397
415
  Tag,
398
416
  MarkdownViewer,
417
+ ObjectStatusBadge,
418
+ OrganizationBadge,
399
419
  OrganizationCard,
420
+ OrganizationTypeBadge,
400
421
  OrganizationLogo,
401
422
  OrganizationNameWithCertificate,
402
423
  OwnerType,
@@ -416,6 +437,7 @@ export {
416
437
  ObjectCardOwner,
417
438
  ResourceIcon,
418
439
  ResourceSelector,
440
+ ReuseBadge,
419
441
  ReuseCard,
420
442
  ReuseDetails,
421
443
  SchemaCard,
package/src/types/ui.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export type WellType = 'primary' | 'secondary'
2
2
 
3
+ export type BadgeTone = 'neutral' | 'primary' | 'success' | 'warning' | 'yellow' | 'danger' | 'pink' | 'teal'
4
+
3
5
  export type Weight = 'light' | 'regular' | 'semi-bold' | 'bold' | 'heavy'
4
6
 
5
7
  export type TitleTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p'
@@ -1,33 +0,0 @@
1
- <template>
2
- <span
3
- class="inline-flex items-center gap-1 max-w-full min-h-6 px-2 py-0.5 rounded border border-current/20 text-xs/[18px] font-medium"
4
- :class="toneClass"
5
- >
6
- <component
7
- :is="icon"
8
- v-if="icon"
9
- class="size-3.5 flex-none"
10
- aria-hidden="true"
11
- />
12
- <span class="min-w-0 [overflow-wrap:anywhere]"><slot /></span>
13
- </span>
14
- </template>
15
-
16
- <script setup lang="ts">
17
- import { computed, type Component } from 'vue'
18
-
19
- const props = withDefaults(defineProps<{
20
- icon?: Component | null
21
- tone?: 'neutral' | 'info' | 'warning' | 'yellow' | 'danger'
22
- }>(), {
23
- tone: 'neutral',
24
- })
25
-
26
- const toneClass = computed(() => ({
27
- neutral: 'bg-gray-lower text-gray-plain',
28
- info: 'bg-blue-france-contrast text-new-primary',
29
- warning: 'bg-new-warning-light text-new-warning',
30
- yellow: 'bg-warning2-lightest text-warning2-dark',
31
- danger: 'bg-new-error-light text-new-error',
32
- })[props.tone])
33
- </script>