srcdev-nuxt-components 6.1.18 → 6.1.19

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.
@@ -6,7 +6,7 @@
6
6
  >
7
7
  <div class="display-prompt-wrapper" :data-theme="theme" :class="[elementClasses]" data-test-id="display-prompt">
8
8
  <div class="display-prompt-inner">
9
- <div class="display-prompt-icon" data-test-id="prompt-icon">
9
+ <div class="display-prompt-icon" data-test-id="prompt-icon" aria-hidden="true">
10
10
  <slot name="customDecoratorIcon">
11
11
  <Icon :name="displayPromptIcons[theme] ?? 'akar-icons:circle-alert'" class="icon" :color="iconColor" />
12
12
  </slot>
@@ -2,7 +2,7 @@
2
2
  <Teleport to="body">
3
3
  <div
4
4
  v-if="privateToastState"
5
- class="display-notification"
5
+ class="display-toast"
6
6
  :class="[
7
7
  elementClasses,
8
8
  {
@@ -13,30 +13,32 @@
13
13
  hide: isHiding,
14
14
  },
15
15
  ]"
16
+ :data-theme="theme"
16
17
  >
17
18
  <slot v-if="slots.default"></slot>
18
19
 
19
- <div v-else class="display-notification-body">
20
- <div class="display-notification-description">
21
- <div class="description-icon icon__wrapper" :class="[theme]">
22
- <Icon name="akar-icons:circle-check-fill" class="icon-circle-check-fill" />
23
- </div>
24
- <div class="description-text page-body-normal">{{ toastDisplayText }}</div>
25
- <div class="description-close">
26
- <button class="description-close-btn" @click.prevent="closeToast()">
27
- <Icon name="material-symbols:close" class="close" :class="[theme]" />
28
- </button>
29
- </div>
20
+ <div v-else class="display-toast-inner">
21
+ <div class="toast-icon" aria-hidden="true">
22
+ <slot name="customToastIcon">
23
+ <Icon :name="defaultThemeIcons[props.theme] ?? 'akar-icons:info'" class="icon" />
24
+ </slot>
25
+ </div>
26
+ <div class="toast-message">{{ toastDisplayText }}</div>
27
+ <div class="toast-action">
28
+ <button @click.prevent="closeToast">
29
+ <Icon name="material-symbols:close" class="icon" />
30
+ <span class="sr-only">Close</span>
31
+ </button>
30
32
  </div>
31
33
  </div>
32
- <div v-if="displayDurationInt > 0" @transitionend="closeToast()" class="display-notification-progress"></div>
34
+ <div v-if="displayDurationInt > 0" @transitionend="closeToast()" class="display-toast-progress"></div>
33
35
  </div>
34
36
  </Teleport>
35
37
  </template>
36
38
  <script setup lang="ts">
