@varlet/ui 2.4.0-alpha.1670569085974 → 2.4.0-alpha.1670751751241

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.
Files changed (47) hide show
  1. package/es/app-bar/AppBar.js +1 -1
  2. package/es/app-bar/appBar.css +1 -1
  3. package/es/app-bar/props.js +4 -0
  4. package/es/index.js +5 -0
  5. package/es/loading-bar/LoadingBar.js +2 -1
  6. package/es/loading-bar/index.js +10 -4
  7. package/es/loading-bar/props.js +3 -0
  8. package/es/overlay/Overlay.js +83 -0
  9. package/es/overlay/index.js +8 -0
  10. package/es/overlay/overlay.css +1 -0
  11. package/es/overlay/props.js +19 -0
  12. package/es/overlay/style/index.js +2 -0
  13. package/es/popup/popup.css +1 -1
  14. package/es/result/style/index.js +1 -0
  15. package/es/snackbar/style/index.js +1 -1
  16. package/es/style.css +1 -1
  17. package/es/style.js +1 -0
  18. package/es/umdIndex.js +5 -0
  19. package/es/utils/elements.js +11 -7
  20. package/es/varlet.esm.js +2797 -2708
  21. package/highlight/attributes.json +17 -1
  22. package/highlight/tags.json +9 -1
  23. package/highlight/web-types.json +54 -1
  24. package/lib/app-bar/AppBar.js +1 -1
  25. package/lib/app-bar/appBar.css +1 -1
  26. package/lib/app-bar/props.js +4 -0
  27. package/lib/index.js +3 -0
  28. package/lib/loading-bar/LoadingBar.js +2 -1
  29. package/lib/loading-bar/index.js +10 -4
  30. package/lib/loading-bar/props.js +3 -0
  31. package/lib/overlay/Overlay.js +96 -0
  32. package/lib/overlay/index.js +17 -0
  33. package/lib/overlay/overlay.css +1 -0
  34. package/lib/overlay/props.js +24 -0
  35. package/lib/overlay/style/index.js +2 -0
  36. package/lib/popup/popup.css +1 -1
  37. package/lib/result/style/index.js +1 -0
  38. package/lib/style.css +1 -1
  39. package/lib/style.js +1 -0
  40. package/lib/utils/elements.js +18 -8
  41. package/package.json +7 -7
  42. package/types/appBar.d.ts +1 -0
  43. package/types/index.d.ts +2 -0
  44. package/types/loadingBar.d.ts +2 -1
  45. package/types/overlay.d.ts +19 -0
  46. package/types/popup.d.ts +1 -2
  47. package/umd/varlet.js +7 -7
@@ -8,7 +8,7 @@ var {
8
8
  import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode } from "vue";
9
9
  export function render(_ctx, _cache) {
10
10
  return _openBlock(), _createElementBlock("div", {
11
- class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.elevation, _ctx.n('$-elevation--3')])),
11
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.round, _ctx.n('--round')], [_ctx.elevation, _ctx.n('$-elevation--3')])),
12
12
  style: _normalizeStyle({
13
13
  background: _ctx.color,
14
14
  color: _ctx.textColor
@@ -1 +1 @@
1
- :root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px;}.var-app-bar { position: relative; display: flex; width: 100%; justify-content: center; align-items: center; height: var(--app-bar-height); background: var(--app-bar-color); color: var(--app-bar-text-color); transition: background-color 0.25s;}.var-app-bar__title { flex: 1; display: flex; justify-content: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: var(--app-bar-title-padding);}.var-app-bar__left,.var-app-bar__right { display: flex; align-items: center; height: 100%; z-index: 2;}.var-app-bar__left { position: absolute; top: 0; left: var(--app-bar-left-gap);}.var-app-bar__right { position: absolute; top: 0; right: var(--app-bar-right-gap);}
1
+ :root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px; --app-bar-border-radius: 4px;}.var-app-bar { position: relative; display: flex; width: 100%; justify-content: center; align-items: center; height: var(--app-bar-height); background: var(--app-bar-color); color: var(--app-bar-text-color); transition: background-color 0.25s;}.var-app-bar__title { flex: 1; display: flex; justify-content: center; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; padding: var(--app-bar-title-padding);}.var-app-bar__left,.var-app-bar__right { display: flex; align-items: center; height: 100%; z-index: 2;}.var-app-bar__left { position: absolute; top: 0; left: var(--app-bar-left-gap);}.var-app-bar__right { position: absolute; top: 0; right: var(--app-bar-right-gap);}.var-app-bar--round { border-radius: var(--app-bar-border-radius);}
@@ -20,5 +20,9 @@ export var props = {
20
20
  elevation: {
21
21
  type: Boolean,
22
22
  default: true
23
+ },
24
+ round: {
25
+ type: Boolean,
26
+ default: false
23
27
  }
24
28
  };
