origam 2.38.1 → 2.38.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.
Files changed (228) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/src/assets/locales/en.json +1 -1
  3. package/dist/src/assets/locales/fr.json +2 -2
  4. package/dist/src/components/Alert/OrigamAlert.vue +739 -165
  5. package/dist/src/components/App/OrigamApp.vue +95 -19
  6. package/dist/src/components/App/OrigamAppBar.vue +751 -158
  7. package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
  8. package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
  9. package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
  10. package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
  11. package/dist/src/components/Badge/OrigamBadge.vue +548 -135
  12. package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
  13. package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
  14. package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
  15. package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
  16. package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
  17. package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
  18. package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
  19. package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
  20. package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
  21. package/dist/src/components/Btn/OrigamBtn.vue +928 -249
  22. package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
  23. package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
  24. package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
  25. package/dist/src/components/Card/OrigamCard.vue +938 -194
  26. package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
  27. package/dist/src/components/Card/OrigamCardText.vue +536 -84
  28. package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
  29. package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
  30. package/dist/src/components/Chart/OrigamChart.vue +942 -452
  31. package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
  32. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
  33. package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
  34. package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
  35. package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
  36. package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
  37. package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
  38. package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
  39. package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
  40. package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
  41. package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
  42. package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
  43. package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
  44. package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
  45. package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
  46. package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
  47. package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
  48. package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
  49. package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
  50. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
  51. package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
  52. package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
  53. package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
  54. package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
  55. package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
  56. package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
  57. package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
  58. package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
  59. package/dist/src/components/Chip/OrigamChip.vue +867 -202
  60. package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
  61. package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
  62. package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
  63. package/dist/src/components/Code/OrigamCode.vue +844 -206
  64. package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
  65. package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
  66. package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
  67. package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
  68. package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
  69. package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
  70. package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
  71. package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
  72. package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
  73. package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
  74. package/dist/src/components/Counter/OrigamCounter.vue +588 -96
  75. package/dist/src/components/DataList/OrigamDataList.vue +619 -113
  76. package/dist/src/components/DataList/OrigamDataText.vue +295 -65
  77. package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
  78. package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
  79. package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
  80. package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
  81. package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
  82. package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
  83. package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
  84. package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
  85. package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
  86. package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
  87. package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
  88. package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
  89. package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
  90. package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
  91. package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
  92. package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
  93. package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
  94. package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
  95. package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
  96. package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
  97. package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
  98. package/dist/src/components/Divider/OrigamDivider.vue +210 -50
  99. package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
  100. package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
  101. package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
  102. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
  103. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
  104. package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
  105. package/dist/src/components/Field/OrigamField.vue +1118 -306
  106. package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
  107. package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
  108. package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
  109. package/dist/src/components/Form/OrigamForm.vue +197 -74
  110. package/dist/src/components/Grid/OrigamGrid.vue +707 -147
  111. package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
  112. package/dist/src/components/Grids/OrigamCol.vue +593 -110
  113. package/dist/src/components/Grids/OrigamContainer.vue +461 -80
  114. package/dist/src/components/Grids/OrigamRow.vue +573 -112
  115. package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
  116. package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
  117. package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
  118. package/dist/src/components/Icon/OrigamIcon.vue +561 -98
  119. package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
  120. package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
  121. package/dist/src/components/Img/OrigamImg.vue +869 -228
  122. package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
  123. package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
  124. package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
  125. package/dist/src/components/Input/OrigamInput.vue +747 -180
  126. package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
  127. package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
  128. package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
  129. package/dist/src/components/Label/OrigamLabel.vue +584 -95
  130. package/dist/src/components/Layout/OrigamLayout.vue +563 -94
  131. package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
  132. package/dist/src/components/List/OrigamList.vue +755 -170
  133. package/dist/src/components/List/OrigamListChildren.vue +59 -19
  134. package/dist/src/components/List/OrigamListGroup.vue +631 -134
  135. package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
  136. package/dist/src/components/List/OrigamListItem.vue +890 -224
  137. package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
  138. package/dist/src/components/List/OrigamListSubheader.vue +542 -93
  139. package/dist/src/components/Loader/OrigamLoader.vue +110 -25
  140. package/dist/src/components/Main/OrigamMain.vue +565 -96
  141. package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
  142. package/dist/src/components/Media/OrigamMediaController.vue +465 -182
  143. package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
  144. package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
  145. package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
  146. package/dist/src/components/Messages/OrigamMessages.vue +606 -97
  147. package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
  148. package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
  149. package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
  150. package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
  151. package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
  152. package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
  153. package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
  154. package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
  155. package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
  156. package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
  157. package/dist/src/components/Picker/OrigamPicker.vue +655 -108
  158. package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
  159. package/dist/src/components/Progress/OrigamProgress.vue +436 -70
  160. package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
  161. package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
  162. package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
  163. package/dist/src/components/Radio/OrigamRadio.vue +772 -132
  164. package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
  165. package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
  166. package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
  167. package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
  168. package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
  169. package/dist/src/components/Select/OrigamSelect.vue +1639 -567
  170. package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
  171. package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
  172. package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
  173. package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
  174. package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
  175. package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
  176. package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
  177. package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
  178. package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
  179. package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
  180. package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
  181. package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
  182. package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
  183. package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
  184. package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
  185. package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
  186. package/dist/src/components/Table/OrigamTable.vue +585 -124
  187. package/dist/src/components/Tabs/OrigamTab.vue +239 -73
  188. package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
  189. package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
  190. package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
  191. package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
  192. package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
  193. package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
  194. package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
  195. package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
  196. package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
  197. package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
  198. package/dist/src/components/Title/OrigamTitle.vue +505 -82
  199. package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
  200. package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
  201. package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
  202. package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
  203. package/dist/src/components/Transition/OrigamFade.vue +47 -9
  204. package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
  205. package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
  206. package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
  207. package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
  208. package/dist/src/components/Transition/OrigamSnack.vue +52 -10
  209. package/dist/src/components/Transition/OrigamTransition.vue +40 -12
  210. package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
  211. package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
  212. package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
  213. package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
  214. package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
  215. package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
  216. package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
  217. package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
  218. package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
  219. package/dist/src/components/Video/OrigamVideo.vue +1178 -331
  220. package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
  221. package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
  222. package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
  223. package/dist/src/components/Window/OrigamWindow.vue +745 -175
  224. package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
  225. package/dist/src/composables/Commons/display.composable.cjs +2 -0
  226. package/dist/src/composables/Commons/display.composable.js +1 -1
  227. package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
  228. package/package.json +6 -6
