srcdev-nuxt-components 6.1.0 → 6.1.2

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.
@@ -1,9 +1,18 @@
1
1
  <template>
2
- <dialog class="display-dialog-core" :class="[elementClasses]" role="dialog" :align-dialog :justify-dialog :open :data-dialog-id="dataDialogId" ref="dialogRef">
2
+ <dialog
3
+ class="display-dialog-core"
4
+ :class="[elementClasses]"
5
+ role="dialog"
6
+ :align-dialog
7
+ :justify-dialog
8
+ :open
9
+ :data-dialog-id="dataDialogId"
10
+ ref="dialogRef"
11
+ >
3
12
  <focus-trap v-model:active="open" :clickOutsideDeactivates="true" @deactivate="closeDialog()">
4
13
  <div class="inner" :class="[variant]">
5
14
  <div class="header">
6
- <div v-if="hasDialogTitle" class="col-left">
15
+ <div v-if="slots.dialogTitle" class="col-left">
7
16
  <slot name="dialogTitle"></slot>
8
17
  </div>
9
18
 
@@ -11,16 +20,24 @@
11
20
  <p class="text-normal wght-700">Center col</p>
12
21
  </div>
13
22
  <div class="col-right">
14
- <button @click.prevent="closeDialog()" data-test-id="display-dialog-header-close" class="display-prompt-action">
23
+ <button
24
+ @click.prevent="closeDialog()"
25
+ data-test-id="display-dialog-header-close"
26
+ class="display-prompt-action"
27
+ >
15
28
  <Icon name="bitcoin-icons:cross-filled" class="icon" />
16
29
  <span class="sr-only">Really Close</span>
17
30
  </button>
18
31
  </div>
19
32
  </div>
20
- <div v-if="hasDialogContent" class="dialog-content" :class="[{ 'allow-content-scroll': allowContentScroll }]">
33
+ <div
34
+ v-if="slots.dialogContent"
35
+ class="dialog-content"
36
+ :class="[{ 'allow-content-scroll': allowContentScroll }]"
37
+ >
21
38
  <slot name="dialogContent"></slot>
22
39
  </div>
23
- <div v-if="hasActionButtons" class="footer">
40
+ <div v-if="slots.actionButtons" class="footer">
24
41
  <slot name="actionButtons"></slot>
25
42
  </div>
26
43
  </div>
@@ -29,7 +46,7 @@
29
46
  </template>
30
47
 
31
48
  <script setup lang="ts">
32
- import { FocusTrap } from 'focus-trap-vue';
49
+ import { FocusTrap } from "focus-trap-vue"
33
50
  const props = defineProps({
34
51
  styleClassPassthrough: {
35
52
  type: Array as PropType<string[]>,
@@ -37,18 +54,18 @@ const props = defineProps({
37
54
  },
38
55
  variant: {
39
56
  type: String,
40
- default: 'dialog',
41
- validator: (val) => ['dialog', 'modal', 'confirm'].includes(val as string),
57
+ default: "dialog",
58
+ validator: (val) => ["dialog", "modal", "confirm"].includes(val as string),
42
59
  },
43
60
  justifyDialog: {
44
61
  type: String,
45
- default: 'center',
46
- validator: (val) => ['start', 'center', 'end'].includes(val as string),
62
+ default: "center",
63
+ validator: (val) => ["start", "center", "end"].includes(val as string),
47
64
  },
48
65
  alignDialog: {
49
66
  type: String,
50
- default: 'center',
51
- validator: (val) => ['start', 'center', 'end'].includes(val as string),
67
+ default: "center",
68
+ validator: (val) => ["start", "center", "end"].includes(val as string),
52
69
  },
53
70
  lockViewport: {
54
71
  type: Boolean,
@@ -62,33 +79,30 @@ const props = defineProps({
62
79
  type: String,
63
80
  required: true,
64
81
  },
65
- });
82
+ })
66
83
 
67
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
84
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
68
85
 
69
- const open = defineModel<boolean>();
70
- const bodyTag = ref<HTMLBodyElement | null>(null);
71
- const lockViewport = toRef<boolean>(props.lockViewport);
86
+ const open = defineModel<boolean>()
87
+ const bodyTag = ref<HTMLBodyElement | null>(null)
88
+ const lockViewport = toRef<boolean>(props.lockViewport)
72
89
 
73
90
  const closeDialog = () => {
74
- open.value = false;
91
+ open.value = false
75
92
 
76
93
  if (lockViewport.value && bodyTag.value !== null) {
77
- bodyTag.value.classList.remove('lock');
94
+ bodyTag.value.classList.remove("lock")
78
95
  }
79
- };
96
+ }
80
97
 
81
- const slots = useSlots();
82
- const hasDialogTitle = computed(() => slots.dialogTitle !== undefined);
83
- const hasDialogContent = computed(() => slots.dialogContent !== undefined);
84
- const hasActionButtons = computed(() => slots.actionButtons !== undefined);
98
+ const slots = useSlots()
85
99
 
86
100
  onMounted(() => {
87
- bodyTag.value = document.querySelector('body');
101
+ bodyTag.value = document.querySelector("body")
88
102
  if (lockViewport.value && bodyTag.value !== null) {
89
- bodyTag.value.classList.add('lock');
103
+ bodyTag.value.classList.add("lock")
90
104
  }
91
- });
105
+ })
92
106
  </script>
