@varlet/ui 2.7.5 → 2.8.0-alpha.1676455225773

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 (62) hide show
  1. package/README.md +3 -1
  2. package/README.zh-CN.md +6 -4
  3. package/es/app-bar/AppBar.mjs +30 -6
  4. package/es/app-bar/appBar.css +1 -1
  5. package/es/app-bar/props.mjs +6 -0
  6. package/es/avatar/Avatar.mjs +148 -0
  7. package/es/avatar/AvatarSfc.css +0 -0
  8. package/es/avatar/avatar.css +1 -0
  9. package/es/avatar/index.mjs +9 -0
  10. package/es/avatar/props.mjs +53 -0
  11. package/es/avatar/style/index.mjs +3 -0
  12. package/es/avatar-group/AvatarGroup.mjs +46 -0
  13. package/es/avatar-group/AvatarGroupSfc.css +0 -0
  14. package/es/avatar-group/avatarGroup.css +1 -0
  15. package/es/avatar-group/index.mjs +9 -0
  16. package/es/avatar-group/props.mjs +9 -0
  17. package/es/avatar-group/style/index.mjs +3 -0
  18. package/es/badge/Badge.mjs +3 -2
  19. package/es/cell/Cell.mjs +59 -31
  20. package/es/cell/cell.css +1 -1
  21. package/es/cell/props.mjs +10 -1
  22. package/es/collapse/Collapse.mjs +2 -2
  23. package/es/ellipsis/Ellipsis.mjs +106 -0
  24. package/es/ellipsis/EllipsisSfc.css +0 -0
  25. package/es/ellipsis/ellipsis.css +1 -0
  26. package/es/ellipsis/index.mjs +8 -0
  27. package/es/ellipsis/props.mjs +16 -0
  28. package/es/ellipsis/style/index.mjs +4 -0
  29. package/es/index.bundle.mjs +25 -1
  30. package/es/index.mjs +21 -1
  31. package/es/paper/Paper.mjs +55 -0
  32. package/es/paper/PaperSfc.css +0 -0
  33. package/es/paper/index.mjs +9 -0
  34. package/es/paper/paper.css +1 -0
  35. package/es/paper/props.mjs +28 -0
  36. package/es/paper/style/index.mjs +4 -0
  37. package/es/ripple/index.mjs +2 -2
  38. package/es/snackbar/style/index.mjs +1 -1
  39. package/es/style.css +1 -1
  40. package/es/style.mjs +4 -0
  41. package/es/tabs/Tabs.mjs +5 -4
  42. package/es/themes/dark/avatar.mjs +4 -0
  43. package/es/themes/dark/index.mjs +2 -1
  44. package/es/tooltip/Tooltip.mjs +6 -1
  45. package/es/tooltip/props.mjs +4 -0
  46. package/es/tooltip/tooltip.css +1 -1
  47. package/es/varlet.esm.js +7878 -7400
  48. package/highlight/web-types.en-US.json +294 -2
  49. package/highlight/web-types.zh-CN.json +294 -2
  50. package/lib/style.css +1 -1
  51. package/lib/varlet.cjs.js +6012 -5455
  52. package/package.json +5 -5
  53. package/types/appBar.d.ts +2 -0
  54. package/types/avatar.d.ts +29 -0
  55. package/types/avatarGroup.d.ts +14 -0
  56. package/types/cell.d.ts +4 -1
  57. package/types/ellipsis.d.ts +23 -0
  58. package/types/index.d.ts +8 -0
  59. package/types/paper.d.ts +25 -0
  60. package/types/tooltip.d.ts +1 -0
  61. package/umd/style.css +1 -1
  62. package/umd/varlet.js +6 -6
package/README.md CHANGED
@@ -28,17 +28,19 @@ Varlet is a Material design mobile component library developed based on `Vue3`,
28
28
 
29
29
 
30
30
  ### Features
31
+
31
32
  - 🚀   Provide 50+ high quality general purpose components
32
33
  - 🚀   Components are very lightweight
33
34
  - 💪   Developed by Chinese, complete Chinese and English documentation and logistics support