@@ -163,10 +163,7 @@
163
163
 
164
164
  <script lang="ts" setup>
165
165
  import { CHART_SIZE_FALLBACK, CHART_SVG_ROLE } from "../../consts/Chart/chart.const";
166
- import {
167
- computed,
168
- ref
169
- } from "vue";
166
+ import { computed, ref } from "vue";
170
167
  import { useChartRoving } from "../../composables/Chart/chart-roving.composable";
171
168
  import { useChartSize } from "../../composables/Chart/chart-size.composable";
172
169
  import { useLocale } from "../../composables/Commons/locale.composable";
@@ -178,70 +175,422 @@ import { useMargin } from "../../composables/Commons/margin.composable";
178
175
  import { usePadding } from "../../composables/Commons/padding.composable";
179
176
  import { useRounded } from "../../composables/Commons/rounded.composable";
180
177
  import { intentBgExpr, isIntent } from "../../utils/Commons/color.util";
181
- defineOptions({
182
- name: "OrigamChartSparkline"
183
- });
178
+ /*********************************************************
179
+ * Global
180
+ *
181
+ * @description
182
+ * Sparkline — tiny inline chart for table cells, KPI cards,
183
+ * and dashboards. No axes, no legend, no grid.
184
+ *
185
+ * Supports `line`, `area`, `column`, and `bar` rendering.
186
+ * A single `color` prop drives the entire paint; no palette
187
+ * cycling. Marker circles can be shown for all points
188
+ * (`showMarkers`) or exclusively for the min / max / last
189
+ * special points.
190
+ *
191
+ * `withDefaults` literals only, per CLAUDE.md.
192
+ ********************************************************/
193
+ defineOptions({ name: "OrigamChartSparkline" });
184
194
  const props = defineProps({
185
- series: { type: Array, required: true },
186
- type: { type: null, required: false, default: "line" },
187
- color: { type: null, required: false, default: "primary" },
188
- lineWidth: { type: Number, required: false, default: 1.5 },
189
- showMarkers: { type: Boolean, required: false, default: false },
190
- showMin: { type: Boolean, required: false, default: false },
191
- showMax: { type: Boolean, required: false, default: false },
192
- showLast: { type: Boolean, required: false, default: true },
193
- markerSize: { type: Number, required: false, default: 2.5 },
194
- width: { type: [Number, String], required: false, default: 120 },
195
- height: { type: [Number, String], required: false, default: 30 },
196
- categories: { type: Array, required: false },
197
- title: { type: String, required: false, default: void 0 },
198
- subtitle: { type: String, required: false, default: void 0 },
199
- showTooltip: { type: Boolean, required: false, default: false },
200
- animated: { type: Boolean, required: false, default: false },
201
- animationDuration: { type: Number, required: false, default: 600 },
202
- aspectRatio: { type: String, required: false, default: void 0 },
203
- id: { type: String, required: false },
204
- class: { type: [String, Array, Object], required: false },
205
- style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
206
- maxHeight: { type: [Number, String], required: false },
207
- maxWidth: { type: [Number, String], required: false },
208
- minHeight: { type: [Number, String], required: false },
209
- minWidth: { type: [Number, String], required: false },
210
- margin: { type: [Boolean, Number, String], required: false },
211
- marginTop: { type: [Boolean, Number, String], required: false },
212
- marginLeft: { type: [Boolean, Number, String], required: false },
213
- marginBottom: { type: [Boolean, Number, String], required: false },
214
- marginRight: { type: [Boolean, Number, String], required: false },
215
- marginBlock: { type: [Boolean, Number, String], required: false },
216
- marginInline: { type: [Boolean, Number, String], required: false },
217
- marginInlineStart: { type: [Boolean, Number, String], required: false },
218
- marginInlineEnd: { type: [Boolean, Number, String], required: false },
219
- marginBlockStart: { type: [Boolean, Number, String], required: false },
220
- marginBlockEnd: { type: [Boolean, Number, String], required: false },
221
- padding: { type: [Boolean, Number, String], required: false },
222
- paddingTop: { type: [Boolean, Number, String], required: false },
223
- paddingLeft: { type: [Boolean, Number, String], required: false },
224
- paddingBottom: { type: [Boolean, Number, String], required: false },
225
- paddingRight: { type: [Boolean, Number, String], required: false },
226
- paddingBlock: { type: [Boolean, Number, String], required: false },
227
- paddingInline: { type: [Boolean, Number, String], required: false },
228
- paddingInlineStart: { type: [Boolean, Number, String], required: false },
229
- paddingInlineEnd: { type: [Boolean, Number, String], required: false },
230
- paddingBlockStart: { type: [Boolean, Number, String], required: false },
231
- paddingBlockEnd: { type: [Boolean, Number, String], required: false },
232
- rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
233
- roundedTopRight: { type: [Boolean, Number, String], required: false },
234
- roundedTopLeft: { type: [Boolean, Number, String], required: false },
235
- roundedBottomLeft: { type: [Boolean, Number, String], required: false },
236
- roundedBottomRight: { type: [Boolean, Number, String], required: false },
237
- roundedStartStart: { type: [Boolean, Number, String], required: false },
238
- roundedStartEnd: { type: [Boolean, Number, String], required: false },
239
- roundedEndStart: { type: [Boolean, Number, String], required: false },
240
- roundedEndEnd: { type: [Boolean, Number, String], required: false },
241
- elevation: { type: [Number, String], required: false },
242
- bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
243
- fontSize: { type: null, required: false },
244
- fontWeight: { type: null, required: false }
195
+ series: {
196
+ type: Array,
197
+ required: true
198
+ },
199
+ type: {
200
+ type: null,
201
+ required: false,
202
+ default: "line"
203
+ },
204
+ color: {
205
+ type: null,
206
+ required: false,
207
+ default: "primary"
208
+ },
209
+ lineWidth: {
210
+ type: Number,
211
+ required: false,
212
+ default: 1.5
213
+ },
214
+ showMarkers: {
215
+ type: Boolean,
216
+ required: false,
217
+ default: false
218
+ },
219
+ showMin: {
220
+ type: Boolean,
221
+ required: false,
222
+ default: false
223
+ },
224
+ showMax: {
225
+ type: Boolean,
226
+ required: false,
227
+ default: false
228
+ },
229
+ showLast: {
230
+ type: Boolean,
231
+ required: false,
232
+ default: true
233
+ },
234
+ markerSize: {
235
+ type: Number,
236
+ required: false,
237
+ default: 2.5
238
+ },
239
+ width: {
240
+ type: [Number, String],
241
+ required: false,
242
+ default: 120
243
+ },
244
+ height: {
245
+ type: [Number, String],
246
+ required: false,
247
+ default: 30
248
+ },
249
+ categories: {
250
+ type: Array,
251
+ required: false
252
+ },
253
+ title: {
254
+ type: String,
255
+ required: false,
256
+ default: undefined
257
+ },
258
+ subtitle: {
259
+ type: String,
260
+ required: false,
261
+ default: undefined
262
+ },
263
+ showTooltip: {
264
+ type: Boolean,
265
+ required: false,
266
+ default: false
267
+ },
268
+ animated: {
269
+ type: Boolean,
270
+ required: false,
271
+ default: false
272
+ },
273
+ animationDuration: {
274
+ type: Number,
275
+ required: false,
276
+ default: 600
277
+ },
278
+ aspectRatio: {
279
+ type: String,
280
+ required: false,
281
+ default: undefined
282
+ },
283
+ id: {
284
+ type: String,
285
+ required: false
286
+ },
287
+ class: {
288
+ type: [
289
+ String,
290
+ Array,
291
+ Object
292
+ ],
293
+ required: false
294
+ },
295
+ style: {
296
+ type: [
297
+ String,
298
+ Array,
299
+ Object,
300
+ Boolean,
301
+ null
302
+ ],
303
+ required: false,
304
+ skipCheck: true
305
+ },
306
+ maxHeight: {
307
+ type: [Number, String],
308
+ required: false
309
+ },
310
+ maxWidth: {
311
+ type: [Number, String],
312
+ required: false
313
+ },
314
+ minHeight: {
315
+ type: [Number, String],
316
+ required: false
317
+ },
318
+ minWidth: {
319
+ type: [Number, String],
320
+ required: false
321
+ },
322
+ margin: {
323
+ type: [
324
+ Boolean,
325
+ Number,
326
+ String
327
+ ],
328
+ required: false
329
+ },
330
+ marginTop: {
331
+ type: [
332
+ Boolean,
333
+ Number,
334
+ String
335
+ ],
336
+ required: false
337
+ },
338
+ marginLeft: {
339
+ type: [
340
+ Boolean,
341
+ Number,
342
+ String
343
+ ],
344
+ required: false
345
+ },
346
+ marginBottom: {
347
+ type: [
348
+ Boolean,
349
+ Number,
350
+ String
351
+ ],
352
+ required: false
353
+ },
354
+ marginRight: {
355
+ type: [
356
+ Boolean,
357
+ Number,
358
+ String
359
+ ],
360
+ required: false
361
+ },
362
+ marginBlock: {
363
+ type: [
364
+ Boolean,
365
+ Number,
366
+ String
367
+ ],
368
+ required: false
369
+ },
370
+ marginInline: {
371
+ type: [
372
+ Boolean,
373
+ Number,
374
+ String
375
+ ],
376
+ required: false
377
+ },
378
+ marginInlineStart: {
379
+ type: [
380
+ Boolean,
381
+ Number,
382
+ String
383
+ ],
384
+ required: false
385
+ },
386
+ marginInlineEnd: {
387
+ type: [
388
+ Boolean,
389
+ Number,
390
+ String
391
+ ],
392
+ required: false
393
+ },
394
+ marginBlockStart: {
395
+ type: [
396
+ Boolean,
397
+ Number,
398
+ String
399
+ ],
400
+ required: false
401
+ },
402
+ marginBlockEnd: {
403
+ type: [
404
+ Boolean,
405
+ Number,
406
+ String
407
+ ],
408
+ required: false
409
+ },
410
+ padding: {
411
+ type: [
412
+ Boolean,
413
+ Number,
414
+ String
415
+ ],
416
+ required: false
417
+ },
418
+ paddingTop: {
419
+ type: [
420
+ Boolean,
421
+ Number,
422
+ String
423
+ ],
424
+ required: false
425
+ },
426
+ paddingLeft: {
427
+ type: [
428
+ Boolean,
429
+ Number,
430
+ String
431
+ ],
432
+ required: false
433
+ },
434
+ paddingBottom: {
435
+ type: [
436
+ Boolean,
437
+ Number,
438
+ String
439
+ ],
440
+ required: false
441
+ },
442
+ paddingRight: {
443
+ type: [
444
+ Boolean,
445
+ Number,
446
+ String
447
+ ],
448
+ required: false
449
+ },
450
+ paddingBlock: {
451
+ type: [
452
+ Boolean,
453
+ Number,
454
+ String
455
+ ],
456
+ required: false
457
+ },
458
+ paddingInline: {
459
+ type: [
460
+ Boolean,
461
+ Number,
462
+ String
463
+ ],
464
+ required: false
465
+ },
466
+ paddingInlineStart: {
467
+ type: [
468
+ Boolean,
469
+ Number,
470
+ String
471
+ ],
472
+ required: false
473
+ },
474
+ paddingInlineEnd: {
475
+ type: [
476
+ Boolean,
477
+ Number,
478
+ String
479
+ ],
480
+ required: false
481
+ },
482
+ paddingBlockStart: {
483
+ type: [
484
+ Boolean,
485
+ Number,
486
+ String
487
+ ],
488
+ required: false
489
+ },
490
+ paddingBlockEnd: {
491
+ type: [
492
+ Boolean,
493
+ Number,
494
+ String
495
+ ],
496
+ required: false
497
+ },
498
+ rounded: {
499
+ type: [
500
+ Boolean,
501
+ Number,
502
+ String,
503
+ null
504
+ ],
505
+ required: false,
506
+ skipCheck: true
507
+ },
508
+ roundedTopRight: {
509
+ type: [
510
+ Boolean,
511
+ Number,
512
+ String
513
+ ],
514
+ required: false
515
+ },
516
+ roundedTopLeft: {
517
+ type: [
518
+ Boolean,
519
+ Number,
520
+ String
521
+ ],
522
+ required: false
523
+ },
524
+ roundedBottomLeft: {
525
+ type: [
526
+ Boolean,
527
+ Number,
528
+ String
529
+ ],
530
+ required: false
531
+ },
532
+ roundedBottomRight: {
533
+ type: [
534
+ Boolean,
535
+ Number,
536
+ String
537
+ ],
538
+ required: false
539
+ },
540
+ roundedStartStart: {
541
+ type: [
542
+ Boolean,
543
+ Number,
544
+ String
545
+ ],
546
+ required: false
547
+ },
548
+ roundedStartEnd: {
549
+ type: [
550
+ Boolean,
551
+ Number,
552
+ String
553
+ ],
554
+ required: false
555
+ },
556
+ roundedEndStart: {
557
+ type: [
558
+ Boolean,
559
+ Number,
560
+ String
561
+ ],
562
+ required: false
563
+ },
564
+ roundedEndEnd: {
565
+ type: [
566
+ Boolean,
567
+ Number,
568
+ String
569
+ ],
570
+ required: false
571
+ },
572
+ elevation: {
573
+ type: [Number, String],
574
+ required: false
575
+ },
576
+ bgColor: {
577
+ type: [
578
+ String,
579
+ Object,
580
+ Boolean,
581
+ null
582
+ ],
583
+ required: false,
584
+ skipCheck: true
585
+ },
586
+ fontSize: {
587
+ type: null,
588
+ required: false
589
+ },
590
+ fontWeight: {
591
+ type: null,
592
+ required: false
593
+ }
245
594
  });
