@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
package/.eslintrc.js CHANGED
@@ -7,7 +7,8 @@ module.exports = {
7
7
  'eslint:recommended',
8
8
  'plugin:@typescript-eslint/recommended',
9
9
  'plugin:vue/recommended',
10
- '@vue/typescript'
10
+ '@vue/typescript',
11
+ 'plugin:storybook/recommended'
11
12
  ],
12
13
  plugins: ['eslint-plugin-member-order'],
13
14
  rules: {
@@ -130,7 +131,6 @@ module.exports = {
130
131
  'use-isnan': 'warn',
131
132
  'valid-typeof': 'off',
132
133
  'no-useless-escape': 'off',
133
-
134
134
  // New Rules
135
135
  '@typescript-eslint/ban-ts-comment': 'off',
136
136
  '@typescript-eslint/explicit-function-return-type': 'off',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.16.45",
3
+ "version": "0.16.47",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -38,13 +38,13 @@
38
38
  "devDependencies": {
39
39
  "@babel/core": "^7.17.9",
40
40
  "@mdx-js/react": "^2.1.1",
41
- "@storybook/addon-actions": "^7.0.0-rc.5",
42
- "@storybook/addon-essentials": "^7.0.0-rc.5",
43
- "@storybook/addon-links": "^7.0.0-rc.5",
44
- "@storybook/addon-mdx-gfm": "^7.0.0-rc.5",
45
- "@storybook/client-api": "^7.0.0-rc.5",
46
- "@storybook/vue3": "^7.0.0-rc.5",
47
- "@storybook/vue3-vite": "^7.0.0-rc.5",
41
+ "@storybook/addon-actions": "^7.0.4",
42
+ "@storybook/addon-essentials": "^7.0.4",
43
+ "@storybook/addon-links": "^7.0.4",
44
+ "@storybook/addon-mdx-gfm": "^7.0.4",
45
+ "@storybook/client-api": "^7.0.4",
46
+ "@storybook/vue3": "^7.0.4",
47
+ "@storybook/vue3-vite": "^7.0.4",
48
48
  "@types/jsdom": "^16.2.14",
49
49
  "@types/node": "^18.7.18",
50
50
  "@types/resize-observer-browser": "^0.1.7",
@@ -61,6 +61,7 @@
61
61
  "eslint-config-prettier": "^8.5.0",
62
62
  "eslint-plugin-member-order": "^0.0.3",
63
63
  "eslint-plugin-prettier": "^4.0.0",
64
+ "eslint-plugin-storybook": "^0.6.11",
64
65
  "eslint-plugin-vue": "^8.6.0",
65
66
  "html-webpack-plugin": "^5.5.0",
66
67
  "jsdom": "^21.1.0",
@@ -69,7 +70,7 @@
69
70
  "prettier": "^2.6.2",
70
71
  "react": "^18.1.0",
71
72
  "react-dom": "^18.2.0",
72
- "storybook": "^7.0.0-rc.5",
73
+ "storybook": "^7.0.4",
73
74
  "storybook-addon-themes": "^6.1.0",
74
75
  "typescript": "^4.5.4",
75
76
  "vite": "^4.1.4",
package/src/App.vue CHANGED
@@ -1,52 +1,79 @@
1
1
  <template>
2
- <DlThemeProvider :is-dark="isDarkMode">
3
- <div style="display: flex">
4
- <dl-typography
5
- color="dl-color-medium"
6
- size="h1"
7
- variant="h1"
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%"
8
10
  >
9
- Dataloop AI UI Library
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
10
20
  </dl-typography>
11
- <dl-button
12
- v-if="!hasProps"
13
- style="margin: 0 20px"
14
- @click="toggleColorMode"
15
- >
16
- {{ (isDarkMode ? 'Light' : 'Dark') + ' theme' }}
17
- </dl-button>
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>
18
39
  </div>
19
40
  <div class="layout-wrapper">
20
41
  <div class="sidebar">
21
42
  <dl-search
22
- v-model="activeDemo"
43
+ v-model="filterTerm"
23
44
  style="margin-bottom: 5px"
24
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>
25
55
  <dl-list
26
56
  bordered
27
57
  clickable
28
58
  style="
59
+ margin-top: 15px;
29
60
  min-width: 200px;
30
61
  height: 100%;
31
- height: calc(100vh - 60px);
62
+ height: calc(100vh - 18vh);
32
63
  overflow: auto;
33
64
  "
34
65
  >
35
66
  <template #default="{ clickable }">
36
67
  <dl-list-item
37
- v-for="(componentName, index) in Object.keys(
38
- demoState
39
- )"
40
- :key="componentName"
68
+ v-for="(demo, index) in filteredDemos"
69
+ :key="demo.name"
41
70
  :bordered="index !== 0"
42
71
  :clickable="clickable"
43
- :class="
44
- componentName === activeDemo ? 'selected' : ''
45
- "
72
+ :class="isSelectedDemo(demo) ? 'selected' : ''"
46
73
  style="text-transform: capitalize"
47
- @click="setActiveDemo(componentName)"
74
+ @click="setActiveDemo(demo)"
48
75
  >
49
- {{ parseName(componentName) }}
76
+ {{ computeDemoName(demo.name) }}
50
77
  </dl-list-item>
51
78
  </template>
52
79
  </dl-list>
@@ -58,12 +85,18 @@
58
85
  variant="h2"
59
86
  style="text-transform: capitalize"
60
87
  >
61
- {{ parseName(activeDemo) }} component
88
+ {{
89
+ activeDemo
90
+ ? computeDemoName(activeDemo.name)
91
+ : 'No selected'
92
+ }}
93
+ component
62
94
  </dl-typography>
63
95
  </div>
64
- <component
65
- :is="demoState[activeDemo]"
66
- class="data-container"
96
+ <component
97
+ :is="activeDemo.component"
98
+ v-if="activeDemo"
99
+ class="data-container"
67
100
  />
68
101
  </div>
69
102
  </div>
@@ -71,17 +104,18 @@
71
104
  </template>
72
105
 
73
106
  <script lang="ts">
74
- import { defineComponent, ref, computed } from 'vue-demi'
107
+ import { defineComponent, ref, computed, shallowRef } from 'vue-demi'
75
108
  import {
76
109
  DlThemeProvider,
77
110
  DlButton,
78
111
  DlListItem,
79
112
  DlList,
80
113
  DlTypography,
81
- DlSearch
114
+ DlSearch,
115
+ DlSwitch,
116
+ DlIcon
82
117
  } from './components'
83
- import { demoState } from './demo'
84
- import { parseName } from './utils'
118
+ import Demos from './demos'
85
119
 
86
120
  export default defineComponent({
87
121
  name: 'DlComponentsDemo',
@@ -91,44 +125,72 @@ export default defineComponent({
91
125
  DlListItem,
92
126
  DlList,
93
127
  DlTypography,
94
- DlSearch
128
+ DlSearch,
129
+ DlSwitch,
130
+ DlIcon
95
131
  },
96
132
  props: {
97
- isDark: { required: false, default: null, type: Boolean }
133
+ isDark: { required: false, default: false, type: Boolean }
98
134
  },
99
135
  setup(props) {
100
- const hasProps = computed(() => props.isDark !== null)
101
- const darkMode = ref(false)
102
- const demos = Object.keys(demoState)
103
- const activeDemo = ref(
104
- window.localStorage.getItem('dl-active-demo') ?? demos[0] ?? ''
105
- )
106
- const setActiveDemo = (demo: string) => {
107
- activeDemo.value = demo
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
+ }))
108
147
 
109
- if (demos.includes(demo)) {
110
- window.localStorage.setItem('dl-active-demo', demo)
148
+ const filteredDemos = computed(() => {
149
+ if (!filterTerm.value || !filterTerm.value.length) {
150
+ return demos
111
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)
112
174
  }
113
- const toggleColorMode = () => {
114
- darkMode.value = !darkMode.value
175
+
176
+ const computeDemoName = (name: string) => {
177
+ return name.includes('Dl')
178
+ ? name.split('Demo')[0]
179
+ : 'Dl' + name.split('Demo')[0]
115
180
  }
116
181
 
117
- const isDarkMode = computed(() => {
118
- if (hasProps.value) {
119
- return props.isDark
120
- }
121
- return darkMode.value
122
- })
182
+ const isSelectedDemo = (demo: { name: string; component: any }) => {
183
+ return activeDemo.value?.name === demo.name
184
+ }
123
185
 
124
186
  return {
125
- hasProps,
126
- isDarkMode,
187
+ darkMode,
127
188
  activeDemo,
128
189
  setActiveDemo,
129
- toggleColorMode,
130
- demoState,
131
- parseName
190
+ filterTerm,
191
+ filteredDemos,
192
+ computeDemoName,
193
+ isSelectedDemo
132
194
  }
133
195
  }
134
196
  })
@@ -140,6 +140,7 @@ body {
140
140
  --dl-color-tooltip-background: #171723d9;
141
141
  --dl-color-text-darker-buttons: #171723;
142
142
  --dl-color-secondary: #3452FF;
143
+ --dl-color-secondary-opaque: #3452FF10;
143
144
  --dl-color-text-buttons: #FFFFFF;
144
145
  --dl-color-darker: #171723;
145
146
  --dl-color-medium: #767676;
@@ -189,6 +190,7 @@ body {
189
190
  --dl-color-tooltip-background: #ffffffd9;
190
191
  --dl-color-text-darker-buttons: #171723;
191
192
  --dl-color-secondary: #7C8CFF;
193
+ --dl-color-secondary-opaque: #7C8CFF10;
192
194
  --dl-color-text-buttons: #FFFFFF;
193
195
  --dl-color-darker: #ffffffcc;
194
196
  --dl-color-medium: #ffffff99;
@@ -93,7 +93,7 @@ export default defineComponent({
93
93
  },
94
94
  type: {
95
95
  type: String,
96
- default: 'success',
96
+ required: true,
97
97
  validator: (value: string) =>
98
98
  includes(['info', 'success', 'warning', 'error'], value)
99
99
  },
@@ -3,13 +3,14 @@
3
3
  :id="uuid"
4
4
  class="dl-button-container"
5
5
  style="pointer-events: none"
6
- :style="cssButtonVars"
6
+ :style="[cssButtonVars, containerStyles]"
7
7
  >
8
8
  <button
9
9
  v-if="hasContent || hasIcon"
10
10
  :tabindex="tabIndex"
11
11
  :aria-disabled="disabled ? 'true' : 'false'"
12
12
  :disabled="disabled"
13
+ :style="[cssButtonVars, styles]"
13
14
  style="pointer-events: auto"
14
15
  class="dl-button"
15
16
  @click="onClick"
@@ -20,7 +21,7 @@
20
21
  >
21
22
  {{ buttonLabel }}
22
23
  </dl-tooltip>
23
- <span class="dl-button-content dl-anchor--skip">
24
+ <div class="dl-button-content dl-anchor--skip">
24
25
  <dl-icon
25
26
  v-if="hasIcon"
26
27
  :size="iconSizePX"
@@ -38,12 +39,8 @@
38
39
  >
39
40
  {{ buttonLabel }}
40
41
  </span>
41
- <slot
42
- :class="{
43
- 'dl-button-label--icon-sibling': hasIcon
44
- }"
45
- />
46
- </span>
42
+ <slot />
43
+ </div>
47
44
  </button>
48
45
  <dl-tooltip
49
46
  v-if="tooltip"
@@ -99,6 +96,7 @@ export default defineComponent({
99
96
  },
100
97
  iconColor: { type: String!, default: '' },
101
98
  padding: { type: String, default: '' },
99
+ margin: { type: String, default: '0 auto' },
102
100
  size: { type: String! as PropType<ButtonSizes>, default: 'm' },
103
101
  filled: { type: Boolean, default: true },
104
102
  round: { type: Boolean, default: false },
@@ -109,7 +107,8 @@ export default defineComponent({
109
107
  noWrap: Boolean,
110
108
  icon: { type: String, default: '' },
111
109
  overflow: { type: Boolean, default: false, required: false },
112
- tooltip: { type: String, default: null, required: false }
110
+ tooltip: { type: String, default: null, required: false },
111
+ styles: { type: [Object, String, Array], default: null }
113
112
  },
114
113
  emits: ['click', 'mousedown'],
115
114
  setup() {
@@ -145,6 +144,9 @@ export default defineComponent({
145
144
  hasIcon(): boolean {
146
145
  return typeof this.icon === 'string' && this.icon !== ''
147
146
  },
147
+ containerStyles(): object {
148
+ return this.fluid ? { width: '100%' } : {}
149
+ },
148
150
  hasContent(): boolean {
149
151
  return !!this.$slots.default || this.hasLabel
150
152
  },
@@ -245,6 +247,7 @@ export default defineComponent({
245
247
  : this.hasIcon && !this.hasContent
246
248
  ? setIconPadding(this.size)
247
249
  : setPadding(this.size),
250
+ '--dl-button-margin': this.margin,
248
251
  '--dl-button-font-size': setFontSize(this.size),
249
252
  '--dl-button-text-transform': this.uppercase
250
253
  ? 'uppercase'
@@ -301,6 +304,7 @@ export default defineComponent({
301
304
 
302
305
  .dl-button {
303
306
  padding: var(--dl-button-padding);
307
+ margin: var(--dl-button-margin);
304
308
  border-radius: var(--dl-button-border-radius);
305
309
  text-transform: var(--dl-button-text-transform);
306
310
  font-family: 'Roboto', sans-serif;
@@ -358,10 +362,6 @@ export default defineComponent({
358
362
  gap: var(--dl-button-gap, 7px);
359
363
  }
360
364
 
361
- //.dl-button-label--icon-sibling {
362
- // margin: var(--dl-button-icon-margin, 0px 0px 0px 7px);
363
- //}
364
-
365
365
  .dl-button-container {
366
366
  display: inline-block;
367
367
  width: var(--dl-button-container-width);
@@ -0,0 +1,234 @@
1
+ <template>
2
+ <div
3
+ class="card"
4
+ :style="[{ width, height }, styles]"
5
+ >
6
+ <div
7
+ v-if="icon"
8
+ class="card--icon"
9
+ >
10
+ <dl-icon
11
+ :icon="icon.src"
12
+ :styles="iconStyles"
13
+ :size="iconSize"
14
+ :color="iconColor"
15
+ />
16
+ </div>
17
+ <div
18
+ v-else-if="image"
19
+ class="card--image"
20
+ >
21
+ <img
22
+ :src="image.src"
23
+ :style="imageStyles"
24
+ :alt="imageAlt"
25
+ >
26
+ </div>
27
+ <div class="card--content">
28
+ <div>
29
+ <slot
30
+ v-if="!!$slots.header"
31
+ name="header"
32
+ />
33
+ <div
34
+ v-else
35
+ class="card--header"
36
+ >
37
+ <span class="card--header_title">{{ title }}</span>
38
+ <span class="card--header_shortcut">{{
39
+ keyboardShortcut
40
+ }}</span>
41
+ </div>
42
+ <slot
43
+ v-if="!!$slots.content"
44
+ name="content"
45
+ />
46
+ <span
47
+ v-else
48
+ class="card--content_text"
49
+ >{{ text }}</span>
50
+ </div>
51
+ <slot
52
+ v-if="!!$slots.footer"
53
+ name="footer"
54
+ />
55
+ <div
56
+ v-else
57
+ class="card--links"
58
+ >
59
+ <div
60
+ v-for="(link, idx) in links"
61
+ :key="idx"
62
+ class="card--links_linkItem"
63
+ >
64
+ <div class="card--links_linkItem_icon">
65
+ <dl-icon
66
+ v-if="link.icon"
67
+ :icon="link.icon"
68
+ size="12px"
69
+ />
70
+ </div>
71
+ <div class="card--links_linkItem_link">
72
+ <dl-link
73
+ :external="!!link.external"
74
+ :href="link.href"
75
+ :newtab="!!link.newtab"
76
+ >
77
+ {{ link.title }}
78
+ </dl-link>
79
+ </div>
80
+ </div>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ </template>
85
+
86
+ <script lang="ts">
87
+ import { defineComponent, PropType } from 'vue-demi'
88
+ import { DlIcon } from '../../essential/DlIcon'
89
+ import { DlLink } from '../../essential/DlLink'
90
+ import { IconItem, ImageItem, LinkItem } from './types'
91
+
92
+ export default defineComponent({
93
+ name: 'DlCard',
94
+ components: { DlLink, DlIcon },
95
+ props: {
96
+ image: {
97
+ type: Object as PropType<ImageItem>,
98
+ default: null
99
+ },
100
+ icon: {
101
+ type: Object as PropType<IconItem>,
102
+ default: null
103
+ },
104
+ title: {
105
+ type: String,
106
+ default: ''
107
+ },
108
+ text: {
109
+ type: String,
110
+ default: ''
111
+ },
112
+ keyboardShortcut: {
113
+ type: String,
114
+ default: ''
115
+ },
116
+ links: {
117
+ type: Array as PropType<LinkItem[]>,
118
+ default: () => Array as PropType<LinkItem[]>
119
+ },
120
+ height: {
121
+ type: String,
122
+ default: 'auto'
123
+ },
124
+ width: {
125
+ type: String,
126
+ default: '200px'
127
+ },
128
+ styles: {
129
+ type: [Object, String, Array],
130
+ default: null
131
+ }
132
+ },
133
+ computed: {
134
+ iconStyles(): string {
135
+ return this.icon?.styles ?? ''
136
+ },
137
+ iconSize(): string {
138
+ return this.icon?.size ?? '50px'
139
+ },
140
+ iconColor(): string {
141
+ return this.icon?.color ?? 'var(--dl-color-darker)'
142
+ },
143
+ imageStyles(): string {
144
+ return this.image?.styles ?? ''
145
+ },
146
+ imageAlt(): string {
147
+ return this.image?.alt ?? ''
148
+ }
149
+ }
150
+ })
151
+ </script>
152
+
153
+ <style lang="scss" scoped>
154
+ .card {
155
+ color: var(--dl-color-darker);
156
+ background-color: var(--dl-color-panel-background);
157
+ border: 1px solid var(--dl-color-separator);
158
+ border-radius: 2px;
159
+ pointer-events: auto;
160
+ box-shadow: 0px 5px 15px 0px var(--dl-color-shadow);
161
+
162
+ &--content {
163
+ padding: 16px 10px;
164
+ &_text {
165
+ font-size: 12px;
166
+ color: var(--dl-color-medium);
167
+ }
168
+ }
169
+
170
+ &--header {
171
+ display: flex;
172
+ align-items: center;
173
+ flex-wrap: wrap;
174
+
175
+ &_title {
176
+ color: var(--dl-color-darker);
177
+ font-size: 14px;
178
+ line-height: 16px;
179
+ font-weight: 700;
180
+ margin-right: 10px;
181
+ margin-bottom: 10px;
182
+ }
183
+ &_shortcut {
184
+ color: #767676;
185
+ font-size: 10px;
186
+ line-height: 10px;
187
+ border-radius: 2px;
188
+ border: 1px solid #767676;
189
+ padding: 4px;
190
+ text-align: center;
191
+ margin-bottom: 10px;
192
+ }
193
+ }
194
+ &--links {
195
+ margin-top: 16px;
196
+ display: flex;
197
+ align-items: center;
198
+ flex-wrap: wrap;
199
+
200
+ &_linkItem {
201
+ margin-right: 15px;
202
+ color: var(--dl-color-secondary);
203
+ font-size: 10px;
204
+ display: flex;
205
+ align-items: center;
206
+
207
+ &_icon {
208
+ margin-right: 7px;
209
+ vertical-align: middle;
210
+ }
211
+
212
+ &_link {
213
+ vertical-align: middle;
214
+ }
215
+ }
216
+ }
217
+ &--image {
218
+ width: 200px;
219
+ height: 100px;
220
+ overflow: hidden;
221
+ img {
222
+ width: 100%;
223
+ }
224
+ }
225
+ &--icon {
226
+ display: flex;
227
+ justify-content: center;
228
+ align-items: center;
229
+ padding-top: 34px;
230
+ padding-bottom: 16px;
231
+ color: var(--dl-color-darker);
232
+ }
233
+ }
234
+ </style>
@@ -0,0 +1,3 @@
1
+ import DlCard from './DlCard.vue'
2
+
3
+ export { DlCard }