@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,221 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ exports.render = render;
6
+
7
+ var _button = _interopRequireDefault(require("../button"));
8
+
9
+ var _vue = require("vue");
10
+
11
+ var _props = require("./props");
12
+
13
+ var _provide = require("./provide");
14
+
15
+ var _components = require("../utils/components");
16
+
17
+ var _shared = require("../utils/shared");
18
+
19
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+
21
+ 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); }
22
+
23
+ var {
24
+ n,
25
+ classes
26
+ } = (0, _components.createNamespace)('bottom-navigation');
27
+ var {
28
+ n: nItem
29
+ } = (0, _components.createNamespace)('bottom-navigation-item');
30
+ var RIGHT_HALF_SPACE_CLASS = nItem('--right-half-space');
31
+ var LEFT_HALF_SPACE_CLASS = nItem('--left-half-space');
32
+ var RIGHT_SPACE_CLASS = nItem('--right-space');
33
+ var defaultFabProps = {
34
+ type: 'primary'
35
+ };
36
+
37
+ function render(_ctx, _cache) {
38
+ var _component_var_button = (0, _vue.resolveComponent)("var-button");
39
+
40
+ return (0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
41
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), [_ctx.fixed, _ctx.n('--fixed')], [_ctx.border, _ctx.n('--border')])),
42
+ ref: "bottomNavigationDom",
43
+ style: (0, _vue.normalizeStyle)("z-index:" + _ctx.zIndex)
44
+ }, [(0, _vue.renderSlot)(_ctx.$slots, "default"), _ctx.$slots.fab ? ((0, _vue.openBlock)(), (0, _vue.createBlock)(_component_var_button, (0, _vue.mergeProps)({
45
+ key: 0,
46
+ class: _ctx.classes(_ctx.n('fab'), [_ctx.length % 2, _ctx.n('--fab-right'), _ctx.n('--fab-center')]),
47
+ "var-bottom-navigation__fab": "",
48
+ onClick: _ctx.handleFabClick
49
+ }, _ctx.fabProps, {
50
+ round: ""
51
+ }), {
52
+ default: (0, _vue.withCtx)(() => [(0, _vue.renderSlot)(_ctx.$slots, "fab")]),
53
+ _: 3
54
+ /* FORWARDED */
55
+
56
+ }, 16
57
+ /* FULL_PROPS */
58
+ , ["class", "onClick"])) : (0, _vue.createCommentVNode)("v-if", true)], 6
59
+ /* CLASS, STYLE */
60
+ );
61
+ }
62
+
63
+ var _default = (0, _vue.defineComponent)({
64
+ render,
65
+ name: 'VarBottomNavigation',
66
+ components: {
67
+ VarButton: _button.default
68
+ },
69
+ props: _props.props,
70
+
71
+ setup(props, _ref) {
72
+ var {
73
+ slots
74
+ } = _ref;
75
+ var bottomNavigationDom = (0, _vue.ref)(null);
76
+ var active = (0, _vue.computed)(() => props.active);
77
+ var activeColor = (0, _vue.computed)(() => props.activeColor);
78
+ var inactiveColor = (0, _vue.computed)(() => props.inactiveColor);
79
+ var fabProps = (0, _vue.ref)({});
80
+ var {
81
+ length,
82
+ bottomNavigationItems,
83
+ bindBottomNavigationItem
84
+ } = (0, _provide.useBottomNavigationItems)();
85
+
86
+ var matchBoundary = () => {
87
+ if (length.value === 0 || matchName() || matchIndex()) {
88
+ return;
89
+ }
90
+
91
+ handleActiveIndex();
92
+ };
93
+
94
+ var matchName = () => {
95
+ return bottomNavigationItems.find(_ref2 => {
96
+ var {
97
+ name
98
+ } = _ref2;
99
+ return active.value === name.value;
100
+ });
101
+ };
102
+
103
+ var matchIndex = () => {
104
+ return bottomNavigationItems.find(_ref3 => {
105
+ var {
106
+ index
107
+ } = _ref3;
108
+ return active.value === index.value;
109
+ });
110
+ };
111
+
112
+ var handleActiveIndex = () => {
113
+ if (!(0, _shared.isNumber)(active.value)) {
114
+ return;
115
+ }
116
+
117
+ if (active.value < 0) {
118
+ (0, _components.call)(props['onUpdate:active'], 0);
119
+ } else if (active.value > length.value - 1) {
120
+ (0, _components.call)(props['onUpdate:active'], length.value - 1);
121
+ }
122
+ };
123
+
124
+ var onToggle = changedValue => {
125
+ props.onBeforeChange ? handleBeforeChange(changedValue) : handleChange(changedValue);
126
+ };
127
+
128
+ var handleBeforeChange = changedValue => {
129
+ Promise.resolve((0, _components.call)(props.onBeforeChange, changedValue)).then(res => res && handleChange(changedValue));
130
+ };
131
+
132
+ var handleChange = changedValue => {
133
+ (0, _components.call)(props['onUpdate:active'], changedValue);
134
+ (0, _components.call)(props.onChange, changedValue);
135
+ };
136
+
137
+ var removeMarginClass = () => {
138
+ var bottomNavigationItems = getBottomNavigationItems();
139
+ bottomNavigationItems.forEach(dom => {
140
+ dom.classList.remove(RIGHT_HALF_SPACE_CLASS, LEFT_HALF_SPACE_CLASS, RIGHT_SPACE_CLASS);
141
+ });
142
+ };
143
+
144
+ var addMarginClass = length => {
145
+ var bottomNavigationItems = getBottomNavigationItems();
146
+ var itemsNum = bottomNavigationItems.length;
147
+ var isEven = length % 2 === 0;
148
+ bottomNavigationItems.forEach((bottomNavigationItem, i) => {
149
+ handleMarginClass(isEven, bottomNavigationItem, i, itemsNum);
150
+ });
151
+ };
152
+
153
+ var handleMarginClass = (isEven, dom, i, length) => {
154
+ var isLast = i === length - 1;
155
+
156
+ if (!isEven && isLast) {
157
+ dom.classList.add(RIGHT_SPACE_CLASS);
158
+ return;
159
+ }
160
+
161
+ var isFabLeft = i === length / 2 - 1;
162
+ var isFabRight = i === length / 2;
163
+
164
+ if (isFabLeft) {
165
+ dom.classList.add(RIGHT_HALF_SPACE_CLASS);
166
+ } else if (isFabRight) {
167
+ dom.classList.add(LEFT_HALF_SPACE_CLASS);
168
+ }
169
+ };
170
+
171
+ var getBottomNavigationItems = () => {
172
+ return Array.from(bottomNavigationDom.value.querySelectorAll("." + nItem()));
173
+ };
174
+
175
+ var handleFabClick = () => {
176
+ (0, _components.call)(props.onFabClick);
177
+ };
178
+
179
+ var bottomNavigationProvider = {
180
+ active,
181
+ activeColor,
182
+ inactiveColor,
183
+ onToggle
184
+ };
185
+ bindBottomNavigationItem(bottomNavigationProvider);
186
+ (0, _vue.watch)(() => length.value, matchBoundary);
187
+ (0, _vue.watch)(() => props.fabProps, newValue => {
188
+ fabProps.value = _extends({}, defaultFabProps, newValue);
189
+ }, {
190
+ immediate: true,
191
+ deep: true
192
+ });
193
+ (0, _vue.onMounted)(() => {
194
+ if (!slots.fab) {
195
+ return;
196
+ }
197
+
198
+ addMarginClass(length.value);
199
+ });
200
+ (0, _vue.onUpdated)(() => {
201
+ removeMarginClass();
202
+
203
+ if (!slots.fab) {
204
+ return;
205
+ }
206
+
207
+ addMarginClass(length.value);
208
+ });
209
+ return {
210
+ n,
211
+ classes,
212
+ length,
213
+ bottomNavigationDom,
214
+ handleFabClick,
215
+ fabProps
216
+ };
217
+ }
218
+
219
+ });
220
+
221
+ exports.default = _default;
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,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports._BottomNavigationComponent = void 0;
5
+
6
+ var _BottomNavigation = _interopRequireDefault(require("./BottomNavigation.js"));
7
+
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+
10
+ _BottomNavigation.default.install = function (app) {
11
+ app.component(_BottomNavigation.default.name, _BottomNavigation.default);
12
+ };
13
+
14
+ var _BottomNavigationComponent = _BottomNavigation.default;
15
+ exports._BottomNavigationComponent = _BottomNavigationComponent;
16
+ var _default = _BottomNavigation.default;
17
+ exports.default = _default;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.props = void 0;
5
+ var props = {
6
+ active: {
7
+ type: [Number, String],
8
+ default: 0
9
+ },
10
+ fixed: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ border: {
15
+ type: Boolean,
16
+ default: false
17
+ },
18
+ zIndex: {
19
+ type: [Number, String],
20
+ default: 1
21
+ },
22
+ activeColor: {
23
+ type: String
24
+ },
25
+ inactiveColor: {
26
+ type: String
27
+ },
28
+ onChange: {
29
+ type: Function
30
+ },
31
+ 'onUpdate:active': {
32
+ type: Function
33
+ },
34
+ onBeforeChange: {
35
+ type: Function
36
+ },
37
+ onFabClick: {
38
+ type: Function
39
+ },
40
+ fabProps: {
41
+ type: [Object],
42
+ default: {}
43
+ }
44
+ };
45
+ exports.props = props;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY = exports.BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY = void 0;
5
+ exports.useBottomNavigationItems = useBottomNavigationItems;
6
+
7
+ var _components = require("../utils/components");
8
+
9
+ var BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY = Symbol('BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY');
10
+ exports.BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY = BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY;
11
+ var BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY = Symbol('BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY');
12
+ exports.BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY = BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY;
13
+
14
+ function useBottomNavigationItems() {
15
+ var {
16
+ childProviders,
17
+ bindChildren
18
+ } = (0, _components.useChildren)(BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY);
19
+ var {
20
+ length
21
+ } = (0, _components.useAtChildrenCounter)(BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY);
22
+ return {
23
+ length,
24
+ bottomNavigationItems: childProviders,
25
+ bindBottomNavigationItem: bindChildren
26
+ };
27
+ }
@@ -0,0 +1,4 @@
1
+ require('../../styles/common.css')
2
+ require('../../button/button.css')
3
+ require('../bottomNavigation.css')
4
+ require('../BottomNavigationSfc.css')
@@ -0,0 +1,4 @@
1
+ require('../../styles/common.less')
2
+ require('../../button/button.less')
3
+ require('../bottomNavigation.less')
4
+ require('../BottomNavigationSfc.less')
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ exports.render = render;
6
+
7
+ var _ripple = _interopRequireDefault(require("../ripple"));
8
+
9
+ var _badge = _interopRequireDefault(require("../badge"));
10
+
11
+ var _icon = _interopRequireDefault(require("../icon"));
12
+
13
+ var _vue = require("vue");
14
+
15
+ var _props = require("./props");
16
+
17
+ var _provide = require("./provide");
18
+
19
+ var _components = require("../utils/components");
20
+
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+
23
+ var {
24
+ n,
25
+ classes
26
+ } = (0, _components.createNamespace)('bottom-navigation-item');
27
+ var defaultBadgeProps = {
28
+ type: 'danger',
29
+ dot: true
30
+ };
31
+
32
+ function render(_ctx, _cache) {
33
+ var _component_var_icon = (0, _vue.resolveComponent)("var-icon");
34
+
35
+ var _component_var_badge = (0, _vue.resolveComponent)("var-badge");
36
+
37
+ var _directive_ripple = (0, _vue.resolveDirective)("ripple");
38
+
39
+ return (0, _vue.withDirectives)(((0, _vue.openBlock)(), (0, _vue.createElementBlock)("button", {
40
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), [_ctx.active === _ctx.index || _ctx.active === _ctx.name, _ctx.n('--active')])),
41
+ style: (0, _vue.normalizeStyle)({
42
+ color: _ctx.computeColorStyle()
43
+ }),
44
+ onClick: _cache[0] || (_cache[0] = function () {
45
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
46
+ })
47
+ }, [_ctx.icon && !_ctx.$slots.icon ? ((0, _vue.openBlock)(), (0, _vue.createBlock)(_component_var_icon, {
48
+ key: 0,
49
+ name: _ctx.icon,
50
+ namespace: _ctx.namespace,
51
+ class: (0, _vue.normalizeClass)(_ctx.n('icon')),
52
+ "var-bottom-navigation-item-cover": ""
53
+ }, null, 8
54
+ /* PROPS */
55
+ , ["name", "namespace", "class"])) : (0, _vue.createCommentVNode)("v-if", true), (0, _vue.renderSlot)(_ctx.$slots, "icon", {
56
+ active: _ctx.active === _ctx.index || _ctx.active === _ctx.name
57
+ }), _ctx.badge ? ((0, _vue.openBlock)(), (0, _vue.createBlock)(_component_var_badge, (0, _vue.mergeProps)({
58
+ key: 1
59
+ }, _ctx.badgeProps, {
60
+ class: _ctx.n('badge'),
61
+ "var-bottom-navigation-item-cover": ""
62
+ }), null, 16
63
+ /* FULL_PROPS */
64
+ , ["class"])) : (0, _vue.createCommentVNode)("v-if", true), (0, _vue.createElementVNode)("span", {
65
+ class: (0, _vue.normalizeClass)(_ctx.n('label'))
66
+ }, [!_ctx.$slots.default ? ((0, _vue.openBlock)(), (0, _vue.createElementBlock)(_vue.Fragment, {
67
+ key: 0
68
+ }, [(0, _vue.createTextVNode)((0, _vue.toDisplayString)(_ctx.label), 1
69
+ /* TEXT */
70
+ )], 2112
71
+ /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
72
+ )) : (0, _vue.createCommentVNode)("v-if", true), (0, _vue.renderSlot)(_ctx.$slots, "default")], 2
73
+ /* CLASS */
74
+ )], 6
75
+ /* CLASS, STYLE */
76
+ )), [[_directive_ripple]]);
77
+ }
78
+
79
+ var _default = (0, _vue.defineComponent)({
80
+ render,
81
+ name: 'VarBottomNavigationItem',
82
+ components: {
83
+ VarBadge: _badge.default,
84
+ VarIcon: _icon.default
85
+ },
86
+ directives: {
87
+ Ripple: _ripple.default
88
+ },
89
+ props: _props.props,
90
+
91
+ setup(props) {
92
+ var name = (0, _vue.computed)(() => props.name);
93
+ var badge = (0, _vue.computed)(() => props.badge);
94
+ var badgeProps = (0, _vue.ref)({});
95
+ var {
96
+ index,
97
+ bottomNavigation,
98
+ bindBottomNavigation
99
+ } = (0, _provide.useBottomNavigation)();
100
+ var {
101
+ active,
102
+ activeColor,
103
+ inactiveColor
104
+ } = bottomNavigation;
105
+ var bottomNavigationItemProvider = {
106
+ name,
107
+ index
108
+ };
109
+
110
+ var computeColorStyle = () => {
111
+ return active.value === name.value || active.value === index.value ? activeColor.value : inactiveColor.value;
112
+ };
113
+
114
+ var handleClick = () => {
115
+ var active = name.value || index.value;
116
+ (0, _components.call)(props.onClick, active);
117
+ (0, _components.call)(bottomNavigation.onToggle, active);
118
+ };
119
+
120
+ bindBottomNavigation(bottomNavigationItemProvider);
121
+ (0, _vue.watch)(() => badge.value, newValue => {
122
+ badgeProps.value = newValue === true ? defaultBadgeProps : badge.value;
123
+ }, {
124
+ immediate: true
125
+ });
126
+ return {
127
+ n,
128
+ classes,
129
+ index,
130
+ active,
131
+ badge,
132
+ badgeProps,
133
+ computeColorStyle,
134
+ handleClick
135
+ };
136
+ }
137
+
138
+ });
139
+
140
+ exports.default = _default;
@@ -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,17 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = exports._BottomNavigationItemComponent = void 0;
5
+
6
+ var _BottomNavigationItem = _interopRequireDefault(require("./BottomNavigationItem.js"));
7
+
8
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+
10
+ _BottomNavigationItem.default.install = function (app) {
11
+ app.component(_BottomNavigationItem.default.name, _BottomNavigationItem.default);
12
+ };
13
+
14
+ var _BottomNavigationItemComponent = _BottomNavigationItem.default;
15
+ exports._BottomNavigationItemComponent = _BottomNavigationItemComponent;
16
+ var _default = _BottomNavigationItem.default;
17
+ exports.default = _default;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.props = void 0;
5
+ var props = {
6
+ name: {
7
+ type: String
8
+ },
9
+ icon: {
10
+ type: String
11
+ },
12
+ label: {
13
+ type: String
14
+ },
15
+ namespace: {
16
+ type: String,
17
+ default: 'var-icon'
18
+ },
19
+ badge: {
20
+ type: [Boolean, Object],
21
+ default: false
22
+ },
23
+ onClick: {
24
+ type: Function
25
+ }
26
+ };
27
+ exports.props = props;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useBottomNavigation = useBottomNavigation;
5
+
6
+ var _components = require("../utils/components");
7
+
8
+ var _provide = require("../bottom-navigation/provide");
9
+
10
+ function useBottomNavigation() {
11
+ var {
12
+ parentProvider,
13
+ bindParent
14
+ } = (0, _components.useParent)(_provide.BOTTOM_NAVIGATION_BIND_BOTTOM_NAVIGATION_ITEM_KEY);
15
+ var {
16
+ index
17
+ } = (0, _components.useAtParentIndex)(_provide.BOTTOM_NAVIGATION_COUNT_BOTTOM_NAVIGATION_ITEM_KEY);
18
+
19
+ if (!parentProvider || !bindParent || !index) {
20
+ throw Error('<var-bottom-navigation-item/> must in <var-bottom-navigation/>');
21
+ }
22
+
23
+ return {
24
+ index,
25
+ bottomNavigation: parentProvider,
26
+ bindBottomNavigation: bindParent
27
+ };
28
+ }