@nextcloud/vue 3.10.2 → 4.1.1

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 (290) hide show
  1. package/CHANGELOG.md +114 -19
  2. package/README.md +9 -10
  3. package/dist/Components/ActionButton.js +24 -3
  4. package/dist/Components/ActionButton.js.map +1 -1
  5. package/dist/Components/ActionCaption.js +23 -0
  6. package/dist/Components/ActionCaption.js.map +1 -0
  7. package/dist/Components/ActionCheckbox.js +24 -3
  8. package/dist/Components/ActionCheckbox.js.map +1 -1
  9. package/dist/Components/ActionInput.js +124 -21
  10. package/dist/Components/ActionInput.js.map +1 -1
  11. package/dist/Components/ActionLink.js +24 -3
  12. package/dist/Components/ActionLink.js.map +1 -1
  13. package/dist/Components/ActionRadio.js +24 -3
  14. package/dist/Components/ActionRadio.js.map +1 -1
  15. package/dist/Components/ActionRouter.js +23 -2
  16. package/dist/Components/ActionRouter.js.map +1 -1
  17. package/dist/Components/ActionSeparator.js +1 -1
  18. package/dist/Components/ActionSeparator.js.map +1 -1
  19. package/dist/Components/ActionText.js +23 -2
  20. package/dist/Components/ActionText.js.map +1 -1
  21. package/dist/Components/ActionTextEditable.js +45 -3
  22. package/dist/Components/ActionTextEditable.js.map +1 -1
  23. package/dist/Components/Actions.js +25 -4
  24. package/dist/Components/Actions.js.map +1 -1
  25. package/dist/Components/AppContent.js +21 -1
  26. package/dist/Components/AppContent.js.map +1 -1
  27. package/dist/Components/AppContentDetails.js +1 -1
  28. package/dist/Components/AppContentDetails.js.map +1 -1
  29. package/dist/Components/AppContentList.js +1 -1
  30. package/dist/Components/AppContentList.js.map +1 -1
  31. package/dist/Components/AppNavigation.js +109 -2
  32. package/dist/Components/AppNavigation.js.map +1 -1
  33. package/dist/Components/AppNavigationCaption.js +66 -1
  34. package/dist/Components/AppNavigationCaption.js.map +1 -1
  35. package/dist/Components/AppNavigationCounter.js +2 -2
  36. package/dist/Components/AppNavigationCounter.js.map +1 -1
  37. package/dist/Components/AppNavigationIconBullet.js +2 -2
  38. package/dist/Components/AppNavigationIconBullet.js.map +1 -1
  39. package/dist/Components/AppNavigationItem.js +49 -7
  40. package/dist/Components/AppNavigationItem.js.map +1 -1
  41. package/dist/Components/AppNavigationNew.js +1 -1
  42. package/dist/Components/AppNavigationNew.js.map +1 -1
  43. package/dist/Components/AppNavigationNewItem.js +2 -2
  44. package/dist/Components/AppNavigationNewItem.js.map +1 -1
  45. package/dist/Components/AppNavigationSettings.js +5 -5
  46. package/dist/Components/AppNavigationSettings.js.map +1 -1
  47. package/dist/Components/AppNavigationSpacer.js +1 -1
  48. package/dist/Components/AppNavigationSpacer.js.map +1 -1
  49. package/dist/Components/AppNavigationToggle.js +109 -2
  50. package/dist/Components/AppNavigationToggle.js.map +1 -1
  51. package/dist/Components/AppSettingsDialog.js +64 -22
  52. package/dist/Components/AppSettingsDialog.js.map +1 -1
  53. package/dist/Components/AppSettingsSection.js +1 -1
  54. package/dist/Components/AppSettingsSection.js.map +1 -1
  55. package/dist/Components/AppSidebar.js +38 -17
  56. package/dist/Components/AppSidebar.js.map +1 -1
  57. package/dist/Components/AppSidebarTab.js +1 -1
  58. package/dist/Components/AppSidebarTab.js.map +1 -1
  59. package/dist/Components/Avatar.js +9 -10
  60. package/dist/Components/Avatar.js.map +1 -1
  61. package/dist/Components/Breadcrumb.js +33 -12
  62. package/dist/Components/Breadcrumb.js.map +1 -1
  63. package/dist/Components/Breadcrumbs.js +59 -17
  64. package/dist/Components/Breadcrumbs.js.map +1 -1
  65. package/dist/Components/CheckboxRadioSwitch.js +44 -0
  66. package/dist/Components/CheckboxRadioSwitch.js.map +1 -0
  67. package/dist/Components/ColorPicker.js +6 -7
  68. package/dist/Components/ColorPicker.js.map +1 -1
  69. package/dist/Components/Content.js +2 -2
  70. package/dist/Components/Content.js.map +1 -1
  71. package/dist/Components/CounterBubble.js +23 -0
  72. package/dist/Components/CounterBubble.js.map +1 -0
  73. package/dist/Components/DatetimePicker.js +341 -3
  74. package/dist/Components/DatetimePicker.js.map +1 -1
  75. package/dist/Components/EmojiPicker.js +14 -14
  76. package/dist/Components/EmojiPicker.js.map +1 -1
  77. package/dist/Components/EmptyContent.js +2 -2
  78. package/dist/Components/EmptyContent.js.map +1 -1
  79. package/dist/Components/Highlight.js +3 -3
  80. package/dist/Components/Highlight.js.map +1 -1
  81. package/dist/Components/ListItem.js +130 -0
  82. package/dist/Components/ListItem.js.map +1 -0
  83. package/dist/Components/ListItemIcon.js +20 -21
  84. package/dist/Components/ListItemIcon.js.map +1 -1
  85. package/dist/Components/Modal.js +53 -11
  86. package/dist/Components/Modal.js.map +1 -1
  87. package/dist/Components/Multiselect.js +22 -23
  88. package/dist/Components/Multiselect.js.map +1 -1
  89. package/dist/Components/MultiselectTags.js +24 -25
  90. package/dist/Components/MultiselectTags.js.map +1 -1
  91. package/dist/Components/Popover.js +2 -2
  92. package/dist/Components/Popover.js.map +1 -1
  93. package/dist/Components/PopoverMenu.js +1 -1
  94. package/dist/Components/PopoverMenu.js.map +1 -1
  95. package/dist/Components/ProgressBar.js +2 -2
  96. package/dist/Components/ProgressBar.js.map +1 -1
  97. package/dist/Components/RichContenteditable.js +2 -2
  98. package/dist/Components/RichContenteditable.js.map +1 -1
  99. package/dist/Components/SettingsInputText.js +22 -1
  100. package/dist/Components/SettingsInputText.js.map +1 -1
  101. package/dist/Components/SettingsSection.js +2 -2
  102. package/dist/Components/SettingsSection.js.map +1 -1
  103. package/dist/Components/SettingsSelectGroup.js +41 -21
  104. package/dist/Components/SettingsSelectGroup.js.map +1 -1
  105. package/dist/Components/TimezonePicker.js +340 -0
  106. package/dist/Components/TimezonePicker.js.map +1 -0
  107. package/dist/Components/UserBubble.js +35 -36
  108. package/dist/Components/UserBubble.js.map +1 -1
  109. package/dist/Directives/Focus.js +1 -1
  110. package/dist/Directives/Focus.js.map +1 -1
  111. package/dist/Directives/Linkify.js +1 -1
  112. package/dist/Directives/Linkify.js.map +1 -1
  113. package/dist/Directives/Tooltip.js +2 -2
  114. package/dist/Directives/Tooltip.js.map +1 -1
  115. package/dist/Functions/usernameToColor.js +2 -3
  116. package/dist/Functions/usernameToColor.js.map +1 -1
  117. package/dist/Mixins/excludeClickOutsideClasses.js +2 -2
  118. package/dist/Mixins/excludeClickOutsideClasses.js.map +1 -1
  119. package/dist/Mixins/isFullscreen.js +1 -1
  120. package/dist/Mixins/isFullscreen.js.map +1 -1
  121. package/dist/Mixins/isMobile.js +1 -1
  122. package/dist/Mixins/isMobile.js.map +1 -1
  123. package/dist/Mixins/richEditor.js +1 -1
  124. package/dist/Mixins/richEditor.js.map +1 -1
  125. package/dist/ncvuecomponents.js +276 -69
  126. package/dist/ncvuecomponents.js.map +1 -1
  127. package/package.json +28 -43
  128. package/src/assets/action.scss +0 -132
  129. package/src/assets/iconfont/README.md +0 -30
  130. package/src/assets/iconfont/arrow-left-double.svg +0 -3
  131. package/src/assets/iconfont/arrow-left.svg +0 -3
  132. package/src/assets/iconfont/arrow-right-double.svg +0 -3
  133. package/src/assets/iconfont/arrow-right.svg +0 -3
  134. package/src/assets/iconfont/breadcrumb.svg +0 -1
  135. package/src/assets/iconfont/checkmark.svg +0 -1
  136. package/src/assets/iconfont/close.svg +0 -1
  137. package/src/assets/iconfont/confirm.svg +0 -1
  138. package/src/assets/iconfont/info.svg +0 -1
  139. package/src/assets/iconfont/menu.svg +0 -1
  140. package/src/assets/iconfont/more.svg +0 -1
  141. package/src/assets/iconfont/pause.svg +0 -1
  142. package/src/assets/iconfont/play.svg +0 -1
  143. package/src/assets/iconfont/triangle-s.svg +0 -1
  144. package/src/assets/iconfont/user-status-away.svg +0 -2
  145. package/src/assets/iconfont/user-status-dnd.svg +0 -2
  146. package/src/assets/iconfont/user-status-invisible.svg +0 -2
  147. package/src/assets/iconfont/user-status-online.svg +0 -2
  148. package/src/assets/inputs.scss +0 -104
  149. package/src/assets/variables.scss +0 -57
  150. package/src/components/ActionButton/ActionButton.vue +0 -160
  151. package/src/components/ActionButton/index.js +0 -24
  152. package/src/components/ActionCheckbox/ActionCheckbox.vue +0 -220
  153. package/src/components/ActionCheckbox/index.js +0 -24
  154. package/src/components/ActionInput/ActionInput.vue +0 -418
  155. package/src/components/ActionInput/index.js +0 -24
  156. package/src/components/ActionLink/ActionLink.vue +0 -132
  157. package/src/components/ActionLink/index.js +0 -24
  158. package/src/components/ActionRadio/ActionRadio.vue +0 -219
  159. package/src/components/ActionRadio/index.js +0 -24
  160. package/src/components/ActionRouter/ActionRouter.vue +0 -100
  161. package/src/components/ActionRouter/index.js +0 -24
  162. package/src/components/ActionSeparator/ActionSeparator.vue +0 -43
  163. package/src/components/ActionSeparator/index.js +0 -24
  164. package/src/components/ActionText/ActionText.vue +0 -87
  165. package/src/components/ActionText/index.js +0 -24
  166. package/src/components/ActionTextEditable/ActionTextEditable.vue +0 -306
  167. package/src/components/ActionTextEditable/index.js +0 -24
  168. package/src/components/Actions/Actions.vue +0 -764
  169. package/src/components/Actions/index.js +0 -24
  170. package/src/components/AppContent/AppContent.vue +0 -93
  171. package/src/components/AppContent/index.js +0 -23
  172. package/src/components/AppContentDetails/AppContentDetails.vue +0 -34
  173. package/src/components/AppContentDetails/index.js +0 -23
  174. package/src/components/AppContentList/AppContentList.vue +0 -44
  175. package/src/components/AppContentList/index.js +0 -23
  176. package/src/components/AppNavigation/AppNavigation.vue +0 -190
  177. package/src/components/AppNavigation/index.js +0 -23
  178. package/src/components/AppNavigationCaption/AppNavigationCaption.vue +0 -39
  179. package/src/components/AppNavigationCaption/index.js +0 -3
  180. package/src/components/AppNavigationCounter/AppNavigationCounter.vue +0 -82
  181. package/src/components/AppNavigationCounter/index.js +0 -25
  182. package/src/components/AppNavigationIconBullet/AppNavigationIconBullet.vue +0 -95
  183. package/src/components/AppNavigationIconBullet/index.js +0 -24
  184. package/src/components/AppNavigationItem/AppNavigationIconCollapsible.vue +0 -90
  185. package/src/components/AppNavigationItem/AppNavigationItem.vue +0 -629
  186. package/src/components/AppNavigationItem/InputConfirmCancel.vue +0 -134
  187. package/src/components/AppNavigationItem/index.js +0 -24
  188. package/src/components/AppNavigationNew/AppNavigationNew.vue +0 -76
  189. package/src/components/AppNavigationNew/index.js +0 -23
  190. package/src/components/AppNavigationNewItem/AppNavigationNewItem.vue +0 -165
  191. package/src/components/AppNavigationNewItem/index.js +0 -24
  192. package/src/components/AppNavigationSettings/AppNavigationSettings.vue +0 -105
  193. package/src/components/AppNavigationSettings/index.js +0 -23
  194. package/src/components/AppNavigationSpacer/AppNavigationSpacer.vue +0 -39
  195. package/src/components/AppNavigationSpacer/index.js +0 -23
  196. package/src/components/AppNavigationToggle/AppNavigationToggle.vue +0 -78
  197. package/src/components/AppNavigationToggle/index.js +0 -24
  198. package/src/components/AppSettingsDialog/AppSettingsDialog.vue +0 -331
  199. package/src/components/AppSettingsDialog/index.js +0 -25
  200. package/src/components/AppSettingsSection/AppSettingsSection.vue +0 -64
  201. package/src/components/AppSettingsSection/index.js +0 -25
  202. package/src/components/AppSidebar/AppSidebar.vue +0 -802
  203. package/src/components/AppSidebar/AppSidebarTabs.vue +0 -348
  204. package/src/components/AppSidebar/index.js +0 -23
  205. package/src/components/AppSidebarTab/AppSidebarTab.vue +0 -103
  206. package/src/components/AppSidebarTab/index.js +0 -23
  207. package/src/components/Avatar/Avatar.vue +0 -758
  208. package/src/components/Avatar/index.js +0 -25
  209. package/src/components/Breadcrumb/Breadcrumb.vue +0 -262
  210. package/src/components/Breadcrumb/index.js +0 -25
  211. package/src/components/Breadcrumbs/Breadcrumbs.vue +0 -537
  212. package/src/components/Breadcrumbs/index.js +0 -25
  213. package/src/components/ColorPicker/ColorPicker.vue +0 -380
  214. package/src/components/ColorPicker/index.js +0 -25
  215. package/src/components/Content/Content.vue +0 -77
  216. package/src/components/Content/index.js +0 -23
  217. package/src/components/DatetimePicker/DatetimePicker.vue +0 -195
  218. package/src/components/DatetimePicker/index.js +0 -28
  219. package/src/components/DatetimePicker/index.scss +0 -405
  220. package/src/components/EmojiPicker/EmojiPicker.vue +0 -302
  221. package/src/components/EmojiPicker/index.js +0 -23
  222. package/src/components/EmptyContent/EmptyContent.vue +0 -120
  223. package/src/components/EmptyContent/index.js +0 -24
  224. package/src/components/Highlight/Highlight.vue +0 -183
  225. package/src/components/Highlight/index.js +0 -25
  226. package/src/components/ListItemIcon/ListItemIcon.vue +0 -277
  227. package/src/components/ListItemIcon/index.js +0 -25
  228. package/src/components/Modal/Modal.vue +0 -833
  229. package/src/components/Modal/index.js +0 -27
  230. package/src/components/Multiselect/EllipsisedOption.vue +0 -141
  231. package/src/components/Multiselect/Multiselect.vue +0 -430
  232. package/src/components/Multiselect/index.js +0 -28
  233. package/src/components/Multiselect/index.scss +0 -290
  234. package/src/components/MultiselectTags/MultiselectTags.vue +0 -179
  235. package/src/components/MultiselectTags/api.js +0 -115
  236. package/src/components/MultiselectTags/index.js +0 -23
  237. package/src/components/Popover/Popover.vue +0 -208
  238. package/src/components/Popover/index.js +0 -25
  239. package/src/components/PopoverMenu/PopoverMenu.vue +0 -62
  240. package/src/components/PopoverMenu/PopoverMenuItem.vue +0 -382
  241. package/src/components/PopoverMenu/index.js +0 -24
  242. package/src/components/ProgressBar/ProgressBar.vue +0 -135
  243. package/src/components/ProgressBar/index.js +0 -25
  244. package/src/components/RichContenteditable/AutoCompleteResult.vue +0 -191
  245. package/src/components/RichContenteditable/MentionBubble.vue +0 -165
  246. package/src/components/RichContenteditable/RichContenteditable.vue +0 -517
  247. package/src/components/RichContenteditable/index.js +0 -25
  248. package/src/components/SettingsInputText/SettingsInputText.vue +0 -207
  249. package/src/components/SettingsInputText/index.js +0 -24
  250. package/src/components/SettingsSection/SettingsSection.vue +0 -151
  251. package/src/components/SettingsSection/index.js +0 -24
  252. package/src/components/SettingsSelectGroup/SettingsSelectGroup.vue +0 -149
  253. package/src/components/SettingsSelectGroup/index.js +0 -25
  254. package/src/components/UserBubble/UserBubble.vue +0 -319
  255. package/src/components/UserBubble/index.js +0 -25
  256. package/src/components/index.js +0 -110
  257. package/src/directives/Focus/index.js +0 -29
  258. package/src/directives/Linkify/index.js +0 -31
  259. package/src/directives/Tooltip/index.js +0 -32
  260. package/src/directives/Tooltip/index.scss +0 -117
  261. package/src/directives/index.js +0 -31
  262. package/src/fonts/iconfont-vue-f56d517.eot +0 -0
  263. package/src/fonts/iconfont-vue-f56d517.svg +0 -1
  264. package/src/fonts/iconfont-vue-f56d517.ttf +0 -0
  265. package/src/fonts/iconfont-vue-f56d517.woff +0 -0
  266. package/src/fonts/scss/iconfont-vue.scss +0 -115
  267. package/src/functions/usernameToColor/index.js +0 -25
  268. package/src/functions/usernameToColor/usernameToColor.js +0 -68
  269. package/src/index.js +0 -40
  270. package/src/l10n.js +0 -42
  271. package/src/mixins/actionGlobal.js +0 -59
  272. package/src/mixins/actionText.js +0 -85
  273. package/src/mixins/excludeClickOutsideClasses/index.js +0 -72
  274. package/src/mixins/index.js +0 -35
  275. package/src/mixins/isFullscreen/index.js +0 -46
  276. package/src/mixins/isMobile/index.js +0 -43
  277. package/src/mixins/l10n.js +0 -8
  278. package/src/mixins/richEditor/index.js +0 -160
  279. package/src/mixins/userStatus.js +0 -76
  280. package/src/utils/FindRanges.js +0 -47
  281. package/src/utils/GenColors.js +0 -79
  282. package/src/utils/GenRandomId.js +0 -31
  283. package/src/utils/GetChildren.js +0 -47
  284. package/src/utils/GetParent.js +0 -41
  285. package/src/utils/IsMobileState.js +0 -49
  286. package/src/utils/IsOutOfViewport.js +0 -36
  287. package/src/utils/ScopeComponent.js +0 -37
  288. package/src/utils/Timer.js +0 -61
  289. package/src/utils/ValidateChildren.js +0 -50
  290. package/src/utils/ValidateSlot.js +0 -57
