@varlet/ui 1.26.9 → 1.27.0-alpha.1649265140569

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 (247) hide show
  1. package/README.en-US.md +1 -1
  2. package/README.md +1 -1
  3. package/es/action-sheet/ActionSheet.js +29 -27
  4. package/es/app-bar/AppBar.js +32 -27
  5. package/es/back-top/BackTop.js +9 -2
  6. package/es/badge/Badge.js +22 -14
  7. package/es/bottom-navigation/BottomNavigation.js +204 -0
  8. package/es/bottom-navigation/BottomNavigationSfc.css +0 -0
  9. package/es/bottom-navigation/BottomNavigationSfc.less +0 -0
  10. package/es/bottom-navigation/bottomNavigation.css +1 -0
  11. package/es/bottom-navigation/bottomNavigation.less +51 -0
  12. package/es/bottom-navigation/index.js +8 -0
  13. package/es/bottom-navigation/props.js +40 -0
  14. package/es/bottom-navigation/provide.js +17 -0
  15. package/es/bottom-navigation/style/index.js +4 -0
  16. package/es/bottom-navigation/style/less.js +4 -0
  17. package/es/bottom-navigation-item/BottomNavigationItem.js +122 -0
  18. package/es/bottom-navigation-item/BottomNavigationItemSfc.css +0 -0
  19. package/es/bottom-navigation-item/BottomNavigationItemSfc.less +0 -0
  20. package/es/bottom-navigation-item/bottomNavigationItem.css +1 -0
  21. package/es/bottom-navigation-item/bottomNavigationItem.less +78 -0
  22. package/es/bottom-navigation-item/index.js +8 -0
  23. package/es/bottom-navigation-item/props.js +22 -0
  24. package/es/bottom-navigation-item/provide.js +21 -0
  25. package/es/bottom-navigation-item/style/index.js +6 -0
  26. package/es/bottom-navigation-item/style/less.js +6 -0
  27. package/es/button/Button.js +12 -5
  28. package/es/card/Card.js +33 -28
  29. package/es/cell/Cell.js +26 -15
  30. package/es/checkbox/Checkbox.js +28 -26
  31. package/es/checkbox-group/CheckboxGroup.js +21 -25
  32. package/es/chip/Chip.js +16 -7
  33. package/es/chip/chip.css +1 -1
  34. package/es/chip/chip.less +11 -11
  35. package/es/col/Col.js +12 -5
  36. package/es/collapse/Collapse.js +15 -12
  37. package/es/collapse-item/CollapseItem.js +31 -30
  38. package/es/collapse-item/collapseItem.css +1 -1
  39. package/es/collapse-item/collapseItem.less +16 -16
  40. package/es/countdown/Countdown.js +14 -11
  41. package/es/counter/Counter.js +30 -27
  42. package/es/date-picker/DatePicker.js +28 -23
  43. package/es/date-picker/date-picker.css +1 -1
  44. package/es/date-picker/date-picker.less +22 -20
  45. package/es/date-picker/src/day-picker-panel.js +41 -34
  46. package/es/date-picker/src/month-picker-panel.js +27 -21
  47. package/es/date-picker/src/panel-header.js +16 -11
  48. package/es/date-picker/src/year-picker-panel.js +17 -9
  49. package/es/dialog/Dialog.js +36 -40
  50. package/es/divider/Divider.js +16 -12
  51. package/es/form/Form.js +11 -8
  52. package/es/form-details/FormDetails.js +27 -22
  53. package/es/icon/Icon.js +8 -1
  54. package/es/image/Image.js +19 -12
  55. package/es/image-preview/ImagePreview.js +35 -34
  56. package/es/index-anchor/IndexAnchor.js +8 -1
  57. package/es/index-bar/IndexBar.js +22 -20
  58. package/es/index.js +10 -0
  59. package/es/input/Input.js +45 -44
  60. package/es/lazy/index.js +2 -1
  61. package/es/less.js +2 -0
  62. package/es/list/List.js +39 -38
  63. package/es/loading/Loading.js +31 -23
  64. package/es/loading/loading.css +1 -1
  65. package/es/loading/loading.less +32 -32
  66. package/es/menu/Menu.js +12 -10
  67. package/es/option/Option.js +16 -11
  68. package/es/pagination/Pagination.js +34 -44
  69. package/es/pagination/pagination.css +1 -1
  70. package/es/pagination/pagination.less +8 -8
  71. package/es/picker/Picker.js +51 -47
  72. package/es/popup/Popup.js +9 -5
  73. package/es/progress/Progress.js +44 -35
  74. package/es/progress/progress.css +1 -1
  75. package/es/progress/progress.less +12 -12
  76. package/es/pull-refresh/PullRefresh.js +13 -10
  77. package/es/radio/Radio.js +25 -25
  78. package/es/radio-group/RadioGroup.js +19 -19
  79. package/es/rate/Rate.js +27 -25
  80. package/es/ripple/index.js +6 -2
  81. package/es/row/Row.js +11 -4
  82. package/es/select/Select.js +53 -54
  83. package/es/skeleton/Skeleton.js +70 -81
  84. package/es/slider/Slider.js +44 -40
  85. package/es/slider/slider.css +1 -1
  86. package/es/slider/slider.less +5 -5
  87. package/es/snackbar/Snackbar.js +9 -5
  88. package/es/snackbar/core.js +20 -26
  89. package/es/snackbar/snackbar.css +1 -1
  90. package/es/snackbar/snackbar.less +66 -68
  91. package/es/snackbar/style/index.js +1 -1
  92. package/es/snackbar/style/less.js +1 -1
  93. package/es/space/Space.js +8 -3
  94. package/es/step/Step.js +25 -23
  95. package/es/step/step.css +1 -1
  96. package/es/step/step.less +10 -10
  97. package/es/steps/Steps.js +12 -5
  98. package/es/sticky/Sticky.js +14 -7
  99. package/es/style-provider/StyleProvider.js +6 -2
  100. package/es/style.css +1 -1
  101. package/es/style.js +2 -0
  102. package/es/swipe/Swipe.js +22 -16
  103. package/es/swipe-item/SwipeItem.js +9 -4
  104. package/es/switch/Switch.js +25 -23
  105. package/es/switch/switch.css +1 -1
  106. package/es/switch/switch.less +2 -2
  107. package/es/tab/Tab.js +8 -1
  108. package/es/tab-item/TabItem.js +8 -1
  109. package/es/table/Table.js +27 -20
  110. package/es/tabs/Tabs.js +23 -14
  111. package/es/tabs-items/TabsItems.js +10 -5
  112. package/es/themes/dark/bottomNavigation.js +4 -0
  113. package/es/themes/dark/bottomNavigationItem.js +3 -0
  114. package/es/themes/dark/index.js +3 -1
  115. package/es/time-picker/TimePicker.js +47 -38
  116. package/es/time-picker/clock.js +26 -22
  117. package/es/time-picker/timePicker.css +1 -1
  118. package/es/time-picker/timePicker.less +11 -11
  119. package/es/umdIndex.js +10 -0
  120. package/es/uploader/Uploader.js +62 -57
  121. package/es/utils/components.js +35 -0
  122. package/es/varlet.esm.js +2093 -1504
  123. package/highlight/attributes.json +48 -0
  124. package/highlight/tags.json +20 -0
  125. package/highlight/web-types.json +155 -1
  126. package/lib/action-sheet/ActionSheet.js +30 -26
  127. package/lib/app-bar/AppBar.js +31 -24
  128. package/lib/back-top/BackTop.js +11 -2
  129. package/lib/badge/Badge.js +23 -13
  130. package/lib/bottom-navigation/BottomNavigation.js +221 -0
  131. package/lib/bottom-navigation/BottomNavigationSfc.css +0 -0
  132. package/lib/bottom-navigation/BottomNavigationSfc.less +0 -0
  133. package/lib/bottom-navigation/bottomNavigation.css +1 -0
  134. package/lib/bottom-navigation/bottomNavigation.less +51 -0
  135. package/lib/bottom-navigation/index.js +17 -0
  136. package/lib/bottom-navigation/props.js +45 -0
  137. package/lib/bottom-navigation/provide.js +27 -0
  138. package/lib/bottom-navigation/style/index.js +4 -0
  139. package/lib/bottom-navigation/style/less.js +4 -0
  140. package/lib/bottom-navigation-item/BottomNavigationItem.js +140 -0
  141. package/lib/bottom-navigation-item/BottomNavigationItemSfc.css +0 -0
  142. package/lib/bottom-navigation-item/BottomNavigationItemSfc.less +0 -0
  143. package/lib/bottom-navigation-item/bottomNavigationItem.css +1 -0
  144. package/lib/bottom-navigation-item/bottomNavigationItem.less +78 -0
  145. package/lib/bottom-navigation-item/index.js +17 -0
  146. package/lib/bottom-navigation-item/props.js +27 -0
  147. package/lib/bottom-navigation-item/provide.js +28 -0
  148. package/lib/bottom-navigation-item/style/index.js +6 -0
  149. package/lib/bottom-navigation-item/style/less.js +6 -0
  150. package/lib/button/Button.js +13 -4
  151. package/lib/card/Card.js +34 -27
  152. package/lib/cell/Cell.js +26 -13
  153. package/lib/checkbox/Checkbox.js +26 -23
  154. package/lib/checkbox-group/CheckboxGroup.js +19 -22
  155. package/lib/chip/Chip.js +18 -7
  156. package/lib/chip/chip.css +1 -1
  157. package/lib/chip/chip.less +11 -11
  158. package/lib/col/Col.js +14 -5
  159. package/lib/collapse/Collapse.js +15 -10
  160. package/lib/collapse-item/CollapseItem.js +31 -28
  161. package/lib/collapse-item/collapseItem.css +1 -1
  162. package/lib/collapse-item/collapseItem.less +16 -16
  163. package/lib/countdown/Countdown.js +14 -10
  164. package/lib/counter/Counter.js +29 -26
  165. package/lib/date-picker/DatePicker.js +30 -23
  166. package/lib/date-picker/date-picker.css +1 -1
  167. package/lib/date-picker/date-picker.less +22 -20
  168. package/lib/date-picker/src/day-picker-panel.js +41 -32
  169. package/lib/date-picker/src/month-picker-panel.js +27 -19
  170. package/lib/date-picker/src/panel-header.js +16 -9
  171. package/lib/date-picker/src/year-picker-panel.js +19 -9
  172. package/lib/dialog/Dialog.js +36 -38
  173. package/lib/divider/Divider.js +16 -10
  174. package/lib/form/Form.js +11 -6
  175. package/lib/form-details/FormDetails.js +27 -20
  176. package/lib/icon/Icon.js +10 -1
  177. package/lib/image/Image.js +20 -11
  178. package/lib/image-preview/ImagePreview.js +35 -33
  179. package/lib/index-anchor/IndexAnchor.js +10 -1
  180. package/lib/index-bar/IndexBar.js +24 -20
  181. package/lib/index.js +6 -0
  182. package/lib/input/Input.js +45 -43
  183. package/lib/lazy/index.js +3 -1
  184. package/lib/less.js +2 -0
  185. package/lib/list/List.js +39 -36
  186. package/lib/loading/Loading.js +33 -23
  187. package/lib/loading/loading.css +1 -1
  188. package/lib/loading/loading.less +32 -32
  189. package/lib/menu/Menu.js +12 -9
  190. package/lib/option/Option.js +16 -9
  191. package/lib/pagination/Pagination.js +36 -44
  192. package/lib/pagination/pagination.css +1 -1
  193. package/lib/pagination/pagination.less +8 -8
  194. package/lib/picker/Picker.js +51 -46
  195. package/lib/popup/Popup.js +9 -4
  196. package/lib/progress/Progress.js +45 -34
  197. package/lib/progress/progress.css +1 -1
  198. package/lib/progress/progress.less +12 -12
  199. package/lib/pull-refresh/PullRefresh.js +14 -10
  200. package/lib/radio/Radio.js +23 -22
  201. package/lib/radio-group/RadioGroup.js +17 -16
  202. package/lib/rate/Rate.js +27 -24
  203. package/lib/ripple/index.js +7 -2
  204. package/lib/row/Row.js +12 -3
  205. package/lib/select/Select.js +53 -53
  206. package/lib/skeleton/Skeleton.js +69 -78
  207. package/lib/slider/Slider.js +42 -38
  208. package/lib/slider/slider.css +1 -1
  209. package/lib/slider/slider.less +5 -5
  210. package/lib/snackbar/Snackbar.js +9 -4
  211. package/lib/snackbar/core.js +20 -25
  212. package/lib/snackbar/snackbar.css +1 -1
  213. package/lib/snackbar/snackbar.less +66 -68
  214. package/lib/space/Space.js +9 -3
  215. package/lib/step/Step.js +26 -22
  216. package/lib/step/step.css +1 -1
  217. package/lib/step/step.less +10 -10
  218. package/lib/steps/Steps.js +13 -4
  219. package/lib/sticky/Sticky.js +15 -6
  220. package/lib/style-provider/StyleProvider.js +8 -2
  221. package/lib/style.css +1 -1
  222. package/lib/style.js +2 -0
  223. package/lib/swipe/Swipe.js +23 -16
  224. package/lib/swipe-item/SwipeItem.js +10 -3
  225. package/lib/switch/Switch.js +23 -20
  226. package/lib/switch/switch.css +1 -1
  227. package/lib/switch/switch.less +2 -2
  228. package/lib/tab/Tab.js +10 -1
  229. package/lib/tab-item/TabItem.js +10 -1
  230. package/lib/table/Table.js +27 -18
  231. package/lib/tabs/Tabs.js +25 -14
  232. package/lib/tabs-items/TabsItems.js +11 -4
  233. package/lib/themes/dark/bottomNavigation.js +9 -0
  234. package/lib/themes/dark/bottomNavigationItem.js +8 -0
  235. package/lib/themes/dark/index.js +5 -1
  236. package/lib/time-picker/TimePicker.js +49 -38
  237. package/lib/time-picker/clock.js +26 -20
  238. package/lib/time-picker/timePicker.css +1 -1
  239. package/lib/time-picker/timePicker.less +11 -11
  240. package/lib/uploader/Uploader.js +60 -55
  241. package/lib/utils/components.js +39 -0
  242. package/package.json +5 -5
  243. package/types/bottomNavigation.d.ts +19 -0
  244. package/types/bottomNavigationItem.d.ts +16 -0
  245. package/types/global.d.ts +2 -0
  246. package/types/index.d.ts +2 -0
  247. package/umd/varlet.js +4 -4
