frappe-ui 0.0.6 → 0.0.7

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.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -44,25 +44,25 @@
44
44
  <slot name="body">
45
45
  <slot name="body-main">
46
46
  <div class="px-4 py-5 bg-white sm:p-6">
47
- <div>
47
+ <div class="flex flex-col sm:flex-row">
48
48
  <div
49
49
  v-if="icon"
50
- class="flex items-center justify-center flex-shrink-0 w-12 h-12 mx-auto mb-3 rounded-full sm:mx-0 sm:h-10 sm:w-10 sm:mb-0 sm:mr-4"
50
+ class="flex items-center justify-center flex-shrink-0 w-12 h-12 mx-auto mb-3 rounded-full sm:mx-0 sm:h-9 sm:w-9 sm:mb-0 sm:mr-4"
51
51
  :class="{
52
- 'bg-yellow-100': icon.type === 'warning',
53
- 'bg-blue-100': icon.type === 'info',
54
- 'bg-red-100': icon.type === 'danger',
55
- 'bg-green-100': icon.type === 'success',
52
+ 'bg-yellow-100': icon.appearance === 'warning',
53
+ 'bg-blue-100': icon.appearance === 'info',
54
+ 'bg-red-100': icon.appearance === 'danger',
55
+ 'bg-green-100': icon.appearance === 'success',
56
56
  }"
57
57
  >
58
58
  <FeatherIcon
59
59
  :name="icon.name"
60
- class="w-6 h-6 text-red-600"
60
+ class="w-6 h-6 text-red-600 sm:w-5 sm:h-5"
61
61
  :class="{
62
- 'text-yellow-600': icon.type === 'warning',
63
- 'text-blue-600': icon.type === 'info',
64
- 'text-red-600': icon.type === 'danger',
65
- 'text-green-600': icon.type === 'success',
62
+ 'text-yellow-600': icon.appearance === 'warning',
63
+ 'text-blue-600': icon.appearance === 'info',
64
+ 'text-red-600': icon.appearance === 'danger',
65
+ 'text-green-600': icon.appearance === 'success',
66
66
  }"
67
67
  aria-hidden="true"
68
68
  />
@@ -79,7 +79,7 @@
79
79
  </DialogTitle>
80
80
 
81
81
  <slot name="body-content">
82
- <p class="text-sm text-gray-500" v-if="options.message">
82
+ <p class="text-sm text-gray-600" v-if="options.message">
83
83
  {{ options.message }}
84
84
  </p>
85
85
  </slot>
@@ -93,9 +93,10 @@
93
93
  >
94
94
  <slot name="actions" v-bind="{ close: () => (open = false) }">
95
95
  <Button
96
+ class="w-full sm:w-max"
96
97
  v-for="action in options.actions"
97
98
  :key="action.label"
98
- :appearance="action.appearance"
99
+ v-bind="action"
99
100
  @click="
100
101
  () => {
101
102
  if (action.handler && action.handler === 'cancel') {
@@ -6,11 +6,7 @@ let cached = {}
6
6
  function createResource(options, vm, getResource) {
7
7
  let cacheKey = null
8
8
  if (options.cache) {
9
- cacheKey = options.cache
10
- if (typeof cacheKey === 'string') {
11
- cacheKey = [cacheKey]
12
- }
13
- cacheKey = JSON.stringify(cacheKey)
9
+ cacheKey = getCacheKey(options.cache)
14
10
  if (cached[cacheKey]) {
15
11
  return cached[cacheKey]
16
12
  }
@@ -113,6 +109,13 @@ function createResource(options, vm, getResource) {
113
109
  return out
114
110
  }
115
111
 
112
+ function getCacheKey(cacheKey) {
113
+ if (typeof cacheKey === 'string') {
114
+ cacheKey = [cacheKey]
115
+ }
116
+ return JSON.stringify(cacheKey)
117
+ }
118
+
116
119
  let createMixin = (mixinOptions) => ({
117
120
  created() {
118
121
  if (this.$options.resources) {
@@ -160,10 +163,10 @@ let createMixin = (mixinOptions) => ({
160
163
  }
161
164
  },
162
165
  methods: {
163
- $refetchResource(cacheKey) {
164
- let key = JSON.stringify(cacheKey)
165
- if (cached[key]) {
166
- let resource = cached[key]
166
+ $refetchResource(cache) {
167
+ let cacheKey = getCacheKey(cache)
168
+ if (cached[cacheKey]) {
169
+ let resource = cached[cacheKey]
167
170
  resource.fetch()
168
171
  }
169
172
  },