@dataloop-ai/components 0.13.0

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 (294) hide show
  1. package/.eslintrc.js +154 -0
  2. package/.prettierrc.json +7 -0
  3. package/Dockerfile +12 -0
  4. package/LICENSE +201 -0
  5. package/README.md +43 -0
  6. package/favicon.ico +0 -0
  7. package/index.html +13 -0
  8. package/index.ts +1 -0
  9. package/jest.config.js +16 -0
  10. package/jest.setup.js +59 -0
  11. package/models.ts +1 -0
  12. package/package.json +109 -0
  13. package/src/App.vue +201 -0
  14. package/src/assets/globals.scss +253 -0
  15. package/src/assets/globalsKeys.ts +28 -0
  16. package/src/components/DlAccordion/AccordionHeader.vue +148 -0
  17. package/src/components/DlAccordion/DlAccordion.vue +108 -0
  18. package/src/components/DlAccordion/index.ts +2 -0
  19. package/src/components/DlAlert.vue +227 -0
  20. package/src/components/DlAvatar.vue +99 -0
  21. package/src/components/DlBadge.vue +127 -0
  22. package/src/components/DlButton/DlButton.vue +370 -0
  23. package/src/components/DlButton/index.ts +4 -0
  24. package/src/components/DlButton/utils.ts +169 -0
  25. package/src/components/DlButtonGroup.vue +122 -0
  26. package/src/components/DlCheckbox.vue +298 -0
  27. package/src/components/DlChip/DlChip.vue +244 -0
  28. package/src/components/DlChip/index.ts +4 -0
  29. package/src/components/DlChip/utils.ts +100 -0
  30. package/src/components/DlColorPicker/DlAlpha.vue +142 -0
  31. package/src/components/DlColorPicker/DlBox.vue +75 -0
  32. package/src/components/DlColorPicker/DlColorPicker.vue +306 -0
  33. package/src/components/DlColorPicker/DlColors.vue +139 -0
  34. package/src/components/DlColorPicker/DlHue.vue +135 -0
  35. package/src/components/DlColorPicker/DlPreview.vue +61 -0
  36. package/src/components/DlColorPicker/DlSaturation.vue +152 -0
  37. package/src/components/DlColorPicker/constants.ts +16 -0
  38. package/src/components/DlColorPicker/index.ts +20 -0
  39. package/src/components/DlColorPicker/types.ts +11 -0
  40. package/src/components/DlColorPicker/utils.ts +128 -0
  41. package/src/components/DlCounters.vue +173 -0
  42. package/src/components/DlDatePicker/DlCalendar.vue +332 -0
  43. package/src/components/DlDatePicker/DlDatePicker.vue +315 -0
  44. package/src/components/DlDatePicker/DlMonthCalendar.vue +282 -0
  45. package/src/components/DlDatePicker/classes/Calendar.ts +110 -0
  46. package/src/components/DlDatePicker/classes/CalendarDate.ts +12 -0
  47. package/src/components/DlDatePicker/classes/CustomDate.ts +218 -0
  48. package/src/components/DlDatePicker/index.ts +3 -0
  49. package/src/components/DlDatePicker/isInRange.ts +44 -0
  50. package/src/components/DlDatePicker/types.ts +4 -0
  51. package/src/components/DlDatePicker/utils.ts +39 -0
  52. package/src/components/DlDateTimeRange/DlCardSidebar.vue +109 -0
  53. package/src/components/DlDateTimeRange/DlDateInput.vue +105 -0
  54. package/src/components/DlDateTimeRange/DlDateTimeRange.vue +468 -0
  55. package/src/components/DlDateTimeRange/index.ts +3 -0
  56. package/src/components/DlDateTimeRange/types.ts +42 -0
  57. package/src/components/DlDialogBox/DlDialogBox.vue +196 -0
  58. package/src/components/DlDialogBox/DlDialogBoxFooter.vue +22 -0
  59. package/src/components/DlDialogBox/DlDialogBoxHeader.vue +75 -0
  60. package/src/components/DlDialogBox/index.ts +5 -0
  61. package/src/components/DlDropdownButton.vue +463 -0
  62. package/src/components/DlIcon.vue +147 -0
  63. package/src/components/DlInfoErrorMessage.vue +91 -0
  64. package/src/components/DlItem/DlItem.vue +35 -0
  65. package/src/components/DlItem/index.ts +2 -0
  66. package/src/components/DlItemSection.vue +88 -0
  67. package/src/components/DlLink/DlLink.vue +76 -0
  68. package/src/components/DlLink/index.ts +4 -0
  69. package/src/components/DlLink/utils.ts +4 -0
  70. package/src/components/DlList.vue +61 -0
  71. package/src/components/DlListItem/DlListItem.vue +205 -0
  72. package/src/components/DlListItem/index.ts +3 -0
  73. package/src/components/DlListItem/utils.ts +14 -0
  74. package/src/components/DlMenu/DlMenu.vue +438 -0
  75. package/src/components/DlMenu/index.ts +3 -0
  76. package/src/components/DlMenu/utils.ts +138 -0
  77. package/src/components/DlOptionGroup/DlOptionGroup.vue +201 -0
  78. package/src/components/DlOptionGroup/MenuItemWrapper.vue +48 -0
  79. package/src/components/DlOptionGroup/OptionGroup.types.ts +36 -0
  80. package/src/components/DlOptionGroup/SimpleWrapper.vue +28 -0
  81. package/src/components/DlOptionGroup/index.ts +4 -0
  82. package/src/components/DlOptionGroup/utils.ts +40 -0
  83. package/src/components/DlPagination/DlPagination.vue +184 -0
  84. package/src/components/DlPagination/PageNavigation.vue +350 -0
  85. package/src/components/DlPagination/PaginationLegend.vue +41 -0
  86. package/src/components/DlPagination/QuickNavigation.vue +146 -0
  87. package/src/components/DlPagination/RowsSelector.vue +74 -0
  88. package/src/components/DlPagination/index.ts +3 -0
  89. package/src/components/DlPanelContainer/DlPanel.vue +213 -0
  90. package/src/components/DlPanelContainer/DlPanelContainer.vue +527 -0
  91. package/src/components/DlPanelContainer/index.ts +4 -0
  92. package/src/components/DlPopup/DlPopup.vue +478 -0
  93. package/src/components/DlPopup/DraggableUpper.vue +64 -0
  94. package/src/components/DlPopup/PopupHeader.vue +129 -0
  95. package/src/components/DlPopup/index.ts +1 -0
  96. package/src/components/DlProgressBar.vue +159 -0
  97. package/src/components/DlProgressChart.vue +299 -0
  98. package/src/components/DlRadio.vue +218 -0
  99. package/src/components/DlRange/DlRange.vue +439 -0
  100. package/src/components/DlRange/utils.ts +209 -0
  101. package/src/components/DlSearch.vue +155 -0
  102. package/src/components/DlSelect/DlSelect.vue +992 -0
  103. package/src/components/DlSelect/SelectOption.vue +261 -0
  104. package/src/components/DlSelect/index.ts +4 -0
  105. package/src/components/DlSelect/utils.ts +43 -0
  106. package/src/components/DlSkeleton.vue +72 -0
  107. package/src/components/DlSlider/DlSlider.vue +243 -0
  108. package/src/components/DlSlider/components/DlSliderBase.vue +380 -0
  109. package/src/components/DlSlider/components/DlSliderInput.vue +123 -0
  110. package/src/components/DlSlider/components/index.ts +4 -0
  111. package/src/components/DlSlider/index.ts +3 -0
  112. package/src/components/DlSlider/sliderStyles.scss +109 -0
  113. package/src/components/DlSlider/useSlider.ts +277 -0
  114. package/src/components/DlSlider/utils.ts +7 -0
  115. package/src/components/DlSmartSearch/DlJsonEditor.vue +309 -0
  116. package/src/components/DlSmartSearch/DlSmartSearch.vue +333 -0
  117. package/src/components/DlSmartSearch/DlSmartSearchInput.vue +741 -0
  118. package/src/components/DlSmartSearch/DlSuggestionsDropdown.vue +73 -0
  119. package/src/components/DlSmartSearch/highlightSyntax.ts +169 -0
  120. package/src/components/DlSmartSearch/index.ts +4 -0
  121. package/src/components/DlSmartSearch/types.ts +36 -0
  122. package/src/components/DlSmartSearch/utils.ts +45 -0
  123. package/src/components/DlStepper/DlStepper.vue +196 -0
  124. package/src/components/DlStepper/DlStepperContainer.vue +55 -0
  125. package/src/components/DlStepper/DlStepperContent.vue +101 -0
  126. package/src/components/DlStepper/DlStepperFooter.vue +133 -0
  127. package/src/components/DlStepper/DlStepperHeader.vue +49 -0
  128. package/src/components/DlStepper/DlStepperSidebar.vue +167 -0
  129. package/src/components/DlStepper/Step.ts +101 -0
  130. package/src/components/DlStepper/Stepper.ts +107 -0
  131. package/src/components/DlStepper/index.ts +7 -0
  132. package/src/components/DlStepper/interfaces.ts +11 -0
  133. package/src/components/DlSwitch.vue +280 -0
  134. package/src/components/DlTabPanels/DlTabPanel.vue +22 -0
  135. package/src/components/DlTabPanels/DlTabPanels.vue +41 -0
  136. package/src/components/DlTabPanels/index.ts +4 -0
  137. package/src/components/DlTabPanels/utils.ts +19 -0
  138. package/src/components/DlTable/DlTable.vue +1264 -0
  139. package/src/components/DlTable/DlTd.vue +109 -0
  140. package/src/components/DlTable/DlTh.vue +126 -0
  141. package/src/components/DlTable/DlTr.vue +44 -0
  142. package/src/components/DlTable/ResizableManager.ts +233 -0
  143. package/src/components/DlTable/dl-table-styles.scss +466 -0
  144. package/src/components/DlTable/hooks/tableActions.ts +64 -0
  145. package/src/components/DlTable/hooks/tableColumnSelection.ts +112 -0
  146. package/src/components/DlTable/hooks/tableFilter.ts +42 -0
  147. package/src/components/DlTable/hooks/tablePagination.ts +197 -0
  148. package/src/components/DlTable/hooks/tableRowExpand.ts +55 -0
  149. package/src/components/DlTable/hooks/tableRowSelection.ts +106 -0
  150. package/src/components/DlTable/hooks/tableSort.ts +125 -0
  151. package/src/components/DlTable/index.ts +6 -0
  152. package/src/components/DlTable/types.ts +96 -0
  153. package/src/components/DlTabs/DlTab.vue +146 -0
  154. package/src/components/DlTabs/DlTabs.vue +192 -0
  155. package/src/components/DlTabs/TabsWrapper.vue +104 -0
  156. package/src/components/DlTabs/index.ts +4 -0
  157. package/src/components/DlTabs/types.ts +8 -0
  158. package/src/components/DlTextArea.vue +151 -0
  159. package/src/components/DlTextHolder.vue +65 -0
  160. package/src/components/DlTextInput.vue +753 -0
  161. package/src/components/DlThemeProvider.vue +41 -0
  162. package/src/components/DlTimePicker/DlTimeCounter.vue +81 -0
  163. package/src/components/DlTimePicker/DlTimePicker.vue +151 -0
  164. package/src/components/DlTimePicker/DlTimePickerInput.vue +311 -0
  165. package/src/components/DlTimePicker/index.ts +3 -0
  166. package/src/components/DlTimePicker/types.ts +4 -0
  167. package/src/components/DlTooltip.vue +456 -0
  168. package/src/components/DlTrend.vue +97 -0
  169. package/src/components/DlTypography.vue +87 -0
  170. package/src/components/DlVirtualScroll/DlVirtualScroll.vue +290 -0
  171. package/src/components/DlVirtualScroll/index.ts +3 -0
  172. package/src/components/DlVirtualScroll/useVirtualScroll.ts +833 -0
  173. package/src/components/DlWidget/DlWidget.vue +50 -0
  174. package/src/components/DlWidget/DlWidgetGrid.vue +360 -0
  175. package/src/components/DlWidget/index.ts +4 -0
  176. package/src/components/DlWidget/types.ts +6 -0
  177. package/src/components/DlWidget/utils.ts +30 -0
  178. package/src/components/index.ts +118 -0
  179. package/src/demo/DlAccordionDemo.vue +60 -0
  180. package/src/demo/DlAlertDemo.vue +54 -0
  181. package/src/demo/DlAvatarDemo.vue +43 -0
  182. package/src/demo/DlBadgeDemo.vue +65 -0
  183. package/src/demo/DlButtonDemo.vue +266 -0
  184. package/src/demo/DlCheckboxDemo.vue +50 -0
  185. package/src/demo/DlChipDemo.vue +181 -0
  186. package/src/demo/DlColorPickerDemo.vue +43 -0
  187. package/src/demo/DlCounterDemo.vue +53 -0
  188. package/src/demo/DlDateTimeRangeDemo.vue +217 -0
  189. package/src/demo/DlDialogBoxDemo.vue +175 -0
  190. package/src/demo/DlDropdownButtonDemo.vue +260 -0
  191. package/src/demo/DlIconDemo.vue +47 -0
  192. package/src/demo/DlLinkDemo.vue +23 -0
  193. package/src/demo/DlListDemo.vue +177 -0
  194. package/src/demo/DlMenuDemo.vue +524 -0
  195. package/src/demo/DlOptionGroupDemo.vue +79 -0
  196. package/src/demo/DlPaginationDemo.vue +44 -0
  197. package/src/demo/DlPanelContainerDemo.vue +221 -0
  198. package/src/demo/DlPopupDemo.vue +58 -0
  199. package/src/demo/DlProgressBarDemo.vue +22 -0
  200. package/src/demo/DlProgressChartDemo.vue +71 -0
  201. package/src/demo/DlRadioDemo.vue +35 -0
  202. package/src/demo/DlRangeDemo.vue +44 -0
  203. package/src/demo/DlSearchDemo.vue +27 -0
  204. package/src/demo/DlSelectDemo.vue +355 -0
  205. package/src/demo/DlSkeletonDemo.vue +20 -0
  206. package/src/demo/DlSliderDemo.vue +47 -0
  207. package/src/demo/DlStepperDemo/CenteredStepperInDialogBox.vue +260 -0
  208. package/src/demo/DlStepperDemo/SimpleStepper.vue +202 -0
  209. package/src/demo/DlStepperDemo/StepperInDialogBox.vue +261 -0
  210. package/src/demo/DlStepperDemo/index.ts +5 -0
  211. package/src/demo/DlStepperDemo/steps/AssignmentsStep.vue +97 -0
  212. package/src/demo/DlStepperDemo/steps/DataStep.vue +158 -0
  213. package/src/demo/DlStepperDemo/steps/GeneralStep.vue +106 -0
  214. package/src/demo/DlStepperDemo/steps/InstructionStep.vue +176 -0
  215. package/src/demo/DlStepperDemo/steps/QualityStep.vue +65 -0
  216. package/src/demo/DlSwitchDemo.vue +49 -0
  217. package/src/demo/DlTableDemo.vue +475 -0
  218. package/src/demo/DlTabsDemo.vue +67 -0
  219. package/src/demo/DlTdDemo.vue +19 -0
  220. package/src/demo/DlTextAreaDemo.vue +37 -0
  221. package/src/demo/DlTextHolderDemo.vue +42 -0
  222. package/src/demo/DlTextInputDemo.vue +89 -0
  223. package/src/demo/DlThDemo.vue +32 -0
  224. package/src/demo/DlTooltipDemo.vue +60 -0
  225. package/src/demo/DlTrDemo.vue +18 -0
  226. package/src/demo/DlTrendDemo.vue +25 -0
  227. package/src/demo/DlTypographyDemo.vue +93 -0
  228. package/src/demo/DlWidgetDemo.vue +157 -0
  229. package/src/demo/SmartSearchDemo/DlSmartSearchDemo.vue +202 -0
  230. package/src/demo/SmartSearchDemo/schema.ts +44 -0
  231. package/src/demo/index.ts +141 -0
  232. package/src/directives/TouchPan.ts +525 -0
  233. package/src/env.d.ts +8 -0
  234. package/src/hooks/use-anchor.ts +223 -0
  235. package/src/hooks/use-model-toggle.ts +181 -0
  236. package/src/hooks/use-portal.ts +104 -0
  237. package/src/hooks/use-scroll-target.ts +53 -0
  238. package/src/hooks/use-size-observer.ts +24 -0
  239. package/src/hooks/use-suggestions.ts +355 -0
  240. package/src/hooks/use-tick.ts +32 -0
  241. package/src/hooks/use-timeout.ts +20 -0
  242. package/src/hooks/use-transition.ts +32 -0
  243. package/src/hooks/use-window-size.ts +25 -0
  244. package/src/hooks/useForm.ts +12 -0
  245. package/src/index.ts +7 -0
  246. package/src/main.ts +4 -0
  247. package/src/models.ts +4 -0
  248. package/src/types.ts +6 -0
  249. package/src/utils/calcs.ts +18 -0
  250. package/src/utils/click-outside.ts +108 -0
  251. package/src/utils/component-name-parser.ts +1 -0
  252. package/src/utils/css-color-names.ts +150 -0
  253. package/src/utils/dom.ts +55 -0
  254. package/src/utils/draggable-table.ts +416 -0
  255. package/src/utils/escape-key.ts +54 -0
  256. package/src/utils/events.ts +67 -0
  257. package/src/utils/focus-manager.ts +33 -0
  258. package/src/utils/focusout.ts +29 -0
  259. package/src/utils/format.ts +3 -0
  260. package/src/utils/getColor.ts +17 -0
  261. package/src/utils/getLighterGradient.ts +36 -0
  262. package/src/utils/getRootStyles.ts +52 -0
  263. package/src/utils/global-config.ts +6 -0
  264. package/src/utils/global-nodes.ts +42 -0
  265. package/src/utils/includes.ts +3 -0
  266. package/src/utils/index.ts +29 -0
  267. package/src/utils/inject-object-prop.ts +21 -0
  268. package/src/utils/input-sizes.ts +7 -0
  269. package/src/utils/is-ellipsis-active.ts +3 -0
  270. package/src/utils/is-in-viewport.ts +13 -0
  271. package/src/utils/is.ts +15 -0
  272. package/src/utils/key-composition.ts +17 -0
  273. package/src/utils/keyCodes.ts +12 -0
  274. package/src/utils/logger/ConsoleLogger.ts +65 -0
  275. package/src/utils/logger/ILogger.ts +8 -0
  276. package/src/utils/logger/index.ts +8 -0
  277. package/src/utils/nav-keys-constants.ts +1 -0
  278. package/src/utils/portal.ts +55 -0
  279. package/src/utils/position-engine.ts +381 -0
  280. package/src/utils/render.ts +36 -0
  281. package/src/utils/ripple.ts +7 -0
  282. package/src/utils/scroll.ts +73 -0
  283. package/src/utils/selection.ts +15 -0
  284. package/src/utils/sort.ts +7 -0
  285. package/src/utils/splitByQuotes.ts +32 -0
  286. package/src/utils/string.ts +6 -0
  287. package/src/utils/teleport.ts +14 -0
  288. package/src/utils/theme.ts +2 -0
  289. package/src/utils/vm.ts +16 -0
  290. package/storybook.js +8 -0
  291. package/tsconfig.json +44 -0
  292. package/tsconfig.node.json +8 -0
  293. package/types.ts +1 -0
  294. package/vite.config.ts +13 -0
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <div class="root-container">
3
+ <slot />
4
+ </div>
5
+ </template>
6
+
7
+ <script lang="ts">
8
+ import { defineComponent } from 'vue-demi'
9
+
10
+ export default defineComponent({
11
+ name: 'DlDialogBoxFooter'
12
+ })
13
+ </script>
14
+
15
+ <style lang="scss" scoped>
16
+ .root-container {
17
+ display: flex;
18
+ width: 100%;
19
+ align-items: flex-start;
20
+ justify-content: flex-end;
21
+ }
22
+ </style>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <div class="root-container">
3
+ <div>
4
+ <dl-button
5
+ v-if="hasBackButton"
6
+ label="Back"
7
+ icon="icon-dl-arrow-left"
8
+ flat
9
+ text-color="dl-color-medium"
10
+ style="padding: 0; margin-bottom: 10px"
11
+ @click.stop.prevent="$emit('onClose')"
12
+ />
13
+ <h2 class="title">
14
+ {{ title }}
15
+ </h2>
16
+ <p class="subtitle">
17
+ {{ subtitle }}
18
+ </p>
19
+ </div>
20
+ <dl-button
21
+ v-if="closeButton"
22
+ class="close-button"
23
+ icon="icon-dl-close"
24
+ size="s"
25
+ flat
26
+ text-color="dl-color-darker"
27
+ @click="$emit('onClose')"
28
+ />
29
+ </div>
30
+ </template>
31
+
32
+ <script lang="ts">
33
+ import { defineComponent } from 'vue-demi'
34
+ import { DlButton } from '../DlButton'
35
+
36
+ export default defineComponent({
37
+ name: 'DlDialogBoxHeader',
38
+ components: {
39
+ DlButton
40
+ },
41
+ props: {
42
+ title: { type: String, default: '' },
43
+ subtitle: { type: String, default: '' },
44
+ closeButton: { type: Boolean, default: true },
45
+ hasBackButton: Boolean
46
+ },
47
+ emits: ['onClose']
48
+ })
49
+ </script>
50
+
51
+ <style lang="scss" scoped>
52
+ .root-container {
53
+ display: flex;
54
+ width: 100%;
55
+ align-items: flex-start;
56
+ justify-content: space-between;
57
+ }
58
+
59
+ .title {
60
+ font-size: var(--dl-font-size-h2);
61
+ margin: 0;
62
+ color: var(--dl-color-darker);
63
+ }
64
+
65
+ .subtitle {
66
+ font-size: var(--dl-font-size-body);
67
+ margin: 3px 0 0 0;
68
+ color: var(--dl-color-medium);
69
+ }
70
+
71
+ .close-button {
72
+ margin-right: -6px;
73
+ margin-top: -6px;
74
+ }
75
+ </style>
@@ -0,0 +1,5 @@
1
+ import DlDialogBox from './DlDialogBox.vue'
2
+ import DlDialogBoxHeader from './DlDialogBoxHeader.vue'
3
+ import DlDialogBoxFooter from './DlDialogBoxFooter.vue'
4
+
5
+ export { DlDialogBox, DlDialogBoxHeader, DlDialogBoxFooter }
@@ -0,0 +1,463 @@
1
+ <template>
2
+ <dl-button-group
3
+ v-if="split"
4
+ :id="uuid"
5
+ :class="identifierClass"
6
+ class="dl-btn-dropdown dl-btn-dropdown--split no-wrap dl-btn-item"
7
+ :outlined="outlined"
8
+ :flat="flat"
9
+ :stretch="stretch"
10
+ >
11
+ <dl-button
12
+ class="dl-btn-dropdown--current"
13
+ :style="mainBtnStyle"
14
+ :label="label"
15
+ :outlined="outlined"
16
+ :size="size"
17
+ :flat="flat"
18
+ :disabled="disabled === true || disableMainBtn === true"
19
+ :max-width="maxWidth"
20
+ :color="color"
21
+ :icon="icon"
22
+ :uppercase="uppercase"
23
+ :text-color="textColor"
24
+ no-wrap
25
+ :aria-expanded="showing === true ? 'true' : 'false'"
26
+ :aria-haspopup="true"
27
+ :aria-disabled="
28
+ disabled === true ||
29
+ (split === false && disableMainBtn === true) ||
30
+ disableDropdown === true
31
+ "
32
+ @click="onClickHide"
33
+ />
34
+ <dl-button
35
+ class="dl-btn-dropdown__arrow-container"
36
+ :style="btnCSSStyles"
37
+ :disabled="disabled === true || disableDropdown === true"
38
+ :outlined="outlined"
39
+ :flat="flat"
40
+ :size="size"
41
+ :color="color"
42
+ :text-color="textColor"
43
+ :aria-expanded="showing"
44
+ :aria-haspopup="true"
45
+ :aria-disabled="
46
+ disabled === true ||
47
+ (split === false && disableMainBtn === true) ||
48
+ disableDropdown === true
49
+ "
50
+ >
51
+ <div
52
+ class="dl-btn-dropdown--separator"
53
+ :style="`
54
+ background-color: ${
55
+ disabled
56
+ ? 'var(--dl-color-disabled)'
57
+ : outlined && !textColor
58
+ ? 'var(--dl-color-secondary)'
59
+ : textColor || 'var(--dl-color-white)'
60
+ }`"
61
+ />
62
+ <dl-icon
63
+ :class="iconClass"
64
+ :icon="dropdownIcon"
65
+ :size="iconSize"
66
+ :color="
67
+ disabled
68
+ ? 'dl-color-disabled'
69
+ : outlined && !textColor
70
+ ? 'dl-color-secondary'
71
+ : textColor || 'dl-color-white'
72
+ "
73
+ />
74
+ </dl-button>
75
+ <dl-menu
76
+ ref="menuRef"
77
+ v-model="menuModel"
78
+ :class="contentClass"
79
+ :style="contentStyle"
80
+ :cover="cover"
81
+ fit
82
+ :persistent="persistent"
83
+ :auto-close="autoClose"
84
+ :anchor="menuAnchor"
85
+ :self="menuSelf"
86
+ :offset="menuOffset"
87
+ separate-close-popup
88
+ :disabled="disabled"
89
+ :max-height="maxHeight"
90
+ @before-show="onBeforeShow"
91
+ @show="onShow"
92
+ @before-hide="onBeforeHide"
93
+ @hide="onHide"
94
+ >
95
+ <slot />
96
+ </dl-menu>
97
+ </dl-button-group>
98
+ <dl-button
99
+ v-else
100
+ class="dl-btn-dropdown dl-btn-dropdown--simple"
101
+ v-bind="$props"
102
+ label=""
103
+ :aria-expanded="showing"
104
+ :aria-haspopup="true"
105
+ :aria-disabled="
106
+ disabled === true ||
107
+ (split === false && disableMainBtn === true) ||
108
+ disableDropdown === true
109
+ "
110
+ :disabled="disabled === true || disableMainBtn === true"
111
+ :style="mainBtnStyle"
112
+ no-wrap
113
+ @click="onClick"
114
+ >
115
+ <div
116
+ style="
117
+ display: flex;
118
+ align-items: center;
119
+ justify-content: space-around;
120
+ "
121
+ >
122
+ <span style="margin-right: 5px">
123
+ {{ label }}
124
+ </span>
125
+ <dl-icon
126
+ :class="iconClass"
127
+ :icon="dropdownIcon"
128
+ :size="iconSize"
129
+ :color="
130
+ disabled
131
+ ? 'dl-color-disabled'
132
+ : outlined && !textColor
133
+ ? 'dl-color-secondary'
134
+ : textColor || 'dl-color-white'
135
+ "
136
+ />
137
+ </div>
138
+
139
+ <dl-menu
140
+ ref="menuRef"
141
+ v-model="menuModel"
142
+ :class="contentClass"
143
+ :style="contentStyle"
144
+ :cover="cover"
145
+ fit
146
+ :persistent="persistent"
147
+ :auto-close="autoClose"
148
+ :anchor="menuAnchor"
149
+ :self="menuSelf"
150
+ :offset="menuOffset"
151
+ separate-close-popup
152
+ :disabled="disabled"
153
+ :max-height="maxHeight"
154
+ @before-show="onBeforeShow"
155
+ @show="onShow"
156
+ @before-hide="onBeforeHide"
157
+ @hide="onHide"
158
+ >
159
+ <slot />
160
+ </dl-menu>
161
+ </dl-button>
162
+ </template>
163
+
164
+ <script lang="ts">
165
+ import DlIcon from './DlIcon.vue'
166
+ import { DlButton } from './DlButton'
167
+ import DlButtonGroup from './DlButtonGroup.vue'
168
+ import { DlMenu } from './DlMenu'
169
+ import { stop } from '../utils/events'
170
+ import {
171
+ defineComponent,
172
+ ref,
173
+ computed,
174
+ watch,
175
+ onMounted,
176
+ getCurrentInstance
177
+ } from 'vue-demi'
178
+ import { v4 } from 'uuid'
179
+
180
+ export default defineComponent({
181
+ name: 'DlDropdownButton',
182
+ components: {
183
+ DlMenu,
184
+ DlIcon,
185
+ DlButton,
186
+ DlButtonGroup
187
+ },
188
+ model: {
189
+ prop: 'modelValue',
190
+ event: 'update:model-value'
191
+ },
192
+ props: {
193
+ 'onUpdate:modelValue': [Function, Array],
194
+ modelValue: Boolean,
195
+ split: Boolean,
196
+ dropdownIcon: { type: String, default: 'icon-dl-down-chevron' },
197
+ contentClass: { type: [Array, String, Object], default: '' },
198
+ contentStyle: { type: [Array, String, Object], default: '' },
199
+ mainBtnStyle: { type: [Array, String, Object], default: '' },
200
+ cover: Boolean,
201
+ maxWidth: { type: String, default: null },
202
+ maxHeight: { type: String, default: null },
203
+ persistent: Boolean,
204
+ stretch: Boolean,
205
+ autoClose: Boolean,
206
+ menuAnchor: {
207
+ type: String,
208
+ default: 'bottom end'
209
+ },
210
+ menuSelf: {
211
+ type: String,
212
+ default: 'top end'
213
+ },
214
+ menuOffset: { type: Array, default: () => [0, 0] },
215
+ disableMainBtn: Boolean,
216
+ disableDropdown: Boolean,
217
+ noIconAnimation: Boolean,
218
+ disabled: Boolean,
219
+ color: { type: String!, default: '' },
220
+ label: { type: String, default: '' },
221
+ textColor: { type: String!, default: '' },
222
+ size: { type: String, default: 'm' },
223
+ contained: { type: Boolean, default: true },
224
+ fluid: Boolean,
225
+ icon: { type: String, required: false, default: '' },
226
+ iconSize: { type: String, required: false, default: '20px' },
227
+ flat: Boolean,
228
+ uppercase: Boolean,
229
+ outlined: Boolean,
230
+ padding: { type: String, default: '5px' }
231
+ },
232
+ emits: [
233
+ 'update:model-value',
234
+ 'update:modelValue',
235
+ 'click',
236
+ 'before-show',
237
+ 'show',
238
+ 'before-hide',
239
+ 'hide'
240
+ ],
241
+
242
+ setup(props, { emit }) {
243
+ const vm = getCurrentInstance()
244
+ const proxy = vm!.proxy!
245
+
246
+ const showing = ref<boolean>(!!props.modelValue)
247
+ const menuRef = ref(null)
248
+
249
+ const attributes = computed(() => {
250
+ const acc: Record<string, string> = {
251
+ 'aria-expanded': showing.value === true ? 'true' : 'false',
252
+ 'aria-haspopup': 'true'
253
+ }
254
+
255
+ if (
256
+ props.disabled === true ||
257
+ (props.split === false && props.disableMainBtn === true) ||
258
+ props.disableDropdown === true
259
+ ) {
260
+ acc['aria-disabled'] = 'true'
261
+ }
262
+
263
+ return acc
264
+ })
265
+
266
+ const menuModel = computed({
267
+ get: () => props.modelValue,
268
+ set: (val) => emit('update:modelValue', val)
269
+ })
270
+
271
+ const iconClass = computed(() => {
272
+ return (
273
+ 'dl-btn-dropdown__arrow' +
274
+ (showing.value === true && props.noIconAnimation === false
275
+ ? ' rotate-180'
276
+ : '') +
277
+ (props.split === false
278
+ ? ' dl-btn-dropdown__arrow-container'
279
+ : '')
280
+ )
281
+ })
282
+
283
+ const btnCSSStyles = computed(() => {
284
+ return {
285
+ '--dl-btn-border-left': props.outlined
286
+ ? 'none'
287
+ : 'var(--dl-color-white)'
288
+ }
289
+ })
290
+
291
+ watch(
292
+ () => props.modelValue,
293
+ (val) => {
294
+ if (menuRef.value) {
295
+ (menuRef!.value as Record<string, Function>)[
296
+ val ? 'show' : 'hide'
297
+ ]()
298
+ }
299
+ }
300
+ )
301
+
302
+ watch(() => props.split, hide)
303
+
304
+ function onBeforeShow(e: Event) {
305
+ showing.value = true
306
+ emit('before-show', e)
307
+ }
308
+
309
+ function onShow(e: Event) {
310
+ emit('show', e)
311
+ emit('update:modelValue', true)
312
+ }
313
+
314
+ function onBeforeHide(e: Event) {
315
+ showing.value = false
316
+ emit('before-hide', e)
317
+ }
318
+
319
+ function onHide(e: Event) {
320
+ emit('hide', e)
321
+ emit('update:modelValue', false)
322
+ }
323
+
324
+ function onClick(e: Event) {
325
+ emit('click', e)
326
+ }
327
+
328
+ function onClickHide(e: Event) {
329
+ stop(e)
330
+ hide(e)
331
+ emit('click', e)
332
+ }
333
+
334
+ function toggle(evt: Event) {
335
+ if (menuRef.value) {
336
+ (menuRef.value as Record<string, Function>).toggle(evt)
337
+ }
338
+ }
339
+
340
+ function show(evt?: Event) {
341
+ if (menuRef.value) {
342
+ (menuRef.value as Record<string, Function>).show(evt)
343
+ }
344
+ }
345
+
346
+ function hide(evt?: any) {
347
+ if (menuRef.value) {
348
+ (menuRef.value as Record<string, Function>).hide(evt)
349
+ }
350
+ }
351
+
352
+ // expose public methods
353
+ Object.assign(proxy, {
354
+ show,
355
+ hide,
356
+ toggle,
357
+ onClickHide,
358
+ onClick,
359
+ onBeforeShow,
360
+ onShow,
361
+ onBeforeHide,
362
+ onHide
363
+ })
364
+
365
+ onMounted(() => {
366
+ if (props.modelValue) {
367
+ show()
368
+ }
369
+ })
370
+
371
+ const identifierClass = computed(() => {
372
+ return `dl-dropdown-button-${props.label ?? ''}`.replaceAll(
373
+ ' ',
374
+ '-'
375
+ )
376
+ })
377
+
378
+ return {
379
+ uuid: `dl-dropdown-button-${v4()}`,
380
+ identifierClass,
381
+ iconClass,
382
+ menuRef,
383
+ attributes,
384
+ btnCSSStyles,
385
+ showing,
386
+ onBeforeShow,
387
+ onBeforeHide,
388
+ onShow,
389
+ onHide,
390
+ onClick,
391
+ onClickHide,
392
+ toggle,
393
+ show,
394
+ hide,
395
+ menuModel
396
+ }
397
+ }
398
+ })
399
+ </script>
400
+
401
+ <style scoped lang="scss">
402
+ .dl-btn-dropdown {
403
+ padding-right: var(--dl-btn-padding-right) !important;
404
+ &--split .dl-btn-dropdown__arrow-container {
405
+ // padding: 0 4px;
406
+ ::v-deep .dl-button {
407
+ border-top-left-radius: 0 !important;
408
+ border-left-width: 0 !important;
409
+ border-bottom-left-radius: 0 !important;
410
+ padding-right: 10px;
411
+ padding-left: 10px;
412
+ &:hover:enabled:not(:active),
413
+ &:hover:enabled:active {
414
+ border-top-left-radius: 0 !important;
415
+ border-left-width: 0 !important;
416
+ border-bottom-left-radius: 0 !important;
417
+ }
418
+ &:active:not(:disabled) {
419
+ border-top-left-radius: 0 !important;
420
+ border-left-width: 0 !important;
421
+ border-bottom-left-radius: 0 !important;
422
+ }
423
+ }
424
+ }
425
+
426
+ &--separator {
427
+ position: absolute;
428
+ left: 0;
429
+ width: 1px;
430
+ height: 60%;
431
+ }
432
+
433
+ &--simple {
434
+ ::v-deep .dl-button-no-wrap {
435
+ padding-right: 8px;
436
+ }
437
+ }
438
+ &__arrow {
439
+ transition: transform 0.28s;
440
+ }
441
+ &--current {
442
+ flex-grow: 1;
443
+ ::v-deep .dl-button {
444
+ border-top-right-radius: 0 !important;
445
+ border-right-width: 0 !important;
446
+ border-bottom-right-radius: 0 !important;
447
+ &:hover:enabled:not(:active) {
448
+ border-top-right-radius: 0 !important;
449
+ border-right-width: 0 !important;
450
+ border-bottom-right-radius: 0 !important;
451
+ }
452
+ &:active:not(:disabled) {
453
+ border-top-right-radius: 0 !important;
454
+ border-right-width: 0 !important;
455
+ border-bottom-right-radius: 0 !important;
456
+ }
457
+ }
458
+ }
459
+ }
460
+ ::v-deep .dl-button-no-wrap {
461
+ flex-grow: 1;
462
+ }
463
+ </style>
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <div
3
+ v-if="!svg"
4
+ :id="uuid"
5
+ :style="inlineStyles"
6
+ @click="$emit('click', $event)"
7
+ >
8
+ <i
9
+ class="dl-icon"
10
+ :class="`${icon} ${externalIcon ? externalIconSource : ''}`"
11
+ aria-hidden="true"
12
+ role="presentation"
13
+ :style="cssIconVars"
14
+ >
15
+ {{ externalIcon ? icon : null }}
16
+ </i>
17
+ <slot />
18
+ </div>
19
+ <div
20
+ v-else
21
+ :id="uuid"
22
+ style="display: inline"
23
+ @click="$emit('click', $event)"
24
+ >
25
+ <div ref="svgIcon">
26
+ <div ref="childToReplace" />
27
+ </div>
28
+ </div>
29
+ </template>
30
+
31
+ <script lang="ts">
32
+ import { v4 } from 'uuid'
33
+ import { defineComponent } from 'vue-demi'
34
+ import { getColor, loggerFactory } from '../utils'
35
+
36
+ export default defineComponent({
37
+ name: 'DlIcon',
38
+ props: {
39
+ color: {
40
+ type: String,
41
+ default: null
42
+ },
43
+ icon: {
44
+ type: String,
45
+ required: true
46
+ },
47
+ size: {
48
+ type: String,
49
+ default: '12px'
50
+ },
51
+ svg: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ inline: {
56
+ type: Boolean,
57
+ default: true
58
+ },
59
+ svgSource: {
60
+ type: String,
61
+ default: null
62
+ }
63
+ },
64
+ emits: ['click'],
65
+ data() {
66
+ return {
67
+ uuid: `dl-icon-${v4()}`,
68
+ externalIconSource: 'material-icons',
69
+ logger_: loggerFactory('dl-icon')
70
+ }
71
+ },
72
+ computed: {
73
+ cssIconVars(): Record<string, string> {
74
+ return {
75
+ '--dl-icon-font-size': `${this.size}`,
76
+ '--dl-icon-color': this.color
77
+ ? // needed for now until the swap of DLBTN in OA
78
+ getColor(
79
+ this.color === 'secondary'
80
+ ? 'q-color-secondary'
81
+ : this.color,
82
+ 'dl-color-icon-default'
83
+ )
84
+ : 'inherit'
85
+ }
86
+ },
87
+ inlineStyles(): string {
88
+ return this.inline ? 'display: inline' : ''
89
+ },
90
+ // needed to allow external source of icons that do not use class based
91
+ externalIcon(): boolean {
92
+ return (
93
+ !this.icon.startsWith('icon-dl-') &&
94
+ !this.icon.startsWith('fas') &&
95
+ !this.icon.startsWith('fa-')
96
+ )
97
+ }
98
+ },
99
+ mounted() {
100
+ const possibleToLoadSvg = this.svg && this.icon && this.icon !== ''
101
+ if (possibleToLoadSvg) {
102
+ this.loadSvg()
103
+ }
104
+ },
105
+ methods: {
106
+ loadSvg() {
107
+ return new Promise<void>((resolve, reject) => {
108
+ const svgElement = new Image()
109
+ svgElement.setAttribute('height', this.size)
110
+ svgElement.setAttribute('width', this.size)
111
+
112
+ svgElement.onload = () => {
113
+ // @ts-ignore // In order to handle events and loading that occur mid unmounting.
114
+ if (this._isDestroyed || this._isBeingDestroyed) {
115
+ return
116
+ }
117
+ const container = this.$refs.svgIcon as HTMLDivElement
118
+ if (!container) {
119
+ reject(new Error('No Ref'))
120
+ return
121
+ }
122
+ container.setAttribute('height', this.size)
123
+ container.setAttribute('width', this.size)
124
+ container?.firstChild?.replaceWith(svgElement)
125
+ resolve()
126
+ }
127
+
128
+ try {
129
+ svgElement.src = this.svgSource
130
+ ? `${this.svgSource}/${this.icon}.svg`
131
+ : require(`@dataloop-ai/icons/docs/assets/${this.icon}.svg`)
132
+ } catch (e) {
133
+ reject(e)
134
+ }
135
+ })
136
+ }
137
+ }
138
+ })
139
+ </script>
140
+
141
+ <style scoped lang="scss">
142
+ .dl-icon {
143
+ display: inline-block;
144
+ color: var(--dl-icon-color);
145
+ font-size: var(--dl-icon-font-size);
146
+ }
147
+ </style>