@quidgest/chatbot 0.0.5 → 0.0.7

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/style.css CHANGED
@@ -1,96 +1 @@
1
- .q-chatbot {
2
- width: 100%;
3
- height: 100%;
4
- padding: 1rem;
5
- }
6
- .q-chatbot input {
7
- line-height: 1.5rem;
8
- }
9
- .q-chatbot .q-input-group .i-text__field {
10
- border-radius: 0;
11
- flex: 1;
12
- }
13
- .q-chatbot__input {
14
- flex: 1;
15
- }
16
- .q-chatbot .clear-btn {
17
- color: red;
18
- }
19
- .q-chatbot__content {
20
- background-color: white;
21
- border: 1px solid #eaebec;
22
- height: 100%;
23
- width: 100%;
24
- display: flex;
25
- flex-direction: column;
26
- overflow: auto;
27
- gap: 1.5rem;
28
- }
29
- .q-chatbot__messages-container {
30
- display: flex;
31
- flex-direction: column;
32
- padding: 0 1rem 2rem 1rem;
33
- gap: 1.5rem;
34
- }
35
- .q-chatbot__messages-wrapper {
36
- display: flex;
37
- max-width: 100%;
38
- gap: 0.2rem;
39
- }
40
- .q-chatbot__messages-wrapper_right {
41
- justify-content: flex-end;
42
- }
43
- .q-chatbot__tools {
44
- display: flex;
45
- flex-direction: row;
46
- justify-content: end;
47
- max-width: 100%;
48
- }
49
- .q-chatbot__message-wrapper {
50
- display: flex;
51
- flex-direction: column;
52
- gap: 0.2rem;
53
- }
54
- .q-chatbot__message-container {
55
- display: flex;
56
- flex-direction: row;
57
- align-items: center;
58
- gap: 0.5rem;
59
- }
60
- .q-chatbot__messages-wrapper_right {
61
- justify-content: flex-end;
62
- }
63
- .q-chatbot__profile {
64
- border-radius: 50%;
65
- height: 2rem;
66
- width: 2rem;
67
- }
68
- .q-chatbot__message {
69
- min-width: 4rem;
70
- display: flex;
71
- align-items: center;
72
- padding: 0.3rem 0.5rem;
73
- background-color: #eaebec;
74
- white-space: normal;
75
- min-height: 2rem;
76
- }
77
- .q-chatbot__messages-wrapper_right .q-chatbot__message {
78
- background-color: rgba(1, 139, 210, 0.2);
79
- }
80
- .q-chatbot__sender {
81
- white-space: nowrap;
82
- color: #7c858d;
83
- font-size: 0.7rem;
84
- }
85
-
86
- @keyframes dotPulse {
87
- 0% {
88
- opacity: 0.5;
89
- }
90
- 50% {
91
- opacity: 1;
92
- }
93
- 100% {
94
- opacity: 0.5;
95
- }
96
- }
1
+ .q-chatbot{width:100%;height:100%;padding:1rem}.q-chatbot input{line-height:1.5rem}.q-chatbot .q-input-group .i-text__field{border-radius:0;flex:1}.q-chatbot__input{flex:1}.q-chatbot__content{background-color:#fff;border:1px solid #eaebec;height:100%;width:100%;display:flex;flex-direction:column;gap:.75rem}.q-chatbot__messages-container{display:flex;flex-direction:column;padding:0 1rem 2rem;gap:1.5rem;overflow:auto}.q-chatbot__messages-wrapper{display:flex;max-width:100%;gap:.2rem}.q-chatbot__tools{display:flex;flex-direction:row;justify-content:end;max-width:100%}.q-chatbot__message-wrapper{display:flex;flex-direction:column;gap:.2rem}.q-chatbot__message-container{display:flex;flex-direction:row;align-items:center;gap:.5rem}.q-chatbot__messages-wrapper_right{justify-content:flex-end}.q-chatbot__profile{border-radius:50%;height:2rem;width:2rem}.q-chatbot__message{min-width:4rem;display:flex;align-items:center;padding:.3rem .5rem;background-color:#eaebec;white-space:normal;min-height:2rem}.q-chatbot__messages-wrapper_right .q-chatbot__message{background-color:#018bd233}.q-chatbot__sender{white-space:nowrap;color:#7c858d;font-size:.7rem}@keyframes dotPulse{0%{opacity:.5}50%{opacity:1}to{opacity:.5}}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@quidgest/chatbot",
3
3
  "private": false,
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
7
7
  "main": "dist/index.cjs",
@@ -24,19 +24,23 @@
24
24
  "src"
25
25
  ],
26
26
  "scripts": {
27
- "build": "yarn build-lib",
28
- "build-lib": "rimraf ./dist && vue-tsc --noEmit && vite build",
27
+ "build": "rimraf ./dist && vite build",
29
28
  "build-types": "vue-tsc --emitDeclarationOnly --declaration -p tsconfig.json",
30
- "lint": "eslint 'src/**/*.{ts,vue}'"
29
+ "lint": "pnpm lint:eslint && pnpm lint:prettier",
30
+ "lint:eslint": "eslint .",
31
+ "lint:prettier": "prettier src --check",
32
+ "lint:fix": "eslint . --fix && prettier --write --list-different src"
31
33
  },