246
595
  const emit = defineEmits(["point-click"]);
247
596
  const { t } = useLocale();
@@ -251,276 +600,370 @@ const { elevationClasses, elevationStyles } = useElevation(props);
251
600
  const { marginClasses, marginStyles } = useMargin(props);
252
601
  const { paddingClasses, paddingStyles } = usePadding(props);
253
602
  const { roundedClasses, roundedStyles } = useRounded(props);
603
+ /*********************************************************
604
+ * Measured SVG coordinate space — viewBox follows the rendered box
605
+ * (useChartSize), 1 unit = 1 px, so strokes and markers are not
606
+ * stretched. 120x30 is the pre-measure fallback.
607
+ ********************************************************/
254
608
  const { resizeRef: svgRef, width: svgWidth, height: svgHeight } = useChartSize(CHART_SIZE_FALLBACK.sparkline);
255
609
  const { onKeydown: onChartKeydown } = useChartRoving(svgRef);
256
610
  const PADDING_X = 2;
257
611
  const PADDING_Y = 2;
612
+ /*********************************************************
613
+ * Data extraction — first series, numeric values only.
614
+ ********************************************************/
258
615
  const activeSeries = computed(() => props.series?.[0] ?? null);
259
616
  const values = computed(() => {
260
- const s = activeSeries.value;
261
- if (!s?.data?.length) return [];
262
- return s.data.map(
263
- (d) => typeof d === "number" ? d : d.y
264
- ).filter((v) => Number.isFinite(v));
617
+ const s = activeSeries.value;
618
+ if (!s?.data?.length) return [];
619
+ return s.data.map((d) => typeof d === "number" ? d : d.y).filter((v) => Number.isFinite(v));
265
620
  });
