@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
@@ -12,7 +12,7 @@
12
12
  :disabled="disabled"
13
13
  :style="[computedStyles]"
14
14
  style="pointer-events: auto"
15
- class="dl-button"
15
+ :class="buttonClass"
16
16
  @click="onClick"
17
17
  @mousedown="onMouseDown"
18
18
  >
@@ -24,6 +24,7 @@
24
24
  <div class="dl-button-content dl-anchor--skip">
25
25
  <dl-icon
26
26
  v-if="hasIcon"
27
+ class="dl-button-icon"
27
28
  :size="iconSizePX"
28
29
  :color="iconColor || textColor"
29
30
  :icon="icon"
@@ -52,7 +53,8 @@
52
53
  </template>
53
54
 
54
55
  <script lang="ts">
55
- import { DlTooltip, DlIcon } from '../../essential'
56
+ import { DlTooltip } from '../../shared'
57
+ import { DlIcon } from '../../essential'
56
58
  import {
57
59
  setPadding,
58
60
  setFontSize,
@@ -62,18 +64,22 @@ import {
62
64
  setColorOnHover,
63
65
  setBorderOnHover,
64
66
  setBgOnHover,
67
+ setBgOnPressed,
68
+ setBorderOnPressed,
69
+ setTextOnPressed,
65
70
  setIconSize,
66
71
  setIconPadding,
67
72
  setMaxHeight
68
73
  } from './utils'
69
74
  import type { ButtonSizes } from './utils'
70
- import { defineComponent, PropType, ref } from 'vue-demi'
75
+ import { computed, defineComponent, PropType, ref } from 'vue-demi'
71
76
  import { colorNames } from '../../../utils/css-color-names'
72
77
  import { useSizeObserver } from '../../../hooks/use-size-observer'
73
78
  import { v4 } from 'uuid'
74
79
  import { ButtonColors } from './types'
75
80
  import { transformOptions } from '../../shared/types'
76
81
  import { stringStyleToRecord } from '../../../utils'
82
+ import { textTransform } from '../../../utils/string'
77
83
  import { isString } from 'lodash'
78
84
 
79
85
  export default defineComponent({
@@ -84,49 +90,106 @@ export default defineComponent({
84
90
  },
85
91
 
86
92
  props: {
93
+ /**
94
+ * The user will not be able to press on the button
95
+ */
87
96
  disabled: Boolean,
97
+ /**
98
+ * The color of the button
99
+ */
88
100
  color: {
89
- type: String! as PropType<keyof typeof colorNames>,
101
+ type: String! as PropType<keyof typeof colorNames | string>,
90
102
  default: ''
91
103
  },
104
+ /**
105
+ * The button's padding is lowered and the white space shrinks
106
+ */
92
107
  dense: { type: Boolean, default: false },
108
+ /**
109
+ * The text content of the button
110
+ */
93
111
  label: { type: String, default: '' },
112
+ /**
113
+ * The color of the button's text
114
+ */
94
115
  textColor: { type: String!, default: '' },
95
116
  colorsObject: {
96
117
  type: Object as PropType<ButtonColors>,
97
118
  default: null
98
119
  },
120
+ /**
121
+ * The color of the icon inside the button
122
+ */
99
123
  iconColor: { type: String!, default: '' },
124
+ /** Padding inside the button */
100
125
  padding: { type: String, default: '' },
126
+ /**
127
+ * The size of the button, it can be s,m,l or xl
128
+ */
101
129
  margin: { type: String, default: '0 auto' },
102
130
  size: { type: String! as PropType<ButtonSizes>, default: 'm' },
131
+ /**
132
+ * The assigned color will fill the entirety of the button
133
+ */
103
134
  filled: { type: Boolean, default: true },
135
+ /** Makes the button rounded */
104
136
  round: { type: Boolean, default: false },
105
- shaded: { type: Boolean, default: false },
137
+ /**
138
+ * The width of the button will take that of its container
139
+ */
106
140
  fluid: Boolean,
141
+ /**
142
+ * The button will not have an outline
143
+ */
107
144
  flat: Boolean,
145
+ /**
146
+ * All the characters inside the button will be uppercase
147
+ */
148
+ uppercase: Boolean,
149
+ /**
150
+ * The button will be transparent with a colored outline
151
+ */
108
152
  transform: {
109
153
  type: String,
110
154
  default: 'default',
111
155
  validator: (value: string): boolean =>
112
156
  transformOptions.includes(value)
113
157
  },
114
- outlined: Boolean,
158
+ /**
159
+ * Doesn't allow the button's text to be wrapped along multiple rows
160
+ */
115
161
  noWrap: Boolean,
162
+ /**
163
+ * The name of the icon to go inside the button
164
+ */
116
165
  icon: { type: String, default: '' },
117
166
  overflow: { type: Boolean, default: false, required: false },
167
+ /**
168
+ * The tooltip displayed when hovering over the button
169
+ */
118
170
  tooltip: { type: String, default: null, required: false },
119
- styles: { type: [Object, String], default: null }
171
+ /**
172
+ * The button will maintain the styles it has when it's pressed if this prop is active
173
+ */
174
+ active: { type: Boolean, default: false, required: false },
175
+ styles: { type: [Object, String], default: null },
176
+ shaded: { type: Boolean, default: false },
177
+ outlined: Boolean
120
178
  },
121
179
  emits: ['click', 'mousedown'],
122
- setup() {
180
+ setup(props) {
123
181
  const buttonLabelRef = ref(null)
124
182
  const { hasEllipsis } = useSizeObserver(buttonLabelRef)
125
183
 
184
+ const buttonClass = computed(() => {
185
+ return props.active ? 'dl-button active-class' : 'dl-button'
186
+ })
187
+
126
188
  return {
127
189
  uuid: `dl-button-${v4()}`,
128
190
  buttonLabelRef,
129
- isOverflowing: hasEllipsis
191
+ isOverflowing: hasEllipsis,
192
+ buttonClass
130
193
  }
131
194
  },
132
195
  computed: {
@@ -151,11 +214,10 @@ export default defineComponent({
151
214
  return setIconSize(this.$props.size)
152
215
  },
153
216
  hasLabel(): boolean {
154
- return (
155
- this.label !== void 0 &&
156
- this.label !== null &&
157
- this.label !== ''
158
- )
217
+ return !!this.label
218
+ },
219
+ buttonLabel(): string {
220
+ return textTransform(this.label)
159
221
  },
160
222
  hasIcon(): boolean {
161
223
  return typeof this.icon === 'string' && this.icon !== ''
@@ -230,7 +292,8 @@ export default defineComponent({
230
292
  disabled: this.disabled,
231
293
  flat: this.flat,
232
294
  shaded: this.shaded,
233
- color: this.color
295
+ color: this.color,
296
+ outlined: this.outlined
234
297
  }),
235
298
  '--dl-button-text-color-hover': setColorOnHover({
236
299
  disabled: this.disabled,
@@ -253,14 +316,24 @@ export default defineComponent({
253
316
  filled: this.filled,
254
317
  color: this.color
255
318
  }),
256
- '--dl-button-text-color-pressed':
257
- 'var(--dl-button-text-color)',
258
- '--dl-button-bg-pressed': 'var(--dl-button-bg)',
259
- '--dl-button-border-pressed': 'var(--dl-button-border)'
319
+ '--dl-button-text-color-pressed': setTextOnPressed({
320
+ shaded: this.shaded,
321
+ outlined: this.shaded
322
+ }),
323
+ '--dl-button-bg-pressed': setBgOnPressed({
324
+ shaded: this.shaded,
325
+ outlined: this.outlined
326
+ }),
327
+ '--dl-button-border-pressed': setBorderOnPressed({
328
+ shaded: this.shaded,
329
+ outlined: this.outlined
330
+ })
260
331
  }
261
332
  }
262
333
 
263
334
  return {
335
+ '--dl-button-transition-duration': 'all ease 0.15s',
336
+ '--dl-button-text-transition-duration': 'all ease 0.05s',
264
337
  '--dl-button-container-width': this.fluid ? '100%' : 'auto',
265
338
  '--dl-button-padding': this.dense
266
339
  ? '0'
@@ -304,7 +377,7 @@ export default defineComponent({
304
377
  },
305
378
  onMouseDown(e: Event) {
306
379
  if (this.isActionable) {
307
- if (e !== void 0) {
380
+ if (e) {
308
381
  if (e.defaultPrevented === true) {
309
382
  return
310
383
  }
@@ -343,27 +416,28 @@ export default defineComponent({
343
416
  align-items: stretch;
344
417
  position: relative;
345
418
  vertical-align: middle;
346
- transition: all ease-in 0.15s;
419
+ transition: var(--dl-button-transition-duration);
347
420
  justify-content: center;
348
421
 
349
422
  &:active {
350
- transition: all ease-in 0.15s;
423
+ transition: var(--dl-button-transition-duration);
351
424
  color: var(--dl-button-text-color-pressed) !important;
352
425
  background-color: var(--dl-button-bg-pressed) !important;
353
426
  border-color: var(--dl-button-border-pressed) !important;
354
427
 
355
428
  & > span > i {
356
- transition: all ease-in 0.15s;
429
+ transition: var(--dl-button-text-transition-duration);
357
430
  }
358
431
  }
359
432
 
360
433
  &:hover:enabled:not(:active) {
434
+ transition: var(--dl-button-transition-duration);
361
435
  color: var(--dl-button-text-color-hover);
362
436
  background-color: var(--dl-button-bg-hover);
363
437
  border-color: var(--dl-button-border-hover);
364
438
 
365
439
  & .dl-button-label {
366
- transition: all ease-in 0.15s;
440
+ transition: var(--dl-button-text-transition-duration);
367
441
  color: var(--dl-button-color-hover);
368
442
  }
369
443
  }
@@ -383,7 +457,11 @@ export default defineComponent({
383
457
  gap: var(--dl-button-content-gap, 7px);
384
458
  }
385
459
 
386
- .dl-chip.first-letter-capitalized {
460
+ .dl-button-icon {
461
+ transition: var(--dl-button-text-transition-duration);
462
+ }
463
+
464
+ .dl-button-container.first-letter-capitalized {
387
465
  &::first-letter,
388
466
  & > *::first-letter {
389
467
  text-transform: capitalize;
@@ -394,4 +472,16 @@ export default defineComponent({
394
472
  display: inline-block;
395
473
  width: var(--dl-button-container-width);
396
474
  }
475
+
476
+ .active-class {
477
+ color: var(--dl-button-text-color-hover);
478
+ background-color: var(--dl-button-bg-hover);
479
+ border-color: var(--dl-button-border-hover);
480
+ transition: var(--dl-button-transition-duration);
481
+
482
+ & .dl-button-label {
483
+ color: var(--dl-button-color-hover);
484
+ transition: var(--dl-button-text-transition-duration);
485
+ }
486
+ }
397
487
  </style>
@@ -1,7 +1,7 @@
1
1
  import { getColor } from '../../../utils'
2
2
  import { getLighterGradient } from '../../../utils/getLighterGradient'
3
3
 
4
- export type ButtonSizes = 's' | 'm' | 'l' | 'xl'
4
+ export type ButtonSizes = 's' | 'm' | 'l' | ('xl' & string)
5
5
 
6
6
  const paddings = {
7
7
  s: '7px 16px',
@@ -70,6 +70,9 @@ export const setTextColor = ({
70
70
  if (disabled) {
71
71
  return getColor('', 'dl-color-disabled')
72
72
  }
73
+ if (shaded && outlined) {
74
+ return getColor(textColor, 'dl-color-text-darker-buttons')
75
+ }
73
76
  if (outlined) {
74
77
  return getColor(textColor, 'dl-color-secondary')
75
78
  }
@@ -111,13 +114,17 @@ export const setBorder = ({
111
114
  disabled,
112
115
  flat,
113
116
  color = '',
114
- shaded
117
+ shaded,
118
+ outlined
115
119
  }: Partial<DlButtonProps>) => {
116
120
  if (disabled) {
117
121
  return flat
118
122
  ? 'var(--dl-color-transparent)'
119
123
  : 'var(--dl-color-separator)'
120
124
  }
125
+ if (shaded && outlined) {
126
+ return 'var(--dl-color-separator)'
127
+ }
121
128
  if (flat || shaded) {
122
129
  return 'var(--dl-color-transparent)'
123
130
  }
@@ -177,3 +184,39 @@ export const setBgOnHover = ({
177
184
 
178
185
  return 'var(--dl-color-panel-background)'
179
186
  }
187
+
188
+ export const setBgOnPressed = ({
189
+ shaded,
190
+ outlined
191
+ }: Partial<DlButtonProps>) => {
192
+ if (shaded && outlined) {
193
+ return 'var(--dl-color-text-buttons)'
194
+ }
195
+ if (shaded) {
196
+ return 'var(--dl-color-secondary)'
197
+ }
198
+ return 'var(--dl-button-bg)'
199
+ }
200
+
201
+ export const setTextOnPressed = ({
202
+ shaded,
203
+ outlined
204
+ }: Partial<DlButtonProps>) => {
205
+ if (shaded && outlined) {
206
+ return 'var(--dl-color-secondary)'
207
+ }
208
+ if (shaded) {
209
+ return 'var(--dl-color-text-buttons)'
210
+ }
211
+ return 'var(--dl-button-text-color)'
212
+ }
213
+
214
+ export const setBorderOnPressed = ({
215
+ shaded,
216
+ outlined
217
+ }: Partial<DlButtonProps>) => {
218
+ if (shaded && outlined) {
219
+ return 'var(--dl-color-secondary)'
220
+ }
221
+ return 'var(--dl-button-border)'
222
+ }
@@ -50,7 +50,8 @@
50
50
 
51
51
  <script lang="ts">
52
52
  import { defineComponent, ref } from 'vue-demi'
53
- import { DlIcon, DlTooltip } from '../../essential'
53
+ import { DlTooltip } from '../../shared'
54
+ import { DlIcon } from '../../essential'
54
55
  import { useSizeObserver } from '../../../hooks/use-size-observer'
55
56
  import {
56
57
  setTextColor,
@@ -106,11 +107,7 @@ export default defineComponent({
106
107
  },
107
108
  computed: {
108
109
  hasLabel(): boolean {
109
- return (
110
- this.label !== void 0 &&
111
- this.label !== null &&
112
- this.label !== ''
113
- )
110
+ return !!this.label
114
111
  },
115
112
  hasLabelSlot(): boolean {
116
113
  return !!this.$slots['default']
@@ -220,7 +217,6 @@ export default defineComponent({
220
217
  text-overflow: ellipsis;
221
218
  white-space: nowrap;
222
219
  overflow: hidden;
223
- padding: 3px 5px 3px 5px;
224
220
  }
225
221
  }
226
222
 
@@ -59,17 +59,17 @@ export const setPadding = ({
59
59
  const right = removable ? 20 : 5
60
60
 
61
61
  if (hasLabel && (removable || hasIcon)) {
62
- return `3px ${right}px 3px ${left}px`
62
+ return `5px ${right}px 5px ${left}px`
63
63
  }
64
64
 
65
65
  if (!hasLabel && hasIcon && removable) {
66
- return `3px ${right}px 3px 0`
66
+ return `5px ${right}px 5px 0`
67
67
  }
68
68
  if (removable || hasIcon) {
69
- return '3px 0'
69
+ return '5px 0'
70
70
  }
71
71
 
72
- return '3px 5px'
72
+ return '5px'
73
73
  }
74
74
 
75
75
  export const setRemoveIconWidth = ({
@@ -0,0 +1,70 @@
1
+ <template>
2
+ <div
3
+ ref="wrapper"
4
+ class="container-wrapper"
5
+ >
6
+ <div
7
+ :id="uuid"
8
+ ref="container"
9
+ :class="containerStyles"
10
+ >
11
+ <div
12
+ v-if="hasHeaderSlot"
13
+ class="dl-container__header"
14
+ >
15
+ <slot name="header" />
16
+ </div>
17
+
18
+ <div class="dl-container__content">
19
+ <slot />
20
+ </div>
21
+ </div>
22
+ </div>
23
+ </template>
24
+ <script lang="ts">
25
+ import { v4 } from 'uuid'
26
+ import { defineComponent } from 'vue-demi'
27
+
28
+ export default defineComponent({
29
+ name: 'DlContainer',
30
+ data() {
31
+ return {
32
+ uuid: `dl-container-${v4()}`
33
+ }
34
+ },
35
+ computed: {
36
+ containerStyles() {
37
+ return 'dl-container'
38
+ },
39
+ hasHeaderSlot(): boolean {
40
+ return this.$slots.header !== undefined
41
+ }
42
+ }
43
+ })
44
+ </script>
45
+
46
+ <style lang="scss" scoped>
47
+ .dl-container {
48
+ border: 1px solid var(--dl-color-separator);
49
+ user-select: none;
50
+ height: 100%;
51
+ display: flex;
52
+ flex-direction: column;
53
+ &__header {
54
+ display: flex;
55
+ padding: 10px;
56
+ border-bottom: 1px solid var(--dl-color-separator);
57
+ }
58
+ &__content {
59
+ padding: 10px;
60
+ height: 100%;
61
+ overflow-y: auto;
62
+ }
63
+ }
64
+
65
+ .container-wrapper {
66
+ flex-basis: var(--container-flex-basis);
67
+ margin: var(--row-gap) var(--column-gap);
68
+ height: 100%;
69
+ }
70
+ </style>
@@ -0,0 +1,3 @@
1
+ import DlContainer from './DlContainer.vue'
2
+
3
+ export { DlContainer }