@weni/unnnic-system 2.0.3 → 2.0.4

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": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "type": "commonjs",
5
5
  "files": [
6
6
  "dist",
@@ -29,7 +29,7 @@ import radio from './Radio/Radio.vue';
29
29
  import languageSelect from './Dropdown/LanguageSelect.vue';
30
30
  import modal from './Modal/Modal.vue';
31
31
  import modalUpload from './ModalUpload/ModalUpload.vue';
32
- import call from '../utils/call';
32
+ import {callAlert, callModal} from '../utils/call';
33
33
  import selectSmart from './SelectSmart/SelectSmart.vue';
34
34
  // import select from './Select/Select.vue';
35
35
  import selectItem from './Select/SelectItem.vue';
@@ -195,8 +195,8 @@ export const unnnicSelectItem = selectItem;
195
195
  // export const unnnicSelectListItem = selectListItem;
196
196
  export const unnnicMultiSelect = multiSelect;
197
197
  export const unnnicAlert = alert;
198
- export const unnnicCallAlert = call.callAlert;
199
- export const unnnicCallModal = call.callModal;
198
+ export const unnnicCallAlert = callAlert;
199
+ export const unnnicCallModal = callModal;
200
200
  // export const unnnicAutocomplete = autocomplete;
201
201
  // export const unnnicAutocompleteSelect = autocompleteSelect;
202
202
  export const unnnicTag = tag;
@@ -1,13 +1,12 @@
1
- import alertCaller from '../components/Alert/AlertCaller.vue';
2
- import alert from '../utils/call';
3
1
  import unnnicAlert from '../components/Alert/Alert.vue';
2
+ import { unnnicCallAlert } from '../components';
4
3
 
5
4
  export default {
6
5
  title: 'example/Alert',
7
6
  component: unnnicAlert,
8
7
  argTypes: {
8
+ type: { control: { type: 'text' } },
9
9
  text: { control: { type: 'text' } },
10
- title: { control: { type: 'text' } },
11
10
  closeText: { control: { type: 'text' } },
12
11
  scheme: {
13
12
  control: {
@@ -56,7 +55,7 @@ export default {
56
55
 
57
56
  const Template = (args, { argTypes }) => ({
58
57
  props: Object.keys(argTypes),
59
- components: { alertCaller, unnnicAlert },
58
+ components: { unnnicCallAlert },
60
59
  template: `
61
60
  <div>
62
61
  <button @click="unnnicCallAlert">Click for alert</button>
@@ -85,14 +84,21 @@ Recommended use:
85
84
  </div>`,
86
85
  methods: {
87
86
  unnnicCallAlert() {
88
- alert.callAlert({ props: this.$props, seconds: this.$props.seconds });
87
+ unnnicCallAlert({
88
+ props: {
89
+ type: 'success',
90
+ text: 'Alert'
91
+ },
92
+ containerRef: this.$refs.divContainer,
93
+ })
89
94
  },
95
+
90
96
  },
91
97
  });
92
98
 
93
99
  const TemplateWithContainerRef = (args, { argTypes }) => ({
94
100
  props: Object.keys(argTypes),
95
- components: { alertCaller, unnnicAlert },
101
+ components: { unnnicCallAlert },
96
102
  template: `
97
103
  <div ref="divContainer" style="height: 200px; position: relative; border: 1px solid black">
98
104
  <button @click="unnnicCallAlert">Click for alert</button>
@@ -108,26 +114,25 @@ const TemplateWithContainerRef = (args, { argTypes }) => ({
108
114
  </div>`,
109
115
  methods: {
110
116
  unnnicCallAlert() {
111
- alert.callAlert({
112
- props: this.$props,
117
+ unnnicCallAlert({
118
+ props: {
119
+ type: 'success',
120
+ text: 'Alert'
121
+ },
113
122
  containerRef: this.$refs.divContainer,
114
- });
123
+ })
115
124
  },
116
125
  },
117
126
  });
118
127
 
119
128
  export const Normal = Template.bind({});
120
129
  Normal.args = {
121
- title: 'Title',
130
+ type: 'success',
122
131
  text: 'Text',
123
- icon: 'check-circle-1-1',
124
- scheme: 'feedback-green',
125
132
  };
126
133
 
127
134
  export const WithContainerRef = TemplateWithContainerRef.bind({});
128
135
  WithContainerRef.args = {
129
- title: 'Title',
136
+ type: 'error',
130
137
  text: 'Text',
131
- icon: 'check-circle-1-1',
132
- scheme: 'feedback-green',
133
138
  };
package/src/utils/call.js CHANGED
@@ -5,8 +5,7 @@ import mitt from 'mitt';
5
5
 
6
6
  const emitter = mitt();
7
7
 
8
- export default {
9
- callAlert({ props, containerRef }) {
8
+ const callAlert = ({ props, containerRef })=>{
10
9
  const AlertComponent = createApp(Alert, {
11
10
  ...props,
12
11
  onClose: () => {
@@ -27,9 +26,9 @@ export default {
27
26
  } else {
28
27
  document.body.appendChild(instance.$el);
29
28
  }
30
- },
29
+ };
31
30
 
32
- callModal({ props }) {
31
+ const callModal = ({ props })=>{
33
32
  const ModalComponent = createApp(Modal, {
34
33
  ...props,
35
34
  onClose: () => {
@@ -44,5 +43,14 @@ export default {
44
43
  const element = document.createElement('div');
45
44
  const instance = ModalComponent.mount(element);
46
45
  document.body.appendChild(element);
47
- },
48
- };
46
+ }
47
+
48
+ export{
49
+ callAlert,
50
+ callModal
51
+ }
52
+
53
+ export default{
54
+ callAlert,
55
+ callModal
56
+ }