@xwiki/cristal-dsvuetify 0.9.0 → 0.11.0

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 (86) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/componentsInit.d.ts +0 -1
  3. package/dist/components/vuetifyDesignSystemLoader.d.ts +0 -1
  4. package/dist/{index-CkW0K4NP.js → index-BMliq0dk.js} +7749 -7612
  5. package/dist/index-BMliq0dk.js.map +1 -0
  6. package/dist/index.d.ts +0 -1
  7. package/dist/index.es.js +7 -4
  8. package/dist/index.umd.js +12 -7
  9. package/dist/index.umd.js.map +1 -1
  10. package/dist/{translations-CFfpgNrx.js → translations-BNEIsfPR.js} +3 -3
  11. package/dist/{translations-CFfpgNrx.js.map → translations-BNEIsfPR.js.map} +1 -1
  12. package/dist/vue/__tests__/utils/vuetify.d.ts +5 -0
  13. package/dist/vue/form/x-file-input.vue.d.ts +10 -31
  14. package/dist/vue/form/x-form.vue.d.ts +9 -4
  15. package/dist/vue/form/x-text-field.vue.d.ts +1 -11
  16. package/dist/vue/x-alert.vue.d.ts +2 -22
  17. package/dist/vue/x-avatar.vue.d.ts +3 -3
  18. package/dist/vue/x-breadcrumb.vue.d.ts +1 -11
  19. package/dist/vue/x-btn.vue.d.ts +9 -3
  20. package/dist/vue/x-card.vue.d.ts +3 -3
  21. package/dist/vue/x-dialog.vue.d.ts +11 -15
  22. package/dist/vue/x-divider.vue.d.ts +1 -1
  23. package/dist/vue/x-img.vue.d.ts +3 -3
  24. package/dist/vue/x-load.vue.d.ts +1 -2
  25. package/dist/vue/x-menu-item.vue.d.ts +12 -16
  26. package/dist/vue/x-menu-label.vue.d.ts +16 -0
  27. package/dist/vue/x-menu.vue.d.ts +9 -17
  28. package/dist/vue/x-navigation-tree.vue.d.ts +13 -0
  29. package/dist/vue/x-search.vue.d.ts +1 -1
  30. package/dist/vue/x-tab-group.vue.d.ts +10 -5
  31. package/dist/vue/x-tab-panel.vue.d.ts +8 -13
  32. package/dist/vue/x-tab.vue.d.ts +8 -13
  33. package/dist/x-alert-D8oy1BPL.js +40 -0
  34. package/dist/x-alert-D8oy1BPL.js.map +1 -0
  35. package/dist/x-breadcrumb-C2iUd4Sf.js +22 -0
  36. package/dist/{x-breadcrumb-DBZVExfF.js.map → x-breadcrumb-C2iUd4Sf.js.map} +1 -1
  37. package/dist/x-btn-DNlhiqjD.js +48 -0
  38. package/dist/x-btn-DNlhiqjD.js.map +1 -0
  39. package/dist/x-divider-Buudf0KI.js +12 -0
  40. package/dist/x-divider-Buudf0KI.js.map +1 -0
  41. package/dist/{x-file-input-COSLRt5u.js → x-file-input-8euR7G64.js} +9 -9
  42. package/dist/{x-file-input-COSLRt5u.js.map → x-file-input-8euR7G64.js.map} +1 -1
  43. package/dist/{x-form-B5rljfJA.js → x-form-UiBYkCKP.js} +2 -2
  44. package/dist/{x-form-B5rljfJA.js.map → x-form-UiBYkCKP.js.map} +1 -1
  45. package/dist/x-menu-DDC7z1Wb.js +31 -0
  46. package/dist/x-menu-DDC7z1Wb.js.map +1 -0
  47. package/dist/x-menu-item-ByE5R9Bf.js +22 -0
  48. package/dist/x-menu-item-ByE5R9Bf.js.map +1 -0
  49. package/dist/x-menu-label-DniImc0U.js +17 -0
  50. package/dist/x-menu-label-DniImc0U.js.map +1 -0
  51. package/dist/x-navigation-tree-DkVWsvlI.js +449 -0
  52. package/dist/x-navigation-tree-DkVWsvlI.js.map +1 -0
  53. package/dist/x-tab-group-ngNByee3.js +49 -0
  54. package/dist/{x-tab-group-DTR-H8Sn.js.map → x-tab-group-ngNByee3.js.map} +1 -1
  55. package/dist/{x-text-field-Ccv2SH00.js → x-text-field-uL1ePP_x.js} +6 -6
  56. package/dist/{x-text-field-Ccv2SH00.js.map → x-text-field-uL1ePP_x.js.map} +1 -1
  57. package/langs/translation-fr.json +1 -0
  58. package/package.json +11 -9
  59. package/src/components/vuetifyDesignSystemLoader.ts +23 -0
  60. package/src/vue/__tests__/utils/vuetify.ts +42 -0
  61. package/src/vue/__tests__/x-btn.test.ts +53 -0
  62. package/src/vue/css/style.css +4 -3
  63. package/src/vue/x-alert.vue +14 -17
  64. package/src/vue/x-breadcrumb.vue +5 -1
  65. package/src/vue/x-btn.vue +34 -1
  66. package/src/vue/x-divider.vue +1 -1
  67. package/src/vue/x-menu-item.vue +2 -2
  68. package/src/vue/x-menu-label.vue +25 -0
  69. package/src/vue/x-menu.vue +13 -6
  70. package/src/vue/x-navigation-tree.vue +204 -0
  71. package/src/vue/x-tab-group.vue +4 -2
  72. package/tsconfig.json +2 -1
  73. package/{src/vue.d.ts → vitest.config.ts} +17 -7
  74. package/dist/index-CkW0K4NP.js.map +0 -1
  75. package/dist/x-alert-Cm6mzRpR.js +0 -29
  76. package/dist/x-alert-Cm6mzRpR.js.map +0 -1
  77. package/dist/x-breadcrumb-DBZVExfF.js +0 -21
  78. package/dist/x-btn-DsACLwMY.js +0 -17
  79. package/dist/x-btn-DsACLwMY.js.map +0 -1
  80. package/dist/x-divider-7cmRuxTV.js +0 -16
  81. package/dist/x-divider-7cmRuxTV.js.map +0 -1
  82. package/dist/x-menu-VerLAd9F.js +0 -32
  83. package/dist/x-menu-VerLAd9F.js.map +0 -1
  84. package/dist/x-menu-item-DGurfOCF.js +0 -22
  85. package/dist/x-menu-item-DGurfOCF.js.map +0 -1
  86. package/dist/x-tab-group-DTR-H8Sn.js +0 -49
