@dataloop-ai/components 0.16.46 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataloop-ai/components",
3
- "version": "0.16.46",
3
+ "version": "0.16.47",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
package/src/App.vue CHANGED
@@ -69,9 +69,7 @@
69
69
  :key="demo.name"
70
70
  :bordered="index !== 0"
71
71
  :clickable="clickable"
72
- :class="
73
- demo.name === activeDemo?.name ? 'selected' : ''
74
- "
72
+ :class="isSelectedDemo(demo) ? 'selected' : ''"
75
73
  style="text-transform: capitalize"
76
74
  @click="setActiveDemo(demo)"
77
75
  >
@@ -181,13 +179,18 @@ export default defineComponent({
181
179
  : 'Dl' + name.split('Demo')[0]
182
180
  }
183
181
 
182
+ const isSelectedDemo = (demo: { name: string; component: any }) => {
183
+ return activeDemo.value?.name === demo.name
184
+ }
185
+
184
186
  return {
185
187
  darkMode,
186
188
  activeDemo,
187
189
  setActiveDemo,
188
190
  filterTerm,
189
191
  filteredDemos,
190
- computeDemoName
192
+ computeDemoName,
193
+ isSelectedDemo
191
194
  }
192
195
  }
193
196
  })
@@ -9,9 +9,9 @@
9
9
  >
10
10
  <dl-icon
11
11
  :icon="icon.src"
12
- :styles="icon?.styles"
13
- :size="icon?.size || '50px'"
14
- :color="icon?.color || 'var(--dl-color-darker)'"
12
+ :styles="iconStyles"
13
+ :size="iconSize"
14
+ :color="iconColor"
15
15
  />
16
16
  </div>
17
17
  <div
@@ -20,8 +20,8 @@
20
20
  >
21
21
  <img
22
22
  :src="image.src"
23
- :style="image?.styles"
24
- :alt="image?.alt"
23
+ :style="imageStyles"
24
+ :alt="imageAlt"
25
25
  >
26
26
  </div>
27
27
  <div class="card--content">
@@ -129,6 +129,23 @@ export default defineComponent({
129
129
  type: [Object, String, Array],
130
130
  default: null
131
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
+ }
132
149
  }
133
150
  })
134
151
  </script>
@@ -137,7 +137,7 @@
137
137
  The given props cannot create a valid matrix.
138
138
  </div>
139
139
  <div
140
- v-if="tooltipState?.visible"
140
+ v-if="tooltipVisible"
141
141
  :style="tooltipStyles"
142
142
  class="tooltip"
143
143
  >
@@ -159,7 +159,7 @@
159
159
  </template>
160
160
 
161
161
  <script lang="ts">
162
- import { defineComponent, PropType } from 'vue-demi'
162
+ import { defineComponent, PropType, ref } from 'vue-demi'
163
163
  import DlBrush from '../../components/DlBrush.vue'
164
164
  import DlTooltip from '../../../../essential/DlTooltip/DlTooltip.vue'
