bfg-common 1.4.826 → 1.4.828

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,131 +1,92 @@
1
1
  <template>
2
- <atoms-modal
3
- show
4
- :test-id="`${props.testId}-modal`"
5
- :width="props.width"
6
- class="confirm-by-input"
2
+ <common-modals-confirm-by-input-new
3
+ v-if="isNewViewLocal"
4
+ :title="props.title"
5
+ :sub-title="props.subTitle"
6
+ :modal-texts="props.modalTexts"
7
+ :test-id="props.testId"
8
+ @hide="emits('hide')"
9
+ @confirm="emits('confirm')"
10
+ />
11
+ <common-modals-confirm-by-input-old
12
+ v-else
7
13
  :title="props.title"
8
- :second-title="props.subTitle"
14
+ :sub-title="props.subTitle"
15
+ :test-id="props.testId"
9
16
  :loading="props.loading"
10
- is-hide-close-icon
11
- @submit="onConfirm"
17
+ :width="props.width"
18
+ @hide="emits('hide')"
19
+ @confirm="emits('confirm')"
12
20
  >
13
- <template #modalBody>
14
- <div class="confirm-by-input__body">
15
- <atoms-the-icon
16
- name="exclamation-triangle"
17
- class="confirm-by-input__icon"
18
- />
19
-
20
- <div>
21
- <slot name="content"></slot>
22
-
23
- <div class="form-group">
24
- <label class="no-selection" for="confirmation">{{
25
- confirmationText
26
- }}</label>
27
- <div class="form-group__input">
28
- <input
29
- id="confirmation"
30
- v-model="confirmationForm"
31
- data-id="confirmation-input"
32
- type="text"
33
- autocomplete="off"
34
- @keyup.enter="onConfirm"
35
- />
36
- <div v-show="!isValid && confirmationForm" class="form-validate">
37
- <atoms-tooltip :test-id="`${props.testId}-tooltip`">
38
- <template #elem>
39
- <atoms-the-icon
40
- class="is-error tooltip-trigger"
41
- name="info"
42
- width="28px"
43
- height="28px"
44
- />
45
- </template>
46
- <template #content>
47
- {{ confirmDeletionInputError }}
48
- </template>
49
- </atoms-tooltip>
50
- </div>
51
- </div>
52
- </div>
53
- </div>
54
- </div>
55
- </template>
56
- <template #modalFooter>
57
- <button
58
- id="confirm-by-input-modal-close-button"
59
- :data-id="`${props.testId}-modal-close-button`"
60
- class="btn btn-outline"
61
- @click="onHide"
62
- >
63
- {{ localization.common.no }}
64
- </button>
65
- <button
66
- id="confirm-by-input-modal-apply-button"
67
- :data-id="`${props.testId}-modal-apply-button`"
68
- class="btn btn-primary"
69
- :class="props.loading && 'modal-dialog__loader'"
70
- :disabled="!isValid || props.loading"
71
- @click="onConfirm"
72
- >
73
- <atoms-loader-pre-loader
74
- v-if="props.loading"
75
- id="loader"
76
- :show="props.loading"
77
- class="button__loading"
78
- :test-id="`${props.testId}-spinner`"
79
- />
80
- <span v-else>
81
- {{ localization.common.yes }}
82
- </span>
83
- </button>
21
+ <template #content>
22
+ <slot name="content" />
84
23
  </template>
85
- </atoms-modal>
24
+ </common-modals-confirm-by-input-old>
86
25
  </template>
87
26
 
88
27
  <script setup lang="ts">
89
28
  import type { UI_I_Localization } from '~/lib/models/interfaces'
90
-
91
- const props = defineProps<{
92
- title: string
93
- subTitle: string
94
- testId: string
95
- width: string
96
- loading?: boolean
97
- }>()
29
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
30
+
31
+ const props = withDefaults(
32
+ defineProps<{
33
+ isNewView?: boolean
34
+ title?: string
35
+ subTitle?: string
36
+ testId?: string
37
+ loading?: boolean
38
+ width?: string
39
+ modalTexts?: UI_I_ModalTexts
40
+ }>(),
41
+ {
42
+ isNewView: undefined,
43
+ title: '',
44
+ subTitle: '',
45
+ testId: 'common-confirmation',
46
+ loading: false,
47
+ width: '580px',
48
+ modalTexts: {
49
+ button1: 'Cancel',
50
+ button2: 'Remove',
51
+ },
52
+ }
53
+ )
98
54
  const emits = defineEmits<{
99
55
  (event: 'confirm'): void
100
56
  (event: 'hide'): void
101
57
  }>()
102
58
 
103
59
  const localization = computed<UI_I_Localization>(() => useLocal())
60
+ const { $store }: any = useNuxtApp()
61
+
62
+ const isNewViewLocal = computed<boolean>(
63
+ () => props.isNewView ?? $store.getters['main/getIsNewView']
64
+ )
104
65
 