266
621
  const showEmpty = computed(() => values.value.length === 0);
622
+ /*********************************************************
623
+ * Colour resolution — intent token or raw CSS.
624
+ ********************************************************/
267
625
  const resolveColor = (raw) => {
268
- if (isIntent(raw)) return intentBgExpr(raw, "default");
269
- if (/^(#|rgb|hsl|var|currentColor|transparent)/i.test(raw)) return raw;
270
- return "currentColor";
626
+ if (isIntent(raw)) return intentBgExpr(raw, "default");
627
+ if (/^(#|rgb|hsl|var|currentColor|transparent)/i.test(raw)) return raw;
628
+ return "currentColor";
271
629
  };
272
630
  const resolvedColor = computed(() => resolveColor(props.color));
273
631
  const MIN_COLOR = "var(--origam-color__feedback--danger---bg, #ef4444)";
274
632
  const MAX_COLOR = "var(--origam-color__feedback--success---bg, #22c55e)";
633
+ /*********************************************************
634
+ * Scale helpers — map data values to SVG coordinates.
635
+ ********************************************************/
275
636
  const plotX0 = PADDING_X;
276
637
  const plotX1 = computed(() => svgWidth.value - PADDING_X);
277
638
  const plotY0 = PADDING_Y;
278
639
  const plotY1 = computed(() => svgHeight.value - PADDING_Y);
279
640
  const dataMin = computed(() => {
280
- if (!values.value.length) return 0;
281
- return Math.min(...values.value);
641
+ if (!values.value.length) return 0;
642
+ return Math.min(...values.value);
282
643
  });
283
644
  const dataMax = computed(() => {
284
- if (!values.value.length) return 1;
285
- return Math.max(...values.value);
645
+ if (!values.value.length) return 1;
646
+ return Math.max(...values.value);
286
647
  });
287
648
  const scaleX = computed(() => {
288
- const n = values.value.length;
289
- if (n < 2) return (_i) => (plotX0 + plotX1.value) / 2;
290
- return (i) => plotX0 + i / (n - 1) * (plotX1.value - plotX0);
649
+ const n = values.value.length;
650
+ if (n < 2) return (_i) => (plotX0 + plotX1.value) / 2;
651
+ return (i) => plotX0 + i / (n - 1) * (plotX1.value - plotX0);
291
652
  });
292
653
  const scaleY = computed(() => {
293
- const min = dataMin.value;
294
- const max = dataMax.value;
295
- const range = max - min || 1;
296
- return (v) => plotY1.value - (v - min) / range * (plotY1.value - plotY0);
654
+ const min = dataMin.value;
655
+ const max = dataMax.value;
656
+ const range = max - min || 1;
657
+ return (v) => plotY1.value - (v - min) / range * (plotY1.value - plotY0);
297
658
  });
298
- const points = computed(
299
- () => values.value.map((v, i) => ({
300
- cx: scaleX.value(i),
301
- cy: scaleY.value(v),
302
- index: i,
303
- value: v
304
- }))
305
- );
659
+ /*********************************************************
660
+ * Point coordinates — array of {cx, cy, index}.
661
+ ********************************************************/
662
+ const points = computed(() => values.value.map((v, i) => ({
663
+ cx: scaleX.value(i),
664
+ cy: scaleY.value(v),
665
+ index: i,
666
+ value: v
667
+ })));
668
+ /*********************************************************
669
+ * Line / area paths — built from the point list.
670
+ ********************************************************/
306
671
  const linePath = computed(() => {
307
- const pts = points.value;
308
- if (pts.length < 2) return null;
309
- const d = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.cx} ${p.cy}`).join(" ");
310
- return d;
672
+ const pts = points.value;
673
+ if (pts.length < 2) return null;
674
+ const d = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.cx} ${p.cy}`).join(" ");
675
+ return d;
311
676
  });
312
677
  const areaPath = computed(() => {
313
- const pts = points.value;
314
- if (pts.length < 2) return null;
315
- const line = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.cx} ${p.cy}`).join(" ");
316
- const close = `L ${pts[pts.length - 1].cx} ${plotY1.value} L ${pts[0].cx} ${plotY1.value} Z`;
317
- return `${line} ${close}`;
678
+ const pts = points.value;
679
+ if (pts.length < 2) return null;
680
+ const line = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.cx} ${p.cy}`).join(" ");
681
+ const close = `L ${pts[pts.length - 1].cx} ${plotY1.value} L ${pts[0].cx} ${plotY1.value} Z`;
682
+ return `${line} ${close}`;
318
683
  });