34
35
  - 🛠️   Support on-demand introduction
35
36
  - 🛠️   Support theme customization
36
37
  - 🌍   Support internationalization
37
- - 💡   Support WebStorm, VS Code component syntax highlighting
38
+ - 💡   Support WebStorm syntax highlighting
38
39
  - 💪   Support the SSR
39
40
  - 💡   Support the Typescript
40
41
  - 💪   Make sure more than 90 percent unit test coverage, providing stability assurance
41
42
  - 🛠️   Support dark mode
43
+ - 🛠️   Provide official VSCode extension
42
44
 
43
45
  ### Install
44
46
 
package/README.zh-CN.md CHANGED
@@ -28,17 +28,19 @@
28
28
  Varlet 是一个基于 `Vue3` 开发的 Material 风格移动端组件库,全面拥抱 `Vue3` 生态,由 `varletjs` 社区团队进行维护。
29
29
 
30
30
  ### 特性
31
- - 🚀   提供50+个高质量通用组件
31
+
32
+ - 🚀   提供 50+ 个高质量通用组件
32
33
  - 🚀   组件十分轻量
33
34
  - 💪   由国人开发,完善的中英文文档和后勤保障
34
35
  - 🛠️   支持按需引入
35
36
  - 🛠️   支持主题定制
36
37
  - 🌍   支持国际化
37
- - 💡   支持 webstorm,vscode 组件属性高亮
38
+ - 💡   支持 webstorm 组件属性高亮
38
39
  - 💪   支持 SSR
39
- - 💡   支持 Typescript
40
- - 💪   确保90%以上单元测试覆盖率,提供稳定性保证
40
+ - 💡   支持 Typescript
41
+ - 💪   确保 90% 以上单元测试覆盖率,提供稳定性保证
41
42
  - 🛠️   支持暗黑模式
43
+ - 🛠️   提供官方的 VSCode 插件
42
44
 
43
45
  ### 安装
44
46
 
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, onMounted, onUpdated } from 'vue';
1
+ import { defineComponent, ref, onMounted, onUpdated, computed } from 'vue';
2
2
  import { props } from './props.mjs';
3
3
  import { createNamespace } from '../utils/components.mjs';
4
4
  var {
@@ -10,10 +10,9 @@ import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createT
10
10
  function __render__(_ctx, _cache) {
11
11
  return _openBlock(), _createElementBlock("div", {
12
12
  class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.round, _ctx.n('--round')], [_ctx.elevation, _ctx.n('$-elevation--3')])),
13
- style: _normalizeStyle({
14
- background: _ctx.color,
15
- color: _ctx.textColor
16
- })
13
+ style: _normalizeStyle(_ctx.rootStyles)
14
+ }, [_createElementVNode("div", {
15
+ class: _normalizeClass(_ctx.n('toolbar'))
17
16
  }, [_createElementVNode("div", {
18
17
  class: _normalizeClass(_ctx.n('left'))
19
18
  }, [_renderSlot(_ctx.$slots, "left"), _ctx.titlePosition === 'left' ? (_openBlock(), _createElementBlock("div", {
@@ -49,7 +48,9 @@ function __render__(_ctx, _cache) {
49
48
  /* CLASS, STYLE */
50
49
  )) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "right")], 2
51
50
  /* CLASS */
52
- )], 6
51
+ )], 2
52
+ /* CLASS */
53
+ ), _renderSlot(_ctx.$slots, "content")], 6
53
54
  /* CLASS, STYLE */
54
55
  );
55
56
  }