@@ -0,0 +1 @@
1
+ {"version":3,"file":"x-navigation-tree-DkVWsvlI.js","sources":["../../../node_modules/.pnpm/vuetify@3.7.2_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewGroup.mjs","../../../node_modules/.pnpm/vuetify@3.7.2_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/shared.mjs","../../../node_modules/.pnpm/vuetify@3.7.2_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewItem.mjs","../../../node_modules/.pnpm/vuetify@3.7.2_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeviewChildren.mjs","../../../node_modules/.pnpm/vuetify@3.7.2_typescript@5.6.3_vite-plugin-vuetify@2.0.4_vue@3.5.12_typescript@5.6.3_/node_modules/vuetify/lib/labs/VTreeview/VTreeview.mjs","../src/vue/x-navigation-tree.vue"],"sourcesContent":["import { mergeProps as _mergeProps, createVNode as _createVNode, Fragment as _Fragment } from \"vue\";\n// Components\nimport { VDefaultsProvider } from \"../../components/VDefaultsProvider/index.mjs\";\nimport { makeVListGroupProps, VListGroup } from \"../../components/VList/VListGroup.mjs\"; // Utilities\nimport { computed, ref } from 'vue';\nimport { genericComponent, omit, propsFactory, useRender } from \"../../util/index.mjs\"; // Types\nexport const makeVTreeviewGroupProps = propsFactory({\n ...omit(makeVListGroupProps({\n collapseIcon: '$treeviewCollapse',\n expandIcon: '$treeviewExpand'\n }), ['subgroup'])\n}, 'VTreeviewGroup');\nexport const VTreeviewGroup = genericComponent()({\n name: 'VTreeviewGroup',\n props: makeVTreeviewGroupProps(),\n setup(props, _ref) {\n let {\n slots\n } = _ref;\n const vListGroupRef = ref();\n const toggleIcon = computed(() => vListGroupRef.value?.isOpen ? props.collapseIcon : props.expandIcon);\n const activatorDefaults = computed(() => ({\n VTreeviewItem: {\n prependIcon: undefined,\n appendIcon: undefined,\n active: vListGroupRef.value?.isOpen,\n toggleIcon: toggleIcon.value\n }\n }));\n useRender(() => {\n const listGroupProps = VListGroup.filterProps(props);\n return _createVNode(VListGroup, _mergeProps(listGroupProps, {\n \"ref\": vListGroupRef,\n \"class\": ['v-treeview-group', props.class],\n \"subgroup\": true\n }), {\n ...slots,\n activator: slots.activator ? slotProps => _createVNode(_Fragment, null, [_createVNode(VDefaultsProvider, {\n \"defaults\": activatorDefaults.value\n }, {\n default: () => [slots.activator?.(slotProps)]\n })]) : undefined\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeviewGroup.mjs.map","// Types\n\nexport const VTreeviewSymbol = Symbol.for('vuetify:v-treeview');\n//# sourceMappingURL=shared.mjs.map","import { mergeProps as _mergeProps, createVNode as _createVNode, Fragment as _Fragment } from \"vue\";\n// Styles\nimport \"./VTreeviewItem.css\";\n\n// Components\nimport { VBtn } from \"../../components/VBtn/index.mjs\";\nimport { VListItemAction } from \"../../components/VList/index.mjs\";\nimport { makeVListItemProps, VListItem } from \"../../components/VList/VListItem.mjs\";\nimport { VProgressCircular } from \"../../components/VProgressCircular/index.mjs\"; // Composables\nimport { IconValue } from \"../../composables/icons.mjs\";\nimport { useLink } from \"../../composables/router.mjs\"; // Utilities\nimport { computed, inject, ref } from 'vue';\nimport { EventProp, genericComponent, omit, propsFactory, useRender } from \"../../util/index.mjs\"; // Types\nimport { VTreeviewSymbol } from \"./shared.mjs\";\nexport const makeVTreeviewItemProps = propsFactory({\n loading: Boolean,\n onToggleExpand: EventProp(),\n toggleIcon: IconValue,\n ...makeVListItemProps({\n slim: true\n })\n}, 'VTreeviewItem');\nexport const VTreeviewItem = genericComponent()({\n name: 'VTreeviewItem',\n props: makeVTreeviewItemProps(),\n setup(props, _ref) {\n let {\n attrs,\n slots,\n emit\n } = _ref;\n const link = useLink(props, attrs);\n const vListItemRef = ref();\n const isActivatableGroupActivator = computed(() => vListItemRef.value?.root.activatable.value && vListItemRef.value?.isGroupActivator);\n const isClickable = computed(() => !props.disabled && props.link !== false && (props.link || link.isClickable.value || props.value != null && !!vListItemRef.value?.list || isActivatableGroupActivator.value));\n function activateItem(e) {\n if (!isClickable.value || !isActivatableGroupActivator.value && vListItemRef.value?.isGroupActivator) return;\n if (vListItemRef.value?.root.activatable.value) {\n vListItemRef.value?.activate(!vListItemRef.value?.isActivated, e);\n }\n }\n const visibleIds = inject(VTreeviewSymbol, {\n visibleIds: ref()\n }).visibleIds;\n useRender(() => {\n const listItemProps = omit(VListItem.filterProps(props), ['onClick']);\n const hasPrepend = slots.prepend || props.toggleIcon;\n return _createVNode(VListItem, _mergeProps({\n \"ref\": vListItemRef\n }, listItemProps, {\n \"active\": vListItemRef.value?.isActivated,\n \"class\": ['v-treeview-item', {\n 'v-treeview-item--activatable-group-activator': isActivatableGroupActivator.value,\n 'v-treeview-item--filtered': visibleIds.value && !visibleIds.value.has(vListItemRef.value?.id)\n }, props.class],\n \"ripple\": false,\n \"onClick\": props.onClick ?? activateItem\n }), {\n ...slots,\n prepend: hasPrepend ? slotProps => {\n return _createVNode(_Fragment, null, [props.toggleIcon && _createVNode(VListItemAction, {\n \"start\": false\n }, {\n default: () => [_createVNode(VBtn, {\n \"density\": \"compact\",\n \"icon\": props.toggleIcon,\n \"loading\": props.loading,\n \"variant\": \"text\",\n \"onClick\": props.onToggleExpand\n }, {\n loader() {\n return _createVNode(VProgressCircular, {\n \"indeterminate\": \"disable-shrink\",\n \"size\": \"20\",\n \"width\": \"2\"\n }, null);\n }\n })]\n }), slots.prepend?.(slotProps)]);\n } : undefined\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeviewItem.mjs.map","import { mergeProps as _mergeProps, resolveDirective as _resolveDirective, createVNode as _createVNode, Fragment as _Fragment } from \"vue\";\n// Components\nimport { VTreeviewGroup } from \"./VTreeviewGroup.mjs\";\nimport { VTreeviewItem } from \"./VTreeviewItem.mjs\";\nimport { VCheckboxBtn } from \"../../components/VCheckbox/index.mjs\"; // Composables\nimport { IconValue } from \"../../composables/icons.mjs\"; // Utilities\nimport { computed, shallowRef, toRaw, withModifiers } from 'vue';\nimport { genericComponent, propsFactory } from \"../../util/index.mjs\"; // Types\nexport const makeVTreeviewChildrenProps = propsFactory({\n loadChildren: Function,\n loadingIcon: {\n type: String,\n default: '$loading'\n },\n items: Array,\n openOnClick: {\n type: Boolean,\n default: undefined\n },\n indeterminateIcon: {\n type: IconValue,\n default: '$checkboxIndeterminate'\n },\n falseIcon: IconValue,\n trueIcon: IconValue,\n returnObject: Boolean,\n selectable: Boolean,\n selectedColor: String,\n selectStrategy: [String, Function, Object]\n}, 'VTreeviewChildren');\nexport const VTreeviewChildren = genericComponent()({\n name: 'VTreeviewChildren',\n props: makeVTreeviewChildrenProps(),\n setup(props, _ref) {\n let {\n emit,\n slots\n } = _ref;\n const isLoading = shallowRef(null);\n const isClickOnOpen = computed(() => props.openOnClick != null ? props.openOnClick : props.selectable);\n function checkChildren(item) {\n return new Promise(resolve => {\n if (!props.items?.length || !props.loadChildren) return resolve();\n if (item?.children?.length === 0) {\n isLoading.value = item.value;\n props.loadChildren(item).then(resolve);\n return;\n }\n resolve();\n }).finally(() => {\n isLoading.value = null;\n });\n }\n function selectItem(select, isSelected) {\n if (props.selectable) {\n select(!isSelected);\n }\n }\n return () => slots.default?.() ?? props.items?.map(_ref2 => {\n let {\n children,\n props: itemProps,\n raw: item\n } = _ref2;\n const loading = isLoading.value === item.value;\n const slotsWithItem = {\n prepend: slotProps => _createVNode(_Fragment, null, [props.selectable && (!children || children && !['leaf', 'single-leaf'].includes(props.selectStrategy)) && _createVNode(\"div\", null, [_createVNode(VCheckboxBtn, {\n \"key\": item.value,\n \"modelValue\": slotProps.isSelected,\n \"loading\": loading,\n \"color\": props.selectedColor,\n \"indeterminate\": slotProps.isIndeterminate,\n \"indeterminateIcon\": props.indeterminateIcon,\n \"falseIcon\": props.falseIcon,\n \"trueIcon\": props.trueIcon,\n \"onClick\": withModifiers(() => selectItem(slotProps.select, slotProps.isSelected), ['stop']),\n \"onKeydown\": e => {\n if (!['Enter', 'Space'].includes(e.key)) return;\n e.stopPropagation();\n selectItem(slotProps.select, slotProps.isSelected);\n }\n }, null)]), slots.prepend?.({\n ...slotProps,\n item\n })]),\n append: slots.append ? slotProps => slots.append?.({\n ...slotProps,\n item\n }) : undefined,\n title: slots.title ? slotProps => slots.title?.({\n ...slotProps,\n item\n }) : undefined\n };\n const treeviewGroupProps = VTreeviewGroup.filterProps(itemProps);\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props);\n return children ? _createVNode(VTreeviewGroup, _mergeProps(treeviewGroupProps, {\n \"value\": props.returnObject ? item : treeviewGroupProps?.value\n }), {\n activator: _ref3 => {\n let {\n props: activatorProps\n } = _ref3;\n const listItemProps = {\n ...itemProps,\n ...activatorProps,\n value: itemProps?.value,\n onToggleExpand: [() => checkChildren(item), activatorProps.onClick],\n onClick: isClickOnOpen.value ? [() => checkChildren(item), activatorProps.onClick] : undefined\n };\n return _createVNode(VTreeviewItem, _mergeProps(listItemProps, {\n \"value\": props.returnObject ? toRaw(item) : itemProps.value,\n \"loading\": loading\n }), slotsWithItem);\n },\n default: () => _createVNode(VTreeviewChildren, _mergeProps(treeviewChildrenProps, {\n \"items\": children,\n \"returnObject\": props.returnObject\n }), slots)\n }) : slots.item?.({\n props: itemProps\n }) ?? _createVNode(VTreeviewItem, _mergeProps(itemProps, {\n \"value\": props.returnObject ? toRaw(item) : itemProps.value\n }), slotsWithItem);\n });\n }\n});\n//# sourceMappingURL=VTreeviewChildren.mjs.map","import { createVNode as _createVNode, mergeProps as _mergeProps, resolveDirective as _resolveDirective } from \"vue\";\n// Components\nimport { makeVTreeviewChildrenProps, VTreeviewChildren } from \"./VTreeviewChildren.mjs\";\nimport { makeVListProps, useListItems, VList } from \"../../components/VList/VList.mjs\"; // Composables\nimport { provideDefaults } from \"../../composables/defaults.mjs\";\nimport { makeFilterProps, useFilter } from \"../../composables/filter.mjs\";\nimport { useProxiedModel } from \"../../composables/proxiedModel.mjs\"; // Utilities\nimport { computed, provide, ref, toRaw, toRef } from 'vue';\nimport { genericComponent, omit, propsFactory, useRender } from \"../../util/index.mjs\"; // Types\nimport { VTreeviewSymbol } from \"./shared.mjs\";\nfunction flatten(items) {\n let flat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n for (const item of items) {\n flat.push(item);\n if (item.children) flatten(item.children, flat);\n }\n return flat;\n}\nexport const makeVTreeviewProps = propsFactory({\n openAll: Boolean,\n search: String,\n ...makeFilterProps({\n filterKeys: ['title']\n }),\n ...makeVTreeviewChildrenProps(),\n ...omit(makeVListProps({\n collapseIcon: '$treeviewCollapse',\n expandIcon: '$treeviewExpand',\n slim: true\n }), ['itemType', 'nav', 'openStrategy']),\n modelValue: {\n type: Array,\n default: () => []\n }\n}, 'VTreeview');\nexport const VTreeview = genericComponent()({\n name: 'VTreeview',\n props: makeVTreeviewProps(),\n emits: {\n 'update:opened': val => true,\n 'update:activated': val => true,\n 'update:selected': val => true,\n 'update:modelValue': val => true,\n 'click:open': value => true,\n 'click:select': value => true\n },\n setup(props, _ref) {\n let {\n slots\n } = _ref;\n const {\n items\n } = useListItems(props);\n const activeColor = toRef(props, 'activeColor');\n const baseColor = toRef(props, 'baseColor');\n const color = toRef(props, 'color');\n const activated = useProxiedModel(props, 'activated');\n const model = useProxiedModel(props, 'modelValue');\n const _selected = useProxiedModel(props, 'selected', props.modelValue);\n const selected = computed({\n get: () => _selected.value,\n set(val) {\n _selected.value = val;\n model.value = val;\n }\n });\n const vListRef = ref();\n const opened = computed(() => props.openAll ? openAll(items.value) : props.opened);\n const flatItems = computed(() => flatten(items.value));\n const search = toRef(props, 'search');\n const {\n filteredItems\n } = useFilter(props, flatItems, search);\n const visibleIds = computed(() => {\n if (!search.value) return null;\n const getPath = vListRef.value?.getPath;\n if (!getPath) return null;\n return new Set(filteredItems.value.flatMap(item => {\n return [...getPath(item.props.value), ...getChildren(item.props.value)];\n }));\n });\n function getChildren(id) {\n const arr = [];\n const queue = (vListRef.value?.children.get(id) ?? []).slice();\n while (queue.length) {\n const child = queue.shift();\n if (!child) continue;\n arr.push(child);\n queue.push(...(vListRef.value?.children.get(child) ?? []).slice());\n }\n return arr;\n }\n function openAll(items) {\n let ids = [];\n for (const i of items) {\n if (!i.children) continue;\n ids.push(props.returnObject ? toRaw(i.raw) : i.value);\n if (i.children) {\n ids = ids.concat(openAll(i.children));\n }\n }\n return ids;\n }\n provide(VTreeviewSymbol, {\n visibleIds\n });\n provideDefaults({\n VTreeviewGroup: {\n activeColor,\n baseColor,\n color,\n collapseIcon: toRef(props, 'collapseIcon'),\n expandIcon: toRef(props, 'expandIcon')\n },\n VTreeviewItem: {\n activeClass: toRef(props, 'activeClass'),\n activeColor,\n baseColor,\n color,\n density: toRef(props, 'density'),\n disabled: toRef(props, 'disabled'),\n lines: toRef(props, 'lines'),\n variant: toRef(props, 'variant')\n }\n });\n useRender(() => {\n const listProps = VList.filterProps(props);\n const treeviewChildrenProps = VTreeviewChildren.filterProps(props);\n return _createVNode(VList, _mergeProps({\n \"ref\": vListRef\n }, listProps, {\n \"class\": ['v-treeview', props.class],\n \"open-strategy\": \"multiple\",\n \"style\": props.style,\n \"opened\": opened.value,\n \"activated\": activated.value,\n \"onUpdate:activated\": $event => activated.value = $event,\n \"selected\": selected.value,\n \"onUpdate:selected\": $event => selected.value = $event\n }), {\n default: () => [_createVNode(VTreeviewChildren, _mergeProps(treeviewChildrenProps, {\n \"returnObject\": props.returnObject,\n \"items\": items.value\n }), slots)]\n });\n });\n return {};\n }\n});\n//# sourceMappingURL=VTreeview.mjs.map","<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\n/**\n * Navigation Tree implemented using Vuetify's VTreeView component.\n * In order to use the initial component as a proper Navigation Tree for\n * Cristal, a few changes were made:\n * - The only node activated matches the current page, or the clicked link if\n * the component has a custom clickAction. We want to use actual links so\n * that the user can click them normally (to e.g., open them in a new tab).\n * So the default behavior of activating a node by clicking anywhere on the\n * item was disabled. Default hover effects, such as darkening or changing\n * the cursor on items, were also disabled.\n */\nimport { Ref, onBeforeMount, ref, watch } from \"vue\";\nimport { VTreeview } from \"vuetify/labs/VTreeview\";\nimport { type PageData } from \"@xwiki/cristal-api\";\nimport type {\n NavigationTreeSource,\n NavigationTreeNode,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\ntype TreeItem = {\n id: string;\n title: string;\n href: string;\n children?: Array<TreeItem>;\n _location: string;\n};\n\ntype OnClickAction = (node: NavigationTreeNode) => void;\n\nconst rootNodes: Ref<Array<TreeItem>> = ref([]);\nconst tree: Ref<VTreeview | undefined> = ref(undefined);\n\nconst activatedNodes: Ref<Array<string>> = ref(new Array<string>());\nconst expandedNodes: Ref<Array<string>> = ref(new Array<string>());\n\nconst props = defineProps<{\n treeSource: NavigationTreeSource;\n clickAction?: OnClickAction;\n currentPage?: PageData;\n}>();\n\nonBeforeMount(async () => {\n for (const node of await props.treeSource.getChildNodes(\"\")) {\n rootNodes.value.push({\n id: node.id,\n title: node.label,\n href: node.url,\n children: node.has_children ? [] : undefined,\n _location: node.location,\n });\n }\n if (props.currentPage !== undefined) {\n await expandTree();\n }\n});\n\nwatch(\n () => props.currentPage,\n async () => {\n if (props.currentPage) {\n await expandTree();\n }\n },\n);\n\nasync function expandTree() {\n const newExpandedNodes = props.treeSource.getParentNodesId(props.currentPage);\n let i;\n let currentNodes = rootNodes.value;\n for (i = 0; i < newExpandedNodes.length - 1; i++) {\n if (currentNodes) {\n for (const node of currentNodes) {\n if (node.id == newExpandedNodes[i]) {\n if (node.children?.length == 0) {\n await lazyLoadChildren(node);\n }\n if (!expandedNodes.value.includes(node.id)) {\n expandedNodes.value.push(node.id);\n }\n currentNodes = node.children!;\n }\n }\n }\n }\n if (currentNodes) {\n for (const node of currentNodes) {\n if (node.id == newExpandedNodes[i]) {\n activatedNodes.value = [node.id];\n // If we have a custom click action, we want to use it on dynamic\n // selection.\n if (props.clickAction) {\n props.clickAction({\n id: node.id,\n label: node.title,\n location: node._location,\n url: node.href,\n has_children: node.children !== undefined,\n });\n }\n }\n }\n }\n}\n\nasync function lazyLoadChildren(item: unknown) {\n const treeItem = item as TreeItem;\n const childNodes = await props.treeSource.getChildNodes(treeItem.id);\n for (const child of childNodes) {\n treeItem.children?.push({\n id: child.id,\n title: child.label,\n href: child.url,\n children: child.has_children ? [] : undefined,\n _location: child.location,\n });\n }\n // If the node doesn't have any children, we update it.\n if (childNodes.length == 0) {\n treeItem.children = undefined;\n }\n}\n\nfunction clearSelection() {\n // Clicking on a node would activate it and this can't be disabled easily.\n // With this listener, we ensure that only the first activated node stays\n // active.\n if (activatedNodes.value.length > 1) {\n activatedNodes.value.pop();\n }\n}\n</script>\n\n<template>\n <v-treeview\n ref=\"tree\"\n v-model:opened=\"expandedNodes\"\n density=\"compact\"\n :activated=\"activatedNodes\"\n :items=\"rootNodes\"\n :load-children=\"lazyLoadChildren\"\n activatable\n active-strategy=\"independent\"\n item-value=\"id\"\n open-strategy=\"multiple\"\n @update:activated=\"clearSelection\"\n >\n <template #title=\"{ item }: { item: any }\">\n <a\n v-if=\"props.clickAction\"\n :href=\"item.href\"\n @click.prevent=\"\n activatedNodes = [item.id];\n clickAction!({\n id: item.id,\n label: item.title,\n location: item._location,\n url: item.href,\n has_children: item.children !== undefined,\n });\n \"\n >{{ item.title }}</a\n >\n <a v-else :href=\"item.href\">{{ item.title }}</a>\n </template>\n </v-treeview>\n</template>\n\n<style scoped>\n.v-list {\n background: none;\n}\n:deep(a) {\n text-decoration: none;\n color: var(--cr-base-text-color);\n}\n/* Disable hover on items. */\n:deep(.v-list-item__overlay) {\n --v-hover-opacity: 0;\n}\n/* Disable hand cursor on items, since we disable the default click action. */\n:deep(.v-list-item--link) {\n cursor: default;\n}\n</style>\n"],"names":["makeVTreeviewGroupProps","propsFactory","omit","makeVListGroupProps","VTreeviewGroup","genericComponent","props","_ref","slots","vListGroupRef","ref","toggleIcon","computed","_a","activatorDefaults","useRender","listGroupProps","VListGroup","_createVNode","_mergeProps","slotProps","_Fragment","VDefaultsProvider","VTreeviewSymbol","makeVTreeviewItemProps","EventProp","IconValue","makeVListItemProps","VTreeviewItem","attrs","emit","link","useLink","vListItemRef","isActivatableGroupActivator","_b","isClickable","activateItem","e","_d","_c","visibleIds","inject","listItemProps","VListItem","hasPrepend","VListItemAction","VBtn","VProgressCircular","makeVTreeviewChildrenProps","VTreeviewChildren","isLoading","shallowRef","isClickOnOpen","checkChildren","item","resolve","selectItem","select","isSelected","_ref2","children","itemProps","loading","slotsWithItem","VCheckboxBtn","withModifiers","treeviewGroupProps","treeviewChildrenProps","_ref3","activatorProps","toRaw","flatten","items","flat","makeVTreeviewProps","makeFilterProps","makeVListProps","VTreeview","val","value","useListItems","activeColor","toRef","baseColor","color","activated","useProxiedModel","model","_selected","selected","vListRef","opened","openAll","flatItems","search","filteredItems","useFilter","getPath","getChildren","id","arr","queue","child","ids","i","provide","provideDefaults","listProps","VList","$event","rootNodes","tree","activatedNodes","expandedNodes","__props","onBeforeMount","node","expandTree","watch","newExpandedNodes","currentNodes","lazyLoadChildren","treeItem","childNodes","clearSelection"],"mappings":";;;AAMO,MAAMA,KAA0BC,EAAa;AAAA,EAClD,GAAGC,EAAKC,GAAoB;AAAA,IAC1B,cAAc;AAAA,IACd,YAAY;AAAA,EAChB,CAAG,GAAG,CAAC,UAAU,CAAC;AAClB,GAAG,gBAAgB,GACNC,IAAiBC,EAAgB,EAAG;AAAA,EAC/C,MAAM;AAAA,EACN,OAAOL,GAAyB;AAAA,EAChC,MAAMM,GAAOC,GAAM;AACjB,QAAI;AAAA,MACF,OAAAC;AAAA,IACD,IAAGD;AACJ,UAAME,IAAgBC,KAChBC,IAAaC,EAAS,MAAM;;AAAA,cAAAC,IAAAJ,EAAc,U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,YAAMoE,IAAWpE,GACXqE,IAAa,MAAMtH,EAAM,WAAW,cAAcqH,EAAS,EAAE;AACnE,iBAAWpB,KAASqB;AAClB,SAAA/G,IAAA8G,EAAS,aAAT,QAAA9G,EAAmB,KAAK;AAAA,UACtB,IAAI0F,EAAM;AAAA,UACV,OAAOA,EAAM;AAAA,UACb,MAAMA,EAAM;AAAA,UACZ,UAAUA,EAAM,eAAe,CAAA,IAAK;AAAA,UACpC,WAAWA,EAAM;AAAA,QAAA;AAIjB,MAAAqB,EAAW,UAAU,MACvBD,EAAS,WAAW;AAAA,IAExB;AAEA,aAASE,IAAiB;AAIpB,MAAAZ,EAAe,MAAM,SAAS,KAChCA,EAAe,MAAM;IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","x_google_ignoreList":[0,1,2,3,4]}
@@ -0,0 +1,49 @@
1
+ import { defineComponent as f, ref as i, resolveComponent as n, openBlock as V, createBlock as b, withCtx as a, createVNode as s, renderSlot as u } from "vue";
2
+ const x = /* @__PURE__ */ f({
3
+ __name: "x-tab-group",
4
+ emits: ["change"],
5
+ setup(g, { emit: d }) {
6
+ const t = i(null), m = d;
7
+ function r(e) {
8
+ typeof e == "string" && m("change", e);
9
+ }
10
+ return (e, o) => {
11
+ const _ = n("v-tabs"), c = n("v-tabs-window"), p = n("v-card-text"), v = n("v-card");
12
+ return V(), b(v, { class: "mx-auto" }, {
13
+ default: a(() => [
14
+ s(_, {
15
+ modelValue: t.value,
16
+ "onUpdate:modelValue": [
17
+ o[0] || (o[0] = (l) => t.value = l),
18
+ r
19
+ ]
20
+ }, {
21
+ default: a(() => [
22
+ u(e.$slots, "tabs")
23
+ ]),
24
+ _: 3
25
+ }, 8, ["modelValue"]),
26
+ s(p, null, {
27
+ default: a(() => [
28
+ s(c, {
29
+ modelValue: t.value,
30
+ "onUpdate:modelValue": o[1] || (o[1] = (l) => t.value = l)
31
+ }, {
32
+ default: a(() => [
33
+ u(e.$slots, "panels")
34
+ ]),
35
+ _: 3
36
+ }, 8, ["modelValue"])
37
+ ]),
38
+ _: 3
39
+ })
40
+ ]),
41
+ _: 3
42
+ });
43
+ };
44
+ }
45
+ });
46
+ export {
47
+ x as default
48
+ };
49
+ //# sourceMappingURL=x-tab-group-ngNByee3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-tab-group-DTR-H8Sn.js","sources":["../src/vue/x-tab-group.vue"],"sourcesContent":["<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nconst tab = ref(null);\n\nconst emits = defineEmits([\"change\"]);\n\nfunction change(tabId: string) {\n emits(\"change\", tabId);\n}\n</script>\n\n<template>\n <v-card class=\"mx-auto\">\n <v-tabs v-model=\"tab\" @update:model-value=\"change\">\n <slot name=\"tabs\"></slot>\n </v-tabs>\n <v-card-text>\n <v-tabs-window v-model=\"tab\">\n <slot name=\"panels\"></slot>\n </v-tabs-window>\n </v-card-text>\n </v-card>\n</template>\n\n<style scoped></style>\n"],"names":["tab","ref","emits","__emit","change","tabId"],"mappings":";;;;;AAqBM,UAAAA,IAAMC,EAAI,IAAI,GAEdC,IAAQC;AAEd,aAASC,EAAOC,GAAe;AAC7B,MAAAH,EAAM,UAAUG,CAAK;AAAA,IACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"x-tab-group-ngNByee3.js","sources":["../src/vue/x-tab-group.vue"],"sourcesContent":["<!--\nSee the LICENSE file distributed with this work for additional\ninformation regarding copyright ownership.\n\nThis is free software; you can redistribute it and/or modify it\nunder the terms of the GNU Lesser General Public License as\npublished by the Free Software Foundation; either version 2.1 of\nthe License, or (at your option) any later version.\n\nThis software is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\nLesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public\nLicense along with this software; if not, write to the Free\nSoftware Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n02110-1301 USA, or see the FSF site: http://www.fsf.org.\n-->\n<script setup lang=\"ts\">\nimport { ref } from \"vue\";\nconst tab = ref(null);\n\nconst emits = defineEmits([\"change\"]);\n\nfunction change(tabId: unknown) {\n if (typeof tabId == \"string\") {\n emits(\"change\", tabId);\n }\n}\n</script>\n\n<template>\n <v-card class=\"mx-auto\">\n <v-tabs v-model=\"tab\" @update:model-value=\"change\">\n <slot name=\"tabs\"></slot>\n </v-tabs>\n <v-card-text>\n <v-tabs-window v-model=\"tab\">\n <slot name=\"panels\"></slot>\n </v-tabs-window>\n </v-card-text>\n </v-card>\n</template>\n\n<style scoped></style>\n"],"names":["tab","ref","emits","__emit","change","tabId"],"mappings":";;;;;AAqBM,UAAAA,IAAMC,EAAI,IAAI,GAEdC,IAAQC;AAEd,aAASC,EAAOC,GAAgB;AAC1B,MAAA,OAAOA,KAAS,YAClBH,EAAM,UAAUG,CAAK;AAAA,IAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,7 @@
1
- import { defineComponent as a, computed as l, openBlock as u, createBlock as m, unref as p } from "vue";
2
- import { m as i } from "./translations-CFfpgNrx.js";
1
+ import { defineComponent as a, computed as l, openBlock as u, createBlock as m, unref as i } from "vue";
2
+ import { t as p } from "./translations-BNEIsfPR.js";
3
3
  import { useI18n as f } from "vue-i18n";