684
+ /*********************************************************
685
+ * Regular markers — shown when showMarkers is true.
686
+ ********************************************************/
319
687
  const markerPoints = computed(() => {
320
- if (!props.showMarkers) return [];
321
- return points.value;
688
+ if (!props.showMarkers) return [];
689
+ return points.value;
322
690
  });
691
+ /*********************************************************
692
+ * Column bars — vertical rectangles for `type === 'column'`.
693
+ ********************************************************/
323
694
  const columnBars = computed(() => {
324
- const pts = points.value;
325
- if (!pts.length) return [];
326
- const n = pts.length;
327
- const totalW = plotX1.value - plotX0;
328
- const barW = Math.max(1, totalW / n * 0.7);
329
- const gap = totalW / n;
330
- const min = dataMin.value;
331
- const max = dataMax.value;
332
- const range = max - min || 1;
333
- return pts.map((p, i) => {
334
- const barH = Math.max(1, (p.value - min) / range * (plotY1.value - plotY0));
335
- const x = plotX0 + i * gap + (gap - barW) / 2;
336
- const y = plotY1.value - barH;
337
- return { index: i, x, y, width: barW, height: barH };
338
- });
695
+ const pts = points.value;
696
+ if (!pts.length) return [];
697
+ const n = pts.length;
698
+ const totalW = plotX1.value - plotX0;
699
+ const barW = Math.max(1, totalW / n * .7);
700
+ const gap = totalW / n;
701
+ const min = dataMin.value;
702
+ const max = dataMax.value;
703
+ const range = max - min || 1;
704
+ return pts.map((p, i) => {
705
+ const barH = Math.max(1, (p.value - min) / range * (plotY1.value - plotY0));
706
+ const x = plotX0 + i * gap + (gap - barW) / 2;
707
+ const y = plotY1.value - barH;
708
+ return {
709
+ index: i,
710
+ x,
711
+ y,
712
+ width: barW,
713
+ height: barH
714
+ };
715
+ });
339
716
  });
