@dataloop-ai/components 0.16.45 → 0.16.47

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 (145) hide show
  1. package/.eslintrc.js +2 -2
  2. package/package.json +10 -9
  3. package/src/App.vue +120 -58
  4. package/src/assets/globals.scss +2 -0
  5. package/src/components/basic/DlAlert/DlAlert.vue +1 -1
  6. package/src/components/basic/DlButton/DlButton.vue +13 -13
  7. package/src/components/basic/DlCard/DlCard.vue +234 -0
  8. package/src/components/basic/DlCard/index.ts +3 -0
  9. package/src/components/basic/DlCard/types.ts +20 -0
  10. package/src/components/basic/DlChip/DlChip.vue +1 -0
  11. package/src/components/basic/DlEllipsis/DlEllipsis.vue +90 -0
  12. package/src/components/basic/DlEllipsis/index.ts +2 -0
  13. package/src/components/basic/DlListItem/DlListItem.vue +11 -5
  14. package/src/components/basic/index.ts +2 -0
  15. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +8 -1
  16. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +22 -6
  17. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +542 -0
  18. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/index.ts +2 -0
  19. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/utils.ts +96 -0
  20. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +2 -2
  21. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +22 -6
  22. package/src/components/compound/DlCharts/charts/index.ts +1 -0
  23. package/src/components/compound/DlCharts/components/DlBrush.vue +8 -1
  24. package/src/components/compound/DlCharts/components/DlChartScrollBar.vue +34 -21
  25. package/src/components/compound/DlCharts/types/DlConfusionMatrix.types.ts +19 -0
  26. package/src/components/compound/DlCharts/types/index.ts +2 -1
  27. package/src/components/compound/DlCharts/types/props.ts +14 -0
  28. package/src/components/compound/DlDialogBox/DlDialogBox.vue +1 -1
  29. package/src/components/compound/DlDialogBox/components/DlDialogBoxFooter.vue +1 -0
  30. package/src/components/compound/DlDropdownButton/DlDropdownButton.vue +58 -12
  31. package/src/components/compound/DlInput/DlInput.vue +45 -23
  32. package/src/components/compound/DlJsonEditor/DlJsonEditor.vue +13 -29
  33. package/src/components/compound/DlPagination/DlPagination.vue +14 -4
  34. package/src/components/compound/DlPagination/components/PageNavigation.vue +24 -25
  35. package/src/components/compound/DlPagination/components/PaginationLegend.vue +2 -1
  36. package/src/components/compound/DlPagination/components/QuickNavigation.vue +1 -0
  37. package/src/components/compound/DlSearches/DlSmartSearch/DlSmartSearch.vue +86 -49
  38. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +86 -69
  39. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +43 -4
  40. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +1 -55
  41. package/src/components/compound/DlSearches/DlSmartSearch/utils/index.ts +42 -10
  42. package/src/components/compound/DlSearches/DlSmartSearch/utils/utils.ts +107 -0
  43. package/src/components/compound/DlSelect/DlSelect.vue +41 -8
  44. package/src/components/compound/DlTable/DlTable.vue +13 -10
  45. package/src/components/compound/DlTable/styles/dl-table-styles.scss +16 -4
  46. package/src/components/compound/DlToggleButton/DlToggleButton.vue +109 -0
  47. package/src/components/compound/DlToggleButton/config.ts +27 -0
  48. package/src/components/compound/DlToggleButton/index.ts +3 -0
  49. package/src/components/compound/DlToggleButton/types.ts +4 -0
  50. package/src/components/compound/index.ts +1 -0
  51. package/src/components/compound/types.ts +1 -0
  52. package/src/components/essential/DlColorPicker/DlColorPicker.vue +4 -1
  53. package/src/components/essential/DlColorPicker/components/DlColors.vue +2 -6
  54. package/src/components/essential/DlIcon/DlIcon.vue +5 -1
  55. package/src/components/essential/DlMenu/DlMenu.vue +30 -2
  56. package/src/components/essential/DlSeparator/DlSeparator.vue +66 -0
  57. package/src/components/essential/DlSeparator/index.ts +2 -0
  58. package/src/components/essential/DlSpinner/DlSpinner.vue +53 -217
  59. package/src/components/essential/DlSpinner/components/DlSpinnerCircle.vue +156 -0
  60. package/src/components/essential/DlSpinner/components/DlSpinnerClock.vue +191 -0
  61. package/src/components/essential/DlSpinner/components/DlSpinnerDots.vue +225 -0
  62. package/src/components/essential/DlSpinner/components/DlSpinnerGrid.vue +278 -0
  63. package/src/components/essential/DlSpinner/components/DlSpinnerLogo.vue +264 -0
  64. package/src/components/essential/DlSpinner/index.ts +14 -1
  65. package/src/components/essential/DlSpinner/types.ts +7 -0
  66. package/src/components/essential/index.ts +1 -0
  67. package/src/components/essential/types.ts +1 -0
  68. package/src/components/shared/DlItemSection/DlItemSection.vue +21 -15
  69. package/src/components/shared/DlVirtualScroll/DlVirtualScroll.vue +36 -21
  70. package/src/components/shared/DlVirtualScroll/useVirtualScroll.ts +8 -10
  71. package/src/{demo → demos}/DlButtonDemo.vue +15 -0
  72. package/src/demos/DlCardDemo.vue +47 -0
  73. package/src/{demo → demos}/DlColorPickerDemo.vue +16 -1
  74. package/src/demos/DlConfusionMatrixDemo.vue +53 -0
  75. package/src/{demo → demos}/DlDialogBoxDemo.vue +4 -1
  76. package/src/demos/DlDropdownButtonDemo.vue +386 -0
  77. package/src/demos/DlEllipsisDemo.vue +30 -0
  78. package/src/{demo → demos}/DlLineChartDemo.vue +8 -8
  79. package/src/{demo → demos}/DlMenuDemo.vue +61 -2
  80. package/src/{demo → demos}/DlSearchDemo.vue +3 -2
  81. package/src/demos/DlSeparatorDemo.vue +44 -0
  82. package/src/demos/DlSpinnerDemo.vue +59 -0
  83. package/src/{demo → demos}/DlTableDemo.vue +117 -29
  84. package/src/demos/DlToggleButtonDemo.vue +55 -0
  85. package/src/{demo → demos}/DlTooltipDemo.vue +43 -2
  86. package/src/{demo → demos}/DlWidgetDemo.vue +34 -19
  87. package/src/{demo → demos}/SmartSearchDemo/DlSmartSearchDemo.vue +2 -50
  88. package/src/{demo → demos}/index.ts +14 -56
  89. package/src/hooks/use-arrow-navigation.ts +58 -0
  90. package/src/hooks/use-suggestions.ts +97 -74
  91. package/src/utils/colors.ts +1 -1
  92. package/src/utils/draggable-table.ts +2 -2
  93. package/src/utils/index.ts +1 -0
  94. package/src/utils/parse-smart-query.ts +87 -0
  95. package/src/components/compound/DlCharts/types.ts +0 -1
  96. package/src/demo/DlDropdownButtonDemo.vue +0 -260
  97. package/src/demo/DlSpinnerDemo.vue +0 -20
  98. /package/src/{demo → demos}/BarChartDemo.vue +0 -0
  99. /package/src/{demo → demos}/ColumnChartDemo.vue +0 -0
  100. /package/src/{demo → demos}/DlAccordionDemo.vue +0 -0
  101. /package/src/{demo → demos}/DlAlertDemo.vue +0 -0
  102. /package/src/{demo → demos}/DlAvatarDemo.vue +0 -0
  103. /package/src/{demo → demos}/DlBadgeDemo.vue +0 -0
  104. /package/src/{demo → demos}/DlChartDoughnutDemo.vue +0 -0
  105. /package/src/{demo → demos}/DlCheckboxDemo.vue +0 -0
  106. /package/src/{demo → demos}/DlChipDemo.vue +0 -0
  107. /package/src/{demo → demos}/DlCounterDemo.vue +0 -0
  108. /package/src/{demo → demos}/DlDateTimeRangeDemo.vue +0 -0
  109. /package/src/{demo → demos}/DlIconDemo.vue +0 -0
  110. /package/src/{demo → demos}/DlInputDemo.vue +0 -0
  111. /package/src/{demo → demos}/DlKpiDemo.vue +0 -0
  112. /package/src/{demo → demos}/DlLinkDemo.vue +0 -0
  113. /package/src/{demo → demos}/DlListDemo.vue +0 -0
  114. /package/src/{demo → demos}/DlOptionGroupDemo.vue +0 -0
  115. /package/src/{demo → demos}/DlPaginationDemo.vue +0 -0
  116. /package/src/{demo → demos}/DlPanelContainerDemo.vue +0 -0
  117. /package/src/{demo → demos}/DlPopupDemo.vue +0 -0
  118. /package/src/{demo → demos}/DlProgressBarDemo.vue +0 -0
  119. /package/src/{demo → demos}/DlProgressChartDemo.vue +0 -0
  120. /package/src/{demo → demos}/DlRadioDemo.vue +0 -0
  121. /package/src/{demo → demos}/DlRangeDemo.vue +0 -0
  122. /package/src/{demo → demos}/DlSelectDemo.vue +0 -0
  123. /package/src/{demo → demos}/DlSkeletonDemo.vue +0 -0
  124. /package/src/{demo → demos}/DlSliderDemo.vue +0 -0
  125. /package/src/{demo → demos}/DlStepperDemo/CenteredStepperInDialogBox.vue +0 -0
  126. /package/src/{demo → demos}/DlStepperDemo/DlStepperDemo.vue +0 -0
  127. /package/src/{demo → demos}/DlStepperDemo/SimpleStepper.vue +0 -0
  128. /package/src/{demo → demos}/DlStepperDemo/StepperInDialogBox.vue +0 -0
  129. /package/src/{demo → demos}/DlStepperDemo/index.ts +0 -0
  130. /package/src/{demo → demos}/DlStepperDemo/steps/AssignmentsStep.vue +0 -0
  131. /package/src/{demo → demos}/DlStepperDemo/steps/DataStep.vue +0 -0
  132. /package/src/{demo → demos}/DlStepperDemo/steps/GeneralStep.vue +0 -0
  133. /package/src/{demo → demos}/DlStepperDemo/steps/InstructionStep.vue +0 -0
  134. /package/src/{demo → demos}/DlStepperDemo/steps/QualityStep.vue +0 -0
  135. /package/src/{demo → demos}/DlSwitchDemo.vue +0 -0
  136. /package/src/{demo → demos}/DlTabsDemo.vue +0 -0
  137. /package/src/{demo → demos}/DlTdDemo.vue +0 -0
  138. /package/src/{demo → demos}/DlTextAreaDemo.vue +0 -0
  139. /package/src/{demo → demos}/DlTextHolderDemo.vue +0 -0
  140. /package/src/{demo → demos}/DlThDemo.vue +0 -0
  141. /package/src/{demo → demos}/DlToastDemo.vue +0 -0
  142. /package/src/{demo → demos}/DlTrDemo.vue +0 -0
  143. /package/src/{demo → demos}/DlTrendDemo.vue +0 -0
  144. /package/src/{demo → demos}/DlTypographyDemo.vue +0 -0
  145. /package/src/{demo → demos}/SmartSearchDemo/schema.ts +0 -0
