@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
@@ -0,0 +1,40 @@
1
+ export var props = {
2
+ active: {
3
+ type: [Number, String],
4
+ default: 0
5
+ },
6
+ fixed: {
7
+ type: Boolean,
8
+ default: false
9
+ },
10
+ border: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ zIndex: {
15
+ type: [Number, String],
16
+ default: 1
17
+ },
18
+ activeColor: {
19
+ type: String
20
+ },
21
+ inactiveColor: {
22
+ type: String
23
+ },
24
+ onChange: {
25
+ type: Function
26
+ },
27
+ 'onUpdate:active': {
28
+ type: Function
29
+ },
30
+ onBeforeChange: {
31
+ type: Function
32
+ },
33
+ onFabClick: {
34
+ type: Function
35
+ },
36
+ fabProps: {
37
+ type: [Object],
38
+ default: {}
39
+ }
40
+ };
@@ -0,0 +1,17 @@
1
+ import { useAtChildrenCounter, useChildren } from '../utils/components';
2
+ export var BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY = Symbol('BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY');
3
+ export var BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY = Symbol('BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY');
4
+ export function useBottomNavigationItems() {
5
+ var {
6
+ childProviders,
7
+ bindChildren
8
+ } = useChildren(BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY);
9
+ var {
10
+ length
11
+ } = useAtChildrenCounter(BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY);
12
+ return {
13
+ length,
14
+ bottomNavigationItems: childProviders,
15
+ bindBottomNavigationItem: bindChildren
16
+ };
17
+ }
@@ -0,0 +1,4 @@
1
+ import '../../styles/common.css'
2
+ import '../../button/button.css'
3
+ import '../bottomNavigation.css'
4
+ import '../BottomNavigationSfc.css'
@@ -0,0 +1,4 @@
1
+ import '../../styles/common.less'
2
+ import '../../button/button.less'
3
+ import '../bottomNavigation.less'
4
+ import '../BottomNavigationSfc.less'
@@ -0,0 +1,122 @@
1
+ import Ripple from '../ripple';
2
+ import VarBadge from '../badge';
3
+ import VarIcon from '../icon';
4
+ import { defineComponent, computed, ref, watch } from 'vue';
5
+ import { props } from './props';
6
+ import { useBottomNavigation } from './provide';
7
+ import { createNamespace, call } from '../utils/components';
8
+ var {
9
+ n,
10
+ classes
11
+ } = createNamespace('bottom-navigation-item');
12
+ var defaultBadgeProps = {
13
+ type: 'danger',
14
+ dot: true
15
+ };
16
+ import { resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, mergeProps as _mergeProps, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, Fragment as _Fragment, createElementBlock as _createElementBlock, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, withDirectives as _withDirectives } from "vue";
17
+ export function render(_ctx, _cache) {
18
+ var _component_var_icon = _resolveComponent("var-icon");
19
+
20
+ var _component_var_badge = _resolveComponent("var-badge");
21
+
22
+ var _directive_ripple = _resolveDirective("ripple");
23
+
24
+ return _withDirectives((_openBlock(), _createElementBlock("button", {
25
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.active === _ctx.index || _ctx.active === _ctx.name, _ctx.n('--active')])),
26
+ style: _normalizeStyle({
27
+ color: _ctx.computeColorStyle()
28
+ }),
29
+ onClick: _cache[0] || (_cache[0] = function () {
30
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
31
+ })
32
+ }, [_ctx.icon && !_ctx.$slots.icon ? (_openBlock(), _createBlock(_component_var_icon, {
33
+ key: 0,
34
+ name: _ctx.icon,
35
+ namespace: _ctx.namespace,
36
+ class: _normalizeClass(_ctx.n('icon')),
37
+ "var-bottom-navigation-item-cover": ""
38
+ }, null, 8
39
+ /* PROPS */
40
+ , ["name", "namespace", "class"])) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "icon", {
41
+ active: _ctx.active === _ctx.index || _ctx.active === _ctx.name
42
+ }), _ctx.badge ? (_openBlock(), _createBlock(_component_var_badge, _mergeProps({
43
+ key: 1
44
+ }, _ctx.badgeProps, {
45
+ class: _ctx.n('badge'),
46
+ "var-bottom-navigation-item-cover": ""
47
+ }), null, 16
48
+ /* FULL_PROPS */
49
+ , ["class"])) : _createCommentVNode("v-if", true), _createElementVNode("span", {
50
+ class: _normalizeClass(_ctx.n('label'))
51
+ }, [!_ctx.$slots.default ? (_openBlock(), _createElementBlock(_Fragment, {
52
+ key: 0
53
+ }, [_createTextVNode(_toDisplayString(_ctx.label), 1
54
+ /* TEXT */
55
+ )], 2112
56
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
57
+ )) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "default")], 2
58
+ /* CLASS */
59
+ )], 6
60
+ /* CLASS, STYLE */
61
+ )), [[_directive_ripple]]);
62
+ }
63
+ export default defineComponent({
64
+ render,
65
+ name: 'VarBottomNavigationItem',
66
+ components: {
67
+ VarBadge,
68
+ VarIcon
69
+ },
70
+ directives: {
71
+ Ripple
72
+ },
73
+ props,
74
+
75
+ setup(props) {
76
+ var name = computed(() => props.name);
77
+ var badge = computed(() => props.badge);
78
+ var badgeProps = ref({});
79
+ var {
80
+ index,
81
+ bottomNavigation,
82
+ bindBottomNavigation
83
+ } = useBottomNavigation();
84
+ var {
85
+ active,
86
+ activeColor,
87
+ inactiveColor
88
+ } = bottomNavigation;
89
+ var bottomNavigationItemProvider = {
90
+ name,
91
+ index
92
+ };
93
+
94
+ var computeColorStyle = () => {
95
+ return active.value === name.value || active.value === index.value ? activeColor.value : inactiveColor.value;
96
+ };
97
+
98
+ var handleClick = () => {
99
+ var active = name.value || index.value;
100
+ call(props.onClick, active);
101
+ call(bottomNavigation.onToggle, active);
102
+ };
103
+
104
+ bindBottomNavigation(bottomNavigationItemProvider);
105
+ watch(() => badge.value, newValue => {
106
+ badgeProps.value = newValue === true ? defaultBadgeProps : badge.value;
107
+ }, {
108
+ immediate: true
109
+ });
110
+ return {
111
+ n,
112
+ classes,
113
+ index,
114
+ active,
115
+ badge,
116
+ badgeProps,
117
+ computeColorStyle,
118
+ handleClick
119
+ };
120
+ }
121
+
122
+ });
@@ -0,0 +1 @@
1
+ :root { --bottom-navigation-item-font-size: var(--font-size-sm); --bottom-navigation-item-inactive-color: #646566; --bottom-navigation-item-active-color: var(--color-primary); --bottom-navigation-item-active-background-color: #fff; --bottom-navigation-item-line-height: 1; --bottom-navigation-item-icon-size: 22px; --bottom-navigation-item-icon-margin-bottom: 5px;}.var-bottom-navigation-item { height: 100%; padding: 6px 12px 8px; position: relative; display: inline-flex; flex: 1 1 0%; flex-direction: column; align-items: center; justify-content: center; line-height: var(--bottom-navigation-item-line-height); color: var(--bottom-navigation-item-inactive-color); cursor: pointer; user-select: none; vertical-align: middle; appearance: none; text-decoration: none; background-color: transparent; outline: 0; border: 0; transition: color 250ms, margin 250ms;}.var-bottom-navigation-item--active { color: var(--bottom-navigation-item-active-color); background-color: var(--bottom-navigation-item-active-background-color); transition: background-color 250ms;}.var-bottom-navigation-item--active .var-bottom-navigation-item__label { font-size: calc(var(--bottom-navigation-item-font-size) * 1.16);}.var-bottom-navigation-item--right-half-space { margin-right: calc(var(--bottom-navigation-height) / 2);}.var-bottom-navigation-item--left-half-space { margin-left: calc(var(--bottom-navigation-height) / 2);}.var-bottom-navigation-item--right-space { margin-right: calc(var(--bottom-navigation-height) + var(--bottom-navigation-fab-offset));}.var-bottom-navigation-item__icon[var-bottom-navigation-item-cover] { font-size: var(--bottom-navigation-item-icon-size);}.var-bottom-navigation-item__badge[var-bottom-navigation-item-cover] { position: absolute; left: 4px; transform: translateY(-22px);}.var-bottom-navigation-item__label { margin-top: var(--bottom-navigation-item-icon-margin-bottom); font-size: var(--bottom-navigation-item-font-size); transition: font-size 0.2s ease 0.1s; white-space: nowrap;}
@@ -0,0 +1,78 @@
1
+ @bottom-navigation-item-font-size: var(--font-size-sm);
2
+ @bottom-navigation-item-inactive-color: #646566;
3
+ @bottom-navigation-item-active-color: var(--color-primary);
4
+ @bottom-navigation-item-active-background-color: #fff;
5
+ @bottom-navigation-item-line-height: 1;
6
+ @bottom-navigation-item-icon-size: 22px;
7
+ @bottom-navigation-item-icon-margin-bottom: 5px;
8
+
9
+ :root {
10
+ --bottom-navigation-item-font-size: @bottom-navigation-item-font-size;
11
+ --bottom-navigation-item-inactive-color: @bottom-navigation-item-inactive-color;
12
+ --bottom-navigation-item-active-color: @bottom-navigation-item-active-color;
13
+ --bottom-navigation-item-active-background-color: @bottom-navigation-item-active-background-color;
14
+ --bottom-navigation-item-line-height: @bottom-navigation-item-line-height;
15
+ --bottom-navigation-item-icon-size: @bottom-navigation-item-icon-size;
16
+ --bottom-navigation-item-icon-margin-bottom: @bottom-navigation-item-icon-margin-bottom;
17
+ }
18
+
19
+ .var-bottom-navigation-item {
20
+ height: 100%;
21
+ padding: 6px 12px 8px;
22
+ position: relative;
23
+ display: inline-flex;
24
+ flex: 1 1 0%;
25
+ flex-direction: column;
26
+ align-items: center;
27
+ justify-content: center;
28
+ line-height: var(--bottom-navigation-item-line-height);
29
+ color: var(--bottom-navigation-item-inactive-color);
30
+ cursor: pointer;
31
+ user-select: none;
32
+ vertical-align: middle;
33
+ appearance: none;
34
+ text-decoration: none;
35
+ background-color: transparent;
36
+ outline: 0;
37
+ border: 0;
38
+ transition: color 250ms, margin 250ms;
39
+
40
+ &--active {
41
+ color: var(--bottom-navigation-item-active-color);
42
+ background-color: var(--bottom-navigation-item-active-background-color);
43
+ transition: background-color 250ms;
44
+
45
+ .var-bottom-navigation-item__label {
46
+ font-size: calc(var(--bottom-navigation-item-font-size) * 1.16);
47
+ }
48
+ }
49
+
50
+ &--right-half-space {
51
+ margin-right: calc(var(--bottom-navigation-height) / 2);
52
+ }
53
+
54
+ &--left-half-space {
55
+ margin-left: calc(var(--bottom-navigation-height) / 2);
56
+ }
57
+
58
+ &--right-space {
59
+ margin-right: calc(var(--bottom-navigation-height) + var(--bottom-navigation-fab-offset));
60
+ }
61
+
62
+ &__icon[var-bottom-navigation-item-cover] {
63
+ font-size: var(--bottom-navigation-item-icon-size);
64
+ }
65
+
66
+ &__badge[var-bottom-navigation-item-cover] {
67
+ position: absolute;
68
+ left: 4px;
69
+ transform: translateY(-22px);
70
+ }
71
+
72
+ &__label {
73
+ margin-top: var(--bottom-navigation-item-icon-margin-bottom);
74
+ font-size: var(--bottom-navigation-item-font-size);
75
+ transition: font-size 0.2s ease 0.1s;
76
+ white-space: nowrap;
77
+ }
78
+ }
@@ -0,0 +1,8 @@
1
+ import BottomNavigationItem from './BottomNavigationItem.js'
2
+
3
+ BottomNavigationItem.install = function (app) {
4
+ app.component(BottomNavigationItem.name, BottomNavigationItem);
5
+ };
6
+
7
+ export var _BottomNavigationItemComponent = BottomNavigationItem;
8
+ export default BottomNavigationItem;
@@ -0,0 +1,22 @@
1
+ export var props = {
2
+ name: {
3
+ type: String
4
+ },
5
+ icon: {
6
+ type: String
7
+ },
8
+ label: {
9
+ type: String
10
+ },
11
+ namespace: {
12
+ type: String,
13
+ default: 'var-icon'
14
+ },
15
+ badge: {
16
+ type: [Boolean, Object],
17
+ default: false
18
+ },
19
+ onClick: {
20
+ type: Function
21
+ }
22
+ };
@@ -0,0 +1,21 @@
1
+ import { useAtParentIndex, useParent } from '../utils/components';
2
+ import { BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY, BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY } from '../bottom-navigation/provide';
3
+ export function useBottomNavigation() {
4
+ var {
5
+ parentProvider,
6
+ bindParent
7
+ } = useParent(BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY);
8
+ var {
9
+ index
10
+ } = useAtParentIndex(BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY);
11
+
12
+ if (!parentProvider || !bindParent || !index) {
13
+ throw Error('<var-bottom-navigation-item/> must in <var-bottom-navigation/>');
14
+ }
15
+
16
+ return {
17
+ index,
18
+ bottomNavigation: parentProvider,
19
+ bindBottomNavigation: bindParent
20
+ };
21
+ }
@@ -0,0 +1,6 @@
1
+ import '../../styles/common.css'
2
+ import '../../ripple/ripple.css'
3
+ import '../../badge/badge.css'
4
+ import '../../icon/icon.css'
5
+ import '../bottomNavigationItem.css'
6
+ import '../BottomNavigationItemSfc.css'
@@ -0,0 +1,6 @@
1
+ import '../../styles/common.less'
2
+ import '../../ripple/ripple.less'
3
+ import '../../badge/badge.less'
4
+ import '../../icon/icon.less'
5
+ import '../bottomNavigationItem.less'
6
+ import '../BottomNavigationItemSfc.less'
@@ -2,7 +2,12 @@ import Ripple from '../ripple';
2
2
  import VarLoading from '../loading';
3
3
  import { defineComponent, ref } from 'vue';
4
4
  import { props } from './props';
5
- import { resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
5
+ import { createNamespace } from '../utils/components';
6
+ var {
7
+ n,
8
+ classes
9
+ } = createNamespace('button');
10
+ import { resolveComponent as _resolveComponent, normalizeClass as _normalizeClass, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, createElementBlock as _createElementBlock, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
6
11
 
7
12
  var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
8
13
 
@@ -13,7 +18,7 @@ export function render(_ctx, _cache) {
13
18
  var _directive_ripple = _resolveDirective("ripple");
14
19
 
15
20
  return _withDirectives((_openBlock(), _createElementBlock("button", {
16
- class: _normalizeClass(["var-button var--box", ["var-button--" + _ctx.size, _ctx.block ? 'var--flex var-button--block' : 'var--inline-flex', _ctx.disabled ? 'var-button--disabled' : null, _ctx.text ? "var-button--text-" + _ctx.type : "var-button--" + _ctx.type, _ctx.text ? 'var-button--text' : 'var-elevation--2', _ctx.text && _ctx.disabled ? 'var-button--text-disabled' : null, _ctx.round ? 'var-button--round' : null, _ctx.outline ? 'var-button--outline' : null]]),
21
+ class: _normalizeClass(_ctx.classes(_ctx.n(), 'var--box', _ctx.n("--" + _ctx.size), [_ctx.block, "var--flex " + _ctx.n('--block'), 'var--inline-flex'], [_ctx.disabled, _ctx.n('--disabled')], [_ctx.text, _ctx.n("--text-" + _ctx.type) + " " + _ctx.n('--text'), _ctx.n("--" + _ctx.type) + " var-elevation--2"], [_ctx.text && _ctx.disabled, _ctx.n('--text-disabled')], [_ctx.round, _ctx.n('--round')], [_ctx.outline, _ctx.n('--outline')])),
17
22
  style: _normalizeStyle({
18
23
  color: _ctx.textColor,
19
24
  background: _ctx.color
@@ -27,15 +32,15 @@ export function render(_ctx, _cache) {
27
32
  })
28
33
  }, [_ctx.loading || _ctx.pending ? (_openBlock(), _createBlock(_component_var_loading, {
29
34
  key: 0,
30
- class: "var-button__loading",
35
+ class: _normalizeClass(_ctx.n('loading')),
31
36
  "var-button-cover": "",
32
37
  type: _ctx.loadingType,
33
38
  size: _ctx.loadingSize,
34
39
  radius: _ctx.loadingRadius
35
40
  }, null, 8
36
41
  /* PROPS */
37
- , ["type", "size", "radius"])) : _createCommentVNode("v-if", true), _createElementVNode("div", {
38
- class: _normalizeClass(["var-button__content", [_ctx.loading || _ctx.pending ? 'var-button--hidden' : null]])
42
+ , ["class", "type", "size", "radius"])) : _createCommentVNode("v-if", true), _createElementVNode("div", {
43
+ class: _normalizeClass(_ctx.classes(_ctx.n('content'), [_ctx.loading || _ctx.pending, _ctx.n('--hidden')]))
39
44
  }, [_renderSlot(_ctx.$slots, "default")], 2
40
45
  /* CLASS */
41
46
  )], 46
@@ -96,6 +101,8 @@ export default defineComponent({
96
101
  };
97
102
 
98
103
  return {
104
+ n,
105
+ classes,
99
106
  pending,
100
107
  handleClick,
101
108
  handleTouchstart
package/es/card/Card.js CHANGED
@@ -2,53 +2,56 @@ import Ripple from '../ripple';
2
2
  import { defineComponent } from 'vue';
3
3
  import { props } from './props';
4
4
  import { toSizeUnit } from '../utils/elements';
5
- import { renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, resolveDirective as _resolveDirective, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
5
+ import { createNamespace } from '../utils/components';
6
+ var {
7
+ n,
8
+ classes
9
+ } = createNamespace('card');
10
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, resolveDirective as _resolveDirective, withDirectives as _withDirectives, 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 = ["src", "alt"];
10
- var _hoisted_2 = {
11
- key: 0,
12
- class: "var-card__title"
13
- };
14
- var _hoisted_3 = {
15
- key: 0,
16
- class: "var-card__subtitle"
17
- };
18
- var _hoisted_4 = {
19
- key: 0,
20
- class: "var-card__description"
21
- };
22
- var _hoisted_5 = {
23
- key: 0,
24
- class: "var-card__footer"
25
- };
26
15
  export function render(_ctx, _cache) {
27
16
  var _directive_ripple = _resolveDirective("ripple");
28
17
 
29
18
  return _withDirectives((_openBlock(), _createElementBlock("div", {
30
- class: _normalizeClass(["var-card", [_ctx.elevation ? "var-elevation--" + _ctx.elevation : 'var-elevation--2']]),
19
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.elevation, "var-elevation--" + _ctx.elevation, 'var-elevation--2'])),
31
20
  onClick: _cache[0] || (_cache[0] = function () {
32
21
  return _ctx.onClick && _ctx.onClick(...arguments);
33
22
  })
34
23
  }, [_renderSlot(_ctx.$slots, "image", {}, () => [_ctx.src ? (_openBlock(), _createElementBlock("img", {
35
24
  key: 0,
36
- class: "var-card__image",
25
+ class: _normalizeClass(_ctx.n('image')),
37
26
  style: _normalizeStyle({
38
27
  objectFit: _ctx.fit,
39
28
  height: _ctx.toSizeUnit(_ctx.height)
40
29
  }),
41
30
  src: _ctx.src,
42
31
  alt: _ctx.alt
43
- }, null, 12
44
- /* STYLE, PROPS */
45
- , _hoisted_1)) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "title", {}, () => [_ctx.title ? (_openBlock(), _createElementBlock("div", _hoisted_2, _toDisplayString(_ctx.title), 1
46
- /* TEXT */
47
- )) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "subtitle", {}, () => [_ctx.subtitle ? (_openBlock(), _createElementBlock("div", _hoisted_3, _toDisplayString(_ctx.subtitle), 1
48
- /* TEXT */
49
- )) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "description", {}, () => [_ctx.description ? (_openBlock(), _createElementBlock("div", _hoisted_4, _toDisplayString(_ctx.description), 1
50
- /* TEXT */
51
- )) : _createCommentVNode("v-if", true)]), _ctx.$slots.extra ? (_openBlock(), _createElementBlock("div", _hoisted_5, [_renderSlot(_ctx.$slots, "extra")])) : _createCommentVNode("v-if", true)], 2
32
+ }, null, 14
33
+ /* CLASS, STYLE, PROPS */
34
+ , _hoisted_1)) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "title", {}, () => [_ctx.title ? (_openBlock(), _createElementBlock("div", {
35
+ key: 0,
36
+ class: _normalizeClass(_ctx.n('title'))
37
+ }, _toDisplayString(_ctx.title), 3
38
+ /* TEXT, CLASS */
39
+ )) : _createCommentVNode("v-if", true)]), _renderSlot(_ctx.$slots, "subtitle", {}, () => [_ctx.subtitle ? (_openBlock(), _createElementBlock("div", {
40
+ key: 0,
41
+ class: _normalizeClass(_ctx.n('subtitle'))
42
+ }, _toDisplayString(_ctx.subtitle), 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.extra ? (_openBlock(), _createElementBlock("div", {
50
+ key: 0,
51
+ class: _normalizeClass(_ctx.n('footer'))
52
+ }, [_renderSlot(_ctx.$slots, "extra")], 2
53
+ /* CLASS */
54
+ )) : _createCommentVNode("v-if", true)], 2
52
55
  /* CLASS */
53
56
  )), [[_directive_ripple, {
54
57
  disabled: !_ctx.ripple
@@ -64,6 +67,8 @@ export default defineComponent({
64
67
 
65
68
  setup() {
66
69
  return {
70
+ n,
71
+ classes,
67
72
  toSizeUnit
68
73
  };
69
74
  }
package/es/cell/Cell.js CHANGED
@@ -1,21 +1,20 @@
1
1
  import { defineComponent } from 'vue';
2
2
  import { props } from './props';
3
3
  import VarIcon from '../icon';
4
- 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, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
5
-
6
- var _withScopeId = n => (_pushScopeId(""), n = n(), _popScopeId(), n);
7
-
8
- var _hoisted_1 = {
9
- class: "var-cell__content"
10
- };
4
+ import { createNamespace } from '../utils/components';
5
+ var {
6
+ n,
7
+ classes
8
+ } = 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
10
  export function render(_ctx, _cache) {
12
11
  var _component_var_icon = _resolveComponent("var-icon");
13
12
 
14
13
  return _openBlock(), _createElementBlock("div", {
15
- class: _normalizeClass(["var-cell", [_ctx.border ? 'var-cell--border' : null]])
14
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.border, _ctx.n('--border')]))
16
15
  }, [_ctx.$slots.icon || _ctx.icon ? (_openBlock(), _createElementBlock("div", {
17
16
  key: 0,
18
- class: _normalizeClass(["var-cell__icon", [_ctx.iconClass ? _ctx.iconClass : null]])
17
+ class: _normalizeClass(_ctx.classes(_ctx.n('icon'), [_ctx.iconClass, _ctx.iconClass]))
19
18
  }, [_renderSlot(_ctx.$slots, "icon", {}, () => [_createVNode(_component_var_icon, {
20
19
  class: "var--flex",
21
20
  name: _ctx.icon
@@ -23,22 +22,26 @@ export function render(_ctx, _cache) {
23
22
  /* PROPS */
24
23
  , ["name"])])], 2
25
24
  /* CLASS */
26
- )) : _createCommentVNode("v-if", true), _createElementVNode("div", _hoisted_1, [_createElementVNode("div", {
27
- class: _normalizeClass(["var-cell__title", [_ctx.titleClass ? _ctx.titleClass : null]])
25
+ )) : _createCommentVNode("v-if", true), _createElementVNode("div", {
26
+ class: _normalizeClass(_ctx.n('content'))
27
+ }, [_createElementVNode("div", {
28
+ class: _normalizeClass(_ctx.classes(_ctx.n('title'), [_ctx.titleClass, _ctx.titleClass]))
28
29
  }, [_renderSlot(_ctx.$slots, "default", {}, () => [_createTextVNode(_toDisplayString(_ctx.title), 1
29
30
  /* TEXT */
30
31
  )])], 2
31
32
  /* CLASS */
32
33
  ), _ctx.$slots.desc || _ctx.desc ? (_openBlock(), _createElementBlock("div", {
33
34
  key: 0,
34
- class: _normalizeClass(["var-cell__desc", [_ctx.descClass ? _ctx.descClass : null]])
35
+ class: _normalizeClass(_ctx.classes(_ctx.n('desc'), [_ctx.descClass, _ctx.descClass]))
35
36
  }, [_renderSlot(_ctx.$slots, "desc", {}, () => [_createTextVNode(_toDisplayString(_ctx.desc), 1
36
37
  /* TEXT */
37
38
  )])], 2
38
39
  /* CLASS */
39
- )) : _createCommentVNode("v-if", true)]), _ctx.$slots.extra ? (_openBlock(), _createElementBlock("div", {
40
+ )) : _createCommentVNode("v-if", true)], 2
41
+ /* CLASS */
42
+ ), _ctx.$slots.extra ? (_openBlock(), _createElementBlock("div", {
40
43
  key: 1,
41
- class: _normalizeClass(["var-cell__extra", [_ctx.extraClass ? _ctx.extraClass : null]])
44
+ class: _normalizeClass(_ctx.classes(_ctx.n('extra'), [_ctx.extraClass, _ctx.extraClass]))
42
45
  }, [_renderSlot(_ctx.$slots, "extra")], 2
43
46
  /* CLASS */
44
47
  )) : _createCommentVNode("v-if", true)], 2
@@ -51,5 +54,13 @@ export default defineComponent({
51
54
  components: {
52
55
  VarIcon
53
56
  },
54
- props
57
+ props,
58
+
59
+ setup() {
60
+ return {
61
+ n,
62
+ classes
63
+ };
64
+ }
65
+
55
66
  });