package/README.en-US.md CHANGED
@@ -26,7 +26,7 @@ Varlet is a Material design mobile component library developed based on `Vue3`,
26
26
 
27
27
 
28
28
  ### Features
29
- - 🚀 Provide 50 high quality general purpose components
29
+ - 🚀 Provide 50+ high quality general purpose components
30
30
  - 🚀 Components are very lightweight
31
31
  - 💪 Developed by Chinese, complete Chinese and English documentation and logistics support
32
32
  - 🛠️ Support on-demand introduction
package/README.md CHANGED
@@ -25,7 +25,7 @@
25
25
  Varlet 是一个基于 `Vue3` 开发的 Material 风格移动端组件库,全面拥抱 `Vue3` 生态,由社区建立起来的组件库团队进行维护。
26
26
 
27
27
  ### 特性
28
- - 🚀 提供50个高质量通用组件
28
+ - 🚀 提供50+个高质量通用组件
29
29
  - 🚀 组件十分轻量
30
30
  - 💪 由国人开发,完善的中英文文档和后勤保障
31
31
  - 🛠️ 支持按需引入
@@ -5,17 +5,16 @@ import { defineComponent, ref, watch } from 'vue';
5
5
  import { props } from './props';
6
6
  import { dt } from '../utils/shared';
7
7
  import { pack } from '../locale';
