@varlet/ui 1.26.8 → 1.27.0-alpha.1649242923701

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 (245) hide show
  1. package/es/action-sheet/ActionSheet.js +29 -27
  2. package/es/app-bar/AppBar.js +32 -27
  3. package/es/back-top/BackTop.js +9 -2
  4. package/es/badge/Badge.js +22 -14
  5. package/es/bottom-navigation/BottomNavigation.js +167 -0
  6. package/es/bottom-navigation/BottomNavigationSfc.css +0 -0
  7. package/es/bottom-navigation/BottomNavigationSfc.less +0 -0
  8. package/es/bottom-navigation/bottomNavigation.css +1 -0
  9. package/es/bottom-navigation/bottomNavigation.less +49 -0
  10. package/es/bottom-navigation/index.js +8 -0
  11. package/es/bottom-navigation/props.js +40 -0
  12. package/es/bottom-navigation/provide.js +17 -0
  13. package/es/bottom-navigation/style/index.js +4 -0
  14. package/es/bottom-navigation/style/less.js +4 -0
  15. package/es/bottom-navigation-item/BottomNavigationItem.js +122 -0
  16. package/es/bottom-navigation-item/BottomNavigationItemSfc.css +0 -0
  17. package/es/bottom-navigation-item/BottomNavigationItemSfc.less +0 -0
  18. package/es/bottom-navigation-item/bottomNavigationItem.css +1 -0
  19. package/es/bottom-navigation-item/bottomNavigationItem.less +78 -0
  20. package/es/bottom-navigation-item/index.js +8 -0
  21. package/es/bottom-navigation-item/props.js +22 -0
  22. package/es/bottom-navigation-item/provide.js +21 -0
  23. package/es/bottom-navigation-item/style/index.js +6 -0
  24. package/es/bottom-navigation-item/style/less.js +6 -0
  25. package/es/button/Button.js +12 -5
  26. package/es/card/Card.js +33 -28
  27. package/es/cell/Cell.js +26 -15
  28. package/es/checkbox/Checkbox.js +28 -26
  29. package/es/checkbox-group/CheckboxGroup.js +21 -25
  30. package/es/chip/Chip.js +16 -7
  31. package/es/chip/chip.css +1 -1
  32. package/es/chip/chip.less +11 -11
  33. package/es/col/Col.js +12 -5
  34. package/es/collapse/Collapse.js +15 -12
  35. package/es/collapse-item/CollapseItem.js +31 -30
  36. package/es/collapse-item/collapseItem.css +1 -1
  37. package/es/collapse-item/collapseItem.less +16 -16
  38. package/es/countdown/Countdown.js +14 -11
  39. package/es/counter/Counter.js +30 -27
  40. package/es/date-picker/DatePicker.js +28 -23
  41. package/es/date-picker/date-picker.css +1 -1
  42. package/es/date-picker/date-picker.less +22 -20
  43. package/es/date-picker/src/day-picker-panel.js +41 -34
  44. package/es/date-picker/src/month-picker-panel.js +27 -21
  45. package/es/date-picker/src/panel-header.js +16 -11
  46. package/es/date-picker/src/year-picker-panel.js +17 -9
  47. package/es/dialog/Dialog.js +36 -40
  48. package/es/divider/Divider.js +16 -12
  49. package/es/form/Form.js +11 -8
  50. package/es/form-details/FormDetails.js +27 -22
  51. package/es/icon/Icon.js +8 -1
  52. package/es/icon/icon.css +1 -1
  53. package/es/image/Image.js +19 -12
  54. package/es/image-preview/ImagePreview.js +35 -34
  55. package/es/index-anchor/IndexAnchor.js +8 -1
  56. package/es/index-bar/IndexBar.js +22 -20
  57. package/es/index.js +10 -0
  58. package/es/input/Input.js +45 -44
  59. package/es/lazy/index.js +2 -1
  60. package/es/less.js +2 -0
  61. package/es/list/List.js +39 -38
  62. package/es/loading/Loading.js +31 -23
  63. package/es/loading/loading.css +1 -1
  64. package/es/loading/loading.less +32 -32
  65. package/es/menu/Menu.js +12 -10
  66. package/es/option/Option.js +16 -11
  67. package/es/pagination/Pagination.js +34 -44
  68. package/es/pagination/pagination.css +1 -1
  69. package/es/pagination/pagination.less +8 -8
  70. package/es/picker/Picker.js +51 -47
  71. package/es/popup/Popup.js +9 -5
  72. package/es/progress/Progress.js +44 -35
  73. package/es/progress/progress.css +1 -1
  74. package/es/progress/progress.less +12 -12
  75. package/es/pull-refresh/PullRefresh.js +13 -10
  76. package/es/radio/Radio.js +25 -25
  77. package/es/radio-group/RadioGroup.js +19 -19
  78. package/es/rate/Rate.js +27 -25
  79. package/es/ripple/index.js +6 -2
  80. package/es/row/Row.js +11 -4
  81. package/es/select/Select.js +53 -54
  82. package/es/skeleton/Skeleton.js +70 -81
  83. package/es/slider/Slider.js +44 -40
  84. package/es/slider/slider.css +1 -1
  85. package/es/slider/slider.less +5 -5
  86. package/es/snackbar/Snackbar.js +9 -5
  87. package/es/snackbar/core.js +20 -26
  88. package/es/snackbar/snackbar.css +1 -1
  89. package/es/snackbar/snackbar.less +66 -68
  90. package/es/space/Space.js +8 -3
  91. package/es/step/Step.js +25 -23
  92. package/es/step/step.css +1 -1
  93. package/es/step/step.less +10 -10
  94. package/es/steps/Steps.js +12 -5
  95. package/es/sticky/Sticky.js +14 -7
  96. package/es/style-provider/StyleProvider.js +6 -2
  97. package/es/style.css +1 -1
  98. package/es/style.js +2 -0
  99. package/es/swipe/Swipe.js +22 -16
  100. package/es/swipe-item/SwipeItem.js +9 -4
  101. package/es/switch/Switch.js +25 -23
  102. package/es/switch/switch.css +1 -1
  103. package/es/switch/switch.less +2 -2
  104. package/es/tab/Tab.js +8 -1
  105. package/es/tab-item/TabItem.js +8 -1
  106. package/es/table/Table.js +27 -20
  107. package/es/tabs/Tabs.js +16 -11
  108. package/es/tabs-items/TabsItems.js +10 -5
  109. package/es/themes/dark/bottomNavigation.js +4 -0
  110. package/es/themes/dark/bottomNavigationItem.js +3 -0
  111. package/es/themes/dark/index.js +3 -1
  112. package/es/time-picker/TimePicker.js +47 -38
  113. package/es/time-picker/clock.js +26 -22
  114. package/es/time-picker/timePicker.css +1 -1
  115. package/es/time-picker/timePicker.less +11 -11
  116. package/es/umdIndex.js +10 -0
  117. package/es/uploader/Uploader.js +62 -57
  118. package/es/utils/components.js +35 -0
  119. package/es/varlet.esm.js +2082 -1527
  120. package/highlight/attributes.json +48 -0
  121. package/highlight/tags.json +20 -0
  122. package/highlight/web-types.json +155 -1
  123. package/lib/action-sheet/ActionSheet.js +30 -26
  124. package/lib/app-bar/AppBar.js +31 -24
  125. package/lib/back-top/BackTop.js +11 -2
  126. package/lib/badge/Badge.js +23 -13
  127. package/lib/bottom-navigation/BottomNavigation.js +183 -0
  128. package/lib/bottom-navigation/BottomNavigationSfc.css +0 -0
  129. package/lib/bottom-navigation/BottomNavigationSfc.less +0 -0
  130. package/lib/bottom-navigation/bottomNavigation.css +1 -0
  131. package/lib/bottom-navigation/bottomNavigation.less +49 -0
  132. package/lib/bottom-navigation/index.js +17 -0
  133. package/lib/bottom-navigation/props.js +45 -0
  134. package/lib/bottom-navigation/provide.js +27 -0
  135. package/lib/bottom-navigation/style/index.js +4 -0
  136. package/lib/bottom-navigation/style/less.js +4 -0
  137. package/lib/bottom-navigation-item/BottomNavigationItem.js +140 -0
  138. package/lib/bottom-navigation-item/BottomNavigationItemSfc.css +0 -0
  139. package/lib/bottom-navigation-item/BottomNavigationItemSfc.less +0 -0
  140. package/lib/bottom-navigation-item/bottomNavigationItem.css +1 -0
  141. package/lib/bottom-navigation-item/bottomNavigationItem.less +78 -0
  142. package/lib/bottom-navigation-item/index.js +17 -0
  143. package/lib/bottom-navigation-item/props.js +27 -0
  144. package/lib/bottom-navigation-item/provide.js +28 -0
  145. package/lib/bottom-navigation-item/style/index.js +6 -0
  146. package/lib/bottom-navigation-item/style/less.js +6 -0
  147. package/lib/button/Button.js +13 -4
  148. package/lib/card/Card.js +34 -27
  149. package/lib/cell/Cell.js +26 -13
  150. package/lib/checkbox/Checkbox.js +26 -23
  151. package/lib/checkbox-group/CheckboxGroup.js +19 -22
  152. package/lib/chip/Chip.js +18 -7
  153. package/lib/chip/chip.css +1 -1
  154. package/lib/chip/chip.less +11 -11
  155. package/lib/col/Col.js +14 -5
  156. package/lib/collapse/Collapse.js +15 -10
  157. package/lib/collapse-item/CollapseItem.js +31 -28
  158. package/lib/collapse-item/collapseItem.css +1 -1
  159. package/lib/collapse-item/collapseItem.less +16 -16
  160. package/lib/countdown/Countdown.js +14 -10
  161. package/lib/counter/Counter.js +29 -26
  162. package/lib/date-picker/DatePicker.js +30 -23
  163. package/lib/date-picker/date-picker.css +1 -1
  164. package/lib/date-picker/date-picker.less +22 -20
  165. package/lib/date-picker/src/day-picker-panel.js +41 -32
  166. package/lib/date-picker/src/month-picker-panel.js +27 -19
  167. package/lib/date-picker/src/panel-header.js +16 -9
  168. package/lib/date-picker/src/year-picker-panel.js +19 -9
  169. package/lib/dialog/Dialog.js +36 -38
  170. package/lib/divider/Divider.js +16 -10
  171. package/lib/form/Form.js +11 -6
  172. package/lib/form-details/FormDetails.js +27 -20
  173. package/lib/icon/Icon.js +10 -1
  174. package/lib/icon/icon.css +1 -1
  175. package/lib/image/Image.js +20 -11
  176. package/lib/image-preview/ImagePreview.js +35 -33
  177. package/lib/index-anchor/IndexAnchor.js +10 -1
  178. package/lib/index-bar/IndexBar.js +24 -20
  179. package/lib/index.js +6 -0
  180. package/lib/input/Input.js +45 -43
  181. package/lib/lazy/index.js +3 -1
  182. package/lib/less.js +2 -0
  183. package/lib/list/List.js +39 -36
  184. package/lib/loading/Loading.js +33 -23
  185. package/lib/loading/loading.css +1 -1
  186. package/lib/loading/loading.less +32 -32
  187. package/lib/menu/Menu.js +12 -9
  188. package/lib/option/Option.js +16 -9
  189. package/lib/pagination/Pagination.js +36 -44
  190. package/lib/pagination/pagination.css +1 -1
  191. package/lib/pagination/pagination.less +8 -8
  192. package/lib/picker/Picker.js +51 -46
  193. package/lib/popup/Popup.js +9 -4
  194. package/lib/progress/Progress.js +45 -34
  195. package/lib/progress/progress.css +1 -1
  196. package/lib/progress/progress.less +12 -12
  197. package/lib/pull-refresh/PullRefresh.js +14 -10
  198. package/lib/radio/Radio.js +23 -22
  199. package/lib/radio-group/RadioGroup.js +17 -16
  200. package/lib/rate/Rate.js +27 -24
  201. package/lib/ripple/index.js +7 -2
  202. package/lib/row/Row.js +12 -3
  203. package/lib/select/Select.js +53 -53
  204. package/lib/skeleton/Skeleton.js +69 -78
  205. package/lib/slider/Slider.js +42 -38
  206. package/lib/slider/slider.css +1 -1
  207. package/lib/slider/slider.less +5 -5
  208. package/lib/snackbar/Snackbar.js +9 -4
  209. package/lib/snackbar/core.js +20 -25
  210. package/lib/snackbar/snackbar.css +1 -1
  211. package/lib/snackbar/snackbar.less +66 -68
  212. package/lib/space/Space.js +9 -3
  213. package/lib/step/Step.js +26 -22
  214. package/lib/step/step.css +1 -1
  215. package/lib/step/step.less +10 -10
  216. package/lib/steps/Steps.js +13 -4
  217. package/lib/sticky/Sticky.js +15 -6
  218. package/lib/style-provider/StyleProvider.js +8 -2
  219. package/lib/style.css +1 -1
  220. package/lib/style.js +2 -0
  221. package/lib/swipe/Swipe.js +23 -16
  222. package/lib/swipe-item/SwipeItem.js +10 -3
  223. package/lib/switch/Switch.js +23 -20
  224. package/lib/switch/switch.css +1 -1
  225. package/lib/switch/switch.less +2 -2
  226. package/lib/tab/Tab.js +10 -1
  227. package/lib/tab-item/TabItem.js +10 -1
  228. package/lib/table/Table.js +27 -18
  229. package/lib/tabs/Tabs.js +18 -11
  230. package/lib/tabs-items/TabsItems.js +11 -4
  231. package/lib/themes/dark/bottomNavigation.js +9 -0
  232. package/lib/themes/dark/bottomNavigationItem.js +8 -0
  233. package/lib/themes/dark/index.js +5 -1
  234. package/lib/time-picker/TimePicker.js +49 -38
  235. package/lib/time-picker/clock.js +26 -20
  236. package/lib/time-picker/timePicker.css +1 -1
  237. package/lib/time-picker/timePicker.less +11 -11
  238. package/lib/uploader/Uploader.js +60 -55
  239. package/lib/utils/components.js +39 -0
  240. package/package.json +4 -4
  241. package/types/bottomNavigation.d.ts +19 -0
  242. package/types/bottomNavigationItem.d.ts +16 -0
  243. package/types/global.d.ts +2 -0
  244. package/types/index.d.ts +2 -0
  245. package/umd/varlet.js +4 -4