105
66
  const confirmationForm = ref<string>('')
106
67
  const isValid = computed<boolean>(() => {
107
68
  return confirmationForm.value === props.subTitle
108
69
  })
109
70
 
110
- const confirmationText = localization.value.common.confirmDeletionInput.replace(
111
- '{title}',
112
- props.subTitle
113
- )
114
- const confirmDeletionInputError =
115
- localization.value.common.confirmDeletionInputError.replace(
116
- '{title}',
117
- props.subTitle
118
- )
119
-
120
- const onConfirm = async (): Promise<void> => {
121
- if (!isValid.value) return
122
-
123
- emits('confirm')
124
- }
125
-
126
- const onHide = (): void => {
127
- emits('hide')
128
- }
71
+ // const confirmationText = localization.value.common.confirmDeletionInput.replace(
72
+ // '{title}',
73
+ // props.subTitle
74
+ // )
75
+ // const confirmDeletionInputError =
76
+ // localization.value.common.confirmDeletionInputError.replace(
77
+ // '{title}',
78
+ // props.subTitle
79
+ // )
80
+
81
+ // const onConfirm = async (): Promise<void> => {
82
+ // if (!isValid.value) return
83
+ //
84
+ // emits('confirm')
85
+ // }
86
+
87
+ // const onHide = (): void => {
88
+ // emits('hide')
89
+ // }
129
90
  </script>
130
91
 
131
92
  <style lang="scss" scoped>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <ui-popup
