@dataloop-ai/components 0.18.0 → 0.18.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 (277) hide show
  1. package/package.json +6 -3
  2. package/src/App.vue +5 -227
  3. package/src/assets/constants.scss +2 -1
  4. package/src/assets/globals.scss +21 -0
  5. package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
  6. package/src/components/basic/DlAccordion/components/AccordionHeader.vue +2 -1
  7. package/src/components/basic/DlAvatar/DlAvatar.vue +1 -1
  8. package/src/components/basic/DlButton/DlButton.vue +115 -25
  9. package/src/components/basic/DlButton/utils.ts +45 -2
  10. package/src/components/basic/DlChip/DlChip.vue +3 -7
  11. package/src/components/basic/DlChip/utils.ts +4 -4
  12. package/src/components/basic/DlContainer/DlContainer.vue +70 -0
  13. package/src/components/basic/DlContainer/index.ts +3 -0
  14. package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
  15. package/src/components/basic/DlEmptyState/index.ts +2 -0
  16. package/src/components/basic/DlEmptyState/types.ts +20 -0
  17. package/src/components/basic/DlGrid/DlGrid.vue +163 -0
  18. package/src/components/basic/DlGrid/index.ts +4 -0
  19. package/src/components/basic/DlGrid/types.ts +5 -0
  20. package/src/components/basic/DlKpi/components/KpiInfo.vue +2 -1
  21. package/src/components/basic/DlListItem/DlListItem.vue +96 -66
  22. package/src/components/basic/DlListItem/utils.ts +0 -3
  23. package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +37 -13
  24. package/src/components/basic/DlPopup/DlPopup.vue +58 -11
  25. package/src/components/basic/DlPopup/components/PopupHeader.vue +11 -6
  26. package/src/components/basic/DlProgressChart/DlProgressChart.vue +2 -1
  27. package/src/components/basic/DlWidget/DlWidget.vue +273 -141
  28. package/src/components/basic/DlWidget/index.ts +1 -3
  29. package/src/components/basic/DlWidget/utils.ts +90 -8
  30. package/src/components/basic/index.ts +4 -2
  31. package/src/components/basic/types.ts +2 -0
  32. package/src/components/compound/DlCard/DlCard.vue +796 -0
  33. package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
  34. package/src/components/compound/DlCard/types.ts +38 -0
  35. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +39 -4
  36. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +128 -36
  37. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +167 -87
  38. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +2 -1
  39. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +44 -3
  40. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChartWidget.vue +1 -2
  41. package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +9 -18
  42. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +48 -9
  43. package/src/components/compound/DlCharts/charts/DlScatterChart/DlScatterChart.vue +667 -0
  44. package/src/components/compound/DlCharts/charts/DlScatterChart/index.ts +2 -0
  45. package/src/components/compound/DlCharts/charts/index.ts +1 -0
  46. package/src/components/compound/DlCharts/components/DlBrush.vue +3 -2
  47. package/src/components/compound/DlCharts/components/DlChartLabels.vue +2 -1
  48. package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +1 -0
  49. package/src/components/compound/DlCharts/types/props.ts +5 -1
  50. package/src/components/compound/DlCharts/utils.ts +1 -1
  51. package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +173 -0
  52. package/src/components/compound/DlCodeEditor/README.md +11 -0
  53. package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
  54. package/src/components/compound/DlCodeEditor/index.ts +3 -0
  55. package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
  56. package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
  57. package/src/components/compound/DlCodeEditor/types.ts +21 -0
  58. package/src/components/compound/DlDateTime/DlDatePicker/DlDatePicker.vue +9 -1
  59. package/src/components/compound/DlDateTime/DlDatePicker/components/DlCalendar.vue +4 -2
  60. package/src/components/compound/DlDateTime/DlDatePicker/components/DlMonthCalendar.vue +2 -1
  61. package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
  62. package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +18 -9
  63. package/src/components/compound/DlDateTime/DlTimePicker/DlTimePicker.vue +2 -2
  64. package/src/components/compound/DlDialogBox/DlDialogBox.vue +74 -15
  65. package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -1
  66. package/src/components/compound/DlDialogBox/components/DlDialogBoxHeader.vue +9 -7
  67. package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +13 -4
  68. package/src/components/compound/DlInput/DlInput.vue +80 -17
  69. package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +42 -219
  70. package/src/components/compound/DlOptionGroup/DlOptionGroup.vue +16 -17
  71. package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
  72. package/src/components/compound/DlPagination/DlPagination.vue +1 -1
  73. package/src/components/compound/DlPagination/components/PaginationLegend.vue +0 -2
  74. package/src/components/compound/DlPagination/components/RowsSelector.vue +0 -2
  75. package/src/components/compound/DlRange/DlRange.vue +3 -2
  76. package/src/components/compound/DlSearches/DlSearch/DlSearch.vue +12 -5
  77. package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +413 -97
  78. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchFilters.vue +4 -1
  79. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +100 -39
  80. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +12 -7
  81. package/src/components/compound/DlSearches/DlSmartSearch/components/FiltersQuery.vue +5 -6
  82. package/src/components/compound/DlSearches/DlSmartSearch/types.ts +14 -0
  83. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
  84. package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +172 -48
  85. package/src/components/compound/DlSelect/DlSelect.vue +264 -130
  86. package/src/components/compound/DlSelect/utils.ts +4 -1
  87. package/src/components/compound/DlSlider/DlSlider.vue +10 -2
  88. package/src/components/compound/DlSlider/components/DlSliderBase.vue +3 -3
  89. package/src/components/compound/DlSlider/components/DlSliderInput.vue +17 -26
  90. package/src/components/compound/DlSlider/sliderStyles.scss +5 -1
  91. package/src/components/compound/DlSlider/useSlider.ts +2 -2
  92. package/src/components/compound/DlSlider/utils.ts +2 -2
  93. package/src/components/compound/DlStepper/DlStepper.vue +46 -4
  94. package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
  95. package/src/components/compound/DlStepper/components/DlStepperFooter.vue +12 -0
  96. package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +24 -11
  97. package/src/components/compound/DlStepper/models/Step.ts +37 -8
  98. package/src/components/compound/DlStepper/models/Stepper.ts +108 -15
  99. package/src/components/compound/DlStepper/models/interfaces.ts +2 -1
  100. package/src/components/compound/DlTable/DlTable.vue +49 -14
  101. package/src/components/compound/DlTable/components/DlTd.vue +9 -9
  102. package/src/components/compound/DlTable/components/DlTh.vue +3 -2
  103. package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
  104. package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
  105. package/src/components/compound/DlTable/hooks/tablePagination.ts +18 -18
  106. package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
  107. package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
  108. package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
  109. package/src/components/compound/DlTable/styles/dl-table-styles.scss +8 -0
  110. package/src/components/compound/DlTabs/DlTabs.vue +83 -31
  111. package/src/components/compound/DlTabs/components/DlTab.vue +14 -4
  112. package/src/components/compound/DlTabs/components/TabsWrapper.vue +32 -27
  113. package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
  114. package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
  115. package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
  116. package/src/components/compound/DlToast/api/useToast.ts +42 -1
  117. package/src/components/compound/DlToast/components/ToastComponent.vue +24 -32
  118. package/src/components/compound/DlToast/types.ts +52 -0
  119. package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
  120. package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
  121. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
  122. package/src/components/compound/DlTreeTable/index.ts +3 -0
  123. package/src/components/compound/DlTreeTable/types.ts +1 -0
  124. package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
  125. package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
  126. package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
  127. package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
  128. package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
  129. package/src/components/compound/index.ts +14 -1
  130. package/src/components/compound/types.ts +2 -0
  131. package/src/components/essential/DlBadge/DlBadge.vue +3 -3
  132. package/src/components/essential/DlCheckbox/DlCheckbox.vue +10 -7
  133. package/src/components/essential/DlEllipsis/DlEllipsis.vue +141 -0
  134. package/src/components/essential/DlIcon/DlIcon.vue +5 -5
  135. package/src/components/essential/DlLabel/DlLabel.vue +190 -0
  136. package/src/components/essential/DlLabel/index.ts +2 -0
  137. package/src/components/essential/DlList/DlList.vue +3 -3
  138. package/src/components/essential/DlMenu/DlMenu.vue +41 -22
  139. package/src/components/essential/DlMenu/utils.ts +8 -7
  140. package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
  141. package/src/components/essential/DlPageLayout/index.ts +2 -0
  142. package/src/components/essential/DlProgressBar/DlProgressBar.vue +1 -1
  143. package/src/components/essential/DlRadio/DlRadio.vue +10 -5
  144. package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
  145. package/src/components/essential/DlSpinner/index.ts +1 -13
  146. package/src/components/essential/DlSpinner/styles/spinnerStyles.scss +7 -0
  147. package/src/components/essential/DlSwitch/DlSwitch.vue +6 -3
  148. package/src/components/essential/DlTextArea/DlTextArea.vue +212 -7
  149. package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
  150. package/src/components/essential/DlTypography/DlTypography.vue +7 -1
  151. package/src/components/essential/index.ts +3 -2
  152. package/src/components/shared/DlInfoErrorMessage/DlInfoErrorMessage.vue +1 -1
  153. package/src/components/{essential → shared}/DlTooltip/DlTooltip.vue +26 -19
  154. package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +106 -43
  155. package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +28 -4
  156. package/src/components/shared/index.ts +1 -0
  157. package/src/components/types.ts +2 -0
  158. package/src/demos/BarChartDemo.vue +59 -2
  159. package/src/demos/ColumnChartDemo.vue +67 -2
  160. package/src/demos/DlAccordionDemo.vue +92 -43
  161. package/src/demos/DlAlertDemo.vue +14 -0
  162. package/src/demos/DlButtonDemo.vue +41 -4
  163. package/src/demos/DlCardDemo.vue +156 -19
  164. package/src/demos/DlChartDoughnutDemo.vue +49 -2
  165. package/src/demos/DlCheckboxDemo.vue +28 -3
  166. package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
  167. package/src/demos/DlCodeEditor/index.ts +2 -0
  168. package/src/demos/DlConfusionMatrixDemo.vue +93 -37
  169. package/src/demos/DlDemoPage.vue +235 -0
  170. package/src/demos/DlDialogBoxDemo.vue +56 -51
  171. package/src/demos/DlDropdownButtonDemo.vue +35 -27
  172. package/src/demos/DlEmptyStateDemo.vue +81 -0
  173. package/src/demos/DlGridDemo.vue +40 -0
  174. package/src/demos/DlInputDemo.vue +21 -1
  175. package/src/demos/DlJsonEditorDemo.vue +59 -0
  176. package/src/demos/DlLabelDemo.vue +208 -0
  177. package/src/demos/DlLineChartDemo.vue +50 -2
  178. package/src/demos/DlListDemo.vue +12 -9
  179. package/src/demos/DlMenuDemo.vue +147 -20
  180. package/src/demos/DlPageLayoutDemo.vue +146 -0
  181. package/src/demos/DlPanelContainerDemo.vue +113 -2
  182. package/src/demos/DlPopupDemo.vue +82 -1
  183. package/src/demos/DlRadioDemo.vue +16 -1
  184. package/src/demos/DlScatterChartDemo.vue +161 -0
  185. package/src/demos/DlSearchDemo.vue +9 -0
  186. package/src/demos/DlSelectDemo.vue +124 -27
  187. package/src/demos/DlSpinnerDemo.vue +0 -2
  188. package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
  189. package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
  190. package/src/demos/DlStepperDemo/SimpleStepper.vue +4 -0
  191. package/src/demos/DlStepperDemo/steps/GeneralStep.vue +1 -0
  192. package/src/demos/DlSwitchDemo.vue +12 -0
  193. package/src/demos/DlTableDemo.vue +84 -5
  194. package/src/demos/DlTabsDemo.vue +92 -3
  195. package/src/demos/DlTextAreaDemo.vue +14 -17
  196. package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
  197. package/src/demos/DlToastDemo.vue +3 -9
  198. package/src/demos/DlTooltipDemo.vue +66 -2
  199. package/src/demos/DlTreeTableDemo.vue +694 -0
  200. package/src/demos/DlVirtualScrollDemo.vue +3 -12
  201. package/src/demos/DlWidgetDemo.vue +252 -61
  202. package/src/demos/SmartSearchDemo/DlSmartSearchDemo.vue +151 -32
  203. package/src/demos/index.ts +23 -4
  204. package/src/hooks/use-anchor.ts +15 -17
  205. package/src/hooks/use-arrow-navigation.ts +64 -21
  206. package/src/hooks/use-model-toggle.ts +14 -16
  207. package/src/hooks/use-portal.ts +9 -3
  208. package/src/hooks/use-scroll-target.ts +2 -4
  209. package/src/hooks/use-size-observer.ts +3 -2
  210. package/src/hooks/use-suggestions.ts +239 -49
  211. package/src/hooks/use-transition.ts +10 -4
  212. package/src/index.ts +22 -1
  213. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
  214. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
  215. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
  216. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
  217. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
  218. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
  219. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
  220. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
  221. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
  222. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
  223. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
  224. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
  225. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
  226. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
  227. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
  228. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
  229. package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
  230. package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
  231. package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
  232. package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
  233. package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
  234. package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
  235. package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
  236. package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
  237. package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
  238. package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
  239. package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
  240. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
  241. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
  242. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
  243. package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
  244. package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
  245. package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
  246. package/src/layouts/DlStudioLayout/index.ts +2 -0
  247. package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
  248. package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
  249. package/src/simple-code-editor.d.ts +1 -0
  250. package/src/utils/click-outside.ts +1 -1
  251. package/src/utils/dom.ts +5 -5
  252. package/src/utils/events.ts +3 -3
  253. package/src/utils/global-nodes.ts +2 -2
  254. package/src/utils/input-sizes.ts +5 -2
  255. package/src/utils/is-ellipsis-active.ts +4 -1
  256. package/src/utils/parse-smart-query.ts +209 -111
  257. package/src/utils/portal.ts +5 -5
  258. package/src/utils/position-engine.ts +7 -7
  259. package/src/utils/render.ts +1 -1
  260. package/src/utils/scroll.ts +2 -2
  261. package/src/utils/selection.ts +3 -3
  262. package/vite.config.ts +9 -1
  263. package/src/components/basic/DlCard/DlCard.vue +0 -241
  264. package/src/components/basic/DlCard/types.ts +0 -20
  265. package/src/components/basic/DlEllipsis/DlEllipsis.vue +0 -114
  266. package/src/components/basic/DlWidget/DlGrid.vue +0 -33
  267. package/src/components/basic/DlWidget/DlGridRow.vue +0 -32
  268. package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +0 -124
  269. package/src/components/compound/DlToast/utils/config.ts +0 -17
  270. package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -65
  271. package/src/components/essential/DlTextHolder/index.ts +0 -2
  272. package/src/demos/DlTextHolderDemo.vue +0 -42
  273. package/src/utils/swapNodes.ts +0 -30
  274. /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
  275. /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
  276. /package/src/components/{basic → essential}/DlEllipsis/index.ts +0 -0
  277. /package/src/components/{essential → shared}/DlTooltip/index.ts +0 -0
