@formixru/b2b-ui 2.5.0 → 3.0.0

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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/package.json +41 -44
  3. package/src/components/action-link/index.scss +49 -0
  4. package/src/components/action-list/index.scss +6 -15
  5. package/src/components/counter/index.scss +16 -0
  6. package/src/components/dialog/index.js +8 -20
  7. package/src/components/dialog/index.scss +13 -0
  8. package/src/components/form/index.js +35 -35
  9. package/src/components/overlay/index.js +1 -1
  10. package/src/components/overlay/index.scss +4 -0
  11. package/src/components/request/index.js +8 -8
  12. package/src/components/sidebar/index.js +3 -3
  13. package/src/components/sidebar/index.scss +7 -0
  14. package/src/components/tabs/index.js +4 -4
  15. package/src/components/tooltip/index.js +4 -3
  16. package/src/{helpers → utils}/error-handler.js +3 -3
  17. package/src/{helpers → utils}/is-in-viewport.js +2 -2
  18. package/src/{helpers → utils}/mm.js +2 -2
  19. package/src/variables.scss +23 -12
  20. package/CHANGELOG.md +0 -108
  21. package/CONTRIBUTING.md +0 -59
  22. package/src/components/color-input/index.vue +0 -154
  23. package/src/components/date-input/index.vue +0 -240
  24. package/src/components/delete-all/index.scss +0 -44
  25. package/src/components/file-input/index.vue +0 -335
  26. package/src/components/font-input/index.vue +0 -174
  27. package/src/components/quantity-input/index.vue +0 -141
  28. package/src/components/range-input/index.vue +0 -185
  29. package/src/components/suggest-input/index.vue +0 -328
  30. package/src/components/warning-message/index.vue +0 -101
  31. package/vite.config.js +0 -75
  32. /package/src/{helpers → utils}/css-var.js +0 -0
  33. /package/src/{helpers → utils}/get-smart-captcha.js +0 -0
  34. /package/src/{helpers → utils}/scroll-to.js +0 -0
@@ -1001,11 +1001,25 @@ $tooltip-image-max-height: 300px !default;
1001
1001
 
1002
1002
  // .action-list
1003
1003
 
1004
- $action-list-link-color: $color-grey-70 !default;
1004
+ $action-list-color: $font-color-tertiary !default;
1005
1005
 
1006
1006
  $action-list-link-separator-color: autocolor(('light': $color-grey-alpha-80, 'dark': $color-grey-alpha-i-90), $tooltip-light-bg) !default;
1007
1007
  $action-list-link-separator-width: 1px !default;
1008
1008
 
1009
+ /********** Ссылка-действие (.action-link) **********/
1010
+
1011
+ $action-link-font: ('font-weight': bold) !default;
1012
+
1013
+ $action-link-action-list-font: ('font-weight': normal) !default;
1014
+
1015
+ $action-link-danger-font: ('font-weight': normal) !default;
1016
+
1017
+ $action-link-danger-color: $link-grey-color !default;
1018
+ $action-link-danger-active-color: $color-error !default;
1019
+
1020
+ $action-link-danger-icon-color: $color-grey-70 !default;
1021
+ $action-link-danger-icon-active-color: $action-link-danger-active-color !default;
1022
+
1009
1023
  /********** Панель с предупреждением (.warning) **********/
1010
1024
 
1011
1025
  $warning-message-bg: $bg-color-tertiary !default;
@@ -1160,17 +1174,6 @@ $total-amount-value-b-desktop-font: ('font-size': $font-size-xl) !default;
1160
1174
  $total-amount-tax-color: $font-color-tertiary !default;
1161
1175
  $total-amount-tax-font: ('font-size': $font-size-xs, 'line-height': $line-height-s) !default;
1162
1176
 
1163
- /********** Удалить всё (.delete-all) **********/
1164
-
1165
- $delete-all-color: $font-color-secondary !default;
1166
- $delete-all-active-color: $color-error !default;
1167
-
1168
- $delete-all-icon-color: $color-grey-70 !default;
1169
- $delete-all-icon-active-color: $delete-all-active-color !default;
1170
-
1171
- $deleta-all-action-list-color: $link-grey-color !default;
1172
- $delete-all-action-list-icon-color: $link-grey-color !default;
1173
-
1174
1177
  /********** Шаги (.steps) **********/
