@dataloop-ai/components 0.17.134 → 0.18.1

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 (180) hide show
  1. package/package.json +3 -1
  2. package/src/App.vue +5 -227
  3. package/src/assets/globals.scss +4 -0
  4. package/src/components/basic/DlAccordion/DlAccordion.vue +26 -4
  5. package/src/components/basic/DlButton/DlButton.vue +2 -6
  6. package/src/components/basic/DlChip/DlChip.vue +1 -5
  7. package/src/components/basic/DlEmptyState/DlEmptyState.vue +282 -0
  8. package/src/components/basic/DlEmptyState/index.ts +2 -0
  9. package/src/components/basic/DlEmptyState/types.ts +20 -0
  10. package/src/components/basic/DlListItem/DlListItem.vue +96 -63
  11. package/src/components/basic/DlListItem/utils.ts +0 -3
  12. package/src/components/basic/DlPanelContainer/DlPanelContainer.vue +35 -12
  13. package/src/components/basic/DlPopup/DlPopup.vue +29 -7
  14. package/src/components/basic/DlWidget/DlWidget.vue +32 -4
  15. package/src/components/basic/index.ts +2 -1
  16. package/src/components/basic/types.ts +2 -0
  17. package/src/components/compound/DlCard/DlCard.vue +796 -0
  18. package/src/components/compound/DlCard/components/DescriptionModal.vue +137 -0
  19. package/src/components/compound/DlCard/types.ts +38 -0
  20. package/src/components/compound/DlCharts/charts/DlBarChart/DlBarChart.vue +35 -3
  21. package/src/components/compound/DlCharts/charts/DlColumnChart/DlColumnChart.vue +51 -12
  22. package/src/components/compound/DlCharts/charts/DlConfusionMatrix/DlConfusionMatrix.vue +71 -14
  23. package/src/components/compound/DlCharts/charts/DlDoughnutChart/DlDoughnutChart.vue +28 -4
  24. package/src/components/compound/DlCharts/charts/DlDoughnutChart/components/DlDoughnutChartLegend.vue +1 -1
  25. package/src/components/compound/DlCharts/charts/DlLineChart/DlLineChart.vue +46 -8
  26. package/src/components/compound/DlCharts/components/DlBrush.vue +2 -2
  27. package/src/components/compound/DlCharts/types/props.ts +5 -1
  28. package/src/components/compound/DlCharts/utils.ts +1 -1
  29. package/src/components/compound/DlCodeEditor/DlCodeEditor.vue +171 -0
  30. package/src/components/compound/DlCodeEditor/README.md +11 -0
  31. package/src/components/compound/DlCodeEditor/components/CodeEditor.vue +705 -0
  32. package/src/components/compound/DlCodeEditor/index.ts +3 -0
  33. package/src/components/compound/DlCodeEditor/styles/themes-base16.css +12809 -0
  34. package/src/components/compound/DlCodeEditor/styles/themes.css +3999 -0
  35. package/src/components/compound/DlCodeEditor/types.ts +21 -0
  36. package/src/components/compound/DlDateTime/DlDateTimeRange/{DlCardSidebar.vue → CardSidebar.vue} +10 -11
  37. package/src/components/compound/DlDateTime/DlDateTimeRange/DlDateTimeRange.vue +8 -8
  38. package/src/components/compound/DlDialogBox/DlDialogBox.vue +26 -2
  39. package/src/components/compound/DlInput/DlInput.vue +2 -2
  40. package/src/components/compound/DlOptionGroup/components/MenuItemWrapper.vue +2 -2
  41. package/src/components/compound/DlRange/DlRange.vue +2 -2
  42. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSmartSearchInput.vue +1 -1
  43. package/src/components/compound/DlSearches/DlSmartSearch/components/DlSuggestionsDropdown.vue +1 -1
  44. package/src/components/compound/DlSearches/DlSmartSearch/utils/highlightSyntax.ts +10 -6
  45. package/src/components/compound/DlSelect/DlSelect.vue +78 -70
  46. package/src/components/compound/DlSlider/components/DlSliderBase.vue +2 -2
  47. package/src/components/compound/DlSlider/useSlider.ts +2 -2
  48. package/src/components/compound/DlStepper/DlStepper.vue +33 -3
  49. package/src/components/compound/DlStepper/components/DlStepperContent.vue +6 -2
  50. package/src/components/compound/DlStepper/components/DlStepperSidebar.vue +12 -6
  51. package/src/components/compound/DlTable/DlTable.vue +30 -4
  52. package/src/components/compound/DlTable/components/DlTd.vue +8 -8
  53. package/src/components/compound/DlTable/components/DlTh.vue +1 -1
  54. package/src/components/compound/DlTable/hooks/tableColumnSelection.ts +35 -40
  55. package/src/components/compound/DlTable/hooks/tableFilter.ts +33 -21
  56. package/src/components/compound/DlTable/hooks/tablePagination.ts +10 -13
  57. package/src/components/compound/DlTable/hooks/tableRowExpand.ts +2 -1
  58. package/src/components/compound/DlTable/hooks/tableRowSelection.ts +0 -1
  59. package/src/components/compound/DlTable/hooks/tableSort.ts +52 -47
  60. package/src/components/compound/DlThumbnailGallery/DlThumbnailGallery.vue +268 -0
  61. package/src/components/compound/DlThumbnailGallery/index.ts +2 -0
  62. package/src/components/compound/DlThumbnailGallery/types.ts +11 -0
  63. package/src/components/compound/DlTreeTable/DlTreeTable.vue +1293 -0
  64. package/src/components/compound/DlTreeTable/components/DlTdTree.vue +119 -0
  65. package/src/components/compound/DlTreeTable/components/DlTrTree.vue +52 -0
  66. package/src/components/compound/DlTreeTable/index.ts +3 -0
  67. package/src/components/compound/DlTreeTable/types.ts +1 -0
  68. package/src/components/compound/DlTreeTable/utils/convertToNestedObject.ts +51 -0
  69. package/src/components/compound/DlTreeTable/utils/flatTreeData.ts +19 -0
  70. package/src/components/compound/DlTreeTable/utils/getFromChildren.ts +39 -0
  71. package/src/components/compound/DlTreeTable/utils/trSpacing.ts +13 -0
  72. package/src/components/compound/DlTreeTable/utils/treeTableRowSelection.ts +184 -0
  73. package/src/components/compound/index.ts +5 -0
  74. package/src/components/compound/types.ts +2 -0
  75. package/src/components/essential/DlBadge/DlBadge.vue +3 -3
  76. package/src/components/essential/DlCheckbox/DlCheckbox.vue +6 -3
  77. package/src/components/essential/DlEllipsis/DlEllipsis.vue +18 -14
  78. package/src/components/essential/DlIcon/DlIcon.vue +1 -1
  79. package/src/components/essential/DlLabel/DlLabel.vue +174 -0
  80. package/src/components/essential/DlLabel/index.ts +2 -0
  81. package/src/components/essential/DlList/DlList.vue +2 -2
  82. package/src/components/essential/DlMenu/DlMenu.vue +26 -20
  83. package/src/components/essential/DlMenu/utils.ts +7 -6
  84. package/src/components/essential/DlPageLayout/DlPageLayout.vue +90 -0
  85. package/src/components/essential/DlPageLayout/index.ts +2 -0
  86. package/src/components/essential/DlSeparator/DlSeparator.vue +2 -2
  87. package/src/components/essential/DlThemeProvider/DlThemeProvider.vue +6 -0
  88. package/src/components/essential/index.ts +2 -1
  89. package/src/components/shared/DlTooltip/DlTooltip.vue +9 -10
  90. package/src/demos/BarChartDemo.vue +47 -2
  91. package/src/demos/ColumnChartDemo.vue +51 -2
  92. package/src/demos/DlAccordionDemo.vue +92 -43
  93. package/src/demos/DlCardDemo.vue +156 -19
  94. package/src/demos/DlChartDoughnutDemo.vue +49 -2
  95. package/src/demos/DlCheckboxDemo.vue +13 -0
  96. package/src/demos/DlCodeEditor/DlCodeEditorDemo.vue +247 -0
  97. package/src/demos/DlCodeEditor/index.ts +2 -0
  98. package/src/demos/DlConfusionMatrixDemo.vue +51 -6
  99. package/src/demos/DlDemoPage.vue +235 -0
  100. package/src/demos/DlDialogBoxDemo.vue +56 -51
  101. package/src/demos/DlDropdownButtonDemo.vue +1 -1
  102. package/src/demos/DlEmptyStateDemo.vue +81 -0
  103. package/src/demos/DlLabelDemo.vue +128 -0
  104. package/src/demos/DlLineChartDemo.vue +50 -2
  105. package/src/demos/DlListDemo.vue +12 -9
  106. package/src/demos/DlMenuDemo.vue +13 -14
  107. package/src/demos/DlPageLayoutDemo.vue +146 -0
  108. package/src/demos/DlPanelContainerDemo.vue +113 -2
  109. package/src/demos/DlPopupDemo.vue +51 -0
  110. package/src/demos/DlSelectDemo.vue +14 -5
  111. package/src/demos/DlStepperDemo/DlStepperDemo.vue +5 -1
  112. package/src/demos/DlStepperDemo/EmptyStateStepper.vue +149 -0
  113. package/src/demos/DlTableDemo.vue +65 -2
  114. package/src/demos/DlTabsDemo.vue +1 -1
  115. package/src/demos/DlThumbnailGalleryDemo.vue +99 -0
  116. package/src/demos/DlTreeTableDemo.vue +694 -0
  117. package/src/demos/DlWidgetDemo.vue +48 -3
  118. package/src/demos/index.ts +17 -4
  119. package/src/hooks/use-anchor.ts +14 -16
  120. package/src/hooks/use-model-toggle.ts +12 -14
  121. package/src/hooks/use-portal.ts +2 -2
  122. package/src/hooks/use-scroll-target.ts +2 -4
  123. package/src/hooks/use-size-observer.ts +3 -2
  124. package/src/hooks/use-transition.ts +10 -4
  125. package/src/index.ts +22 -1
  126. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetFooter.vue +78 -0
  127. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetHeader.vue +22 -0
  128. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetLeftDrawer.vue +96 -0
  129. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetMainContent.vue +51 -0
  130. package/src/layouts/DlDatasetBrowser/DemoComponents/DatasetRightDrawer.vue +88 -0
  131. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/ActionsMenu.vue +70 -0
  132. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/AutomationMenu.vue +106 -0
  133. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardView.vue +101 -0
  134. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewGallery.vue +141 -0
  135. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/CardViewTable.vue +193 -0
  136. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/LayoutEmptyState.vue +227 -0
  137. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/EmptyState/UploadData.vue +106 -0
  138. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentImages.vue +540 -0
  139. package/src/layouts/DlDatasetBrowser/DemoComponents/MainContent/MainContentNav.vue +329 -0
  140. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarKpi.vue +84 -0
  141. package/src/layouts/DlDatasetBrowser/DemoComponents/NavbarSearch.vue +132 -0
  142. package/src/layouts/DlDatasetBrowser/DemoComponents/SearchFilterMenu.vue +19 -0
  143. package/src/layouts/DlDatasetBrowser/DemoComponents/filters/AddFilter.vue +212 -0
  144. package/src/layouts/DlDatasetBrowser/DemoComponents/types/imageMetadata.ts +28 -0
  145. package/src/layouts/DlDatasetBrowser/DlDatasetBrowser.vue +42 -0
  146. package/src/layouts/DlStudioLayout/DlStudioLayout.vue +42 -0
  147. package/src/layouts/DlStudioLayout/components/Demo/LeftMenuContent.vue +23 -0
  148. package/src/layouts/DlStudioLayout/components/Demo/StudioFooter.vue +25 -0
  149. package/src/layouts/DlStudioLayout/components/Demo/StudioHeader.vue +121 -0
  150. package/src/layouts/DlStudioLayout/components/Demo/StudioLeftDrawer.vue +245 -0
  151. package/src/layouts/DlStudioLayout/components/Demo/StudioMainContent.vue +31 -0
  152. package/src/layouts/DlStudioLayout/components/Demo/StudioTabsMenu.vue +117 -0
  153. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/FilterMenu.vue +62 -0
  154. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuAnnotations.vue +98 -0
  155. package/src/layouts/DlStudioLayout/components/Demo/TabMenu/TabMenuItem.vue +66 -0
  156. package/src/layouts/DlStudioLayout/components/LayoutNavbar.vue +24 -0
  157. package/src/layouts/DlStudioLayout/components/ListAutocomplete.vue +149 -0
  158. package/src/layouts/DlStudioLayout/components/NavigationDrawer.vue +147 -0
  159. package/src/layouts/DlStudioLayout/index.ts +2 -0
  160. package/src/layouts/DlStudioLayout/types/HorizontalItems.ts +9 -0
  161. package/src/layouts/DlStudioLayout/types/VerticalItems.ts +10 -0
  162. package/src/simple-code-editor.d.ts +1 -0
  163. package/src/utils/click-outside.ts +1 -1
  164. package/src/utils/dom.ts +5 -5
  165. package/src/utils/events.ts +3 -3
  166. package/src/utils/global-nodes.ts +2 -2
  167. package/src/utils/is-ellipsis-active.ts +4 -1
  168. package/src/utils/portal.ts +5 -5
  169. package/src/utils/position-engine.ts +5 -5
  170. package/src/utils/render.ts +1 -1
  171. package/src/utils/scroll.ts +2 -2
  172. package/src/utils/selection.ts +3 -3
  173. package/vite.config.ts +9 -1
  174. package/src/components/basic/DlCard/DlCard.vue +0 -242
  175. package/src/components/basic/DlCard/types.ts +0 -20
  176. package/src/components/essential/DlTextHolder/DlTextHolder.vue +0 -93
  177. package/src/components/essential/DlTextHolder/index.ts +0 -2
  178. package/src/demos/DlTextHolderDemo.vue +0 -50
  179. /package/src/components/{basic → compound}/DlCard/index.ts +0 -0
  180. /package/src/components/compound/DlDateTime/DlDateTimeRange/{DlDateInput.vue → DateInput.vue} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.17.134",
