@globalbrain/sefirot 2.31.1 → 2.32.0

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.
@@ -36,6 +36,7 @@ const props = defineProps<{
36
36
 
37
37
  const emit = defineEmits<{
38
38
  (e: 'click'): void
39
+ (e: 'disabled-click'): void
39
40
  }>()
40
41
 
41
42
  const classes = computed(() => [
@@ -57,7 +58,9 @@ const computedTag = computed(() => {
57
58
  })
58
59
 
59
60
  function handleClick(): void {
60
- !props.disabled && !props.loading && emit('click')
61
+ if (!props.loading) {
62
+ props.disabled ? emit('disabled-click') : emit('click')
63
+ }
61
64
  }
62
65
  </script>
63
66
 
@@ -18,13 +18,17 @@ const props = defineProps<{
18
18
  const input = ref<HTMLElement | null>(null)
19
19
  const query = ref('')
20
20
 
21
+ const enabledOptions = computed(() => {
22
+ return unref(props.options).filter((o) => !o.disabled)
23
+ })
24
+
21
25
  const fuse = computed(() => {
22
- return new Fuse(unref(props.options), { keys: ['label'] })
26
+ return new Fuse(unref(enabledOptions), { keys: ['label'] })
23
27
  })
24
28
 
25
29
  const filteredOptions = computed(() => {
26
30
  return (!props.search || !query.value)
27
- ? unref(props.options)
31
+ ? unref(enabledOptions)
28
32
  : fuse.value.search(query.value).map((r) => r.item)
29
33
  })
30
34
 
@@ -27,6 +27,7 @@ export type Option = OptionText | OptionAvatar
27
27
  export interface OptionBase {
28
28
  type?: 'text' | 'avatar'
29
29
  value: OptionValue
30
+ disabled?: boolean
30
31
  }
31
32
 
32
33
  export interface OptionText extends OptionBase {
@@ -48,6 +48,7 @@ export interface DropdownSectionFilterOptionBase {
48
48
  type?: 'text' | 'avatar'
49
49
  label: string
50
50
  value: string | number | boolean
51
+ disabled?: boolean
51
52
  onClick?(value: string | number | boolean): void
52
53
  }
53
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalbrain/sefirot",
3
- "version": "2.31.1",
3
+ "version": "2.32.0",
4
4
  "packageManager": "pnpm@7.26.2",
5
5
  "description": "Vue Components for Global Brain Design System.",
6
6
  "author": "Kia Ishii <ka.ishii@globalbrains.com>",