8
- import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, mergeProps as _mergeProps, withCtx as _withCtx, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
8
+ import { createNamespace, call } from '../utils/components';
9
+ var {
10
+ n,
11
+ classes
12
+ } = createNamespace('action-sheet');
13
+ import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives, mergeProps as _mergeProps, withCtx as _withCtx, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
9
14
 
10
15
  var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
11
16
 
12
- var _hoisted_1 = {
13
- class: "var-action-sheet__title"
14
- };
15
- var _hoisted_2 = ["onClick"];
16
- var _hoisted_3 = {
17
- class: "var-action-sheet__action-name"
18
- };
17
+ var _hoisted_1 = ["onClick"];
19
18
  export function render(_ctx, _cache) {
20
19
  var _component_var_icon = _resolveComponent("var-icon");
21
20
 
@@ -24,7 +23,7 @@ export function render(_ctx, _cache) {
24
23
  var _directive_ripple = _resolveDirective("ripple");
25
24
 
26
25
  return _openBlock(), _createBlock(_component_var_popup, _mergeProps({
27
- class: "var-action-sheet__popup-radius",
26
+ class: _ctx.n('popup-radius'),
28
27
  position: "bottom",
29
28
  overlay: _ctx.overlay,
30
29
  "overlay-class": _ctx.overlayClass,
@@ -34,11 +33,7 @@ export function render(_ctx, _cache) {
34
33
  teleport: _ctx.teleport,
35
34
  show: _ctx.popupShow
36
35
  }, {
37
- 'onUpdate:show': value => {
38
- var _ctx$$props$onUpdate, _ctx$$props;
39
-
40
- return (_ctx$$props$onUpdate = (_ctx$$props = _ctx.$props)['onUpdate:show']) == null ? void 0 : _ctx$$props$onUpdate.call(_ctx$$props, value);
41
- }
36
+ 'onUpdate:show': _ctx.handlePopupUpdateShow
42
37
  }, {
43
38
  onOpen: _ctx.onOpen,
44
39
  onClose: _ctx.onClose,
@@ -47,12 +42,14 @@ export function render(_ctx, _cache) {
47
42
  onRouteChange: _ctx.onRouteChange
48
43
  }), {
49
44
  default: _withCtx(() => [_createElementVNode("div", _mergeProps({
50
- class: "var-action-sheet var--box"
51
- }, _ctx.$attrs), [_renderSlot(_ctx.$slots, "title", {}, () => [_createElementVNode("div", _hoisted_1, _toDisplayString(_ctx.dt(_ctx.title, _ctx.pack.actionSheetTitle)), 1
52
- /* TEXT */
45
+ class: _ctx.classes(_ctx.n(), 'var--box')
46
+ }, _ctx.$attrs), [_renderSlot(_ctx.$slots, "title", {}, () => [_createElementVNode("div", {
47
+ class: _normalizeClass(_ctx.n('title'))
48
+ }, _toDisplayString(_ctx.dt(_ctx.title, _ctx.pack.actionSheetTitle)), 3
49
+ /* TEXT, CLASS */
53
50
  )]), _renderSlot(_ctx.$slots, "actions", {}, () => [(_openBlock(true), _createElementBlock(_Fragment, null, _renderList(_ctx.actions, action => {
54
51
  return _withDirectives((_openBlock(), _createElementBlock("div", {
55
- class: _normalizeClass(["var-action-sheet__action-item", [action.className, action.disabled ? 'var-action-sheet--disabled' : null]]),
52
+ class: _normalizeClass(_ctx.classes(_ctx.n('action-item'), action.className, [action.disabled, _ctx.n('--disabled')])),
56
53
  key: action.name,
57
54
  style: _normalizeStyle({
58
55
  color: action.color
@@ -60,17 +57,19 @@ export function render(_ctx, _cache) {
60
57
  onClick: $event => _ctx.handleSelect(action)
61
58
  }, [action.icon ? (_openBlock(), _createBlock(_component_var_icon, {
62
59
  key: 0,
63
- class: "var-action-sheet__action-icon",
60
+ class: _normalizeClass(_ctx.n('action-icon')),
64
61
  "var-action-sheet-cover": "",
65
62
  name: action.icon,
66
63
  size: action.iconSize
67
64
  }, null, 8
68
65
  /* PROPS */
69
- , ["name", "size"])) : _createCommentVNode("v-if", true), _createElementVNode("div", _hoisted_3, _toDisplayString(action.name), 1
70
- /* TEXT */
66
+ , ["class", "name", "size"])) : _createCommentVNode("v-if", true), _createElementVNode("div", {
67
+ class: _normalizeClass(_ctx.n('action-name'))
68
+ }, _toDisplayString(action.name), 3
69
+ /* TEXT, CLASS */
71
70
  )], 14
72
71
  /* CLASS, STYLE, PROPS */
73
- , _hoisted_2)), [[_directive_ripple, {
72
+ , _hoisted_1)), [[_directive_ripple, {
74
73
  disabled: action.disabled
75
74
  }]]);
76
75
  }), 128
@@ -83,7 +82,7 @@ export function render(_ctx, _cache) {
83
82
 
84
83
  }, 16
85
84
  /* FULL_PROPS */
86
- , ["overlay", "overlay-class", "overlay-style", "lock-scroll", "close-on-click-overlay", "teleport", "show", "onOpen", "onClose", "onClosed", "onOpened", "onRouteChange"]);
85
+ , ["class", "overlay", "overlay-class", "overlay-style", "lock-scroll", "close-on-click-overlay", "teleport", "show", "onOpen", "onClose", "onClosed", "onOpened", "onRouteChange"]);
87
86
  }
88
87
  export default defineComponent({
89
88
  render,
@@ -102,8 +101,6 @@ export default defineComponent({
102
101
  var popupShow = ref(false);
103
102
 
104
103
  var handleSelect = action => {
105
- var _props$onUpdateShow;
106
-
107
104
  if (action.disabled) {
108
105
  return;
109
106
  }
@@ -112,16 +109,21 @@ export default defineComponent({
112
109
  closeOnClickAction,
113
110
  onSelect
114
111
  } = props;
115
- onSelect == null ? void 0 : onSelect(action);
116
- closeOnClickAction && ((_props$onUpdateShow = props['onUpdate:show']) == null ? void 0 : _props$onUpdateShow.call(props, false));
112
+ call(onSelect, action);
113
+ closeOnClickAction && call(props['onUpdate:show'], false);
117
114
  };
118
115
 
116
+ var handlePopupUpdateShow = value => call(props['onUpdate:show'], value);
117
+
119
118
  watch(() => props.show, newValue => {
120
119
  popupShow.value = newValue;
121
120
  }, {
122
121
  immediate: true
123
122
  });
124
123
  return {
124
+ n,
125
+ classes,
126
+ handlePopupUpdateShow,
125
127
  popupShow,
126
128
  pack,
127
129
  dt,
@@ -1,51 +1,54 @@
1
1
  import { defineComponent, ref, onMounted, onUpdated } from 'vue';
2
2
  import { props } from './props';
3
- import { renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
4
-
5
- var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
6
-
7
- var _hoisted_1 = {
8
- class: "var-app-bar__left"
9
- };
10
- var _hoisted_2 = {
11
- key: 0,
12
- class: "var-app-bar__title"
13
- };
14
- var _hoisted_3 = {
15
- class: "var-app-bar__right"
16
- };
3
+ import { createNamespace } from '../utils/components';
4
+ var {
5
+ n,
6
+ classes
7
+ } = createNamespace('app-bar');
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";
17
9
  export function render(_ctx, _cache) {
18
10
  return _openBlock(), _createElementBlock("div", {
19
- class: _normalizeClass(["var-app-bar", {
20
- 'var-elevation--3': _ctx.elevation
21
- }]),
11
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.elevation, 'var-elevation--3'])),
22
12
  style: _normalizeStyle({
23
13
  background: _ctx.color,
24
14
  color: _ctx.textColor
25
15
  })
26
- }, [_createElementVNode("div", _hoisted_1, [_renderSlot(_ctx.$slots, "left"), _ctx.titlePosition === 'left' ? (_openBlock(), _createElementBlock("div", {
16
+ }, [_createElementVNode("div", {
17
+ class: _normalizeClass(_ctx.n('left'))
18
+ }, [_renderSlot(_ctx.$slots, "left"), _ctx.titlePosition === 'left' ? (_openBlock(), _createElementBlock("div", {
27
19
  key: 0,
28
- class: "var-app-bar__title",
20
+ class: _normalizeClass(_ctx.n('title')),
29
21
  style: _normalizeStyle({
30
22
  paddingLeft: _ctx.paddingLeft
31
23
  })
32
24
  }, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.title), 1
33
25
  /* TEXT */
34
- )])], 4
35
- /* STYLE */
36
- )) : _createCommentVNode("v-if", true)]), _ctx.titlePosition === 'center' ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.title), 1
26
+ )])], 6
27
+ /* CLASS, STYLE */
28
+ )) : _createCommentVNode("v-if", true)], 2
29
+ /* CLASS */
30
+ ), _ctx.titlePosition === 'center' ? (_openBlock(), _createElementBlock("div", {
31
+ key: 0,
32
+ class: _normalizeClass(_ctx.n('title'))
33
+ }, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.title), 1
37
34
  /* TEXT */
38
- )])])) : _createCommentVNode("v-if", true), _createElementVNode("div", _hoisted_3, [_ctx.titlePosition === 'right' ? (_openBlock(), _createElementBlock("div", {
35
+ )])], 2
36
+ /* CLASS */
37
+ )) : _createCommentVNode("v-if", true), _createElementVNode("div", {
38
+ class: _normalizeClass(_ctx.n('right'))
39
+ }, [_ctx.titlePosition === 'right' ? (_openBlock(), _createElementBlock("div", {
39
40
  key: 0,
40
- class: "var-app-bar__title",
41
+ class: _normalizeClass(_ctx.n('title')),
41
42
  style: _normalizeStyle({
42
43
  paddingRight: _ctx.paddingRight
43
44
  })
44
45
  }, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.title), 1
45
46
  /* TEXT */
46
- )])], 4
47
- /* STYLE */
48
- )) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "right")])], 6
47
+ )])], 6
48
+ /* CLASS, STYLE */
49
+ )) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "right")], 2
50
+ /* CLASS */
51
+ )], 6
49
52
  /* CLASS, STYLE */
