frappe-ui 0.1.45 → 0.1.46
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 +2 -1
- package/src/components/ListView/ListRowItem.vue +1 -1
- package/src/components/TextEditor/FontColor.vue +1 -1
- package/src/components/Tooltip/Tooltip.story.vue +40 -0
- package/src/components/Tooltip/Tooltip.vue +60 -0
- package/src/index.js +3 -3
- package/src/components/Tooltip.story.vue +0 -11
- package/src/components/Tooltip.vue +0 -38
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "frappe-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"description": "A set of components and utilities for rapid UI development",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@vueuse/core": "^10.4.1",
|
|
51
51
|
"feather-icons": "^4.28.0",
|
|
52
52
|
"idb-keyval": "^6.2.0",
|
|
53
|
+
"radix-vue": "^1.5.3",
|
|
53
54
|
"showdown": "^2.1.0",
|
|
54
55
|
"socket.io-client": "^4.5.1",
|
|
55
56
|
"tippy.js": "^6.3.7"
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import Tooltip from './Tooltip.vue'
|
|
4
|
+
import Button from '../Button.vue'
|
|
5
|
+
|
|
6
|
+
const placement = ref('top')
|
|
7
|
+
</script>
|
|
8
|
+
<template>
|
|
9
|
+
<Story :layout="{ type: 'grid', width: '300px' }">
|
|
10
|
+
<Variant title="with text prop">
|
|
11
|
+
<Tooltip
|
|
12
|
+
text="This action cannot be undone"
|
|
13
|
+
:hover-delay="1"
|
|
14
|
+
:placement="placement"
|
|
15
|
+
>
|
|
16
|
+
<Button theme="red">Delete</Button>
|
|
17
|
+
</Tooltip>
|
|
18
|
+
</Variant>
|
|
19
|
+
<Variant title="with slot">
|
|
20
|
+
<Tooltip arrow-class="fill-white" :placement="placement">
|
|
21
|
+
<template #body>
|
|
22
|
+
<div
|
|
23
|
+
class="min-w-[6rem] rounded bg-white px-2 py-1 text-xs text-gray-900 shadow-xl"
|
|
24
|
+
>
|
|
25
|
+
test
|
|
26
|
+
</div>
|
|
27
|
+
</template>
|
|
28
|
+
<Button theme="red">Delete</Button>
|
|
29
|
+
</Tooltip>
|
|
30
|
+
</Variant>
|
|
31
|
+
|
|
32
|
+
<template #controls>
|
|
33
|
+
<HstSelect
|
|
34
|
+
v-model="placement"
|
|
35
|
+
:options="['top', 'right', 'bottom', 'left']"
|
|
36
|
+
title="Placement"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
39
|
+
</Story>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { type HTMLAttributes } from 'vue'
|
|
3
|
+
import {
|
|
4
|
+
TooltipProvider,
|
|
5
|
+
TooltipRoot,
|
|
6
|
+
TooltipPortal,
|
|
7
|
+
TooltipTrigger,
|
|
8
|
+
TooltipContent,
|
|
9
|
+
TooltipArrow,
|
|
10
|
+
type TooltipContentProps,
|
|
11
|
+
} from 'radix-vue'
|
|
12
|
+
import { computed } from 'vue'
|
|
13
|
+
|
|
14
|
+
defineOptions({
|
|
15
|
+
inheritAttrs: false,
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const props = withDefaults(
|
|
19
|
+
defineProps<{
|
|
20
|
+
text?: string
|
|
21
|
+
hoverDelay?: number
|
|
22
|
+
placement?: TooltipContentProps['side']
|
|
23
|
+
arrowClass?: HTMLAttributes['class']
|
|
24
|
+
}>(),
|
|
25
|
+
{
|
|
26
|
+
text: '',
|
|
27
|
+
placement: 'top',
|
|
28
|
+
hoverDelay: 0.5,
|
|
29
|
+
arrowClass: 'fill-gray-900',
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const delayDuration = computed(() => props.hoverDelay * 1000)
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<TooltipProvider :delayDuration="delayDuration">
|
|
38
|
+
<TooltipRoot>
|
|
39
|
+
<TooltipTrigger as-child>
|
|
40
|
+
<slot />
|
|
41
|
+
</TooltipTrigger>
|
|
42
|
+
<TooltipPortal>
|
|
43
|
+
<TooltipContent
|
|
44
|
+
v-if="props.text || $slots.body"
|
|
45
|
+
:side="props.placement"
|
|
46
|
+
:side-offset="4"
|
|
47
|
+
>
|
|
48
|
+
<slot name="body">
|
|
49
|
+
<div
|
|
50
|
+
class="rounded bg-gray-900 px-2 py-1 text-xs text-white shadow-xl"
|
|
51
|
+
>
|
|
52
|
+
<div>{{ props.text }}</div>
|
|
53
|
+
</div>
|
|
54
|
+
</slot>
|
|
55
|
+
<TooltipArrow :class="props.arrowClass" :width="8" :height="4" />
|
|
56
|
+
</TooltipContent>
|
|
57
|
+
</TooltipPortal>
|
|
58
|
+
</TooltipRoot>
|
|
59
|
+
</TooltipProvider>
|
|
60
|
+
</template>
|
package/src/index.js
CHANGED
|
@@ -52,7 +52,7 @@ export { default as ListSelectBanner } from './components/ListView/ListSelectBan
|
|
|
52
52
|
export { default as ListFooter } from './components/ListView/ListFooter.vue'
|
|
53
53
|
export { default as Toast } from './components/Toast.vue'
|
|
54
54
|
export { toast, Toasts } from './components/toast.js'
|
|
55
|
-
export { default as Tooltip } from './components/Tooltip.vue'
|
|
55
|
+
export { default as Tooltip } from './components/Tooltip/Tooltip.vue'
|
|
56
56
|
export { default as CommandPalette } from './components/CommandPalette/CommandPalette.vue'
|
|
57
57
|
export { default as CommandPaletteItem } from './components/CommandPalette/CommandPaletteItem.vue'
|
|
58
58
|
export { default as ListFilter } from './components/ListFilter/ListFilter.vue'
|
|
@@ -65,7 +65,7 @@ export { default as visibilityDirective } from './directives/visibility.js'
|
|
|
65
65
|
export { default as call, createCall } from './utils/call.js'
|
|
66
66
|
export { default as debounce } from './utils/debounce.ts'
|
|
67
67
|
export { default as fileToBase64 } from './utils/file-to-base64.js'
|
|
68
|
-
export { default as FileUploadHandler } from './utils/fileUploadHandler'
|
|
68
|
+
export { default as FileUploadHandler } from './utils/fileUploadHandler.ts'
|
|
69
69
|
export { usePageMeta } from './utils/pageMeta.js'
|
|
70
70
|
|
|
71
71
|
// data-fetching, resources
|
|
@@ -77,7 +77,7 @@ export {
|
|
|
77
77
|
getCachedDocumentResource,
|
|
78
78
|
getCachedListResource,
|
|
79
79
|
resourcesPlugin,
|
|
80
|
-
} from './resources'
|
|
80
|
+
} from './resources/index.js'
|
|
81
81
|
export { request } from './utils/request.js'
|
|
82
82
|
export { frappeRequest } from './utils/frappeRequest.js'
|
|
83
83
|
export { default as initSocket } from './utils/socketio.js'
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import Tooltip from './Tooltip.vue'
|
|
3
|
-
import Button from './Button.vue'
|
|
4
|
-
</script>
|
|
5
|
-
<template>
|
|
6
|
-
<Story :layout="{ type: 'grid' }">
|
|
7
|
-
<Tooltip text="This action cannot be undone">
|
|
8
|
-
<Button theme="red">Delete data</Button>
|
|
9
|
-
</Tooltip>
|
|
10
|
-
</Story>
|
|
11
|
-
</template>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Popover trigger="hover" :hoverDelay="hoverDelay" :placement="placement">
|
|
3
|
-
<template #target>
|
|
4
|
-
<slot />
|
|
5
|
-
</template>
|
|
6
|
-
<template #body>
|
|
7
|
-
<slot name="body">
|
|
8
|
-
<div
|
|
9
|
-
v-if="text"
|
|
10
|
-
class="rounded bg-gray-900 px-2 py-1 text-xs text-white shadow-xl"
|
|
11
|
-
>
|
|
12
|
-
<div class="py-px">
|
|
13
|
-
{{ text }}
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
16
|
-
</slot>
|
|
17
|
-
</template>
|
|
18
|
-
</Popover>
|
|
19
|
-
</template>
|
|
20
|
-
<script>
|
|
21
|
-
import Popover from './Popover.vue'
|
|
22
|
-
export default {
|
|
23
|
-
name: 'Tooltip',
|
|
24
|
-
components: { Popover },
|
|
25
|
-
props: {
|
|
26
|
-
hoverDelay: {
|
|
27
|
-
default: 0.5,
|
|
28
|
-
},
|
|
29
|
-
placement: {
|
|
30
|
-
default: 'top',
|
|
31
|
-
},
|
|
32
|
-
text: {
|
|
33
|
-
type: String,
|
|
34
|
-
default: null,
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
</script>
|