package/es/index.js CHANGED
@@ -35,6 +35,7 @@ import LoadingBar, * as LoadingBarModule from './loading-bar'
35
35
  import Locale, * as LocaleModule from './locale'
36
36
  import Menu, * as MenuModule from './menu'
37
37
  import Option, * as OptionModule from './option'
38
+ import Overlay, * as OverlayModule from './overlay'
38
39
  import Pagination, * as PaginationModule from './pagination'
39
40
  import Picker, * as PickerModule from './picker'
40
41
  import Popup, * as PopupModule from './popup'
@@ -104,6 +105,7 @@ export const _LoadingBarComponent = LoadingBarModule._LoadingBarComponent || {}
104
105
  export const _LocaleComponent = LocaleModule._LocaleComponent || {}
105
106
  export const _MenuComponent = MenuModule._MenuComponent || {}
106
107
  export const _OptionComponent = OptionModule._OptionComponent || {}
108
+ export const _OverlayComponent = OverlayModule._OverlayComponent || {}
107
109
  export const _PaginationComponent = PaginationModule._PaginationComponent || {}
108
110
  export const _PickerComponent = PickerModule._PickerComponent || {}
109
111
  export const _PopupComponent = PopupModule._PopupComponent || {}
@@ -175,6 +177,7 @@ function install(app) {
175
177
  Locale.install && app.use(Locale)
176
178
  Menu.install && app.use(Menu)
177
179
  Option.install && app.use(Option)
180
+ Overlay.install && app.use(Overlay)
178
181
  Pagination.install && app.use(Pagination)
179
182
  Picker.install && app.use(Picker)
180
183
  Popup.install && app.use(Popup)
@@ -247,6 +250,7 @@ export {
247
250
  Locale,
248
251
  Menu,
249
252
  Option,
253
+ Overlay,
250
254
  Pagination,
251
255
  Picker,
252
256
  Popup,
@@ -319,6 +323,7 @@ export default {
319
323
  Locale,
320
324
  Menu,
321
325
  Option,
326
+ Overlay,
322
327
  Pagination,
323
328
  Picker,
324
329
  Popup,
@@ -23,7 +23,8 @@ export default defineComponent({
23
23
  width: props.value + "%",
24
24
  opacity: props.opacity,
25
25
  height: toSizeUnit(props.height),
26
- backgroundColor: props.error ? props.errorColor : props.color
26
+ backgroundColor: props.error ? props.errorColor : props.color,
27
+ top: toSizeUnit(props.top)
27
28
  }
28
29
  }, null);
29
30
  };
@@ -9,7 +9,7 @@ var props = reactive({
9
9
  error: false
10
10
  });
11
11
 
12
- var LoadingBar = options => {
12
+ var mergeConfig = options => {
13
13
  Object.assign(props, options);
14
14
  };
15
15
 
@@ -23,7 +23,7 @@ var changeValue = () => {
23
23
  }, 200);
24
24
  };
25
25
 