@@ -0,0 +1,268 @@
1
+ <template>
2
+ <div class="slider-wrapper">
3
+ <div
4
+ :style="imageContainerStyles"
5
+ class="slider"
6
+ >
7
+ <div class="slider__arrow">
8
+ <div
9
+ :class="getChevronClass('left')"
10
+ @mousedown="navigateBackward"
11
+ >
12
+ <dl-icon
13
+ color="--dl-color-darker"
14
+ size="24px"
15
+ icon="icon-dl-left-chevron"
16
+ :inline="false"
17
+ />
18
+ </div>
19
+ </div>
20
+
21
+ <div
22
+ ref="images"
23
+ class="slider__images"
24
+ >
25
+ <div
26
+ v-for="image in currentImages"
27
+ :key="image.src"
28
+ :class="getImageClass(image.src)"
29
+ :style="getImageOutline(image.src)"
30
+ @mousedown="handleThumbnailMousedown(image)"
31
+ >
32
+ <div class="slider__images--status">
33
+ <dl-icon
34
+ v-if="image.status"
35
+ size="16px"
36
+ color="dl-color-darker"
37
+ :icon="getStatusIcon(image.status)"
38
+ />
39
+ </div>
40
+ <img
41
+ :src="image.src"
42
+ @error="handleImageError"
43
+ >
44
+ <dl-tooltip>{{ image.name }}</dl-tooltip>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="slider__arrow">
49
+ <div
50
+ :class="getChevronClass('right')"
51
+ @mousedown="navigateForward"
52
+ >
53
+ <dl-icon
54
+ size="24px"
55
+ icon="icon-dl-right-chevron"
56
+ :inline="false"
57
+ />
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </template>
63
+
64
+ <script lang="ts">
65
+ import { defineComponent, PropType } from 'vue-demi'
66
+ import { DlIcon } from '../../essential'
67
+ import { DlTooltip } from '../../shared'
68
+ import { DlThumbnail, statusColors } from './types'
69
+
70
+ export default defineComponent({
71
+ components: {
72
+ DlIcon,
73
+ DlTooltip
74
+ },
75
+ model: {
76
+ prop: 'modelValue',
77
+ event: 'update:modelValue'
78
+ },
79
+ props: {
80
+ /**
81
+ * The currently selected image
82
+ */
83
+ modelValue: {
84
+ type: Object as PropType<DlThumbnail>,
85
+ default: null
86
+ },
87
+ /**
88
+ * The array of image objects to be contained in the gallery
89
+ */
90
+ images: {
91
+ type: Array as PropType<DlThumbnail[]>,
92
+ default: (): DlThumbnail[] => []
93
+ },
94
+ /**
95
+ * The number of thumbnails visible at once
96
+ */
97
+ visibleThumbnails: {
98
+ type: Number,
99
+ default: 10
100
+ },
101
+ /**
102
+ * The source of the image to be displayed when an image is unavailable
103
+ */
104
+ invalidImage: {
105
+ type: String,
106
+ default: null
107
+ },
108
+ /**
109
+ * The aspect ratio of the image inside each thumbnail. Available values: default, full and full-with-padding
110
+ */
111
+ aspectRatio: {
112
+ type: String,
113
+ default: 'default'
114
+ },
115
+ /**
116
+ * The opacity value of the white overlay on the thumbnails
117
+ */
118
+ overlayOpacity: {
119
+ type: Number,
120
+ default: 0.3
121
+ }
122
+ },
123
+ emits: ['update:modelValue', 'selected'],
124
+ data() {
125
+ return {
126
+ currentList: { first: 0, last: this.visibleThumbnails }
127
+ }
128
+ },
129
+ computed: {
130
+ imageContainerStyles(): object {
131
+ return {
132
+ '--thumbnail-size': `${100 / this.visibleThumbnails}%`,
133
+ '--img-object-fit':
134
+ this.aspectRatio === 'full' ||
135
+ this.aspectRatio === 'full-with-padding'
136
+ ? 'contain'
137
+ : '',
138
+ '--img-padding':
139
+ this.aspectRatio === 'full-with-padding' ? '5px' : '',
140
+ '--images-min-width': `${this.currentImages.length * 70}px`,
141
+ '--overlay-opacity': this.overlayOpacity
142
+ }
143
+ },
144
+ currentImages(): DlThumbnail[] {
145
+ return this.images.slice(
146
+ this.currentList.first,
147
+ this.currentList.last
148
+ )
149
+ }
150
+ },
151
+ methods: {
152
+ navigateForward() {
153
+ this.currentList.first += this.visibleThumbnails
154
+ this.currentList.last += this.visibleThumbnails
155
+ },
156
+ navigateBackward() {
157
+ this.currentList.first -= this.visibleThumbnails
158
+ this.currentList.last -= this.visibleThumbnails
159
+ },
160
+ handleImageError(e: ErrorEvent) {
161
+ (e.target as HTMLImageElement).src = this.invalidImage
162
+ },
163
+ getImageOutline(image: string) {
164
+ return {
165
+ outline:
166
+ image === this.modelValue?.src
167
+ ? '2px solid var(--dl-color-secondary)'
168
+ : '1px solid var(--dl-color-separator)'
169
+ }
170
+ },
171
+ getImageClass(image: string) {
172
+ return `slider__images--image ${
173
+ image !== this.modelValue?.src ? 'greyed-out' : ''
174
+ }`
175
+ },
176
+ getStatusIcon(status: string) {
177
+ return statusColors[status as keyof typeof statusColors]
178
+ },
179
+ getChevronClass(side: string) {
180
+ const isVisible =
181
+ side === 'left'
182
+ ? this.currentList.first > 0
183
+ : this.currentList.last <= this.images.length
184
+ return isVisible
185
+ ? 'slider__arrow--icon'
186
+ : 'slider__arrow--icon--invisible'
187
+ },
188
+ handleThumbnailMousedown(image: string) {
189
+ this.$emit('update:modelValue', image)
190
+ this.$emit('selected', image)
191
+ }
192
+ }
193
+ })
194
+ </script>
195
+
196
+ <style lang="scss" scoped>
197
+ .slider-wrapper {
198
+ display: flex;
199
+ flex-direction: column;
200
+ justify-content: flex-end;
201
+ width: 100%;
202
+ }
203
+ .slider {
204
+ display: flex;
205
+ justify-content: center;
206
+ width: 100%;
207
+ height: 65px;
208
+ &__arrow {
209
+ display: flex;
210
+ align-items: center;
211
+ &--icon {
212
+ cursor: pointer;
213
+ background-color: var(--dl-color-text-buttons);
214
+ border-radius: 50%;
215
+ &--invisible {
216
+ visibility: hidden;
217
+ cursor: default;
218
+ }
219
+ }
220
+ }
221
+ &__images {
222
+ display: flex;
223
+ justify-content: center;
224
+ min-width: var(--images-min-width);
225
+ height: 100%;
226
+ padding: 0px 10px;
227
+ &--image {
228
+ position: relative;
229
+ border-radius: 3px;
230
+ margin: 0px 5px;
231
+ width: var(--thumbnail-size);
232
+ max-width: 60px;
233
+ max-height: 60px;
234
+ transition: 0.1s;
235
+ &:hover {
236
+ transform: scale(1.1);
237
+ outline: 1px solid var(--dl-color-hover) !important;
238
+ }
239
+ cursor: pointer;
240
+ background-color: var(--dl-color-text-buttons);
241
+ padding: var(--img-padding);
242
+ }
243
+ &--image img {
244
+ pointer-events: none;
245
+ border-radius: 3px;
246
+ width: 100%;
247
+ height: 100%;
248
+ object-fit: var(--img-object-fit);
249
+ }
250
+ &--status {
251
+ position: absolute;
252
+ top: 0;
253
+ right: 4px;
254
+ }
255
+ }
256
+ }
257
+ .greyed-out::after {
258
+ content: '';
259
+ position: absolute;
260
+ width: 100%;
261
+ height: 100%;
262
+ top: 0;
263
+ left: 0;
264
+ background-color: #ffffff;
265
+ border-radius: 3px;
266
+ opacity: var(--overlay-opacity);
267
+ }
268
+ </style>
@@ -0,0 +1,2 @@
1
+ import DlThumbnailGallery from './DlThumbnailGallery.vue'
2
+ export { DlThumbnailGallery }
@@ -0,0 +1,11 @@
1
+ export interface DlThumbnail {
2
+ name: string
3
+ src: string
4
+ status: string
5
+ }
6
+
7
+ export const statusColors = {
8
+ approve: 'icon-dl-approve-filled',
9
+ discard: 'icon-dl-discard-filled',
10
+ issue: 'icon-dl-alert-filled'
11
+ }
@@ -2,6 +2,7 @@ import { isVue3 } from 'vue-demi'
2
2
  import toastComponent from '../components/ToastComponent.vue'