32
34
  "dependencies": {
33
35
  "axios": "^1.6.7",
34
- "vue": "^3.3.11",
35
- "cross-env": "5.0.5"
36
+ "vue": "^3.3.11"
36
37
  },
37
38
  "devDependencies": {
38
39
  "@types/node": "^20.11.13",
39
40
  "@vitejs/plugin-vue": "^4.5.2",
41
+ "eslint": "^9.8.0",
42
+ "eslint-plugin-prettier": "^5.2.1",
43
+ "prettier": "^3.3.3",
40
44
  "rimraf": "^5.0.5",
41
45
  "sass": "^1.70.0",
42
46
  "typescript": "^5.2.2",
@@ -45,6 +49,6 @@
45
49
  "vue-tsc": "^1.8.25"
46
50
  },
47
51
  "peerDependencies": {
48
- "@quidgest/ui": "0.9.7"
52
+ "@quidgest/ui": "^0.14.1"
49
53
  }
50
54
  }
@@ -16,10 +16,6 @@
16
16
  flex: 1;
17
17
  }
18
18
 
19
- .clear-btn {
20
- color: red;
21
- }
22
-
23
19
  &__content {
24
20
  background-color: white;
25
21
  border: 1px solid #eaebec;
@@ -27,8 +23,7 @@
27
23
  width: 100%;
28
24
  display: flex;
29
25
  flex-direction: column;
30
- overflow: auto;
31
- gap: 1.5rem;
26
+ gap: 0.75rem;
32
27
  }
33
28
 
34
29
  &__messages-container {
@@ -36,16 +31,17 @@
36
31
  flex-direction: column;
37
32
  padding: 0 1rem 2rem 1rem;
38
33
  gap: 1.5rem;
34
+ overflow: auto;
39
35
  }
40
36
 
41
37
  &__messages-wrapper {
42
38
  display: flex;
43
39
  max-width: 100%;
44
40
  gap: 0.2rem;
45
-
46
- &_right {
47
- justify-content: flex-end;
48
- }
41
+
42
+ &_right {
43
+ justify-content: flex-end;
44
+ }
49
45
  }
50
46
 
51
47
  &__tools {
@@ -57,7 +53,7 @@
57
53
 
58
54
  &__message-wrapper {
59
55
  display: flex;
60
- flex-direction: column;
56
+ flex-direction: column;
61
57
  gap: 0.2rem;
62
58
  }
63
59
 
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
3
  import ChatBotIcon from '@/assets/chatbot.png'
4
- import { QLineLoader } from '@quidgest/ui'
4
+ import { QLineLoader } from '@quidgest/ui/components'
5
5
 
6
6
  export interface CBMessageProps {
7
7
  /*
@@ -23,6 +23,11 @@
23
23
  * If the message is loading
24
24
  */
25
25
  loading?: boolean
26
+
27
+ /**
28
+ * Project locale
29
+ */
30
+ dateFormat?: string
26
31
  }
27
32
 
28
33
  const props = withDefaults(defineProps<CBMessageProps>(), {
@@ -35,24 +40,42 @@
35
40
  })
36
41
 
37
42
  const getLocaleDate = computed(() => {
38
- return props.date.toLocaleString()
43
+ if (!props.dateFormat) return props.date.toLocaleString()
44
+
45
+ return formatDate(props.date, props.dateFormat)
39
46
  })
40
47
 
41
48
  const messageHeader = computed(() => {
42
49
  return `${senderName.value} ${getLocaleDate.value}`
43
50
  })
51
+
52
+ function formatDate(date: Date, format: string) {
53
+ const day = date.getDate().toString().padStart(2, '0')
54
+ const month = (date.getMonth() + 1).toString().padStart(2, '0')
55
+ const year = date.getFullYear().toString().padStart(2, '0')
56
+ const hours = date.getHours().toString().padStart(2, '0')
57
+ const minutes = date.getMinutes().toString().padStart(2, '0')
58
+ const seconds = date.getSeconds().toString().padStart(2, '0')
59
+
60
+ return format
61
+ .replace('dd', day)
62
+ .replace('MM', month)
63
+ .replace('yyyy', year)
64
+ .replace('HH', hours)
65
+ .replace('mm', minutes)
66
+ .replace('ss', seconds)
67
+ }
44
68
  </script>
45
69
 
46
70
  <template>
47
71
  <div class="q-chatbot__message-container">
48
-
49
72
  <!-- Chatbot Image -->
50
73
  <img
51
74
  v-if="props.sender === 'bot'"
52
75
  :src="ChatBotIcon"
53
76
  alt="Chatbot"
54
77
  class="q-chatbot__profile" />
55
-
78
+
56
79
  <div class="q-chatbot__message-wrapper">
57
80
  <!-- Message header -->
58
81
  <div
@@ -63,7 +86,7 @@
63
86
 
64
87
  <!-- Message body -->
65
88
  <div class="q-chatbot__message">
66
- <QLineLoader v-if="loading" />
89
+ <QLineLoader v-if="loading" />
67
90
  <template v-else>
68
91
  <div
69
92
  class="q-chatbot__text"
@@ -78,4 +101,4 @@
78
101
  </div>
79
102
  </div>
80
103
  </div>
81
- </template>
104
+ </template>