717
+ /*********************************************************
718
+ * Horizontal bars — for `type === 'bar'`.
719
+ ********************************************************/
340
720
  const horizontalBars = computed(() => {
341
- const n = values.value.length;
342
- if (!n) return [];
343
- const totalH = plotY1.value - plotY0;
344
- const barH = Math.max(1, totalH / n * 0.7);
345
- const gap = totalH / n;
346
- const min = dataMin.value;
347
- const max = dataMax.value;
348
- const range = max - min || 1;
349
- return values.value.map((v, i) => {
350
- const barW = Math.max(1, (v - min) / range * (plotX1.value - plotX0));
351
- const y = plotY0 + i * gap + (gap - barH) / 2;
352
- return { index: i, x: plotX0, y, width: barW, height: barH };
353
- });
721
+ const n = values.value.length;
722
+ if (!n) return [];
723
+ const totalH = plotY1.value - plotY0;
724
+ const barH = Math.max(1, totalH / n * .7);
725
+ const gap = totalH / n;
726
+ const min = dataMin.value;
727
+ const max = dataMax.value;
728
+ const range = max - min || 1;
729
+ return values.value.map((v, i) => {
730
+ const barW = Math.max(1, (v - min) / range * (plotX1.value - plotX0));
731
+ const y = plotY0 + i * gap + (gap - barH) / 2;
732
+ return {
733
+ index: i,
734
+ x: plotX0,
735
+ y,
736
+ width: barW,
737
+ height: barH
738
+ };
739
+ });
354
740
  });
741
+ /*********************************************************
742
+ * Special markers — min, max, last.
743
+ ********************************************************/
355
744
  const minIndex = computed(() => {
356
- const vs = values.value;
357
- if (!vs.length) return -1;
358
- let idx = 0;
359
- for (let i = 1; i < vs.length; i++) {
360
- if (vs[i] < vs[idx]) idx = i;
361
- }
362
- return idx;
745
+ const vs = values.value;
746
+ if (!vs.length) return -1;
747
+ let idx = 0;
748
+ for (let i = 1; i < vs.length; i++) {
749
+ if (vs[i] < vs[idx]) idx = i;
750
+ }
751
+ return idx;
363
752
  });
364
753
  const maxIndex = computed(() => {
365
- const vs = values.value;
366
- if (!vs.length) return -1;
367
- let idx = 0;
368
- for (let i = 1; i < vs.length; i++) {
369
- if (vs[i] > vs[idx]) idx = i;
370
- }
371
- return idx;
754
+ const vs = values.value;
755
+ if (!vs.length) return -1;
756
+ let idx = 0;
757
+ for (let i = 1; i < vs.length; i++) {
758
+ if (vs[i] > vs[idx]) idx = i;
759
+ }
760
+ return idx;
372
761
  });
373
762
  const specialMarkers = computed(() => {
374
- const pts = points.value;
375
- if (!pts.length) return [];
376
- const result = [];
377
- const r = props.markerSize;
378
- if (props.showMin && minIndex.value >= 0) {
379
- const p = pts[minIndex.value];
380
- result.push({ cx: p.cx, cy: p.cy, r, fill: MIN_COLOR, role: "min", dataIndex: minIndex.value });
381
- }
382
- if (props.showMax && maxIndex.value >= 0) {
383
- const p = pts[maxIndex.value];
384
- result.push({ cx: p.cx, cy: p.cy, r, fill: MAX_COLOR, role: "max", dataIndex: maxIndex.value });
385
- }
386
- if (props.showLast && pts.length > 0) {
387
- const last = pts[pts.length - 1];
388
- const lastIdx = pts.length - 1;
389
- const alreadyMarked = result.some((m) => m.dataIndex === lastIdx);
390
- if (!alreadyMarked) {
391
- result.push({ cx: last.cx, cy: last.cy, r, fill: resolvedColor.value, role: "last", dataIndex: lastIdx });
392
- }
393
- }
394
- return result;
763
+ const pts = points.value;
764
+ if (!pts.length) return [];
765
+ const result = [];
766
+ const r = props.markerSize;
767
+ if (props.showMin && minIndex.value >= 0) {
768
+ const p = pts[minIndex.value];
769
+ result.push({
770
+ cx: p.cx,
771
+ cy: p.cy,
772
+ r,
773
+ fill: MIN_COLOR,
774
+ role: "min",
775
+ dataIndex: minIndex.value
776
+ });
777
+ }
778
+ if (props.showMax && maxIndex.value >= 0) {
779
+ const p = pts[maxIndex.value];
780
+ result.push({
781
+ cx: p.cx,
782
+ cy: p.cy,
783
+ r,
784
+ fill: MAX_COLOR,
785
+ role: "max",
786
+ dataIndex: maxIndex.value
787
+ });
788
+ }
789
+ if (props.showLast && pts.length > 0) {
790
+ const last = pts[pts.length - 1];
791
+ const lastIdx = pts.length - 1;
792
+ const alreadyMarked = result.some((m) => m.dataIndex === lastIdx);
793
+ if (!alreadyMarked) {
794
+ result.push({
795
+ cx: last.cx,
796
+ cy: last.cy,
797
+ r,
798
+ fill: resolvedColor.value,
799
+ role: "last",
800
+ dataIndex: lastIdx
801
+ });
802
+ }
803
+ }
804
+ return result;
805
+ });
806
+ /*********************************************************
807
+ * Tooltip hover state.
808
+ ********************************************************/
809
+ const mousePos = ref({
810
+ x: 0,
811
+ y: 0
395
812
  });
396
- const mousePos = ref({ x: 0, y: 0 });
397
813
  const hoveredIndex = ref(null);