26
- LoadingBar.start = () => {
26
+ var start = () => {
27
27
  if (!isMount) {
28
28
  isMount = true;
29
29
  mountInstance(LoadingBarComponent, props);
@@ -39,7 +39,7 @@ LoadingBar.start = () => {
39
39
  changeValue();
40
40
  };
41
41
 
42
- LoadingBar.finish = () => {
42
+ var finish = () => {
43
43
  props.value = 100;
44
44
  setTimeout(() => {
45
45
  props.opacity = 0;
@@ -50,11 +50,17 @@ LoadingBar.finish = () => {
50
50
  window.clearTimeout(timer);
51
51
  };
52
52
 
53
- LoadingBar.error = () => {
53
+ var error = () => {
54
54
  props.error = true;
55
55
  LoadingBar.start();
56
56
  setTimeout(LoadingBar.finish, 300);
57
57
  };
58
58
 
59
+ var LoadingBar = {
60
+ start,
61
+ finish,
62
+ error,
63
+ mergeConfig
64
+ };
59
65
  export var _LoadingBarComponent = LoadingBar;
60
66
  export default LoadingBar;
@@ -19,5 +19,8 @@ export var props = {
19
19
  },
20
20
  height: {
21
21
  type: [Number, String]
22
+ },
23
+ top: {
24
+ type: [Number, String]
22
25
  }
23
26
  };
@@ -0,0 +1,83 @@
1
+ import { isVNode as _isVNode, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
+ import { defineComponent, Teleport, Transition } from 'vue';
3
+ import { props } from './props';
4
+ import { useLock } from '../context/lock';
5
+ import { useZIndex } from '../context/zIndex';
6
+ import { createNamespace, useTeleport, call } from '../utils/components';
7
+
8
+
9
+
10
+ function _isSlot(s) {
11
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !_isVNode(s);
12
+ }
13
+
14
+ var {
15
+ n
16
+ } = createNamespace('overlay');
17
+ export default defineComponent({
18
+ name: 'VarOverlay',
19
+ inheritAttrs: false,
20
+ props,
21
+
22
+ setup(props, _ref) {
23
+ var {
24
+ slots,
25
+ attrs
26
+ } = _ref;
27
+ var {
28
+ zIndex
29
+ } = useZIndex(() => props.show, 1);
30
+ var {
31
+ disabled
32
+ } = useTeleport();
33
+
34
+ var handleClickOverlay = () => {
35
+ call(props.onClick);
36
+ call(props['onUpdate:show'], false);
37
+ };
38
+
39
+ useLock(() => props.show, () => props.lockScroll);
40
+
41
+ var renderOverlay = () => {
42
+ return _createVNode("div", _mergeProps({
43
+ "class": n(),
44
+ "style": {
45
+ zIndex: zIndex.value - 1
46
+ }
47
+ }, attrs, {
48
+ "onClick": handleClickOverlay
49
+ }), [call(slots.default)]);
50
+ };
51
+
52
+ var renderTransitionOverlay = () => {
53
+ var {
54
+ show
55
+ } = props;
56
+ return _createVNode(Transition, {
57
+ "name": n('--fade')
58
+ }, {
59
+ default: () => [show && renderOverlay()]
60
+ });
61
+ };
62
+
63
+ return () => {
64
+ var {
65
+ teleport
66
+ } = props;
67
+
68
+ if (teleport) {
69
+ var _slot;
70
+
71
+ return _createVNode(Teleport, {
72
+ "to": teleport,
73
+ "disabled": disabled.value
74
+ }, _isSlot(_slot = renderTransitionOverlay()) ? _slot : {
75
+ default: () => [_slot]
76
+ });
77
+ }
78
+
79
+ return renderTransitionOverlay();
80
+ };
81
+ }
82
+
83
+ });
@@ -0,0 +1,8 @@
1
+ import Overlay from './Overlay';
2
+
3
+ Overlay.install = function (app) {
4
+ app.component(Overlay.name, Overlay);
5
+ };
6
+
7
+ export var _PopupComponent = Overlay;
8
+ export default Overlay;
@@ -0,0 +1 @@
1
+ :root { --overlay-background-color: rgba(0, 0, 0, 0.6);}.var-overlay { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: var(--overlay-background-color); transition: all 0.25s;}.var-overlay--fade-enter-from,.var-overlay--fade-leave-to { opacity: 0;}.var-overlay--fade-enter-active,.var-overlay--fade-leave-active { transition: opacity 0.25s;}
@@ -0,0 +1,19 @@
1
+ export var props = {
2
+ show: {
3
+ type: Boolean,
4
+ default: false
5
+ },
6
+ lockScroll: {
7
+ type: Boolean,
8
+ default: true
9
+ },
10
+ onClick: {
11
+ type: Function
12
+ },
13
+ teleport: {
14
+ type: String
15
+ },
16
+ 'onUpdate:show': {
17
+ type: Function
18
+ }
19
+ };
@@ -0,0 +1,2 @@
1
+ import '../../styles/common.css'
2
+ import '../overlay.css'
@@ -1 +1 @@
1
- :root { --popup-overlay-background-color: rgba(0, 0, 0, 0.6); --popup-content-background-color: #fff;}.var-fade-enter-from,.var-fade-leave-to { opacity: 0;}.var-fade-enter-active,.var-fade-leave-active { transition: opacity 0.25s;}.var-pop-center-enter-from,.var-pop-center-leave-to { transform: scale(0.3);}.var-pop-center-enter-active,.var-pop-center-leave-active { transition: all 0.25s;}.var-pop-bottom-enter-from,.var-pop-bottom-leave-to { transform: translateY(100%);}.var-pop-bottom-enter-active,.var-pop-bottom-leave-active { transition: all 0.25s;}.var-pop-top-enter-from,.var-pop-top-leave-to { transform: translateY(-100%);}.var-pop-top-enter-active,.var-pop-top-leave-active { transition: all 0.25s;}.var-pop-left-enter-from,.var-pop-left-leave-to { transform: translateX(-100%);}.var-pop-left-enter-active,.var-pop-left-leave-active { transition: all 0.25s;}.var-pop-right-enter-from,.var-pop-right-leave-to { transform: translateX(100%);}.var-pop-right-enter-active,.var-pop-right-leave-active { transition: all 0.25s;}.var-popup { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0;}.var-popup__overlay { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: var(--popup-overlay-background-color); transition: all 0.25s;}.var-popup__content { overflow: auto; transition: all 0.25s;}.var-popup--content-background-color { background-color: var(--popup-content-background-color);}.var-popup--center { position: relative;}.var-popup--bottom { min-width: 100%; position: absolute; left: 0; bottom: 0;}.var-popup--top { min-width: 100%; position: absolute; left: 0; top: 0;}.var-popup--left { min-height: 100%; position: absolute; left: 0; top: 0;}.var-popup--right { min-height: 100%; position: absolute; right: 0; top: 0;}
1
+ :root { --popup-content-background-color: #fff; --popup-overlay-background-color: rgba(0, 0, 0, 0.6);}.var-fade-enter-from,.var-fade-leave-to { opacity: 0;}.var-fade-enter-active,.var-fade-leave-active { transition: opacity 0.25s;}.var-pop-center-enter-from,.var-pop-center-leave-to { transform: scale(0.3);}.var-pop-center-enter-active,.var-pop-center-leave-active { transition: all 0.25s;}.var-pop-bottom-enter-from,.var-pop-bottom-leave-to { transform: translateY(100%);}.var-pop-bottom-enter-active,.var-pop-bottom-leave-active { transition: all 0.25s;}.var-pop-top-enter-from,.var-pop-top-leave-to { transform: translateY(-100%);}.var-pop-top-enter-active,.var-pop-top-leave-active { transition: all 0.25s;}.var-pop-left-enter-from,.var-pop-left-leave-to { transform: translateX(-100%);}.var-pop-left-enter-active,.var-pop-left-leave-active { transition: all 0.25s;}.var-pop-right-enter-from,.var-pop-right-leave-to { transform: translateX(100%);}.var-pop-right-enter-active,.var-pop-right-leave-active { transition: all 0.25s;}.var-popup { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0;}.var-popup__overlay { display: flex; justify-content: center; align-items: center; position: fixed; top: 0; right: 0; bottom: 0; left: 0; background-color: var(--popup-overlay-background-color); transition: all 0.25s;}.var-popup__content { overflow: auto; transition: all 0.25s;}.var-popup--content-background-color { background-color: var(--popup-content-background-color);}.var-popup--center { position: relative;}.var-popup--bottom { min-width: 100%; position: absolute; left: 0; bottom: 0;}.var-popup--top { min-width: 100%; position: absolute; left: 0; top: 0;}.var-popup--left { min-height: 100%; position: absolute; left: 0; top: 0;}.var-popup--right { min-height: 100%; position: absolute; right: 0; top: 0;}
@@ -1,2 +1,3 @@
1
+ import '../../styles/common.css'
1
2
  import '../result.css'
2
3
  import '../ResultSfc.css'
@@ -1,8 +1,8 @@
1
1
  import '../../styles/common.css'
2
+ import '../SnackbarSfc.css'
2
3
  import '../../styles/elevation.css'
3
4
  import '../../loading/loading.css'
4
5
  import '../../button/button.css'
5
6
  import '../../icon/icon.css'
6
7
  import '../snackbar.css'
7
8
  import '../coreSfc.css'
8
- import '../SnackbarSfc.css'