@@ -70,11 +71,34 @@ var __sfc__ = defineComponent({
70
71
  paddingRight.value = slots.right ? 0 : undefined;
71
72
  };
72
73
 
74
+ var rootStyles = computed(() => {
75
+ var {
76
+ image,
77
+ color,
78
+ textColor,
79
+ imageLinearGradient
80
+ } = props;
81
+
82
+ if (image != null) {
83
+ var gradient = imageLinearGradient ? "linear-gradient(" + imageLinearGradient + "), " : '';
84
+ return {
85
+ 'background-image': gradient + "url(" + image + ")",
86
+ 'background-position': 'center center',
87
+ 'background-size': 'cover'
88
+ };
89
+ }
90
+
91
+ return {
92
+ background: color,
93
+ color: textColor
94
+ };
95
+ });
73
96
  onMounted(computePadding);
74
97
  onUpdated(computePadding);
75
98
  return {
76
99
  n,
77
100
  classes,
101
+ rootStyles,
78
102
  paddingLeft,
79
103
  paddingRight
80
104
  };
@@ -1 +1 @@
1
- :root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-title-font-size: var(--font-size-lg); --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px; --app-bar-border-radius: 4px; --app-bar-font-size: var(--font-size-lg);}.var-app-bar { position: relative; display: flex; width: 100%; font-size: var(--app-bar-font-size); 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 { font-size: var(--app-bar-title-font-size); 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);}
1
+ :root { --app-bar-color: var(--color-primary); --app-bar-title-padding: 0 12px; --app-bar-title-font-size: var(--font-size-lg); --app-bar-text-color: #fff; --app-bar-height: 54px; --app-bar-left-gap: 6px; --app-bar-right-gap: 6px; --app-bar-border-radius: 4px; --app-bar-font-size: var(--font-size-lg);}.var-app-bar { position: relative; z-index: 0; width: 100%; font-size: var(--app-bar-font-size); background: var(--app-bar-color); color: var(--app-bar-text-color); transition: background-color 0.25s;}.var-app-bar__toolbar { position: relative; display: flex; justify-content: center; align-items: center; height: var(--app-bar-height);}.var-app-bar__title { font-size: var(--app-bar-title-font-size); 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);}
@@ -24,5 +24,11 @@ export var props = {
24
24
  round: {
25
25
  type: Boolean,
26
26
  default: false
27
+ },
28
+ image: {
29
+ type: String
30
+ },
31
+ imageLinearGradient: {
32
+ type: String
27
33
  }
28
34
  };
@@ -0,0 +1,148 @@
1
+ import { defineComponent, ref, onMounted, onUpdated } from 'vue';
2
+ import { props, internalSizeValidator, sizeValidator } from './props.mjs';
3
+ import { toSizeUnit } from '../utils/elements.mjs';
4
+ import { createNamespace, call } from '../utils/components.mjs';
5
+ var {
6
+ n,
7
+ classes
8
+ } = createNamespace('avatar');
9
+ import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, openBlock as _openBlock, createElementBlock as _createElementBlock, Fragment as _Fragment, renderSlot as _renderSlot, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
10
+
11
+ var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
12
+
13
+ var _hoisted_1 = ["src", "lazy-loading", "lazy-error"];
14
+ var _hoisted_2 = ["src"];
15
+
16
+ function __render__(_ctx, _cache) {
17
+ var _directive_lazy = _resolveDirective("lazy");
18
+
19
+ return _openBlock(), _createElementBlock("div", {
20
+ ref: "avatarElement",
21
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.internalSizeValidator(_ctx.size), _ctx.n("--" + _ctx.size)], [_ctx.round, _ctx.n('--round')], [_ctx.bordered, _ctx.n('--bordered')])),
22
+ style: _normalizeStyle({
23
+ width: !_ctx.internalSizeValidator(_ctx.size) ? _ctx.toSizeUnit(_ctx.size) : undefined,
24
+ height: !_ctx.internalSizeValidator(_ctx.size) ? _ctx.toSizeUnit(_ctx.size) : undefined,
25
+ borderColor: _ctx.borderColor,
26
+ backgroundColor: _ctx.color
27
+ }),
28
+ onClick: _cache[3] || (_cache[3] = function () {
29
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
30
+ })
31
+ }, [_ctx.src ? (_openBlock(), _createElementBlock(_Fragment, {
32
+ key: 0
33
+ }, [_ctx.lazy ? _withDirectives((_openBlock(), _createElementBlock("img", {
34
+ key: 0,
35
+ class: _normalizeClass(_ctx.n('image')),
36
+ src: _ctx.src,
37
+ style: _normalizeStyle({
38
+ objectFit: _ctx.fit
39
+ }),
40
+ "lazy-loading": _ctx.loading,
41
+ "lazy-error": _ctx.error,
42
+ onLoad: _cache[0] || (_cache[0] = function () {
43
+ return _ctx.handleLoad && _ctx.handleLoad(...arguments);
44
+ })
45
+ }, null, 46
46
+ /* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
47
+ , _hoisted_1)), [[_directive_lazy, _ctx.src]]) : (_openBlock(), _createElementBlock("img", {
48
+ key: 1,
49
+ class: _normalizeClass(_ctx.n('image')),
50
+ src: _ctx.src,
51
+ style: _normalizeStyle({
52
+ objectFit: _ctx.fit
53
+ }),
54
+ onLoad: _cache[1] || (_cache[1] = function () {
55
+ return _ctx.handleLoad && _ctx.handleLoad(...arguments);
56
+ }),
57
+ onError: _cache[2] || (_cache[2] = function () {
58
+ return _ctx.handleError && _ctx.handleError(...arguments);
59
+ })
60
+ }, null, 46
61
+ /* CLASS, STYLE, PROPS, HYDRATE_EVENTS */
62
+ , _hoisted_2))], 2112
63
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
64
+ )) : (_openBlock(), _createElementBlock("div", {
65
+ key: 1,
66
+ ref: "textElement",
67
+ class: _normalizeClass(_ctx.n('text')),
68
+ style: _normalizeStyle({
69
+ scale: _ctx.scale
70
+ })
71
+ }, [_renderSlot(_ctx.$slots, "default")], 6
72
+ /* CLASS, STYLE */
73
+ ))], 6
74
+ /* CLASS, STYLE */
75
+ );
76
+ }
77
+
78
+ var __sfc__ = defineComponent({
79
+ name: 'VarAvatar',
80
+ components: {},
81
+ props,
82
+
83
+ setup(props) {
84
+ var avatarElement = ref(null);
85
+ var textElement = ref(null);
86
+ var scale = ref(1);
87
+
88
+ var getScale = () => {
89
+ if (!avatarElement.value || !textElement.value) {
90
+ scale.value = 1;
91
+ return;
92
+ }
93
+
94
+ var avatarElementWidth = avatarElement.value.offsetWidth;
95
+ var textElementWidth = textElement.value.offsetWidth;
96
+
97
+ if (avatarElementWidth > textElementWidth) {
98
+ scale.value = 1;
99
+ } else {
100
+ scale.value = avatarElementWidth / textElementWidth;
101
+ }
102
+ };
103
+
104
+ var handleLoad = e => {
105
+ var el = e.currentTarget;
106
+ var {
107
+ lazy,
108
+ onLoad,
109
+ onError
110
+ } = props;
111
+
112
+ if (lazy) {
113
+ el._lazy.state === 'success' && call(onLoad, e);
114
+ el._lazy.state === 'error' && call(onError, e);
115
+ } else {
116
+ call(onLoad, e);
117
+ }
118
+ };
119
+
120
+ var handleError = e => {
121
+ call(props.onError, e);
122
+ };
123
+
124
+ var handleClick = e => {
125
+ call(props.onClick, e);
126
+ };
127
+
128
+ onMounted(getScale);
129
+ onUpdated(getScale);
130
+ return {
131
+ internalSizeValidator,
132
+ sizeValidator,
133
+ toSizeUnit,
134
+ n,
135
+ classes,
136
+ avatarElement,
137
+ textElement,
138
+ scale,
139
+ handleLoad,
140
+ handleError,
141
+ handleClick
142
+ };
143
+ }
144
+
145
+ });
146
+
147
+ __sfc__.render = __render__;
148
+ export default __sfc__;
File without changes
@@ -0,0 +1 @@
1
+ :root { --avatar-text-color: #f5f5f5; --avatar-border-radius: 4px; --avatar-mini-size: 28px; --avatar-small-size: 36px; --avatar-normal-size: 48px; --avatar-large-size: 64px; --avatar-border: 2px solid #fff; --avatar-background-color: #bebebe;}.var-avatar { display: inline-flex; overflow: hidden; align-items: center; justify-content: center; color: var(--avatar-text-color); border-radius: var(--avatar-border-radius); background-color: var(--avatar-background-color); transition: background-color 0.25s;}.var-avatar img { width: 100%; height: 100%;}.var-avatar--mini { width: var(--avatar-mini-size); height: var(--avatar-mini-size);}.var-avatar--small { width: var(--avatar-small-size); height: var(--avatar-small-size);}.var-avatar--normal { width: var(--avatar-normal-size); height: var(--avatar-normal-size);}.var-avatar--large { width: var(--avatar-large-size); height: var(--avatar-large-size);}.var-avatar--round { border-radius: 50%;}.var-avatar--bordered { border: var(--avatar-border);}.var-avatar__text { padding: 0 4px; white-space: nowrap;}
@@ -0,0 +1,9 @@
1
+ import Avatar from './Avatar.mjs';
2
+
3
+ Avatar.install = function (app) {
4
+ app.component(Avatar.name, Avatar);
5
+ };
6
+
7
+ export { props as avatarProps } from './props.mjs';
8
+ export var _AvatarComponent = Avatar;
9
+ export default Avatar;
@@ -0,0 +1,53 @@
1
+ import { defineListenerProp } from '../utils/components.mjs';
2
+ import { isNumber, isString } from '@varlet/shared';
3
+
4
+ function fitValidator(fit) {
5
+ return ['fill', 'contain', 'cover', 'none', 'scale-down'].includes(fit);
6
+ }
7
+
8
+ export var internalSizeValidator = size => ['mini', 'small', 'normal', 'large'].includes(size);
9
+ export function sizeValidator(size) {
10
+ return internalSizeValidator(size) || isNumber(size) || isString(size);
11
+ }
12
+ export var props = {
13
+ round: {
14
+ type: Boolean,
15
+ default: true
16
+ },
17
+ size: {
18
+ type: [String, Number],
19
+ validator: sizeValidator,
20
+ default: 'normal'
21
+ },
22
+ color: {
23
+ type: String
24
+ },
25
+ src: {
26
+ type: String
27
+ },
28
+ fit: {
29
+ type: String,
30
+ validator: fitValidator,
31
+ default: 'cover'
32
+ },
33
+ bordered: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ borderColor: {
38
+ type: String
39
+ },
40
+ loading: {
41
+ type: String
42
+ },
43
+ error: {
44
+ type: String
45
+ },
46
+ lazy: {
47
+ type: Boolean,
48
+ default: false
49
+ },
50
+ onClick: defineListenerProp(),
51
+ onLoad: defineListenerProp(),
52
+ onError: defineListenerProp()
53
+ };
@@ -0,0 +1,3 @@
1
+ import '../../styles/common.css'
2
+ import '../avatar.css'
3
+ import '../AvatarSfc.css'
@@ -0,0 +1,46 @@
1
+ import { defineComponent, computed } from 'vue';
2
+ import { props } from './props.mjs';
3
+ import { createNamespace } from '../utils/components.mjs';
4
+ import { toSizeUnit } from '../utils/elements.mjs';
5
+ var {
6
+ n,
7
+ classes
8
+ } = createNamespace('avatar-group');
9
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
10
+
11
+ function __render__(_ctx, _cache) {
12
+ return _openBlock(), _createElementBlock("div", {
13
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.vertical, _ctx.n('--column'), _ctx.n('--row')])),
14
+ style: _normalizeStyle(_ctx.rootStyles)
15
+ }, [_renderSlot(_ctx.$slots, "default"), _renderSlot(_ctx.$slots, "rest")], 6
16
+ /* CLASS, STYLE */
17
+ );
18
+ }
19
+
20
+ var __sfc__ = defineComponent({
21
+ name: 'VarAvatarGroup',
22
+ components: {},
23
+ props,
24
+
25
+ setup(props) {
26
+ var rootStyles = computed(() => {
27
+ if (props.offset == null) {
28
+ return {};
29
+ }
30
+
31
+ return {
32
+ '--avatar-group-offset': toSizeUnit(props.offset)
33
+ };
34
+ });
35
+ return {
36
+ n,
37
+ classes,
38
+ toSizeUnit,
39
+ rootStyles
40
+ };
41
+ }
42
+
43
+ });
44
+
45
+ __sfc__.render = __render__;
46
+ export default __sfc__;
File without changes
@@ -0,0 +1 @@
1
+ :root { --avatar-group-offset: -10px;}.var-avatar-group { display: flex; flex-wrap: wrap;}.var-avatar-group--row { margin-left: calc(var(--avatar-group-offset) * -1);}.var-avatar-group--row > * { margin-left: var(--avatar-group-offset);}.var-avatar-group--column { flex-direction: column; margin-top: calc(var(--avatar-group-offset) * -1);}.var-avatar-group--column > * { margin-top: var(--avatar-group-offset);}
@@ -0,0 +1,9 @@
1
+ import AvatarGroup from './AvatarGroup.mjs';
2
+
3
+ AvatarGroup.install = function (app) {
4
+ app.component(AvatarGroup.name, AvatarGroup);
5
+ };
6
+
7
+ export { props as avatarGroupProps } from './props.mjs';
8
+ export var _AvatarGroupComponent = AvatarGroup;
9
+ export default AvatarGroup;
@@ -0,0 +1,9 @@
1
+ export var props = {
2
+ offset: {
3
+ type: [Number, String]
4
+ },
5
+ vertical: {
6
+ type: Boolean,
7
+ default: false
8
+ }
9
+ };
@@ -0,0 +1,3 @@
1
+ import '../../styles/common.css'
2
+ import '../avatarGroup.css'
3
+ import '../AvatarGroupSfc.css'
@@ -90,8 +90,9 @@ var __sfc__ = defineComponent({
90
90
  position,
91
91
  dot
92
92
  } = props;
93
- if (dot && position.includes('right')) return n('dot--right');
94
- if (dot && position.includes('left')) return n('dot--left');
93
+ if (!dot) return;
94
+ if (position.includes('right')) return n('dot--right');
95
+ if (position.includes('left')) return n('dot--left');
95
96
  };