93
107
 
94
108
  <style lang="css">
@@ -121,26 +135,26 @@ onMounted(() => {
121
135
  }
122
136
 
123
137
  /* * Positioning the dialog */
124
- &[justify-dialog='start'] {
138
+ &[justify-dialog="start"] {
125
139
  justify-content: flex-start;
126
140
  }
127
141
 
128
- &[justify-dialog='center'] {
142
+ &[justify-dialog="center"] {
129
143
  justify-content: center;
130
144
  }
131
145
 
132
- &[justify-dialog='end'] {
146
+ &[justify-dialog="end"] {
133
147
  justify-content: flex-end;
134
148
  }
135
149
 
136
- &[align-dialog='start'] {
150
+ &[align-dialog="start"] {
137
151
  align-items: flex-start;
138
152
  }
139
153
 
140
- &[align-dialog='center'] {
154
+ &[align-dialog="center"] {
141
155
  align-items: center;
142
156
  }
143
- &[align-dialog='end'] {
157
+ &[align-dialog="end"] {
144
158
  align-items: flex-end;
145
159
  }
146
160
 
@@ -1,21 +1,35 @@
1
1
  <template>
2
- <div class="display-prompt-core" :class="[{ dismissed: hide }, { 'use-local-style-overrides': useLocalStyleOverrides }]" :data-test-id="`display-prompt-core-${theme}`">
3
- <div class="display-prompt-wrapper" :data-component-theme="theme" :class="[elementClasses]" data-test-id="display-prompt">
2
+ <div
3
+ class="display-prompt-core"
4
+ :class="[{ dismissed: hide }, { 'use-local-style-overrides': useLocalStyleOverrides }]"
5
+ :data-test-id="`display-prompt-core-${theme}`"
6
+ >
7
+ <div
8
+ class="display-prompt-wrapper"
9
+ :data-component-theme="theme"
10
+ :class="[elementClasses]"
11
+ data-test-id="display-prompt"
12
+ >
4
13
  <div class="display-prompt-inner">
5
14
  <div class="display-prompt-icon" data-test-id="prompt-icon">
6
15
  <slot name="customDecoratorIcon">
7
- <Icon :name="displayPromptIcons[theme]" class="icon" :color="iconColor" />
16
+ <Icon :name="displayPromptIcons[theme] ?? 'akar-icons:circle-alert'" class="icon" :color="iconColor" />
8
17
  </slot>
9
18
  </div>
10
19
  <div class="display-prompt-content">
11
20
  <p class="title" data-test-id="display-prompt-title">
12
21
  <slot name="title"></slot>
13
22
  </p>
14
- <p v-if="hasContent" class="text" data-test-id="display-prompt-content">
23
+ <p v-if="slots.content" class="text" data-test-id="display-prompt-content">
15
24
  <slot name="content"></slot>
16
25
  </p>
17
26
  </div>
18
- <button v-if="dismissible" @click.prevent="dismissPrompt()" data-test-id="display-prompt-action" class="display-prompt-action">
27
+ <button
28
+ v-if="dismissible"
29
+ @click.prevent="dismissPrompt()"
30
+ data-test-id="display-prompt-action"
31
+ class="display-prompt-action"
32
+ >
19
33
  <slot name="customCloseIcon">
20
34
  <Icon name="bitcoin-icons:cross-filled" class="icon" />
21
35
  </slot>
@@ -36,9 +50,9 @@ const props = defineProps({
36
50
  },
37
51
  theme: {
38
52
  type: String,
39
- default: 'error',
53
+ default: "error",
40
54
  validator(value: string) {
41
- return ['error', 'info', 'success', 'warning', 'secondary'].includes(value);
55
+ return ["error", "info", "success", "warning", "secondary"].includes(value)
42
56
  },
43
57
  },
44
58
  styleClassPassthrough: {
@@ -47,9 +61,9 @@ const props = defineProps({
47
61
  },
48
62
  iconColor: {
49
63
  type: String as PropType<string>,
50
- default: 'dark-grey',
64
+ default: "dark-grey",
51
65
  validator(value: string) {
52
- return ['dark-grey', 'white'].includes(value);
66
+ return ["dark-grey", "white"].includes(value)
53
67
  },
54
68
  },
55
69
  useLocalStyleOverrides: {
@@ -59,24 +73,23 @@ const props = defineProps({
59
73
  displayPromptIcons: {
60
74
  type: Object as PropType<Record<string, string>>,
61
75
  default: () => ({
62
- error: 'akar-icons:circle-alert',
63
- info: 'akar-icons:info',
64
- success: 'akar-icons:check',
65
- warning: 'akar-icons:circle-alert',
66
- secondary: 'akar-icons:info',
76
+ error: "akar-icons:circle-alert",
77
+ info: "akar-icons:info",
78
+ success: "akar-icons:check",
79
+ warning: "akar-icons:circle-alert",
80
+ secondary: "akar-icons:info",
67
81
  }),
68
82
  },
69
- });
83
+ })
70
84
 
71
- const slots = useSlots();
72
- const hasContent = ref(slots.content !== undefined);
73
- const hide = ref(false);
74
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
85
+ const slots = useSlots()
86
+ const hide = ref(false)
87
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
75
88
 
76
89
  const dismissPrompt = () => {
77
90
  // styleClassPassthrough.value = '';
78
- hide.value = true;
79
- };
91
+ hide.value = true
92
+ }
80
93
  </script>
81
94
 
82
95
  <style lang="css">
@@ -6,7 +6,7 @@
6
6
  <template #title>
7
7
  <slot name="title"></slot>
8
8
  </template>
9
- <template v-if="hasContent" #content>
9
+ <template v-if="slots.content" #content>
10
10
  <slot name="content"></slot>
11
11
  </template>
12
12
  </DisplayPromptCore>
@@ -22,11 +22,9 @@ const props = defineProps({
22
22
  type: Array as PropType<string[]>,
23
23
  default: () => [],
24
24
  },
25
- });
25
+ })
26
26
 
27
- const slots = useSlots();
28
- const hasContent = ref(slots.content !== undefined);
29
- const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
27
+ const slots = useSlots()
30
28
  </script>
31
29
 
32
30
  <style lang="css">
@@ -24,11 +24,11 @@
24
24
  const props = defineProps({
25
25
  name: {
26
26
  type: String,
27
- default: '',
27
+ default: "",
28
28
  },
29
29
  iconSize: {
30
30
  type: String,
31
- default: 'medium',
31
+ default: "medium",
32
32
  },
33
33
  animationDuration: {
34
34
  type: Number,
@@ -38,15 +38,15 @@ const props = defineProps({
38
38
  type: Array as PropType<string[]>,
39
39
  default: () => [],
40
40
  },
41
- });
41
+ })
42
42
 
43
- const name = computed(() => props.name || useId());
43
+ const name = computed(() => props.name || useId())
44
44
 
45
- const triggerId = computed(() => `id-${name.value}-trigger`);
46
- const contentId = computed(() => `id-${name.value}-content`);
47
- const animationDurationStr = computed(() => `${props.animationDuration}ms`);
45
+ const triggerId = computed(() => `id-${name.value}-trigger`)
46
+ const contentId = computed(() => `id-${name.value}-content`)
47
+ const animationDurationStr = computed(() => `${props.animationDuration}ms`)
48
48
 
49
- const { elementClasses, resetElementClasses, updateElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
49
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
50
50
  </script>
51
51
 
52
52
  <style lang="css">