@resee-movies/nuxt-ux 0.2.4 → 0.3.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.
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@resee-movies/nuxt-ux",
3
3
  "configKey": "ux",
4
- "version": "0.2.4",
4
+ "version": "0.3.1",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.0"
package/dist/module.mjs CHANGED
@@ -125,6 +125,7 @@ function importModules(nuxt) {
125
125
  "Dialog",
126
126
  "Drawer",
127
127
  "Message",
128
+ "Menu",
128
129
  "ProgressBar",
129
130
  "ProgressSpinner",
130
131
  "Tag",
@@ -1,7 +1,17 @@
1
1
  <template>
2
2
  <Transition name="fade" mode="out-in">
3
- <ProgressSpinner v-if="props.loading" :size="props.size" class="icon" />
4
- <span v-else role="presentation" :class="['icon', props.name, props.size, { 'color-cycle': props.colorCycle }]" />
3
+ <ProgressSpinner
4
+ v-if = "props.loading"
5
+ :size = "props.size"
6
+ class = "icon"
7
+ />
8
+
9
+ <span
10
+ v-else
11
+ v-bind = "attrs"
12
+ role = "presentation"
13
+ :class = "['icon', props.name, props.size, { 'color-cycle': props.colorCycle }]"
14
+ />
5
15
  </Transition>
6
16
  </template>
7
17
 
@@ -10,7 +20,9 @@
10
20
  </script>
11
21
 
12
22
  <script setup>
23
+ import { useAttrs } from "vue";
13
24
  import ProgressSpinner from "./ProgressSpinner.vue";
25
+ const attrs = useAttrs();
14
26
  const props = defineProps({
15
27
  name: { type: String, required: false, default: void 0 },
16
28
  loading: { type: Boolean, required: false, default: false },
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <slot
3
+ name = "control"
4
+ :toggle = "(event) => menu?.toggle(event)"
5
+ :menu-id = "menuId"
6
+ :expanded = "visible"
7
+ />
8
+
9
+ <PrimeMenu
10
+ ref = "menu"
11
+ v-bind = "attrs"
12
+ :model = "props.model"
13
+ :popup = "true"
14
+ :id = "menuId"
15
+ class = "menu"
16
+ :pt = "passthroughProps"
17
+ @show = "visible = true"
18
+ @hide = "visible = false"
19
+ >
20
+ <template v-if="slots.prefix || props.prefixText" #start>
21
+ <slot name="prefix">
22
+ {{ props.prefixText }}
23
+ </slot>
24
+ </template>
25
+
26
+ <template #item="{ item }">
27
+ <slot name="item">
28
+ <a v-if="item.url" :href="item.url" :target="item.target">
29
+ <IconTextPair
30
+ :text = "isString(item.label) ? item.label : item.label?.()"
31
+ :icon = "item.icon"
32
+ />
33
+ </a>
34
+
35
+ <IconTextPair
36
+ v-else
37
+ :text = "isString(item.label) ? item.label : item.label?.()"
38
+ :icon = "item.icon"
39
+ />
40
+ </slot>
41
+ </template>
42
+
43
+ <template v-if="slots.suffix || props.suffixText" #end>
44
+ <slot name="suffix">
45
+ {{ props.suffixText }}
46
+ </slot>
47
+ </template>
48
+ </PrimeMenu>
49
+ </template>
50
+
51
+ <script>
52
+
53
+ </script>
54
+
55
+ <script setup>
56
+ import { isString } from "@resee-movies/utilities/strings/is-string";
57
+ import PrimeMenu, {} from "primevue/menu";
58
+ import { computed, ref, useAttrs, useId, useSlots } from "vue";
59
+ import IconTextPair from "./IconTextPair.vue";
60
+ defineOptions({
61
+ inheritAttrs: false
62
+ });
63
+ const attrs = useAttrs();
64
+ const slots = useSlots();
65
+ const menuId = useId();
66
+ const menu = ref();
67
+ const visible = ref(false);
68
+ const props = defineProps({
69
+ model: { type: Array, required: true },
70
+ prefixText: { type: String, required: false, default: void 0 },
71
+ suffixText: { type: String, required: false, default: void 0 }
72
+ });
73
+ defineExpose({
74
+ toggle: (event) => menu.value?.toggle(event),
75
+ expanded: () => visible.value,
76
+ menuId
77
+ });
78
+ const passthroughProps = computed(() => {
79
+ return {
80
+ start: {
81
+ class: "menu-prefix"
82
+ },
83
+ end: {
84
+ class: "menu-suffix"
85
+ },
86
+ transition: {
87
+ name: "fade"
88
+ }
89
+ };
90
+ });
91
+ </script>
92
+
93
+ <style>
94
+ @reference "tailwindcss";.menu{background-color:var(--color-global-background);border:1px solid var(--color-global-background-accent);border-radius:var(--radius-md);box-shadow:var(--shadow-heavy);margin-block:--spacing(1);max-width:--spacing(80);padding:--spacing(1)}.menu li[role=separator]{border-bottom:1px solid var(--color-global-background-accent);margin-block:--spacing(1)}.menu li[role=none]{font-weight:var(--font-weight-semibold);padding:--spacing(1) --spacing(2)}.menu li[role=menuitem],.menu li[role=none]{-webkit-user-select:none;-moz-user-select:none;user-select:none}.menu li[role=menuitem]{border-radius:var(--radius-md);cursor:pointer;transition:background-color;transition-duration:var(--default-transition-duration)}.menu li[role=menuitem]>:only-child:not(:has(>a:only-child)){padding:--spacing(1) --spacing(2)}.menu li[role=menuitem]>:only-child:has(>a:only-child)>a{display:block;padding:--spacing(1) --spacing(2)}.menu li[role=menuitem][aria-disabled=true]{color:var(--color-global-foreground-accent);cursor:not-allowed}.menu li[role=menuitem][data-p-focused=true]:not([aria-disabled=true]),.menu ul:not(:focus) li[role=menuitem]:not([aria-disabled=true]):hover{background-color:var(--color-background-scale-c)}.menu .menu-prefix{border-bottom:1px solid var(--color-global-background-accent);margin-bottom:--spacing(1);padding:0 --spacing(2) --spacing(1)}.menu .menu-suffix{border-top:1px solid var(--color-global-background-accent);margin-top:--spacing(1);padding:--spacing(1) --spacing(2) 0}
95
+ </style>
@@ -0,0 +1,45 @@
1
+ import type { ComputedGetter } from 'vue';
2
+ import type { MenuItem as PrimeMenuItem } from 'primevue/menuitem';
3
+ export interface MenuProps {
4
+ model: MenuItem[];
5
+ prefixText?: string;
6
+ suffixText?: string;
7
+ }
8
+ export interface MenuItem {
9
+ label?: string;
10
+ icon?: string;
11
+ disabled?: boolean;
12
+ separator?: boolean;
13
+ command?: PrimeMenuItem['command'];
14
+ url?: PrimeMenuItem['url'];
15
+ target?: PrimeMenuItem['target'];
16
+ items?: MenuItem[];
17
+ }
18
+ export interface MenuExposes {
19
+ toggle: (event: Event) => void;
20
+ menuId: string;
21
+ expanded: ComputedGetter<boolean>;
22
+ }
23
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<MenuProps, MenuExposes, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MenuProps> & Readonly<{}>, {
24
+ prefixText: string;
25
+ suffixText: string;
26
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
27
+ control?: (props: {
28
+ toggle: (event: Event) => void | undefined;
29
+ menuId: string;
30
+ expanded: boolean;
31
+ }) => any;
32
+ } & {
33
+ prefix?: (props: {}) => any;
34
+ } & {
35
+ item?: (props: {}) => any;
36
+ } & {
37
+ suffix?: (props: {}) => any;
38
+ }>;
39
+ declare const _default: typeof __VLS_export;
40
+ export default _default;
41
+ type __VLS_WithSlots<T, S> = T & {
42
+ new (): {
43
+ $slots: S;
44
+ };
45
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resee-movies/nuxt-ux",
3
- "version": "0.2.4",
3
+ "version": "0.3.1",
4
4
  "description": "The next-gen user experience library for ReSee Movies - currently in development. ",
5
5
  "repository": {
6
6
  "url": "https://github.com/ReSee-Movies/nuxt-ux.git"