96
97
 
97
98
  return {
package/es/cell/Cell.mjs CHANGED
@@ -1,52 +1,59 @@
1
- import { defineComponent } from 'vue';
2
- import { props } from './props.mjs';
3
1
  import VarIcon from '../icon/index.mjs';
4
- import { createNamespace } from '../utils/components.mjs';
2
+ import Ripple from '../ripple/index.mjs';
3
+ import { computed, defineComponent } from 'vue';
4
+ import { props } from './props.mjs';
5
+ import { call, createNamespace } from '../utils/components.mjs';
6
+ import { toSizeUnit } from '../utils/elements.mjs';
5
7
  var {
6
8
  n,
7
9
  classes
8
10
  } = createNamespace('cell');
9
- import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, createElementVNode as _createElementVNode } from "vue";
11
+ import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives } from "vue";
10
12
 
11
13
  function __render__(_ctx, _cache) {
12
14
  var _component_var_icon = _resolveComponent("var-icon");
13
15
 
14
- return _openBlock(), _createElementBlock("div", {
15
- class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.border, _ctx.n('--border')]))
16
- }, [_ctx.$slots.icon || _ctx.icon ? (_openBlock(), _createElementBlock("div", {
16
+ var _directive_ripple = _resolveDirective("ripple");
17
+
18
+ return _withDirectives((_openBlock(), _createElementBlock("div", {
19
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.border, _ctx.n('--border')], [_ctx.onClick, _ctx.n('--cursor')])),
20
+ style: _normalizeStyle(_ctx.borderOffsetStyles),
21
+ onClick: _cache[0] || (_cache[0] = function () {
22
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
23
+ })
24
+ }, [_renderSlot(_ctx.$slots, "icon", {}, () => [_ctx.icon ? (_openBlock(), _createElementBlock("div", {
17
25
  key: 0,
18
- class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.iconClass, _ctx.iconClass]))
19
- }, [_renderSlot(_ctx.$slots, "icon", {}, () => [_createVNode(_component_var_icon, {
26
+ class: _normalizeClass(_ctx.classes(_ctx.n('icon'), _ctx.iconClass))
27
+ }, [_createVNode(_component_var_icon, {
20
28
  name: _ctx.icon
21
29
  }, null, 8
22
30
  /* PROPS */
23
- , ["name"])])], 2
31
+ , ["name"])], 2
24
32
  /* CLASS */
25
- )) : _createCommentVNode("v-if", true), _createElementVNode("div", {
33
+ )) : _createCommentVNode("v-if", true)]), _createElementVNode("div", {
26
34
  class: _normalizeClass(_ctx.n('content'))
27
- }, [_createElementVNode("div", {
28
- class: _normalizeClass(_ctx.classes(_ctx.n('title'), [_ctx.titleClass, _ctx.titleClass]))
29
- }, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.title), 1
30
- /* TEXT */
31
- )])], 2
32
- /* CLASS */
33
- ), _ctx.$slots.description || _ctx.description ? (_openBlock(), _createElementBlock("div", {
35
+ }, [_renderSlot(_ctx.$slots, "default", {}, () => [_ctx.title ? (_openBlock(), _createElementBlock("div", {
34
36
  key: 0,
35
- class: _normalizeClass(_ctx.classes(_ctx.n('description'), [_ctx.descriptionClass, _ctx.descriptionClass]))
36
- }, [_renderSlot(_ctx.$slots, "description", {}, () => [_createTextVNode(_toDisplayString(_ctx.description), 1
37
- /* TEXT */
38
- )])], 2
39
- /* CLASS */
40
- )) : _createCommentVNode("v-if", true)], 2
37
+ class: _normalizeClass(_ctx.classes(_ctx.n('title'), _ctx.titleClass))
38
+ }, _toDisplayString(_ctx.title), 3
39
+ /* TEXT, CLASS */
40
+ )) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "description", {}, () => [_ctx.description ? (_openBlock(), _createElementBlock("div", {
41
+ key: 0,
42
+ class: _normalizeClass(_ctx.classes(_ctx.n('description'), _ctx.descriptionClass))
43
+ }, _toDisplayString(_ctx.description), 3
44
+ /* TEXT, CLASS */
45
+ )) : _createCommentVNode("v-if", true)])], 2
41
46
  /* CLASS */