398
814
  const pointAt = (index) => {
399
- if (!activeSeries.value) return null;
400
- const v = values.value[index];
401
- if (v === void 0) return null;
402
- return {
403
- seriesIndex: 0,
404
- seriesName: activeSeries.value.name,
405
- dataIndex: index,
406
- x: index,
407
- y: v,
408
- color: resolvedColor.value
409
- };
815
+ if (!activeSeries.value) return null;
816
+ const v = values.value[index];
817
+ if (v === undefined) return null;
818
+ return {
819
+ seriesIndex: 0,
820
+ seriesName: activeSeries.value.name,
821
+ dataIndex: index,
822
+ x: index,
823
+ y: v,
824
+ color: resolvedColor.value
825
+ };
410
826
  };
411
827
  const tooltipPoint = computed(() => {
412
- if (hoveredIndex.value === null) return null;
413
- return pointAt(hoveredIndex.value);
828
+ if (hoveredIndex.value === null) return null;
829
+ return pointAt(hoveredIndex.value);
414
830
  });
415
831
  const tooltipStyle = computed(() => ({
416
- left: `${mousePos.value.x + 8}px`,
417
- top: `${mousePos.value.y - 28}px`
832
+ left: `${mousePos.value.x + 8}px`,
833
+ top: `${mousePos.value.y - 28}px`
418
834
  }));
835
+ /*********************************************************
836
+ * nearestIndexFromEvent
837
+ *
838
+ * @description
839
+ * Nearest data-point index for a mouse position on the SVG — shared
840
+ * by hover (tooltip) and click (`point-click`) so both agree on
841
+ * which point the pointer is over.
842
+ ********************************************************/
419
843
  const nearestIndexFromEvent = (event) => {
420
- const target = svgRef.value;
421
- if (!target) return null;
422
- const n = values.value.length;
423
- if (!n) return null;
424
- const rect = target.getBoundingClientRect();
425
- const relX = event.clientX - rect.left;
426
- const ratio = relX / rect.width;
427
- return Math.min(n - 1, Math.max(0, Math.round(ratio * (n - 1))));
844
+ const target = svgRef.value;
845
+ if (!target) return null;
846
+ const n = values.value.length;
847
+ if (!n) return null;
848
+ const rect = target.getBoundingClientRect();
849
+ const relX = event.clientX - rect.left;
850
+ const ratio = relX / rect.width;
851
+ return Math.min(n - 1, Math.max(0, Math.round(ratio * (n - 1))));
428
852
  };
429
853
  const onSvgMouseMove = (event) => {
430
- if (!props.showTooltip) return;
431
- const target = svgRef.value;
432
- if (!target) return;
433
- const rect = target.getBoundingClientRect();
434
- mousePos.value = { x: event.clientX - rect.left, y: event.clientY - rect.top };
435
- hoveredIndex.value = nearestIndexFromEvent(event);
854
+ if (!props.showTooltip) return;
855
+ const target = svgRef.value;
856
+ if (!target) return;
857
+ const rect = target.getBoundingClientRect();
858
+ mousePos.value = {
859
+ x: event.clientX - rect.left,
860
+ y: event.clientY - rect.top
861
+ };
862
+ hoveredIndex.value = nearestIndexFromEvent(event);
436
863
  };
437
864
  const onSvgMouseLeave = () => {
438
- hoveredIndex.value = null;
865
+ hoveredIndex.value = null;
439
866
  };
867
+ /*********************************************************
868
+ * `point-click` — mouse / keyboard activation on a data point.
869
+ * Individually-rendered marks (markers, special min/max/last,
870
+ * bars) carry their own click/keydown handlers (see template);
871
+ * clicking anywhere else on the SVG falls back to the nearest
872
+ * point, so `line`/`area` sparklines without visible markers stay
873
+ * clickable too.
874
+ ********************************************************/
440
875
  const onPointClick = (index, event) => {
441
- const point = pointAt(index);
442
- if (!point) return;
443
- emit("point-click", point, event);
876
+ const point = pointAt(index);
877
+ if (!point) return;
878
+ emit("point-click", point, event);
444
879
  };
445
880
  const onSvgClick = (event) => {
446
- const idx = nearestIndexFromEvent(event);
447
- if (idx === null) return;
448
- onPointClick(idx, event);
881
+ const idx = nearestIndexFromEvent(event);
882
+ if (idx === null) return;
883
+ onPointClick(idx, event);
449
884
  };
885
+ /*********************************************************
886
+ * pointAriaLabel
887
+ *
888
+ * @description
889
+ * ⛔ issue #781 — the accessible name of each `role="button"` mark.
890
+ * `IChartSeries.name` is typed `string`, but nothing enforces it at
891
+ * RUNTIME: a JavaScript consumer omitting it, or passing `''`, produced
892
+ * a label starting on a dangling separator — measured on `develop`,
893
+ * `aria-label=", 0: 1"`, read aloud as "comma zero colon one, button".
894
+ * The mark stayed focusable and operable, so this is a name-quality
895
+ * defect, not the unnameable-role defect of #747 / #660 / #653: index
896
+ * and value are ALWAYS available here, so the DS can always name these
897
+ * marks. It just has to stop emitting the separator of an absent part.
898
+ ********************************************************/
450
899
  const pointAriaLabel = (index) => {
451
- const point = pointAt(index);
452
- if (!point) return "";
453
- const seriesName = point.seriesName?.trim();
454
- const value = `${index}: ${point.y}`;
455
- return seriesName ? `${seriesName}, ${value}` : value;
900
+ const point = pointAt(index);
901
+ if (!point) return "";
902
+ const seriesName = point.seriesName?.trim();
903
+ const value = `${index}: ${point.y}`;
904
+ return seriesName ? `${seriesName}, ${value}` : value;
456
905
  };
