@dataloop-ai/components 0.15.3 → 0.15.4

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.15.3",
3
+ "version": "0.15.4",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -41,7 +41,15 @@
41
41
 
42
42
  <script lang="ts">
43
43
  import { v4 } from 'uuid'
44
- import { computed, defineComponent, onMounted, Ref, ref, watch } from 'vue-demi'
44
+ import {
45
+ computed,
46
+ defineComponent,
47
+ nextTick,
48
+ onMounted,
49
+ ref,
50
+ Ref,
51
+ watch
52
+ } from 'vue-demi'
45
53
  import { getColor, includes } from '../utils'
46
54
  import { DlIcon } from './'
47
55
 
@@ -138,32 +146,29 @@ export default defineComponent({
138
146
  )
139
147
 
140
148
  function normalizeStyles(fluid?: boolean) {
141
- const { height } = (
142
- rootRef as Ref<HTMLElement | null>
143
- ).value!.getBoundingClientRect()
144
-
145
- const iconS: Record<string, any> = {
146
- display: 'flex'
147
- }
148
-
149
- const rootS: Record<string, any> = {
150
- backgroundColor: getColor(typeToBackgroundMap[type])
151
- }
152
-
153
- if (height > 36) {
154
- iconS.alignSelf = 'flex-start'
155
- } else {
156
- iconS.alignSelf = 'center'
157
- }
158
-
159
- if (fluid === true) {
160
- rootS.width = '100%'
161
- } else {
162
- rootS.width = 'fit-content'
163
- }
164
-
165
- iconStyle.value = iconS
166
- rootStyle.value = rootS
149
+ nextTick(() => {
150
+ const { height } = (
151
+ rootRef as Ref<HTMLElement | null>
152
+ ).value!.getBoundingClientRect()
153
+ const iconS: Record<string, any> = {
154
+ display: 'flex'
155
+ }
156
+ const rootS: Record<string, any> = {
157
+ backgroundColor: getColor(typeToBackgroundMap[type])
158
+ }
159
+ if (height > 36) {
160
+ iconS.alignSelf = 'flex-start'
161
+ } else {
162
+ iconS.alignSelf = 'center'
163
+ }
164
+ if (fluid === true) {
165
+ rootS.width = '100%'
166
+ } else {
167
+ rootS.width = 'fit-content'
168
+ }
169
+ iconStyle.value = iconS
170
+ rootStyle.value = rootS
171
+ })
167
172
  }
168
173
 
169
174
  function handleClose() {
@@ -199,7 +204,7 @@ export default defineComponent({
199
204
  > div {
200
205
  display: flex;
201
206
  flex-direction: row;
202
- padding: 10px 10px 10px 16px;
207
+ padding: 10px 16px;
203
208
  }
204
209
 
205
210
  .text {
@@ -12,10 +12,12 @@
12
12
  `v-toast__item--${position}`,
13
13
  classItem
14
14
  ]"
15
+ :style="{ width }"
15
16
  >
16
17
  <dl-alert
17
18
  :type="type"
18
19
  :closable="closable"
20
+ fluid
19
21
  @update:model-value="(val) => closeToast(val)"
20
22
  >
21
23
  <span
@@ -29,11 +31,11 @@
29
31
 
30
32
  <script lang="ts">
31
33
  import {
34
+ computed,
32
35
  defineComponent,
33
- ref,
34
36
  onBeforeMount,
35
- computed,
36
- onMounted
37
+ onMounted,
38
+ ref
37
39
  } from 'vue-demi'
38
40
  import DlAlert from '../../DlAlert.vue'
39
41
  import { Positions, Types } from '../utils/config'
@@ -59,6 +61,10 @@ export default defineComponent({
59
61
  type: String,
60
62
  default: ''
61
63
  },
64
+ width: {
65
+ type: String,
66
+ default: 'auto'
67
+ },
62
68
  duration: {
63
69
  type: Number,
64
70
  default: 10
@@ -183,18 +189,16 @@ export default defineComponent({
183
189
  overflow: hidden;
184
190
  z-index: 1052;
185
191
  pointer-events: none;
186
- &__text {
187
- min-width: 300px;
188
- max-width: 800px;
189
- }
190
192
  &__item {
191
193
  display: inline-flex;
192
194
  align-items: center;
193
195
  pointer-events: auto;
194
- margin-bottom: 5px;
195
- margin-top: 5px;
196
+ min-width: 400px;
197
+ max-width: 900px;
198
+ margin: 5px;
196
199
  cursor: pointer;
197
200
  animation-duration: 150ms;
201
+
198
202
  &.v-toast__item--top,
199
203
  &.v-toast__item--bottom {
200
204
  align-self: center;
@@ -15,6 +15,10 @@
15
15
  v-model="classItem"
16
16
  title="Custom class for toast item"
17
17
  />
18
+ <dl-text-input
19
+ v-model="width"
20
+ title="Custom width for toast item"
21
+ />
18
22
  </div>
19
23
  <div class="flex">
20
24
  <div>
@@ -95,6 +99,7 @@ import DlTextInput from '../components/DlTextInput.vue'
95
99
  import DlRadio from '../components/DlRadio.vue'
96
100
  import DlTextArea from '../components/DlTextArea.vue'
97
101
  import DlSwitch from '../components/DlSwitch.vue'
102
+
98
103
  export default defineComponent({
99
104
  name: 'DlToast',
100
105
  components: {
@@ -113,6 +118,7 @@ export default defineComponent({
113
118
  const position = ref('bottom')
114
119
  const closable = ref(true)
115
120
  const classItem = ref('demo-toast')
121
+ const width = ref('auto')
116
122
  function showToastMessage() {
117
123
  DlToast.open({
118
124
  message: message.value,
@@ -120,7 +126,8 @@ export default defineComponent({
120
126
  type: type.value,
121
127
  duration: duration.value,
122
128
  classItem: classItem.value,
123
- closable: closable.value
129
+ closable: closable.value,
130
+ width: width.value
124
131
  })
125
132
  }
126
133
  return {
@@ -130,7 +137,8 @@ export default defineComponent({
130
137
  type,
131
138
  position,
132
139
  classItem,
133
- closable
140
+ closable,
141
+ width
134
142
  }
135
143
  }
136
144
  })