@varlet/ui 2.3.0 → 2.4.0-alpha.1670569085974

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 (67) hide show
  1. package/es/card/Card.js +1 -1
  2. package/es/index.js +10 -0
  3. package/es/link/props.js +0 -4
  4. package/es/loading-bar/LoadingBar.js +32 -0
  5. package/es/loading-bar/index.js +60 -0
  6. package/es/loading-bar/loadingBar.css +1 -0
  7. package/es/loading-bar/props.js +23 -0
  8. package/es/loading-bar/style/index.js +2 -0
  9. package/es/popup/Popup.js +1 -1
  10. package/es/popup/popup.css +1 -1
  11. package/es/popup/props.js +4 -0
  12. package/es/result/Empty.js +23 -0
  13. package/es/result/Error.js +23 -0
  14. package/es/result/Info.js +23 -0
  15. package/es/result/Question.js +23 -0
  16. package/es/result/Result.js +95 -0
  17. package/es/result/ResultSfc.css +0 -0
  18. package/es/result/Success.js +74 -0
  19. package/es/result/Warning.js +23 -0
  20. package/es/result/index.js +8 -0
  21. package/es/result/props.js +24 -0
  22. package/es/result/result.css +1 -0
  23. package/es/result/style/index.js +2 -0
  24. package/es/style.css +1 -1
  25. package/es/style.js +2 -0
  26. package/es/themes/dark/index.js +2 -1
  27. package/es/themes/dark/result.js +9 -0
  28. package/es/umdIndex.js +10 -0
  29. package/es/varlet.esm.js +5078 -4694
  30. package/highlight/attributes.json +24 -0
  31. package/highlight/tags.json +13 -0
  32. package/highlight/web-types.json +85 -1
  33. package/lib/card/Card.js +1 -1
  34. package/lib/index.js +6 -0
  35. package/lib/link/props.js +0 -4
  36. package/lib/loading-bar/LoadingBar.js +48 -0
  37. package/lib/loading-bar/index.js +72 -0
  38. package/lib/loading-bar/loadingBar.css +1 -0
  39. package/lib/loading-bar/props.js +28 -0
  40. package/lib/loading-bar/style/index.js +2 -0
  41. package/lib/popup/Popup.js +1 -1
  42. package/lib/popup/popup.css +1 -1
  43. package/lib/popup/props.js +4 -0
  44. package/lib/result/Empty.js +32 -0
  45. package/lib/result/Error.js +32 -0
  46. package/lib/result/Info.js +32 -0
  47. package/lib/result/Question.js +32 -0
  48. package/lib/result/Result.js +117 -0
  49. package/lib/result/ResultSfc.css +0 -0
  50. package/lib/result/Success.js +86 -0
  51. package/lib/result/Warning.js +32 -0
  52. package/lib/result/index.js +17 -0
  53. package/lib/result/props.js +30 -0
  54. package/lib/result/result.css +1 -0
  55. package/lib/result/style/index.js +2 -0
  56. package/lib/snackbar/style/index.js +1 -1
  57. package/lib/style.css +1 -1
  58. package/lib/style.js +2 -0
  59. package/lib/themes/dark/index.js +3 -1
  60. package/lib/themes/dark/result.js +14 -0
  61. package/package.json +8 -9
  62. package/types/index.d.ts +4 -0
  63. package/types/loadingBar.d.ts +17 -0
  64. package/types/popup.d.ts +1 -0
  65. package/types/result.d.ts +25 -0
  66. package/umd/varlet.js +7 -7
  67. package/CHANGELOG.md +0 -1885
package/es/card/Card.js CHANGED
@@ -39,7 +39,7 @@ export function render(_ctx, _cache) {
39
39
  })
