@finema/core 2.2.0 → 2.3.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.
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "configKey": "core",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.1",
package/dist/module.mjs CHANGED
@@ -3,7 +3,7 @@ import defu from 'defu';
3
3
  import * as theme from '../dist/runtime/theme/index.js';
4
4
 
5
5
  const name = "@finema/core";
6
- const version = "2.2.0";
6
+ const version = "2.3.0";
7
7
 
8
8
  const nuxtAppOptions = {
9
9
  head: {
@@ -6,38 +6,38 @@
6
6
  <template #body>
7
7
  <div :class="ui.base()">
8
8
  <Icon
9
- v-if="!isHideIcon"
9
+ v-if="!propsSafe.isHideIcon"
10
10
  :name="getIcon"
11
11
  :class="ui.icon()"
12
12
  />
13
13
  <div :class="ui.wrapper()">
14
14
  <p :class="ui.title()">
15
- {{ title }}
15
+ {{ propsSafe.title }}
16
16
  </p>
17
17
  <p
18
- v-if="description"
18
+ v-if="propsSafe.description"
19
19
  :class="ui.description()"
20
20
  >
21
- {{ description }}
21
+ {{ propsSafe.description }}
22
22
  </p>
23
23
  <div :class="ui.buttonGroup()">
24
24
  <Button
25
- v-if="isShowCancelBtn"
25
+ v-if="propsSafe.isShowCancelBtn"
26
26
  type="button"
27
27
  color="neutral"
28
28
  variant="outline"
29
29
  :class="ui.cancelButton()"
30
30
  @click="emits('close', false)"
31
31
  >
32
- {{ cancelText }}
32
+ {{ propsSafe.cancelText }}
33
33
  </Button>
34
34
  <Button
35
35
  type="button"
36
- :color="type"
36
+ :color="propsSafe.type"
37
37
  :class="ui.confirmButton()"
38
38
  @click="emits('close', true)"
39
39
  >
40
- {{ confirmText }}
40
+ {{ propsSafe.confirmText }}
41
41
  </Button>
42
42
  </div>
43
43
  </div>
@@ -47,7 +47,7 @@
47
47
  </template>
48
48
 
49
49
  <script setup>
50
- import { computed } from "vue";
50
+ import { computed, useAttrs } from "vue";
51
51
  import { DialogType } from "#core/composables/useDialog";
52
52
  import { useUiConfig } from "#core/composables/useConfig";
53
53
  import { dialogTheme } from "#core/theme/dialog";
@@ -56,11 +56,22 @@ const props = withDefaults(defineProps(), {
56
56
  confirmText: "\u0E15\u0E01\u0E25\u0E07",
57
57
  cancelText: "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01"
58
58
  });
59
+ const attrs = useAttrs();
60
+ const propsSafe = computed(() => {
61
+ if (props.title) {
62
+ return props;
63
+ }
64
+ return {
65
+ ...attrs,
66
+ cancelText: attrs.cancelText || "\u0E22\u0E01\u0E40\u0E25\u0E34\u0E01",
67
+ confirmText: attrs.confirmText || "\u0E15\u0E01\u0E25\u0E07"
68
+ };
69
+ });
59
70
  const getIcon = computed(() => {
60
- if (props.icon) {
61
- return props.icon;
71
+ if (propsSafe.value.icon) {
72
+ return propsSafe.value.icon;
62
73
  }
63
- switch (props.type) {
74
+ switch (propsSafe.value.type) {
64
75
  case DialogType.SUCCESS:
65
76
  return "i-heroicons-check-circle";
66
77
  case DialogType.ERROR:
@@ -73,5 +84,5 @@ const getIcon = computed(() => {
73
84
  return "";
74
85
  }
75
86
  });
76
- const ui = computed(() => useUiConfig(dialogTheme, "dialog")({ color: props.type }));
87
+ const ui = computed(() => useUiConfig(dialogTheme, "dialog")({ color: propsSafe.value.type }));
77
88
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finema/core",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "repository": "https://gitlab.finema.co/finema/ui-kit",
5
5
  "license": "MIT",
6
6
  "author": "Finema Dev Core Team",
@@ -88,4 +88,4 @@
88
88
  "lint-staged": {
89
89
  "*": "eslint --fix ."
90
90
  }
91
- }
91
+ }