@@ -1,24 +0,0 @@
1
- /**
2
- * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
3
- *
4
- * @author John Molakvoæ <skjnldsv@protonmail.com>
5
- *
6
- * @license GNU AGPL version 3 or any later version
7
- *
8
- * This program is free software: you can redistribute it and/or modify
9
- * it under the terms of the GNU Affero General Public License as
10
- * published by the Free Software Foundation, either version 3 of the
11
- * License, or (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU Affero General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Affero General Public License
19
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
- *
21
- */
22
- import ActionTextEditable from './ActionTextEditable'
23
-
24
- export default ActionTextEditable
@@ -1,764 +0,0 @@
1
- <!--
2
- - @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
3
- -
4
- - @author John Molakvoæ <skjnldsv@protonmail.com>
5
- - @author Marco Ambrosini <marcoambrosini@pm.me
6
- -
7
- - @license GNU AGPL version 3 or any later version
8
- -
9
- - This program is free software: you can redistribute it and/or modify
10
- - it under the terms of the GNU Affero General Public License as
11
- - published by the Free Software Foundation, either version 3 of the
12
- - License, or (at your option) any later version.
13
- -
14
- - This program is distributed in the hope that it will be useful,
15
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
- - GNU Affero General Public License for more details.
18
- -
19
- - You should have received a copy of the GNU Affero General Public License
20
- - along with this program. If not, see <http://www.gnu.org/licenses/>.
21
- -
22
- -->
23
-
24
- <!-- Accessibility guidelines:
25
- https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-actions.html -->
26
-
27
- <docs>
28
- ### Single action
29
-
30
- ```
31
- <Actions>
32
- <ActionButton icon="icon-delete" @click="alert('Delete')">Delete</ActionButton>
33
- </Actions>
34
- ```
35
-
36
- ### Multiple actions
37
-
38
- ```
39
- <Actions>
40
- <ActionButton icon="icon-edit" @click="alert('Edit')">Edit</ActionButton>
41
- <ActionButton icon="icon-delete" @click="alert('Delete')">Delete</ActionButton>
42
- <ActionLink icon="icon-external" title="Link" href="https://nextcloud.com" />
43
- </Actions>
44
- ```
45
-
46
- ### Multiple actions with custom icon
47
-
48
- ```
49
- <Actions default-icon="icon-edit">
50
- <ActionButton icon="icon-edit" @click="alert('Edit')">Edit</ActionButton>
51
- <ActionButton icon="icon-delete" @click="alert('Delete')">Delete</ActionButton>
52
- <ActionLink icon="icon-external" title="Link" href="https://nextcloud.com" />
53
- </Actions>
54
- ```
55
-
56
- ### With menu title
57
-
58
- ```
59
- <Actions default-icon="icon-edit" menu-title="Object management">
60
- <ActionButton icon="icon-edit">Rename</ActionButton>
61
- <ActionButton icon="icon-delete">Delete</ActionButton>
62
- <ActionButton icon="icon-confirm">Validate</ActionButton>
63
- <ActionButton icon="icon-download">Download</ActionButton>
64
- </Actions>
65
- ```
66
-
67
- ### Various icons styles
68
- ```
69
- <Actions :primary="true">
70
- <ActionButton icon="icon-edit">Edit</ActionButton>
71
- <ActionButton icon="icon-delete">Delete</ActionButton>
72
- </Actions>
73
- ```
74
-
75
- ```
76
- <Actions default-icon="icon-add-white" :primary="true" menu-title="Object management">
77
- <ActionButton icon="icon-edit">Rename</ActionButton>
78
- <ActionButton icon="icon-delete">Delete</ActionButton>
79
- <ActionButton icon="icon-confirm">Validate</ActionButton>
80
- <ActionButton icon="icon-download">Download</ActionButton>
81
- </Actions>
82
- ```
83
-
84
- ### Custom icon slot
85
- To be used with `vue-material-design-icons` only. For icon classes use the `default-icon` slot.
86
- It can be used with one or multiple actions.
87
- ```
88
- <template>
89
- <div style="display: flex;align-items: center;">
90
- <button @click="toggled = !toggled">Toggle multiple action</button>
91
- <Actions>
92
- <DotsHorizontalCircleOutline
93
- slot="icon"
94
- :size="16"
95
- decorative />
96
- <ActionButton>
97
- <MicrophoneOff
98
- slot="icon"
99
- :size="16"
100
- decorative />
101
- Mute
102
- </ActionButton>
103
- <ActionButton v-if="toggled" icon="icon-delete">Delete</ActionButton>
104
- </Actions>
105
- <Actions>
106
- </Actions>
107
- </div>
108
- </template>
109
- <script>
110
- import DotsHorizontalCircleOutline from 'vue-material-design-icons/DotsHorizontalCircleOutline'
111
- import MicrophoneOff from 'vue-material-design-icons/MicrophoneOff'
112
-
113
- export default {
114
- components: {
115
- DotsHorizontalCircleOutline,
116
- MicrophoneOff,
117
- },
118
- data() {
119
- return {
120
- toggled: false
121
- }
122
- }
123
- }
124
- </script>
125
- ```
126
-
127
- ### Custom icon slot in child elements
128
- ```
129
- <Actions :primary="true">
130
- <ActionButton><template #icon><MagnifyIcon /></template>Search</ActionButton>
131
- <ActionButton icon="icon-delete">Delete</ActionButton>
132
- </Actions>
133
- ```
134
-
135
- </docs>
136
- <template>
137
- <!-- if only one action, check if we need to bind to click or not -->
138
- <element v-if="isValidSingleAction && !forceMenu"
139
- v-tooltip.auto="firstAction.text"
140
- v-bind="firstActionBinding"
141
- :class="{
142
- [firstAction.icon]: firstAction.icon,
143
- [firstActionClass]: firstActionClass }"
144
- class="action-item action-item--single"
145
- rel="noreferrer noopener"
146
- :disabled="disabled"
147
- @focus="onFocus"
148
- @blur="onBlur"
149
- @[firstActionEventBinding]="execFirstAction">
150
- <!-- Render the icon slot content of the first action -->
151
- <VNodes :vnodes="firstActionIconSlot" />
152
-
153
- <!-- fake slot to gather main action -->
154
- <span :aria-hidden="true" hidden>
155
- <!-- @slot All action elements passed into the default slot will be used -->
156
- <slot />
157
- </span>
158
- </element>
159
-
160
- <!-- more than one action -->
161
- <div v-else
162
- v-show="hasMultipleActions || forceMenu"
163
- :class="{'action-item--open': opened}"
164
- class="action-item">
165
- <!-- If more than one action, create a popovermenu -->
166
- <Popover
167
- :delay="0"
168
- :handle-resize="true"
169
- :open.sync="opened"
170
- :placement="placement"
171
- :boundaries-element="boundariesElement"
172
- :container="container"
173
- @show="openMenu"
174
- @after-show="onOpen"
175
- @hide="closeMenu">
176
- <!-- Menu open/close trigger button -->
177
- <button slot="trigger"
178
- ref="menuButton"
179
- :disabled="disabled"
180
- class="icon action-item__menutoggle"
181
- :class="{
182
- [defaultIcon]: !iconSlotIsPopulated,
183
- 'action-item__menutoggle--with-title': menuTitle,
184
- 'action-item__menutoggle--primary': primary
185
- }"
186
- aria-haspopup="true"
187
- :aria-label="ariaLabel"
188
- :aria-controls="randomId"
189
- :aria-expanded="opened ? 'true' : 'false'"
190
- test-attr="1"
191
- type="button"
192
- @focus="onFocus"
193
- @blur="onBlur">
194
- <slot name="icon" />
195
- {{ menuTitle }}
196
- </button>
197
-
198
- <!-- Menu content -->
199
- <div v-show="opened"
200
- ref="menu"
201
- :class="{ open: opened }"
202
- tabindex="-1"
203
- @keydown.up.exact="focusPreviousAction"
204
- @keydown.down.exact="focusNextAction"
205
- @keydown.tab.exact="focusNextAction"
206
- @keydown.shift.tab.exact="focusPreviousAction"
207
- @keydown.page-up.exact="focusFirstAction"
208
- @keydown.page-down.exact="focusLastAction"
209
- @keydown.esc.exact.prevent="closeMenu"
210
- @mousemove="onMouseFocusAction">
211
- <!-- menu content -->
212
- <ul :id="randomId" tabindex="-1">
213
- <template v-if="opened">
214
- <slot />
215
- </template>
216
- </ul>
217
- </div>
218
- </Popover>
219
- </div>
220
- </template>
221
- <script>
222
- import Tooltip from '../../directives/Tooltip'
223
- import GenRandomId from '../../utils/GenRandomId'
224
- import { t } from '../../l10n'
225
- import Popover from '../Popover'
226
-
227
- const focusableSelector = '.focusable'
228
-
229
- /**
230
- * The Actions component can be used to display one ore more actions.
231
- * If only a single action is provided, it will be rendered as an inline icon.
232
- * For more, a menu indicator will be shown and a popovermenu containing the
233
- * actions will be opened on click.
234
- *
235
- * @since 0.10.0
236
- */
237
- export default {
238
- name: 'Actions',
239
-
240
- directives: {
241
- tooltip: Tooltip,
242
- },
243
-
244
- components: {
245
- Popover,
246
-
247
- // Component to render the first action icon slot content (vnodes)
248
- VNodes: {
249
- functional: true,
250
- render: (h, context) => context.props.vnodes,
251
- },
252
- },
253
-
254
- props: {
255
- /**
256
- * Specify the open state of the popover menu
257
- */
258
- open: {
259
- type: Boolean,
260
- default: false,
261
- },
262
-
263
- /**
264
- * Force the actions to display in a three dot menu
265
- */
266
- forceMenu: {
267
- type: Boolean,
268
- default: false,
269
- },
270
-
271
- /**
272
- * Specify the menu title
273
- */
274
- menuTitle: {
275
- type: String,
276
- default: null,
277
- },
278
-
279
- /**
280
- * Apply primary styling for this menu
281
- */
282
- primary: {
283
- type: Boolean,
284
- default: false,
285
- },
286
-
287
- /**
288
- * Icon to show for the toggle menu button
289
- * when more than one action is inside the actions component.
290
- * Only replace the default three-dot icon if really necessary.
291
- */
292
- defaultIcon: {
293
- type: String,
294
- default: 'action-item__menutoggle--default-icon',
295
- },
296
-
297
- /**
298
- * Aria label for the actions menu
299
- */
300
- ariaLabel: {
301
- type: String,
302
- default: t('Actions'),
303
- },
304
-
305
- /**
306
- * Wanted direction of the menu
307
- */
308
- placement: {
309
- type: String,
310
- default: 'bottom',
311
- },
312
-
313
- /**
314
- * DOM element for the actions' popover boundaries
315
- */
316
- boundariesElement: {
317
- type: Element,
318
- default: () => document.querySelector('body'),
319
- },
320
-
321
- /**
322
- * Selector for the actions' popover container
323
- */
324
- container: {
325
- type: String,
326
- default: 'body',
327
- },
328
-
329
- /**
330
- * Disabled state of the main button (single action or menu toggle)
331
- */
332
- disabled: {
333
- type: Boolean,
334
- default: false,
335
- },
336
- },
337
-
338
- data() {
339
- return {
340
- actions: [],
341
- opened: this.open,
342
- focusIndex: 0,
343
- randomId: 'menu-' + GenRandomId(),
344
- // Making children reactive!
345
- // By binding this here, vuejs will track the object content
346
- // Needed for firstAction reactivity !!!
347
- children: this.$children,
348
- }
349
- },
350
-
351
- computed: {
352
- /**
353
- * Is there more than one action?
354
- * @returns {boolean}
355
- */
356
- hasMultipleActions() {
357
- return this.actions.length > 1
358
- },
359
- /**
360
- * Is there any first action ?
361
- * And is it allowed as a standalone element ?
362
- * @returns {boolean}
363
- */
364
- isValidSingleAction() {
365
- return this.actions.length === 1
366
- && this.firstActionElement !== null
367
- },
368
- /**
369
- * First action vnode
370
- * @returns {Object} return the first action vue vnode
371
- */
372
- firstActionVNode() {
373
- return this.actions[0]
374
- },
375
- /**
376
- * Reactive binding to the first children
377
- * Since we're here, it means we already passed all the proper checks
378
- * we can assume the first action is the first children too
379
- * @returns {Object} first action vue children object
380
- */
381
- firstAction() {
382
- return this.children[0]
383
- ? this.children[0]
384
- : {}
385
- },
386
-
387
- /**
388
- * Binding of the first action to the template
389
- * @returns {Object} vue template v-bind shortcut
390
- */
391
- firstActionBinding() {
392
- if (this.firstActionVNode && this.firstActionVNode.componentOptions) {
393
- const tag = this.firstActionVNode.componentOptions.tag
394
- if (tag === 'ActionLink') {
395
- return {
396
- is: 'a',
397
- href: this.firstAction.href,
398
- target: this.firstAction.target,
399
- 'aria-label': this.firstAction.ariaLabel,
400
- ...this.firstAction.$attrs,
401
- ...this.firstAction.$props,
402
- }
403
- }
404
- if (tag === 'ActionRouter') {
405
- return {
406
- is: 'router-link',
407
- to: this.firstAction.to,
408
- exact: this.firstAction.exact,
409
- 'aria-label': this.firstAction.ariaLabel,
410
- ...this.firstAction.$attrs,
411
- ...this.firstAction.$props,
412
- }
413
- }
414
- if (tag === 'ActionButton') {
415
- return {
416
- is: 'button',
417
- 'aria-label': this.firstAction.ariaLabel,
418
- ...this.firstAction.$attrs,
419
- ...this.firstAction.$props,
420
- }
421
- }
422
- }
423
- // other action types are not allowed as standalone buttons
424
- return null
425
- },
426
-
427
- // return the event to bind if the firstActionVNode have an action
428
- firstActionEvent() {
429
- return this.firstActionVNode?.componentOptions?.listeners?.click
430
- },
431
- firstActionEventBinding() {
432
- return this.firstActionEvent ? 'click' : null
433
- },
434
- // return the first action icon slot vnodes array
435
- firstActionIconSlot() {
436
- return this.firstAction?.$slots?.icon
437
- },
438
- firstActionClass() {
439
- const staticClass = this.firstActionVNode && this.firstActionVNode.data.staticClass
440
- const dynClass = this.firstActionVNode && this.firstActionVNode.data.class
441
- return (staticClass + ' ' + dynClass).trim()
442
- },
443
-
444
- iconSlotIsPopulated() {
445
- return !!this.$slots.icon
446
- },
447
- },
448
-
449
- watch: {
450
- // Watch parent prop
451
- open(state) {
452
- if (state === this.opened) {
453
- return
454
- }
455
-
456
- this.opened = state
457
- },
458
- },
459
- beforeMount() {
460
- // init actions
461
- this.initActions()
462
- },
463
- beforeUpdate() {
464
- // ! since we're using $slots to manage our actions
465
- // ! we NEED to update the actions if anything change
466
-
467
- // update children & actions
468
- // no need to init actions again since we bound it to $children
469
- // and the array is now reactive
470
- // init actions
471
- this.initActions()
472
- },
473
-
474
- methods: {
475
- // MENU STATE MANAGEMENT
476
- openMenu(e) {
477
- if (this.opened) {
478
- return
479
- }
480
-
481
- this.opened = true
482
-
483
- /**
484
- * Event emitted when the popover menu open state is changed
485
- * @type {boolean}
486
- */
487
- this.$emit('update:open', true)
488
-
489
- /**
490
- * Event emitted when the popover menu is closed
491
- */
492
- this.$emit('open')
493
- },
494
- closeMenu(e) {
495
- if (!this.opened) {
496
- return
497
- }
498
-
499
- this.opened = false
500
-
501
- /**
502
- * Event emitted when the popover menu open state is changed
503
- * @type {boolean}
504
- */
505
- this.$emit('update:open', false)
506
-
507
- /**
508
- * Event emitted when the popover menu is closed
509
- */
510
- this.$emit('close')
511
-
512
- // close everything
513
- this.opened = false
514
- this.focusIndex = 0
515
-
516
- // focus back the menu button
517
- this.$refs.menuButton.focus()
518
- },
519
-
520
- onOpen(event) {
521
- this.$nextTick(() => {
522
- this.focusFirstAction(event)
523
- })
524
- },
525
-
526
- // MENU KEYS & FOCUS MANAGEMENT
527
- // focus nearest focusable item on mouse move
528
- // DO NOT change the focus if the target is already focused
529
- // this will prevent issues with input being unfocused
530
- // on mouse move
531
- onMouseFocusAction(event) {
532
- if (document.activeElement === event.target) {
533
- return
534
- }
535
-
536
- const menuItem = event.target.closest('li')
537
- if (menuItem) {
538
- const focusableItem = menuItem.querySelector(focusableSelector)
539
- if (focusableItem) {
540
- const focusList = this.$refs.menu.querySelectorAll(focusableSelector)
541
- const focusIndex = [...focusList].indexOf(focusableItem)
542
- if (focusIndex > -1) {
543
- this.focusIndex = focusIndex
544
- this.focusAction()
545
- }
546
- }
547
- }
548
- },
549
- removeCurrentActive() {
550
- const currentActiveElement = this.$refs.menu.querySelector('li.active')
551
- if (currentActiveElement) {
552
- currentActiveElement.classList.remove('active')
553
- }
554
- },
555
- focusAction() {
556
- // TODO: have a global disabled state for non input elements
557
- const focusElement = this.$refs.menu.querySelectorAll(focusableSelector)[this.focusIndex]
558
- if (focusElement) {
559
- this.removeCurrentActive()
560
- const liMenuParent = focusElement.closest('li.action')
561
- focusElement.focus()
562
- if (liMenuParent) {
563
- liMenuParent.classList.add('active')
564
- }
565
- }
566
- },
567
- focusPreviousAction(event) {
568
- if (this.opened) {
569
- if (this.focusIndex === 0) {
570
- // First element overflows to body-navigation (no preventDefault!) and closes Actions-menu
571
- this.closeMenu()
572
- } else {
573
- this.preventIfEvent(event)
574
- this.focusIndex = this.focusIndex - 1
575
- }
576
- this.focusAction()
577
- }
578
- },
579
- focusNextAction(event) {
580
- if (this.opened) {
581
- const indexLength = this.$refs.menu.querySelectorAll(focusableSelector).length - 1
582
- if (this.focusIndex === indexLength) {
583
- // Last element overflows to body-navigation (no preventDefault!) and closes Actions-menu
584
- this.closeMenu()
585
- } else {
586
- this.preventIfEvent(event)
587
- this.focusIndex = this.focusIndex + 1
588
- }
589
- this.focusAction()
590
- }
591
- },
592
- focusFirstAction(event) {
593
- if (this.opened) {
594
- this.preventIfEvent(event)
595
- this.focusIndex = 0
596
- this.focusAction()
597
- }
598
- },
599
- focusLastAction(event) {
600
- if (this.opened) {
601
- this.preventIfEvent(event)
602
- this.focusIndex = this.$el.querySelectorAll(focusableSelector).length - 1
603
- this.focusAction()
604
- }
605
- },
606
-
607
- preventIfEvent(event) {
608
- if (event) {
609
- event.preventDefault()
610
- event.stopPropagation()
611
- }
612
- },
613
-
614
- // ACTIONS MANAGEMENT
615
- // exec the first action
616
- execFirstAction(event) {
617
- if (this.firstActionEvent) {
618
- this.firstActionEvent(event)
619
- }
620
- },
621
- initActions() {
622
- // filter out invalid slots
623
- this.actions = (this.$slots.default || []).filter(node => !!node && !!node.componentOptions)
624
- },
625
- onFocus(event) {
626
- this.$emit('focus', event)
627
- },
628
- onBlur(event) {
629
- this.$emit('blur', event)
630
- },
631
- },
632
- }
633
- </script>
634
-
635
- <style lang="scss" scoped>
636
- @import '../../fonts/scss/iconfont-vue';
637
-
638
- .action-item {
639
- position: relative;
640
- display: inline-block;
641
-
642
- // put a grey round background when menu is opened
643
- // or hover-focused
644
- &--single:hover,
645
- &--single:focus,
646
- &--single:active,
647
- &__menutoggle:hover,
648
- &__menutoggle:focus,
649
- &__menutoggle:active {
650
- opacity: $opacity_full;
651
- // good looking on dark AND white bg
652
- background-color: $icon-focus-bg;
653
- }
654
-
655
- // TODO: handle this in the future button component
656
- &__menutoggle:disabled,
657
- &--single:disabled {
658
- opacity: .3 !important;
659
- }
660
-
661
- &.action-item--open .action-item__menutoggle {
662
- opacity: $opacity_full;
663
- background-color: $action-background-hover;
664
- }
665
-
666
- // icons
667
- &--single,
668
- &__menutoggle {
669
- box-sizing: border-box;
670
- width: auto;
671
- min-width: $clickable-area;
672
- height: $clickable-area;
673
- margin: 0;
674
- padding: $icon-margin;
675
- cursor: pointer;
676
- border: none;
677
- border-radius: $clickable-area / 2;
678
- background-color: transparent;
679
- }
680
-
681
- // icon-more
682
- &__menutoggle {
683
- // align menu icon in center
684
- display: flex;
685
- align-items: center;
686
- justify-content: center;
687
- opacity: $opacity_normal;
688
- font-weight: bold;
689
- line-height: $icon-size;
690
-
691
- // image slot
692
- /deep/ span {
693
- width: $icon-size;
694
- height: $icon-size;
695
- line-height: $icon-size;
696
- }
697
-
698
- &:before {
699
- content: '';
700
- }
701
-
702
- &--default-icon {
703
- @include iconfont('more');
704
- &::before {
705
- font-size: $icon-size;
706
- }
707
- }
708
-
709
- &--with-title {
710
- position: relative;
711
- padding-left: $clickable-area;
712
- white-space: nowrap;
713
- opacity: $opacity_full;
714
- border: 1px solid var(--color-border-dark);
715
- // with a title, we need to display this as a real button
716
- background-color: var(--color-background-dark);
717
- background-position: $icon-margin center;
718
- font-size: inherit;
719
- // non-background icon class
720
- &:before {
721
- position: absolute;
722
- top: $icon-margin;
723
- left: $icon-margin;
724
- }
725
- }
726
-
727
- &--primary {
728
- opacity: $opacity_full;
729
- color: var(--color-primary-text);
730
- border: none;
731
- background-color: var(--color-primary-element);
732
- .action-item--open &,
733
- &:hover,
734
- &:focus,
735
- &:active {
736
- color: var(--color-primary-text) !important;
737
- background-color: var(--color-primary-element-light) !important;
738
- }
739
- }
740
- }
741
-
742
- &--single {
743
- opacity: $opacity_normal;
744
- &:hover,
745
- &:focus,
746
- &:active {
747
- opacity: $opacity_full;
748
- }
749
- // hide anything the slot is displaying
750
- & > [hidden] {
751
- display: none;
752
- }
753
- }
754
- }
755
-
756
- .ie,
757
- .edge {
758
- .action-item__menu,
759
- .action-item__menu .action-item__menu_arrow {
760
- border: 1px solid var(--color-border);
761
- }
762
- }
763
-
764
- </style>