@weni/unnnic-system 3.11.1-alpha.5 → 3.11.3-alpha.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weni/unnnic-system",
3
- "version": "3.11.1-alpha.5",
3
+ "version": "3.11.3-alpha.0",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -3,7 +3,7 @@
3
3
  class="unnnic-drawer"
4
4
  data-testid="drawer"
5
5
  :open="modelValue"
6
- @update:open="$emit('update:modelValue', $event)"
6
+ @update:open="$event ? () => {} : back()"
7
7
  >
8
8
  <DrawerContent
9
9
  :showOverlay="!withoutOverlay"
@@ -7,9 +7,9 @@
7
7
  >
8
8
  <aside
9
9
  v-if="isVisible"
10
- :class="['unnnic-toast', `unnnic-toast--${type}`]"
11
- :role="type === 'error' ? 'alert' : 'status'"
12
- :aria-live="type === 'error' ? 'assertive' : 'polite'"
10
+ :class="['unnnic-toast', `unnnic-toast--${validType}`]"
11
+ :role="validType === 'error' ? 'alert' : 'status'"
12
+ :aria-live="validType === 'error' ? 'assertive' : 'polite'"
13
13
  data-testid="toast"
14
14
  >
15
15
  <section
@@ -22,7 +22,7 @@
22
22
  >
23
23
  <UnnnicIcon
24
24
  :icon="typeConfig.icon"
25
- :scheme="typeConfig.scheme"
25
+ :scheme="typeConfig.scheme as SchemeColor"
26
26
  size="ant"
27
27
  data-testid="toast-type-icon"
28
28
  />
@@ -95,6 +95,13 @@ const emit = defineEmits<ToastEmits>();
95
95
  const isVisible = ref(false);
96
96
  let timeoutId: number | null = null;
97
97
 
98
+ const validType = computed(() => {
99
+ if (['informational', 'attention', 'success', 'error'].includes(props.type)) {
100
+ return props.type;
101
+ }
102
+ return 'informational';
103
+ });
104
+
98
105
  const typeConfig = computed(() => {
99
106
  const configMap = {
100
107
  informational: { icon: 'info', scheme: 'blue-500' },
@@ -103,10 +110,7 @@ const typeConfig = computed(() => {
103
110
  error: { icon: 'cancel', scheme: 'red-500' },
104
111
  };
105
112
 
106
- return configMap[props.type || 'informational'] as {
107
- icon: string;
108
- scheme: SchemeColor;
109
- };
113
+ return configMap[validType.value];
110
114
  });
111
115
 
112
116
  const handleClose = () => {