frappe-ui 0.1.44 → 0.1.45

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": "frappe-ui",
3
- "version": "0.1.44",
3
+ "version": "0.1.45",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -8,9 +8,6 @@
8
8
  "prettier": "npx prettier -w ./src",
9
9
  "prepare": "husky install",
10
10
  "bump-and-release": "git pull --rebase origin main && yarn version --patch && git push && git push --tags",
11
- "docs:dev": "vitepress dev docs",
12
- "docs:build": "vitepress build docs",
13
- "docs:serve": "vitepress serve docs",
14
11
  "dev": "vite",
15
12
  "build": "vite build",
16
13
  "preview": "vite preview",
@@ -62,11 +59,11 @@
62
59
  "vue-router": "^4.1.6"
63
60
  },
64
61
  "devDependencies": {
65
- "@histoire/plugin-vue": "^0.16.1",
62
+ "@histoire/plugin-vue": "^0.17.14",
66
63
  "@vitejs/plugin-vue": "^4.0.0",
67
64
  "autoprefixer": "^10.4.13",
68
65
  "cross-fetch": "^3.1.5",
69
- "histoire": "^0.16.2",
66
+ "histoire": "^0.17.14",
70
67
  "husky": ">=6",
71
68
  "lint-staged": ">=10",
72
69
  "postcss": "^8.4.21",
@@ -75,7 +72,6 @@
75
72
  "tailwindcss": "^3.2.7",
76
73
  "typescript": "^5.0.2",
77
74
  "vite": "^4.1.0",
78
- "vitepress": "^1.0.0-alpha.29",
79
75
  "vue": "^3.2.45",
80
76
  "vue-router": "^4.1.6"
81
77
  },
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { reactive } from 'vue'
2
+ import { reactive, ref } from 'vue'
3
3
  import FormControl from './FormControl.vue'
4
4
  import FeatherIcon from './FeatherIcon.vue'
5
5
  import Avatar from './Avatar.vue'
@@ -10,8 +10,11 @@ const state = reactive({
10
10
  placeholder: 'Placeholder',
11
11
  disabled: false,
12
12
  label: 'Label',
13
- modelValue: '',
14
13
  })
14
+ const inputValue = ref('')
15
+ const selectValue = ref(null)
16
+ const autocompleteValue = ref(null)
17
+ const checkboxValue = ref(false)
15
18
 
16
19
  const inputTypes = [
17
20
  'text',
@@ -34,11 +37,7 @@ const variants = ['subtle', 'outline']
34
37
  :title="inputType"
35
38
  >
36
39
  <div class="p-2">
37
- <FormControl
38
- :type="inputType"
39
- v-bind="state"
40
- v-model="state.modelValue"
41
- />
40
+ <FormControl :type="inputType" v-bind="state" v-model="inputValue" />
42
41
  </div>
43
42
  </Variant>
44
43
  <Variant title="select">
@@ -51,6 +50,7 @@ const variants = ['subtle', 'outline']
51
50
  { label: 'Three', value: '3' },
52
51
  ]"
53
52
  v-bind="state"
53
+ v-model="selectValue"
54
54
  />
55
55
  </div>
56
56
  </Variant>
@@ -64,12 +64,13 @@ const variants = ['subtle', 'outline']
64
64
  { label: 'Three', value: '3' },
65
65
  ]"
66
66
  v-bind="state"
67
+ v-model="autocompleteValue"
67
68
  />
68
69
  </div>
69
70
  </Variant>
70
71
  <Variant title="checkbox">
71
72
  <div class="p-2">
72
- <FormControl type="checkbox" v-bind="state" />
73
+ <FormControl type="checkbox" v-bind="state" v-model="checkboxValue" />
73
74
  </div>
74
75
  </Variant>
75
76
 
@@ -114,7 +114,7 @@
114
114
  </template>
115
115
 
116
116
  <script setup>
117
- import { Autocomplete, FeatherIcon, FormControl } from 'frappe-ui'
117
+ import { Autocomplete, FeatherIcon, FormControl } from '../../index'
118
118
  import { computed, h } from 'vue'
119
119
  import FilterIcon from './FilterIcon.vue'
120
120
  import NestedPopover from './NestedPopover.vue'
@@ -9,7 +9,7 @@
9
9
  </template>
10
10
 
11
11
  <script setup>
12
- import { Autocomplete, createListResource } from 'frappe-ui'
12
+ import { Autocomplete, createListResource } from '../../index'
13
13
  import { computed, ref, watch } from 'vue'
14
14
 
15
15
  const props = defineProps({
@@ -12,8 +12,9 @@
12
12
  </div>
13
13
  <div
14
14
  v-if="placeholder"
15
- class="absolute select-none text-gray-500"
16
- :class="paddingClasses"
15
+ v-show="!modelValue"
16
+ class="pointer-events-none absolute text-gray-500"
17
+ :class="[fontSizeClasses, paddingClasses]"
17
18
  >
18
19
  {{ placeholder }}
19
20
  </div>
@@ -96,6 +97,15 @@ const textColor = computed(() => {
96
97
  return props.disabled ? 'text-gray-500' : 'text-gray-800'
97
98
  })
98
99
 
100
+ const fontSizeClasses = computed(() => {
101
+ return {
102
+ sm: 'text-base',
103
+ md: 'text-base',
104
+ lg: 'text-lg',
105
+ xl: 'text-xl',
106
+ }[props.size]
107
+ })
108
+
99
109
  const paddingClasses = computed(() => {
100
110
  return {
101
111
  sm: 'px-2',
@@ -107,10 +117,10 @@ const paddingClasses = computed(() => {
107
117
 
108
118
  const selectClasses = computed(() => {
109
119
  let sizeClasses = {
110
- sm: 'text-base rounded h-7',
111
- md: 'text-base rounded h-8',
112
- lg: 'text-lg rounded-md h-10',
113
- xl: 'text-xl rounded-md h-10',
120
+ sm: 'rounded h-7',
121
+ md: 'rounded h-8',
122
+ lg: 'rounded-md h-10',
123
+ xl: 'rounded-md h-10',
114
124
  }[props.size]
115
125
 
116
126
  let variant = props.disabled ? 'disabled' : props.variant
@@ -130,10 +140,11 @@ const selectClasses = computed(() => {
130
140
 
131
141
  return [
132
142
  sizeClasses,
143
+ fontSizeClasses.value,
133
144
  paddingClasses.value,
134
145
  variantClasses,
135
146
  textColor.value,
136
- 'transition-colors w-full',
147
+ 'transition-colors w-full py-0',
137
148
  ]
138
149
  })
139
150