@indielayer/ui 1.8.1 → 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/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.8.1";
1
+ declare const _default: "1.8.2";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,4 +1,4 @@
1
- const e = "1.8.1";
1
+ const e = "1.8.2";
2
2
  export {
3
3
  e as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indielayer/ui",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "Indielayer UI Components with Tailwind CSS build for Vue 3",
5
5
  "author": {
6
6
  "name": "João Teixeira",
@@ -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="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="multiple && Array.isArray(selected) && selected.length > 0">
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>&nbsp;</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="disabled || loading || readonly"
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>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
2
  const tagProps = {
3
3
  ...useCommon.props(),
4
- ...useColors.props('gray'),
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-[color:var(--x-tag-border)] dark:border-[color:var(--x-tag-dark-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 ? 'border' : 'bg-[color:var(--x-tag-bg)] dark:bg-[color:var(--x-tag-dark-bg)]',
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 hover:text-secondary-700 transition-colors duration-150"
74
- @click="(e: Event) => $emit('remove', e)"
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 items-center leading-none max-w-full'
6
+ let c = 'inline-flex leading-tight max-w-full'
7
7
 
8
- if (props.size === 'xs') c += ' px-2 py-1 text-xs'
9
- else if (props.size === 'sm') c += ' px-2 py-1 text-sm'
10
- else if (props.size === 'lg') c += ' px-4 py-3 text-lg'
11
- else if (props.size === 'xl') c += ' px-6 py-6 text-xl'
12
- else c += ' px-3 py-2'
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 items-center leading-none max-w-full '
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'
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export default '1.8.1'
1
+ export default '1.8.2'