3
3
  import { createComponent } from '../utils/render'
4
4
  import { v4 } from 'uuid'
5
+ import { DlToastProps, DlToastTypes } from '../types'
5
6
 
6
7
  const state: { prevToastId: any; toasts: { [key: string]: any } } = {
7
8
  prevToastId: null,
@@ -10,7 +11,7 @@ const state: { prevToastId: any; toasts: { [key: string]: any } } = {
10
11
 
11
12
  export const useToast = (globalProps = {}) => {
12
13
  return {
13
- open(options: Object | string) {
14
+ open(options: DlToastProps | string) {
14
15
  let message = null
15
16
  if (typeof options === 'string') message = options
16
17
 
@@ -55,6 +56,46 @@ export const useToast = (globalProps = {}) => {
55
56
  propsData,
56
57
  document.body
57
58
  )
59
+ },
60
+ success(options: DlToastProps | string) {
61
+ let props: Partial<DlToastProps> = {}
62
+ if (typeof options === 'string') {
63
+ props.message = options
64
+ } else {
65
+ props = options
66
+ }
67
+
68
+ this.open({ ...props, type: DlToastTypes.SUCCESS } as DlToastProps)
69
+ },
70
+ error(options: DlToastProps | string) {
71
+ let props: Partial<DlToastProps> = {}
72
+ if (typeof options === 'string') {
73
+ props.message = options
74
+ } else {
75
+ props = options
76
+ }
77
+
78
+ this.open({ ...props, type: DlToastTypes.ERROR } as DlToastProps)
79
+ },
80
+ info(options: DlToastProps | string) {
81
+ let props: Partial<DlToastProps> = {}
82
+ if (typeof options === 'string') {
83
+ props.message = options
84
+ } else {
85
+ props = options
86
+ }
87
+
88
+ this.open({ ...props, type: DlToastTypes.INFO } as DlToastProps)
89
+ },
90
+ warn(options: DlToastProps | string) {
91
+ let props: Partial<DlToastProps> = {}
92
+ if (typeof options === 'string') {
93
+ props.message = options
94
+ } else {
95
+ props = options
96
+ }
97
+
98
+ this.open({ ...props, type: DlToastTypes.WARNING } as DlToastProps)
58
99
  }
59
100
  }
60
101
  }
@@ -8,11 +8,7 @@
8
8
  :id="`DlToastContainer-${uuid}`"
9
9
  ref="root"
10
10
  class="toast-item DlToastContainer"
11
- :class="[
12
- `toast-item--${type}`,
13
- `toast-item--${position}`,
14
- classItem
15
- ]"
11
+ :class="[`toast-item--${type}`, `toast-item--${position}`]"
16
12
  :style="{ width }"
17
13
  >
18
14
  <dl-alert
@@ -64,7 +60,7 @@ import {
64
60
  ref
65
61
  } from 'vue-demi'
66
62
  import { DlAlert, DlBadge } from '../../../'
67
- import { Positions, Types } from '../utils/config'
63
+ import { DlToastTypes, DlToastPositions } from '../types'
68
64
  import { removeElement } from '../utils/render'
69
65
  import { Animation } from '../types'
70
66
  import { v4 } from 'uuid'
@@ -79,15 +75,11 @@ export default defineComponent({
79
75
  },
80
76
  type: {
81
77
  type: String,
82
- default: 'success',
83
- validator(value: string): boolean {
84
- return Object.values(Types as unknown).includes(value)
78
+ required: true,
79
+ validator(value: DlToastTypes): boolean {
80
+ return Object.values(DlToastTypes).includes(value)
85
81
  }
86
82
  },
87
- classItem: {
88
- type: String,
89
- default: ''
90
- },
91
83
  width: {
92
84
  type: String,
93
85
  default: 'auto'
@@ -98,9 +90,9 @@ export default defineComponent({
98
90
  },
99
91
  position: {
100
92
  type: String,
101
- default: Positions.bottom,
102
- validator(value: string): boolean {
103
- return Object.values(Positions as unknown).includes(value)
93
+ default: DlToastPositions.BOTTOM,
94
+ validator(value: DlToastPositions): boolean {
95
+ return Object.values(DlToastPositions).includes(value)
104
96
  }
105
97
  },
106
98
  closable: {
@@ -151,14 +143,14 @@ export default defineComponent({
151
143
 
152
144
  const correctParent = computed(() => {
153
145
  switch (position) {
154
- case Positions.top:
155
- case Positions.top_right:
156
- case Positions.top_left:
146
+ case DlToastPositions.TOP:
147
+ case DlToastPositions.TOP_RIGHT:
148
+ case DlToastPositions.TOP_LEFT:
157
149
  toastParentPosition.value = 'top'
158
150
  return parentTop
159
- case Positions.bottom:
160
- case Positions.bottom_right:
161
- case Positions.bottom_left:
151
+ case DlToastPositions.BOTTOM:
152
+ case DlToastPositions.BOTTOM_RIGHT:
153
+ case DlToastPositions.BOTTOM_LEFT:
162
154
  toastParentPosition.value = 'bottom'
163
155
  return parentBottom
164
156
  }
@@ -166,16 +158,16 @@ export default defineComponent({
166
158
 
167
159
  const transition = computed((): Animation => {
168
160
  switch (position) {
169
- case Positions.top:
170
- case Positions.top_right:
171
- case Positions.top_left:
161
+ case DlToastPositions.TOP:
162
+ case DlToastPositions.TOP_RIGHT:
163
+ case DlToastPositions.TOP_LEFT:
172
164
  return {
173
165
  enter: 'dl-toast--fade-in-down',
174
166
  leave: 'dl-toast--fade-out'
175
167
  }
176
- case Positions.bottom:
177
- case Positions.bottom_right:
178
- case Positions.bottom_left:
168
+ case DlToastPositions.BOTTOM:
169
+ case DlToastPositions.BOTTOM_RIGHT:
170
+ case DlToastPositions.BOTTOM_LEFT:
179
171
  return {
180
172
  enter: 'dl-toast--fade-in-up',
181
173
  leave: 'dl-toast--fade-out'
@@ -231,13 +223,13 @@ export default defineComponent({
231
223
 
232
224
  const badgeColor = computed(() => {
233
225
  switch (props.type) {
234
- case Types.success:
226
+ case DlToastTypes.SUCCESS:
235
227
  return 'var(--dl-color-alert-success)'
236
- case Types.warning:
228
+ case DlToastTypes.WARNING:
237
229
  return 'var(--dl-color-alert-warn)'
238
- case Types.error:
230
+ case DlToastTypes.ERROR:
239
231
  return 'var(--dl-color-alert-error)'
240
- case Types.info:
232
+ case DlToastTypes.INFO:
241
233
  return 'var(--dl-color-alert-info)'
242
234
  }
243
235
  })
@@ -2,3 +2,55 @@ export interface Animation {
2
2
  enter: string
3
3
  leave: string
4
4
  }
5
+
6
+ export enum DlToastPositions {
7
+ TOP_RIGHT = 'top-right',
8
+ TOP = 'top',
9
+ TOP_LEFT = 'top-left',
10
+ BOTTOM_RIGHT = 'bottom-right',
11
+ BOTTOM = 'bottom',
12
+ BOTTOM_LEFT = 'bottom-left'
13
+ }
14
+
15
+ export enum DlToastTypes {
16
+ SUCCESS = 'success',
17
+ WARNING = 'warning',
18
+ ERROR = 'error',
19
+ INFO = 'info'
20
+ }
21
+
22
+ export interface DlToastProps {
23
+ /**
24
+ * The message to display in the toast
25
+ */
26
+ message: string
27
+ /**
28
+ * The type of the toast
29
+ */
30
+ type: DlToastTypes
31
+ /**
32
+ * The width of the toast
33
+ * @default 'auto'
34
+ */
35
+ width?: string
36
+ /**
37
+ * The duration of the toast in seconds
38
+ * @default 10
39
+ */
40
+ duration?: number
41
+ /**
42
+ * The position of the toast
43
+ * @default DlToastPositions.BOTTOM
44
+ */
45
+ position?: DlToastPositions
46
+ /**
47
+ * Whether the toast is closable
48
+ * @default true
49
+ */
50
+ closable?: boolean
51
+ /**
52
+ * The number of toasts to collapse after
53
+ * @default 5
54
+ */
55
+ collapseCount?: number
56
+ }