165
165
  import {
@@ -177,7 +177,7 @@ import {
177
177
  getCellWidth,
178
178
  flattenConfusionMatrix
179
179
  } from './utils'
180
- import { debounce } from 'lodash'
180
+ import { debounce, isObject } from 'lodash'
181
181
  export default defineComponent({
182
182
  components: {
183
183
  DlBrush,
@@ -218,36 +218,53 @@ export default defineComponent({
218
218
  setup(props) {
219
219
  const { variables } = useThemeVariables()
220
220
 
221
- const getCellBackground = (value: number = 1) => {
222
- return hexToRgbA(
223
- { ...variables, ...colorNames }[props.color],
224
- value
225
- )
221
+ const tooltipState = ref<{
222
+ x: string
223
+ y: string
224
+ visible?: boolean
225
+ } | null>(null)
226
+ const currentBrushState = ref<{ min: number; max: number }>({
227
+ min: 0,
228
+ max: props.matrix.length
229
+ })
230
+ const cellWidth = ref<number | null>(null)
231
+
232
+ const getCellBackground = (value: number = 1): string => {
233
+ const object: { [key: string]: any } = {
234
+ ...variables,
235
+ ...colorNames
236
+ }
237
+ const hex = object[props.color]
238
+ return hexToRgbA(hex, value)
226
239
  }
227
- return { variables, getCellBackground }
228
- },
229
- data(): {
230
- tooltipState: { x: string; y: string } | null
231
- currentBrushState: { min: number; max: number }
232
- cellWidth: number
233
- } {
234
240
  return {
235
- tooltipState: null,
236
- currentBrushState: { min: 0, max: this.matrix.length },
237
- cellWidth: null
241
+ variables,
242
+ getCellBackground,
243
+ cellWidth,
244
+ tooltipState,
245
+ currentBrushState
238
246
  }
239
247
  },
240
248
  computed: {
241
- visibleLabels(): string[] | DlConfusionMatrixLabel[] {
242
- return this.labels.slice(
243
- this.currentBrushState.min,
244
- this.currentBrushState.max
245
- )
249
+ tooltipVisible(): boolean {
250
+ return this.tooltipState?.visible
251
+ },
252
+ visibleLabels(): DlConfusionMatrixLabel[] {
253
+ if (isObject(this.labels[0])) {
254
+ const arr = this.labels as DlConfusionMatrixLabel[]
255
+ return arr.slice(
256
+ this.currentBrushState.min,
257
+ this.currentBrushState.max
258
+ )
259
+ }
260
+ return []
246
261
  },
247
262
  labelStrings(): string[] | DlConfusionMatrixLabel[] {
248
- if (typeof this.labels[0] === 'object')
249
- return this.labels.map((label: any) => label.title)
250
- else return this.labels
263
+ if (isObject(this.labels[0])) {
264
+ const arr = this.labels as DlConfusionMatrixLabel[]
265
+ return arr.map((label: DlConfusionMatrixLabel) => label.title)
266
+ }
267
+ return this.labels
251
268
  },
252
269
  labelImages(): string[] {
253
270
  return this.visibleLabels.map((label: any) => label.image)
@@ -320,9 +337,8 @@ export default defineComponent({
320
337
  30
321
338
  ),
322
339
  resizeYAxis() {
323
- (this.$refs.yAxis as HTMLElement).style.height = `${
324
- getCellWidth() * this.matrix.length
325
- }px`
340
+ const yAxis = this.$refs.yAxis as HTMLElement
341
+ yAxis.style.height = `${getCellWidth() * this.matrix.length}px`
326
342
  },
327
343
  handleMatrixScroll(e: MouseEvent) {
328
344
  const target = e.target as HTMLElement
@@ -1,3 +1,4 @@
1
+ import { isObject } from 'lodash'
1
2
  import { DlConfusionMatrixCell, DlConfusionMatrixLabel } from '../../types'
2
3
 
3
4
  export function getCellWidth() {
@@ -35,10 +36,10 @@ export function validateMatrix(
35
36
  export function normalizeMatrix(flatMatrix: DlConfusionMatrixCell[]) {
36
37
  const values = flatMatrix.map((cell) => cell.value)
37
38
  const largest = Math.max(...values)
38
- flatMatrix.forEach((cell) => {
39
+ for (const cell of flatMatrix) {
39
40
  cell.unnormalizedValue = cell.value
40
41
  cell.value = Number((cell.value / largest).toFixed(1))
41
- })
42
+ }
42
43
  return flatMatrix
43
44
  }
44
45
 
@@ -48,13 +49,17 @@ export function getGradationValues(
48
49
  ) {
49
50
  let max = Number.MIN_VALUE
50
51
  let min = Number.MAX_VALUE
51
- matrix.forEach((row) => {
52
- row.forEach((cell) => {
53
- const cellValue = typeof cell === 'object' ? cell.value : cell
52
+
53
+ for (const row of matrix) {
54
+ for (const cell of row) {
55
+ const cellValue = isObject(cell)
56
+ ? (cell as DlConfusionMatrixCell).value
57
+ : cell
54
58
  if (cellValue > max) max = cellValue
55
59
  if (cellValue < min) min = cellValue
56
- })
57
- })
60
+ }
61
+ }
62
+
58
63
  const range = (max - min) / step
59
64
  const gradationValues = []
60
65
  let amount = 0
@@ -69,28 +74,23 @@ export function flattenConfusionMatrix(
69
74
  matrix: number[][] | DlConfusionMatrixCell[][],
70
75
  labelStrings: string[] | DlConfusionMatrixLabel[]
71
76
  ) {
72
- return normalizeMatrix(
73
- matrix.flatMap(
74
- (row: number[] | DlConfusionMatrixCell[], rowIndex: number) => {
75
- return row.map(
76
- (
77
- cell: number | DlConfusionMatrixCell,
78
- cellIndex: number
79
- ) => {
80
- const isObject = typeof cell === 'object'
81
- const value = isObject ? cell.value : cell
82
- return {
83
- value,
84
- unnormalizedValue: value,
85
- xLabel: labelStrings[rowIndex],
86
- yLabel: labelStrings[cellIndex],
87
- x: rowIndex,
88
- y: cellIndex,
89
- link: isObject ? cell.link : ''
90
- }
91
- }
92
- )
93
- }
94
- )
95
- )
77
+ const toNormalize: DlConfusionMatrixCell[] = []
78
+
79
+ for (const [rowIndex, row] of matrix.entries()) {
80
+ for (const [cellIndex, cell] of row.entries()) {
81
+ const value = isObject(cell)
82
+ ? (cell as DlConfusionMatrixCell).value
83
+ : cell
84
+ toNormalize.push({
85
+ value,
86
+ unnormalizedValue: value,
87
+ xLabel: labelStrings[rowIndex],
88
+ yLabel: labelStrings[cellIndex],
89
+ x: rowIndex,
90
+ y: cellIndex,
91
+ link: isObject ? (cell as DlConfusionMatrixCell).link : ''
92
+ })
93
+ }
94
+ }
95
+ return normalizeMatrix(toNormalize)
96
96
  }
@@ -5,7 +5,7 @@ export interface DlConfusionMatrixCell {
5
5
  yLabel: string | DlConfusionMatrixLabel
6
6
  x: number
7
7
  y: number
8
- link: string
8
+ link?: string
9
9
  }
10
10
 
11
11
  export interface DlConfusionMatrixLabel {
@@ -117,7 +117,7 @@
117
117
  </div>
118
118
  </template>
119
119
  <script lang="ts">
120
- import { defineComponent, ref, PropType } from 'vue-demi'
120
+ import { defineComponent, ref, PropType, computed } from 'vue-demi'
121
121
  import { DlButton } from '../../../../basic'
122
122
  import { DlDatePicker } from '../../../DlDateTime'
123
123
  import { DlMenu, DlIcon } from '../../../../essential'
@@ -218,6 +218,10 @@ export default defineComponent({
218
218
  const styledTexarea = ref(null)
219
219
  const styledInput = ref(null)
220
220
 
221
+ const focused = ref(false)
222
+ const isOverflow = ref(false)
223
+ const isTyping = ref(false)
224
+
221
225
  const { hasEllipsis } = useSizeObserver(input)
222
226
 
223
227
  const suggestionModal = ref(false)
@@ -253,35 +257,16 @@ export default defineComponent({
253
257
  emit('update:modelValue', stringValue)
254
258
  }
255
259
 
256
- return {
257
- input,
258
- label,
259
- hasEllipsis,
260
- suggestionModal,
261
- setInputValue,
262
- menuOffset,
263
- cancelBlur,
264
- expanded,
265
- styledTexarea,
266
- styledInput,
267
- datePickerSelection,
268
- isDatePickerVisible
269
- }
270
- },
271
- data(): {
272
- focused: boolean
273
- isOverflow: boolean
274
- isTyping: boolean
275
- } {
276
- return {
277
- focused: false,
278
- isOverflow: false,
279
- isTyping: false
280
- }
281
- },
282
- computed: {
283
- statusIcon(): string {
284
- switch (this.status.type) {
260
+ const saveStatus = computed(() => {
261
+ return (
262
+ props.disabled ||
263
+ !props.modelValue ||
264
+ props.status?.type === 'error'
265
+ )
266
+ })
267
+
268
+ const statusIcon = computed(() => {
269
+ switch (props.status?.type) {
285
270
  case 'success':
286
271
  return 'icon-dl-approve-filled'
287
272
  case 'error':
@@ -291,9 +276,10 @@ export default defineComponent({
291
276
  default:
292
277
  return ''
293
278
  }
294
- },
295
- statusIconColor(): string {
296
- switch (this.status.type) {
279
+ })
280
+
281
+ const statusIconColor = computed(() => {
282
+ switch (props.status?.type) {
297
283
  case 'success':
298
284
  return 'dl-color-positive'
299
285
  case 'error':
@@ -303,65 +289,89 @@ export default defineComponent({
303
289
  default:
304
290
  return ''
305
291
  }
306
- },
307
- screenIcon(): string {
308
- return this.expanded
309
- ? 'icon-dl-fit-to-screen'
310
- : 'icon-dl-full-screen'
311
- },
312
- searchBarClasses(): string {
292
+ })
293
+
294
+ const screenIcon = computed(() => {
295
+ return expanded ? 'icon-dl-fit-to-screen' : 'icon-dl-full-screen'
296
+ })
297
+
298
+ const searchBarClasses = computed(() => {
313
299
  let classes = 'dl-smart-search-input__search-bar'
314
300
 
315
- if (this.focused && this.status.type === 'info') {
301
+ if (focused && props.status?.type === 'info') {
316
302
  classes += ' dl-smart-search-input__search-bar--focused'
317
303
  } else {
318
- if (this.status.type === 'error') {
304
+ if (props.status?.type === 'error') {
319
305
  classes += ' dl-smart-search-input__search-bar--error'
320
- } else if (this.status.type === 'warning') {
306
+ } else if (props.status?.type === 'warning') {
321
307
  classes += ' dl-smart-search-input__search-bar--warning'
322
308
  }
323
309
  }
324
310
 
325
- if (this.expanded) {
311
+ if (expanded) {
326
312
  classes += ' dl-smart-search-input__search-bar--expanded'
327
313
  }
328
314
 
329
- if (this.disabled) {
315
+ if (props.disabled) {
330
316
  classes += ' dl-smart-search-input__search-bar--disabled'
331
317
  }
332
318
 
333
319
  return classes
334
- },
335
- labelStyles(): Record<string, any> {
320
+ })
321
+
322
+ const labelStyles = computed(() => {
336
323
  return {
337
- color: this.status.type === 'error' ? 'red' : 'gray'
324
+ color: props.status?.type === 'error' ? 'red' : 'gray'
338
325
  }
339
- },
340
- messageClasses(): string {
326
+ })
327
+
328
+ const messageClasses = computed(() => {
341
329
  let classes = 'dl-smart-search-input__message'
342
330
 
343
- if (this.status) {
344
- classes += ` dl-smart-search-input__message--${this.status}`
331
+ if (props.status) {
332
+ classes += ` dl-smart-search-input__message--${props.status}`
345
333
  }
346
334
 
347
335
  return classes
348
- },
349
- withClearBtn(): boolean {
350
- return this.modelValue.length > 0
351
- },
352
- cssVars(): Record<string, string> {
336
+ })
337
+
338
+ const withClearBtn = computed(() => {
339
+ return props.modelValue?.length > 0
340
+ })
341
+
342
+ const cssVars = computed(() => {
353
343
  return {
354
344
  '--dl-smart-search-bar-wrapper-height':
355
- this.expandedInputHeight,
356
- '--dl-smart-search-input-height': this.inputHeight
345
+ props.expandedInputHeight,
346
+ '--dl-smart-search-input-height': props.inputHeight
357
347
  }
358
- },
359
- saveStatus() {
360
- return (
361
- this.disabled ||
362
- !this.modelValue ||
363
- this.status.type === 'error'
364
- )
348
+ })
349
+
350
+ return {
351
+ input,
352
+ label,
353
+ hasEllipsis,
354
+ suggestionModal,
355
+ setInputValue,
356
+ menuOffset,
357
+ cancelBlur,
358
+ expanded,
359
+ styledTexarea,
360
+ styledInput,
361
+ datePickerSelection,
362
+ isDatePickerVisible,
363
+ focused,
364
+ isOverflow,
365
+ isTyping,
366
+ saveStatus,
367
+ statusIcon,
368
+ statusIconColor,
369
+ screenIcon,
370
+ searchBarClasses,
371
+ labelStyles,
372
+ messageClasses,
373
+ withClearBtn,
374
+ cssVars
365
375
  }
366
376
  },
367
377
  watch: {
@@ -64,7 +64,7 @@ export default defineComponent({
64
64
  }),
65
65
  computed: {
66
66
  value: {
67
- get() {
67
+ get(): string | number | null {
68
68
  return this.modelValue
69
69
  },
70
70
  set(value: string | number) {
@@ -79,7 +79,7 @@ export default defineComponent({
79
79
  this.$emit('update:modelValue', buttonValue)
80
80
  }
81
81
  },
82
- toggleButtons() {
82
+ toggleButtons(): DlToggleButtonOption[] {
83
83
  return this.options.slice(0, 3)
84
84
  }
85
85
  },
@@ -3,7 +3,7 @@
3
3
  </template>
4
4
 
5
5
  <script lang="ts">
6
- import { defineComponent } from 'vue-demi'
6
+ import { computed, defineComponent } from 'vue-demi'
7
7
  import { includes } from '../../../utils'
8
8
 
9
9
  export default defineComponent({
@@ -32,31 +32,35 @@ export default defineComponent({
32
32
  default: '10px'
33
33
  }
34
34
  },
35
- computed: {
36
- styles() {
35
+ setup(props) {
36
+ const { color, height, type, indent, width } = props
37
+ const styles = computed(() => {
37
38
  let styles
38
- switch (this.type) {
39
+ switch (type) {
39
40
  case 'horizontal':
40
41
  styles = {
41
- backgroundColor: this.color,
42
- width: this.width || '300px',
43
- height: this.height || '1px',
44
- marginTop: this.indent,
45
- marginBottom: this.indent
42
+ backgroundColor: color,
43
+ width: width ?? '300px',
44
+ height: height ?? '1px',
45
+ marginTop: indent,
46
+ marginBottom: indent
46
47
  }
47
48
  break
48
49
  case 'vertical':
49
50
  styles = {
50
- backgroundColor: this.color,
51
- width: this.width || '1px',
52
- height: this.height || '300px',
53
- marginLeft: this.indent,
54
- marginRight: this.indent
51
+ backgroundColor: color,
52
+ width: width ?? '1px',
53
+ height: height ?? '300px',
54
+ marginLeft: indent,
55
+ marginRight: indent
55
56
  }
56
57
  break
58
+ default:
59
+ styles = {}
57
60
  }
58
61
  return styles
59
- }
62
+ })
63
+ return { styles }
60
64
  }
61
65
  })
62
66
  </script>
@@ -41,4 +41,116 @@ export default defineComponent({
41
41
  })
42
42
  </script>
43
43
 
44
- <style src="../styles/spinnerStyles.scss" />
44
+ <style lang="scss">
45
+ .spinner-wrapper {
46
+ display: flex;
47
+ justify-content: center;
48
+ align-items: center;
49
+ }
50
+ .dl-spinner {
51
+ vertical-align: middle;
52
+ }
53
+
54
+ .dl-spinner-mat {
55
+ animation: spinCircle 2s linear infinite;
56
+ transform-origin: center center;
57
+ }
58
+ .spinner-path {
59
+ stroke-dasharray: 1, 200 #{'/* rtl:ignore */'};
60
+ stroke-dashoffset: 0 #{'/* rtl:ignore */'};
61
+ animation: dash 1.5s ease-in-out infinite;
62
+ }
63
+
64
+ .spinner {
65
+ position: relative;
66
+ }
67
+
68
+ .spin-loader,
69
+ .spin-bg {
70
+ width: var(--dl-spinner-size);
71
+ height: var(--dl-spinner-size);
72
+ top: 0;
73
+ left: 0;
74
+ }
75
+
76
+ .spin-loader {
77
+ position: absolute;
78
+ animation: spin 2s linear infinite;
79
+ }
80
+
81
+ .dl-spinner-icon {
82
+ top: var(--icon-top);
83
+ left: var(--icon-top);
84
+ position: absolute;
85
+ width: var(--dl-spinner-icon-size);
86
+ height: var(--dl-spinner-icon-size);
87
+ opacity: 1;
88
+ animation: pulse 2s infinite;
89
+ }
90
+
91
+ .dl-svg {
92
+ fill: var(--dl-spinner-border-color);
93
+ }
94
+
95
+ .spinner-color-bg {
96
+ fill: none;
97
+ }
98
+
99
+ .spinner-color {
100
+ fill: url(#linear-gradient);
101
+ }
102
+
103
+ @keyframes dash {
104
+ 0% {
105
+ stroke-dasharray: 1, 200;
106
+ stroke-dashoffset: 0;
107
+ }
108
+ 50% {
109
+ stroke-dasharray: 89, 200;
110
+ stroke-dashoffset: -35px;
111
+ }
112
+ 100% {
113
+ stroke-dasharray: 89, 200;
114
+ stroke-dashoffset: -124px;
115
+ }
116
+ }
117
+
118
+ @keyframes spinCircle {
119
+ 0% {
120
+ transform: rotate3d(0, 0, 1, 0deg) #{'/* rtl:ignore */'};
121
+ }
122
+ 25% {
123
+ transform: rotate3d(0, 0, 1, 90deg) #{'/* rtl:ignore */'};
124
+ }
125
+ 50% {
126
+ transform: rotate3d(0, 0, 1, 180deg) #{'/* rtl:ignore */'};
127
+ }
128
+ 75% {
129
+ transform: rotate3d(0, 0, 1, 270deg) #{'/* rtl:ignore */'};
130
+ }
131
+ 100% {
132
+ transform: rotate3d(0, 0, 1, 359deg) #{'/* rtl:ignore */'};
133
+ }
134
+ }
135
+
136
+ @keyframes spin {
137
+ 0% {
138
+ transform: rotate(0deg);
139
+ }
140
+ 100% {
141
+ transform: rotate(360deg);
142
+ }
143
+ }
144
+
145
+ @keyframes pulse {
146
+ 0% {
147
+ opacity: 1;
148
+ }
149
+ 50% {
150
+ opacity: 0;
151
+ }
152
+ 100% {
153
+ opacity: 1;
154
+ }
155
+ }
156
+ </style>
@@ -76,4 +76,116 @@ export default defineComponent({
76
76
  })
77
77
  </script>
78
78
 
79
- <style src="../styles/spinnerStyles.scss" />
79
+ <style lang="scss">
80
+ .spinner-wrapper {
81
+ display: flex;
82
+ justify-content: center;
83
+ align-items: center;
84
+ }
85
+ .dl-spinner {
86
+ vertical-align: middle;
87
+ }
88
+
89
+ .dl-spinner-mat {
90
+ animation: spinCircle 2s linear infinite;
91
+ transform-origin: center center;
92
+ }
93
+ .spinner-path {
94
+ stroke-dasharray: 1, 200 #{'/* rtl:ignore */'};
95
+ stroke-dashoffset: 0 #{'/* rtl:ignore */'};
96
+ animation: dash 1.5s ease-in-out infinite;
97
+ }
98
+
99
+ .spinner {
100
+ position: relative;
101
+ }
102
+
103
+ .spin-loader,
104
+ .spin-bg {
105
+ width: var(--dl-spinner-size);
106
+ height: var(--dl-spinner-size);
107
+ top: 0;
108
+ left: 0;
109
+ }
110
+
111
+ .spin-loader {
112
+ position: absolute;
113
+ animation: spin 2s linear infinite;
114
+ }
115
+
116
+ .dl-spinner-icon {
117
+ top: var(--icon-top);
118
+ left: var(--icon-top);
119
+ position: absolute;
120
+ width: var(--dl-spinner-icon-size);
121
+ height: var(--dl-spinner-icon-size);
122
+ opacity: 1;
123
+ animation: pulse 2s infinite;
124
+ }
125
+
126
+ .dl-svg {
127
+ fill: var(--dl-spinner-border-color);
128
+ }
129
+
130
+ .spinner-color-bg {
131
+ fill: none;
132
+ }
133
+
134
+ .spinner-color {
135
+ fill: url(#linear-gradient);
136
+ }
137
+
138
+ @keyframes dash {
139
+ 0% {
140
+ stroke-dasharray: 1, 200;
141
+ stroke-dashoffset: 0;
142
+ }
143
+ 50% {
144
+ stroke-dasharray: 89, 200;
145
+ stroke-dashoffset: -35px;
146
+ }
147
+ 100% {
148
+ stroke-dasharray: 89, 200;
149
+ stroke-dashoffset: -124px;
150
+ }
151
+ }
152
+
153
+ @keyframes spinCircle {
154
+ 0% {
155
+ transform: rotate3d(0, 0, 1, 0deg) #{'/* rtl:ignore */'};
156
+ }
157
+ 25% {
158
+ transform: rotate3d(0, 0, 1, 90deg) #{'/* rtl:ignore */'};
159
+ }
160
+ 50% {
161
+ transform: rotate3d(0, 0, 1, 180deg) #{'/* rtl:ignore */'};
162
+ }
163
+ 75% {
164
+ transform: rotate3d(0, 0, 1, 270deg) #{'/* rtl:ignore */'};
165
+ }
166
+ 100% {
167
+ transform: rotate3d(0, 0, 1, 359deg) #{'/* rtl:ignore */'};
168
+ }
169
+ }
170
+
171
+ @keyframes spin {
172
+ 0% {
173
+ transform: rotate(0deg);
174
+ }
175
+ 100% {
176
+ transform: rotate(360deg);
177
+ }
178
+ }
179
+
180
+ @keyframes pulse {
181
+ 0% {
182
+ opacity: 1;
183
+ }
184
+ 50% {
185
+ opacity: 0;
186
+ }
187
+ 100% {
188
+ opacity: 1;
189
+ }
190
+ }
191
+ </style>
@@ -110,4 +110,116 @@ export default defineComponent({
110
110
  })
111
111
  </script>
112
112
 
113
- <style src="../styles/spinnerStyles.scss" />
113
+ <style lang="scss">
114
+ .spinner-wrapper {
115
+ display: flex;
116
+ justify-content: center;
117
+ align-items: center;
118
+ }
119
+ .dl-spinner {
120
+ vertical-align: middle;
121
+ }
122
+
123
+ .dl-spinner-mat {
124
+ animation: spinCircle 2s linear infinite;
125
+ transform-origin: center center;
126
+ }
127
+ .spinner-path {
128
+ stroke-dasharray: 1, 200 #{'/* rtl:ignore */'};
129
+ stroke-dashoffset: 0 #{'/* rtl:ignore */'};
130
+ animation: dash 1.5s ease-in-out infinite;
131
+ }
132
+
133
+ .spinner {
134
+ position: relative;
135
+ }
136
+
137
+ .spin-loader,
138
+ .spin-bg {
139
+ width: var(--dl-spinner-size);
140
+ height: var(--dl-spinner-size);
141
+ top: 0;
142
+ left: 0;
143
+ }
144
+
145
+ .spin-loader {
146
+ position: absolute;
147
+ animation: spin 2s linear infinite;
148
+ }
149
+
150
+ .dl-spinner-icon {
151
+ top: var(--icon-top);
152
+ left: var(--icon-top);
153
+ position: absolute;
154
+ width: var(--dl-spinner-icon-size);
155
+ height: var(--dl-spinner-icon-size);
156
+ opacity: 1;
157
+ animation: pulse 2s infinite;
158
+ }
159
+
160
+ .dl-svg {
161
+ fill: var(--dl-spinner-border-color);
162
+ }
163
+
164
+ .spinner-color-bg {
165
+ fill: none;
166
+ }
167
+
168
+ .spinner-color {
169
+ fill: url(#linear-gradient);
170
+ }
171
+
172
+ @keyframes dash {
173
+ 0% {
174
+ stroke-dasharray: 1, 200;
175
+ stroke-dashoffset: 0;
176
+ }
177
+ 50% {
178
+ stroke-dasharray: 89, 200;
179
+ stroke-dashoffset: -35px;
180
+ }
181
+ 100% {
182
+ stroke-dasharray: 89, 200;
183
+ stroke-dashoffset: -124px;
184
+ }
185
+ }
186
+
187
+ @keyframes spinCircle {
188
+ 0% {
189
+ transform: rotate3d(0, 0, 1, 0deg) #{'/* rtl:ignore */'};
190
+ }
191
+ 25% {
192
+ transform: rotate3d(0, 0, 1, 90deg) #{'/* rtl:ignore */'};
193
+ }
194
+ 50% {
195
+ transform: rotate3d(0, 0, 1, 180deg) #{'/* rtl:ignore */'};
196
+ }
197
+ 75% {
198
+ transform: rotate3d(0, 0, 1, 270deg) #{'/* rtl:ignore */'};
199
+ }
200
+ 100% {
201
+ transform: rotate3d(0, 0, 1, 359deg) #{'/* rtl:ignore */'};
202
+ }
203
+ }
204
+
205
+ @keyframes spin {
206
+ 0% {
207
+ transform: rotate(0deg);
208
+ }
209
+ 100% {
210
+ transform: rotate(360deg);
211
+ }
212
+ }
213
+
214
+ @keyframes pulse {
215
+ 0% {
216
+ opacity: 1;
217
+ }
218
+ 50% {
219
+ opacity: 0;
220
+ }
221
+ 100% {
222
+ opacity: 1;
223
+ }
224
+ }
225
+ </style>
@@ -163,4 +163,116 @@ export default defineComponent({
163
163
  })
164
164
  </script>
165
165
 
166
- <style src="../styles/spinnerStyles.scss" />
166
+ <style lang="scss">
167
+ .spinner-wrapper {
168
+ display: flex;
169
+ justify-content: center;
170
+ align-items: center;
171
+ }
172
+ .dl-spinner {
173
+ vertical-align: middle;
174
+ }
175
+
176
+ .dl-spinner-mat {
177
+ animation: spinCircle 2s linear infinite;
178
+ transform-origin: center center;
179
+ }
180
+ .spinner-path {
181
+ stroke-dasharray: 1, 200 #{'/* rtl:ignore */'};
182
+ stroke-dashoffset: 0 #{'/* rtl:ignore */'};
183
+ animation: dash 1.5s ease-in-out infinite;
184
+ }
185
+
186
+ .spinner {
187
+ position: relative;
188
+ }
189
+
190
+ .spin-loader,
191
+ .spin-bg {
192
+ width: var(--dl-spinner-size);
193
+ height: var(--dl-spinner-size);
194
+ top: 0;
195
+ left: 0;
196
+ }
197
+
198
+ .spin-loader {
199
+ position: absolute;
200
+ animation: spin 2s linear infinite;
201
+ }
202
+
203
+ .dl-spinner-icon {
204
+ top: var(--icon-top);
205
+ left: var(--icon-top);
206
+ position: absolute;
207
+ width: var(--dl-spinner-icon-size);
208
+ height: var(--dl-spinner-icon-size);
209
+ opacity: 1;
210
+ animation: pulse 2s infinite;
211
+ }
212
+
213
+ .dl-svg {
214
+ fill: var(--dl-spinner-border-color);
215
+ }
216
+
217
+ .spinner-color-bg {
218
+ fill: none;
219
+ }
220
+
221
+ .spinner-color {
222
+ fill: url(#linear-gradient);
223
+ }
224
+
225
+ @keyframes dash {
226
+ 0% {
227
+ stroke-dasharray: 1, 200;
228
+ stroke-dashoffset: 0;
229
+ }
230
+ 50% {
231
+ stroke-dasharray: 89, 200;
232
+ stroke-dashoffset: -35px;
233
+ }
234
+ 100% {
235
+ stroke-dasharray: 89, 200;
236
+ stroke-dashoffset: -124px;
237
+ }
238
+ }
239
+
240
+ @keyframes spinCircle {
241
+ 0% {
242
+ transform: rotate3d(0, 0, 1, 0deg) #{'/* rtl:ignore */'};
243
+ }
244
+ 25% {
245
+ transform: rotate3d(0, 0, 1, 90deg) #{'/* rtl:ignore */'};
246
+ }
247
+ 50% {
248
+ transform: rotate3d(0, 0, 1, 180deg) #{'/* rtl:ignore */'};
249
+ }
250
+ 75% {
251
+ transform: rotate3d(0, 0, 1, 270deg) #{'/* rtl:ignore */'};
252
+ }
253
+ 100% {
254
+ transform: rotate3d(0, 0, 1, 359deg) #{'/* rtl:ignore */'};
255
+ }
256
+ }
257
+
258
+ @keyframes spin {
259
+ 0% {
260
+ transform: rotate(0deg);
261
+ }
262
+ 100% {
263
+ transform: rotate(360deg);
264
+ }
265
+ }
266
+
267
+ @keyframes pulse {
268
+ 0% {
269
+ opacity: 1;
270
+ }
271
+ 50% {
272
+ opacity: 0;
273
+ }
274
+ 100% {
275
+ opacity: 1;
276
+ }
277
+ }
278
+ </style>
@@ -149,4 +149,116 @@ export default defineComponent({
149
149
  })
150
150
  </script>
151
151
 
152
- <style src="../styles/spinnerStyles.scss" />
152
+ <style lang="scss">
153
+ .spinner-wrapper {
154
+ display: flex;
155
+ justify-content: center;
156
+ align-items: center;
157
+ }
158
+ .dl-spinner {
159
+ vertical-align: middle;
160
+ }
161
+
162
+ .dl-spinner-mat {
163
+ animation: spinCircle 2s linear infinite;
164
+ transform-origin: center center;
165
+ }
166
+ .spinner-path {
167
+ stroke-dasharray: 1, 200 #{'/* rtl:ignore */'};
168
+ stroke-dashoffset: 0 #{'/* rtl:ignore */'};
169
+ animation: dash 1.5s ease-in-out infinite;
170
+ }
171
+
172
+ .spinner {
173
+ position: relative;
174
+ }
175
+
176
+ .spin-loader,
177
+ .spin-bg {
178
+ width: var(--dl-spinner-size);
179
+ height: var(--dl-spinner-size);
180
+ top: 0;
181
+ left: 0;
182
+ }
183
+
184
+ .spin-loader {
185
+ position: absolute;
186
+ animation: spin 2s linear infinite;
187
+ }
188
+
189
+ .dl-spinner-icon {
190
+ top: var(--icon-top);
191
+ left: var(--icon-top);
192
+ position: absolute;
193
+ width: var(--dl-spinner-icon-size);
194
+ height: var(--dl-spinner-icon-size);
195
+ opacity: 1;
196
+ animation: pulse 2s infinite;
197
+ }
198
+
199
+ .dl-svg {
200
+ fill: var(--dl-spinner-border-color);
201
+ }
202
+
203
+ .spinner-color-bg {
204
+ fill: none;
205
+ }
206
+
207
+ .spinner-color {
208
+ fill: url(#linear-gradient);
209
+ }
210
+
211
+ @keyframes dash {
212
+ 0% {
213
+ stroke-dasharray: 1, 200;
214
+ stroke-dashoffset: 0;
215
+ }
216
+ 50% {
217
+ stroke-dasharray: 89, 200;
218
+ stroke-dashoffset: -35px;
219
+ }
220
+ 100% {
221
+ stroke-dasharray: 89, 200;
222
+ stroke-dashoffset: -124px;
223
+ }
224
+ }
225
+
226
+ @keyframes spinCircle {
227
+ 0% {
228
+ transform: rotate3d(0, 0, 1, 0deg) #{'/* rtl:ignore */'};
229
+ }
230
+ 25% {
231
+ transform: rotate3d(0, 0, 1, 90deg) #{'/* rtl:ignore */'};
232
+ }
233
+ 50% {
234
+ transform: rotate3d(0, 0, 1, 180deg) #{'/* rtl:ignore */'};
235
+ }
236
+ 75% {
237
+ transform: rotate3d(0, 0, 1, 270deg) #{'/* rtl:ignore */'};
238
+ }
239
+ 100% {
240
+ transform: rotate3d(0, 0, 1, 359deg) #{'/* rtl:ignore */'};
241
+ }
242
+ }
243
+
244
+ @keyframes spin {
245
+ 0% {
246
+ transform: rotate(0deg);
247
+ }
248
+ 100% {
249
+ transform: rotate(360deg);
250
+ }
251
+ }
252
+
253
+ @keyframes pulse {
254
+ 0% {
255
+ opacity: 1;
256
+ }
257
+ 50% {
258
+ opacity: 0;
259
+ }
260
+ 100% {
261
+ opacity: 1;
262
+ }
263
+ }
264
+ </style>
@@ -23,29 +23,27 @@
23
23
 
24
24
  <script lang="ts">
25
25
  import { DlIcon, DlInput, DlToggleButton } from '../components'
26
+ import { DlToggleButtonOption } from '../components/types'
26
27
  import { defineComponent } from 'vue-demi'
27
28
 
28
29
  export default defineComponent({
29
30
  name: 'DlToggleButtonDemo',
30
31
  components: { DlIcon, DlInput, DlToggleButton },
31
- setup() {
32
- return {
33
- DlToggleButton
34
- }
35
- },
36
32
  data: () => ({
37
33
  options: [
38
34
  { label: 'Button 1', value: 1 },
39
35
  { label: 'Button 2', value: 2 },
40
36
  { label: 'Button 3', value: 3 }
41
- ],
37
+ ] as DlToggleButtonOption[],
42
38
  selectedValue: 1,
43
39
  width: '100%'
44
40
  }),
45
41
  computed: {
46
- label() {
47
- return this.options.find((o) => o.value === this.selectedValue)
48
- ?.label
42
+ label(): string {
43
+ const option = this.options.find(
44
+ (o: DlToggleButtonOption) => o.value === this.selectedValue
45
+ )
46
+ return option?.label ?? ''
49
47
  }
50
48
  },
51
49
  methods: {
@@ -1,111 +0,0 @@
1
- .spinner-wrapper {
2
- display: flex;
3
- justify-content: center;
4
- align-items: center;
5
- }
6
- .dl-spinner {
7
- vertical-align: middle;
8
- }
9
-
10
- .dl-spinner-mat {
11
- animation: spinCircle 2s linear infinite;
12
- transform-origin: center center;
13
- }
14
- .spinner-path {
15
- stroke-dasharray: 1, 200 #{'/* rtl:ignore */'};
16
- stroke-dashoffset: 0 #{'/* rtl:ignore */'};
17
- animation: dash 1.5s ease-in-out infinite;
18
- }
19
-
20
- .spinner {
21
- position: relative;
22
- }
23
-
24
- .spin-loader,
25
- .spin-bg {
26
- width: var(--dl-spinner-size);
27
- height: var(--dl-spinner-size);
28
- top: 0;
29
- left: 0;
30
- }
31
-
32
- .spin-loader {
33
- position: absolute;
34
- animation: spin 2s linear infinite;
35
- }
36
-
37
- .dl-spinner-icon {
38
- top: var(--icon-top);
39
- left: var(--icon-top);
40
- position: absolute;
41
- width: var(--dl-spinner-icon-size);
42
- height: var(--dl-spinner-icon-size);
43
- opacity: 1;
44
- animation: pulse 2s infinite;
45
- }
46
-
47
- .dl-svg {
48
- fill: var(--dl-spinner-border-color);
49
- }
50
-
51
- .spinner-color-bg {
52
- fill: none;
53
- }
54
-
55
- .spinner-color {
56
- fill: url(#linear-gradient);
57
- }
58
-
59
- @keyframes dash {
60
- 0% {
61
- stroke-dasharray: 1, 200;
62
- stroke-dashoffset: 0;
63
- }
64
- 50% {
65
- stroke-dasharray: 89, 200;
66
- stroke-dashoffset: -35px;
67
- }
68
- 100% {
69
- stroke-dasharray: 89, 200;
70
- stroke-dashoffset: -124px;
71
- }
72
- }
73
-
74
- @keyframes spinCircle {
75
- 0% {
76
- transform: rotate3d(0, 0, 1, 0deg) #{'/* rtl:ignore */'};
77
- }
78
- 25% {
79
- transform: rotate3d(0, 0, 1, 90deg) #{'/* rtl:ignore */'};
80
- }
81
- 50% {
82
- transform: rotate3d(0, 0, 1, 180deg) #{'/* rtl:ignore */'};
83
- }
84
- 75% {
85
- transform: rotate3d(0, 0, 1, 270deg) #{'/* rtl:ignore */'};
86
- }
87
- 100% {
88
- transform: rotate3d(0, 0, 1, 359deg) #{'/* rtl:ignore */'};
89
- }
90
- }
91
-
92
- @keyframes spin {
93
- 0% {
94
- transform: rotate(0deg);
95
- }
96
- 100% {
97
- transform: rotate(360deg);
98
- }
99
- }
100
-
101
- @keyframes pulse {
102
- 0% {
103
- opacity: 1;
104
- }
105
- 50% {
106
- opacity: 0;
107
- }
108
- 100% {
109
- opacity: 1;
110
- }
111
- }