frappe-ui 0.1.220 → 0.1.223

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.
@@ -9,6 +9,7 @@
9
9
  @focus="() => loadOptions('')"
10
10
  :open-on-focus="true"
11
11
  v-bind="attrsWithoutClassStyle"
12
+ :variant="props.variant"
12
13
  >
13
14
  <template #create-new="{ searchTerm }">
14
15
  <LucidePlus class="size-4 mr-2" />
@@ -32,6 +33,7 @@ import LucidePlus from '~icons/lucide/plus'
32
33
  const props = withDefaults(defineProps<LinkProps>(), {
33
34
  label: '',
34
35
  filters: () => ({}),
36
+ variant: 'subtle',
35
37
  })
36
38
  const model = defineModel<string | null>({ default: '' })
37
39
  const emit = defineEmits<{
@@ -1,5 +1,8 @@
1
+ import { ComboboxVariant } from '../../src/components/Combobox/types'
2
+
1
3
  export interface LinkProps {
2
4
  doctype: string
5
+ variant?: ComboboxVariant
3
6
  label?: string
4
7
  placeholder?: string
5
8
  filters?: Record<string, string | [string, string]>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.1.220",
3
+ "version": "0.1.223",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -38,7 +38,10 @@
38
38
  "./style.css": {
39
39
  "import": "./src/style.css"
40
40
  },
41
- "./tsconfig.base.json": "./tsconfig.base.json"
41
+ "./tsconfig.base.json": {
42
+ "default": "./tsconfig.base.json",
43
+ "types": "./tsconfig.base.json"
44
+ }
42
45
  },
43
46
  "files": [
44
47
  "frappe",
@@ -281,9 +281,13 @@ const reset = () => {
281
281
  }
282
282
 
283
283
  const variantClasses = computed(() => {
284
+ const borderCss =
285
+ 'border focus-within:border-outline-gray-4 focus-within:ring-2 focus-within:ring-outline-gray-3'
286
+
284
287
  return {
285
- subtle: 'bg-surface-gray-2 hover:bg-surface-gray-3 border-transparent',
286
- outline: 'border-outline-gray-2',
288
+ subtle: `${borderCss} bg-surface-gray-2 hover:bg-surface-gray-3 border-transparent`,
289
+ outline: `${borderCss} border-outline-gray-2`,
290
+ ghost: '',
287
291
  }[props.variant]
288
292
  })
289
293
 
@@ -302,7 +306,7 @@ defineExpose({
302
306
  :open="isOpen"
303
307
  >
304
308
  <ComboboxAnchor
305
- class="flex h-7 w-full items-center justify-between gap-2 rounded px-2 py-1 transition-colors border focus-within:border-outline-gray-4 focus-within:ring-2 focus-within:ring-outline-gray-3"
309
+ class="flex h-7 w-full items-center justify-between gap-2 rounded px-2 py-1 transition-colors"
306
310
  :class="{
307
311
  'opacity-50 pointer-events-none': disabled,
308
312
  [variantClasses]: true,
@@ -1,5 +1,7 @@
1
1
  import type { Component, VNode } from 'vue'
2
2
 
3
+ export type ComboboxVariant = 'subtle' | 'outline' | 'ghost'
4
+
3
5
  export type SelectableOption = {
4
6
  type?: 'option'
5
7
  label: string
@@ -26,7 +28,7 @@ export type GroupedOption = { group: string; options: SimpleOption[] }
26
28
  export type ComboboxOption = SimpleOption | GroupedOption
27
29
 
28
30
  export interface ComboboxProps {
29
- variant?: 'subtle' | 'outline'
31
+ variant?: ComboboxVariant
30
32
  options: Array<ComboboxOption>
31
33
  modelValue?: string | null
32
34
  placeholder?: string
@@ -77,7 +77,7 @@ const selectClasses = computed(() => {
77
77
  const selectOptions = computed(() => {
78
78
  const str = typeof props.options?.[0] == 'string'
79
79
  const tmp = props.options?.map((x) => ({ label: x, value: x }))
80
- return (str ? tmp : props.options)?.filter(Boolean) || []
80
+ return (str ? tmp : props.options)?.filter((x) => x && x.value) || []
81
81
  })
82
82
  </script>
83
83