3
+ "version": "0.18.1",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -27,10 +27,12 @@
27
27
  "@types/lodash": "^4.14.184",
28
28
  "chart.js": "^3.9.1",
29
29
  "flat": "^5.0.2",
30
+ "highlight.js": "^11.8.0",
30
31
  "lodash": "^4.17.21",
31
32
  "moment": "^2.29.4",
32
33
  "sass": "^1.51.0",
33
34
  "sass-loader": "^12.6.0",
35
+ "simple-code-editor": "^2.0.8",
34
36
  "uuid": "^8.3.2",
35
37
  "v-wave": "^1.5.0",
36
38
  "vanilla-jsoneditor": "^0.10.2",
package/src/App.vue CHANGED
@@ -1,242 +1,20 @@
1
1
  <template>
2
- <DlThemeProvider :is-dark="darkMode">
3
- <div
4
- style="display: flex; width: 100%; align-items: center; align-content; center;"
5
- >
6
- <dl-typography
7
- color="dl-color-medium"
8
- variant="p"
9
- style="margin: 10px 0px 20px 0px; width: 90%"
10
- >
11
- <div
12
- style="
13
- background-image: url(https://dataloop.ai/wp-content/uploads/2020/03/logo.svg);
14
- width: 160px;
15
- height: 28px;
16
- display: inline-block;
17
- "
18
- />
19
- Components library
20
- </dl-typography>
21
- <div style="display: flex; align-items: center">
22
- <dl-icon
23
- icon="icon-dl-light-theme"
24
- size="24px"
25
- :color="
26
- !darkMode ? 'dl-color-secondary' : 'dl-color-darker'
27
- "
28
- />
29
- <dl-switch
30
- v-model="darkMode"
31
- style="margin: 0 20px"
32
- />
33
- <dl-icon
34
- icon="icon-dl-dark-theme"
35
- size="20px"
36
- :color="darkMode ? 'dl-color-secondary' : 'dl-color-darker'"
37
- />
38
- </div>
39
- </div>
40
- <div class="layout-wrapper">
41
- <div class="sidebar">
42
- <dl-search
43
- v-model="filterTerm"
44
- style="margin-bottom: 5px"
45
- />
46
-
47
- <dl-button
48
- v-if="activeDemo"
49
- outlined
50
- >
51
- <span style="text-transform: capitalize">
52
- Selected: {{ computeDemoName(activeDemo.name) }}
53
- </span>
54
- </dl-button>
55
- <dl-list
56
- bordered
57
- clickable
58
- style="
59
- margin-top: 15px;
60
- min-width: 200px;
61
- height: 100%;
62
- height: calc(100vh - 20vh);
63
- overflow: auto;
64
- "
65
- >
66
- <template #default="{ clickable }">
67
- <dl-list-item
68
- v-for="(demo, index) in filteredDemos"
69
- :key="demo.name"
70
- :bordered="index !== 0"
71
- :clickable="clickable"
72
- :class="isSelectedDemo(demo) ? 'selected' : ''"
73
- style="text-transform: capitalize"
74
- @click="setActiveDemo(demo)"
75
- >
76
- {{ computeDemoName(demo.name) }}
77
- </dl-list-item>
78
- </template>
79
- </dl-list>
80
- </div>
81
- <div class="content">
82
- <div style="display: flex; justify-content: center">
83
- <dl-typography
84
- size="h2"
85
- variant="h2"
86
- style="text-transform: capitalize"
87
- >
88
- {{
89
- activeDemo
90
- ? computeDemoName(activeDemo.name)
91
- : 'No selected'
92
- }}
93
- component
94
- </dl-typography>
95
- </div>
96
- <component
97
- :is="activeDemo.component"
98
- v-if="activeDemo"
99
- class="data-container"
100
- />
101
- </div>
102
- </div>
103
- </DlThemeProvider>
2
+ <DlDemoPage :is-dark="isDark" />
104
3
  </template>
105
4
 
106
5
  <script lang="ts">
107
- import { defineComponent, ref, computed, shallowRef } from 'vue-demi'
108
- import {
109
- DlThemeProvider,
110
- DlButton,
111
- DlListItem,
112
- DlList,
113
- DlTypography,
114
- DlSearch,
115
- DlSwitch,
116
- DlIcon
117
- } from './components'
118
- import Demos from './demos'
6
+ import { defineComponent } from 'vue-demi'
7
+ import { DlDemoPage } from './demos'
119
8
 
120
9
  export default defineComponent({
121
10
  name: 'DlComponentsDemo',
122
11
  components: {
123
- DlThemeProvider,
124
- DlButton,
125
- DlListItem,
126
- DlList,
127
- DlTypography,
128
- DlSearch,
129
- DlSwitch,
130
- DlIcon
12
+ DlDemoPage
131
13
  },
132
14
  props: {
133
15
  isDark: { required: false, default: false, type: Boolean }
134
- },
135
- setup(props) {
136
- const darkMode = ref(props.isDark)
137
- const filterTerm = ref('')
138
- const names = Object.keys(Demos)
139
- const demos: {
140
- name: string
141
- component: any
142
- }[] = names.map((n: string) => ({
143
- name: n,
144
- // @ts-ignore
145
- component: Demos[n]
146
- }))
147
-
148
- const filteredDemos = computed(() => {
149
- if (!filterTerm.value || !filterTerm.value.length) {
150
- return demos
151
- }
152
-
153
- return demos.filter((demo: { name: string; component: any }) => {
154
- return demo.name
155
- .toLowerCase()
156
- .includes(filterTerm.value.toLowerCase())
157
- })
158
- })
159
-
160
- const activeDemo = shallowRef(
161
- window.localStorage.getItem('dl-active-demo')
162
- ? demos.find(
163
- (d) =>
164
- d.name ===
165
- window.localStorage.getItem('dl-active-demo')
166
- ) ?? null
167
- : null
168
- )
169
-
170
- const setActiveDemo = (demo: { name: string; component: any }) => {
171
- activeDemo.value = demo
172
- filterTerm.value = ''
173
- window.localStorage.setItem('dl-active-demo', demo.name)
174
- }
175
-
176
- const computeDemoName = (name: string) => {
177
- return name.includes('Dl')
178
- ? name.split('Demo')[0]
179
- : 'Dl' + name.split('Demo')[0]
180
- }
181
-
182
- const isSelectedDemo = (demo: { name: string; component: any }) => {
183
- return activeDemo.value?.name === demo.name
184
- }
185
-
186
- return {
187
- darkMode,
188
- activeDemo,
189
- setActiveDemo,
190
- filterTerm,
191
- filteredDemos,
192
- computeDemoName,
193
- isSelectedDemo
194
- }
195
16
  }
196
17
  })
197
18
  </script>
198
19
 
199
- <style scoped lang="scss">
200
- #app {
201
- -webkit-font-smoothing: antialiased;
202
- -moz-osx-font-smoothing: grayscale;
203
- text-align: center;
204
- color: #2c3e50;
205
- }
206
-
207
- .layout-wrapper {
208
- display: flex;
209
- }
210
-
211
- .sidebar {
212
- display: flex;
213
- flex-direction: column;
214
- }
215
-
216
- .content {
217
- padding: 20px 30px;
218
- flex-grow: 1;
219
- }
220
-
221
- .data-container {
222
- display: flex;
223
- gap: 1rem;
224
- align-items: center;
225
- max-width: 100%;
226
- overflow: auto;
227
- padding: 20px;
228
- margin: 0 auto;
229
- flex-direction: column;
230
- justify-content: center;
231
- width: 950px;
232
- resize: both;
233
- box-shadow: var(--dl-menu-shadow);
234
- }
235
-
236
- .selected {
237
- ::v-deep .row {
238
- color: var(--dl-color-secondary) !important;
239
- background-color: var(--dl-color-fill);
240
- }
241
- }
242
- </style>
20
+ <style scoped lang="scss"></style>
@@ -1,6 +1,7 @@
1
1
  @import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');