50
53
  );
51
54
  }
@@ -69,6 +72,8 @@ export default defineComponent({
69
72
  onMounted(computePadding);
70
73
  onUpdated(computePadding);
71
74
  return {
75
+ n,
76
+ classes,
72
77
  paddingLeft,
73
78
  paddingRight
74
79
  };
@@ -4,6 +4,11 @@ import VarIcon from '../icon';
4
4
  import { props } from './props';
5
5
  import { isString, easeInOutCubic, throttle, isObject } from '../utils/shared';
6
6
  import { getScrollTop, getScrollLeft, scrollTo, getParentScroller, toPxNum, toSizeUnit } from '../utils/elements';
7
+ import { call, createNamespace } from '../utils/components';
8
+ var {
9
+ n,
10
+ classes
11
+ } = createNamespace('back-top');
7
12
  import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, withCtx as _withCtx, withModifiers as _withModifiers, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, Teleport as _Teleport, openBlock as _openBlock, createBlock as _createBlock } from "vue";
8
13
  export function render(_ctx, _cache) {
9
14
  var _component_var_icon = _resolveComponent("var-icon");
@@ -14,7 +19,7 @@ export function render(_ctx, _cache) {
14
19
  to: "body",
15
20
  disabled: _ctx.disabled
16
21
  }, [_createElementVNode("div", {
17
- class: _normalizeClass(["var-back-top", [_ctx.show ? 'var-back-top--active' : null]]),
22
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.show, _ctx.n('--active')])),
18
23
  ref: "backTopEl",
19
24
  style: _normalizeStyle({
20
25
  right: _ctx.toSizeUnit(_ctx.right),
@@ -56,7 +61,7 @@ export default defineComponent({
56
61
  var target;
57
62
 
58
63
  var click = event => {
59
- props.onClick == null ? void 0 : props.onClick(event);
64
+ call(props.onClick, event);
60
65
  var left = getScrollLeft(target);
61
66
  scrollTo(target, {
62
67
  left,
@@ -103,6 +108,8 @@ export default defineComponent({
103
108
  show,
104
109
  backTopEl,
105
110
  toSizeUnit,
111
+ n,
112
+ classes,
106
113
  click
107
114
  };
108
115
  }
package/es/badge/Badge.js CHANGED
@@ -2,24 +2,28 @@ import VarIcon from '../icon';
2
2
  import { computed, defineComponent } from 'vue';
3
3
  import { props } from './props';
4
4
  import { toNumber } from '../utils/shared';
5
- import { resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, vShow as _vShow, mergeProps as _mergeProps, createElementVNode as _createElementVNode, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
5
+ import { createNamespace } from '../utils/components';
6
+ var {
7
+ n,
8
+ classes
9
+ } = createNamespace('badge');
10
+ import { resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, vShow as _vShow, mergeProps as _mergeProps, createElementVNode as _createElementVNode, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
6
11
 
7
12
  var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
8
13
 
9
14
  var _hoisted_1 = {
10
- class: "var-badge var--box"
11
- };
12
- var _hoisted_2 = {
13
15
  key: 1
14
16
  };
15
17
  export function render(_ctx, _cache) {
16
18
  var _component_var_icon = _resolveComponent("var-icon");
17
19
 
18
- return _openBlock(), _createElementBlock("div", _hoisted_1, [_createVNode(_Transition, {
20
+ return _openBlock(), _createElementBlock("div", {
21
+ class: _normalizeClass(_ctx.classes(_ctx.n(), 'var--box'))
22
+ }, [_createVNode(_Transition, {
19
23
  name: "var-badge-fade"
20
24
  }, {
21
25
  default: _withCtx(() => [_withDirectives(_createElementVNode("span", _mergeProps(_ctx.$attrs, {
22
- class: ["var-badge__content", _ctx.contentClass],
26
+ class: _ctx.classes(_ctx.n('content'), ..._ctx.contentClass),
23
27
  style: {
24
28
  background: _ctx.color
25
29
  }
@@ -29,7 +33,7 @@ export function render(_ctx, _cache) {
29
33
  size: "10px"
30
34
  }, null, 8
31
35
  /* PROPS */
32
- , ["name"])) : (_openBlock(), _createElementBlock("span", _hoisted_2, _toDisplayString(_ctx.values), 1
36
+ , ["name"])) : (_openBlock(), _createElementBlock("span", _hoisted_1, _toDisplayString(_ctx.values), 1
33
37
  /* TEXT */
34
38
  ))], 16
35
39
  /* FULL_PROPS */
@@ -37,7 +41,9 @@ export function render(_ctx, _cache) {
37
41
  _: 1
38
42
  /* STABLE */
39
43
 
40
- }), _renderSlot(_ctx.$slots, "default")]);
44
+ }), _renderSlot(_ctx.$slots, "default")], 2
45
+ /* CLASS */
46
+ );
41
47
  }
42
48
  export default defineComponent({
43
49
  render,
@@ -59,11 +65,11 @@ export default defineComponent({
59
65
  dot,
60
66
  icon
61
67
  } = props;
62
- var positionBasic = slots.default && "var-badge__position var-badge--" + position;
63
- var dotClass = dot && 'var-badge__dot';
68
+ var positionBasic = slots.default && n('position') + " " + n("--" + position);
69
+ var dotClass = dot && n('dot');
64
70
  var positionClass = getPositionClass();
65
- var iconClass = icon && 'var-badge__icon';
66
- return ["var-badge--" + type, positionBasic, dotClass, positionClass, iconClass];
71
+ var iconClass = icon ? n('icon') : null;
72
+ return [n("--" + type), positionBasic, dotClass, positionClass, iconClass];
67
73
  });
68
74
  var values = computed(() => {
69
75
  var {
@@ -81,11 +87,13 @@ export default defineComponent({
81
87
  position,
82
88
  dot
83
89
  } = props;
84
- if (dot && position.includes('right')) return 'var-badge__dot--right';
85
- if (dot && position.includes('left')) return 'var-badge__dot--left';
90
+ if (dot && position.includes('right')) return n('dot--right');
91
+ if (dot && position.includes('left')) return n('dot--left');
86
92
  };
87
93
 
88
94
  return {
95
+ n,
96
+ classes,
89
97
  values,
90
98
  contentClass
91
99
  };
@@ -0,0 +1,204 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ import VarButton from '../button';
4
+ import { defineComponent, ref, computed, onMounted, onUpdated, watch } from 'vue';
5
+ import { props } from './props';
6
+ import { useBottomNavigationItems } from './provide';
7
+ import { createNamespace, call } from '../utils/components';
8
+ import { isNumber } from '../utils/shared';
9
+ var {
10
+ n,
11
+ classes
12
+ } = createNamespace('bottom-navigation');
13
+ var {
14
+ n: nItem
15
+ } = createNamespace('bottom-navigation-item');
16
+ var RIGHT_HALF_SPACE_CLASS = nItem('--right-half-space');
17
+ var LEFT_HALF_SPACE_CLASS = nItem('--left-half-space');
18
+ var RIGHT_SPACE_CLASS = nItem('--right-space');
19
+ var defaultFabProps = {
20
+ type: 'primary'
21
+ };
22
+ import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, mergeProps as _mergeProps, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementBlock as _createElementBlock } from "vue";
23
+ export function render(_ctx, _cache) {
24
+ var _component_var_button = _resolveComponent("var-button");
25
+
26
+ return _openBlock(), _createElementBlock("div", {
27
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.fixed, _ctx.n('--fixed')], [_ctx.border, _ctx.n('--border')])),
28
+ ref: "bottomNavigationDom",
29
+ style: _normalizeStyle("z-index:" + _ctx.zIndex)
30
+ }, [_renderSlot(_ctx.$slots, "default"), _ctx.$slots.fab ? (_openBlock(), _createBlock(_component_var_button, _mergeProps({
31
+ key: 0,
32
+ class: _ctx.classes(_ctx.n('fab'), [_ctx.length % 2, _ctx.n('--fab-right'), _ctx.n('--fab-center')]),
33
+ "var-bottom-navigation__fab": "",
34
+ onClick: _ctx.handleFabClick
35
+ }, _ctx.fabProps, {
36
+ round: ""
37
+ }), {
38
+ default: _withCtx(() => [_renderSlot(_ctx.$slots, "fab")]),
39
+ _: 3
40
+ /* FORWARDED */
41
+
42
+ }, 16
43
+ /* FULL_PROPS */
44
+ , ["class", "onClick"])) : _createCommentVNode("v-if", true)], 6
45
+ /* CLASS, STYLE */
46
+ );
47
+ }
48
+ export default defineComponent({
49
+ render,
50
+ name: 'VarBottomNavigation',
51
+ components: {
52
+ VarButton
53
+ },
54
+ props,
55
+
56
+ setup(props, _ref) {
57
+ var {
58
+ slots
59
+ } = _ref;
60
+ var bottomNavigationDom = ref(null);
61
+ var active = computed(() => props.active);
62
+ var activeColor = computed(() => props.activeColor);
63
+ var inactiveColor = computed(() => props.inactiveColor);
64
+ var fabProps = ref({});
65
+ var {
66
+ length,
67
+ bottomNavigationItems,
68
+ bindBottomNavigationItem
69
+ } = useBottomNavigationItems();
70
+
71
+ var matchBoundary = () => {
72
+ if (length.value === 0 || matchName() || matchIndex()) {
73
+ return;
74
+ }
75
+
76
+ handleActiveIndex();
77
+ };
78
+
79
+ var matchName = () => {
80
+ return bottomNavigationItems.find(_ref2 => {
81
+ var {
82
+ name
83
+ } = _ref2;
84
+ return active.value === name.value;
85
+ });
86
+ };
87
+
88
+ var matchIndex = () => {
89
+ return bottomNavigationItems.find(_ref3 => {
90
+ var {
91
+ index
92
+ } = _ref3;
93
+ return active.value === index.value;
94
+ });
95
+ };
96
+
97
+ var handleActiveIndex = () => {
98
+ if (!isNumber(active.value)) {
99
+ return;
100
+ }
101
+
102
+ if (active.value < 0) {
103
+ call(props['onUpdate:active'], 0);
104
+ } else if (active.value > length.value - 1) {
105
+ call(props['onUpdate:active'], length.value - 1);
106
+ }
107
+ };
108
+
109
+ var onToggle = changedValue => {
110
+ props.onBeforeChange ? handleBeforeChange(changedValue) : handleChange(changedValue);
111
+ };
112
+
113
+ var handleBeforeChange = changedValue => {
114
+ Promise.resolve(call(props.onBeforeChange, changedValue)).then(res => res && handleChange(changedValue));
115
+ };
116
+
117
+ var handleChange = changedValue => {
118
+ call(props['onUpdate:active'], changedValue);
119
+ call(props.onChange, changedValue);
120
+ };
121
+
122
+ var removeMarginClass = () => {
123
+ var bottomNavigationItems = getBottomNavigationItems();
124
+ bottomNavigationItems.forEach(dom => {
125
+ dom.classList.remove(RIGHT_HALF_SPACE_CLASS, LEFT_HALF_SPACE_CLASS, RIGHT_SPACE_CLASS);
126
+ });
127
+ };
128
+
129
+ var addMarginClass = length => {
130
+ var bottomNavigationItems = getBottomNavigationItems();
131
+ var itemsNum = bottomNavigationItems.length;
132
+ var isEven = length % 2 === 0;
133
+ bottomNavigationItems.forEach((bottomNavigationItem, i) => {
134
+ handleMarginClass(isEven, bottomNavigationItem, i, itemsNum);
135
+ });
136
+ };
137
+
138
+ var handleMarginClass = (isEven, dom, i, length) => {
139
+ var isLast = i === length - 1;
140
+
141
+ if (!isEven && isLast) {
142
+ dom.classList.add(RIGHT_SPACE_CLASS);
143
+ return;
144
+ }
145
+
146
+ var isFabLeft = i === length / 2 - 1;
147
+ var isFabRight = i === length / 2;
148
+
149
+ if (isFabLeft) {
150
+ dom.classList.add(RIGHT_HALF_SPACE_CLASS);
151
+ } else if (isFabRight) {
152
+ dom.classList.add(LEFT_HALF_SPACE_CLASS);
153
+ }
154
+ };
155
+
156
+ var getBottomNavigationItems = () => {
157
+ return Array.from(bottomNavigationDom.value.querySelectorAll("." + nItem()));
158
+ };
159
+
160
+ var handleFabClick = () => {
161
+ call(props.onFabClick);
162
+ };
163
+
164
+ var bottomNavigationProvider = {
165
+ active,
166
+ activeColor,
167
+ inactiveColor,
168
+ onToggle
169
+ };
170
+ bindBottomNavigationItem(bottomNavigationProvider);
171
+ watch(() => length.value, matchBoundary);
172
+ watch(() => props.fabProps, newValue => {
173
+ fabProps.value = _extends({}, defaultFabProps, newValue);
174
+ }, {
175
+ immediate: true,
176
+ deep: true
177
+ });
178
+ onMounted(() => {
179
+ if (!slots.fab) {
180
+ return;
181
+ }
182
+
183
+ addMarginClass(length.value);
184
+ });
185
+ onUpdated(() => {
186
+ removeMarginClass();
187
+
188
+ if (!slots.fab) {
189
+ return;
190
+ }
191
+
192
+ addMarginClass(length.value);
193
+ });
194
+ return {
195
+ n,
196
+ classes,
197
+ length,
198
+ bottomNavigationDom,
199
+ handleFabClick,
200
+ fabProps
201
+ };
202
+ }
203
+
204
+ });
File without changes
File without changes
@@ -0,0 +1 @@
1
+ :root { --bottom-navigation-height: 50px; --bottom-navigation-z-index: 1; --bottom-navigation-background-color: #fff; --bottom-navigation-border-color: #e3e3e3; --bottom-navigation-fab-offset: 4px;}.var-bottom-navigation { width: 100%; height: var(--bottom-navigation-height); display: flex; position: relative; background-color: var(--bottom-navigation-background-color); transition: background-color 250ms, border-color 250ms; -webkit-tap-highlight-color: transparent;}.var-bottom-navigation--fixed { position: fixed; left: 0; bottom: 0;}.var-bottom-navigation--border { border-top: 1px solid var(--bottom-navigation-border-color);}.var-bottom-navigation__fab[var-bottom-navigation__fab] { width: var(--bottom-navigation-height); height: var(--bottom-navigation-height); position: absolute; z-index: 2; transform: translateY(-50%); overflow: hidden; transition: right 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.var-bottom-navigation--fab-center { right: calc(50% - var(--bottom-navigation-height) / 2);}.var-bottom-navigation--fab-right { right: var(--bottom-navigation-fab-offset);}
@@ -0,0 +1,51 @@
1
+ @bottom-navigation-height: 50px;
2
+ @bottom-navigation-z-index: 1;
3
+ @bottom-navigation-background-color: #fff;
4
+ @bottom-navigation-border-color: #e3e3e3;
5
+ @bottom-navigation-fab-offset: 4px;
6
+
7
+ :root {
8
+ --bottom-navigation-height: @bottom-navigation-height;
9
+ --bottom-navigation-z-index: @bottom-navigation-z-index;
10
+ --bottom-navigation-background-color: @bottom-navigation-background-color;
11
+ --bottom-navigation-border-color: @bottom-navigation-border-color;
12
+ --bottom-navigation-fab-offset: @bottom-navigation-fab-offset;
13
+ }
14
+
15
+ .var-bottom-navigation {
16
+ width: 100%;
17
+ height: var(--bottom-navigation-height);
18
+ display: flex;
19
+ position: relative;
20
+ background-color: var(--bottom-navigation-background-color);
21
+ transition: background-color 250ms, border-color 250ms;
22
+ -webkit-tap-highlight-color: transparent;
23
+
24
+ &--fixed {
25
+ position: fixed;
26
+ left: 0;
27
+ bottom: 0;
28
+ }
29
+
30
+ &--border {
31
+ border-top: 1px solid var(--bottom-navigation-border-color);
32
+ }
33
+
34
+ &__fab[var-bottom-navigation__fab] {
35
+ width: var(--bottom-navigation-height);
36
+ height: var(--bottom-navigation-height);
37
+ position: absolute;
38
+ z-index: 2;
39
+ transform: translateY(-50%);
40
+ overflow: hidden;
41
+ transition: right 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
42
+ }
43
+
44
+ &--fab-center {
45
+ right: calc(50% - var(--bottom-navigation-height) / 2);
46
+ }
47
+
48
+ &--fab-right {
49
+ right: var(--bottom-navigation-fab-offset);
50
+ }
51
+ }
@@ -0,0 +1,8 @@
1
+ import BottomNavigation from './BottomNavigation.js'
2
+
3
+ BottomNavigation.install = function (app) {
4
+ app.component(BottomNavigation.name, BottomNavigation);
5
+ };
6
+
7
+ export var _BottomNavigationComponent = BottomNavigation;
8
+ export default BottomNavigation;