@indielayer/ui 1.8.0 → 1.8.2
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/docs/pages/component/form/usage.vue +1 -0
- package/docs/pages/component/modal/composed.vue +10 -1
- package/docs/pages/component/select/usage.vue +2 -2
- package/docs/pages/component/tag/usage.vue +5 -4
- package/lib/components/checkbox/Checkbox.vue.d.ts +4 -0
- package/lib/components/datepicker/Datepicker.vue.d.ts +4 -0
- package/lib/components/formGroup/FormGroup.vue.d.ts +4 -0
- package/lib/components/input/Input.vue.d.ts +4 -0
- package/lib/components/modal/Modal.vue.js +74 -70
- package/lib/components/radio/Radio.vue.d.ts +4 -0
- package/lib/components/select/Select.vue.d.ts +4 -0
- package/lib/components/select/Select.vue.js +188 -200
- package/lib/components/slider/Slider.vue.d.ts +4 -0
- package/lib/components/tag/Tag.vue.d.ts +4 -0
- package/lib/components/tag/Tag.vue.js +32 -31
- package/lib/components/tag/theme/Tag.base.theme.js +2 -2
- package/lib/components/tag/theme/Tag.carbon.theme.js +1 -1
- package/lib/components/textarea/Textarea.vue.d.ts +4 -0
- package/lib/components/toggle/Toggle.vue.d.ts +4 -0
- package/lib/composables/useInputtable.d.ts +1 -0
- package/lib/composables/useInputtable.js +31 -30
- package/lib/index.js +1 -1
- package/lib/index.umd.js +4 -4
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/components/modal/Modal.vue +11 -2
- package/src/components/select/Select.vue +17 -21
- package/src/components/tag/Tag.vue +9 -5
- package/src/components/tag/theme/Tag.base.theme.ts +6 -6
- package/src/components/tag/theme/Tag.carbon.theme.ts +1 -1
- package/src/composables/useInputtable.ts +6 -3
- package/src/version.ts +1 -1
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.8.
|
|
1
|
+
declare const _default: "1.8.2";
|
|
2
2
|
export default _default;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ export default {
|
|
|
67
67
|
</script>
|
|
68
68
|
|
|
69
69
|
<script setup lang="ts">
|
|
70
|
-
import { ref, watch, type PropType, type ExtractPublicPropTypes, computed, nextTick
|
|
70
|
+
import { ref, watch, type PropType, type ExtractPublicPropTypes, computed, nextTick } from 'vue'
|
|
71
71
|
import { onClickOutside, useEventListener } from '@vueuse/core'
|
|
72
72
|
import { useTheme, type ThemeComponent } from '../../composables/useTheme'
|
|
73
73
|
import { useFocusTrap } from '../../composables/useFocusTrap'
|
|
@@ -132,8 +132,17 @@ async function checkVisibiliy() {
|
|
|
132
132
|
|
|
133
133
|
if (typeof window !== 'undefined') useEventListener(document, 'keydown', onKeyDown)
|
|
134
134
|
|
|
135
|
+
const shouldIgnoreEvent = (event: KeyboardEvent) => {
|
|
136
|
+
return ['.v-popper__popper', '.x-datepicker'].some((target) => {
|
|
137
|
+
if (typeof target === 'string') {
|
|
138
|
+
return Array.from(window.document.querySelectorAll(target))
|
|
139
|
+
.some((el) => el === event.target || event.composedPath().includes(el))
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
}
|
|
143
|
+
|
|
135
144
|
function onKeyDown(event: KeyboardEvent) {
|
|
136
|
-
if (event.key === 'Escape' && value.value && !props.persistent) close()
|
|
145
|
+
if (event.key === 'Escape' && !shouldIgnoreEvent(event) && value.value && !props.persistent) close()
|
|
137
146
|
}
|
|
138
147
|
|
|
139
148
|
function clickOutsideCallback() {
|
|
@@ -69,6 +69,8 @@ const selectedIndex = ref<number | undefined>()
|
|
|
69
69
|
const filter = ref('')
|
|
70
70
|
const filterRef = ref<InstanceType<typeof XInput> | null>(null)
|
|
71
71
|
|
|
72
|
+
const isDisabled = computed(() => props.disabled || props.loading || props.readonly)
|
|
73
|
+
|
|
72
74
|
const selected = computed<any | any[]>({
|
|
73
75
|
get() {
|
|
74
76
|
if (props.multiple) {
|
|
@@ -239,6 +241,8 @@ function isEmpty(value: string | number | []) {
|
|
|
239
241
|
function handleRemove(e: Event, value: string) {
|
|
240
242
|
e.stopPropagation()
|
|
241
243
|
|
|
244
|
+
if (isDisabled.value) return
|
|
245
|
+
|
|
242
246
|
// find value in selected and remove it
|
|
243
247
|
const index = selected.value.indexOf(value)
|
|
244
248
|
|
|
@@ -355,7 +359,7 @@ defineExpose({ focus, blur, reset, validate, setError })
|
|
|
355
359
|
tabindex="0"
|
|
356
360
|
class="group"
|
|
357
361
|
:style="styles"
|
|
358
|
-
:disabled="
|
|
362
|
+
:disabled="isDisabled"
|
|
359
363
|
:required="required"
|
|
360
364
|
:is-inside-form="isInsideForm"
|
|
361
365
|
:label="label"
|
|
@@ -368,26 +372,11 @@ defineExpose({ focus, blur, reset, validate, setError })
|
|
|
368
372
|
>
|
|
369
373
|
<div class="relative">
|
|
370
374
|
<div v-if="native && !multiple" :class="classes.box" @click="elRef?.click()">
|
|
371
|
-
<template v-if="
|
|
372
|
-
<div class="flex gap-1 flex-wrap">
|
|
373
|
-
<x-tag
|
|
374
|
-
v-for="value in selected"
|
|
375
|
-
:key="value"
|
|
376
|
-
size="xs"
|
|
377
|
-
outlined
|
|
378
|
-
removable
|
|
379
|
-
@remove="(e: Event) => { handleRemove(e, value) }"
|
|
380
|
-
>{{ getLabel(value) }}</x-tag>
|
|
381
|
-
</div>
|
|
382
|
-
</template>
|
|
383
|
-
<template v-else-if="!multiple && !isEmpty(selected)">
|
|
375
|
+
<template v-if="!isEmpty(selected)">
|
|
384
376
|
{{ getLabel(selected) }}
|
|
385
377
|
</template>
|
|
386
378
|
<template v-else>
|
|
387
|
-
<div
|
|
388
|
-
v-if="placeholder"
|
|
389
|
-
class="text-secondary-400 dark:text-secondary-500"
|
|
390
|
-
>
|
|
379
|
+
<div v-if="placeholder" class="text-secondary-400 dark:text-secondary-500">
|
|
391
380
|
{{ placeholder }}
|
|
392
381
|
</div>
|
|
393
382
|
<div v-else> </div>
|
|
@@ -396,7 +385,7 @@ defineExpose({ focus, blur, reset, validate, setError })
|
|
|
396
385
|
<x-popover
|
|
397
386
|
v-else
|
|
398
387
|
ref="popoverRef"
|
|
399
|
-
:disabled="
|
|
388
|
+
:disabled="isDisabled"
|
|
400
389
|
>
|
|
401
390
|
<div
|
|
402
391
|
:class="[classes.box]"
|
|
@@ -407,8 +396,9 @@ defineExpose({ focus, blur, reset, validate, setError })
|
|
|
407
396
|
v-for="value in selected"
|
|
408
397
|
:key="value"
|
|
409
398
|
size="xs"
|
|
410
|
-
outlined
|
|
411
399
|
removable
|
|
400
|
+
:outlined="!(isDisabled || options?.find((i) => i.value === value)?.disabled)"
|
|
401
|
+
:disabled="isDisabled || options?.find((i) => i.value === value)?.disabled"
|
|
412
402
|
@remove="(e: Event) => { handleRemove(e, value) }"
|
|
413
403
|
>{{ getLabel(value) }}</x-tag>
|
|
414
404
|
</div>
|
|
@@ -432,7 +422,13 @@ defineExpose({ focus, blur, reset, validate, setError })
|
|
|
432
422
|
<x-popover-container :class="classes.content">
|
|
433
423
|
<slot name="content-header">
|
|
434
424
|
<div v-if="filterable" :class="classes.search">
|
|
435
|
-
<x-input
|
|
425
|
+
<x-input
|
|
426
|
+
ref="filterRef"
|
|
427
|
+
v-model="filter"
|
|
428
|
+
:placeholder="filterPlaceholder"
|
|
429
|
+
skip-form-registry
|
|
430
|
+
size="sm"
|
|
431
|
+
/>
|
|
436
432
|
</div>
|
|
437
433
|
</slot>
|
|
438
434
|
<div v-if="internalOptions.length > 0" :class="classes.contentBody">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
const tagProps = {
|
|
3
3
|
...useCommon.props(),
|
|
4
|
-
...useColors.props('
|
|
4
|
+
...useColors.props('slate'),
|
|
5
5
|
tag: {
|
|
6
6
|
type: String,
|
|
7
7
|
default: 'span',
|
|
@@ -9,6 +9,7 @@ const tagProps = {
|
|
|
9
9
|
rounded: Boolean,
|
|
10
10
|
removable: Boolean,
|
|
11
11
|
outlined: Boolean,
|
|
12
|
+
disabled: Boolean,
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export type TagProps = ExtractPublicPropTypes<typeof tagProps>
|
|
@@ -52,13 +53,15 @@ const { styles, classes, className } = useTheme('Tag', {}, props)
|
|
|
52
53
|
<template>
|
|
53
54
|
<component
|
|
54
55
|
:is="tag"
|
|
55
|
-
class="text-[color:var(--x-tag-text)] dark:text-[color:var(--x-tag-dark-text)] border
|
|
56
|
+
class="text-[color:var(--x-tag-text)] dark:text-[color:var(--x-tag-dark-text)] border"
|
|
56
57
|
:style="styles"
|
|
57
58
|
:class="
|
|
58
59
|
[
|
|
59
60
|
className,
|
|
60
61
|
classes.wrapper,
|
|
61
|
-
outlined ?
|
|
62
|
+
outlined ?
|
|
63
|
+
'border-[color:var(--x-tag-border)] dark:border-[color:var(--x-tag-dark-border)]' :
|
|
64
|
+
'border-transparent bg-[color:var(--x-tag-bg)] dark:bg-[color:var(--x-tag-dark-bg)]',
|
|
62
65
|
rounded ? 'rounded-full' : 'rounded'
|
|
63
66
|
]"
|
|
64
67
|
>
|
|
@@ -70,8 +73,9 @@ const { styles, classes, className } = useTheme('Tag', {}, props)
|
|
|
70
73
|
<x-icon
|
|
71
74
|
:size="closeIconSize"
|
|
72
75
|
:icon="closeIcon"
|
|
73
|
-
class="ml-1.5 cursor-pointer
|
|
74
|
-
|
|
76
|
+
class="ml-1.5 -mt-0.5 cursor-pointer transition-colors duration-150"
|
|
77
|
+
:class="[disabled ? 'text-secondary-400' : 'hover:text-secondary-500']"
|
|
78
|
+
@click="(e: Event) => !disabled && $emit('remove', e)"
|
|
75
79
|
/>
|
|
76
80
|
</span>
|
|
77
81
|
|
|
@@ -3,13 +3,13 @@ import type { TagTheme } from '../Tag.vue'
|
|
|
3
3
|
const theme: TagTheme = {
|
|
4
4
|
classes: {
|
|
5
5
|
wrapper: ({ props }) => {
|
|
6
|
-
let c = 'inline-flex
|
|
6
|
+
let c = 'inline-flex leading-tight max-w-full'
|
|
7
7
|
|
|
8
|
-
if (props.size === 'xs') c += ' px-2 py-
|
|
9
|
-
else if (props.size === 'sm') c += ' px-2 py-
|
|
10
|
-
else if (props.size === 'lg') c += ' px-4 py-
|
|
11
|
-
else if (props.size === 'xl') c += ' px-
|
|
12
|
-
else c += ' px-3 py-
|
|
8
|
+
if (props.size === 'xs') c += ' px-2 py-0.5 text-xs'
|
|
9
|
+
else if (props.size === 'sm') c += ' px-2 py-0.5 text-sm'
|
|
10
|
+
else if (props.size === 'lg') c += ' px-4 py-2 text-lg'
|
|
11
|
+
else if (props.size === 'xl') c += ' px-5 py-3 text-xl'
|
|
12
|
+
else c += ' px-3 py-1.5'
|
|
13
13
|
|
|
14
14
|
return c
|
|
15
15
|
},
|
|
@@ -3,7 +3,7 @@ import type { TagTheme } from '../Tag.vue'
|
|
|
3
3
|
const theme: TagTheme = {
|
|
4
4
|
classes: {
|
|
5
5
|
wrapper: ({ props }) => {
|
|
6
|
-
let c = 'inline-flex
|
|
6
|
+
let c = 'inline-flex leading-tight max-w-full '
|
|
7
7
|
|
|
8
8
|
if (props.size === 'xs' || props.size === 'sm') c += ' px-2 py-0.5 text-xs'
|
|
9
9
|
else if (props.size === 'lg') c += ' px-4 py-3'
|
|
@@ -118,7 +118,8 @@ export const useInputtable = (props: any, { focus, emit, withListeners = true }:
|
|
|
118
118
|
if (formGroup.isInsideFormGroup) {
|
|
119
119
|
formGroup.registerInputGroup(nameInternal.value, focus)
|
|
120
120
|
} else {
|
|
121
|
-
|
|
121
|
+
if (!props.skipFormRegistry)
|
|
122
|
+
form.registerInput(nameInternal.value, focus, validate, setError)
|
|
122
123
|
}
|
|
123
124
|
})
|
|
124
125
|
|
|
@@ -126,7 +127,8 @@ export const useInputtable = (props: any, { focus, emit, withListeners = true }:
|
|
|
126
127
|
if (formGroup.isInsideFormGroup) {
|
|
127
128
|
formGroup.unregisterInputGroup(nameInternal.value)
|
|
128
129
|
} else {
|
|
129
|
-
|
|
130
|
+
if (!props.skipFormRegistry)
|
|
131
|
+
form.unregisterInput(nameInternal.value)
|
|
130
132
|
}
|
|
131
133
|
|
|
132
134
|
})
|
|
@@ -136,7 +138,7 @@ export const useInputtable = (props: any, { focus, emit, withListeners = true }:
|
|
|
136
138
|
errorInternal,
|
|
137
139
|
hideFooterInternal,
|
|
138
140
|
isFocused,
|
|
139
|
-
isInsideForm: form.isInsideForm,
|
|
141
|
+
isInsideForm: props.skipFormRegistry ? false : form.isInsideForm,
|
|
140
142
|
isInsideFormGroup: formGroup.isInsideFormGroup,
|
|
141
143
|
inputListeners,
|
|
142
144
|
formGroup,
|
|
@@ -174,4 +176,5 @@ useInputtable.props = () => ({
|
|
|
174
176
|
default: () => [],
|
|
175
177
|
},
|
|
176
178
|
tooltip: String,
|
|
179
|
+
skipFormRegistry: Boolean,
|
|
177
180
|
} as const)
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.8.
|
|
1
|
+
export default '1.8.2'
|