3
+ :test-id="props.testId"
4
+ icon-name="info-status"
5
+ :message="props.subTitle"
6
+ :texts="modalTextsLocal"
7
+ @submit="onSubmit"
8
+ @hide="onHide"
9
+ >
10
+ <template #content>
11
+ <div class="ui-popup_body-content">
12
+ <span>{{ props.title }}</span>
13
+ <span>{{ props.subTitle }}</span>
14
+ </div>
15
+ </template>
16
+ </ui-popup>
17
+ </template>
18
+
19
+ <script setup lang="ts">
20
+ import type { UI_I_ModalTexts } from '~/node_modules/bfg-uikit/components/ui/modal/models/interfaces'
21
+
22
+ const props = defineProps<{
23
+ testId: string
24
+ title: string
25
+ subTitle: string
26
+ modalTexts: UI_I_ModalTexts
27
+ }>()
28
+ const emits = defineEmits<{
29
+ (event: 'confirm'): void
30
+ (event: 'hide-modal'): void
31
+ }>()
32
+
33
+ const modalTextsLocal = computed<UI_I_ModalTexts>(() => props.modalTexts)
34
+
35
+ const onHide = (): void => {
36
+ emits('hide-modal')
37
+ }
38
+ const onSubmit = (): void => {
39
+ emits('confirm')
40
+ }
41
+ </script>
42
+
43
+ <style scoped lang="scss">
44
+ .ui-popup_body-content {
45
+ padding: 16px 32px;
46
+ span {
47
+ display: block;
48
+ font-size: 14px;
49
+ font-weight: 400;
50
+ line-height: 16.94px;
51
+ text-align: center;
52
+ color: #9da6ad;
53
+
54
+ &:first-of-type {
55
+ font-size: 20px;
56
+ font-weight: 500;
57
+ line-height: 24.2px;
58
+ color: var(--modal-title);
59
+ margin-bottom: 8px;
60
+ }
61
+ }
62
+ }
63
+ </style>
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <atoms-modal
3
+ show
4
+ :test-id="`${props.testId}-modal`"
5
+ :width="props.width"
6
+ class="confirm-by-input"
7
+ :title="props.title"
8
+ :second-title="props.subTitle"
9
+ :loading="props.loading"
10
+ is-hide-close-icon
11
+ @submit="onConfirm"
12
+ >
13
+ <template #modalBody>
14
+ <div class="confirm-by-input__body">
15
+ <atoms-the-icon
16
+ name="exclamation-triangle"
17
+ class="confirm-by-input__icon"
18
+ />
19
+
20
+ <div>
21
+ <slot name="content"></slot>
22
+
23
+ <div class="form-group">
24
+ <label class="no-selection" for="confirmation">{{
25
+ confirmationText
26
+ }}</label>
27
+ <div class="form-group__input">
28
+ <input
29
+ id="confirmation"
30
+ v-model="confirmationForm"
31
+ data-id="confirmation-input"
32
+ type="text"
33
+ autocomplete="off"
34
+ @keyup.enter="onConfirm"
35
+ />
36
+ <div v-show="!isValid && confirmationForm" class="form-validate">
37
+ <atoms-tooltip :test-id="`${props.testId}-tooltip`">
38
+ <template #elem>
39
+ <atoms-the-icon
40
+ class="is-error tooltip-trigger"
41
+ name="info"
42
+ width="28px"
43
+ height="28px"
44
+ />
45
+ </template>
46
+ <template #content>
47
+ {{ confirmDeletionInputError }}
48
+ </template>
49
+ </atoms-tooltip>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </template>
56
+ <template #modalFooter>
57
+ <button
58
+ id="confirm-by-input-modal-close-button"
59
+ :data-id="`${props.testId}-modal-close-button`"
60
+ class="btn btn-outline"
61
+ @click="onHide"
62
+ >
63
+ {{ localization.common.no }}
64
+ </button>
65
+ <button
66
+ id="confirm-by-input-modal-apply-button"
67
+ :data-id="`${props.testId}-modal-apply-button`"
68
+ class="btn btn-primary"
69
+ :class="props.loading && 'modal-dialog__loader'"
70
+ :disabled="!isValid || props.loading"
71
+ @click="onConfirm"
72
+ >
73
+ <atoms-loader-pre-loader
74
+ v-if="props.loading"
75
+ id="loader"
76
+ :show="props.loading"
77
+ class="button__loading"
78
+ :test-id="`${props.testId}-spinner`"
79
+ />
80
+ <span v-else>
81
+ {{ localization.common.yes }}
82
+ </span>
83
+ </button>
84
+ </template>
85
+ </atoms-modal>
86
+ </template>
87
+
88
+ <script setup lang="ts">
89
+ import type { UI_I_Localization } from '~/lib/models/interfaces'
90
+
91
+ const props = defineProps<{
92
+ title: string
93
+ subTitle: string
94
+ testId: string
95
+ width: string
96
+ loading?: boolean
97
+ }>()
98
+ const emits = defineEmits<{
99
+ (event: 'confirm'): void
100
+ (event: 'hide'): void
101
+ }>()
102
+
103
+ const localization = computed<UI_I_Localization>(() => useLocal())
104
+
105
+ const confirmationForm = ref<string>('')
106
+ const isValid = computed<boolean>(() => {
107
+ return confirmationForm.value === props.subTitle
108
+ })
109
+
110
+ const confirmationText = localization.value.common.confirmDeletionInput.replace(
111
+ '{title}',
112
+ props.subTitle
113
+ )
114
+ const confirmDeletionInputError =
115
+ localization.value.common.confirmDeletionInputError.replace(
116
+ '{title}',
117
+ props.subTitle
118
+ )
119
+
120
+ const onConfirm = async (): Promise<void> => {
121
+ if (!isValid.value) return
122
+
123
+ emits('confirm')
124
+ }
125
+
126
+ const onHide = (): void => {
127
+ emits('hide')
128
+ }
129
+ </script>
130
+
131
+ <style lang="scss" scoped>
132
+ @import 'assets/scss/common/mixins.scss';
133
+ .confirm-by-input {
134
+ :deep(.modal-header) {
135
+ display: flex;
136
+ justify-content: space-between;
137
+ align-items: flex-start;
138
+
139
+ .modal-title {
140
+ color: var(--main-color-mode);
141
+ font-size: 24px;
142
+ max-width: 65%;
143
+ }
144
+ .secondary-title {
145
+ color: var(--modal-secondary-title);
146
+ font-size: 0.75rem;
147
+ font-weight: lighter;
148
+ user-select: none;
149
+ }
150
+ .separator {
151
+ content: '';
152
+ border-left: 1px solid #ccc;
153
+ margin: 0 18px;
154
+ height: 22px;
155
+ }
156
+
157
+ .close-icon {
158
+ fill: var(--close-icon);
159
+ width: 24px;
160
+ height: 24px;
161
+ }
162
+ }
163
+
164
+ &__body {
165
+ @include flex($align: flex-start);
166
+
167
+ .form-group {
168
+ margin-top: 20px;
169
+
170
+ label {
171
+ font-weight: bold;
172
+ font-size: 0.6rem;
173
+ user-select: none;
174
+ }
175
+
176
+ &:not(:first-child) input {
177
+ width: 100%;
178
+ }
179
+ &__input {
180
+ display: flex;
181
+ width: 100%;
182
+ min-height: 30px;
183
+ }
184
+ }
185
+ }
186
+
187
+ &__icon {
188
+ min-width: 48px;
189
+ height: 48px;
190
+ margin-right: 20px;
191
+ fill: #c27b00;
192
+ }
193
+
194
+ .button {
195
+ &__loading {
196
+ :deep(.spinner) {
197
+ width: 25px;
198
+ height: 25px;
199
+ min-width: 25px;
200
+ min-height: 25px;
201
+ margin-top: 5px;
202
+ }
203
+ }
204
+ }
205
+ }
206
+ </style>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.826",
4
+ "version": "1.4.828",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",