42
47
  ), _ctx.$slots.extra ? (_openBlock(), _createElementBlock("div", {
43
- key: 1,
44
- class: _normalizeClass(_ctx.classes(_ctx.n('extra'), [_ctx.extraClass, _ctx.extraClass]))
48
+ key: 0,
49
+ class: _normalizeClass(_ctx.classes(_ctx.n('extra'), _ctx.extraClass))
45
50
  }, [_renderSlot(_ctx.$slots, "extra")], 2
46
51
  /* CLASS */
47
- )) : _createCommentVNode("v-if", true)], 2
48
- /* CLASS */
49
- );
52
+ )) : _createCommentVNode("v-if", true)], 6
53
+ /* CLASS, STYLE */
54
+ )), [[_directive_ripple, {
55
+ disabled: !_ctx.ripple
56
+ }]]);
50
57
  }
51
58
 
52
59
  var __sfc__ = defineComponent({
@@ -54,12 +61,33 @@ var __sfc__ = defineComponent({
54
61
  components: {
55
62
  VarIcon
56
63
  },
64
+ directives: {
65
+ Ripple
66
+ },
57
67
  props,
58
68
 
59
- setup() {
69
+ setup(props) {
70
+ var borderOffsetStyles = computed(() => {
71
+ if (props.borderOffset == null) {
72
+ return {};
73
+ }
74
+
75
+ return {
76
+ '--cell-border-left': toSizeUnit(props.borderOffset),
77
+ '--cell-border-right': toSizeUnit(props.borderOffset)
78
+ };
79
+ });
80
+
81
+ var handleClick = e => {
82
+ call(props.onClick, e);
83
+ };
84
+
60
85
  return {
61
86
  n,
62
- classes
87
+ classes,
88
+ toSizeUnit,
89
+ borderOffsetStyles,
90
+ handleClick
63
91
  };
64
92
  }
65
93
 
package/es/cell/cell.css CHANGED
@@ -1 +1 @@
1
- :root { --cell-color: var(--color-text); --cell-font-size: var(--font-size-md); --cell-description-font-size: var(--font-size-sm); --cell-description-color: rgba(0, 0, 0, 0.6); --cell-padding: 10px 12px; --cell-min-height: 40px; --cell-border-color: #bcc2cb; --cell-border-left: 12px; --cell-border-right: 12px; --cell-icon-right: 8px; --cell-extra-left: 8px;}.var-cell { align-items: center; display: flex; min-height: var(--cell-min-height); outline: none; width: 100%; padding: var(--cell-padding); position: relative; box-sizing: border-box; font-size: var(--cell-font-size); color: var(--cell-color);}.var-cell--border::after { position: absolute; box-sizing: border-box; content: ' '; pointer-events: none; right: var(--cell-border-right); bottom: 0; left: var(--cell-border-left); border-bottom: 1px solid var(--cell-border-color); transform: scaleY(0.5);}.var-cell__icon { margin-right: var(--cell-icon-right); flex: 0;}.var-cell__content { flex: 1; overflow: hidden;}.var-cell__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.var-cell__description { font-size: var(--cell-description-font-size); color: var(--cell-description-color);}.var-cell__extra { flex: 0; margin-left: var(--cell-extra-left);}
1
+ :root { --cell-color: var(--color-text); --cell-font-size: var(--font-size-md); --cell-description-font-size: var(--font-size-sm); --cell-description-color: rgba(0, 0, 0, 0.6); --cell-description-margin-top: 4px; --cell-padding: 10px 12px; --cell-min-height: 40px; --cell-border-color: #bcc2cb; --cell-border-left: 12px; --cell-border-right: 12px; --cell-icon-right: 8px; --cell-extra-left: 8px;}.var-cell { align-items: center; display: flex; min-height: var(--cell-min-height); outline: none; width: 100%; padding: var(--cell-padding); position: relative; box-sizing: border-box; font-size: var(--cell-font-size); color: var(--cell-color);}.var-cell--border::after { position: absolute; box-sizing: border-box; content: ' '; pointer-events: none; bottom: 0; right: var(--cell-border-right); left: var(--cell-border-left); border-bottom: 1px solid var(--cell-border-color); transform: scaleY(0.5);}.var-cell__icon { margin-right: var(--cell-icon-right); flex: 0;}.var-cell__content { flex: 1; overflow: hidden;}.var-cell__title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}.var-cell__description { font-size: var(--cell-description-font-size); color: var(--cell-description-color); margin-top: var(--cell-description-margin-top);}.var-cell__extra { flex: 0; margin-left: var(--cell-extra-left);}.var-cell--cursor { cursor: pointer;}
package/es/cell/props.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components.mjs';
1
2
  export var props = {
2
3
  title: {
3
4
  type: [Number, String]
@@ -12,6 +13,9 @@ export var props = {
12
13
  type: Boolean,
13
14
  default: false
14
15
  },
16
+ borderOffset: {
17
+ type: [Number, String]
18
+ },
15
19
  iconClass: {
16
20
  type: String
17
21
  },
@@ -23,5 +27,10 @@ export var props = {
23
27
  },
24
28
  extraClass: {
25
29
  type: String
26
- }
30
+ },
31
+ ripple: {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ onClick: defineListenerProp
27
36
  };
@@ -82,7 +82,7 @@ var __sfc__ = defineComponent({
82
82
  index,
83
83
  name
84
84
  } = _ref3;
85
- return name.value === undefined ? props.modelValue === index.value : false;
85
+ return name.value === undefined && props.modelValue === index.value;
86
86
  });
87
87
  }
88
88
 
@@ -91,7 +91,7 @@ var __sfc__ = defineComponent({
91
91
  index,
92
92
  name
93
93
  } = _ref4;
94
- return name.value === undefined ? props.modelValue.includes(index.value) : false;
94
+ return name.value === undefined && props.modelValue.includes(index.value);
95
95
  });
96
96
  };
97
97