@varlet/ui 2.8.6 → 2.9.0-alpha.1678371604765
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/es/breadcrumb/provide.mjs +4 -6
- package/es/breadcrumbs/provide.mjs +3 -6
- package/es/button/Button.mjs +17 -2
- package/es/button/button.css +1 -1
- package/es/button/props.mjs +3 -7
- package/es/fab/Fab.mjs +182 -0
- package/es/fab/fab.css +1 -0
- package/es/fab/index.mjs +9 -0
- package/es/fab/props.mjs +91 -0
- package/es/fab/style/index.mjs +2 -0
- package/es/hover/index.mjs +5 -2
- package/es/icon/Icon.mjs +10 -7
- package/es/icon/icon.css +1 -1
- package/es/icon/props.mjs +3 -0
- package/es/index.bundle.mjs +7 -1
- package/es/index.mjs +6 -1
- package/es/menu/props.mjs +3 -0
- package/es/menu/usePopover.mjs +4 -1
- package/es/option/Option.mjs +3 -8
- package/es/select/Select.mjs +1 -0
- package/es/snackbar/style/index.mjs +1 -1
- package/es/space/Space.mjs +3 -21
- package/es/style.css +1 -1
- package/es/style.mjs +1 -0
- package/es/tab/provide.mjs +4 -6
- package/es/tab-item/provide.mjs +4 -6
- package/es/tabs/provide.mjs +3 -6
- package/es/tabs-items/provide.mjs +3 -6
- package/es/tooltip/props.mjs +3 -0
- package/es/utils/components.mjs +19 -1
- package/es/varlet.esm.js +5659 -5367
- package/highlight/web-types.en-US.json +238 -3
- package/highlight/web-types.zh-CN.json +238 -3
- package/lib/style.css +1 -1
- package/lib/varlet.cjs.js +845 -488
- package/package.json +6 -6
- package/types/fab.d.ts +55 -0
- package/types/icon.d.ts +1 -0
- package/types/index.d.ts +2 -0
- package/types/menu.d.ts +1 -0
- package/types/tooltip.d.ts +1 -0
- package/umd/varlet.js +5 -6
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY
|
|
1
|
+
import { useParent } from '@varlet/use';
|
|
2
|
+
import { BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY } from '../breadcrumbs/provide.mjs';
|
|
3
3
|
export function useBreadcrumb() {
|
|
4
4
|
var {
|
|
5
5
|
parentProvider,
|
|
6
|
-
bindParent
|
|
7
|
-
} = useParent(BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY);
|
|
8
|
-
var {
|
|
6
|
+
bindParent,
|
|
9
7
|
index
|
|
10
|
-
} =
|
|
8
|
+
} = useParent(BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY);
|
|
11
9
|
|
|
12
10
|
if (!parentProvider || !bindParent || !index) {
|
|
13
11
|
throw Error('<var-breadcrumb/> must in <var-breadcrumbs/>');
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useChildren } from '@varlet/use';
|
|
2
2
|
export var BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY = Symbol('BREADCRUMBS_BIND_BREADCRUMB_KEY');
|
|
3
|
-
export var BREADCRUMBS_COUNT_BREADCRUMB_ITEM_KEY = Symbol('BREADCRUMBS_COUNT_BREADCRUMB_KEY');
|
|
4
3
|
export function useBreadcrumbsList() {
|
|
5
4
|
var {
|
|
6
5
|
childProviders,
|
|
7
|
-
bindChildren
|
|
8
|
-
} = useChildren(BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY);
|
|
9
|
-
var {
|
|
6
|
+
bindChildren,
|
|
10
7
|
length
|
|
11
|
-
} =
|
|
8
|
+
} = useChildren(BREADCRUMBS_BIND_BREADCRUMB_ITEM_KEY);
|
|
12
9
|
return {
|
|
13
10
|
length,
|
|
14
11
|
breadcrumbList: childProviders,
|
package/es/button/Button.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { computed, defineComponent, ref } from 'vue';
|
|
|
4
4
|
import { props } from './props.mjs';
|
|
5
5
|
import { call, createNamespace } from '../utils/components.mjs';
|
|
6
6
|
import { useButtonGroup } from './provide.mjs';
|
|
7
|
+
import Hover from '../hover/index.mjs';
|
|
7
8
|
import { isArray } from '@varlet/shared';
|
|
8
9
|
var {
|
|
9
10
|
n,
|
|
@@ -20,6 +21,8 @@ function __render__(_ctx, _cache) {
|
|
|
20
21
|
|
|
21
22
|
var _directive_ripple = _resolveDirective("ripple");
|
|
22
23
|
|
|
24
|
+
var _directive_hover = _resolveDirective("hover");
|
|
25
|
+
|
|
23
26
|
return _withDirectives((_openBlock(), _createElementBlock("button", {
|
|
24
27
|
class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box'), _ctx.n("--" + _ctx.states.size), [_ctx.block, _ctx.n('$--flex') + " " + _ctx.n('--block'), _ctx.n('$--inline-flex')], [_ctx.disabled, _ctx.n('--disabled')], [_ctx.states.text, _ctx.n("--text-" + _ctx.states.type) + " " + _ctx.n('--text'), _ctx.n("--" + _ctx.states.type) + " " + _ctx.n("$-elevation--" + _ctx.states.elevation)], [_ctx.states.text && _ctx.disabled, _ctx.n('--text-disabled')], [_ctx.round, _ctx.n('--round')], [_ctx.states.outline, _ctx.n('--outline')])),
|
|
25
28
|
style: _normalizeStyle({
|
|
@@ -48,11 +51,15 @@ function __render__(_ctx, _cache) {
|
|
|
48
51
|
class: _normalizeClass(_ctx.classes(_ctx.n('content'), [_ctx.loading || _ctx.pending, _ctx.n('--hidden')]))
|
|
49
52
|
}, [_renderSlot(_ctx.$slots, "default")], 2
|
|
50
53
|
/* CLASS */
|
|
54
|
+
), _createElementVNode("div", {
|
|
55
|
+
class: _normalizeClass(_ctx.classes(_ctx.n('overlay'), [_ctx.hovering, _ctx.n('--hovering')]))
|
|
56
|
+
}, null, 2
|
|
57
|
+
/* CLASS */
|
|
51
58
|
)], 46
|
|
52
59
|
/* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
|
|
53
60
|
, _hoisted_1)), [[_directive_ripple, {
|
|
54
61
|
disabled: _ctx.disabled || !_ctx.ripple
|
|
55
|
-
}]]);
|
|
62
|
+
}], [_directive_hover, _ctx.handleHover, "desktop"]]);
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
var __sfc__ = defineComponent({
|
|
@@ -61,12 +68,14 @@ var __sfc__ = defineComponent({
|
|
|
61
68
|
VarLoading
|
|
62
69
|
},
|
|
63
70
|
directives: {
|
|
64
|
-
Ripple
|
|
71
|
+
Ripple,
|
|
72
|
+
Hover
|
|
65
73
|
},
|
|
66
74
|
props,
|
|
67
75
|
|
|
68
76
|
setup(props) {
|
|
69
77
|
var pending = ref(false);
|
|
78
|
+
var hovering = ref(false);
|
|
70
79
|
var {
|
|
71
80
|
buttonGroup
|
|
72
81
|
} = useButtonGroup();
|
|
@@ -141,11 +150,17 @@ var __sfc__ = defineComponent({
|
|
|
141
150
|
attemptAutoLoading(call(onTouchstart, e));
|
|
142
151
|
};
|
|
143
152
|
|
|
153
|
+
var handleHover = isHover => {
|
|
154
|
+
hovering.value = isHover;
|
|
155
|
+
};
|
|
156
|
+
|
|
144
157
|
return {
|
|
145
158
|
n,
|
|
146
159
|
classes,
|
|
147
160
|
pending,
|
|
148
161
|
states,
|
|
162
|
+
hovering,
|
|
163
|
+
handleHover,
|
|
149
164
|
handleClick,
|
|
150
165
|
handleTouchstart
|
|
151
166
|
};
|
package/es/button/button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root { --button-default-color: #f5f5f5; --button-primary-color: var(--color-primary); --button-danger-color: var(--color-danger); --button-success-color: var(--color-success); --button-warning-color: var(--color-warning); --button-info-color: var(--color-info); --button-disabled-color: var(--color-disabled); --button-disabled-text-color: var(--color-text-disabled); --button-border-radius: 4px; --button-mini-padding: 0 9px; --button-small-padding: 0 11px; --button-normal-padding: 0 15px; --button-large-padding: 0 22px; --button-round-padding: 6px; --button-mini-height: 20px; --button-small-height: 28px; --button-normal-height: 36px; --button-large-height: 44px; --button-mini-font-size: var(--font-size-xs); --button-small-font-size: var(--font-size-sm); --button-normal-font-size: var(--font-size-md); --button-large-font-size: var(--font-size-lg);}.var-button { position: relative; justify-content: center; align-items: center; outline: none; border: none; border-radius: var(--button-border-radius); user-select: none; cursor: pointer; font-family: inherit; transition: box-shadow 0.2s, background-color 0.25s; will-change: box-shadow; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); white-space: nowrap;}.var-button:active { box-shadow: 0 3px 5px -1px var(--shadow-key-umbra-opacity), 0 5px 8px 0 var(--shadow-key-penumbra-opacity), 0 1px 14px 0 var(--shadow-key-ambient-opacity);}.var-button__content { display: flex; align-items: center; flex-wrap: wrap;}.var-button__loading[var-button-cover] { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);}.var-button--default { color: inherit; background-color: var(--button-default-color);}.var-button--primary { color: #fff; background-color: var(--button-primary-color);}.var-button--info { color: #fff; background-color: var(--button-info-color);}.var-button--success { color: #fff; background-color: var(--button-success-color);}.var-button--warning { color: #fff; background-color: var(--button-warning-color);}.var-button--danger { color: #fff; background-color: var(--button-danger-color);}.var-button--disabled { background-color: var(--button-disabled-color); color: var(--button-disabled-text-color); cursor: not-allowed; box-shadow: none !important;}.var-button--block { width: 100%;}.var-button--text { background-color: transparent;}.var-button--text:active { box-shadow: none;}.var-button--text-default { color: inherit;}.var-button--text-primary { color: var(--button-primary-color);}.var-button--text-info { color: var(--button-info-color);}.var-button--text-success { color: var(--button-success-color);}.var-button--text-warning { color: var(--button-warning-color);}.var-button--text-danger { color: var(--button-danger-color);}.var-button--text-disabled { color: var(--button-disabled-text-color);}.var-button--normal { height: var(--button-normal-height); padding: var(--button-normal-padding); font-size: var(--button-normal-font-size);}.var-button--large { height: var(--button-large-height); padding: var(--button-large-padding); font-size: var(--button-large-font-size);}.var-button--small { height: var(--button-small-height); padding: var(--button-small-padding); font-size: var(--button-small-font-size);}.var-button--mini { height: var(--button-mini-height); padding: var(--button-mini-padding); font-size: var(--button-mini-font-size);}.var-button--round { padding: var(--button-round-padding); border-radius: 50%; height: auto;}.var-button--outline { border: thin solid currentColor;}.var-button--hidden { opacity: 0;}
|
|
1
|
+
:root { --button-default-color: #f5f5f5; --button-primary-color: var(--color-primary); --button-danger-color: var(--color-danger); --button-success-color: var(--color-success); --button-warning-color: var(--color-warning); --button-info-color: var(--color-info); --button-disabled-color: var(--color-disabled); --button-disabled-text-color: var(--color-text-disabled); --button-border-radius: 4px; --button-mini-padding: 0 9px; --button-small-padding: 0 11px; --button-normal-padding: 0 15px; --button-large-padding: 0 22px; --button-round-padding: 6px; --button-mini-height: 20px; --button-small-height: 28px; --button-normal-height: 36px; --button-large-height: 44px; --button-mini-font-size: var(--font-size-xs); --button-small-font-size: var(--font-size-sm); --button-normal-font-size: var(--font-size-md); --button-large-font-size: var(--font-size-lg);}.var-button { position: relative; justify-content: center; align-items: center; outline: none; border: none; border-radius: var(--button-border-radius); user-select: none; cursor: pointer; font-family: inherit; transition: box-shadow 0.2s, background-color 0.25s; will-change: box-shadow; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); white-space: nowrap;}.var-button:active { box-shadow: 0 3px 5px -1px var(--shadow-key-umbra-opacity), 0 5px 8px 0 var(--shadow-key-penumbra-opacity), 0 1px 14px 0 var(--shadow-key-ambient-opacity);}.var-button__content { display: flex; align-items: center; flex-wrap: wrap;}.var-button__loading[var-button-cover] { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);}.var-button__overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: inherit; background-color: currentColor; opacity: 0; transition: opacity 0.15s; will-change: opacity; pointer-events: none;}.var-button--hovering { opacity: 0.15;}.var-button--default { color: inherit; background-color: var(--button-default-color);}.var-button--primary { color: #fff; background-color: var(--button-primary-color);}.var-button--info { color: #fff; background-color: var(--button-info-color);}.var-button--success { color: #fff; background-color: var(--button-success-color);}.var-button--warning { color: #fff; background-color: var(--button-warning-color);}.var-button--danger { color: #fff; background-color: var(--button-danger-color);}.var-button--disabled { background-color: var(--button-disabled-color); color: var(--button-disabled-text-color); cursor: not-allowed; box-shadow: none !important;}.var-button--block { width: 100%;}.var-button--text { background-color: transparent;}.var-button--text:active { box-shadow: none;}.var-button--text-default { color: inherit;}.var-button--text-primary { color: var(--button-primary-color);}.var-button--text-info { color: var(--button-info-color);}.var-button--text-success { color: var(--button-success-color);}.var-button--text-warning { color: var(--button-warning-color);}.var-button--text-danger { color: var(--button-danger-color);}.var-button--text-disabled { color: var(--button-disabled-text-color);}.var-button--normal { height: var(--button-normal-height); padding: var(--button-normal-padding); font-size: var(--button-normal-font-size);}.var-button--large { height: var(--button-large-height); padding: var(--button-large-padding); font-size: var(--button-large-font-size);}.var-button--small { height: var(--button-small-height); padding: var(--button-small-padding); font-size: var(--button-small-font-size);}.var-button--mini { height: var(--button-mini-height); padding: var(--button-mini-padding); font-size: var(--button-mini-font-size);}.var-button--round { padding: var(--button-round-padding); border-radius: 50%; height: auto;}.var-button--outline { border: thin solid currentColor;}.var-button--hidden { opacity: 0;}
|
package/es/button/props.mjs
CHANGED
|
@@ -2,19 +2,15 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
|
|
3
3
|
import { props as loadingProps } from '../loading/props.mjs';
|
|
4
4
|
import { defineListenerProp, pickProps } from '../utils/components.mjs';
|
|
5
|
-
|
|
6
|
-
function typeValidator(type) {
|
|
5
|
+
export function typeValidator(type) {
|
|
7
6
|
return ['default', 'primary', 'info', 'success', 'warning', 'danger'].includes(type);
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
function sizeValidator(size) {
|
|
8
|
+
export function sizeValidator(size) {
|
|
11
9
|
return ['normal', 'mini', 'small', 'large'].includes(size);
|
|
12
10
|
}
|
|
13
|
-
|
|
14
|
-
function nativeTypeValidator(nativeType) {
|
|
11
|
+
export function nativeTypeValidator(nativeType) {
|
|
15
12
|
return ['button', 'reset', 'submit'].includes(nativeType);
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
export var props = {
|
|
19
15
|
type: {
|
|
20
16
|
type: String,
|
package/es/fab/Fab.mjs
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { mergeProps as _mergeProps, isVNode as _isVNode, withDirectives as _withDirectives, vShow as _vShow, createVNode as _createVNode } from "vue";
|
|
2
|
+
import Button from '../button/index.mjs';
|
|
3
|
+
import Icon from '../icon/index.mjs';
|
|
4
|
+
import { computed, defineComponent, ref, Teleport, Transition, watch } from 'vue';
|
|
5
|
+
import { useClickOutside } from '@varlet/use';
|
|
6
|
+
import { call, createNamespace, flatFragment, useTeleport } from '../utils/components.mjs';
|
|
7
|
+
import { toSizeUnit } from '../utils/elements.mjs';
|
|
8
|
+
import { toNumber } from '@varlet/shared';
|
|
9
|
+
import { props } from './props.mjs';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
function _isSlot(s) {
|
|
14
|
+
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
var {
|
|
18
|
+
classes,
|
|
19
|
+
n
|
|
20
|
+
} = createNamespace('fab');
|
|
21
|
+
export default defineComponent({
|
|
22
|
+
name: 'VarFab',
|
|
23
|
+
inheritAttrs: false,
|
|
24
|
+
props,
|
|
25
|
+
|
|
26
|
+
setup(props, _ref) {
|
|
27
|
+
var {
|
|
28
|
+
slots,
|
|
29
|
+
attrs
|
|
30
|
+
} = _ref;
|
|
31
|
+
var localActive = ref(false);
|
|
32
|
+
var host = ref(null);
|
|
33
|
+
var {
|
|
34
|
+
disabled
|
|
35
|
+
} = useTeleport();
|
|
36
|
+
var isActive = computed({
|
|
37
|
+
get() {
|
|
38
|
+
return localActive.value;
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
set(value) {
|
|
42
|
+
localActive.value = value;
|
|
43
|
+
call(props['onUpdate:active'], value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
var handleClick = (e, value, childrenLength) => {
|
|
49
|
+
e.stopPropagation();
|
|
50
|
+
|
|
51
|
+
if (props.trigger !== 'click' || props.disabled) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (childrenLength === 0) {
|
|
56
|
+
call(props.onClick, isActive.value, e);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
isActive.value = value;
|
|
61
|
+
call(props.onClick, isActive.value, e);
|
|
62
|
+
call(isActive.value ? props.onOpen : props.onClose);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var handleMouse = (value, childrenLength) => {
|
|
66
|
+
if (props.trigger !== 'hover' || props.disabled || childrenLength === 0) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
isActive.value = value;
|
|
71
|
+
call(isActive.value ? props.onOpen : props.onClose);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
var handleClickOutside = () => {
|
|
75
|
+
if (props.trigger !== 'click' || props.disabled) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (isActive.value !== false) {
|
|
80
|
+
isActive.value = false;
|
|
81
|
+
call(props.onClose);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
var renderTrigger = () => {
|
|
86
|
+
if (slots.trigger) {
|
|
87
|
+
return props.show ? slots.trigger({
|
|
88
|
+
active: isActive.value
|
|
89
|
+
}) : null;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return _withDirectives(_createVNode(Button, {
|
|
93
|
+
"var-fab-cover": true,
|
|
94
|
+
"class": n('trigger'),
|
|
95
|
+
"type": props.type,
|
|
96
|
+
"color": props.color,
|
|
97
|
+
"disabled": props.disabled,
|
|
98
|
+
"round": true
|
|
99
|
+
}, {
|
|
100
|
+
default: () => [_createVNode(Icon, {
|
|
101
|
+
"var-fab-cover": true,
|
|
102
|
+
"class": classes([isActive.value, n('trigger-active-icon'), n('trigger-inactive-icon')]),
|
|
103
|
+
"name": isActive.value ? props.activeIcon : props.inactiveIcon,
|
|
104
|
+
"size": isActive.value ? props.inactiveIconSize : props.activeIconSize,
|
|
105
|
+
"transition": 200,
|
|
106
|
+
"animationClass": n('--trigger-icon-animation')
|
|
107
|
+
}, null)]
|
|
108
|
+
}), [[_vShow, props.show]]);
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
var renderFab = () => {
|
|
112
|
+
var _slot;
|
|
113
|
+
|
|
114
|
+
var _slots$default;
|
|
115
|
+
|
|
116
|
+
var children = flatFragment((_slots$default = slots.default == null ? void 0 : slots.default()) != null ? _slots$default : []);
|
|
117
|
+
return _createVNode("div", _mergeProps({
|
|
118
|
+
"class": classes(n(), n("--position-" + props.position), n("--direction-" + props.direction), [props.fixed, n('--fixed'), n('--absolute')]),
|
|
119
|
+
"style": {
|
|
120
|
+
zIndex: toNumber(props.zIndex),
|
|
121
|
+
top: toSizeUnit(props.top),
|
|
122
|
+
bottom: toSizeUnit(props.bottom),
|
|
123
|
+
left: toSizeUnit(props.left),
|
|
124
|
+
right: toSizeUnit(props.right)
|
|
125
|
+
},
|
|
126
|
+
"ref": host,
|
|
127
|
+
"onClick": e => handleClick(e, !isActive.value, children.length),
|
|
128
|
+
"onMouseleave": () => handleMouse(false, children.length),
|
|
129
|
+
"onMouseenter": () => handleMouse(true, children.length)
|
|
130
|
+
}, attrs), [_createVNode(Transition, {
|
|
131
|
+
"name": n("--active-transition")
|
|
132
|
+
}, _isSlot(_slot = renderTrigger()) ? _slot : {
|
|
133
|
+
default: () => [_slot]
|
|
134
|
+
}), _createVNode(Transition, {
|
|
135
|
+
"name": n("--actions-transition-" + props.direction),
|
|
136
|
+
"onAfterEnter": props.onOpened,
|
|
137
|
+
"onAfterLeave": props.onClosed
|
|
138
|
+
}, {
|
|
139
|
+
default: () => [_withDirectives(_createVNode("div", {
|
|
140
|
+
"class": n('actions'),
|
|
141
|
+
"onClick": e => e.stopPropagation()
|
|
142
|
+
}, [children.map(child => {
|
|
143
|
+
return _createVNode("div", {
|
|
144
|
+
"class": n('action')
|
|
145
|
+
}, [child]);
|
|
146
|
+
})]), [[_vShow, props.show && isActive.value && children.length]])]
|
|
147
|
+
})]);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
watch(() => props.active, value => {
|
|
151
|
+
localActive.value = value;
|
|
152
|
+
}, {
|
|
153
|
+
immediate: true
|
|
154
|
+
});
|
|
155
|
+
watch(() => props.trigger, () => {
|
|
156
|
+
isActive.value = false;
|
|
157
|
+
});
|
|
158
|
+
watch(() => props.disabled, () => {
|
|
159
|
+
isActive.value = false;
|
|
160
|
+
});
|
|
161
|
+
useClickOutside(host, 'click', handleClickOutside);
|
|
162
|
+
return () => {
|
|
163
|
+
var {
|
|
164
|
+
teleport
|
|
165
|
+
} = props;
|
|
166
|
+
|
|
167
|
+
if (teleport) {
|
|
168
|
+
var _slot2;
|
|
169
|
+
|
|
170
|
+
return _createVNode(Teleport, {
|
|
171
|
+
"to": teleport,
|
|
172
|
+
"disabled": disabled.value
|
|
173
|
+
}, _isSlot(_slot2 = renderFab()) ? _slot2 : {
|
|
174
|
+
default: () => [_slot2]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return renderFab();
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
});
|
package/es/fab/fab.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root { --fab-top: 70px; --fab-bottom: 16px; --fab-left: 16px; --fab-right: 16px; --fab-trigger-size: 56px; --fab-trigger-inactive-icon-size: 26px; --fab-trigger-active-icon-size: 22px; --fab-actions-padding: 10px 0; --fab-action-margin: 6px; --fab-transition-standard-easing: cubic-bezier(0.4, 0, 0.2, 1);}.var-fab-transition-default-enter-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab-transition-default-leave-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab__trigger[var-fab-cover] { width: var(--fab-trigger-size); height: var(--fab-trigger-size);}.var-fab__trigger-inactive-icon[var-fab-cover] { font-size: var(--fab-trigger-inactive-icon-size);}.var-fab__trigger-active-icon[var-fab-cover] { font-size: var(--fab-trigger-active-icon-size);}.var-fab__actions { position: absolute; display: flex; justify-content: center; align-items: center; padding: var(--fab-actions-padding);}.var-fab__action { margin: var(--fab-action-margin);}.var-fab--position-left-top { top: var(--fab-top); left: var(--fab-left);}.var-fab--position-right-top { top: var(--fab-top); right: var(--fab-right);}.var-fab--position-left-bottom { bottom: var(--fab-bottom); left: var(--fab-left);}.var-fab--position-right-bottom { bottom: var(--fab-bottom); right: var(--fab-right);}.var-fab--direction-left .var-fab__actions,.var-fab--direction-right .var-fab__actions { height: 100%; top: 0; padding: 0 var(--fab-actions-padding);}.var-fab--direction-left .var-fab__actions { flex-direction: row-reverse; right: 100%;}.var-fab--direction-right .var-fab__actions { flex-direction: row; left: 100%;}.var-fab--direction-top .var-fab__actions,.var-fab--direction-bottom .var-fab__actions { width: 100%; left: 0;}.var-fab--direction-top .var-fab__actions { flex-direction: column-reverse; bottom: 100%;}.var-fab--direction-bottom .var-fab__actions { flex-direction: column; top: 100%;}.var-fab--fixed { position: fixed;}.var-fab--absolute { position: absolute;}.var-fab--active-transition-enter-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--active-transition-leave-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--active-transition-enter-from,.var-fab--active-transition-leave-to { transform: scale(0);}.var-fab--actions-transition-top-enter-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-top-leave-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-top-enter-from,.var-fab--actions-transition-top-leave-to { opacity: 0; transform: translateY(40px);}.var-fab--actions-transition-bottom-enter-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-bottom-leave-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-bottom-enter-from,.var-fab--actions-transition-bottom-leave-to { opacity: 0; transform: translateY(-40px);}.var-fab--actions-transition-left-enter-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-left-leave-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-left-enter-from,.var-fab--actions-transition-left-leave-to { opacity: 0; transform: translateX(40px);}.var-fab--actions-transition-right-enter-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-right-leave-active { transition: 0.3s var(--fab-transition-standard-easing) !important;}.var-fab--actions-transition-right-enter-from,.var-fab--actions-transition-right-leave-to { opacity: 0; transform: translateX(-40px);}.var-fab--trigger-icon-animation { transform: scale(0.4); opacity: 0; transition-property: transform, opacity;}
|
package/es/fab/index.mjs
ADDED
package/es/fab/props.mjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { defineListenerProp } from '../utils/components.mjs';
|
|
2
|
+
import { typeValidator } from '../button/props.mjs';
|
|
3
|
+
export function positionValidator(position) {
|
|
4
|
+
return ['left-top', 'right-top', 'left-bottom', 'right-bottom'].includes(position);
|
|
5
|
+
}
|
|
6
|
+
export function directionValidator(direction) {
|
|
7
|
+
return ['top', 'right', 'bottom', 'left'].includes(direction);
|
|
8
|
+
}
|
|
9
|
+
export function triggerValidator(trigger) {
|
|
10
|
+
return ['click', 'hover'].includes(trigger);
|
|
11
|
+
}
|
|
12
|
+
export var props = {
|
|
13
|
+
active: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: false
|
|
16
|
+
},
|
|
17
|
+
show: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: true
|
|
20
|
+
},
|
|
21
|
+
type: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: 'primary',
|
|
24
|
+
validator: typeValidator
|
|
25
|
+
},
|
|
26
|
+
position: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: 'right-bottom',
|
|
29
|
+
validator: positionValidator
|
|
30
|
+
},
|
|
31
|
+
direction: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: 'top',
|
|
34
|
+
validator: directionValidator
|
|
35
|
+
},
|
|
36
|
+
trigger: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'click',
|
|
39
|
+
validator: triggerValidator
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: false
|
|
44
|
+
},
|
|
45
|
+
color: {
|
|
46
|
+
type: String
|
|
47
|
+
},
|
|
48
|
+
inactiveIcon: {
|
|
49
|
+
type: String,
|
|
50
|
+
default: 'plus'
|
|
51
|
+
},
|
|
52
|
+
activeIcon: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'window-close'
|
|
55
|
+
},
|
|
56
|
+
inactiveIconSize: {
|
|
57
|
+
type: [Number, String]
|
|
58
|
+
},
|
|
59
|
+
activeIconSize: {
|
|
60
|
+
type: [Number, String]
|
|
61
|
+
},
|
|
62
|
+
fixed: {
|
|
63
|
+
type: Boolean,
|
|
64
|
+
default: true
|
|
65
|
+
},
|
|
66
|
+
zIndex: {
|
|
67
|
+
type: [Number, String],
|
|
68
|
+
default: 90
|
|
69
|
+
},
|
|
70
|
+
top: {
|
|
71
|
+
type: [Number, String]
|
|
72
|
+
},
|
|
73
|
+
bottom: {
|
|
74
|
+
type: [Number, String]
|
|
75
|
+
},
|
|
76
|
+
left: {
|
|
77
|
+
type: [Number, String]
|
|
78
|
+
},
|
|
79
|
+
right: {
|
|
80
|
+
type: [Number, String]
|
|
81
|
+
},
|
|
82
|
+
teleport: {
|
|
83
|
+
type: String
|
|
84
|
+
},
|
|
85
|
+
onClick: defineListenerProp(),
|
|
86
|
+
onOpen: defineListenerProp(),
|
|
87
|
+
onOpened: defineListenerProp(),
|
|
88
|
+
onClose: defineListenerProp(),
|
|
89
|
+
onClosed: defineListenerProp(),
|
|
90
|
+
'onUpdate:active': defineListenerProp()
|
|
91
|
+
};
|
package/es/hover/index.mjs
CHANGED
|
@@ -55,14 +55,17 @@ function updateStyle(element, styleValue) {
|
|
|
55
55
|
|
|
56
56
|
function clearStyle(element) {
|
|
57
57
|
Object.keys(element._hover.value).forEach(key => {
|
|
58
|
-
element.
|
|
58
|
+
var value = element._hover.value[key];
|
|
59
|
+
|
|
60
|
+
if (value != null) {
|
|
61
|
+
element.style[key] = '';
|
|
62
|
+
}
|
|
59
63
|
});
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
function restoreStyle(element) {
|
|
63
67
|
clearStyle(element);
|
|
64
68
|
updateStyle(element, element._hover.rawStyle);
|
|
65
|
-
element._hover.rawStyle = {};
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
function createHover() {
|
package/es/icon/Icon.mjs
CHANGED
|
@@ -15,10 +15,10 @@ import { resolveDynamicComponent as _resolveDynamicComponent, normalizeClass as
|
|
|
15
15
|
|
|
16
16
|
function __render__(_ctx, _cache) {
|
|
17
17
|
return _openBlock(), _createBlock(_resolveDynamicComponent(_ctx.isURL(_ctx.name) ? 'img' : 'i'), {
|
|
18
|
-
class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.namespace !== _ctx.n(), _ctx.namespace], _ctx.namespace + "--set", [_ctx.isURL(_ctx.name), _ctx.n('image'), _ctx.namespace + "-" + _ctx.nextName], [_ctx.
|
|
18
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.namespace !== _ctx.n(), _ctx.namespace], _ctx.namespace + "--set", [_ctx.isURL(_ctx.name), _ctx.n('image'), _ctx.namespace + "-" + _ctx.nextName], [_ctx.animateInProgress, _ctx.animationClass == null ? _ctx.n('--shrinking') : _ctx.animationClass])),
|
|
19
19
|
style: _normalizeStyle({
|
|
20
20
|
color: _ctx.color,
|
|
21
|
-
transition:
|
|
21
|
+
'transition-duration': _ctx.toNumber(_ctx.transition) + "ms",
|
|
22
22
|
width: _ctx.isURL(_ctx.name) ? _ctx.toSizeUnit(_ctx.size) : null,
|
|
23
23
|
height: _ctx.isURL(_ctx.name) ? _ctx.toSizeUnit(_ctx.size) : null,
|
|
24
24
|
fontSize: _ctx.toSizeUnit(_ctx.size)
|
|
@@ -36,7 +36,7 @@ var __sfc__ = defineComponent({
|
|
|
36
36
|
|
|
37
37
|
setup(props) {
|
|
38
38
|
var nextName = ref('');
|
|
39
|
-
var
|
|
39
|
+
var animateInProgress = ref(false);
|
|
40
40
|
|
|
41
41
|
var handleNameChange = /*#__PURE__*/function () {
|
|
42
42
|
var _ref = _asyncToGenerator(function* (newName, oldName) {
|
|
@@ -49,11 +49,14 @@ var __sfc__ = defineComponent({
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
animateInProgress.value = true;
|
|
53
53
|
yield nextTick();
|
|
54
54
|
setTimeout(() => {
|
|
55
|
-
oldName != null
|
|
56
|
-
|
|
55
|
+
if (oldName != null) {
|
|
56
|
+
nextName.value = newName;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
animateInProgress.value = false;
|
|
57
60
|
}, toNumber(transition));
|
|
58
61
|
});
|
|
59
62
|
|
|
@@ -69,7 +72,7 @@ var __sfc__ = defineComponent({
|
|
|
69
72
|
n,
|
|
70
73
|
classes,
|
|
71
74
|
nextName,
|
|
72
|
-
|
|
75
|
+
animateInProgress,
|
|
73
76
|
isURL,
|
|
74
77
|
toNumber,
|
|
75
78
|
toSizeUnit
|