@data-fair/lib-vuetify 1.0.0 → 1.1.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.
@@ -0,0 +1,11 @@
1
+ // made for https://github.com/unplugin/unplugin-auto-import
2
+ import vueAutoImports from '@data-fair/lib-vue/auto-imports.js'
3
+ export default [
4
+ ...vueAutoImports,
5
+ {
6
+ '@data-fair/lib-vuetify/personal-menu.vue': [['default', 'dfPersonalMenu']],
7
+ '@data-fair/lib-vuetify/tutorial-alert.vue': [['default', 'dfTutorialAlert']],
8
+ '@data-fair/lib-vuetify/user-avatar.vue': [['default', 'dfUserAvatar']]
9
+ }
10
+ ]
11
+ // # sourceMappingURL=auto-imports.js.map
@@ -1,4 +1,4 @@
1
- <script setup>
1
+ <script setup lang="ts">
2
2
  import { ref, watch } from 'vue'
3
3
 
4
4
  const props = defineProps({
@@ -1,11 +1,42 @@
1
- declare const _default: import("vue").DefineComponent<{}, {
2
- label?: string | undefined;
3
- max?: string | undefined;
4
- min?: string | undefined;
5
- $props: {
6
- readonly label?: string | undefined;
7
- readonly max?: string | undefined;
8
- readonly min?: string | undefined;
9
- };
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ min: {
3
+ type: StringConstructor;
4
+ default: undefined;
5
+ };
6
+ max: {
7
+ type: StringConstructor;
8
+ default: undefined;
9
+ };
10
+ label: {
11
+ type: StringConstructor;
12
+ default: undefined;
13
+ };
14
+ modelValue: {
15
+ type: import("vue").PropType<string>;
16
+ };
17
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ "update:modelValue": (modelValue: string | undefined) => any;
19
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
+ min: {
21
+ type: StringConstructor;
22
+ default: undefined;
23
+ };
24
+ max: {
25
+ type: StringConstructor;
26
+ default: undefined;
27
+ };
28
+ label: {
29
+ type: StringConstructor;
30
+ default: undefined;
31
+ };
32
+ modelValue: {
33
+ type: import("vue").PropType<string>;
34
+ };
35
+ }>> & Readonly<{
36
+ "onUpdate:modelValue"?: ((modelValue: string | undefined) => any) | undefined;
37
+ }>, {
38
+ label: string;
39
+ max: string;
40
+ min: string;
41
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
42
  export default _default;
@@ -114,20 +114,33 @@ function __VLS_template() {
114
114
  const __VLS_self = (await import('vue')).defineComponent({
115
115
  setup() {
116
116
  return {
117
- $props: __VLS_makeOptional(props),
118
- ...props,
119
117
  model: model,
120
118
  start: start,
121
119
  end: end,
122
120
  };
123
121
  },
122
+ __typeEmits: {},
123
+ props: {
124
+ ...{},
125
+ ...{
126
+ min: { type: String, default: undefined },
127
+ max: { type: String, default: undefined },
128
+ label: { type: String, default: undefined }
129
+ },
130
+ },
124
131
  });
125
132
  export default (await import('vue')).defineComponent({
126
133
  setup() {
127
- return {
128
- $props: __VLS_makeOptional(props),
129
- ...props,
130
- };
134
+ return {};
135
+ },
136
+ __typeEmits: {},
137
+ props: {
138
+ ...{},
139
+ ...{
140
+ min: { type: String, default: undefined },
141
+ max: { type: String, default: undefined },
142
+ label: { type: String, default: undefined }
143
+ },
131
144
  },
132
145
  });
133
146
  ;
package/default.scss ADDED
@@ -0,0 +1,10 @@
1
+ @use 'vuetify' with (
2
+ $color-pack: false,
3
+ $body-font-family: 'Nunito'
4
+ );
5
+
6
+ // v-icon has an opacity when it is prepended in a list of items.
7
+ // ref: https://github.com/vuetifyjs/vuetify/issues/18760
8
+ .v-icon {
9
+ --v-medium-emphasis-opacity: 1 !important;
10
+ }
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { VuetifyOptions } from 'vuetify';
2
- export declare function defaultOptions(searchParams: Record<string, string>, darkCookie?: boolean): VuetifyOptions;
2
+ export declare function defaultOptions(searchParams: Record<string, string>, darkCookie?: boolean, locale?: 'fr' | 'en'): VuetifyOptions;
package/index.js CHANGED
@@ -13,7 +13,7 @@ const baseDarkColors = {
13
13
  primary: '#2196F3', // blue.base
14
14
  success: '#00E676' // green.accent3
15
15
  }
16
- export function defaultOptions (searchParams, darkCookie = false) {
16
+ export function defaultOptions (searchParams, darkCookie = false, locale = 'fr') {
17
17
  const dark = searchParams?.dark ? searchParams.dark === 'true' : darkCookie
18
18
  const searchParamsColors = {}
19
19
  for (const colorCode of ['primary', 'secondary']) {
@@ -25,9 +25,9 @@ export function defaultOptions (searchParams, darkCookie = false) {
25
25
  return {
26
26
  ssr: false,
27
27
  locale: {
28
- locale: 'fr',
28
+ locale,
29
29
  messages: { fr, en }
30
- }, // TODO: sync this with the i18n locale
30
+ },
31
31
  theme: {
32
32
  defaultTheme,
33
33
  themes: {
package/owner-avatar.vue CHANGED
@@ -17,7 +17,7 @@
17
17
  </v-tooltip>
18
18
  </template>
19
19
 
20
- <script setup>
20
+ <script setup lang="ts">
21
21
  import { computed } from 'vue'
22
22
 
23
23
  const ownerProps = defineProps({
@@ -1,7 +1,14 @@
1
- declare const _default: import("vue").DefineComponent<{}, {
2
- owner: Record<string, any>;
3
- $props: {
4
- readonly owner?: Record<string, any> | undefined;
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ owner: {
3
+ type: ObjectConstructor;
4
+ default: null;
5
+ };
6
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
7
+ owner: {
8
+ type: ObjectConstructor;
9
+ default: null;
5
10
  };
6
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ }>> & Readonly<{}>, {
12
+ owner: Record<string, any>;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
14
  export default _default;
@@ -84,19 +84,26 @@ function __VLS_template() {
84
84
  const __VLS_self = (await import('vue')).defineComponent({
85
85
  setup() {
86
86
  return {
87
- $props: __VLS_makeOptional(ownerProps),
88
- ...ownerProps,
89
87
  avatarUrl: avatarUrl,
90
88
  label: label,
91
89
  };
92
90
  },
91
+ props: {
92
+ owner: {
93
+ type: Object,
94
+ default: null
95
+ }
96
+ },
93
97
  });
94
98
  export default (await import('vue')).defineComponent({
95
99
  setup() {
96
- return {
97
- $props: __VLS_makeOptional(ownerProps),
98
- ...ownerProps,
99
- };
100
+ return {};
101
+ },
102
+ props: {
103
+ owner: {
104
+ type: Object,
105
+ default: null
106
+ }
100
107
  },
101
108
  });
102
109
  ;
package/owner-pick.vue CHANGED
@@ -37,12 +37,12 @@ en:
37
37
  message: Choisissez un propriétaire
38
38
  </i18n>
39
39
 
40
- <script setup>
40
+ <script setup lang="ts">
41
41
  import { watch, computed } from 'vue'
42
42
  import { computedAsync } from '@vueuse/core'
43
43
  import { ofetch } from 'ofetch'
44
44
  import { useI18n } from 'vue-i18n'
45
- import { useSessionAuthenticated } from '@data-fair/lib/vue/session.js'
45
+ import { useSessionAuthenticated, type Account } from '@data-fair/lib-vue/session.js'
46
46
 
47
47
  const { t } = useI18n({ useScope: 'local' })
48
48
 
@@ -60,8 +60,7 @@ const session = useSessionAuthenticated()
60
60
  const owners = computedAsync(async () => {
61
61
  const user = session.state.user
62
62
 
63
- /** @type {import('@data-fair/lib-common-types/session').Account[]} */
64
- const owners = []
63
+ const owners: Account[] = []
65
64
  if (props.otherAccounts || session.state.account.type === 'user') {
66
65
  owners.push({ type: 'user', id: user.id, name: user.name })
67
66
  }
@@ -92,10 +91,7 @@ const owners = computedAsync(async () => {
92
91
  return owners
93
92
  })
94
93
 
95
- /**
96
- * @param {import('@data-fair/lib-common-types/session').Account} owner
97
- */
98
- const getLabel = (owner) => {
94
+ const getLabel = (owner: Account) => {
99
95
  if (owner.type === 'user' && owner.id === session.state.user?.id) return t('yourself')
100
96
  if (owner.type === 'organization') {
101
97
  if (owner.department) return `${t('org')} ${owner.name} / ${owner.departmentName || owner.department}`
@@ -1,11 +1,50 @@
1
- declare const _default: import("vue").DefineComponent<{}, {
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ otherAccounts: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ hideSingle: {
7
+ type: BooleanConstructor;
8
+ default: boolean;
9
+ };
10
+ message: {
11
+ type: StringConstructor;
12
+ default: null;
13
+ };
14
+ modelValue: {
15
+ type: import("vue").PropType<any>;
16
+ };
17
+ ready: {
18
+ type: import("vue").PropType<boolean>;
19
+ };
20
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ "update:modelValue": (modelValue: any) => any;
22
+ "update:ready": (ready: boolean) => any;
23
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
24
+ otherAccounts: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ hideSingle: {
29
+ type: BooleanConstructor;
30
+ default: boolean;
31
+ };
32
+ message: {
33
+ type: StringConstructor;
34
+ default: null;
35
+ };
36
+ modelValue: {
37
+ type: import("vue").PropType<any>;
38
+ };
39
+ ready: {
40
+ type: import("vue").PropType<boolean>;
41
+ };
42
+ }>> & Readonly<{
43
+ "onUpdate:modelValue"?: ((modelValue: any) => any) | undefined;
44
+ "onUpdate:ready"?: ((ready: boolean) => any) | undefined;
45
+ }>, {
46
+ message: string;
2
47
  otherAccounts: boolean;
3
48
  hideSingle: boolean;
4
- message: string;
5
- $props: {
6
- readonly otherAccounts?: boolean | undefined;
7
- readonly hideSingle?: boolean | undefined;
8
- readonly message?: string | undefined;
9
- };
10
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
49
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
50
  export default _default;
package/owner-pick.vue.js CHANGED
@@ -3,7 +3,7 @@ import { watch, computed } from 'vue';
3
3
  import { computedAsync } from '@vueuse/core';
4
4
  import { ofetch } from 'ofetch';
5
5
  import { useI18n } from 'vue-i18n';
6
- import { useSessionAuthenticated } from '@data-fair/lib/vue/session.js';
6
+ import { useSessionAuthenticated } from '@data-fair/lib-vue/session.js';
7
7
  const { defineProps, defineSlots, defineEmits, defineExpose, defineModel, defineOptions, withDefaults, } = await import('vue');
8
8
  const { t } = useI18n({ useScope: 'local' });
9
9
  const props = defineProps({
@@ -16,7 +16,6 @@ const ready = defineModel('ready', { type: Boolean, default: false });
16
16
  const session = useSessionAuthenticated();
17
17
  const owners = computedAsync(async () => {
18
18
  const user = session.state.user;
19
- /** @type {import('@data-fair/lib-common-types/session').Account[]} */
20
19
  const owners = [];
21
20
  if (props.otherAccounts || session.state.account.type === 'user') {
22
21
  owners.push({ type: 'user', id: user.id, name: user.name });
@@ -47,9 +46,6 @@ const owners = computedAsync(async () => {
47
46
  }
48
47
  return owners;
49
48
  });
50
- /**
51
- * @param {import('@data-fair/lib-common-types/session').Account} owner
52
- */
53
49
  const getLabel = (owner) => {
54
50
  if (owner.type === 'user' && owner.id === session.state.user?.id)
55
51
  return t('yourself');
@@ -164,8 +160,6 @@ function __VLS_template() {
164
160
  const __VLS_self = (await import('vue')).defineComponent({
165
161
  setup() {
166
162
  return {
167
- $props: __VLS_makeOptional(props),
168
- ...props,
169
163
  t: t,
170
164
  model: model,
171
165
  owners: owners,
@@ -173,13 +167,28 @@ const __VLS_self = (await import('vue')).defineComponent({
173
167
  status: status,
174
168
  };
175
169
  },
170
+ __typeEmits: {},
171
+ props: {
172
+ ...{},
173
+ ...{
174
+ otherAccounts: { type: Boolean, default: false },
175
+ hideSingle: { type: Boolean, default: true },
176
+ message: { type: String, default: null }
177
+ },
178
+ },
176
179
  });
177
180
  export default (await import('vue')).defineComponent({
178
181
  setup() {
179
- return {
180
- $props: __VLS_makeOptional(props),
181
- ...props,
182
- };
182
+ return {};
183
+ },
184
+ __typeEmits: {},
185
+ props: {
186
+ ...{},
187
+ ...{
188
+ otherAccounts: { type: Boolean, default: false },
189
+ hideSingle: { type: Boolean, default: true },
190
+ message: { type: String, default: null }
191
+ },
183
192
  },
184
193
  });
185
194
  ;
package/package.json CHANGED
@@ -1,25 +1,29 @@
1
1
  {
2
2
  "name": "@data-fair/lib-vuetify",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Components based on the Vuetify 3 UI lib for the data-fair stack.",
5
5
  "main": "index.js",
6
6
  "files": [
7
7
  "**/*.js",
8
8
  "**/*.d.ts",
9
- "**/*.vue"
9
+ "**/*.vue",
10
+ "**/*.scss"
10
11
  ],
11
12
  "author": "",
12
13
  "license": "MIT",
13
14
  "scripts": {
14
- "prepublishOnly": "cd .. && npm run prepublishOnly"
15
+ "prepublishOnly": "cd .. && npm run prepublishOnly",
16
+ "build": "cd .. && npm run build"
15
17
  },
16
18
  "peerDependencies": {
17
- "ofetch": "^1.4.0",
18
- "vue-i18n": "^10.0.4",
19
- "vuetify": "^3.7.2"
19
+ "@data-fair/lib-vue": "^1.1.0",
20
+ "ofetch": "1",
21
+ "vue-i18n": "10",
22
+ "vuetify": "3"
20
23
  },
21
24
  "type": "module",
22
25
  "dependencies": {
23
- "@data-fair/lib-common-types": "^1.1.0"
26
+ "@data-fair/lib-common-types": "^1.1.0",
27
+ "@mdi/js": "^7.4.47"
24
28
  }
25
29
  }
package/personal-menu.vue CHANGED
@@ -224,10 +224,10 @@ en:
224
224
  cancelDeletion: Cancel the deletion of the user
225
225
  </i18n>
226
226
 
227
- <script setup>
227
+ <script setup lang="ts">
228
228
  import { computed, toRefs } from 'vue'
229
229
  import { useI18n } from 'vue-i18n'
230
- import { useSession } from '@data-fair/lib/vue/session.js'
230
+ import { useSession } from '@data-fair/lib-vue/session.js'
231
231
  import { useTheme } from 'vuetify'
232
232
  import UserAvatar from './user-avatar.vue'
233
233
 
@@ -1,19 +1,28 @@
1
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
2
- export default _default;
3
- type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
- $slots: S;
5
- });
6
- declare const __VLS_component: import("vue").DefineComponent<{}, {
7
- darkModeSwitch: boolean;
8
- $props: {
9
- readonly darkModeSwitch?: boolean | undefined;
10
- };
11
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
12
- type __VLS_TemplateResult = {
1
+ declare function __VLS_template(): {
13
2
  slots: {
14
3
  "actions-before"?(_: {}): any;
15
4
  };
16
5
  refs: {};
17
- attrs: Partial<typeof __VLS_inheritedAttrs>;
6
+ attrs: Partial<{}>;
7
+ };
8
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
9
+ declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
10
+ darkModeSwitch: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
15
+ darkModeSwitch: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
19
+ }>> & Readonly<{}>, {
20
+ darkModeSwitch: boolean;
21
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
22
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
23
+ export default _default;
24
+ type __VLS_WithTemplateSlots<T, S> = T & {
25
+ new (): {
26
+ $slots: S;
27
+ };
18
28
  };
19
- declare var __VLS_inheritedAttrs: {};
@@ -1,7 +1,7 @@
1
1
  /// <reference types=".vue-global-types/vue_3.5_false.d.ts" />
2
2
  import { computed, toRefs } from 'vue';
3
3
  import { useI18n } from 'vue-i18n';
4
- import { useSession } from '@data-fair/lib/vue/session.js';
4
+ import { useSession } from '@data-fair/lib-vue/session.js';
5
5
  import { useTheme } from 'vuetify';
6
6
  import UserAvatar from './user-avatar.vue';
7
7
  const { defineProps, defineSlots, defineEmits, defineExpose, defineModel, defineOptions, withDefaults, } = await import('vue');
@@ -459,8 +459,6 @@ function __VLS_template() {
459
459
  const __VLS_self = (await import('vue')).defineComponent({
460
460
  setup() {
461
461
  return {
462
- $props: __VLS_makeOptional(__VLS_props),
463
- ...__VLS_props,
464
462
  UserAvatar: UserAvatar,
465
463
  theme: theme,
466
464
  session: session,
@@ -470,13 +468,22 @@ const __VLS_self = (await import('vue')).defineComponent({
470
468
  switchableOrganizations: switchableOrganizations,
471
469
  };
472
470
  },
471
+ props: {
472
+ darkModeSwitch: {
473
+ type: Boolean,
474
+ default: false
475
+ }
476
+ },
473
477
  });
474
478
  const __VLS_component = (await import('vue')).defineComponent({
475
479
  setup() {
476
- return {
477
- $props: __VLS_makeOptional(__VLS_props),
478
- ...__VLS_props,
479
- };
480
+ return {};
481
+ },
482
+ props: {
483
+ darkModeSwitch: {
484
+ type: Boolean,
485
+ default: false
486
+ }
480
487
  },
481
488
  });
482
489
  export default {};
@@ -61,8 +61,8 @@ en:
61
61
  readDoc: Read the documentation
62
62
  </i18n>
63
63
 
64
- <script>
65
- import { useTheme } from 'vuetify';
64
+ <script lang="ts">
65
+ import { useTheme } from 'vuetify'
66
66
 
67
67
  export default {
68
68
  props: {
@@ -73,9 +73,9 @@ export default {
73
73
  initial: { type: Boolean, default: true },
74
74
  persistent: { type: Boolean, default: false }
75
75
  },
76
- setup() {
76
+ setup () {
77
77
  const theme = useTheme()
78
- return {theme}
78
+ return { theme }
79
79
  },
80
80
  data: () => ({
81
81
  show: false
package/ui-notif.vue ADDED
@@ -0,0 +1,66 @@
1
+ <template>
2
+ <v-snackbar
3
+ v-if="notification"
4
+ ref="notificationSnackbar"
5
+ v-model="showNotification"
6
+ class="ui-notification"
7
+ v-bind="fullSnackbarProps"
8
+ >
9
+ <p>{{ notification.msg }}</p>
10
+ <p
11
+ v-if="notification.type === 'error'"
12
+ class="ml-3"
13
+ v-html="notification.errorMsg"
14
+ />
15
+
16
+ <template #actions>
17
+ <v-btn
18
+ icon
19
+ @click.native="showNotification = false"
20
+ >
21
+ <v-icon :icon="mdiClose" />
22
+ </v-btn>
23
+ </template>
24
+ </v-snackbar>
25
+ </template>
26
+
27
+ <script setup lang="ts">
28
+ import { computed, ref, watch } from 'vue'
29
+ import { useUiNotif } from '@data-fair/lib-vue/ui-notif.js'
30
+ import inIframe from '@data-fair/lib-utils/in-iframe.js'
31
+ import { mdiClose } from '@mdi/js'
32
+
33
+ const uiNotif = useUiNotif()
34
+
35
+ const notification = computed(() => uiNotif.notification.value)
36
+ const showNotification = ref(false)
37
+
38
+ watch(() => notification.value, async () => {
39
+ showNotification.value = false
40
+ if (!inIframe && notification.value) {
41
+ await new Promise(resolve => setTimeout(resolve, 300))
42
+ showNotification.value = true
43
+ }
44
+ }, {immediate: true})
45
+
46
+ const { snackbarProps } = defineProps({
47
+ snackbarProps: {
48
+ type: Object,
49
+ default () {
50
+ return { tile: true, right: true, bottom: true, timeout: 30000 }
51
+ }
52
+ }
53
+ })
54
+
55
+ const fullSnackbarProps = computed(() => {
56
+ const props = { ...snackbarProps }
57
+ if (!notification.value) return props
58
+ if (notification.value.type === 'error') props.timeout = -1
59
+ props.color = notification.value.type
60
+ return props
61
+ })
62
+
63
+ </script>
64
+
65
+ <style>
66
+ </style>
@@ -0,0 +1,24 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ snackbarProps: {
3
+ type: ObjectConstructor;
4
+ default(): {
5
+ tile: boolean;
6
+ right: boolean;
7
+ bottom: boolean;
8
+ timeout: number;
9
+ };
10
+ };
11
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
12
+ snackbarProps: {
13
+ type: ObjectConstructor;
14
+ default(): {
15
+ tile: boolean;
16
+ right: boolean;
17
+ bottom: boolean;
18
+ timeout: number;
19
+ };
20
+ };
21
+ }>> & Readonly<{}>, {
22
+ snackbarProps: Record<string, any>;
23
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
24
+ export default _default;
@@ -0,0 +1,154 @@
1
+ /// <reference types=".vue-global-types/vue_3.5_false.d.ts" />
2
+ import { computed, ref, watch } from 'vue';
3
+ import { useUiNotif } from '@data-fair/lib-vue/ui-notif.js';
4
+ import inIframe from '@data-fair/lib-utils/in-iframe.js';
5
+ import { mdiClose } from '@mdi/js';
6
+ const { defineProps, defineSlots, defineEmits, defineExpose, defineModel, defineOptions, withDefaults, } = await import('vue');
7
+ const uiNotif = useUiNotif();
8
+ const notification = computed(() => uiNotif.notification.value);
9
+ const showNotification = ref(false);
10
+ watch(() => notification.value, async () => {
11
+ showNotification.value = false;
12
+ if (!inIframe && notification.value) {
13
+ await new Promise(resolve => setTimeout(resolve, 300));
14
+ showNotification.value = true;
15
+ }
16
+ }, { immediate: true });
17
+ const __VLS_props = defineProps({
18
+ snackbarProps: {
19
+ type: Object,
20
+ default() {
21
+ return { tile: true, right: true, bottom: true, timeout: 30000 };
22
+ }
23
+ }
24
+ });
25
+ const { snackbarProps } = __VLS_props;
26
+ const fullSnackbarProps = computed(() => {
27
+ const props = { ...snackbarProps };
28
+ if (!notification.value)
29
+ return props;
30
+ if (notification.value.type === 'error')
31
+ props.timeout = -1;
32
+ props.color = notification.value.type;
33
+ return props;
34
+ });
35
+ const __VLS_fnComponent = (await import('vue')).defineComponent({
36
+ props: {
37
+ snackbarProps: {
38
+ type: Object,
39
+ default() {
40
+ return { tile: true, right: true, bottom: true, timeout: 30000 };
41
+ }
42
+ }
43
+ },
44
+ });
45
+ ;
46
+ let __VLS_functionalComponentProps;
47
+ function __VLS_template() {
48
+ const __VLS_ctx = {};
49
+ const __VLS_localComponents = {
50
+ ...{},
51
+ ...{},
52
+ ...__VLS_ctx,
53
+ };
54
+ let __VLS_components;
55
+ const __VLS_localDirectives = {
56
+ ...{},
57
+ ...__VLS_ctx,
58
+ };
59
+ let __VLS_directives;
60
+ let __VLS_styleScopedClasses;
61
+ // CSS variable injection
62
+ // CSS variable injection end
63
+ let __VLS_resolvedLocalAndGlobalComponents;
64
+ if (__VLS_ctx.notification) {
65
+ const __VLS_0 = __VLS_resolvedLocalAndGlobalComponents.VSnackbar;
66
+ /** @type { [typeof __VLS_components.VSnackbar, typeof __VLS_components.vSnackbar, typeof __VLS_components.VSnackbar, typeof __VLS_components.vSnackbar, ] } */
67
+ // @ts-ignore
68
+ const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({ ref: ("notificationSnackbar"), modelValue: ((__VLS_ctx.showNotification)), ...{ class: ("ui-notification") }, ...(__VLS_ctx.fullSnackbarProps), }));
69
+ const __VLS_2 = __VLS_1({ ref: ("notificationSnackbar"), modelValue: ((__VLS_ctx.showNotification)), ...{ class: ("ui-notification") }, ...(__VLS_ctx.fullSnackbarProps), }, ...__VLS_functionalComponentArgsRest(__VLS_1));
70
+ // @ts-ignore navigation for `const notificationSnackbar = ref()`
71
+ __VLS_ctx.notificationSnackbar;
72
+ var __VLS_6 = {};
73
+ __VLS_elementAsFunction(__VLS_intrinsicElements.p, __VLS_intrinsicElements.p)({});
74
+ (__VLS_ctx.notification.msg);
75
+ if (__VLS_ctx.notification.type === 'error') {
76
+ __VLS_elementAsFunction(__VLS_intrinsicElements.p)({ ...{ class: ("ml-3") }, });
77
+ __VLS_directiveAsFunction(__VLS_directives.vHtml)(null, { ...__VLS_directiveBindingRestFields, value: (__VLS_ctx.notification.errorMsg) }, null, null);
78
+ }
79
+ __VLS_elementAsFunction(__VLS_intrinsicElements.template, __VLS_intrinsicElements.template)({});
80
+ {
81
+ const { actions: __VLS_thisSlot } = __VLS_nonNullable(__VLS_5.slots);
82
+ const __VLS_7 = __VLS_resolvedLocalAndGlobalComponents.VBtn;
83
+ /** @type { [typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, typeof __VLS_components.VBtn, typeof __VLS_components.vBtn, ] } */
84
+ // @ts-ignore
85
+ const __VLS_8 = __VLS_asFunctionalComponent(__VLS_7, new __VLS_7({ ...{ 'onClick': {} }, icon: (true), }));
86
+ const __VLS_9 = __VLS_8({ ...{ 'onClick': {} }, icon: (true), }, ...__VLS_functionalComponentArgsRest(__VLS_8));
87
+ let __VLS_13;
88
+ const __VLS_14 = {
89
+ onClick: (...[$event]) => {
90
+ if (!((__VLS_ctx.notification)))
91
+ return;
92
+ __VLS_ctx.showNotification = false;
93
+ }
94
+ };
95
+ let __VLS_10;
96
+ let __VLS_11;
97
+ const __VLS_15 = __VLS_resolvedLocalAndGlobalComponents.VIcon;
98
+ /** @type { [typeof __VLS_components.VIcon, typeof __VLS_components.vIcon, ] } */
99
+ // @ts-ignore
100
+ const __VLS_16 = __VLS_asFunctionalComponent(__VLS_15, new __VLS_15({ icon: ((__VLS_ctx.mdiClose)), }));
101
+ const __VLS_17 = __VLS_16({ icon: ((__VLS_ctx.mdiClose)), }, ...__VLS_functionalComponentArgsRest(__VLS_16));
102
+ __VLS_nonNullable(__VLS_12.slots).default;
103
+ const __VLS_12 = __VLS_pickFunctionalComponentCtx(__VLS_7, __VLS_9);
104
+ }
105
+ const __VLS_5 = __VLS_pickFunctionalComponentCtx(__VLS_0, __VLS_2);
106
+ }
107
+ __VLS_styleScopedClasses['ui-notification'];
108
+ __VLS_styleScopedClasses['ml-3'];
109
+ var __VLS_slots;
110
+ var __VLS_inheritedAttrs;
111
+ const __VLS_refs = {
112
+ "notificationSnackbar": __VLS_6,
113
+ };
114
+ var $refs;
115
+ return {
116
+ slots: __VLS_slots,
117
+ refs: $refs,
118
+ attrs: {},
119
+ };
120
+ }
121
+ ;
122
+ const __VLS_self = (await import('vue')).defineComponent({
123
+ setup() {
124
+ return {
125
+ mdiClose: mdiClose,
126
+ notification: notification,
127
+ showNotification: showNotification,
128
+ fullSnackbarProps: fullSnackbarProps,
129
+ };
130
+ },
131
+ props: {
132
+ snackbarProps: {
133
+ type: Object,
134
+ default() {
135
+ return { tile: true, right: true, bottom: true, timeout: 30000 };
136
+ }
137
+ }
138
+ },
139
+ });
140
+ export default (await import('vue')).defineComponent({
141
+ setup() {
142
+ return {};
143
+ },
144
+ props: {
145
+ snackbarProps: {
146
+ type: Object,
147
+ default() {
148
+ return { tile: true, right: true, bottom: true, timeout: 30000 };
149
+ }
150
+ }
151
+ },
152
+ });
153
+ ;
154
+ //# sourceMappingURL=ui-notif.vue.js.map
package/user-avatar.vue CHANGED
@@ -39,19 +39,19 @@
39
39
  </div>
40
40
  </template>
41
41
 
42
- <script setup>
42
+ <script setup lang="ts">
43
43
  import { computed } from 'vue'
44
- import { useSession } from '@data-fair/lib/vue/session.js'
44
+ import { useSession } from '@data-fair/lib-vue/session.js'
45
45
 
46
46
  const props = defineProps({
47
47
  showAccount: { type: Boolean, default: false }
48
48
  })
49
49
 
50
50
  const session = useSession()
51
- const userAvatarUrl = computed(() => session.state.user && `/simple-directory/api/avatars/user/${session.state.user.id}/avatar.png`)
51
+ const userAvatarUrl = computed(() => session.state.user && `${session.options.directoryUrl}/api/avatars/user/${session.state.user.id}/avatar.png`)
52
52
  const accountAvatarUrl = computed(() => {
53
53
  if (!session.state.account) return
54
- let url = `/simple-directory/api/avatars/${session.state.account.type}/${session.state.account.id}`
54
+ let url = `${session.options.directoryUrl}/api/avatars/${session.state.account.type}/${session.state.account.id}`
55
55
  if (session.state.account.department) url += `/${session.state.account.department}`
56
56
  url += '/avatar.png'
57
57
  return url
@@ -1,7 +1,14 @@
1
- declare const _default: import("vue").DefineComponent<{}, {
2
- showAccount: boolean;
3
- $props: {
4
- readonly showAccount?: boolean | undefined;
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ showAccount: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
7
+ showAccount: {
8
+ type: BooleanConstructor;
9
+ default: boolean;
5
10
  };
6
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
+ }>> & Readonly<{}>, {
12
+ showAccount: boolean;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
7
14
  export default _default;
@@ -1,16 +1,16 @@
1
1
  /// <reference types=".vue-global-types/vue_3.5_false.d.ts" />
2
2
  import { computed } from 'vue';
3
- import { useSession } from '@data-fair/lib/vue/session.js';
3
+ import { useSession } from '@data-fair/lib-vue/session.js';
4
4
  const { defineProps, defineSlots, defineEmits, defineExpose, defineModel, defineOptions, withDefaults, } = await import('vue');
5
5
  const props = defineProps({
6
6
  showAccount: { type: Boolean, default: false }
7
7
  });
8
8
  const session = useSession();
9
- const userAvatarUrl = computed(() => session.state.user && `/simple-directory/api/avatars/user/${session.state.user.id}/avatar.png`);
9
+ const userAvatarUrl = computed(() => session.state.user && `${session.options.directoryUrl}/api/avatars/user/${session.state.user.id}/avatar.png`);
10
10
  const accountAvatarUrl = computed(() => {
11
11
  if (!session.state.account)
12
12
  return;
13
- let url = `/simple-directory/api/avatars/${session.state.account.type}/${session.state.account.id}`;
13
+ let url = `${session.options.directoryUrl}/api/avatars/${session.state.account.type}/${session.state.account.id}`;
14
14
  if (session.state.account.department)
15
15
  url += `/${session.state.account.department}`;
16
16
  url += '/avatar.png';
@@ -91,21 +91,22 @@ function __VLS_template() {
91
91
  const __VLS_self = (await import('vue')).defineComponent({
92
92
  setup() {
93
93
  return {
94
- $props: __VLS_makeOptional(props),
95
- ...props,
96
94
  session: session,
97
95
  userAvatarUrl: userAvatarUrl,
98
96
  accountAvatarUrl: accountAvatarUrl,
99
97
  showSecondAvatar: showSecondAvatar,
100
98
  };
101
99
  },
100
+ props: {
101
+ showAccount: { type: Boolean, default: false }
102
+ },
102
103
  });
103
104
  export default (await import('vue')).defineComponent({
104
105
  setup() {
105
- return {
106
- $props: __VLS_makeOptional(props),
107
- ...props,
108
- };
106
+ return {};
107
+ },
108
+ props: {
109
+ showAccount: { type: Boolean, default: false }
109
110
  },
110
111
  });
111
112
  ;
package/vite.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export declare const autoImports: (string | {
2
+ '@data-fair/lib-vue/session.js': string[];
3
+ '@data-fair/lib-vue/reactive-search-params.js': string[];
4
+ '@data-fair/lib-vue/locale-dayjs.js': string[];
5
+ '@data-fair/lib-vue/concept-filters.js': string[];
6
+ '@data-fair/lib-vue/ui-notif.js': string[];
7
+ } | {
8
+ '@data-fair/lib-vuetify/personal-menu.vue': string[][];
9
+ '@data-fair/lib-vuetify/tutorial-alert.vue': string[][];
10
+ '@data-fair/lib-vuetify/user-avatar.vue': string[][];
11
+ })[];
package/vite.js ADDED
@@ -0,0 +1,11 @@
1
+ // made for https://github.com/unplugin/unplugin-auto-import
2
+ import { autoImports as vueAutoImports } from '@data-fair/lib-vue/vite.js'
3
+ export const autoImports = [
4
+ ...vueAutoImports,
5
+ {
6
+ '@data-fair/lib-vuetify/personal-menu.vue': [['default', 'dfPersonalMenu']],
7
+ '@data-fair/lib-vuetify/tutorial-alert.vue': [['default', 'dfTutorialAlert']],
8
+ '@data-fair/lib-vuetify/user-avatar.vue': [['default', 'dfUserAvatar']]
9
+ }
10
+ ]
11
+ // # sourceMappingURL=vite.js.map