@@ -58,12 +58,13 @@
58
58
  v-if="hasVirtScroll"
59
59
  ref="virtScrollRef"
60
60
  :class="tableClass"
61
+ :draggable-classes="additionalClasses"
61
62
  :style="tableStyle"
62
63
  :scroll-target="virtualScrollTarget"
63
64
  :items="computedRows"
64
- :on-virtual-scroll="onVScroll"
65
65
  :table-colspan="computedColspan"
66
66
  v-bind="virtProps"
67
+ @virtual-scroll="onVScroll"
67
68
  >
68
69
  <template #before>
69
70
  <thead>
@@ -144,16 +145,18 @@
144
145
  <DlTr
145
146
  :key="getRowKey(props.item)"
146
147
  :class="
147
- isRowSelected(getRowKey(row))
148
+ isRowSelected(getRowKey(props.item))
148
149
  ? 'selected'
149
150
  : hasAnyAction
150
151
  ? ' cursor-pointer'
151
152
  : ''
152
153
  "
153
154
  :no-hover="noHover"
154
- @click="onTrClick($event, row, pageIndex)"
155
- @dblclick="onTrDblClick($event, row, pageIndex)"
156
- @contextmenu="onTrContextMenu($event, row, pageIndex)"
155
+ @click="onTrClick($event, props.item, pageIndex)"
156
+ @dblclick="onTrDblClick($event, props.item, pageIndex)"
157
+ @contextmenu="
158
+ onTrContextMenu($event, props.item, pageIndex)
159
+ "
157
160
  >