4
- import { a as c } from "./index-CkW0K4NP.js";
4
+ import { a as c } from "./index-BMliq0dk.js";
5
5
  const y = /* @__PURE__ */ a({
6
6
  __name: "x-text-field",
7
7
  props: {
@@ -11,12 +11,12 @@ const y = /* @__PURE__ */ a({
11
11
  },
12
12
  setup(t) {
13
13
  const { t: n } = f({
14
- messages: i
14
+ messages: p
15
15
  }), o = t, s = l(() => {
16
16
  const e = [];
17
17
  return o.required && e.push((r) => r ? !0 : n("vuetify.text.input.mandatory")), e;
18
18
  });
19
- return (e, r) => (u(), m(p(c), {
19
+ return (e, r) => (u(), m(i(c), {
20
20
  label: e.label,
21
21
  name: e.name,
22
22
  rules: s.value
@@ -26,4 +26,4 @@ const y = /* @__PURE__ */ a({
26
26
  export {
27
27
  y as default
28
28
  };
29
- //# sourceMappingURL=x-text-field-Ccv2SH00.js.map
29
+ //# sourceMappingURL=x-text-field-uL1ePP_x.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"x-text-field-Ccv2SH00.js","sources":["../src/vue/form/x-text-field.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { type TextFieldProps } from \"@xwiki/cristal-dsapi\";\nimport { computed } from \"vue\";\nimport { VTextField } from \"vuetify/components/VTextField\";\nimport messages from \"../../translations\";\nimport { useI18n } from \"vue-i18n\";\n\nconst { t } = useI18n({\n messages,\n});\nconst props = defineProps<TextFieldProps>();\n\nconst rules = computed(() => {\n const rulesList = [];\n if (props.required) {\n rulesList.push((value: unknown) => {\n if (value) {\n return true;\n } else {\n return t(\"vuetify.text.input.mandatory\");\n }\n });\n }\n return rulesList;\n});\n</script>\n\n<template>\n <v-text-field :label=\"label\" :name=\"name\" :rules=\"rules\"></v-text-field>\n</template>\n\n<style scoped></style>\n"],"names":["t","useI18n","messages","props","__props","rules","computed","rulesList","value"],"mappings":";;;;;;;;;;;;AAOM,UAAA,EAAE,GAAAA,EAAE,IAAIC,EAAQ;AAAA,MACpB,UAAAC;AAAA,IAAA,CACD,GACKC,IAAQC,GAERC,IAAQC,EAAS,MAAM;AAC3B,YAAMC,IAAY,CAAA;AAClB,aAAIJ,EAAM,YACEI,EAAA,KAAK,CAACC,MACVA,IACK,KAEAR,EAAE,8BAA8B,CAE1C,GAEIO;AAAA,IAAA,CACR;;;;;;;;"}
1
+ {"version":3,"file":"x-text-field-uL1ePP_x.js","sources":["../src/vue/form/x-text-field.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { type TextFieldProps } from \"@xwiki/cristal-dsapi\";\nimport { computed } from \"vue\";\nimport { VTextField } from \"vuetify/components/VTextField\";\nimport messages from \"../../translations\";\nimport { useI18n } from \"vue-i18n\";\n\nconst { t } = useI18n({\n messages,\n});\nconst props = defineProps<TextFieldProps>();\n\nconst rules = computed(() => {\n const rulesList = [];\n if (props.required) {\n rulesList.push((value: unknown) => {\n if (value) {\n return true;\n } else {\n return t(\"vuetify.text.input.mandatory\");\n }\n });\n }\n return rulesList;\n});\n</script>\n\n<template>\n <v-text-field :label=\"label\" :name=\"name\" :rules=\"rules\"></v-text-field>\n</template>\n\n<style scoped></style>\n"],"names":["t","useI18n","messages","props","__props","rules","computed","rulesList","value"],"mappings":";;;;;;;;;;;;AAOM,UAAA,EAAE,GAAAA,EAAE,IAAIC,EAAQ;AAAA,MAAA,UACpBC;AAAAA,IAAA,CACD,GACKC,IAAQC,GAERC,IAAQC,EAAS,MAAM;AAC3B,YAAMC,IAAY,CAAA;AAClB,aAAIJ,EAAM,YACEI,EAAA,KAAK,CAACC,MACVA,IACK,KAEAR,EAAE,8BAA8B,CAE1C,GAEIO;AAAA,IAAA,CACR;;;;;;;;"}
@@ -0,0 +1 @@
1
+ {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-dsvuetify",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -23,22 +23,24 @@
23
23
  "main": "./dist/index.es.js",
24
24
  "dependencies": {
25
25
  "inversify": "6.0.2",
26
- "vue": "3.4.29",
27
- "vue-i18n": "9.13.1",
28
- "vuetify": "3.6.10",
29
- "@xwiki/cristal-api": "0.9.0",
30
- "@xwiki/cristal-dsapi": "0.9.0"
26
+ "vue": "3.5.12",
27
+ "vue-i18n": "10.0.4",
28
+ "vuetify": "3.7.2",
29
+ "@xwiki/cristal-api": "0.11.0",
30
+ "@xwiki/cristal-dsapi": "0.11.0",
31
+ "@xwiki/cristal-navigation-tree-api": "0.11.0"
31
32
  },
32
33
  "devDependencies": {
33
- "rimraf": "5.0.7",
34
- "vue-tsc": "2.0.21"
34
+ "@vue/test-utils": "2.4.6",
35
+ "vue-tsc": "2.1.6",
36
+ "@xwiki/cristal-dev-config": "0.11.0"
35
37
  },
36
38
  "scripts": {
37
39
  "build": "pnpm compile",
38
40
  "clean": "rimraf dist",
39
41
  "compile": "vue-tsc --project tsconfig.json && vite build",
40
42
  "lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0",
41
- "test": "echo 'no test'"
43
+ "test": "vitest --run"
42
44
  },
43
45
  "types": "./dist/index.d.ts"
44
46
  }
@@ -24,6 +24,7 @@ import { VCol, VContainer, VRow, VTextField } from "vuetify/components";
24
24
  import type { DesignSystemLoader } from "@xwiki/cristal-api";
25
25
 
26
26
  import { createVuetify } from "vuetify";
27
+ import colors from "vuetify/util/colors";
27
28
  import { mdi } from "vuetify/iconsets/mdi";
28
29
  import * as directives from "vuetify/directives";
29
30
  import { injectable } from "inversify";
@@ -56,6 +57,18 @@ export class VuetifyDesignSystemLoader implements DesignSystemLoader {
56
57
  mdi,
57
58
  },
58
59
  },
60
+ theme: {
61
+ themes: {
62
+ light: {
63
+ dark: false,
64
+ colors: {
65
+ background: "#FFFFFF",
66
+ primary: colors.blue.darken4,
67
+ secondary: colors.blueGrey.darken4,
68
+ },
69
+ },
70
+ },
71
+ },
59
72
  });
60
73
  app.use(vuetify);
61
74
  // Native Vuetify components
@@ -83,6 +96,11 @@ export class VuetifyDesignSystemLoader implements DesignSystemLoader {
83
96
  "XMenuItem",
84
97
  () => import("../vue/x-menu-item.vue"),
85
98
  );
99
+ registerAsyncComponent(
100
+ app,
101
+ "XMenuLabel",
102
+ () => import("../vue/x-menu-label.vue"),
103
+ );
86
104
  registerAsyncComponent(
87
105
  app,
88
106
  "XBreadcrumb",
@@ -115,5 +133,10 @@ export class VuetifyDesignSystemLoader implements DesignSystemLoader {
115
133
  "XFileInput",
116
134
  () => import("../vue/form/x-file-input.vue"),
117
135
  );
136
+ registerAsyncComponent(
137
+ app,
138
+ "XNavigationTree",
139
+ () => import("../vue/x-navigation-tree.vue"),
140
+ );
118
141
  }
119
142
  }
@@ -0,0 +1,42 @@
1
+ /*
2
+ * See the LICENSE file distributed with this work for additional
3
+ * information regarding copyright ownership.
4
+ *
5
+ * This is free software; you can redistribute it and/or modify it
6
+ * under the terms of the GNU Lesser General Public License as
7
+ * published by the Free Software Foundation; either version 2.1 of
8
+ * the License, or (at your option) any later version.
9
+ *
10
+ * This software is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this software; if not, write to the Free
17
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
+ */
20
+
21
+ import { createVuetify } from "vuetify";
22
+ import * as components from "vuetify/components";
23
+ import * as directives from "vuetify/directives";
24
+
25
+ const vuetify = createVuetify({
26
+ components,
27
+ directives,
28
+ });
29
+
30
+ /**
31
+ * Provide the required options for testing vuetify, and merge them with existing
32
+ * @param options - the existing options to merge
33
+ */
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ export function addVuetifyOptions(options: any) {
36
+ return {
37
+ ...options,
38
+ global: {
39
+ plugins: [vuetify],
40
+ },
41
+ };
42
+ }
@@ -0,0 +1,53 @@
1
+ /*
2
+ * See the LICENSE file distributed with this work for additional
3
+ * information regarding copyright ownership.
4
+ *
5
+ * This is free software; you can redistribute it and/or modify it
6
+ * under the terms of the GNU Lesser General Public License as
7
+ * published by the Free Software Foundation; either version 2.1 of
8
+ * the License, or (at your option) any later version.
9
+ *
10
+ * This software is distributed in the hope that it will be useful,
11
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ * Lesser General Public License for more details.
14
+ *
15
+ * You should have received a copy of the GNU Lesser General Public
16
+ * License along with this software; if not, write to the Free
17
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
+ */
20
+ import { describe, expect, it } from "vitest";
21
+ import { mount, VueWrapper } from "@vue/test-utils";
22
+ import XBtn from "../x-btn.vue";
23
+ import { addVuetifyOptions } from "./utils/vuetify";
24
+
25
+ /**
26
+ * Mount a XBtn component with the default configuration.
27
+ * @param options - additional wrapper options, overriding the default ones
28
+ */
29
+ function mountXBtn(options: unknown): VueWrapper {
30
+ return mount(XBtn, addVuetifyOptions(options));
31
+ }
32
+
33
+ describe("x-btn", () => {
34
+ it("display the slot", () => {
35
+ const xBtn = mountXBtn({
36
+ slots: {
37
+ default: "Content",
38
+ },
39
+ });
40
+ expect(xBtn.text()).eq("Content");
41
+ });
42
+ it("uses the variant", () => {
43
+ const xBtn = mountXBtn({
44
+ props: {
45
+ variant: "danger",
46
+ },
47
+ slots: {
48
+ default: "Content",
49
+ },
50
+ });
51
+ expect(xBtn.classes()).toContain("text-error");
52
+ });
53
+ });
@@ -26,10 +26,11 @@
26
26
 
27
27
  :root {
28
28
  --cr-sizes-max-page-width: 960px; /*This value controls the width of the main content. It should be 100% for spanning text along the whole width or an arbitraty value*/
29
- --cr-sizes-left-sidebar-width: 15%; /*The default width of the sidebar*/
30
- --cr-sizes-left-sidebar-min-width: 250px; /*The minimum width of the sidebar*/
31
- --cr-sizes-collapsed-sidebar-width: 32px; /*The width of the bar that gets shown containing the menu button to reopen the standard left sidebar*/
29
+ --cr-sizes-main-sidebar-width: 15%; /*The default width of the main sidebar*/
30
+ --cr-sizes-main-sidebar-min-width: 250px; /*The minimum width of the main sidebar*/
31
+ --cr-sizes-collapsed-main-sidebar-width: 32px; /*The width of the bar that gets shown containing the menu button to reopen the standard main main sidebar*/
32
32
  --cr-base-font-size: 16px;
33
+ --cr-base-text-color: var(--cr-color-gray-950);
33
34
 
34
35
 
35
36
  /*
@@ -17,23 +17,20 @@ License along with this software; if not, write to the Free
17
17
  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
18
  02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
19
  -->
20
+ <script setup lang="ts">
21
+ import type { AlertProps } from "@xwiki/cristal-dsapi";
22
+
23
+ defineProps<AlertProps>();
24
+ </script>
20
25
  <template>
21
- <v-alert :title="title" :type="type">
22
- <slot />
26
+ <v-alert closable :title="title" :type="type" :text="description">
27
+ <x-btn
28
+ v-for="action of actions"
29
+ :key="action.name"
30
+ size="small"
31
+ variant="text"
32
+ @click="action.callback"
33
+ >{{ action.name }}</x-btn
34
+ >
23
35
  </v-alert>
24
36
  </template>
25
- <script lang="ts">
26
- import type { PropType } from "vue";
27
- import type { VAlert } from "vuetify/lib/components/VAlert/index.mjs";
28
-
29
- export default {
30
- components: {},
31
- props: {
32
- title: { type: String, required: true },
33
- type: {
34
- type: Object as PropType<VAlert["type"] | undefined>,
35
- required: true,
36
- },
37
- },
38
- };
39
- </script>
@@ -37,4 +37,8 @@ const items = computed(() => {
37
37
  <v-breadcrumbs :items="items"></v-breadcrumbs>
38
38
  </template>
39
39
 
40
- <style scoped></style>
40
+ <style scoped>
41
+ .v-breadcrumbs {
42
+ padding: 0;
43
+ }
44
+ </style>
package/src/vue/x-btn.vue CHANGED
@@ -17,8 +17,41 @@ License along with this software; if not, write to the Free
17
17
  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
18
  02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
19
  -->
20
+ <script lang="ts" setup>
21
+ import { computed } from "vue";
22
+ import { type BtnProps } from "@xwiki/cristal-dsapi";
23
+
24
+ const { variant } = defineProps<BtnProps>();
25
+
26
+ // Map the variants to corresponding vuetify colors.
27
+ const color = computed(() => {
28
+ let color = undefined;
29
+ switch (variant) {
30
+ case "default":
31
+ break;
32
+ case "primary":
33
+ color = "primary";
34
+ break;
35
+ case "success":
36
+ color = "success";
37
+ break;
38
+ case "neutral":
39
+ color = "secondary";
40
+ break;
41
+ case "warning":
42
+ color = "warning";
43
+ break;
44
+ case "danger":
45
+ color = "error";
46
+ break;
47
+ }
48
+ return color;
49
+ });
50
+
51
+ const vVariant = computed(() => (variant == "text" ? "text" : "tonal"));
52
+ </script>
20
53
  <template>
21
- <v-btn>
54
+ <v-btn :color="color" :variant="vVariant">
22
55
  <slot />
23
56
  </v-btn>
24
57
  </template>
@@ -18,5 +18,5 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
18
  02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
19
  -->
20
20
  <template>
21
- <v-divider :thickness="2" class="border-opacity-100" color="info" />
21
+ <v-divider />
22
22
  </template>
@@ -19,11 +19,11 @@ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19
19
  -->
20
20
  <script lang="ts" setup>
21
21
  defineProps<{
22
- title: string;
22
+ value: string;
23
23
  }>();
24
24
  </script>
25
25
  <template>
26
- <v-list-item>
26
+ <v-list-item :value="value">
27
27
  <slot name="default" />
28
28
  </v-list-item>
29
29
  </template>
@@ -0,0 +1,25 @@
1
+ <!--
2
+ See the LICENSE file distributed with this work for additional
3
+ information regarding copyright ownership.
4
+
5
+ This is free software; you can redistribute it and/or modify it
6
+ under the terms of the GNU Lesser General Public License as
7
+ published by the Free Software Foundation; either version 2.1 of
8
+ the License, or (at your option) any later version.
9
+
10
+ This software is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ Lesser General Public License for more details.
14
+
15
+ You should have received a copy of the GNU Lesser General Public
16
+ License along with this software; if not, write to the Free
17
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
+ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
+ -->
20
+ <script lang="ts" setup></script>
21
+ <template>
22
+ <v-list-subheader>
23
+ <slot name="default" />
24
+ </v-list-subheader>
25
+ </template>
@@ -17,13 +17,15 @@ License along with this software; if not, write to the Free
17
17
  Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18
18
  02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
19
  -->
20
- <script lang="ts" setup>
21
- defineProps<{
22
- title: string;
23
- }>();
24
- </script>
20
+ <script lang="ts" setup></script>
25
21
  <template>
26
- <v-menu open-on-hover>
22
+ <!-- v-menu needs to be attached inside Cristal DOM to fix its z-index.
23
+ We also reset the default z-index to set it in the style section. -->
24
+ <v-menu
25
+ :close-on-content-click="false"
26
+ attach="#xwCristalApp"
27
+ z-index="initial"
28
+ >
27
29
  <template #activator="{ props }">
28
30
  <span v-bind="props">
29
31
  <slot name="activator" />
@@ -34,3 +36,8 @@ defineProps<{
34
36
  </v-list>
35
37
  </v-menu>
36
38
  </template>
39
+ <style scoped>
40
+ .v-overlay {
41
+ z-index: var(--cr-z-index-dropdown);
42
+ }
43
+ </style>