@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,282 @@
1
+ <template>
2
+ <div
3
+ :id="uuid"
4
+ ref="dlEtaRef"
5
+ :style="cssVars"
6
+ :class="[{ 'empty-state': true }, `empty-state--${align}`]"
7
+ >
8
+ <dl-icon
9
+ :class="iconClassName"
10
+ :color="iconColor"
11
+ :size="iconFontSize"
12
+ :icon="icon"
13
+ />
14
+
15
+ <dl-typography
16
+ v-if="title"
17
+ bold
18
+ :size="titleFontSize"
19
+ :color="titleColor"
20
+ :class="titleClassName"
21
+ >
22
+ {{ title }}
23
+ </dl-typography>
24
+
25
+ <dl-typography
26
+ v-if="subtitle"
27
+ :size="subtitleFontSize"
28
+ :color="subtitleColor"
29
+ :class="subtitleClassName"
30
+ >
31
+ {{ subtitle }}
32
+ </dl-typography>
33
+
34
+ <div
35
+ v-if="hasCTASlot"
36
+ class="empty-state--cta"
37
+ >
38
+ <slot name="cta" />
39
+ </div>
40
+
41
+ <dl-typography
42
+ v-if="info"
43
+ :size="infoFontSize"
44
+ :color="infoColor"
45
+ class="empty-state--info"
46
+ >
47
+ {{ info }}
48
+ </dl-typography>
49
+
50
+ <div
51
+ v-if="hasLinkSlot"
52
+ class="empty-state--links"
53
+ >
54
+ <slot name="links" />
55
+ </div>
56
+ </div>
57
+ </template>
58
+
59
+ <script lang="ts">
60
+ import { v4 } from 'uuid'
61
+ import { DlIcon, DlTypography } from '../../essential'
62
+ import { useSizeObserver } from '../../../hooks/use-size-observer'
63
+ import { defineComponent, computed, ref } from 'vue-demi'
64
+
65
+ export default defineComponent({
66
+ name: 'DlEmptyState',
67
+ components: {
68
+ DlIcon,
69
+ DlTypography
70
+ },
71
+ props: {
72
+ bgImage: {
73
+ type: String,
74
+ default: null
75
+ },
76
+ bgSize: {
77
+ type: String,
78
+ default: '240px'
79
+ },
80
+ title: {
81
+ type: String,
82
+ default: 'Something Went Wrong'
83
+ },
84
+ titleColor: {
85
+ type: String,
86
+ default: 'dl-color-darker'
87
+ },
88
+ titleSize: {
89
+ type: String,
90
+ default: '20px'
91
+ },
92
+ subtitle: {
93
+ type: String,
94
+ default: ''
95
+ },
96
+ subtitleSize: {
97
+ type: String,
98
+ default: '14px'
99
+ },
100
+ subtitleColor: {
101
+ type: String,
102
+ default: 'dl-color-medium'
103
+ },
104
+ info: {
105
+ type: String,
106
+ default: ''
107
+ },
108
+ infoColor: {
109
+ type: String,
110
+ default: 'dl-color-darker'
111
+ },
112
+ infoSize: {
113
+ type: String,
114
+ default: '14px'
115
+ },
116
+ icon: {
117
+ type: String,
118
+ default: 'icon-dl-alert-filled'
119
+ },
120
+ iconSize: {
121
+ type: String,
122
+ default: '40px'
123
+ },
124
+ iconColor: {
125
+ type: String,
126
+ default: 'dl-color-darker'
127
+ },
128
+ responsive: Boolean,
129
+ align: {
130
+ type: String,
131
+ default: 'center'
132
+ }
133
+ },
134
+ setup(props, { slots }) {
135
+ const uuid = ref(`dl-empty-state-${v4()}`)
136
+
137
+ const dlEtaRef = ref(null)
138
+
139
+ const { widthRef, heightRef } = useSizeObserver(dlEtaRef)
140
+
141
+ const metric = computed(() => {
142
+ return widthRef.value > heightRef.value
143
+ ? widthRef.value
144
+ : heightRef.value
145
+ })
146
+
147
+ const fontSize = (value: number) => metric.value * (value / 365)
148
+
149
+ const titleFontSize = computed(() =>
150
+ props.responsive
151
+ ? fontSize(parseInt(props.titleSize)) + 'px'
152
+ : props.titleSize
153
+ )
154
+
155
+ const infoFontSize = computed(() =>
156
+ props.responsive
157
+ ? fontSize(parseInt(props.infoSize)) + 'px'
158
+ : props.infoSize
159
+ )
160
+
161
+ const iconFontSize = computed(() =>
162
+ props.responsive
163
+ ? fontSize(parseInt(props.iconSize)) + 'px'
164
+ : props.iconSize
165
+ )
166
+
167
+ const subtitleFontSize = computed(() =>
168
+ props.responsive
169
+ ? fontSize(parseInt(props.subtitleSize)) + 'px'
170
+ : props.subtitleSize
171
+ )
172
+
173
+ const bgImageSize = computed(() =>
174
+ props.responsive
175
+ ? fontSize(parseInt(props.bgSize)) + 'px'
176
+ : props.bgSize
177
+ )
178
+
179
+ const hasCTASlot = !!slots['cta']
180
+
181
+ const hasLinkSlot = !!slots['links']
182
+
183
+ const iconClassName = computed(() => {
184
+ const classname = 'empty-state--icon'
185
+
186
+ return classname
187
+ })
188
+
189
+ const titleClassName = computed(() => {
190
+ const classname = 'empty-state--title'
191
+
192
+ return classname
193
+ })
194
+
195
+ const subtitleClassName = computed(() => {
196
+ const classname = 'empty-state--subtitle'
197
+
198
+ return classname
199
+ })
200
+
201
+ const infoClassName = computed(() => {
202
+ const classname = 'empty-state--info'
203
+
204
+ return classname
205
+ })
206
+
207
+ const cssVars = computed(() => {
208
+ return {
209
+ '--bg-image': props.bgImage,
210
+ '--bg-size': bgImageSize.value
211
+ }
212
+ })
213
+
214
+ return {
215
+ uuid,
216
+ cssVars,
217
+ iconClassName,
218
+ titleClassName,
219
+ infoClassName,
220
+ subtitleClassName,
221
+ hasCTASlot,
222
+ hasLinkSlot,
223
+ dlEtaRef,
224
+ titleFontSize,
225
+ subtitleFontSize,
226
+ infoFontSize,
227
+ iconFontSize
228
+ }
229
+ }
230
+ })
231
+ </script>
232
+
233
+ <style scoped lang="scss">
234
+ .empty-state {
235
+ display: flex;
236
+ justify-content: center;
237
+ align-items: center;
238
+ flex-direction: column;
239
+ background-repeat: no-repeat;
240
+ background-position: 50% 50%;
241
+
242
+ background-image: var(--bg-image);
243
+ background-size: var(--bg-size);
244
+
245
+ &--title {
246
+ line-height: 24px;
247
+ margin-bottom: 2px;
248
+ }
249
+
250
+ &--subtitle,
251
+ &--cta,
252
+ &--links,
253
+ &--info {
254
+ margin-bottom: 20px;
255
+ }
256
+
257
+ &--nowrap {
258
+ white-space: nowrap;
259
+ }
260
+
261
+ &--icon {
262
+ margin-bottom: 10px;
263
+ }
264
+
265
+ &--center,
266
+ &--left {
267
+ display: flex;
268
+ width: 100%;
269
+ }
270
+
271
+ &--center {
272
+ justify-content: center;
273
+ align-items: center;
274
+ text-align: center;
275
+ }
276
+
277
+ &--left {
278
+ align-items: flex-start;
279
+ text-align: start;
280
+ }
281
+ }
282
+ </style>
@@ -0,0 +1,2 @@
1
+ import DlEmptyState from './DlEmptyState.vue'
2
+ export { DlEmptyState }
@@ -0,0 +1,20 @@
1
+ export type DlEmptyStateProps = {
2
+ bgImage?: string
3
+ bgSize?: string
4
+ title?: string
5
+ titleColor?: string
6
+ titleSize?: string
7
+ subtitle?: string
8
+ subtitleSize?: string
9
+ subtitleColor?: string
10
+ info?: string
11
+ infoColor?: string
12
+ infoSize?: string
13
+ icon?: string
14
+ iconSize?: string
15
+ iconColor?: string
16
+ responsive?: boolean
17
+ align: 'center' | 'left'
18
+ }
19
+
20
+ export type DlEmptyStateSlots = ['cta', 'links']
@@ -0,0 +1,163 @@
1
+ <template>
2
+ <div
3
+ ref="grid"
4
+ :style="gridStyles"
5
+ :class="gridClass"
6
+ >
7
+ <slot />
8
+ </div>
9
+ </template>
10
+
11
+ <script lang="ts">
12
+ import { defineComponent, PropType } from 'vue-demi'
13
+ import {
14
+ getGridTemplate,
15
+ getElementAbove,
16
+ findIndexInMatrix,
17
+ swapElemensInMatrix,
18
+ isCustomEvent
19
+ } from '../DlWidget/utils'
20
+
21
+ export default defineComponent({
22
+ model: {
23
+ prop: 'modelValue',
24
+ event: 'update:modelValue'
25
+ },
26
+ props: {
27
+ modelValue: {
28
+ type: Array as PropType<number[][]>,
29
+ default: null
30
+ },
31
+ rowGap: {
32
+ type: String,
33
+ default: '30px'
34
+ },
35
+ columnGap: {
36
+ type: String,
37
+ default: '30px'
38
+ },
39
+ maxElementsPerRow: {
40
+ type: Number,
41
+ default: 3
42
+ }
43
+ },
44
+ emits: ['update:modelValue', 'layout-changed'],
45
+ computed: {
46
+ gridStyles(): object {
47
+ return {
48
+ '--row-gap': this.rowGap,
49
+ '--column-gap': this.columnGap
50
+ }
51
+ },
52
+ gridClass(): string {
53
+ return this.modelValue
54
+ ? 'dl-grid-wrapper__grid'
55
+ : 'dl-grid-wrapper__flex'
56
+ }
57
+ },
58
+ watch: {
59
+ modelValue: {
60
+ handler(val, oldVal) {
61
+ this.$nextTick(() => {
62
+ if (val) {
63
+ if (val.length !== oldVal?.length) {
64
+ this.applyIndexesForChildren()
65
+ }
66
+ this.applyGridElementStyles()
67
+ }
68
+ })
69
+ },
70
+ immediate: true
71
+ }
72
+ },
73
+ mounted() {
74
+ this.applyIndexesForChildren()
75
+ },
76
+ methods: {
77
+ applyGridElementStyles() {
78
+ if (!this.modelValue) return
79
+ const gridElements = Array.from(
80
+ (this.$refs.grid as HTMLElement).children
81
+ )
82
+ const gridTemplate = getGridTemplate(this.modelValue)
83
+ if (gridElements.length > gridTemplate.length) return
84
+
85
+ const order = this.modelValue.flat()
86
+ gridElements.forEach((element: Element, index: number) => {
87
+ const orderIndex =
88
+ order.findIndex((nr: number) => nr === index + 1) + 1
89
+ const htmlElement = element as HTMLElement
90
+ htmlElement.style.order = `${orderIndex}`
91
+ htmlElement.style.gridColumn = gridTemplate[orderIndex - 1]
92
+ htmlElement.addEventListener('position-changing', (e) => {
93
+ if (!isCustomEvent(e)) return
94
+ this.changePosition(e)
95
+ })
96
+ htmlElement.addEventListener(
97
+ 'position-changed',
98
+ this.layoutChanged.bind(this)
99
+ )
100
+ })
101
+ },
102
+ changePosition(e: CustomEvent) {
103
+ if (!this.modelValue) return
104
+ const side = e.detail.side
105
+ const className = (this.$refs.grid as HTMLElement).children[0]
106
+ .classList[0]
107
+ const sourceIndex =
108
+ parseInt(
109
+ getElementAbove(e.detail.source, className).dataset.index
110
+ ) + 1
111
+ const targetIndex =
112
+ parseInt(
113
+ getElementAbove(e.detail.target, className).dataset.index
114
+ ) + 1
115
+ const sourceMatrixIndex = findIndexInMatrix(
116
+ this.modelValue,
117
+ sourceIndex
118
+ )
119
+ const targetMatrixIndex = findIndexInMatrix(
120
+ this.modelValue,
121
+ targetIndex
122
+ )
123
+
124
+ const newLayout = swapElemensInMatrix(
125
+ this.modelValue,
126
+ sourceMatrixIndex,
127
+ targetMatrixIndex,
128
+ side,
129
+ this.maxElementsPerRow
130
+ )
131
+ // Update modelValue is required to trigger visualization of the changes
132
+ this.$emit('update:modelValue', newLayout)
133
+ if (e.detail.endDragging) {
134
+ this.layoutChanged()
135
+ }
136
+ },
137
+ layoutChanged() {
138
+ this.$emit('layout-changed', this.modelValue)
139
+ },
140
+ applyIndexesForChildren() {
141
+ Array.from((this.$refs.grid as HTMLElement).children).forEach(
142
+ (element: Element, index: number) => {
143
+ (element as HTMLElement).dataset.index = `${index}`
144
+ }
145
+ )
146
+ }
147
+ }
148
+ })
149
+ </script>
150
+
151
+ <style lang="scss" scoped>
152
+ .dl-grid-wrapper {
153
+ &__grid {
154
+ display: grid;
155
+ row-gap: var(--row-gap);
156
+ column-gap: var(--column-gap);
157
+ }
158
+ &__flex {
159
+ display: flex;
160
+ flex-wrap: wrap;
161
+ }
162
+ }
163
+ </style>
@@ -0,0 +1,4 @@
1
+ import DlGrid from './DlGrid.vue'
2
+ import { DlGridLayout } from './types'
3
+ export { DlGrid }
4
+ export type { DlGridLayout }
@@ -0,0 +1,5 @@
1
+ export interface DlGridLayout {
2
+ name: string
3
+ value: number[][]
4
+ }
5
+ export type DlGridSideType = 'left' | 'right'
@@ -18,7 +18,8 @@
18
18
 
19
19
  <script lang="ts">
20
20
  import { defineComponent, ref, computed } from 'vue-demi'
21
- import { DlTooltip, DlIcon } from '../../../essential'
21
+ import { DlIcon } from '../../../essential'
22
+ import { DlTooltip } from '../../../shared'
22
23
 
23
24
  export default defineComponent({
24
25
  name: 'KpiInfo',