@rock555/frontend-core 3.3.0 → 3.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rock555/frontend-core",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "Спільне фронтове ядро: API-клієнт, таблиці, форми, модалки, хелпери",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -39,7 +39,9 @@ useHotkey('Escape', (event) => {
39
39
  </template>
40
40
 
41
41
  <style lang="scss">
42
- // Overlay: фикс на весь экран, скролл внутри, прозрачный затемнённый бэкдроп.
42
+ // Overlay: фикс на весь экран, прозрачный затемнённый бэкдроп. Картка не вища за
43
+ // екран і скролить свою середину (.modal__body); overflow тут — запас для вікон
44
+ // без неї, звичайне вікно overlay не прокручує.
43
45
  .modal-block {
44
46
  position: fixed;
45
47
  inset: 0;
@@ -108,6 +110,9 @@ useHotkey('Escape', (event) => {
108
110
 
109
111
  width: 100%;
110
112
  max-width: 480px;
113
+ // Не вища за екран: шапка й кнопки лишаються на місці, скролиться тіло.
114
+ max-height: 100%;
115
+ min-height: 0;
111
116
  margin: auto;
112
117
  padding: 20px;
113
118
 
@@ -129,6 +134,7 @@ useHotkey('Escape', (event) => {
129
134
 
130
135
  // ----- Заголовок ----------------------------------------------------------
131
136
  &__header {
137
+ flex: none;
132
138
  display: flex;
133
139
  justify-content: space-between;
134
140
  align-items: flex-start;
@@ -158,6 +164,27 @@ useHotkey('Escape', (event) => {
158
164
  display: flex;
159
165
  flex-direction: column;
160
166
  gap: 12px;
167
+ // relative: абсолютні нащадки (сховані input чекбоксів) рахуються від тіла
168
+ // й скроляться з ним, а не розпирають overlay.
169
+ position: relative;
170
+ min-height: 0;
171
+ overflow-y: auto;
172
+ overscroll-behavior: contain;
173
+ // Поле біля краю тіла не має обрізати кільце фокусу: запас усередині,
174
+ // відступ картки той самий.
175
+ margin: -4px -20px;
176
+ padding: 4px 20px;
177
+
178
+ // Тінь біля краю — лише коли за ним є прихований вміст: видно, що вікно
179
+ // прокручується, а не обірвалось. «Кришки» кольору картки їдуть разом із
180
+ // вмістом (local) і ховають тінь, щойно край досягнуто; тіні стоять (scroll).
181
+ background:
182
+ linear-gradient($color-surface 30%, rgba($color-surface, 0)) top / 100% 24px no-repeat local,
183
+ linear-gradient(rgba($color-surface, 0), $color-surface 70%) bottom / 100% 24px no-repeat local,
184
+ radial-gradient(farthest-side at 50% 0, rgba(15, 20, 30, 0.14), transparent) top / 100% 10px no-repeat scroll,
185
+ radial-gradient(farthest-side at 50% 100%, rgba(15, 20, 30, 0.14), transparent) bottom / 100% 10px no-repeat scroll;
186
+
187
+ @include scrollbarStyle;
161
188
  }
162
189
 
163
190
  &__note {
@@ -168,6 +195,7 @@ useHotkey('Escape', (event) => {
168
195
 
169
196
  // ----- Футер + кнопки -----------------------------------------------------
170
197
  &__footer {
198
+ flex: none;
171
199
  display: flex;
172
200
  justify-content: flex-end;
173
201
  gap: 8px;
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import {Info} from '@lucide/vue';
3
+ import {TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger} from 'reka-ui';
3
4
  import {Field} from 'vee-validate';
4
5
  import {useId} from 'vue';
5
6
 
@@ -32,18 +33,23 @@ const inputId = useId();
32
33
  <span v-if="isRequired" class="smart-field__required" aria-hidden="true">*</span>
33
34
  </label>
34
35
 
35
- <!-- tabindex — щоб підказка відкривалась і з клавіатури, не тільки по
36
- наведенню; aria-label дублює текст для читалок екрана. -->
37
- <button
38
- v-if="hint"
39
- type="button"
40
- class="smart-field__hint"
41
- :aria-label="hint"
42
- tabindex="0"
43
- >
44
- <Info :size="12" />
45
- <span class="smart-field__tip">{{ hint }}</span>
46
- </button>
36
+ <!-- Підказка в порталі, поверх сторінки: тіло модалки прокручується й
37
+ обрізало б її біля краю. Відкривається наведенням, фокусом з
38
+ клавіатури й дотиком (фокус); дотик по значку її не закриває. -->
39
+ <TooltipProvider v-if="hint" :delay-duration="150">
40
+ <TooltipRoot disable-closing-trigger>
41
+ <TooltipTrigger as-child>
42
+ <button type="button" class="smart-field__hint" :aria-label="hint">
43
+ <Info :size="12" />
44
+ </button>
45
+ </TooltipTrigger>
46
+ <TooltipPortal>
47
+ <TooltipContent class="smart-field__tip" side="top" :side-offset="6" :collision-padding="8">
48
+ {{ hint }}
49
+ </TooltipContent>
50
+ </TooltipPortal>
51
+ </TooltipRoot>
52
+ </TooltipProvider>
47
53
  </span>
48
54
  <slot v-bind="vee" :field="{ ...vee.field, id: inputId }" :input-id="inputId"></slot>
49
55
  <span class="ui-errors" v-if="vee.errors.length">
@@ -102,17 +108,12 @@ const inputId = useId();
102
108
  &:hover, &:focus-visible { opacity: 1; color: $color-accent; }
103
109
 
104
110
  // Показуємо підказку і по наведенню, і по фокусу з клавіатури.
105
- &:hover .smart-field__tip,
106
- &:focus-visible .smart-field__tip { opacity: 1; visibility: visible; }
111
+ &[data-state$='open'] { opacity: 1; color: $color-accent; }
107
112
  }
108
113
 
114
+ // Портал: над модалкою (999) і поповерами (1000).
109
115
  &__tip {
110
- position: absolute;
111
- bottom: calc(100% + 6px);
112
- left: 50%;
113
- z-index: 5;
114
- transform: translateX(-50%);
115
- width: max-content;
116
+ z-index: 1001;
116
117
  max-width: 240px;
117
118
  padding: 6px 8px;
118
119
  border-radius: 6px;
@@ -123,11 +124,6 @@ const inputId = useId();
123
124
  line-height: 1.35;
124
125
  text-align: left;
125
126
  white-space: normal;
126
- // visibility, а не display: інакше не буде переходу прозорості.
127
- opacity: 0;
128
- visibility: hidden;
129
- transition: opacity 0.12s ease;
130
- pointer-events: none;
131
127
  }
132
128
 
133
129
  input:not([type='checkbox']):not([type='radio']):not([type='file']),