40
40
  }, [_createElementVNode("div", {
41
41
  ref: "cardFloater",
42
- class: _normalizeClass(_ctx.classes(_ctx.n('floater'))),
42
+ class: _normalizeClass(_ctx.n('floater')),
43
43
  style: _normalizeStyle({
44
44
  width: _ctx.floaterWidth,
45
45
  height: _ctx.floaterHeight,
package/es/index.js CHANGED
@@ -31,6 +31,7 @@ import Lazy, * as LazyModule from './lazy'
31
31
  import Link, * as LinkModule from './link'
32
32
  import List, * as ListModule from './list'
33
33
  import Loading, * as LoadingModule from './loading'
34
+ import LoadingBar, * as LoadingBarModule from './loading-bar'
34
35
  import Locale, * as LocaleModule from './locale'
35
36
  import Menu, * as MenuModule from './menu'
36
37
  import Option, * as OptionModule from './option'
@@ -42,6 +43,7 @@ import PullRefresh, * as PullRefreshModule from './pull-refresh'
42
43
  import Radio, * as RadioModule from './radio'
43
44
  import RadioGroup, * as RadioGroupModule from './radio-group'
44
45
  import Rate, * as RateModule from './rate'
46
+ import Result, * as ResultModule from './result'
45
47
  import Ripple, * as RippleModule from './ripple'
46
48
  import Row, * as RowModule from './row'
47
49
  import Select, * as SelectModule from './select'
@@ -98,6 +100,7 @@ export const _LazyComponent = LazyModule._LazyComponent || {}
98
100
  export const _LinkComponent = LinkModule._LinkComponent || {}
99
101
  export const _ListComponent = ListModule._ListComponent || {}
100
102
  export const _LoadingComponent = LoadingModule._LoadingComponent || {}
103
+ export const _LoadingBarComponent = LoadingBarModule._LoadingBarComponent || {}
101
104
  export const _LocaleComponent = LocaleModule._LocaleComponent || {}
102
105
  export const _MenuComponent = MenuModule._MenuComponent || {}
103
106
  export const _OptionComponent = OptionModule._OptionComponent || {}
@@ -109,6 +112,7 @@ export const _PullRefreshComponent = PullRefreshModule._PullRefreshComponent ||
109
112
  export const _RadioComponent = RadioModule._RadioComponent || {}
110
113
  export const _RadioGroupComponent = RadioGroupModule._RadioGroupComponent || {}
111
114
  export const _RateComponent = RateModule._RateComponent || {}
115
+ export const _ResultComponent = ResultModule._ResultComponent || {}
112
116
  export const _RippleComponent = RippleModule._RippleComponent || {}
113
117
  export const _RowComponent = RowModule._RowComponent || {}
114
118
  export const _SelectComponent = SelectModule._SelectComponent || {}
@@ -167,6 +171,7 @@ function install(app) {
167
171
  Link.install && app.use(Link)
168
172
  List.install && app.use(List)
169
173
  Loading.install && app.use(Loading)
174
+ LoadingBar.install && app.use(LoadingBar)
170
175
  Locale.install && app.use(Locale)
171
176
  Menu.install && app.use(Menu)
172
177
  Option.install && app.use(Option)
@@ -178,6 +183,7 @@ function install(app) {
178
183
  Radio.install && app.use(Radio)
179
184
  RadioGroup.install && app.use(RadioGroup)
180
185
  Rate.install && app.use(Rate)
186
+ Result.install && app.use(Result)
181
187
  Ripple.install && app.use(Ripple)
182
188
  Row.install && app.use(Row)
183
189
  Select.install && app.use(Select)
@@ -237,6 +243,7 @@ export {
237
243
  Link,
238
244
  List,
239
245
  Loading,
246
+ LoadingBar,
240
247
  Locale,
241
248
  Menu,
242
249
  Option,
@@ -248,6 +255,7 @@ export {
248
255
  Radio,
249
256
  RadioGroup,
250
257
  Rate,
258
+ Result,
251
259
  Ripple,
252
260
  Row,
253
261
  Select,
@@ -307,6 +315,7 @@ export default {
307
315
  Link,
308
316
  List,
309
317
  Loading,
318
+ LoadingBar,
310
319
  Locale,
311
320
  Menu,
312
321
  Option,
@@ -318,6 +327,7 @@ export default {
318
327
  Radio,
319
328
  RadioGroup,
320
329
  Rate,
330
+ Result,
321
331
  Ripple,
322
332
  Row,
323
333
  Select,
package/es/link/props.js CHANGED
@@ -40,10 +40,6 @@ export var props = {
40
40
  textColor: {
41
41
  type: String
42
42
  },
43
- defaultStyle: {
44
- type: Boolean,
45
- default: false
46
- },
47
43
  onClick: {
48
44
  type: Function
49
45
  }
@@ -0,0 +1,32 @@
1
+ import { createVNode as _createVNode } from "vue";
2
+ import { defineComponent } from 'vue';
3
+ import context from '../context';
4
+ import { createNamespace } from '../utils/components';
5
+ import { toSizeUnit } from '../utils/elements';
6
+ import { props } from './props';
7
+
8
+
9
+ var {
10
+ classes,
11
+ n
12
+ } = createNamespace('loading-bar');
13
+ export default defineComponent({
14
+ name: 'VarLoadingBar',
15
+ props,
16
+
17
+ setup(props) {
18
+ return () => {
19
+ return _createVNode("div", {
20
+ "class": classes(n(), [props.error, n('--error')]),
21
+ "style": {
22
+ zIndex: context.zIndex + 10,
23
+ width: props.value + "%",
24
+ opacity: props.opacity,
25
+ height: toSizeUnit(props.height),
26
+ backgroundColor: props.error ? props.errorColor : props.color
27
+ }
28
+ }, null);
29
+ };
30
+ }
31
+
32
+ });
@@ -0,0 +1,60 @@
1
+ import LoadingBarComponent from './LoadingBar';
2
+ import { reactive } from 'vue';
3
+ import { mountInstance } from '../utils/components';
4
+ var timer;
5
+ var isMount;
6
+ var props = reactive({
7
+ value: 0,
8
+ opacity: 0,
9
+ error: false
10
+ });
11
+
12
+ var LoadingBar = options => {
13
+ Object.assign(props, options);
14
+ };
15
+
16
+ var changeValue = () => {
17
+ timer = window.setTimeout(() => {
18
+ if (props.value >= 95) return;
19
+ var num = Math.random();
20
+ if (props.value < 70) num = Math.round(5 * Math.random());
21
+ props.value += num;
22
+ changeValue();
23
+ }, 200);
24
+ };
25
+
26
+ LoadingBar.start = () => {
27
+ if (!isMount) {
28
+ isMount = true;
29
+ mountInstance(LoadingBarComponent, props);
30
+ }
31
+
32
+ if (!props.error || props.value === 100) {
33
+ props.value = 0;
34
+ }
35
+
36
+ setTimeout(() => {
37
+ props.opacity = 1;
38
+ }, 200);
39
+ changeValue();
40
+ };
41
+
42
+ LoadingBar.finish = () => {
43
+ props.value = 100;
44
+ setTimeout(() => {
45
+ props.opacity = 0;
46
+ setTimeout(() => {
47
+ props.error = false;
48
+ }, 250);
49
+ }, 300);
50
+ window.clearTimeout(timer);
51
+ };
52
+
53
+ LoadingBar.error = () => {
54
+ props.error = true;
55
+ LoadingBar.start();
56
+ setTimeout(LoadingBar.finish, 300);
57
+ };
58
+
59
+ export var _LoadingBarComponent = LoadingBar;
60
+ export default LoadingBar;
@@ -0,0 +1 @@
1
+ :root { --loading-bar-color: var(--color-primary); --loading-bar-error-color: var(--color-danger); --loading-bar-height: 3px;}.var-loading-bar { position: fixed; left: 0; top: 0; transition: all 0.25s; height: var(--loading-bar-height); background-color: var(--loading-bar-color);}.var-loading-bar--error { background-color: var(--loading-bar-error-color);}
@@ -0,0 +1,23 @@
1
+ export var props = {
2
+ value: {
3
+ type: Number,
4
+ default: 0
5
+ },
6
+ opacity: {
7
+ type: Number,
8
+ default: 0
9
+ },
10
+ error: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ color: {
15
+ type: String
16
+ },
17
+ errorColor: {
18
+ type: String
19
+ },
20
+ height: {
21
+ type: [Number, String]
22
+ }
23
+ };
@@ -0,0 +1,2 @@
1
+ import '../../styles/common.css'
2
+ import '../loadingBar.css'
package/es/popup/Popup.js CHANGED
@@ -78,7 +78,7 @@ export default defineComponent({
78
78
 
79
79
  var renderContent = () => {
80
80
  return _createVNode("div", _mergeProps({
81
- "class": classes(n('content'), n('$-elevation--3'), n("--" + props.position)),
81
+ "class": classes(n('content'), n("--" + props.position), [props.defaultStyle, n('--content-background-color')], [props.defaultStyle, n('$-elevation--3')]),
82
82
  "style": {
83
83
  zIndex: zIndex.value
84
84
  }
@@ -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; background-color: var(--popup-content-background-color); transition: all 0.25s;}.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-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;}
package/es/popup/props.js CHANGED
@@ -33,6 +33,10 @@ export var props = {
33
33
  type: Boolean,
34
34
  default: true
35
35
  },
36
+ defaultStyle: {
37
+ type: Boolean,
38
+ default: true
39
+ },
36
40
  teleport: {
37
41
  type: String
38
42
  },
@@ -0,0 +1,23 @@
1
+ import { defineComponent } from 'vue';
2
+ import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
3
+
4
+ var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
5
+
6
+ var _hoisted_1 = {
7
+ viewBox: "-4 -4 32 32"
8
+ };
9
+
10
+ var _hoisted_2 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/_createElementVNode("path", {
11
+ fill: "currentColor",
12
+ d: "M2,10.96C1.5,10.68 1.35,10.07 1.63,9.59L3.13,7C3.24,6.8 3.41,6.66 3.6,6.58L11.43,2.18C11.59,2.06 11.79,2 12,2C12.21,2 12.41,2.06 12.57,2.18L20.47,6.62C20.66,6.72 20.82,6.88 20.91,7.08L22.36,9.6C22.64,10.08 22.47,10.69 22,10.96L21,11.54V16.5C21,16.88 20.79,17.21 20.47,17.38L12.57,21.82C12.41,21.94 12.21,22 12,22C11.79,22 11.59,21.94 11.43,21.82L3.53,17.38C3.21,17.21 3,16.88 3,16.5V10.96C2.7,11.13 2.32,11.14 2,10.96M12,4.15V4.15L12,10.85V10.85L17.96,7.5L12,4.15M5,15.91L11,19.29V12.58L5,9.21V15.91M19,15.91V12.69L14,15.59C13.67,15.77 13.3,15.76 13,15.6V19.29L19,15.91M13.85,13.36L20.13,9.73L19.55,8.72L13.27,12.35L13.85,13.36Z"
13
+ }, null, -1
14
+ /* HOISTED */
15
+ ));
16
+
17
+ var _hoisted_3 = [_hoisted_2];
18
+ export function render(_ctx, _cache) {
19
+ return _openBlock(), _createElementBlock("svg", _hoisted_1, _hoisted_3);
20
+ }
21
+ export default defineComponent({
22
+ render
23
+ });
@@ -0,0 +1,23 @@
1
+ import { defineComponent } from 'vue';
2
+ import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
3
+
4
+ var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
5
+
6
+ var _hoisted_1 = {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ viewBox: "2 2 20 20"
9
+ };
10
+
11
+ var _hoisted_2 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/_createElementVNode("path", {
12
+ d: "M19,3V5H19V19M17,8.4L13.4,12L17,15.6L15.6,17L12,13.4L8.4,17L7,15.6L10.6,12L7,8.4L8.4,7L12,10.6L15.6,7L17,8.4Z"
13
+ }, null, -1
14
+ /* HOISTED */
15
+ ));
16
+
17
+ var _hoisted_3 = [_hoisted_2];
18
+ export function render(_ctx, _cache) {
19
+ return _openBlock(), _createElementBlock("svg", _hoisted_1, _hoisted_3);
20
+ }
21
+ export default defineComponent({
22
+ render
23
+ });
@@ -0,0 +1,23 @@
1
+ import { defineComponent } from 'vue';
2
+ import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
3
+
4
+ var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
5
+
6
+ var _hoisted_1 = {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ viewBox: "2 3.6 20 20"
9
+ };
10
+
11
+ var _hoisted_2 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/_createElementVNode("path", {
12
+ d: "M11,9H13V7H11M11,20H13V11H11V20Z"
13
+ }, null, -1
14
+ /* HOISTED */
15
+ ));
16
+
17
+ var _hoisted_3 = [_hoisted_2];
18
+ export function render(_ctx, _cache) {
19
+ return _openBlock(), _createElementBlock("svg", _hoisted_1, _hoisted_3);
20
+ }
21
+ export default defineComponent({
22
+ render
23
+ });
@@ -0,0 +1,23 @@
1
+ import { defineComponent } from 'vue';
2
+ import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
3
+
4
+ var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
5
+
6
+ var _hoisted_1 = {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ viewBox: "-3 -3 30 30"
9
+ };
10
+
11
+ var _hoisted_2 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/_createElementVNode("path", {
12
+ d: "M10,19H13V22H10V19M12,2C17.35,2.22 19.68,7.62 16.5,11.67C15.67,12.67 14.33,13.33 13.67,14.17C13,15 13,16 13,17H10C10,15.33 10,13.92 10.67,12.92C11.33,11.92 12.67,11.33 13.5,10.67C15.92,8.43 15.32,5.26 12,5A3,3 0 0,0 9,8H6A6,6 0 0,1 12,2Z"
13
+ }, null, -1
14
+ /* HOISTED */
15
+ ));
16
+
17
+ var _hoisted_3 = [_hoisted_2];
18
+ export function render(_ctx, _cache) {
19
+ return _openBlock(), _createElementBlock("svg", _hoisted_1, _hoisted_3);
20
+ }
21
+ export default defineComponent({
22
+ render
23
+ });
@@ -0,0 +1,95 @@
1
+ import { computed, defineComponent } from 'vue';
2
+ import { toNumber } from '@varlet/shared';
3
+ import { props } from './props';
4
+ import { createNamespace } from '../utils/components';
5
+ import { toPxNum, toSizeUnit } from '../utils/elements';
6
+ import Info from './Info.js'
7
+ import Error from './Error.js'
8
+ import Warning from './Warning.js'
9
+ import Success from './Success.js'
10
+ import Question from './Question.js'
11
+ import Empty from './Empty.js'
12
+ var {
13
+ n,
14
+ classes
15
+ } = createNamespace('result');
16
+ import { renderSlot as _renderSlot, resolveDynamicComponent as _resolveDynamicComponent, openBlock as _openBlock, createBlock as _createBlock, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString } from "vue";
17
+ export function render(_ctx, _cache) {
18
+ return _openBlock(), _createElementBlock("div", {
19
+ class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n('$--box')))
20
+ }, [_renderSlot(_ctx.$slots, "image", {}, () => [_ctx.type ? (_openBlock(), _createElementBlock("div", {
21
+ key: 0,
22
+ class: _normalizeClass(_ctx.n('image-container'))
23
+ }, [_createElementVNode("div", {
24
+ class: _normalizeClass(_ctx.classes(_ctx.n('image'), _ctx.n(_ctx.type))),
25
+ style: _normalizeStyle({
26
+ width: _ctx.circleSize,
27
+ height: _ctx.circleSize,
28
+ borderWidth: _ctx.borderSize
29
+ })
30
+ }, [(_openBlock(), _createBlock(_resolveDynamicComponent(_ctx.type), {
31
+ "border-size": _ctx.borderSize,
32
+ animation: _ctx.animation
33
+ }, null, 8
34
+ /* PROPS */
35
+ , ["border-size", "animation"]))], 6
36
+ /* CLASS, STYLE */
37
+ )], 2
38
+ /* CLASS */
39
+ )) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "title", {}, () => [_ctx.title ? (_openBlock(), _createElementBlock("div", {
40
+ key: 0,
41
+ class: _normalizeClass(_ctx.n('title'))
42
+ }, _toDisplayString(_ctx.title), 3
43
+ /* TEXT, CLASS */
44
+ )) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "description", {}, () => [_ctx.description ? (_openBlock(), _createElementBlock("div", {
45
+ key: 0,
46
+ class: _normalizeClass(_ctx.n('description'))
47
+ }, _toDisplayString(_ctx.description), 3
48
+ /* TEXT, CLASS */
49
+ )) : _createCommentVNode("v-if", true)]), _ctx.$slots.footer ? (_openBlock(), _createElementBlock("div", {
50
+ key: 0,
51
+ class: _normalizeClass(_ctx.n('footer'))
52
+ }, [_renderSlot(_ctx.$slots, "footer")], 2
53
+ /* CLASS */
54
+ )) : _createCommentVNode("v-if", true)], 2
55
+ /* CLASS */
56
+ );
57
+ }
58
+ export default defineComponent({
59
+ render,
60
+ name: 'VarResult',
61
+ components: {
62
+ Info,
63
+ Success,
64
+ Warning,
65
+ Error,
66
+ Question,
67
+ Empty
68
+ },
69
+ props,
70
+
71
+ setup(props) {
72
+ var circleSize = computed(() => {
73
+ var {
74
+ imageSize
75
+ } = props;
76
+ return "calc(" + (imageSize ? toSizeUnit(imageSize) : 'var(--result-image-size)') + " * 0.9)";
77
+ });
78
+ var borderSize = computed(() => {
79
+ var {
80
+ imageSize
81
+ } = props;
82
+ return "calc(" + (imageSize ? toSizeUnit(props.imageSize) : 'var(--result-image-size)') + " * 0.05)";
83
+ });
84
+ return {
85
+ n,
86
+ classes,
87
+ toNumber,
88
+ toPxNum,
89
+ toSizeUnit,
90
+ circleSize,
91
+ borderSize
92
+ };
93
+ }
94
+
95
+ });
File without changes
@@ -0,0 +1,74 @@
1
+ import { defineComponent } from 'vue';
2
+ import { createNamespace } from '../utils/components';
3
+ import { toNumber } from '@varlet/shared';
4
+ var {
5
+ n,
6
+ classes
7
+ } = createNamespace('result');
8
+ import { normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
9
+ export function render(_ctx, _cache) {
10
+ return _openBlock(), _createElementBlock(_Fragment, null, [_createElementVNode("span", {
11
+ class: _normalizeClass(_ctx.n('success-cover-left'))
12
+ }, null, 2
13
+ /* CLASS */
14
+ ), _createElementVNode("span", {
15
+ class: _normalizeClass(_ctx.classes(_ctx.n('success-line'), _ctx.n('success-line-tip'))),
16
+ style: _normalizeStyle({
17
+ animationDuration: _ctx.animation ? "760ms" : '0ms',
18
+ borderRadius: "calc(" + _ctx.borderSize + " * 0.625)"
19
+ })
20
+ }, null, 6
21
+ /* CLASS, STYLE */
22
+ ), _createElementVNode("span", {
23
+ class: _normalizeClass(_ctx.classes(_ctx.n('success-line'), _ctx.n('success-line-long'))),
24
+ style: _normalizeStyle({
25
+ animationDuration: _ctx.animation ? "770ms" : '0ms',
26
+ borderRadius: "calc(" + _ctx.borderSize + " * 0.625)"
27
+ })
28
+ }, null, 6
29
+ /* CLASS, STYLE */
30
+ ), _createElementVNode("span", {
31
+ ref: "circle",
32
+ class: _normalizeClass(_ctx.n('success-circle')),
33
+ style: _normalizeStyle({
34
+ left: "-" + _ctx.borderSize,
35
+ top: "-" + _ctx.borderSize,
36
+ borderWidth: _ctx.borderSize
37
+ })
38
+ }, null, 6
39
+ /* CLASS, STYLE */
40
+ ), _createElementVNode("span", {
41
+ class: _normalizeClass(_ctx.n('success-line-fix'))
42
+ }, null, 2
43
+ /* CLASS */
44
+ ), _createElementVNode("span", {
45
+ class: _normalizeClass(_ctx.n('success-cover-right')),
46
+ style: _normalizeStyle({
47
+ animationDuration: _ctx.animation ? "4250ms" : '0ms'
48
+ })
49
+ }, null, 6
50
+ /* CLASS, STYLE */
51
+ )], 64
52
+ /* STABLE_FRAGMENT */
53
+ );
54
+ }
55
+ export default defineComponent({
56
+ render,
57
+ props: {
58
+ animation: {
59
+ type: Boolean
60
+ },
61
+ borderSize: {
62
+ type: String
63
+ }
64
+ },
65
+
66
+ setup() {
67
+ return {
68
+ n,
69
+ classes,
70
+ toNumber
71
+ };
72
+ }
73
+
74
+ });
@@ -0,0 +1,23 @@
1
+ import { defineComponent } from 'vue';
2
+ import { createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
3
+
4
+ var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
5
+
6
+ var _hoisted_1 = {
7
+ xmlns: "http://www.w3.org/2000/svg",
8
+ viewBox: "-6 -4 35 35"
9
+ };
10
+
11
+ var _hoisted_2 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/_createElementVNode("path", {
12
+ d: "M10,21H14A2,2 0 0,1 12,23A2,2 0 0,1 10,21M21,19V20H3V19L5,17V11C5,7.9 7.03,5.17 10,4.29C10,4.19 10,4.1 10,4A2,2 0 0,1 12,2A2,2 0 0,1 14,4C14,4.1 14,4.19 14,4.29C16.97,5.17 19,7.9 19,11V17L21,19M17,11A5,5 0 0,0 12,6A5,5 0 0,0 7,11V18H17V11M19.75,3.19L18.33,4.61M1,11"
13
+ }, null, -1
14
+ /* HOISTED */
15
+ ));
16
+
17
+ var _hoisted_3 = [_hoisted_2];
18
+ export function render(_ctx, _cache) {
19
+ return _openBlock(), _createElementBlock("svg", _hoisted_1, _hoisted_3);
20
+ }
21
+ export default defineComponent({
22
+ render
23
+ });
@@ -0,0 +1,8 @@
1
+ import Result from './Result.js'
2
+
3
+ Result.install = function (app) {
4
+ app.component(Result.name, Result);
5
+ };
6
+
7
+ export var _ResultComponent = Result;
8
+ export default Result;
@@ -0,0 +1,24 @@
1
+ function typeValidator(type) {
2
+ return ['info', 'success', 'warning', 'error', 'question', 'empty'].includes(type);
3
+ }
4
+
5
+ export var props = {
6
+ imageSize: {
7
+ type: [String, Number]
8
+ },
9
+ type: {
10
+ type: String,
11
+ default: 'success',
12
+ validator: typeValidator
13
+ },
14
+ title: {
15
+ type: String
16
+ },
17
+ description: {
18
+ type: String
19
+ },
20
+ animation: {
21
+ type: Boolean,
22
+ default: true
23
+ }
24
+ };
@@ -0,0 +1 @@
1
+ :root { --result-background: #fff; --result-padding: 24px; --result-border-radius: 3px; --result-title-color: #444; --result-title-font-size: 32px; --result-title-margin: 15px 0 0 0; --result-image-size: 80px; --result-title-font-weight: 500; --result-description-margin: 10px 0 0 0; --result-description-font-size: 14px; --result-description-color: rgba(0, 0, 0, 0.6); --result-description-line-height: 1.6; --result-info-color: var(--color-info); --result-info-border-color: rgba(0, 175, 239, 0.3); --result-success-color: var(--color-success); --result-success-border-color: rgba(0, 196, 143, 0.3); --result-error-color: var(--color-danger); --result-error-border-color: rgba(244, 67, 54, 0.3); --result-warning-color: var(--color-warning); --result-warning-border-color: rgba(255, 159, 0, 0.3); --result-question-color: #607d8b; --result-question-border-color: rgba(96, 125, 139, 0.3); --result-empty-color: #9e9e9e; --result-empty-border-color: rgba(158, 158, 158, 0.3);}.var-result { display: flex; flex-direction: column; align-items: center; border-radius: var(--result-border-radius); width: 100%; padding: var(--result-padding); background-color: var(--result-background); transition: background-color 0.25s;}.var-result__image-container { overflow: hidden;}.var-result__image { margin: 0 auto; position: relative; border-radius: 50%; box-sizing: content-box; border-style: solid; border-color: transparent; width: var(--result-image-size); height: var(--result-image-size); display: flex; justify-content: center; align-items: center;}.var-result__image svg { margin: 0 auto; display: block; width: 100%; height: 100%;}.var-result__info { border-color: var(--result-info-border-color);}.var-result__info path { fill: var(--result-info-color);}.var-result__empty { border-color: var(--result-empty-border-color);}.var-result__empty path { fill: var(--result-empty-color);}.var-result__question { border-color: var(--result-question-border-color);}.var-result__question path { fill: var(--result-question-color);}.var-result__error { border-color: var(--result-error-border-color);}.var-result__error path { fill: var(--result-error-color);}.var-result__warning { border-color: var(--result-warning-border-color);}.var-result__warning path { fill: var(--result-warning-color);}.var-result__success { border-color: var(--result-success-color);}.var-result__success-cover-left { display: block; position: absolute; z-index: 1; top: -0.875%; left: -41.27%; width: 75%; height: 150%; border-radius: 150% 0 0 150%; transform: rotate(-45deg); background: var(--result-background); transition: background-color 0.25s;}.var-result__success-cover-right { display: block; position: absolute; top: -13.75%; left: 37.5%; width: 75%; height: 150%; border-radius: 0 125% 125% 0; animation-name: rotate-circle; animation-timing-function: ease-in; transform-origin: 0 50%; transform: rotate(-45deg); background: var(--result-background); transition: background-color 0.25s;}.var-result__success-line { height: 6.8%; background-color: var(--result-success-color); display: block; position: absolute; z-index: 10; transition: background-color 0.25s;}.var-result__success-line-tip { transform: rotate(45deg); animation-name: success-line-tip; animation-fill-mode: forwards;}.var-result__success-line-long { transform: rotate(-45deg); animation-name: success-line-long; animation-fill-mode: forwards;}.var-result__success-circle { z-index: 10; width: 100%; height: 100%; border-radius: 50%; position: absolute; box-sizing: content-box !important; border-style: solid; border-color: var(--result-success-border-color);}.var-result__success-line-fix { top: 10%; left: 32.5%; width: 8.75%; height: 112.5%; z-index: 1; position: absolute; transform: rotate(-45deg); background: var(--result-background); transition: background-color 0.25s;}@keyframes success-line-tip { 0% { top: 23.75%; left: 1.25%; width: 0; } 54% { top: 20.25%; left: 1%; width: 0; } 70% { top: 43.75%; left: -9.5%; width: 62.5%; } 84% { top: 60%; left: 26.25%; width: 21.25%; } 100% { top: 56.25%; left: 17.5%; width: 31.25%; }}@keyframes success-line-long { 0% { top: 67.5%; right: 57.5%; width: 0; } 65% { top: 67.5%; right: 57.5%; width: 0; } 84% { top: 43.75%; right: 0; width: 68.75%; } 100% { top: 47%; right: 9%; width: 58.75%; }}@keyframes rotate-circle { 0% { transform: rotate(-45deg); } 5% { transform: rotate(-45deg); } 12% { transform: rotate(-405deg); } 100% { transform: rotate(-405deg); }}.var-result__title { font-size: var(--result-title-font-size); word-break: break-word; margin: var(--result-title-margin); font-weight: var(--result-title-font-weight); color: var(--result-title-color); text-align: center;}.var-result__description { font-size: var(--result-description-font-size); word-break: break-word; color: var(--result-description-color); margin: var(--result-description-margin); line-height: var(--result-description-line-height); text-align: center;}.var-result__footer { z-index: 1; margin-top: 20px;}
@@ -0,0 +1,2 @@
1
+ import '../result.css'
2
+ import '../ResultSfc.css'