158
161
  <td v-if="hasDraggableRows">
159
162
  <dl-icon
@@ -302,7 +305,7 @@
302
305
  </tr>
303
306
  </slot>
304
307
  </thead>
305
- <tbody>
308
+ <tbody id="draggable">
306
309
  <slot
307
310
  name="top-row"
308
311
  :cols="computedCols"
@@ -723,7 +726,7 @@ export default defineComponent({
723
726
 
724
727
  onMounted(() => {
725
728
  tableEl = (rootRef.value as HTMLDivElement).querySelector(
726
- '.dl-table'
729
+ 'table.dl-table'
727
730
  ) as HTMLTableElement
728
731
  resizableManager = new ResizableManager()
729
732
 
@@ -753,7 +756,7 @@ export default defineComponent({
753
756
  hasVirtScroll,
754
757
  () => {
755
758
  tableEl = (rootRef.value as HTMLDivElement).querySelector(
756
- '.dl-table'
759
+ 'table.dl-table'
757
760
  ) as HTMLTableElement
758
761
 
759
762
  if (props.resizable) {
@@ -1049,8 +1052,8 @@ export default defineComponent({
1049
1052
  acc[p] = (props as Record<string, any>)[p]
1050
1053
  })
1051
1054
 
1052
- if (acc.virtualScrollItemSize === void 0) {
1053
- acc.virtualScrollItemSize = props.dense === true ? 28 : 48
1055
+ if (!acc.virtualScrollItemSize) {
1056
+ acc.virtualScrollItemSize = props.dense === true ? 30 : 40
1054
1057
  }
1055
1058
 
1056
1059
  return acc
@@ -21,9 +21,11 @@
21
21
  }
22
22
 
23
23
  /* this is when the loading indicator appears */
24
- &.dl-table--loading thead tr:last-child th {
25
- /* height of all previous header rows */
26
- top: 40px;
24
+ &--loading {
25
+ thead tr:last-child th {
26
+ /* height of all previous header rows */
27
+ top: 38px;
28
+ }
27
29
  }
28
30
 
29
31
  th:first-child,
@@ -371,6 +373,7 @@
371
373
  */
372
374
 
373
375
  .dl-table--dense {
376
+
374
377
  .dl-table__top {
375
378
  position: relative;
376
379
  padding: 5px 16px;
@@ -385,6 +388,8 @@
385
388
  font-size: 80%;
386
389
  }
387
390
 
391
+
392
+
388
393
  .dl-table {
389
394
 
390
395
  th {
@@ -423,6 +428,13 @@
423
428
  }
424
429
  }
425
430
 
431
+ .dl-table--dense.dl-table--loading {
432
+ thead tr:last-child th {
433
+ /* height of all previous header rows */
434
+ top: 32px;
435
+ }
436
+ }
437
+
426
438
  /*
427
439
  * Separators
428
440
  */
@@ -463,4 +475,4 @@
463
475
  position: relative;
464
476
  border-bottom: 1px solid var(--dl-color-separator);
465
477
  }
466
- }
478
+ }
@@ -0,0 +1,109 @@
1
+ <template>
2
+ <div
3
+ :style="{ width }"
4
+ class="container"
5
+ >
6
+ <dl-button
7
+ v-for="(btn, idx) in toggleButtons"
8
+ :key="idx"
9
+ :styles="
10
+ getStyles(btn.value === scopedValue, hoverBtn === btn.value)
11
+ "
12
+ data-test="button"
13
+ fluid
14
+ @mouseenter="hoverBtn = btn.value"
15
+ @mouseleave="hoverBtn = null"
16
+ @click="value = btn.value"
17
+ >
18
+ <span v-if="!$slots.button && !$slots[`button-${idx}`]">
19
+ {{ btn.label }}
20
+ </span>
21
+ <slot
22
+ :label="btn.label"
23
+ :name="`button-${idx}`"
24
+ />
25
+ <slot
26
+ :label="btn.label"
27
+ name="button"
28
+ />
29
+ </dl-button>
30
+ </div>
31
+ </template>
32
+
33
+ <script lang="ts">
34
+ import { defineComponent } from 'vue-demi'
35
+ import { DlToggleButtonOption } from './types'
36
+ import { DlButton } from '../../basic'
37
+ import { ButtonsStyles } from './config'
38
+
39
+ export default defineComponent({
40
+ name: 'DlToggleButton',
41
+ components: { DlButton },
42
+ model: {
43
+ prop: 'modelValue',
44
+ event: 'update:model-value'
45
+ },
46
+ props: {
47
+ width: {
48
+ type: String,
49
+ default: '100%'
50
+ },
51
+ modelValue: {
52
+ type: [String, Number],
53
+ default: null
54
+ },
55
+ options: {
56
+ type: Array as () => DlToggleButtonOption[],
57
+ required: true
58
+ }
59
+ },
60
+ emits: ['update:modelValue', 'change'],
61
+ data: () => ({
62
+ scopedValue: null as string | number,
63
+ hoverBtn: null as string | number
64
+ }),
65
+ computed: {
66
+ value: {
67
+ get(): string | number | null {
68
+ return this.modelValue
69
+ },
70
+ set(value: string | number) {
71
+ this.$emit('change', value)
72
+ let buttonValue
73
+ if (this.scopedValue !== value) {
74
+ buttonValue = value
75
+ } else {
76
+ buttonValue = null
77
+ }
78
+ this.scopedValue = buttonValue
79
+ this.$emit('update:modelValue', buttonValue)
80
+ }
81
+ },
82
+ toggleButtons(): DlToggleButtonOption[] {
83
+ return this.options.slice(0, 3)
84
+ }
85
+ },
86
+ created() {
87
+ this.scopedValue = this.value
88
+ },
89
+ methods: {
90
+ getStyles(activeBtn: boolean, hovered: boolean) {
91
+ if (activeBtn) {
92
+ return ButtonsStyles.activeStyles
93
+ } else if (hovered) {
94
+ return ButtonsStyles.hoverStyles
95
+ } else {
96
+ return ButtonsStyles.nonActiveStyles
97
+ }
98
+ }
99
+ }
100
+ })
101
+ </script>
102
+
103
+ <style lang="scss" scoped>
104
+ .container {
105
+ display: inline-flex;
106
+ border-radius: 2px;
107
+ overflow: hidden;
108
+ }
109
+ </style>
@@ -0,0 +1,27 @@
1
+ const generalStyles = {
2
+ padding: '7px 10px',
3
+ height: '28px',
4
+ fontSize: 'var(--dl-font-size-body)',
5
+ borderRadius: '0'
6
+ }
7
+
8
+ export const ButtonsStyles = Object.freeze({
9
+ nonActiveStyles: {
10
+ ...generalStyles,
11
+ color: 'var(--dl-color-darker)',
12
+ borderColor: 'var(--dl-color-separator)',
13
+ background: 'var(--dl-color-bg)'
14
+ },
15
+ activeStyles: {
16
+ ...generalStyles,
17
+ color: 'var(--dl-color-secondary)',
18
+ borderColor: 'var(--dl-color-secondary)',
19
+ background: 'var(--dl-color-secondary-opaque)'
20
+ },
21
+ hoverStyles: {
22
+ ...generalStyles,
23
+ color: 'var(--dl-color-hover)',
24
+ borderColor: 'var(--dl-color-hover)',
25
+ background: 'var(--dl-color-bg)'
26
+ }
27
+ })
@@ -0,0 +1,3 @@
1
+ import DlToggleButton from './DlToggleButton.vue'
2
+
3
+ export { DlToggleButton }
@@ -0,0 +1,4 @@
1
+ export interface DlToggleButtonOption {
2
+ label: string
3
+ value: string | number
4
+ }
@@ -16,3 +16,4 @@ export * from './DlTabPanels'
16
16
  export * from './DlTabs'
17
17
  export * from './DlToast'
18
18
  export * from './DlDialogBox'
19
+ export * from './DlToggleButton'
@@ -8,3 +8,4 @@ export * from './DlToast/types'
8
8
  export * from './DlDialogBox/types'
9
9
  export * from './DlOptionGroup/types'
10
10
  export * from './DlTable/types'
11
+ export * from './DlToggleButton/types'
@@ -287,8 +287,9 @@ export default defineComponent({
287
287
  .hu-color-picker {
288
288
  width: 180px;
289
289
  padding: 10px;
290
- background: var(--dl-color-shadow);
290
+ background: var(--dl-color-panel-background);
291
291
  border-radius: 2px;
292
+ border: 1px solid var(--dl-color-separator);
292
293
  box-shadow: 0px 3px 6px 0px rgba(16, 30, 115, 0.15);
293
294
  z-index: 1;
294
295
  text-align: left;
@@ -301,6 +302,8 @@ export default defineComponent({
301
302
  .color-show {
302
303
  margin-top: 11px;
303
304
  display: flex;
305
+ border: 1px solid var(--dl-color-separator);
306
+ overflow: hidden;
304
307
  }
305
308
  }
306
309
  </style>
@@ -13,7 +13,7 @@
13
13
  />
14
14
  <div
15
15
  :style="{ background: `${item}` }"
16
- :class="getColorClasses(`${item}`)"
16
+ class="color"
17
17
  />
18
18
  </li>
19
19
  </ul>
@@ -33,7 +33,7 @@
33
33
  />
34
34
  <div
35
35
  :style="{ background: `${item}` }"
36
- :class="getColorClasses(`${item}`)"
36
+ class="color"
37
37
  />
38
38
  </li>
39
39
  </ul>
@@ -125,11 +125,7 @@ export default defineComponent({
125
125
  position: absolute;
126
126
  left: 0;
127
127
  top: 0;
128
- width: 100%;
129
- height: 100%;
130
128
  border-radius: 3px;
131
- }
132
- .color-white {
133
129
  border: 1px solid var(--dl-color-separator);
134
130
  width: calc(100% - 2px);
135
131
  height: calc(100% - 2px);
@@ -2,7 +2,7 @@
2
2
  <div
3
3
  v-if="!svg"
4
4
  :id="uuid"
5
- :style="inlineStyles"
5
+ :style="[inlineStyles, styles]"
6
6
  @click="$emit('click', $event)"
7
7
  >
8
8
  <i
@@ -48,6 +48,10 @@ export default defineComponent({
48
48
  type: String,
49
49
  default: '12px'
50
50
  },
51
+ styles: {
52
+ type: [Array, String, Object],
53
+ default: null
54
+ },
51
55
  svg: {
52
56
  type: Boolean,
53
57
  default: false
@@ -79,6 +79,7 @@ import {
79
79
  } from './utils'
80
80
  import { isMobileOrTablet } from '../../../utils'
81
81
  import { v4 } from 'uuid'
82
+ import { useArrowNavigation } from '../../../hooks/use-arrow-navigation'
82
83
 
83
84
  export default defineComponent({
84
85
  name: 'DlMenu',
@@ -140,10 +141,20 @@ export default defineComponent({
140
141
  menuClass: {
141
142
  type: String,
142
143
  default: ''
144
+ },
145
+ arrowNavItems: {
146
+ type: [String, Array, Object],
147
+ default: () => [] as any[]
143
148
  }
144
149
  },
145
150
 
146
- emits: [...useModelToggleEmits, 'click', 'escape-key'],
151
+ emits: [
152
+ ...useModelToggleEmits,
153
+ 'click',
154
+ 'escape-key',
155
+ 'highlightedIndex',
156
+ 'handleSelectedItem'
157
+ ],
147
158
 
148
159
  setup(props, { attrs }) {
149
160
  const vm = getCurrentInstance()
@@ -242,6 +253,7 @@ export default defineComponent({
242
253
  const isMobile = computed(() => isMobileOrTablet())
243
254
 
244
255
  function handleShow(evt: MouseEvent | TouchEvent) {
256
+ isMenuOpen.value = true
245
257
  removeTick()
246
258
  removeTimeout()
247
259
 
@@ -290,6 +302,7 @@ export default defineComponent({
290
302
  }
291
303
 
292
304
  function handleHide(evt: ClickOutsideEvent) {
305
+ isMenuOpen.value = false
293
306
  removeTick()
294
307
  removeTimeout()
295
308
  hidePortal()
@@ -396,6 +409,19 @@ export default defineComponent({
396
409
  // expose public methods
397
410
  Object.assign(proxy, { focus, updatePosition })
398
411
 
412
+ const isMenuOpen = ref(false)
413
+ const navItems = computed(() => props.arrowNavItems)
414
+ const { selectedItem, highlightedIndex } = useArrowNavigation(
415
+ navItems,
416
+ isMenuOpen
417
+ )
418
+ watch(selectedItem, (value: any) => {
419
+ emit('handleSelectedItem', value)
420
+ })
421
+ watch(highlightedIndex, (value: any) => {
422
+ emit('highlightedIndex', value)
423
+ })
424
+
399
425
  return {
400
426
  uuid: `dl-menu-${v4()}`,
401
427
  onClick,
@@ -406,7 +432,9 @@ export default defineComponent({
406
432
  portalEl: isVue2 ? '[data-test-id="portal"]' : portalEl,
407
433
  portalIsActive,
408
434
  classes: 'dl-menu dl-position-engine scroll' + classes.value,
409
- styles: [attrs.style, transitionStyle.value] as any
435
+ styles: [attrs.style, transitionStyle.value] as any,
436
+ selectedItem,
437
+ highlightedIndex
410
438
  }
411
439
  }
412
440
  })
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <div :style="styles" />
3
+ </template>
4
+
5
+ <script lang="ts">
6
+ import { computed, defineComponent } from 'vue-demi'
7
+ import { includes } from '../../../utils'
8
+
9
+ export default defineComponent({
10
+ name: 'DlSeparator',
11
+ props: {
12
+ color: {
13
+ type: String,
14
+ default: 'var(--dl-color-separator)'
15
+ },
16
+ type: {
17
+ type: String,
18
+ default: 'horizontal',
19
+ validator: (value: string) =>
20
+ includes(['horizontal', 'vertical'], value)
21
+ },
22
+ width: {
23
+ type: String,
24
+ default: null
25
+ },
26
+ height: {
27
+ type: String,
28
+ default: null
29
+ },
30
+ indent: {
31
+ type: String,
32
+ default: '10px'
33
+ }
34
+ },
35
+ setup(props) {
36
+ const { color, height, type, indent, width } = props
37
+ const styles = computed(() => {
38
+ let styles
39
+ switch (type) {
40
+ case 'horizontal':
41
+ styles = {
42
+ backgroundColor: color,
43
+ width: width ?? '300px',
44
+ height: height ?? '1px',
45
+ marginTop: indent,
46
+ marginBottom: indent
47
+ }
48
+ break
49
+ case 'vertical':
50
+ styles = {
51
+ backgroundColor: color,
52
+ width: width ?? '1px',
53
+ height: height ?? '300px',
54
+ marginLeft: indent,
55
+ marginRight: indent
56
+ }
57
+ break
58
+ default:
59
+ styles = {}
60
+ }
61
+ return styles
62
+ })
63
+ return { styles }
64
+ }
65
+ })
66
+ </script>
@@ -0,0 +1,2 @@
1
+ import DlSeparator from './DlSeparator.vue'
2
+ export { DlSeparator }