37
39
  const props = defineProps({
38
40
  theme: {
39
- type: String,
41
+ type: String as PropType<"primary" | "secondary" | "tertiary" | "ghost" | "error" | "info" | "success" | "warning">,
40
42
  default: "ghost",
41
43
  validator(value: string) {
42
44
  return ["primary", "secondary", "tertiary", "ghost", "error", "info", "success", "warning"].includes(value)
@@ -60,16 +62,20 @@ const props = defineProps({
60
62
  },
61
63
  })
62
64
 
65
+ const defaultThemeIcons = {
66
+ primary: "akar-icons:info",
67
+ secondary: "akar-icons:info",
68
+ tertiary: "akar-icons:info",
69
+ ghost: "akar-icons:info",
70
+ error: "akar-icons:circle-alert",
71
+ info: "akar-icons:info",
72
+ success: "akar-icons:info",
73
+ warning: "akar-icons:circle-alert",
74
+ }
75
+
63
76
  const slots = useSlots()
64
77
  const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
65
78
 
66
- watch(
67
- () => props.styleClassPassthrough,
68
- () => {
69
- resetElementClasses(props.styleClassPassthrough)
70
- }
71
- )
72
-
73
79
  const privateToastState = ref(false)
74
80
  const isHiding = ref(false)
75
81
  const publicToastState = defineModel<boolean>({ default: false })
@@ -94,6 +100,13 @@ const closeToast = async () => {
94
100
  sendCloseEvent()
95
101
  }
96
102
 
103
+ watch(
104
+ () => props.styleClassPassthrough,
105
+ () => {
106
+ resetElementClasses(props.styleClassPassthrough)
107
+ }
108
+ )
109
+
97
110
  watch(
98
111
  () => publicToastState.value,
99
112
  async (newValue, previousValue) => {
@@ -111,7 +124,7 @@ watch(
111
124
  )
112
125
  </script>
113
126
 
114
- <style lang="css">
127
+ <style scoped lang="css">
115
128
  @keyframes fade-in {
116
129
  5% {
117
130
  opacity: 1;
@@ -151,7 +164,7 @@ watch(
151
164
  }
152
165
  }
153
166
 
154
- .display-notification {
167
+ .display-toast {
155
168
  display: block;
156
169
  overflow: hidden;
157
170
  position: fixed;
@@ -189,24 +202,24 @@ watch(
189
202
  animation: hide v-bind(revealDuration)
190
203
  linear(
191
204
  0,
192
- 0.029 1.6%,
193
- 0.123 3.5%,
194
- 0.651 10.6%,
195
- 0.862 14.1%,
196
- 1.002 17.7%,
197
- 1.046 19.6%,
198
- 1.074 21.6%,
199
- 1.087 23.9%,
200
- 1.086 26.6%,
201
- 1.014 38.5%,
202
- 0.994 46.3%,
203
- 1
205
+ 0.006 53.7%,
206
+ 0.986 61.5%,
207
+ 1.014 73.4%,
208
+ 1.087 76.1%,
209
+ 1.074 78.4%,
210
+ 1.046 80.4%,
211
+ 1.002 82.3%,
212
+ 0.862 85.9%,
213
+ 0.651 89.4%,
214
+ 0.123 96.5%,
215
+ 0.029 98.4%,
216
+ 0
204
217
  )
205
218
  forwards;
206
219
  }
207
220
 
208
221
  &:hover {
209
- .display-notification-progress {
222
+ .display-toast-progress {
210
223
  animation-play-state: paused;
211
224
  }
212
225
  }
@@ -216,12 +229,19 @@ watch(
216
229
  right: 24px;
217
230
  }
218
231
 
219
- &.left {
220
- left: 24px;
221
- }
232
+ &:not(.full-width) {
233
+ &.left {
234
+ left: 24px;
235
+ }
222
236
 
223
- &.right {
224
- right: 24px;
237
+ &.right {
238
+ right: 24px;
239
+ }
240
+
241
+ &.center {
242
+ left: 50%;
243
+ /* transform: translateX(-50%); */
244
+ }
225
245
  }
226
246
 
227
247
  &.top {
@@ -233,85 +253,99 @@ watch(
233
253
  transform: translateY(30px);
234
254
  }
235
255
 
236
- &.has-theme {
237
- align-items: center;
238
- border: 2px solid transparent;
239
- border-radius: 12px;
240
- background-color: #9ce6a8;
241
- color: white;
242
-
243
- &.success {
244
- background-color: var(--green-4);
245
- border-color: var(--green-2);
246
- }
247
- &.error {
248
- background-color: var(--red-3);
249
- border-color: var(--red-2);
250
- }
251
- }
252
-
253
- .display-notification-body {
254
- display: flex;
255
- flex-direction: row;
256
- padding: 6px 12px 10px 12px;
257
- }
256
+ /*
257
+ * Styles for the display toast component
258
+ */
258
259
 
259
- .display-notification-description {
260
- display: flex;
261
- gap: 4px;
262
- align-items: center;
263
- justify-content: space-between;
264
- font-size: 1rem;
265
- flex-grow: 2;
266
-
267
- .description {
268
- .description-icon {
269
- transform: translateY(2px);
270
-
271
- &.success {
272
- background-color: var(--green-4);
273
- border-color: var(--green-2);
274
- }
275
- &.error {
276
- background-color: var(--red-3);
277
- border-color: var(--red-2);
260
+ &.has-theme {
261
+ padding-inline-start: 6px;
262
+ background-color: var(--colour-theme-8);
263
+
264
+ border: 0.1rem solid var(--colour-theme-8);
265
+ border-start-start-radius: 8px;
266
+ border-end-start-radius: 8px;
267
+ overflow: hidden;
268
+
269
+ .display-toast-inner {
270
+ display: grid;
271
+ grid-template-columns: auto 1fr auto;
272
+ gap: 12px;
273
+ align-items: center;
274
+ background-color: var(--gray-10);
275
+ border-start-start-radius: 8px;
276
+ border-end-start-radius: 8px;
277
+ padding: 12px 14px;
278
+ overflow: hidden;
279
+
280
+ .toast-icon {
281
+ display: inline-flex;
282
+ align-items: center;
283
+ justify-content: center;
284
+ margin-right: 12px;
285
+
286
+ .icon {
287
+ color: var(--colour-theme-0);
288
+ display: inline-block;
289
+ font-size: 2.5rem;
290
+ font-style: normal;
291
+ font-weight: normal;
292
+ overflow: hidden;
278
293
  }
279
294
  }
280
295
 
281
- .description-text {
282
- flex-grow: 1;
283
- text-align: right;
296
+ .toast-message {
297
+ display: flex;
298
+ align-items: center;
299
+ font-size: var(--step-4);
300
+ font-weight: normal;
301
+ line-height: 1.3;
302
+ color: var(--colour-theme-0);
303
+ margin: 0;
304
+ padding: 0;
284
305
  }
285
- .description-close {
286
- .description-close-btn {
287
- background-color: transparent;
288
- border: none;
289
- outline: 0;
290
- margin: 0;
291
- padding: 0;
292
- line-height: initial;
293
-
294
- svg {
295
- border-radius: 50%;
296
- border-width: 1px;
297
- border-style: solid;
298
- color: var(--gray-0);
299
-
300
- &.success {
301
- background-color: var(--green-2);
302
- border-color: var(--green-2);
303
- }
304
- &.error {
305
- background-color: var(--red-2);
306
- border-color: var(--red-2);
307
- }
306
+
307
+ .toast-action {
308
+ display: flex;
309
+ align-items: center;
310
+ justify-content: center;
311
+ margin-left: 12px;
312
+
313
+ button {
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ background: var(--colour-theme-10);
318
+ border: 0.1rem solid var(--colour-theme-8);
319
+ outline: 0.1rem solid transparent;
320
+ border-radius: 50%;
321
+ box-shadow: none;
322
+ color: var(--colour-theme-0);
323
+ cursor: pointer;
324
+ font-size: var(--step-4);
325
+ font-weight: bold;
326
+ padding: 0.5rem;
327
+ text-decoration: underline;
328
+
329
+ transition: all 0.3s ease;
330
+
331
+ .icon {
332
+ font-size: 1.5rem;
333
+ vertical-align: middle;
334
+ }
335
+
336
+ &:hover {
337
+ box-shadow: none;
338
+ background-color: var(--colour-theme-8);
339
+ color: var(--colour-theme-0);
340
+ outline: 0.1rem solid var(--colour-theme-3);
341
+ outline-offset: 0.2rem;
308
342
  }
309
343
  }
310
344
  }
311
345
  }
312
346
  }
313
347
 
314
- .display-notification-progress {
348
+ .display-toast-progress {
315
349
  position: absolute;
316
350
  right: 8px;
317
351
  bottom: 4px;
@@ -319,7 +353,7 @@ watch(
319
353
  height: 3px;
320
354
  transform: scaleX(0);
321
355
  transform-origin: right;
322
- background: linear-gradient(to right, #9ce6a8, #9ce6a8);
356
+ background: linear-gradient(to right, var(--colour-theme-2), var(--colour-theme-8));
323
357
  border-radius: inherit;
324
358
  animation: progress v-bind(progressDuration) linear forwards;
325
359
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "6.1.18",
4
+ "version": "6.1.19",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",