906
+ /*********************************************************
907
+ * Root classes / styles.
908
+ ********************************************************/
457
909
  const rootClasses = computed(() => [
458
- {
459
- [`origam-chart-sparkline--${props.type}`]: true,
460
- "origam-chart-sparkline--empty": showEmpty.value
461
- },
462
- backgroundColorClasses.value,
463
- elevationClasses.value,
464
- marginClasses.value,
465
- paddingClasses.value,
466
- roundedClasses.value,
467
- props.class
910
+ {
911
+ [`origam-chart-sparkline--${props.type}`]: true,
912
+ "origam-chart-sparkline--empty": showEmpty.value
913
+ },
914
+ backgroundColorClasses.value,
915
+ elevationClasses.value,
916
+ marginClasses.value,
917
+ paddingClasses.value,
918
+ roundedClasses.value,
919
+ props.class
468
920
  ]);
469
921
  const { dimensionStyles } = useDimension(props);
470
- useUnsupportedProp(
471
- "OrigamChartSparkline",
472
- "categories",
473
- "a sparkline is a bare trend line: it draws no axis and no labels.",
474
- () => props.categories !== void 0
475
- );
476
- useUnsupportedProp(
477
- "OrigamChartSparkline",
478
- "animated",
479
- "no animation is ever emitted \u2014 neither a CSS class nor an inline `animation` declaration.",
480
- () => props.animated === true
481
- );
482
- useUnsupportedProp(
483
- "OrigamChartSparkline",
484
- "animationDuration",
485
- "nothing is animated, so there is no duration to apply.",
486
- () => props.animationDuration !== void 0 && props.animationDuration !== 600
487
- );
488
- useUnsupportedProp(
489
- "OrigamChartSparkline",
490
- "aspectRatio",
491
- "the root sizes itself from `width` / `height`; no `aspect-ratio` declaration is emitted.",
492
- () => props.aspectRatio !== void 0
493
- );
494
- useUnsupportedProp(
495
- "OrigamChartSparkline",
496
- "fontSize",
497
- "a sparkline renders no text at all.",
498
- () => props.fontSize !== void 0
499
- );
500
- useUnsupportedProp(
501
- "OrigamChartSparkline",
502
- "fontWeight",
503
- "a sparkline renders no text at all.",
504
- () => props.fontWeight !== void 0
505
- );
506
- useUnsupportedProp(
507
- "OrigamChartSparkline",
508
- "subtitle",
509
- "a sparkline renders no header \u2014 neither title nor subtitle.",
510
- () => props.subtitle !== void 0
511
- );
922
+ /*********************************************************
923
+ * Props heritees sans effet ici (#426)
924
+ *
925
+ * @description
926
+ * ⛔ Ces props sont declarees par `IChartBaseProps` et n'ont aucun
927
+ * effet sur ce composant. Elles ne sont ni retirees ni cablees a un
928
+ * comportement fictif : elles avertissent une fois, en dev, avec la
929
+ * raison exacte. Meme traitement que `OrigamChartGauge`.
930
+ ********************************************************/
931
+ useUnsupportedProp("OrigamChartSparkline", "categories", "a sparkline is a bare trend line: it draws no axis and no labels.", () => props.categories !== undefined);
932
+ useUnsupportedProp("OrigamChartSparkline", "animated", "no animation is ever emitted — neither a CSS class nor an inline `animation` declaration.", () => props.animated === true);
933
+ useUnsupportedProp("OrigamChartSparkline", "animationDuration", "nothing is animated, so there is no duration to apply.", () => props.animationDuration !== undefined && props.animationDuration !== 600);
934
+ useUnsupportedProp("OrigamChartSparkline", "aspectRatio", "the root sizes itself from `width` / `height`; no `aspect-ratio` declaration is emitted.", () => props.aspectRatio !== undefined);
935
+ useUnsupportedProp("OrigamChartSparkline", "fontSize", "a sparkline renders no text at all.", () => props.fontSize !== undefined);
936
+ useUnsupportedProp("OrigamChartSparkline", "fontWeight", "a sparkline renders no text at all.", () => props.fontWeight !== undefined);
937
+ useUnsupportedProp("OrigamChartSparkline", "subtitle", "a sparkline renders no header — neither title nor subtitle.", () => props.subtitle !== undefined);
938
+ /*********************************************************
939
+ * rootStyles
940
+ *
941
+ * @description
942
+ * ⛔ Ce bloc convertissait `width` / `height` a la main — et ignorait les
943
+ * cinq autres props de dimension qu'`IDimensionProps` declare. Un
944
+ * consommateur passant `maxHeight` ne voyait rien se produire, sans
945
+ * avertissement : la « half-implemented surface » que le CLAUDE.md du
946
+ * projet decrit nommement.
947
+ *
948
+ * @description
949
+ * `useDimension` couvre les sept, et son `convertToUnit` gere des cas
950
+ * qu'un convertisseur maison finit toujours par manquer : nombres,
951
+ * longueurs CSS, references a une propriete personnalisee, raccourcis
952
+ * d'`aspect-ratio`.
953
+ ********************************************************/
512
954
  const rootStyles = computed(() => [
513
- dimensionStyles.value,
514
- { display: "inline-block" },
515
- props.style
955
+ dimensionStyles.value,
956
+ { display: "inline-block" },
957
+ props.style
516
958
  ]);
959
+ /*********************************************************
960
+ * ARIA.
961
+ ********************************************************/
517
962
  const defaultAriaLabel = computed(() => t(`origam.chart.sparkline.aria_label_${props.type}`));
518
963
  const ariaLabel = computed(() => props.title ?? defaultAriaLabel.value);
519
964
  const svgAriaLabel = computed(() => props.title ?? defaultAriaLabel.value);
520
965
  const svgTitle = computed(() => props.title ?? defaultAriaLabel.value);
521
- const svgDesc = computed(
522
- () => t("origam.chart.sparkline.desc", values.value.length, { chart: defaultAriaLabel.value })
523
- );
966
+ const svgDesc = computed(() => t("origam.chart.sparkline.desc", values.value.length, { chart: defaultAriaLabel.value }));
524
967
  </script>
525
968
 
526
969
  <style lang="scss" scoped>