1175
1178
 
1176
1179
  $steps-item-number-border-width: 1px !default;
@@ -1221,6 +1224,14 @@ $content-title-desktop-font: $font-h1-desktop !default;
1221
1224
  $content-title-small-mobile-font: $font-h2-mobile !default;
1222
1225
  $content-title-small-desktop-font: $font-h2-desktop !default;
1223
1226
 
1227
+ /********** Счётчик (.counter) **********/
1228
+
1229
+ $counter-bg: $color-error;
1230
+ $counter-color: $color-white;
1231
+ $counter-font: ('font-weight': bold, 'font-size': $font-size-3xs, 'line-height': 1);
1232
+ $counter-radius: $radius-l;
1233
+ $counter-size: 16px;
1234
+
1224
1235
  /********** Адаптивные точки **********/
1225
1236
 
1226
1237
  // При изменении устройств изменить их так же в mm.js
package/CHANGELOG.md DELETED
@@ -1,108 +0,0 @@
1
- ## v2.5.0
2
-
3
- - Для `Form` исправлена работа атрибута `data-request` - теперь он называется `data-form-request`, чтобы избежать конфликтов с компонентом `Request`
4
-
5
- ## v2.4.0
6
-
7
- - `@advdominion/tooltip` обновлён до 5-й версии
8
- - Исправдение стилей `.warning-message`
9
-
10
- ## v2.3.0
11
-
12
- - В `Request` добавлена поддержка id диалогового окна или сайдбара как c `#`, так и без неё
13
-
14
- ## v2.2.0
15
-
16
- - Доработки по стилям `.tabs`/`.warning-message`
17
-
18
- ## v2.1.0
19
-
20
- - В Request добавлены `reloadOnHideSidebar`/`hideSidebar`, а так же параметр `hideLoaderOnSuccess`
21
- - В Request добавлена функция `__FORMIX__REQUEST__INIT_CONTENT` вместо `__FORMIX__FORM__INIT_CONTENT`/`__FORMIX__DIALOG__INIT_CONTENT`/`__FORMIX__SIDEBAR_INIT_CONTENT`
22
- - Поддержка id диалогового окна или сайдбара как c `#`, так и без неё
23
-
24
- ## v2.0.1
25
-
26
- - Исправлена работа `Request`
27
- - Исправлена работа `cssVar`
28
-
29
- ## v2.0.0
30
-
31
- - Добавлен новый компонент - универсальный AJAX-контроллер `Request`, который используется внутри `Dialog`/`Form`/`Sidebar` и может использоваться как отдельный компонент
32
- - Storybook обновлён до 9-й версии
33
-
34
- ## v1.7.0
35
-
36
- - Добавлен новый вид для WarningMessage (`light-info`)
37
-
38
- ## v1.6.1
39
-
40
- - Исправление в WarningMessage
41
- - Доработки по стилям .form
42
-
43
- ## v1.6.0
44
-
45
- - Доработки для PWA
46
-
47
- ## v1.5.2
48
-
49
- - Исправлен баг в работе FontInput
50
-
51
- ## v1.5.1
52
-
53
- - Переработан FontInput - теперь вместо названий переменных для font-size/line-height он возвращает их значения
54
-
55
- ## v1.5.0
56
-
57
- - Для AJAX-форм добавлена поддержка поля `trigger`
58
-
59
- ## v1.4.0
60
-
61
- - Для SuggestInput сделан expose функции `clear()`
62
-
63
- ## v1.3.0
64
-
65
- - Добавленена поддержка `data-tooltip-image` для вывода изображений во всплывающих подсказках
66
-
67
- ## v1.2.1
68
-
69
- - Исправлены стили в .pagination-group
70
-
71
- ## v1.2.0
72
-
73
- - Для `isInViewport` добавлен параметр `partialVisibility` для определения частичной видимости элемента
74
-
75
- ## v1.1.1
76
-
77
- - Переменная `--tab-bar-height` добавлена в `base.scss`
78
-
79
- ## v1.1.0
80
-
81
- - Использование cssVar() в ColorInput для работы с предустановленными цветами
82
-
83
- ## v1.0.5
84
-
85
- - Доработки по коду и документации
86
- - Функция `__FORMIX__DIALOG__INIT_JSON` переименована в `__FORMIX__DIALOG__INTERCEPT_DATA`
87
- - Обновлена требуемая версия @advdominion/tooltip
88
- - Доработки по работе по .tabs
89
-
90
- ## v1.0.4
91
-
92
- - Добавлены новые переменные для .slider-nav
93
- - Исправлены ошибки в работе FileInput
94
-
95
- ## v1.0.3
96
-
97
- - Исправлены ошибки в работе SuggestInput
98
-
99
- ## v1.0.2
100
-
101
- - Исправлены ошибки в работе FileInput - теперь при загрузке вместе с содержимым файла (поле `file`) отправляется его имя (поле `name`)
102
- - Исправлены возможные ошибки в работе блока .form
103
-
104
- ## v1.0.1
105
-
106
- - Исправлены ошибки в работе блока .form
107
-
108
- ## v1.0.0
package/CONTRIBUTING.md DELETED
@@ -1,59 +0,0 @@
1
- # b2b-ui
2
-
3
- ## Системные требования
4
-
5
- - Node.js и Yarn (https://gitea.optiweb.ru/wiki/wiki/wiki/Установка-Node.js-и-Yarn)
6
- - [Java](https://www.java.com/download/) версии 8 или выше (только для разработки и CI)
7
-
8
- Так же возможна работа через [Dev Containers](https://gitea.optiweb.ru/wiki/wiki/wiki/Работа-с-проектом-через-Dev-Containers).
9
-
10
- ## Команды
11
-
12
- Сборка проекта в development-режиме и запуск сервера для разработки на порту по-умолчанию (3000):
13
-
14
- `yarn dev`
15
-
16
- Сборка проекта в development-режиме и запуск сервера для разработки на определённом порту:
17
-
18
- `yarn dev --port 8000`
19
-
20
- Сборка проекта в production-режиме:
21
-
22
- `yarn build`
23
-
24
- Запуск проверки кода (в том числе его форматирования):
25
-
26
- `yarn lint`
27
-
28
- ## Git Hooks
29
-
30
- ### commit-msg
31
-
32
- Хук проверяет commit message на соответствие следующему формату:
33
-
34
- ```
35
- #<Номер задачи> <Краткое описание изменений>
36
- ```
37
-
38
- Особенности:
39
-
40
- - Если у номера задачи нет символа `#`, он будет добавлен автоматически
41
- - Cообщения, начинающиеся с `Merge/Revert`, не проверяются
42
-
43
- ### pre-commit
44
-
45
- Хук запускает проверку кода (в том числе его форматирования) с исправлением, если это возможно, найденных ошибок. Если автоматически исправить все найденные ошибки невозможно, создание коммита будет отменено.
46
-
47
- ## Обновление зависимостей
48
-
49
- ```shell
50
- yarn set version stable
51
-
52
- yarn install
53
-
54
- yarn dlx storybook@latest upgrade
55
-
56
- yarn upgrade-interactive
57
-
58
- yarn dlx @yarnpkg/sdks
59
- ```
@@ -1,154 +0,0 @@
1
- <template>
2
- <div class="color-input">
3
- <label
4
- v-for="color in preset"
5
- :key="color"
6
- class="color-input__color"
7
- :class="{ 'color-input__color_active': color === currentColor }"
8
- :style="{ borderColor: color === currentColor ? getActiveBorderColor(color) : '' }"
9
- >
10
- <input
11
- hidden
12
- type="radio"
13
- :name="name"
14
- :value="color"
15
- :checked="color === currentColor"
16
- @change="setColor(color)"
17
- />
18
- <span class="color-input__example" :style="{ backgroundColor: getHexColor(color) }"></span>
19
- </label>
20
- <template v-if="custom">
21
- <label
22
- class="color-input__color"
23
- :class="{ 'color-input__color_active': isCustomColorActive }"
24
- :style="{ borderColor: isCustomColorActive ? getActiveBorderColor(currentColorHex) : '' }"
25
- >
26
- <input
27
- class="sr-only"
28
- type="color"
29
- :name="name"
30
- :value="currentColorHex"
31
- @change="setColor($event.target.value)"
32
- />
33
- <span class="color-input__example" :style="{ backgroundColor: currentColorHex }">
34
- <svg class="color-input__icon" :class="[getIconModifier()]">
35
- <use :href="`${ICONS_PATH}#color-picker`" />
36
- </svg>
37
- </span>
38
- </label>
39
- <input hidden type="radio" :value="currentColorHex" :checked="isCustomColorActive" />
40
- </template>
41
- <label
42
- v-if="transparent"
43
- class="color-input__color"
44
- :class="{ 'color-input__color_active': isTransparentColorActive }"
45
- >
46
- <input
47
- hidden
48
- type="radio"
49
- :name="name"
50
- value="transparent"
51
- :checked="isTransparentColorActive"
52
- @change="setColor($event.target.value)"
53
- />
54
- <span class="color-input__example color-input__example_transparent"></span>
55
- </label>
56
- <label v-if="autocolor" class="color-input__color" :class="{ 'color-input__color_active': isAutoColorActive }">
57
- <input
58
- hidden
59
- type="radio"
60
- :name="name"
61
- :value="autocolor"
62
- :checked="isAutoColorActive"
63
- @change="setColor($event.target.value)"
64
- />
65
- <span class="color-input__example color-input__example_autocolor">
66
- <svg class="color-input__icon">
67
- <use :href="`${ICONS_PATH}#magic-wand`" />
68
- </svg>
69
- <svg class="color-input__icon">
70
- <use :href="`${ICONS_PATH}#magic-wand`" />
71
- </svg>
72
- </span>
73
- </label>
74
- </div>
75
- </template>
76
-
77
- <script setup>
78
- import Color from 'color';
79
- import { computed, ref, toRefs, watch } from 'vue';
80
-
81
- import { cssVar } from '../../helpers/css-var.js';
82
-
83
- const ICONS_PATH = window.ICONS_PATH;
84
-
85
- const emit = defineEmits(['input']);
86
-
87
- const props = defineProps({
88
- name: {
89
- type: String,
90
- required: true,
91
- },
92
- value: {
93
- type: String,
94
- required: true,
95
- },
96
- preset: {
97
- type: Array,
98
- default() {
99
- return [];
100
- },
101
- },
102
- custom: {
103
- type: Boolean,
104
- },
105
- transparent: {
106
- type: Boolean,
107
- },
108
- autocolor: {
109
- type: String,
110
- default: '',
111
- },
112
- });
113
-
114
- const { name, value, preset, custom, transparent, autocolor } = toRefs(props);
115
- const currentColor = ref(value.value);
116
- const isTransparentColorActive = computed(() => currentColor.value === 'transparent');
117
- const isAutoColorActive = computed(() => currentColor.value.indexOf('autocolor') === 0);
118
- const isCustomColorActive = computed(
119
- () => !preset.value.includes(currentColor.value) && !isTransparentColorActive.value && !isAutoColorActive.value,
120
- );
121
- const currentColorHex = computed(() => getHexColor(currentColor.value));
122
-
123
- watch(value, (newValue) => {
124
- currentColor.value = newValue;
125
- });
126
-
127
- const setColor = (color) => {
128
- currentColor.value = color;
129
- emit('input', currentColor.value);
130
- };
131
-
132
- const getHexColor = (color) => {
133
- if (color.charAt(0) === '$') {
134
- color = cssVar(color.replace('$', '--'));
135
- return Color(color).hex().toLowerCase();
136
- }
137
- return color;
138
- };
139
-
140
- const getActiveBorderColor = (color) => {
141
- color = getHexColor(color);
142
- // https://www.w3.org/TR/WCAG21/#contrast-minimum
143
- if (Color(color).contrast(Color('#ffffff')) >= 3) {
144
- return color;
145
- }
146
- return '';
147
- };
148
-
149
- const getIconModifier = () => {
150
- return !isTransparentColorActive.value && !isAutoColorActive.value && Color(currentColorHex.value).isDark()
151
- ? 'color-input__icon_light'
152
- : 'color-input__icon_dark';
153
- };
154
- </script>
@@ -1,240 +0,0 @@
1
- <template>
2
- <div class="date-input">
3
- <VDatePicker
4
- v-if="range"
5
- v-model.range.string="date"
6
- :min-date="minDate"
7
- :max-date="maxDate"
8
- :disabled-dates="parsedDisabledDates"
9
- locale="ru-RU"
10
- :masks="{ modelValue: 'DD.MM.YYYY' }"
11
- :popover="{ visibility: 'click' }"
12
- :attributes="attributes"
13
- :select-attribute="selectAttribute"
14
- :drag-attribute="dragAttribute"
15
- @update:model-value="model = $event"
16
- >
17
- <template #default="{ inputValue, inputEvents }">
18
- <div>
19
- <input
20
- :id="id"
21
- class="date-input__input input"
22
- :class="{ input_error: error, input_small: small }"
23
- type="text"
24
- readonly
25
- :name="name"
26
- :placeholder="placeholder || 'Введите даты'"
27
- :value="inputValue.start && inputValue.end ? `${inputValue.start} — ${inputValue.end}` : ''"
28
- :required="required"
29
- :disabled="disabled"
30
- v-on="inputEvents.start"
31
- />
32
- <svg class="date-input__icon"><use :href="`${ICONS_PATH}#date`" /></svg>
33
- </div>
34
- </template>
35
- </VDatePicker>
36
- <VDatePicker
37
- v-else
38
- v-model.string="date"
39
- :min-date="minDate"
40
- :max-date="maxDate"
41
- :disabled-dates="parsedDisabledDates"
42
- locale="ru-RU"
43
- :masks="{ modelValue: 'DD.MM.YYYY' }"
44
- :popover="{ visibility: 'click' }"
45
- :attributes="attributes"
46
- :select-attribute="selectAttribute"
47
- :drag-attribute="dragAttribute"
48
- @update:model-value="model = $event"
49
- >
50
- <template #default="{ inputValue, inputEvents }">
51
- <div>
52
- <input
53
- :id="id"
54
- class="date-input__input input"
55
- :class="{ input_error: error, input_small: small }"
56
- type="text"
57
- readonly
58
- :name="name"
59
- :placeholder="placeholder || 'Введите дату'"
60
- :value="inputValue"
61
- :required="required"
62
- :disabled="disabled"
63
- v-on="inputEvents"
64
- />
65
- <svg class="date-input__icon"><use :href="`${ICONS_PATH}#date`" /></svg>
66
- </div>
67
- </template>
68
- </VDatePicker>
69
- </div>
70
- </template>
71
-
72
- <script setup>
73
- import { is } from '@advdominion/is';
74
- import dayjs from 'dayjs';
75
- import customParseFormat from 'dayjs/plugin/customParseFormat.js';
76
- import { DatePicker } from 'v-calendar';
77
- import { ref, toRefs, watch } from 'vue';
78
-
79
- const ICONS_PATH = window.ICONS_PATH;
80
-
81
- dayjs.extend(customParseFormat);
82
- const VDatePicker = DatePicker;
83
-
84
- const model = defineModel({ type: String, default: '' });
85
-
86
- const props = defineProps({
87
- id: {
88
- type: String,
89
- default: '',
90
- },
91
- name: {
92
- type: String,
93
- default: '',
94
- },
95
- placeholder: {
96
- type: String,
97
- default: '',
98
- },
99
- min: {
100
- type: String,
101
- default: '',
102
- },
103
- max: {
104
- type: String,
105
- default: '',
106
- },
107
- range: {
108
- type: Boolean,
109
- },
110
- required: {
111
- type: Boolean,
112
- },
113
- disabled: {
114
- type: Boolean,
115
- },
116
- small: {
117
- type: Boolean,
118
- },
119
- error: {
120
- type: Boolean,
121
- },
122
- disabledDates: {
123
- type: Array,
124
- default() {
125
- return [];
126
- },
127
- },
128
- });
129
-
130
- const { id, name, placeholder, min, max, range, required, disabled, small, error, disabledDates } = toRefs(props);
131
-
132
- const attributes = ref([
133
- {
134
- key: 'today',
135
- highlight: {
136
- fillMode: 'outline',
137
- class: 'date-input__outline_bg',
138
- contentClass: 'date-input__outline_color',
139
- },
140
- dates: new Date(),
141
- },
142
- ]);
143
-
144
- const selectAttribute = ref({
145
- order: 1,
146
- highlight: {
147
- start: {
148
- fillMode: 'solid',
149
- class: 'date-input__solid_bg',
150
- contentClass: 'date-input__solid_color',
151
- },
152
- base: {
153
- fillMode: 'light',
154
- class: 'date-input__light_bg',
155
- contentClass: 'date-input__light_color',
156
- },
157
- end: {
158
- fillMode: 'solid',
159
- class: 'date-input__solid_bg',
160
- contentClass: 'date-input__solid_color',
161
- },
162
- },
163
- });
164
-
165
- const dragAttribute = ref({
166
- highlight: {
167
- start: {
168
- fillMode: 'outline',
169
- class: 'date-input__outline_bg',
170
- contentClass: 'date-input__outline_color',
171
- },
172
- base: {
173
- fillMode: 'light',
174
- class: 'date-input__light_bg',
175
- contentClass: 'date-input__light_color',
176
- },
177
- end: {
178
- fillMode: 'outline',
179
- class: 'date-input__outline_bg',
180
- contentClass: 'date-input__outline_color',
181
- },
182
- },
183
- });
184
-
185
- const date = ref();
186
- const setDate = (value) => {
187
- if (value) {
188
- if (range.value && is(value, 'String')) {
189
- value = value.split(',');
190
- date.value = {
191
- start: value[0],
192
- end: value[1],
193
- };
194
- } else {
195
- date.value = value;
196
- }
197
- } else {
198
- date.value = undefined;
199
- }
200
- };
201
- setDate(model.value);
202
- watch(model, () => {
203
- setDate(model.value);
204
- });
205
-
206
- const minDate = ref();
207
- const setMin = (value) => {
208
- minDate.value = value ? dayjs(value, 'DD.MM.YYYY').toDate() : undefined;
209
- };
210
- setMin(min.value);
211
- watch(min, (newMinValue) => {
212
- setMin(newMinValue);
213
- });
214
-
215
- const maxDate = ref();
216
- const setMax = (value) => {
217
- maxDate.value = value ? dayjs(value, 'DD.MM.YYYY').toDate() : undefined;
218
- };
219
- setMax(max.value);
220
- watch(max, (newMaxValue) => {
221
- setMax(newMaxValue);
222
- });
223
-
224
- const parsedDisabledDates = ref();
225
- const setParsedDisabledDates = (value) => {
226
- parsedDisabledDates.value = value.map((date) => {
227
- return date ? dayjs(date, 'DD.MM.YYYY').toDate() : '';
228
- });
229
- };
230
- setParsedDisabledDates(disabledDates.value);
231
- watch(disabledDates, (newDisabledDates) => {
232
- setParsedDisabledDates(newDisabledDates);
233
- });
234
-
235
- defineExpose({
236
- setDate,
237
- setMin,
238
- setMax,
239
- });
240
- </script>
@@ -1,44 +0,0 @@
1
- @use '../../variables' as *;
2
-
3
- $b: '.delete-all';
4
-
5
- #{$b} {
6
- align-items: center;
7
- color: $delete-all-color;
8
- cursor: pointer;
9
- display: inline-flex;
10
- text-decoration: none;
11
- transition-duration: var(--duration-micro-s);
12
- transition-property: color;
13
- transition-timing-function: var(--easing-standard);
14
-
15
- &:hover,
16
- &:focus-visible {
17
- color: $delete-all-active-color;
18
- }
19
-
20
- .action-list & {
21
- color: $deleta-all-action-list-color;
22
- }
23
-
24
- &__icon {
25
- fill: $delete-all-icon-color;
26
- height: 4px * 6;
27
- margin-right: 4px * 2;
28
- position: relative;
29
- top: -2px;
30
- transition-duration: var(--duration-micro-s);
31
- transition-property: fill;
32
- transition-timing-function: var(--easing-standard);
33
- width: 4px * 6;
34
-
35
- #{$b}:hover &,
36
- #{$b}:focus-visible & {
37
- fill: $delete-all-icon-active-color;
38
- }
39
-
40
- .action-list & {
41
- fill: $delete-all-action-list-icon-color;
42
- }
43
- }
44
- }