2
2
  @import 'constants';
3
3
 
4
+
4
5
  body {
5
6
  font-family: 'Roboto', sans-serif;
6
7
  font-weight: 400;
@@ -128,6 +129,9 @@ body {
128
129
  .full-width {
129
130
  width: 100%;
130
131
  }
132
+ .full-height {
133
+ height: 100%;
134
+ }
131
135
 
132
136
 
133
137
  :root {
@@ -27,20 +27,37 @@
27
27
  class="accordion-content"
28
28
  :class="{ closed: !isOpen, 'right-side': rightSide }"
29
29
  >
30
- <slot v-if="isOpen" />
30
+ <slot v-if="isOpen && !isEmpty" />
31
+ <dl-empty-state
32
+ v-if="isOpen && isEmpty"
33
+ v-bind="emptyStateProps"
34
+ >
35
+ <template
36
+ v-for="(_, slot) in $slots"
37
+ #[slot]="props"
38
+ >
39
+ <slot
40
+ :name="slot"
41
+ v-bind="props"
42
+ />
43
+ </template>
44
+ </dl-empty-state>
31
45
  </div>
32
46
  </div>
33
47
  </template>
34
48
 
35
49
  <script lang="ts">
36
50
  import DlAccordionHeader from './components/AccordionHeader.vue'
37
- import { defineComponent } from 'vue-demi'
51
+ import DlEmptyState from '../DlEmptyState/DlEmptyState.vue'
52
+ import { DlEmptyStateProps } from '../DlEmptyState/types'
53
+ import { defineComponent, PropType } from 'vue-demi'
38
54
  import { v4 } from 'uuid'
39
55
 
40
56
  export default defineComponent({
41
57
  name: 'DlAccordion',
42
58
  components: {
43
- DlAccordionHeader
59
+ DlAccordionHeader,
60
+ DlEmptyState
44
61
  },
45
62
  model: {
46
63
  prop: 'modelValue',
@@ -53,7 +70,12 @@ export default defineComponent({
53
70
  fontSize: { type: String, default: '12px' },
54
71
  titleColor: { type: String, default: 'dl-color-medium' },
55
72
  modelValue: { type: Boolean, default: null },
56
- rightSide: { type: Boolean, default: false }
73
+ rightSide: { type: Boolean, default: false },
74
+ isEmpty: Boolean,
75
+ emptyStateProps: {
76
+ type: Object as PropType<DlEmptyStateProps>,
77
+ default: null
78
+ }
57
79
  },
58
80
  emits: ['update:model-value', 'hide', 'show'],
59
81
  data() {
@@ -214,11 +214,7 @@ export default defineComponent({
214
214
  return setIconSize(this.$props.size)
215
215
  },
216
216
  hasLabel(): boolean {
217
- return (
218
- this.label !== void 0 &&
219
- this.label !== null &&
220
- this.label !== ''
221
- )
217
+ return !!this.label
222
218
  },
223
219
  buttonLabel(): string {
224
220
  return textTransform(this.label)
@@ -381,7 +377,7 @@ export default defineComponent({
381
377
  },
382
378
  onMouseDown(e: Event) {
383
379
  if (this.isActionable) {
384
- if (e !== void 0) {
380
+ if (e) {
385
381
  if (e.defaultPrevented === true) {
386
382
  return
387
383
  }
@@ -107,11 +107,7 @@ export default defineComponent({
107
107
  },
108
108
  computed: {
109
109
  hasLabel(): boolean {
110
- return (
111
- this.label !== void 0 &&
112
- this.label !== null &&
113
- this.label !== ''
114
- )
110
+ return !!this.label
115
111
  },
116
112
  hasLabelSlot(): boolean {
117
113
  return !!this.$slots['default']
@@ -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']