nuxt-unified-ui 0.2.1 → 0.2.2

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.
@@ -44,13 +44,8 @@ const emit = defineEmits([
44
44
  /* actions */
45
45
 
46
46
  async function handleButtonClick(button) {
47
-
48
- if (button.onClick) {
49
- await button.onClick(button.value);
50
- }
51
-
47
+ await button.onClick?.(button.value);
52
48
  emit('close', button.value);
53
-
54
49
  }
55
50
 
56
51
  </script>
@@ -59,36 +54,25 @@ async function handleButtonClick(button) {
59
54
  <template>
60
55
  <u-modal @update:open="!$event && emit('close')">
61
56
  <template #content>
62
- <u-card>
63
-
64
- <un-typography
65
- :icon="props.icon"
66
- :title="props.title"
67
- :subtitle="props.subtitle"
68
- :text="props.text"
69
- />
70
-
71
- <div class="flex items-end gap-2 mt-4">
72
-
73
- <u-button
74
- v-for="button of props.startButtons" :key="button.value || button.label || button.icon"
75
- v-bind="radOmit(button, [ 'value', 'onClick' ])"
76
- loading-auto
77
- @click="handleButtonClick(button)"
78
- />
79
-
80
- <div class="grow" />
81
-
82
- <u-button
83
- v-for="button of props.endButtons" :key="button.value || button.label || button.icon"
84
- v-bind="radOmit(button, [ 'value', 'onClick' ])"
85
- loading-auto
86
- @click="handleButtonClick(button)"
87
- />
88
-
89
- </div>
90
-
91
- </u-card>
57
+ <un-card
58
+ :icon="props.icon"
59
+ :title="props.title"
60
+ :subtitle="props.subtitle"
61
+ :text="props.text"
62
+ :actions="[
63
+ ...(props.startButtons || []).map(button => ({
64
+ ...button,
65
+ onClick: () => handleButtonClick(button),
66
+ })),
67
+ {
68
+ actionType: 'spacer',
69
+ },
70
+ ...(props.endButtons || []).map(button => ({
71
+ ...button,
72
+ onClick: () => handleButtonClick(button),
73
+ })),
74
+ ]"
75
+ />
92
76
  </template>
93
77
  </u-modal>
94
78
  </template>
@@ -46,13 +46,8 @@ const { form, formTag } = useForm({
46
46
  /* actions */
47
47
 
48
48
  async function handleSubmit() {
49
-
50
- if (props.submitButton?.onClick) {
51
- await props.submitButton?.onClick(form.value);
52
- }
53
-
49
+ await props.submitButton?.onClick?.(form.value);
54
50
  emit('close', form.value);
55
-
56
51
  }
57
52
 
58
53
  </script>
@@ -61,41 +56,31 @@ async function handleSubmit() {
61
56
  <template>
62
57
  <u-modal @update:open="!$event && emit('close')">
63
58
  <template #content>
64
- <u-card>
65
-
66
- <un-typography
67
- :icon="props.icon"
68
- :title="props.title"
69
- :subtitle="props.subtitle"
70
- :text="props.text"
71
- />
72
-
73
- <form-tag
74
- class="mt-4"
75
- />
76
-
77
- <div class="flex items-end gap-2 mt-4">
78
-
79
- <u-button
80
- label="Submit"
81
- v-bind="radOmit(props.submitButton, [ 'onClick' ])"
82
- loading-auto
83
- @click="handleSubmit()"
84
- />
85
-
86
- <div class="grow" />
87
-
88
- <u-button
89
- variant="ghost"
90
- label="Cancel"
91
- v-bind="radOmit(props.cancelButton, [ 'onClick' ])"
92
- loading-auto
93
- @click="emit('close')"
94
- />
95
-
96
- </div>
97
-
98
- </u-card>
59
+ <un-card
60
+ :icon="props.icon"
61
+ :title="props.title"
62
+ :subtitle="props.subtitle"
63
+ :text="props.text"
64
+ :actions="[
65
+ {
66
+ label: 'Submit',
67
+ ...props.submitButton,
68
+ loadingAuto: true,
69
+ onClick: handleSubmit,
70
+ },
71
+ {
72
+ actionType: 'spacer',
73
+ },
74
+ {
75
+ variant: 'ghost',
76
+ label: 'Cancel',
77
+ ...props.cancelButton,
78
+ loadingAuto: true,
79
+ onClick: () => emit('close'),
80
+ },
81
+ ]">
82
+ <form-tag />
83
+ </un-card>
99
84
  </template>
100
85
  </u-modal>
101
86
  </template>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-unified-ui",
3
3
  "type": "module",
4
- "version": "0.2.1",
4
+ "version": "0.2.2",
5
5
  "main": "./nuxt.config.js",
6
6
  "exports": {
7
7
  ".": "./nuxt.config.js",