@@ -0,0 +1,183 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.default = void 0;
5
+ exports.render = render;
6
+
7
+ var _vue = require("vue");
8
+
9
+ var _props = require("./props");
10
+
11
+ var _button = _interopRequireDefault(require("../button"));
12
+
13
+ var _provide = require("./provide");
14
+
15
+ var _components = require("../utils/components");
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ 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); }
20
+
21
+ var {
22
+ n,
23
+ classes
24
+ } = (0, _components.createNamespace)('bottom-navigation');
25
+ var {
26
+ n: nItem
27
+ } = (0, _components.createNamespace)('bottom-navigation-item');
28
+ var RIGHT_HALF_SPACE_CLASS = nItem('--right-half-space');
29
+ var LEFT_HALF_SPACE_CLASS = nItem('--left-half-space');
30
+ var RIGHT_SPACE_CLASS = nItem('--right-space');
31
+ var defaultFabProps = {
32
+ type: 'primary'
33
+ };
34
+
35
+ function render(_ctx, _cache) {
36
+ var _component_var_button = (0, _vue.resolveComponent)("var-button");
37
+
38
+ return (0, _vue.openBlock)(), (0, _vue.createElementBlock)("div", {
39
+ class: (0, _vue.normalizeClass)(_ctx.classes(_ctx.n(), [_ctx.fixed, _ctx.n('--fixed')], [_ctx.border, _ctx.n('--border')])),
40
+ ref: "bottomNavigationDom",
41
+ style: (0, _vue.normalizeStyle)("z-index:" + _ctx.zIndex)
42
+ }, [(0, _vue.renderSlot)(_ctx.$slots, "default"), _ctx.$slots.fab ? ((0, _vue.openBlock)(), (0, _vue.createBlock)(_component_var_button, (0, _vue.mergeProps)({
43
+ key: 0,
44
+ class: _ctx.classes(_ctx.n('fab'), [_ctx.length % 2, _ctx.n('--fab-right'), _ctx.n('--fab-center')]),
45
+ "var-bottom-navigation__fab": "",
46
+ onClick: _ctx.handleFabClick
47
+ }, _ctx.fabProps, {
48
+ round: ""
49
+ }), {
50
+ default: (0, _vue.withCtx)(() => [(0, _vue.renderSlot)(_ctx.$slots, "fab")]),
51
+ _: 3
52
+ /* FORWARDED */
53
+
54
+ }, 16
55
+ /* FULL_PROPS */
56
+ , ["class", "onClick"])) : (0, _vue.createCommentVNode)("v-if", true)], 6
57
+ /* CLASS, STYLE */
58
+ );
59
+ }
60
+
61
+ var _default = (0, _vue.defineComponent)({
62
+ render,
63
+ name: 'VarBottomNavigation',
64
+ components: {
65
+ VarButton: _button.default
66
+ },
67
+ props: _props.props,
68
+
69
+ setup(props, _ref) {
70
+ var {
71
+ slots
72
+ } = _ref;
73
+ var bottomNavigationDom = (0, _vue.ref)(null);
74
+ var active = (0, _vue.computed)(() => props.modelValue);
75
+ var activeColor = (0, _vue.computed)(() => props.activeColor);
76
+ var inactiveColor = (0, _vue.computed)(() => props.inactiveColor);
77
+ var fabProps = (0, _vue.ref)({});
78
+
79
+ var onToggle = changedValue => {
80
+ if (props.onBeforeChange) {
81
+ handleBeforeChange(changedValue);
82
+ } else {
83
+ handleChange(changedValue);
84
+ }
85
+ };
86
+
87
+ var handleBeforeChange = changedValue => {
88
+ Promise.resolve((0, _components.call)(props.onBeforeChange, changedValue)).then(res => {
89
+ if (res) {
90
+ handleChange(changedValue);
91
+ }
92
+ });
93
+ };
94
+
95
+ var handleChange = changedValue => {
96
+ (0, _components.call)(props['onUpdate:modelValue'], changedValue);
97
+ (0, _components.call)(props.onChange, changedValue);
98
+ };
99
+
100
+ var {
101
+ length,
102
+ bindBottomNavigationItem
103
+ } = (0, _provide.useBottomNavigationItems)();
104
+
105
+ var removeMarginClass = () => {
106
+ var bottomNavigationItems = getBottomNavigationItems();
107
+ bottomNavigationItems.forEach(dom => {
108
+ dom.classList.remove(RIGHT_HALF_SPACE_CLASS, LEFT_HALF_SPACE_CLASS, RIGHT_SPACE_CLASS);
109
+ });
110
+ };
111
+
112
+ var addMarginClass = length => {
113
+ var bottomNavigationItems = getBottomNavigationItems();
114
+ var itemsNum = bottomNavigationItems.length;
115
+ var isEven = length % 2 === 0;
116
+ bottomNavigationItems.forEach((bottomNavigationItem, i) => {
117
+ handleMarginClass(isEven, bottomNavigationItem, i, itemsNum);
118
+ });
119
+ };
120
+
121
+ var handleMarginClass = (isEven, dom, i, length) => {
122
+ var isLast = i === length - 1;
123
+
124
+ if (!isEven && isLast) {
125
+ dom.classList.add(RIGHT_SPACE_CLASS);
126
+ return;
127
+ }
128
+
129
+ var isFabLeft = i === length / 2 - 1;
130
+ var isFabRight = i === length / 2;
131
+
132
+ if (isFabLeft) {
133
+ dom.classList.add(RIGHT_HALF_SPACE_CLASS);
134
+ } else if (isFabRight) {
135
+ dom.classList.add(LEFT_HALF_SPACE_CLASS);
136
+ }
137
+ };
138
+
139
+ var getBottomNavigationItems = () => {
140
+ return Array.from(bottomNavigationDom.value.querySelectorAll("." + nItem()));
141
+ };
142
+
143
+ var handleFabClick = () => {
144
+ (0, _components.call)(props.onFabClick);
145
+ };
146
+
147
+ fabProps.value = _extends({}, defaultFabProps, props.fabProps);
148
+ var bottomNavigationProvider = {
149
+ active,
150
+ activeColor,
151
+ inactiveColor,
152
+ onToggle
153
+ };
154
+ bindBottomNavigationItem(bottomNavigationProvider);
155
+ (0, _vue.onMounted)(() => {
156
+ if (!slots.fab) {
157
+ return;
158
+ }
159
+
160
+ addMarginClass(length.value);
161
+ });
162
+ (0, _vue.onUpdated)(() => {
163
+ removeMarginClass();
164
+
165
+ if (!slots.fab) {
166
+ return;
167
+ }
168
+
169
+ addMarginClass(length.value);
170
+ });
171
+ return {
172
+ n,
173
+ classes,
174
+ length,
175
+ bottomNavigationDom,
176
+ handleFabClick,
177
+ fabProps
178
+ };
179
+ }
180
+
181
+ });
182
+
183
+ 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;}.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 cubic-bezier(0.4, 0, 0.2, 1) 0ms, border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.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: 0;}
@@ -0,0 +1,49 @@
1
+ @bottom-navigation-height: 50px;
2
+ @bottom-navigation-z-index: 1;
3
+ @bottom-navigation-background-color: #fff;
4
+ @bottom-navigation-border-color: #e3e3e3;
5
+
6
+ :root {
7
+ --bottom-navigation-height: @bottom-navigation-height;
8
+ --bottom-navigation-z-index: @bottom-navigation-z-index;
9
+ --bottom-navigation-background-color: @bottom-navigation-background-color;
10
+ --bottom-navigation-border-color: @bottom-navigation-border-color;
11
+ }
12
+
13
+ .var-bottom-navigation {
14
+ width: 100%;
15
+ height: var(--bottom-navigation-height);
16
+ display: flex;
17
+ position: relative;
18
+ background-color: var(--bottom-navigation-background-color);
19
+ transition: background-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms,
20
+ border-color 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
21
+
22
+ &--fixed {
23
+ position: fixed;
24
+ left: 0;
25
+ bottom: 0;
26
+ }
27
+
28
+ &--border {
29
+ border-top: 1px solid var(--bottom-navigation-border-color);
30
+ }
31
+
32
+ &__fab[var-bottom-navigation__fab] {
33
+ width: var(--bottom-navigation-height);
34
+ height: var(--bottom-navigation-height);
35
+ position: absolute;
36
+ z-index: 2;
37
+ transform: translateY(-50%);
38
+ overflow: hidden;
39
+ transition: right 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
40
+ }
41
+
42
+ &--fab-center {
43
+ right: calc(50% - var(--bottom-navigation-height) / 2);
44
+ }
45
+
46
+ &--fab-right {
47
+ right: 0;
48
+ }
49
+ }
@@ -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
+ modelValue: {
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:modelValue': {
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 _vue = require("vue");
8
+
9
+ var _props = require("./props");
10
+
11
+ var _ripple = _interopRequireDefault(require("../ripple"));
12
+
13
+ var _badge = _interopRequireDefault(require("../badge"));
14
+
15
+ var _icon = _interopRequireDefault(require("../icon"));
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
+ bindBottomNavigation(bottomNavigationItemProvider);
110
+
111
+ var computeColorStyle = () => {
112
+ return active.value === name.value || active.value === index.value ? activeColor.value : inactiveColor.value;
113
+ };
114
+
115
+ var handleClick = () => {
116
+ var active = name.value || index.value;
117
+ (0, _components.call)(props.onClick, active);
118
+ (0, _components.call)(bottomNavigation.onToggle, active);
119
+ };
120
+
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 cubic-bezier(0.4, 0, 0.2, 1) 0ms, margin 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.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 cubic-bezier(0.4, 0, 0.2, 1) 0ms;}.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: var(--bottom-navigation-height);}.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 cubic-bezier(0.4, 0, 0.2, 1) 0ms, margin 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
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 cubic-bezier(0.4, 0, 0.2, 1) 0ms;
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: var(--bottom-navigation-height);
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
+ }
@@ -0,0 +1,6 @@
1
+ require('../../styles/common.css')
2
+ require('../../ripple/ripple.css')
3
+ require('../../badge/badge.css')
4
+ require('../../icon/icon.css')
5
+ require('../bottomNavigationItem.css')
6
+ require('../BottomNavigationItemSfc.css')
@@ -0,0 +1,6 @@
1
+ require('../../styles/common.less')
2
+ require('../../ripple/ripple.less')
3
+ require('../../badge/badge.less')
4
+ require('../../icon/icon.less')
5
+ require('../bottomNavigationItem.less')
6
+ require('../BottomNavigationItemSfc.less')