@dataloop-ai/components 0.20.13 → 0.20.15

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.20.13",
3
+ "version": "0.20.15",
4
4
  "exports": {
5
5
  ".": "./index.ts",
6
6
  "./models": "./models.ts",
@@ -15,9 +15,12 @@
15
15
  :color="iconColor"
16
16
  :size="iconSize"
17
17
  />
18
- <span class="text" :style="textStyle"
19
- ><slot v-if="!text" /> <span v-else> {{ text }}</span></span
20
- >
18
+ <span class="text" :style="textStyle">
19
+ <slot v-if="!text" />
20
+ <span v-else>
21
+ {{ text }}
22
+ </span>
23
+ </span>
21
24
  </div>
22
25
  <div
23
26
  v-if="closable"
@@ -46,6 +49,7 @@ import {
46
49
  onMounted,
47
50
  Ref,
48
51
  ref,
52
+ toRefs,
49
53
  watch
50
54
  } from 'vue-demi'
51
55
  import { getColor, includes } from '../../../utils'
@@ -112,15 +116,19 @@ export default defineComponent({
112
116
  text: {
113
117
  type: String,
114
118
  default: null
119
+ },
120
+ padding: {
121
+ type: String,
122
+ default: null
115
123
  }
116
124
  },
117
125
  emits: ['update:model-value'],
118
126
  setup(props, { emit }) {
119
- const show = ref(props.modelValue)
120
- const type = ref(props.type as DlAlertType)
121
- const typeIcon = computed(() => typeToIconMap[type.value])
122
- const icon = computed(() => typeToIconMap[type.value])
123
- const iconColor = computed(() => typeToIconColorMap[type.value])
127
+ const { padding, modelValue, type } = toRefs(props)
128
+ const icon = computed(() => typeToIconMap[type.value as DlAlertType])
129
+ const iconColor = computed(
130
+ () => typeToIconColorMap[type.value as DlAlertType]
131
+ )
124
132
  const textStyle = computed(() => ({
125
133
  color: getColor(props.textColor, 'dl-color-darker')
126
134
  }))
@@ -134,26 +142,21 @@ export default defineComponent({
134
142
  normalizeStyles(props.fluid)
135
143
  })
136
144
 
137
- watch(
138
- () => props.modelValue,
139
- (val) => {
140
- show.value = val
141
- }
142
- )
145
+ watch(modelValue, (val) => {
146
+ modelValue.value = val
147
+ })
143
148
 
144
- watch(
145
- () => props.type,
146
- (val) => {
147
- type.value = val as DlAlertType
148
- }
149
- )
149
+ watch(type, (val) => {
150
+ type.value = val as DlAlertType
151
+ })
150
152
 
151
153
  watch(
152
154
  [
153
155
  () => props.fluid,
154
156
  () => props.text,
155
157
  () => props.closable,
156
- () => props.type
158
+ () => props.type,
159
+ () => props.padding
157
160
  ],
158
161
  ([fluid]) => {
159
162
  normalizeStyles(fluid)
@@ -169,7 +172,9 @@ export default defineComponent({
169
172
  display: 'flex'
170
173
  }
171
174
  const rootS: Record<string, any> = {
172
- backgroundColor: getColor(typeToBackgroundMap[type.value])
175
+ backgroundColor: getColor(
176
+ typeToBackgroundMap[type.value as DlAlertType]
177
+ )
173
178
  }
174
179
  if (height > 46) {
175
180
  iconS.alignSelf = 'flex-start'
@@ -181,6 +186,11 @@ export default defineComponent({
181
186
  } else {
182
187
  rootS.width = 'fit-content'
183
188
  }
189
+
190
+ if (padding.value) {
191
+ rootS['--dl-alert-padding'] = padding.value
192
+ }
193
+
184
194
  iconStyle.value = iconS
185
195
  rootStyle.value = rootS
186
196
  closeButtonStyle.value = iconS
@@ -188,14 +198,14 @@ export default defineComponent({
188
198
  }
189
199
 
190
200
  function handleClose() {
191
- show.value = false
201
+ modelValue.value = false
192
202
  emit('update:model-value', false)
193
203
  }
194
204
 
195
205
  return {
196
206
  uuid: `dl-alert-${v4()}`,
197
207
  rootRef,
198
- show,
208
+ show: modelValue,
199
209
  icon,
200
210
  iconColor,
201
211
  rootStyle,
@@ -221,7 +231,7 @@ export default defineComponent({
221
231
  > div {
222
232
  display: flex;
223
233
  flex-direction: row;
224
- padding: 10px 16px;
234
+ padding: var(--dl-alert-padding, 10px 16px);
225
235
  }
226
236
 
227
237
  .text {
@@ -28,7 +28,7 @@
28
28
  >
29
29
  <template #selected="scope">
30
30
  <span class="json-query-menu-option">
31
- {{ scope.opt.label }}
31
+ {{ scope.opt ? scope.opt.label : '' }}
32
32
  </span>
33
33
  </template>
34
34
  <template #option="scope">
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <DlAlert type="info" :closable="true" fluid>
3
+ <DlAlert type="info" :closable="true" fluid padding="150px">
4
4
  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quas eos
5
5
  amet, nobis unde animi atque itaque? Provident suscipit enim eos
6
6
  sequi dolor minima optio tempora error tenetur, autem ratione