@studio-west/component-sw 0.13.18 → 1.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.
package/README.md CHANGED
@@ -25,8 +25,12 @@ Interactive playground of the latest version with live examples, demonstration o
25
25
 
26
26
  - [Установка / Install](#установка--install)
27
27
 
28
+ - [SwAffix](#swaffix)
29
+
28
30
  - [SwAlert](#swalert)
29
31
 
32
+ - [SwBackTop](#swbacktop)
33
+
30
34
  - [SwBadge](#swbadge)
31
35
 
32
36
  - [SwButton](#swbutton)
@@ -35,8 +39,12 @@ Interactive playground of the latest version with live examples, demonstration o
35
39
 
36
40
  - [SwCollapse](#swcollapse)
37
41
 
42
+ - [SwDadata](#swdadata)
43
+
38
44
  - [SwDatePicker](#swdatepicker)
39
45
 
46
+ - [SwDrawer](#swdrawer)
47
+
40
48
  - [SwDropdown](#swdropdown)
41
49
 
42
50
  - [SwDropdownItem](#swdropdownitem)
@@ -45,9 +53,9 @@ Interactive playground of the latest version with live examples, demonstration o
45
53
 
46
54
  - [SwFormItem](#swformitem)
47
55
 
48
- - [SwIcon](#swicon)
56
+ - [SwGuide](#swguide)
49
57
 
50
- - [SwGide](#swgide)
58
+ - [SwIcon](#swicon)
51
59
 
52
60
  - [SwInput](#swinput)
53
61
 
@@ -57,10 +65,10 @@ Interactive playground of the latest version with live examples, demonstration o
57
65
 
58
66
  - [SwPagination](#swpagination)
59
67
 
60
- - [SwSelect](#swselect)
61
-
62
68
  - [SwSection](#swsection)
63
69
 
70
+ - [SwSelect](#swselect)
71
+
64
72
  - [SwSkeleton](#swskeleton)
65
73
 
66
74
  - [SwSkeletonItem](#swskeletonitem)
@@ -87,29 +95,6 @@ npm install @studio-west/component-sw
87
95
 
88
96
  Registry: [npmjs](https://www.npmjs.com/package/@studio-west/component-sw).
89
97
 
90
- ### Публикация / Publish
91
-
92
- ```bash
93
- npm version patch # или minor / major
94
- npm publish # либо: npm run release:patch
95
- git push && git push --tags
96
- ```
97
-
98
- CI: git-тег `v*.*.*` → workflow **Publish to npm** (secret **`NPM_TOKEN`**).
99
-
100
- ### Разработка / Development
101
-
102
- Нужен **Node 24** через [nvm](https://github.com/nvm-sh/nvm) (см. `.nvmrc`). Системный Node 21 с Vite 8 не совместим.
103
-
104
- ```bash
105
- nvm use # или: nvm install
106
- npm run dev # scripts/with-node.sh сам переключает Node
107
- npm run build
108
- ```
109
-
110
- Не вызывайте `npx vite` напрямую на системном Node — используйте `npm run …`. /
111
- Requires **Node 24** via [nvm](https://github.com/nvm-sh/nvm) (see `.nvmrc`). System Node 21 is incompatible with Vite 8. Use `npm run …` (via `scripts/with-node.sh`), not bare `npx vite`.
112
-
113
98
  ### Глобальное подключение / global add to main.js
114
99
  ```js
115
100
  import { Library } from '@studio-west/component-sw';
@@ -127,6 +112,7 @@ const {
127
112
  } = components;
128
113
 
129
114
  ```
115
+
130
116
  Установка в ручную светлой и темной темы - добавление к тегу `html` классов `dark` или `light` / Installation in a manual light and dark theme - adding to the tag `html` classes` dark` or `light`
131
117
 
132
118
  ### Пример использования / Example Usage
@@ -149,9 +135,98 @@ const darkMode = () => {
149
135
  ```
150
136
  ---
151
137
 
138
+ ## SwAffix
139
+
140
+ Фиксирует слот при прокрутке до нижней границы `boundary` или, если селектор не задан, до конца страницы. Алгоритм бокового меню [studiowest.ru/component-sw](https://studiowest.ru/component-sw/) (`listing.js`).
141
+
142
+ ### Свойства / Properties
143
+
144
+ | Имя | Тип | По умолчанию | Описание |
145
+ |----------------|----------|--------------|----------|
146
+ | `class` | `String` | `` | CSS-класс обёртки. |
147
+ | `offset` | `Number` | `0` | Отступ сверху viewport (px), `P` в listing.js. |
148
+ | `offsetBottom` | `Number` | `0` | Зазор до границы `boundary` (px); линия фиксации = edge − offsetBottom. |
149
+ | `boundary` | `String` | `` | CSS-селектор границы; без него — конец страницы. |
150
+ | `boundaryEdge` | `String` | `bottom` | `top` \| `bottom` — к какой границе boundary привязка (включительно). |
151
+
152
+ ### Пример
153
+
154
+ Два варианта `boundary-edge` (как в dev playground):
155
+
156
+ ```html
157
+ <style>
158
+ .dev-affix-demos { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; align-items: start; }
159
+ .dev-affix-demo > h3 { margin: 0 0 .75rem; font-size: .95rem; font-weight: 600; }
160
+ .dev-affix-layout { align-items: stretch; }
161
+ .dev-affix-layout > p { margin: 0; }
162
+ .dev-affix-aside { min-width: 0; align-self: stretch; }
163
+ .dev-affix-panel { background: var(--sw-bg-color-page); padding: .75rem 1rem; opacity: .8; }
164
+ .dev-affix-panel > p { margin: 0; }
165
+ .dev-affix-demo-menu .dev-affix-layout { display: grid; grid-template-columns: minmax(120px, 160px) 1fr; gap: 1rem; align-items: stretch; }
166
+ .dev-affix-demo-menu .dev-affix-aside { grid-column: 1; grid-row: 1; }
167
+ .dev-affix-demo-menu .dev-affix-boundary-b { grid-column: 2; grid-row: 1; display: grid; gap: .75rem; }
168
+ .dev-affix-demo-menu .dev-affix-boundary-b > p { margin: 0; line-height: 1.5; color: var(--sw-text-color-secondary); font-size: var(--sw-font-size-small); }
169
+ .dev-affix-demo-menu .dev-affix-panel { opacity: 1; }
170
+ </style>
171
+
172
+ <div class="dev-affix-demos">
173
+ <div class="dev-affix-demo">
174
+ <h3>boundary-edge top</h3>
175
+ <p>boundary — <code>.dev-affix-main</code> (нижний блок).</p>
176
+ <div class="dev-affix-layout">
177
+ <aside class="dev-affix-aside">
178
+ <sw-affix :offset="20" boundary=".dev-affix-main" boundary-edge="top">
179
+ <div class="dev-affix-panel">
180
+ <p>Affix — первая строка.</p>
181
+ <p>Affix — вторая строка.</p>
182
+ <p>Affix — третья строка.</p>
183
+ </div>
184
+ </sw-affix>
185
+ </aside>
186
+ <p>Контент — строка 1.</p>
187
+ <p>Контент — строка 2.</p>
188
+ <p>Контент — строка 3.</p>
189
+ <p>Контент — строка 4.</p>
190
+ <p>Контент — строка 5.</p>
191
+ <p>Контент — строка 6.</p>
192
+ <p>Контент — строка 7.</p>
193
+ <p>Контент — строка 8.</p>
194
+ <p>Контент — строка 9.</p>
195
+ <div class="dev-affix-main">end of content</div>
196
+ </div>
197
+ </div>
198
+ <div class="dev-affix-demo dev-affix-demo-menu">
199
+ <h3>boundary-edge bottom</h3>
200
+ <div class="dev-affix-layout">
201
+ <div class="dev-affix-boundary-b">
202
+ <p>Контент — строка 1.</p>
203
+ <p>Контент — строка 2.</p>
204
+ <p>Контент — строка 3.</p>
205
+ <p>Контент — строка 4.</p>
206
+ <p>Контент — строка 5.</p>
207
+ <p>Контент — строка 6.</p>
208
+ <p>Контент — строка 7.</p>
209
+ <p>Контент — строка 8.</p>
210
+ <p>Контент — строка 9.</p>
211
+ </div>
212
+ <aside class="dev-affix-aside">
213
+ <sw-affix :offset="20" :offset-bottom="20" boundary=".dev-affix-boundary-b">
214
+ <div class="dev-affix-panel">
215
+ <p>Affix — первая строка.</p>
216
+ <p>Affix — вторая строка.</p>
217
+ <p>Affix — третья строка.</p>
218
+ </div>
219
+ </sw-affix>
220
+ </aside>
221
+ </div>
222
+ </div>
223
+ </div>
224
+ ```
225
+ ---
226
+
152
227
  ## SwAlert
153
228
 
154
- Функция `Alert()` — система всплывающих сообщений. Несколько алертов стекаются; позиция и порядок задаются параметрами `placement` / `align`.
229
+ Функция `Alert()` — система всплывающих сообщений. Несколько сообщений групируются; позиция и порядок задаются параметрами `placement` / `align`.
155
230
 
156
231
  The `Alert()` function shows toast messages. Multiple alerts stack; position and order are controlled by `placement` / `align`.
157
232
 
@@ -164,7 +239,7 @@ The `Alert()` function shows toast messages. Multiple alerts stack; position and
164
239
  | `type` | `String` | `info` | `'primary'`, `'success'`, `'info'`, `'warning'`, `'danger'` (алиас `'error'` → `danger`). |
165
240
  | `message` | `String` | `Default message` | Текст сообщения. |
166
241
  | `duration` | `Number` | `6000` | Время отображения в миллисекундах. |
167
- | `placement` | `String` | `top` | Вертикаль: `'top'` — старые сверху, новые ниже; `'bottom'` — свежие сверху стека у низа экрана. |
242
+ | `placement` | `String` | `top` | Вертикаль: `'top'` — старые сверху в верху экрана; `'bottom'` — новые сверху у низа экрана. |
168
243
  | `align` | `String` | `center` | Горизонталь: `'left'`, `'center'`, `'right'`. |
169
244
  | `before` | `String` | `` | Иконка в начале: имя из SVG-спрайта или URL. См. [SwIcon](#swicon). |
170
245
  | `after` | `String` | `` | Иконка в конце (закрыть): имя из спрайта или URL. См. [SwIcon](#swicon). |
@@ -182,34 +257,103 @@ Default - Текст описания или модуль / модули
182
257
 
183
258
  ### Пример использования / Example Usage
184
259
 
185
- ```js
186
- // .js addons
187
- import { Alert, components } from "@studio-west/component-sw"
188
- import { h } from 'vue'
189
- Alert({
190
- message: 'Message',
191
- type: 'danger',
192
- duration: 10000,
193
- placement: 'bottom',
194
- align: 'right',
195
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/bell.svg',
196
- footer: h(components.SwButton, { onClick: () => console.log('Клик по кнопке в футере') }, () => 'OK')
197
- })
260
+ ```html
261
+ <script setup>
262
+ import { Alert } from '@studio-west/component-sw'
198
263
 
199
- // Composition API / <script setup>:
200
- import { inject, h } from "vue"
201
- import { components } from "@studio-west/component-sw"
202
- const Alert = inject('Alert')
203
- Alert({
204
- message: 'Alarm!',
205
- type: 'warning',
206
- placement: 'top',
207
- align: 'center',
208
- suffix: h(components.SwIcon, { iconClass: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/info-circle.svg' })
209
- })
264
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
265
+ const icons = {
266
+ star: `${TABLER}/star.svg`,
267
+ close: `${TABLER}/x.svg`
268
+ }
269
+
270
+ let alertSeq = 0
271
+
272
+ function showAlert(type, placement = 'top', align = 'center') {
273
+ alertSeq += 1
274
+ Alert({
275
+ message: `#${alertSeq} ${type} (${placement}/${align})`,
276
+ type,
277
+ placement,
278
+ align,
279
+ duration: 8000,
280
+ before: icons.star,
281
+ after: icons.close
282
+ })
283
+ }
284
+ </script>
285
+
286
+ <sw-button type="info" label="info" @click="showAlert('info')" />
287
+ <sw-button type="success" label="success" @click="showAlert('success')" />
288
+ <sw-button type="warning" label="warning" @click="showAlert('warning')" />
289
+ <sw-button type="danger" label="error" @click="showAlert('error')" />
290
+
291
+ <!-- позиция: повторный клик — стек -->
292
+ <sw-button
293
+ v-for="pos in [
294
+ { placement: 'top', align: 'left' },
295
+ { placement: 'top', align: 'center' },
296
+ { placement: 'bottom', align: 'right' }
297
+ ]"
298
+ :key="`${pos.placement}-${pos.align}`"
299
+ type="primary"
300
+ :label="`${pos.placement}/${pos.align}`"
301
+ @click="showAlert('info', pos.placement, pos.align)"
302
+ />
303
+ ```
304
+ ---
305
+
306
+ ## SwBackTop
307
+
308
+ Кнопка «наверх» — появляется после прокрутки ниже `visibilityHeight`, плавный scroll to top.
309
+
310
+ ### Свойства / Properties
311
+
312
+ | Имя | Тип | По умолчанию | Описание |
313
+ |--------------------|----------|--------------|-----------------------------------|
314
+ | `class` | `String` | `` | CSS-класс кнопки. |
315
+ | `visibilityHeight` | `Number` | `400` | Порог scrollY для показа. |
316
+ | `right` | `String` | `2rem` | Отступ справа (`position: fixed`).|
317
+ | `bottom` | `String` | `2rem` | Отступ снизу. |
318
+
319
+ ### Пример
320
+
321
+ ```html
322
+ <sw-back-top :visibility-height="300" />
323
+ ```
324
+ ---
325
+
326
+ ## SwBadge
327
+
328
+ Индикатор поверх слота: число, текст или точка (`isDot`).
329
+
330
+ ### Свойства / Properties
331
+
332
+ | Имя | Тип | По умолчанию | Описание |
333
+ |-------------|-------------------|--------------|-----------------------------------|
334
+ | `value` | `Number`/`String` | `` | Значение на бейдже. |
335
+ | `max` | `Number` | `99` | При числе > max → `{max}+`. |
336
+ | `type` | `String` | `danger` | Цвет метки. |
337
+ | `isDot` | `Boolean` | `false` | Точка вместо текста. |
338
+ | `showZero` | `Boolean` | `false` | Показывать `0`. |
339
+ | `hidden` | `Boolean` | `false` | Скрыть метку. |
340
+ | `class` | `String` | `` | CSS-класс обёртки. |
341
+
342
+ ### Пример
210
343
 
211
- // Options API:
212
- this.$Alert({ message: 'Welcome!', type: 'success', prefix: 'Дополнительная информация' })
344
+ ```html
345
+ <sw-badge :value="3">
346
+ <sw-button type="primary" label="Сообщения" />
347
+ </sw-badge>
348
+ <sw-badge :value="120" :max="99" type="warning">
349
+ <sw-button label="Уведомления" />
350
+ </sw-badge>
351
+ <sw-badge is-dot type="danger">
352
+ <sw-button type="info" label="Точка" />
353
+ </sw-badge>
354
+ <sw-badge value="new" type="success">
355
+ <sw-button label="Текст" />
356
+ </sw-badge>
213
357
  ```
214
358
  ---
215
359
 
@@ -230,10 +374,10 @@ this.$Alert({ message: 'Welcome!', type: 'success', prefix: 'Дополните
230
374
  | `href` | `String` | `` | URL, на который будет перенаправлен пользователь при клике (если `link=true`). |
231
375
  | `disabled` | `Boolean` | `false` | Блокирует кнопку, делая её неактивной. |
232
376
  | `label` | `String` | `` | Текст кнопки (альтернатива содержимому слота). |
233
- | `before` | `String` | `` | Иконка перед текстом: имя из SVG-спрайта или URL (`https://…`). См. [SwIcon](#swicon). |
377
+ | `before` | `String` | `` | Иконка перед текстом: имя из SVG-спрайта или URL. См. [SwIcon](#swicon). |
234
378
  | `after` | `String` | `` | Иконка после текста: имя из спрайта или URL. См. [SwIcon](#swicon). |
235
- | `prefix` | `String` | `` | **Deprecated** (удалить в major) — используйте `before`. |
236
- | `postfix` | `String` | `` | **Deprecated** (удалить в major) — используйте `after`. |
379
+ | `prefix` | `String` | `` | **Deprecated** (удалю в major) — используйте `before`. |
380
+ | `postfix` | `String` | `` | **Deprecated** (удалю в major) — используйте `after`. |
237
381
 
238
382
  ### Слоты / Slots
239
383
 
@@ -241,42 +385,32 @@ Default - содержимое кнопки (текст, иконки или д
241
385
 
242
386
  ### Пример использования / Example Usage
243
387
 
244
- #### Базовый пример:
245
-
246
388
  ```html
247
- <sw-button
248
- class="custom-class"
249
- size="large"
250
- type="primary"
251
- round
252
- text
253
- link
254
- href="https://example.com"
255
- >
256
- Нажми меня / Click Me
257
- </sw-button>
258
- ```
259
-
260
- #### С иконками и label:
389
+ <script setup>
390
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
391
+ const icons = {
392
+ floppy: `${TABLER}/device-floppy.svg`,
393
+ arrow: `${TABLER}/arrow-right.svg`,
394
+ star: `${TABLER}/star.svg`,
395
+ chevron: `${TABLER}/chevron-down.svg`,
396
+ search: `${TABLER}/search.svg`
397
+ }
398
+ </script>
261
399
 
262
- ```html
400
+ <sw-button type="primary" label="Primary" />
401
+ <sw-button type="success" label="Success" />
402
+ <sw-button size="small" type="primary" label="Small" />
403
+ <sw-button type="primary" round label="Round" />
404
+ <sw-button type="primary" text label="Text" />
405
+ <sw-button type="primary" link label="Link" />
406
+ <sw-button type="primary" disabled label="Disabled" />
263
407
  <sw-button
264
- label="Сохранить"
265
- before="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/device-floppy.svg"
266
- after="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/arrow-right.svg"
267
408
  type="success"
409
+ label="Сохранить"
410
+ :before="icons.floppy"
411
+ :after="icons.arrow"
268
412
  />
269
- ```
270
-
271
- #### Отключенная кнопка:
272
-
273
- ```html
274
- <sw-button
275
- disabled="true"
276
- type="primary"
277
- >
278
- Недоступно
279
- </sw-button>
413
+ <sw-button type="warning" :before="icons.search">Слот</sw-button>
280
414
  ```
281
415
  ---
282
416
 
@@ -306,16 +440,15 @@ model - индекс активной кнопки.
306
440
  ### Пример использования / Example Usage
307
441
 
308
442
  ```html
309
- <script>let active = 0 </script>
310
- <sw-button-group
311
- class="custom-class"
312
- radio
313
- v-model="active"
314
- vertical
315
- >
316
- <sw-button type="primary" size="small">Нажми меня 1 / Click Me 1</sw-button>
317
- <sw-button type="primary" >Нажми меня 2 / Click Me 2</sw-button>
318
- <sw-button type="danger">Нажми меня 3 / Click Me 3</sw-button>
443
+ <script setup>
444
+ import { ref } from 'vue'
445
+ const buttonGroupActive = ref(0)
446
+ </script>
447
+
448
+ <sw-button-group radio v-model="buttonGroupActive">
449
+ <sw-button type="primary" size="small">Один</sw-button>
450
+ <sw-button type="primary">Два</sw-button>
451
+ <sw-button type="danger">Три</sw-button>
319
452
  </sw-button-group>
320
453
  ```
321
454
  ---
@@ -337,7 +470,6 @@ Default - Контент для скрытия
337
470
  ### Особенности реализации
338
471
 
339
472
  - Плавная анимация открытия/закрытия с использованием CSS transitions
340
- - Автоматический расчет высоты контента через ResizeObserver
341
473
  - Адаптивное изменение размеров при динамическом контенте
342
474
 
343
475
  ### Пример использования / Example Usage
@@ -345,18 +477,48 @@ Default - Контент для скрытия
345
477
  ```html
346
478
  <script setup>
347
479
  import { ref } from 'vue'
348
-
349
- const open = ref(true)
480
+ const collapseOpen = ref(true)
350
481
  </script>
351
482
 
352
- <sw-button label="Показать / скрыть" type="primary" @click="open = !open" />
353
-
354
- <sw-collapse :visual="open">
355
- <p>Скрываемый контент / Collapsible content</p>
483
+ <sw-button size="small" @click="collapseOpen = !collapseOpen">
484
+ {{ collapseOpen ? 'Свернуть' : 'Развернуть' }}
485
+ </sw-button>
486
+ <sw-collapse :visual="collapseOpen">
487
+ <p>Скрываемый контент коллапса.</p>
356
488
  </sw-collapse>
357
489
  ```
358
490
  ---
359
491
 
492
+ ## SwDadata
493
+
494
+ Подсказки адреса [DaData](https://dadata.ru/api/suggest/address/). Логика, ранее в `SwSelect`, вынесена сюда. Клавиатура: ↑↓, Enter, Escape; поле с `clearable`.
495
+
496
+ ### Свойства / Properties
497
+
498
+ | Имя | Тип | По умолчанию | Описание |
499
+ |---------------|----------|--------------|-----------------------------------------------|
500
+ | `class` | `String` | `` | CSS-класс. |
501
+ | `size` | `String` | `large` | `'large'` / `'small'`. |
502
+ | `placeholder` | `String` | `` | Placeholder. |
503
+ | `token` | `String` | `` | API-ключ DaData (без токена запросы не идут). |
504
+
505
+ ### Модель / Model
506
+
507
+ `{ text, coords: [lat, lon], suggestion }`
508
+
509
+ ### Пример
510
+
511
+ ```html
512
+ <script setup>
513
+ import { ref } from 'vue'
514
+ const geo = ref({ text: '', coords: [0, 0], suggestion: null })
515
+ const token = '192ee5dbc59f8cdd137089bbe67ba1aa0b9ec5cb'
516
+ </script>
517
+
518
+ <sw-dadata v-model="geo" :token="token" placeholder="Город, улица, дом" size="small" />
519
+ ```
520
+ ---
521
+
360
522
  ## SwDatePicker
361
523
 
362
524
  Компонент `SwDatePicker` представляет собой панель с календарем.
@@ -371,7 +533,7 @@ const open = ref(true)
371
533
 
372
534
  ### События / Events
373
535
 
374
- input - событие выбора с данными {dateStart: "11.11.2011", dateEnd: "14-12-2011" ( при range), count: 1 }
536
+ input — событие выбора: `{ dateStart: "11.11.2011", dateEnd: "14.12.2011" /* при range */, count: 1 }` (формат `DD.MM.YYYY`)
375
537
 
376
538
  ### Слоты / Slots
377
539
 
@@ -435,19 +597,56 @@ const datePickerLimitation = ref([
435
597
  ```
436
598
  ---
437
599
 
438
- ## SwDropdown
600
+ ## SwDrawer
601
+
602
+ Боковая шторка (panel/sheet). В отличие от **SwMessage** (центральный `<dialog>`), выезжает слева или справа. `v-model` — открыт/закрыт; Escape и клик по маске закрывают.
603
+
604
+ ### Свойства / Properties
605
+
606
+ | Имя | Тип | По умолчанию | Описание |
607
+ |---------------------|-----------|--------------|---------------------------------------|
608
+ | `class` | `String` | `` | Класс маски. |
609
+ | `title` | `String` | `` | Заголовок (или slot `#header`). |
610
+ | `placement` | `String` | `right` | `'left'` / `'right'`. |
611
+ | `size` | `String` | `30%` | Ширина панели (CSS width). |
612
+ | `after` | `String` | `` | Иконка закрытия в header. |
613
+ | `modal` | `Boolean` | `false` | Затемнение backdrop (glass + blur). |
614
+ | `closeOnClickModal` | `Boolean` | `true` | Закрывать по клику на backdrop. |
615
+
616
+ ### Слоты
439
617
 
440
- Компонент `SwDropdown` — всплывающее меню с настройкой места открытия и типа триггера. У попапа есть **уголок**, который указывает на триггер; сторона и смещение считаются по фактической позиции (с учётом flip у края экрана). `z-index` попапа = z-index ближайшего предка + 3 (`Teleport` в `body`). Клавиатура: **Escape** закрывает, **↑/↓** по пунктам, **Enter** / **Space** выбирает.
618
+ Default — тело; `#header`, `#footer`.
441
619
 
442
- **Tooltip:** отдельный `SwTooltip` не нужен. Тот же компонент с `trigger="hover"` и текстом/разметкой в `#dropdown` работает как подсказка (без `SwDropdownItem`, если это не меню).
620
+ ### Пример
621
+
622
+ ```html
623
+ <script setup>
624
+ import { ref } from 'vue'
625
+ const open = ref(false)
626
+ const close = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg'
627
+ </script>
628
+
629
+ <sw-button type="primary" @click="open = true">Открыть</sw-button>
630
+ <sw-drawer v-model="open" title="Шторка" :after="close">
631
+ Контент
632
+ <template #footer>
633
+ <sw-button size="small" @click="open = false">OK</sw-button>
634
+ </template>
635
+ </sw-drawer>
636
+ ```
637
+ ---
638
+
639
+ ## SwDropdown
640
+
641
+ Компонент `SwDropdown` — всплывающее меню с настройкой места открытия и типа триггера. У попапа есть **уголок**, который указывает на триггер; сторона и смещение считаются по фактической позиции (с учётом flip у края экрана). `z-index` попапа динамический = z-index ближайшего предка + 3. Клавиатура: **Escape** закрывает, **↑/↓** по пунктам, **Enter** / **Space** выбирает.
443
642
 
444
- The `SwDropdown` popup shows a caret pointing at the trigger; side/offset follow the real placement after edge flip. Keyboard: Escape, Arrow keys, Enter/Space. Use `trigger="hover"` as a tooltip — no separate Tooltip component.
643
+ Компонент с `trigger="hover"` и текстом/разметкой в `#dropdown` работает как подсказка **Tooltip** (без `SwDropdownItem`, если это не меню).
445
644
 
446
645
  ### Свойства / Properties
447
646
 
448
647
  | Имя | Тип | По умолчанию | Значения/Описание |
449
648
  |-------------|-----------|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
450
- | `class` | `String` | `` | CSS-класс попапа (например `gide` для онбординга). |
649
+ | `class` | `String` | `` | CSS-класс попапа (например `guide` для онбординга). |
451
650
  | `size` | `String` | `` | Размер: `'large'`, `'small'`. |
452
651
  | `type` | `String` | `` | `'primary'`, `'success'`, `'info'`, `'warning'`, `'danger'`. |
453
652
  | `trigger` | `String` | `click` | Способ открытия: `'click'`, `'hover'` (в т.ч. как tooltip), `'context'`, `'none'` — только через `model`. |
@@ -469,10 +668,22 @@ model - состояние меню, булевое значение откры
469
668
  Меню:
470
669
 
471
670
  ```html
472
- <sw-dropdown class="custom-class" placement="bottom" :max-width="250">
473
- <sw-button label="Меню" type="primary" />
671
+ <script setup>
672
+ import { ref } from 'vue'
673
+ const open = ref(false)
674
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
675
+ const star = `${TABLER}/star.svg`
676
+ const chevron = `${TABLER}/chevron-down.svg`
677
+ </script>
678
+
679
+ <sw-dropdown v-model="open" trigger="click" placement="bottom-left">
680
+ <sw-button size="small">
681
+ Меню <sw-icon :icon-class="chevron" />
682
+ </sw-button>
474
683
  <template #dropdown>
475
- <sw-dropdown-item>содержание / context</sw-dropdown-item>
684
+ <sw-dropdown-item :before="star">Пункт со звездой</sw-dropdown-item>
685
+ <sw-dropdown-item>Обычный пункт</sw-dropdown-item>
686
+ <sw-dropdown-item type="danger">Опасный</sw-dropdown-item>
476
687
  </template>
477
688
  </sw-dropdown>
478
689
  ```
@@ -509,13 +720,16 @@ Default - текст названия или модуль
509
720
 
510
721
  ### Пример использования / Example Usage
511
722
 
723
+ См. [SwDropdown](#swdropdown). Кратко с иконкой:
724
+
512
725
  ```html
513
- <sw-dropdown class="custom-class" :max-width="250">
514
- <sw-button label="Меню" type="primary" />
515
- <template #dropdown>
516
- <sw-dropdown-item before="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/files.svg">содержание / context</sw-dropdown-item>
517
- </template>
518
- </sw-dropdown>
726
+ <script setup>
727
+ const star = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg'
728
+ </script>
729
+
730
+ <sw-dropdown-item :before="star">Пункт со звездой</sw-dropdown-item>
731
+ <sw-dropdown-item>Обычный пункт</sw-dropdown-item>
732
+ <sw-dropdown-item type="danger">Пункт внимание</sw-dropdown-item>
519
733
  ```
520
734
  ---
521
735
 
@@ -650,8 +864,6 @@ const documentFiles = ref([])
650
864
 
651
865
  Компонент `SwFormItem` — **подписи к полям формы** (не обёртка контрола): строка с подписью слева и текстом справа (подсказка / ошибка). Выравнивание через `justify`, цвет текста через `type`.
652
866
 
653
- `SwFormItem` is a **form caption row** (not a field wrapper): label on the left, hint/error on the right. Use `justify` for alignment and `type` for text color.
654
-
655
867
  ### Свойства / Properties
656
868
 
657
869
  | Имя | Тип | По умолчанию | Значения/Описание |
@@ -659,7 +871,7 @@ const documentFiles = ref([])
659
871
  | `label` | `String` | `` | Подпись слева. |
660
872
  | `type` | `String` | `` | Цвет текста: `'primary'`, `'success'`, `'info'`, `'warning'`, `'danger'` (`'error'` → `danger`). Без фонов кнопок. |
661
873
  | `justify` | `String` | `` | Выравнивание: `''` → `space-between`; `'start'`, `'end'`, `'around'`, `'center'`. |
662
- | `class` | `String` | `` | Дополнительный CSS-класс. |
874
+ | `class` | `String` | `` | Пользовательски CSS-класс корня модуля. |
663
875
 
664
876
  ### Слоты / Slots
665
877
 
@@ -672,46 +884,28 @@ Default — текст справа (подсказка / ошибка)
672
884
  ### Пример использования / Example Usage
673
885
 
674
886
  ```html
675
- <sw-form-item label="Пароль" type="danger">слишком короткий</sw-form-item>
676
- <sw-input v-model="pass" name="pass" label="Пароль" />
677
-
678
- <sw-form-item justify="start" type="info">Подсказка под полем</sw-form-item>
679
- ```
680
- ---
681
-
682
- ## SwIcon
683
-
684
- Компонент `SwIcon` отображает SVG-иконку из встроенного спрайта или по-внешнему URL.
685
-
686
- Если `iconClass` начинается с `http://`, `https://`, иконка загружается как внешний SVG через CSS `mask` (класс `sw-external-icon`). Иначе используется символ из спрайта: `#prefix-iconClass`.
687
-
688
- Компонент используется внутри SwButton, SwInput, SwAlert, SwDropdownItem, SwSection, SwMessage, SwGide (`before` / `after`) — во всех этих props можно передавать как имя из спрайта, так и полный URL. Старые имена (`prefix`/`postfix`, `iconBefore`, `iconAfter`, `iconClose`) пока работают, будут удалены в major.
689
-
690
- ### Свойства / Properties
691
-
692
- | Имя | Тип | По умолчанию | Значения/Описание |
693
- |-------------|----------|--------------|-------------------------------------------------|
694
- | `iconClass` | `String` | `required` | Имя иконки в спрайте или URL (`https://…`). |
695
- | `prefix` | `String` | `icon` | Префикс символа в спрайте: `#prefix-iconClass`. |
696
- | `className` | `String` | `` | Дополнительный CSS-класс для элемента `<svg>`. |
697
-
698
- ### Пример использования / Example Usage
699
-
700
- ```html
701
- <!-- из спрайта -->
702
- <sw-icon icon-class="star" />
887
+ <script setup>
888
+ import { ref } from 'vue'
889
+ const formPlain = ref('')
890
+ const formOk = ref('ok')
891
+ const formBad = ref('')
892
+ </script>
703
893
 
704
- <!-- внешний URL (Tabler Icons) -->
705
- <sw-icon icon-class="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg" />
894
+ <sw-form-item label="Имя">
895
+ <sw-input v-model="formPlain" name="form-plain" label="Имя" />необязательно
896
+ </sw-form-item>
897
+ <sw-form-item label="Email" type="success">
898
+ <sw-input v-model="formOk" name="form-ok" label="Email" />ок
899
+ </sw-form-item>
900
+ <sw-form-item label="Пароль" justify="center" type="danger">
901
+ <sw-input v-model="formBad" name="form-bad" label="Пароль" />слишком короткий
902
+ </sw-form-item>
706
903
  ```
707
-
708
904
  ---
709
905
 
710
- ## SwGide
711
-
712
- Компонент `SwGide` создаёт затемнение вокруг блока по селектору и показывает [SwDropdown](#swdropdown) с шагами из `steps`. `z-index` гида динамический: выше контента страницы (в т.ч. тултипов слайдера), ниже алертов (`9999`).
906
+ ## SwGuide
713
907
 
714
- `SwGide` dims the page around a selector and shows a [SwDropdown](#swdropdown) for `steps`. Overlay `z-index` is dynamic: above page content, below alerts (`9999`).
908
+ Компонент `SwGuide` создаёт затемнение вокруг блока по селектору и показывает [SwDropdown](#swdropdown) с шагами из `steps`. `z-index` гида динамический: выше контента страницы (в т.ч. тултипов слайдера), ниже алертов.
715
909
 
716
910
  ### Свойства / Properties
717
911
 
@@ -739,27 +933,63 @@ model - массив обьектов шагов обучения
739
933
  ```html
740
934
  <script setup>
741
935
  import { ref } from 'vue'
936
+ const guideOn = ref(false)
937
+ const guideStep = ref(0)
938
+ const close = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg'
939
+ const guideSteps = [
940
+ { header: 'Dropdown', text: 'Клик открывает список пунктов.', tag: '#guide-demo', placement: 'bottom' },
941
+ { header: 'Календарь', text: 'Ниже на странице — SwDatePicker.', tag: '#sw-datepicker', placement: 'bottom' }
942
+ ]
943
+ </script>
742
944
 
743
- const settings = ref({ gide: true })
744
- const step = ref(0)
745
- const steps = ref([
746
- {header: 'заголовок',
747
- text: 'текст сообщения',
748
- tag: 'nav',
749
- placement: 'bottom',
750
- img: 'assets/teme_sw/images/sw.png'
751
- }
752
- ])
945
+ <sw-button type="primary" size="small" @click="guideStep = 0; guideOn = true">Запустить гид</sw-button>
946
+ <sw-guide
947
+ v-if="guideOn"
948
+ v-model="guideStep"
949
+ :steps="guideSteps"
950
+ :after="close"
951
+ @close="guideOn = false"
952
+ />
953
+ ```
954
+ ---
955
+
956
+ ## SwIcon
957
+
958
+ Компонент `SwIcon` отображает SVG-иконку из встроенного спрайта или по-внешнему URL.
959
+
960
+ Если `iconClass` начинается с `http://`, `https://`, иконка загружается как внешний SVG через CSS `mask` (класс `sw-external-icon`). Иначе используется символ из спрайта: `#prefix-iconClass`.
961
+
962
+ Компонент используется внутри библиотеки, и во многих компонентов в props можно передавать как имя из спрайта, так и полный URL.
963
+
964
+ ### Свойства / Properties
965
+
966
+ | Имя | Тип | По умолчанию | Значения/Описание |
967
+ |-------------|----------|--------------|-------------------------------------------------|
968
+ | `iconClass` | `String` | `required` | Имя иконки в спрайте или URL (`https://…`). |
969
+ | `prefix` | `String` | `icon` | Префикс символа в спрайте: `#prefix-iconClass`. |
970
+ | `className` | `String` | `` | Пользовательский CSS-класс для элемента `<svg>`. |
971
+
972
+ ### Пример использования / Example Usage
973
+
974
+ ```html
975
+ <script setup>
976
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
977
+ const icons = {
978
+ star: `${TABLER}/star.svg`,
979
+ search: `${TABLER}/search.svg`,
980
+ phone: `${TABLER}/phone.svg`,
981
+ chevron: `${TABLER}/chevron-down.svg`
982
+ }
753
983
  </script>
754
- <sw-gide v-if="settings.gide" :steps="steps" v-model="step" @close="settings.gide=false" after="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg">
755
- <template #header>
756
- Блок {{ steps[step].header }}
757
- <sw-button type="primary" link @click="settings.gide=false"><sw-icon icon-class="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg" /></sw-button>
758
- </template>
759
- <template #arrow><sw-icon icon-class="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-left.svg" /></template>
760
- </sw-gide>
984
+
985
+ <sw-icon :icon-class="icons.star" />
986
+ <sw-icon :icon-class="icons.search" />
987
+ <sw-icon :icon-class="icons.phone" />
988
+ <sw-icon :icon-class="icons.chevron" />
761
989
  ```
990
+
762
991
  ---
992
+
763
993
  ## SwInput
764
994
 
765
995
  Компонент `SwInput` представляет собой поле ввода с возможностью настройки внешнего вида и поведения.
@@ -809,23 +1039,15 @@ clear - очистка через `clearable`
809
1039
  ```html
810
1040
  <script setup>
811
1041
  import { ref } from 'vue'
812
-
813
- const model = ref('')
1042
+ const inputSmall = ref('')
1043
+ const inputPassword = ref('')
1044
+ const inputTextarea = ref('')
1045
+ const phone = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/phone.svg'
814
1046
  </script>
815
1047
 
816
- <sw-input
817
- v-model="model"
818
- name="input"
819
- class="custom-class"
820
- size="large"
821
- type="phone"
822
- before="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/phone.svg"
823
- placeholder="Your phone"
824
- label="Телефон"
825
- @prefix="console.log('before')"
826
- >
827
- <template #suffix>#</template>
828
- </sw-input>
1048
+ <sw-input v-model="inputSmall" name="input-small" size="small" :before="phone" label="Small" clearable />
1049
+ <sw-input v-model="inputPassword" name="input-password" type="password" label="Password" clearable />
1050
+ <sw-input v-model="inputTextarea" name="input-textarea" type="textarea" label="Комментарий" :rows="4" clearable />
829
1051
  ```
830
1052
  ---
831
1053
 
@@ -939,212 +1161,28 @@ change - событие изменения значения компонента
939
1161
 
940
1162
  ### Пример использования / Example Usage
941
1163
 
942
- #### Базовый пример с объектом:
943
-
944
1164
  ```html
945
1165
  <script setup>
946
1166
  import { ref } from 'vue'
1167
+ const menuModel = ref([])
1168
+ const menuItems = [
1169
+ { SwButton: { type: 'primary', size: 'small', slot: 'Пункт 1' } },
1170
+ { SwButton: { size: 'small', slot: 'Пункт 2' } },
1171
+ { SwSwitch: { id: 'menu-sw', name: 'menu-sw', on: 'On', off: 'Off' } }
1172
+ ]
1173
+ </script>
947
1174
 
948
- const menuState = ref([false, false])
1175
+ <sw-menu v-model="menuModel" :menu-items="menuItems" @click="console.log" />
1176
+ ```
949
1177
 
950
- const menuConfig = {
951
- 'SwButton': {
952
- label: 'Нажми меня',
953
- type: 'primary',
954
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg'
955
- },
956
- 'SwSwitch': [
957
- {
958
- label: 'Уведомления',
959
- on: 'Вкл',
960
- off: 'Выкл'
961
- },
962
- {
963
- label: 'Звук',
964
- checkbox: true
965
- }
966
- ]
967
- }
1178
+ Корень меню — `nav.sw-menu`: `display: flex`, `align-items: center`, `gap: var(--sw-gap)`, `flex-wrap: wrap`.
1179
+ ---
968
1180
 
969
- const handleClick = (data) => {
970
- console.log('Clicked:', data)
971
- }
1181
+ ## SwMessage
972
1182
 
973
- const handleChange = (data) => {
974
- console.log('Changed:', data)
975
- }
976
- </script>
1183
+ Компонент `SwMessage` — модальное окно по центру (`<dialog>`). При открытии блокирует прокрутку страницы (`body.overflow = hidden`).
977
1184
 
978
- <style>
979
- .demo-menu {
980
- display: flex;
981
- flex-wrap: wrap;
982
- gap: 12px;
983
- align-items: center;
984
- padding: 12px;
985
- }
986
- </style>
987
-
988
- <sw-menu
989
- class="demo-menu"
990
- :menu-items="menuConfig"
991
- v-model="menuState"
992
- @click="handleClick"
993
- @change="handleChange"
994
- />
995
- ```
996
-
997
- #### Пример с массивом:
998
-
999
- ```html
1000
- <script setup>
1001
- import { ref } from 'vue'
1002
-
1003
- const menuItems = [
1004
- {
1005
- 'SwButton': {
1006
- label: 'Главная',
1007
- type: 'info',
1008
- link: true,
1009
- href: '/'
1010
- }
1011
- },
1012
- {
1013
- 'SwButton': {
1014
- label: 'О нас',
1015
- type: 'info',
1016
- link: true,
1017
- href: '/about'
1018
- }
1019
- },
1020
- {
1021
- 'SwInput': {
1022
- name: 'search',
1023
- placeholder: 'Поиск...',
1024
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/search.svg',
1025
- size: 'small'
1026
- }
1027
- }
1028
- ]
1029
- </script>
1030
-
1031
- <style>
1032
- .demo-menu {
1033
- display: flex;
1034
- flex-wrap: wrap;
1035
- gap: 12px;
1036
- align-items: center;
1037
- padding: 12px;
1038
- }
1039
- </style>
1040
-
1041
- <sw-menu
1042
- class="demo-menu"
1043
- :menu-items="menuItems"
1044
- />
1045
- ```
1046
-
1047
- #### Пример с вложенными компонентами:
1048
-
1049
- ```html
1050
- <script setup>
1051
- import { ref } from 'vue'
1052
-
1053
- const dropdownMenu = {
1054
- 'SwDropdown': {
1055
- trigger: 'hover',
1056
- placement: 'bottom-left',
1057
- slot: {
1058
- 'SwButton': {
1059
- label: 'Меню',
1060
- type: 'primary',
1061
- after: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-down.svg'
1062
- }
1063
- },
1064
- 'slot.dropdown': [
1065
- {
1066
- 'SwDropdownItem': {
1067
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/user.svg',
1068
- slot: 'Профиль'
1069
- }
1070
- },
1071
- {
1072
- 'SwDropdownItem': {
1073
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/settings.svg',
1074
- slot: 'Настройки'
1075
- }
1076
- }
1077
- ]
1078
- }
1079
- }
1080
- </script>
1081
-
1082
- <style>
1083
- .demo-menu {
1084
- display: flex;
1085
- flex-wrap: wrap;
1086
- gap: 12px;
1087
- align-items: center;
1088
- padding: 12px;
1089
- }
1090
- </style>
1091
-
1092
- <sw-menu class="demo-menu" :menu-items="dropdownMenu" />
1093
- ```
1094
-
1095
- #### Пример с использованием слотов:
1096
-
1097
- ```html
1098
- <script setup>
1099
- import { h } from 'vue'
1100
- import { components } from '@studio-west/component-sw'
1101
-
1102
- const complexMenu = {
1103
- 'SwSection': {
1104
- name: 'Панель управления',
1105
- after: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-down.svg',
1106
- slot: 'Основное содержимое секции',
1107
- 'slot.footer': {
1108
- 'SwButtonGroup': {
1109
- radio: true,
1110
- slot: [
1111
- {
1112
- 'SwButton': {
1113
- label: 'Опция 1',
1114
- type: 'primary'
1115
- }
1116
- },
1117
- {
1118
- 'SwButton': {
1119
- label: 'Опция 2'
1120
- }
1121
- }
1122
- ]
1123
- }
1124
- }
1125
- }
1126
- }
1127
- </script>
1128
-
1129
- <style>
1130
- .demo-menu {
1131
- display: flex;
1132
- flex-wrap: wrap;
1133
- gap: 12px;
1134
- align-items: center;
1135
- padding: 12px;
1136
- }
1137
- </style>
1138
-
1139
- <sw-menu class="demo-menu" :menu-items="complexMenu" />
1140
- ```
1141
- ---
1142
-
1143
- ## SwMessage
1144
-
1145
- Компонент `SwMessage` — модальное окно по центру (`<dialog>`). При открытии блокирует прокрутку страницы (`body.overflow = hidden`).
1146
-
1147
- `SwMessage` is a centered modal (`<dialog>`). While open it locks page scroll.
1185
+ `SwMessage` is a centered modal (`<dialog>`). While open it locks page scroll.
1148
1186
 
1149
1187
  ### Свойства / Properties
1150
1188
 
@@ -1170,21 +1208,66 @@ model - состояние компонента булевое значение,
1170
1208
  ### Пример использования / Example Usage
1171
1209
 
1172
1210
  ```html
1173
- <script>let model = false</script>
1174
-
1175
- <sw-button label="Показать сообщение" type="primary" @click="model = true" />
1211
+ <script setup>
1212
+ import { ref } from 'vue'
1213
+ const messageOpen = ref(false)
1214
+ const close = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg'
1215
+ </script>
1176
1216
 
1177
- <sw-message
1178
- v-model="model"
1179
- name="Message"
1180
- class="custom-class"
1181
- after="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg"
1182
- >
1183
- <p>Описание / Description</p>
1217
+ <sw-button type="primary" label="Открыть сообщение" @click="messageOpen = true" />
1218
+ <sw-message v-model="messageOpen" name="Сообщение" :after="close">
1219
+ Текст диалога. Клик снаружи закрывает окно.
1220
+ <template #footer>
1221
+ <sw-button type="primary" size="small" @click="messageOpen = false">OK</sw-button>
1222
+ </template>
1184
1223
  </sw-message>
1185
1224
  ```
1186
1225
  ---
1187
1226
 
1227
+ ## SwPagination
1228
+
1229
+ Постраничная навигация. `v-model` — текущая страница (с 1).
1230
+
1231
+ ### Свойства / Properties
1232
+
1233
+ | Имя | Тип | По умолчанию | Описание |
1234
+ |---------------|-----------|--------------|----------------------------------|
1235
+ | `total` | `Number` | `0` | Всего элементов. |
1236
+ | `pageSize` | `Number` | `10` | Элементов на странице (`v-model:page-size`). |
1237
+ | `pageSizes` | `Number[]` | `[10, 20, 50, 100]` | Варианты в селекте размера. |
1238
+ | `showSize` | `Boolean` | `true` | Показать выбор «N / стр.». |
1239
+ | `pagerCount` | `Number` | `7` | Число кнопок страниц (нечётное). |
1240
+ | `size` | `String` | `` | `small` / `large`. |
1241
+ | `showTotal` | `Boolean` | `false` | Текст «Всего N». |
1242
+ | `disabled` | `Boolean` | `false` | Блок неактивен. |
1243
+ | `class` | `String` | `` | CSS-класс. |
1244
+
1245
+ ### Модель / Events
1246
+
1247
+ - `v-model` / `modelValue` — номер страницы
1248
+ - `v-model:page-size` — размер страницы
1249
+ - `change` — новая страница
1250
+ - `size-change` — новый размер страницы
1251
+
1252
+ ### Пример
1253
+
1254
+ ```html
1255
+ <script setup>
1256
+ import { ref } from 'vue'
1257
+ const page = ref(1)
1258
+ const pageSize = ref(10)
1259
+ </script>
1260
+
1261
+ <sw-pagination
1262
+ v-model="page"
1263
+ v-model:page-size="pageSize"
1264
+ :total="240"
1265
+ :page-sizes="[10, 20, 50, 100]"
1266
+ show-total
1267
+ />
1268
+ ```
1269
+ ---
1270
+
1188
1271
  ## SwSection
1189
1272
 
1190
1273
  Компонент `SwSection` это тег section с шаблоном из слотов, по умолчанию в слот #header добавлено заголовок и иконка.
@@ -1213,14 +1296,14 @@ header - клик по всему Header
1213
1296
  ### Пример использования / Example Usage
1214
1297
 
1215
1298
  ```html
1216
- <sw-section
1217
- name="section"
1218
- class="custom-class"
1219
- after="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg"
1220
- >
1221
- <p>Содержимое / Content</p>
1299
+ <script setup>
1300
+ const chevron = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-down.svg'
1301
+ </script>
1302
+
1303
+ <sw-section name="Заголовок секции" :after="chevron" @header="console.log('section header')">
1304
+ <p>Контент секции. Клик по шапке эмитит header.</p>
1222
1305
  <template #footer>
1223
- <p>Footer!</p>
1306
+ <sw-button size="small" type="primary">В футере</sw-button>
1224
1307
  </template>
1225
1308
  </sw-section>
1226
1309
  ```
@@ -1228,37 +1311,37 @@ header - клик по всему Header
1228
1311
 
1229
1312
  ## SwSelect
1230
1313
 
1231
- Компонент `SwSelect` — подсказки адреса [DaData](https://dadata.ru/api/suggest/address/). Стили на `--sw-*` (без Element). Клавиатура: ↑↓, Enter, Escape; поле с `clearable`.
1232
-
1233
- ### Свойства / Properties
1314
+ Универсальный выпадающий список: `options`, single / `multiple`, `clearable`, клавиатура (↑↓ Home/End Enter Escape).
1234
1315
 
1235
- | Имя | Тип | По умолчанию | Значения/Описание |
1236
- |----------------|-----------|--------------|-----------------------------------------------|
1237
- | `class` | `String` | `` | CSS-класс корневого блока. |
1238
- | `size` | `String` | `large` | Размер поля: `'large'`, `'small'`. |
1239
- | `placeholder` | `String` | `` | Placeholder. |
1240
- | `token` | `String` | `` | API-ключ DaData (без токена запросы не идут). |
1316
+ > **Миграция:** подсказки DaData перенесены в **SwDadata** (`<sw-dadata>`).
1241
1317
 
1242
- ### Модель / Model
1318
+ ### Свойства / Properties
1243
1319
 
1244
- model - текст ввода или выбора из списка
1320
+ | Имя | Тип | По умолчанию | Описание |
1321
+ |---------------|-----------|--------------|-----------------------------------------------|
1322
+ | `class` | `String` | `` | CSS-класс. |
1323
+ | `size` | `String` | `large` | `'large'` / `'small'`. |
1324
+ | `placeholder` | `String` | `` | Placeholder. |
1325
+ | `options` | `Array` | `[]` | `{ label, value, disabled? }[]`. |
1326
+ | `multiple` | `Boolean` | `false` | Мультивыбор; модель — массив значений. |
1327
+ | `clearable` | `Boolean` | `false` | Кнопка очистки. |
1328
+ | `disabled` | `Boolean` | `false` | Неактивен. |
1245
1329
 
1246
- ### Пример использования / Example Usage
1330
+ ### Пример
1247
1331
 
1248
1332
  ```html
1249
1333
  <script setup>
1250
1334
  import { ref } from 'vue'
1251
-
1252
- const model = ref({ text: '', coords: [0, 0] })
1253
- const token = ref('') // API-ключ DADATA
1335
+ const city = ref('')
1336
+ const cities = ref([])
1337
+ const options = [
1338
+ { label: 'Москва', value: 'msk' },
1339
+ { label: 'Санкт-Петербург', value: 'spb' }
1340
+ ]
1254
1341
  </script>
1255
1342
 
1256
- <sw-select
1257
- v-model="model"
1258
- class="custom-class"
1259
- placeholder="Введите адрес"
1260
- :token="token"
1261
- />
1343
+ <sw-select v-model="city" :options="options" placeholder="Город" clearable />
1344
+ <sw-select v-model="cities" :options="options" multiple clearable placeholder="Несколько" />
1262
1345
  ```
1263
1346
  ---
1264
1347
 
@@ -1283,10 +1366,21 @@ Default - Содержимое
1283
1366
  ### Пример использования / Example Usage
1284
1367
 
1285
1368
  ```html
1286
- <sw-skeleton
1287
- :visual="visual"
1288
- >
1289
- <p>Содержимое / Content</p>
1369
+ <script setup>
1370
+ import { ref } from 'vue'
1371
+ const skeletonReady = ref(false)
1372
+ </script>
1373
+
1374
+ <sw-button size="small" @click="skeletonReady = !skeletonReady">
1375
+ {{ skeletonReady ? 'Показать скелетон' : 'Показать контент' }}
1376
+ </sw-button>
1377
+ <sw-skeleton :visual="skeletonReady">
1378
+ <p>Загруженный контент.</p>
1379
+ <template #skeleton>
1380
+ <sw-skeleton-item animate width="80" />
1381
+ <sw-skeleton-item animate size="small" width="60" />
1382
+ <sw-skeleton-item animate width="40" />
1383
+ </template>
1290
1384
  </sw-skeleton>
1291
1385
  ```
1292
1386
  ---
@@ -1319,21 +1413,22 @@ Default - Содержимое
1319
1413
 
1320
1414
  ## SwSlider
1321
1415
 
1322
- Компонент `SwSlider` — слайдер с одним или несколькими ползунками: число → 1 бегунок, массив из n чисел → n бегунков. Значения в массиве **сортируются** при перетаскивании; тултип следует за тянущимся ползунком при перескоке. Без CSS-lag на `left`/`top` во время drag.
1323
-
1324
- `SwSlider` supports one value or an array of n thumbs. Array values are **sorted** while dragging; the value tooltip follows the active thumb across swaps.
1416
+ Компонент `SwSlider` — слайдер с одним или несколькими ползунками: число в v-model → 1 бегунок, массив из n чисел → n бегунков. Значения в массиве **сортируются** при перетаскивании; тултип следует за тянущимся ползунком при перескоке. Без CSS-lag на `left`/`top` во время drag.
1325
1417
 
1326
1418
  ### Свойства / Properties
1327
1419
 
1328
1420
  | Имя | Тип | По умолчанию | Значения/Описание |
1329
1421
  |--------------|-----------|--------------|----------------------------------------------------|
1330
- | `vertical` | `Boolean` | `false` | Вертикальная ориентация. |
1422
+ | `vertical` | `Boolean` | `false` | Вертикальная ориентация (`min` снизу, `max` сверху). |
1331
1423
  | `class` | `String` | `` | Пользовательский CSS-класс. |
1332
1424
  | `size` | `String` | `` | Размер бегунка: `'large'`, `'small'`. |
1333
1425
  | `min` | `Number` | `0` | Минимум. |
1334
1426
  | `max` | `Number` | `100` | Максимум. |
1335
1427
  | `step` | `Number` | `1` | Шаг. |
1336
1428
  | `show-value` | `Boolean` | `false` | Всплывающее значение при наведении / drag. |
1429
+ | `track-color`| `Array` | `[]` | Цвета сегментов трека между thumb; пустой — `--sw-color-primary`. |
1430
+
1431
+ Сегменты: **число** — `0 → thumb`; **массив** — `thumb₀ → thumb₁`, … (без хвоста после последнего). Если цветов меньше — последний повторяется.
1337
1432
 
1338
1433
  ### Слоты / Slots
1339
1434
 
@@ -1346,25 +1441,20 @@ Default - содержимое бегунка (`index`, `value` в слот-пр
1346
1441
  ### Пример использования / Example Usage
1347
1442
 
1348
1443
  ```html
1349
- <!-- один ползунок -->
1350
- <sw-slider v-model="value" :min="0" :max="100" show-value />
1351
-
1352
- <!-- несколько ползунков -->
1353
1444
  <script setup>
1354
1445
  import { ref } from 'vue'
1355
- const multi = ref([15, 35, 60, 85])
1446
+ const sliderValue = ref(40)
1447
+ const sliderMulti = ref([15, 35, 60, 85])
1356
1448
  </script>
1449
+
1450
+ <sw-slider v-model="sliderValue" :min="0" :max="100" show-value />
1357
1451
  <sw-slider
1358
- v-model="multi"
1452
+ v-model="sliderMulti"
1359
1453
  :min="0"
1360
1454
  :max="100"
1361
- :step="1"
1362
1455
  show-value
1363
- >
1364
- <template #default="{ value }">
1365
- <!-- опционально: иконка внутри бегунка -->
1366
- </template>
1367
- </sw-slider>
1456
+ :track-color="['var(--sw-color-success)', 'var(--sw-color-warning)', 'var(--sw-color-danger)']"
1457
+ />
1368
1458
  ```
1369
1459
  ---
1370
1460
 
@@ -1395,16 +1485,14 @@ model - состояние чекбокса (checked ) булевое знач
1395
1485
  ### Пример использования / Example Usage
1396
1486
 
1397
1487
  ```html
1398
- <sw-switch
1399
- v-model="model"
1400
- name="switch"
1401
- class="custom-class"
1402
- id="switch"
1403
- on="on"
1404
- off="off"
1405
- >
1406
- <p>Описание / Description</p>
1407
- </sw-switch>
1488
+ <script setup>
1489
+ import { ref } from 'vue'
1490
+ const switchOn = ref(true)
1491
+ const switchCheck = ref(false)
1492
+ </script>
1493
+
1494
+ <sw-switch v-model="switchOn" id="sw-demo-1" name="sw-demo-1" on="Вкл" off="Выкл">С подписями</sw-switch>
1495
+ <sw-switch v-model="switchCheck" id="sw-demo-2" name="sw-demo-2" checkbox>checkbox</sw-switch>
1408
1496
  ```
1409
1497
  ---
1410
1498
 
@@ -1412,12 +1500,8 @@ model - состояние чекбокса (checked ) булевое знач
1412
1500
 
1413
1501
  Компонент `SwTable` — динамическая таблица с вложенными заголовками, объединением ячеек (`rowspan` / `colspan`), кастомизацией через слоты, подсветкой строк и столбцов при наведении, изменением ширины колонок и фиксацией крайних колонок при горизонтальном скролле.
1414
1502
 
1415
- The `SwTable` component is a dynamic table with nested headers, cell merging (`rowspan` / `colspan`), slot-based customization, row and column hover highlighting, column resizing, and sticky edge columns during horizontal scroll.
1416
-
1417
1503
  Колонки описываются дочерним компонентом `SwTableColumn`.
1418
1504
 
1419
- Columns are defined with the child `SwTableColumn` component.
1420
-
1421
1505
  ### Свойства SwTable / SwTable Properties
1422
1506
 
1423
1507
  | Имя | Тип | По умолчанию | Значения/Описание |
@@ -1444,9 +1528,7 @@ The `SwTable` component is a dynamic table with nested headers, cell merging (`r
1444
1528
  | `minWidth` | `String` \| `Number` | `48` | Минимальная ширина при ресайзе (px). |
1445
1529
  | `fixed` | `String` | — | `'left'` \| `'right'` — фиксация колонки при горизонтальном скролле. |
1446
1530
 
1447
- `SwTableColumn` без `prop` используется как групповой заголовок; внутри него задаются дочерние `SwTableColumn`.
1448
-
1449
- A `SwTableColumn` without `prop` is a group header; place child `SwTableColumn` components inside it.
1531
+ `SwTableColumn` без `prop` используется как групповой заголовок; внутри него задаются дочерние `SwTableColumn`.
1450
1532
 
1451
1533
  ### Подсветка при наведении / Hover highlight
1452
1534
 
@@ -1478,109 +1560,78 @@ The `SwTable` component is a dynamic table with nested headers, cell merging (`r
1478
1560
 
1479
1561
  ### Пример использования / Example Usage
1480
1562
 
1481
- #### Базовый пример с вложенными колонками:
1482
-
1483
- ```html
1484
- <script>
1485
- let table = [
1486
- {city:{label:'Moscow', rowspan:2},district:'Center',speed:{max:80,min:50,midl:70}},
1487
- {city:'Moscow',district:'MRCR',speed:{max:130,min:90,midl:120}},
1488
- ]
1489
- </script>
1490
-
1491
- <style>
1492
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1493
- </style>
1494
-
1495
- <sw-table :data="table">
1496
- <sw-table-column label="Label">
1497
- <sw-table-column label="City" prop="city"/>
1498
- <sw-table-column label="District" prop="district"/>
1499
- </sw-table-column>
1500
- <sw-table-column label="Speed" prop="speed.midl"/>
1501
- </sw-table>
1502
- ```
1503
-
1504
- #### Ресайз колонок:
1563
+ #### Базовая таблица с ресайзом и слотами:
1505
1564
 
1506
1565
  ```html
1507
1566
  <script setup>
1508
- const users = [
1509
- { name: 'Иван', age: 25 },
1510
- { name: 'Мария', age: 30 },
1511
- { name: 'Петр', age: 35 }
1512
- ]
1513
-
1514
- function onColumnResize({ prop, width }) {
1515
- console.log(prop, width)
1567
+ import { ref } from 'vue'
1568
+ const users = ref([
1569
+ { name: 'Иван Петров', age: 25, status: 'active' },
1570
+ { name: 'Мария Сидорова', age: 30, status: 'inactive' },
1571
+ { name: 'Петр Иванов', age: 35, status: 'active' }
1572
+ ])
1573
+ function logRow(row) {
1574
+ console.log('row:', row)
1516
1575
  }
1517
1576
  </script>
1518
1577
 
1519
- <style>
1520
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1521
- </style>
1522
-
1523
- <sw-table :data="users" @column-resize="onColumnResize">
1578
+ <sw-table :data="users" :resizable="true" @column-resize="console.log">
1524
1579
  <sw-table-column prop="name" label="Имя" width="180px" />
1525
1580
  <sw-table-column prop="age" label="Возраст" width="100px" />
1526
- <sw-table-column
1527
- prop="actions"
1528
- label="Действия"
1529
- width="150px"
1530
- :resizable="false"
1531
- />
1581
+ <sw-table-column prop="status" label="Статус" width="120px" />
1582
+ <sw-table-column prop="actions" label="Действия" width="150px" :resizable="false" />
1583
+
1584
+ <template #name="{ value }">
1585
+ <strong>{{ value }}</strong>
1586
+ </template>
1587
+ <template #status="{ value }">
1588
+ {{ value === 'active' ? 'Активен' : 'Неактивен' }}
1589
+ </template>
1590
+ <template #actions="{ row }">
1591
+ <sw-button type="info" size="small" text @click="logRow(row)">...</sw-button>
1592
+ </template>
1532
1593
  </sw-table>
1533
1594
  ```
1534
1595
 
1535
- #### Фиксированные крайние колонки:
1596
+ #### Вложенные заголовки:
1536
1597
 
1537
1598
  ```html
1538
1599
  <script setup>
1539
- const rows = [
1540
- { id: 1, name: 'Иван', email: 'ivan@example.com', note: 'Примечание 1' },
1541
- { id: 2, name: 'Мария', email: 'maria@example.com', note: 'Примечание 2' },
1542
- { id: 3, name: 'Петр', email: 'petr@example.com', note: 'Примечание 3' }
1543
- ]
1600
+ import { ref } from 'vue'
1601
+ const nestedData = ref([
1602
+ { city: 'Москва', district: 'Центр', speed: 70 },
1603
+ { city: 'Санкт-Петербург', district: 'Невский', speed: 60 }
1604
+ ])
1544
1605
  </script>
1545
1606
 
1546
- <style>
1547
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1548
- </style>
1549
-
1550
- <sw-table :data="rows" max-width="520px">
1551
- <sw-table-column prop="id" label="ID" width="70px" fixed="left" />
1552
- <sw-table-column prop="name" label="Имя" width="160px" fixed="left" />
1553
- <sw-table-column prop="email" label="Email" width="200px" />
1554
- <sw-table-column prop="note" label="Примечание" width="180px" fixed="right" />
1607
+ <sw-table :data="nestedData">
1608
+ <sw-table-column label="Адрес">
1609
+ <sw-table-column prop="city" label="Город" width="140px" />
1610
+ <sw-table-column prop="district" label="Район" width="120px" />
1611
+ </sw-table-column>
1612
+ <sw-table-column prop="speed" label="Скорость" width="100px" />
1555
1613
  </sw-table>
1556
1614
  ```
1557
1615
 
1558
- #### Пример с v-for для динамических колонок:
1616
+ #### Динамические колонки (v-for):
1559
1617
 
1560
1618
  ```html
1561
1619
  <script setup>
1562
1620
  import { ref } from 'vue'
1563
-
1564
- const columns = ref([
1565
- { prop: 'name', label: 'Имя', width: '150px' },
1566
- { prop: 'age', label: 'Возраст', width: '100px' },
1567
- { prop: 'email', label: 'Email', width: '200px' }
1621
+ const productColumns = ref([
1622
+ { prop: 'name', label: 'Название', width: '200px' },
1623
+ { prop: 'price', label: 'Цена', width: '100px' },
1624
+ { prop: 'quantity', label: 'Кол-во', width: '90px' }
1568
1625
  ])
1569
-
1570
- const tableData = ref([
1571
- { name: 'Иван', age: 25, email: 'ivan@example.com' },
1572
- { name: 'Мария', age: 30, email: 'maria@example.com' },
1573
- { name: 'Петр', age: 35, email: 'petr@example.com' }
1626
+ const products = ref([
1627
+ { name: 'Товар 1', price: 1000, quantity: 5 },
1628
+ { name: 'Товар 2', price: 2500, quantity: 3 }
1574
1629
  ])
1575
1630
  </script>
1576
1631
 
1577
- <style>
1578
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1579
- </style>
1580
-
1581
- <sw-table :data="tableData">
1582
- <sw-table-column
1583
- v-for="column in columns"
1632
+ <sw-table :data="products">
1633
+ <sw-table-column
1634
+ v-for="column in productColumns"
1584
1635
  :key="column.prop"
1585
1636
  :prop="column.prop"
1586
1637
  :label="column.label"
@@ -1589,122 +1640,51 @@ const tableData = ref([
1589
1640
  </sw-table>
1590
1641
  ```
1591
1642
 
1592
- #### Пример с кастомизацией через слоты:
1643
+ #### Фиксированные крайние колонки:
1593
1644
 
1594
1645
  ```html
1595
1646
  <script setup>
1596
1647
  import { ref } from 'vue'
1597
-
1598
- const users = ref([
1599
- { id: 1, name: 'Иван Петров', age: 25, status: 'active', email: 'ivan@example.com' },
1600
- { id: 2, name: 'Мария Сидорова', age: 30, status: 'inactive', email: 'maria@example.com' },
1601
- { id: 3, name: 'Петр Иванов', age: 35, status: 'active', email: 'petr@example.com' }
1648
+ const wideColumns = ref([
1649
+ { prop: 'dept', label: 'Отдел', width: '140px' },
1650
+ { prop: 'email', label: 'Email', width: '200px' }
1602
1651
  ])
1603
-
1604
- const deleteUser = (id) => {
1605
- console.log('Delete user:', id)
1606
- }
1607
- </script>
1608
-
1609
- <style>
1610
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1611
- </style>
1612
-
1613
- <sw-table :data="users">
1614
- <sw-table-column prop="name" label="Имя" />
1615
- <sw-table-column prop="age" label="Возраст" />
1616
- <sw-table-column prop="status" label="Статус" />
1617
- <sw-table-column prop="actions" label="Действия" width="150px" />
1618
-
1619
- <!-- Именованный слот для конкретной колонки -->
1620
- <template #name="{ row, value }">
1621
- <strong>{{ value }}</strong>
1622
- </template>
1623
-
1624
- <template #age="{ value }">
1625
- <span style="color: blue">{{ value }} лет</span>
1626
- </template>
1627
-
1628
- <template #status="{ value }">
1629
- <span :style="{ color: value === 'active' ? 'green' : 'red' }">
1630
- {{ value === 'active' ? '✓ Активен' : '✗ Неактивен' }}
1631
- </span>
1632
- </template>
1633
-
1634
- <!-- Default слот для колонки actions -->
1635
- <template #actions="{ row }">
1636
- <button @click="deleteUser(row.id)">Удалить</button>
1637
- <a :href="`mailto:${row.email}`">Написать</a>
1638
- </template>
1639
- </sw-table>
1640
- ```
1641
-
1642
- #### Пример с универсальным слотом cell:
1643
-
1644
- ```html
1645
- <script setup>
1646
- import { ref } from 'vue'
1647
-
1648
- const products = ref([
1649
- { name: 'Товар 1', price: 1000, quantity: 5 },
1650
- { name: 'Товар 2', price: 2500, quantity: 3 },
1651
- { name: 'Товар 3', price: 750, quantity: 10 }
1652
+ const wideRows = ref([
1653
+ { id: 1, name: 'Иван Петров', dept: 'Разработка', email: 'ivan@example.com', note: 'В отпуске' },
1654
+ { id: 2, name: 'Мария Сидорова', dept: 'Дизайн', email: 'maria@example.com', note: 'Удалённо' }
1652
1655
  ])
1653
1656
  </script>
1654
1657
 
1655
- <style>
1656
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1657
- </style>
1658
-
1659
- <sw-table :data="products">
1660
- <sw-table-column prop="name" label="Название" />
1661
- <sw-table-column prop="price" label="Цена" />
1662
- <sw-table-column prop="quantity" label="Количество" />
1663
-
1664
- <template #cell="{ column, value }">
1665
- <span v-if="column === 'price'" style="font-weight: bold">
1666
- {{ value }} ₽
1667
- </span>
1668
- <span v-else-if="column === 'quantity' && value < 5" style="color: red">
1669
- {{ value }} ⚠️ Мало
1670
- </span>
1671
- <span v-else>{{ value }}</span>
1672
- </template>
1658
+ <sw-table :data="wideRows" max-width="520px">
1659
+ <sw-table-column prop="id" label="ID" width="70px" fixed="left" />
1660
+ <sw-table-column prop="name" label="Имя" width="160px" fixed="left" />
1661
+ <sw-table-column
1662
+ v-for="column in wideColumns"
1663
+ :key="column.prop"
1664
+ :prop="column.prop"
1665
+ :label="column.label"
1666
+ :width="column.width"
1667
+ />
1668
+ <sw-table-column prop="note" label="Примечание" width="180px" fixed="right" />
1673
1669
  </sw-table>
1674
1670
  ```
1675
1671
 
1676
- #### Пример с объединением ячеек (rowspan/colspan):
1672
+ #### Объединение ячеек (rowspan / colspan):
1677
1673
 
1678
1674
  ```html
1679
1675
  <script setup>
1680
1676
  import { ref } from 'vue'
1681
-
1682
- const complexData = ref([
1683
- {
1684
- city: { label: 'Москва', rowspan: 2 },
1685
- district: 'Центр',
1686
- population: 500000
1687
- },
1688
- {
1689
- city: 'Москва', // будет скрыта из-за rowspan
1690
- district: 'Север',
1691
- population: 300000
1692
- },
1693
- {
1694
- city: { label: 'Общая статистика', colspan: 2 },
1695
- population: 800000
1696
- }
1677
+ const mergedData = ref([
1678
+ { city: { label: 'Москва', rowspan: 2 }, district: 'Центр', population: 500000 },
1679
+ { city: 'Москва', district: 'Север', population: 300000 },
1680
+ { city: { label: 'Итого', colspan: 2 }, population: 800000 }
1697
1681
  ])
1698
1682
  </script>
1699
1683
 
1700
- <style>
1701
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1702
- </style>
1703
-
1704
- <sw-table :data="complexData">
1705
- <sw-table-column label="Город" prop="city" />
1706
- <sw-table-column label="Район" prop="district" />
1707
- <sw-table-column label="Население" prop="population" />
1684
+ <sw-table :data="mergedData">
1685
+ <sw-table-column prop="city" label="Город" width="120px" />
1686
+ <sw-table-column prop="district" label="Район" width="120px" />
1687
+ <sw-table-column prop="population" label="Население" width="120px" />
1708
1688
  </sw-table>
1709
1689
  ```
1710
1690
  ---
@@ -1732,15 +1712,18 @@ model - индекс активной вкладки (по порядку в к
1732
1712
  ### Пример использования / Example Usage
1733
1713
 
1734
1714
  ```html
1735
- <script>let activeTabId = 0</script>
1736
-
1737
- <sw-tabs v-model="activeTabId" class="custom-class">
1738
- <sw-tabs-pane label="Профиль" title="profile">
1739
- <p>Содержимое вкладки профиля / Profile tab</p>
1740
- </sw-tabs-pane>
1741
- <sw-tabs-pane label="Настройки" title="settings">
1742
- <p>Содержимое вкладки настроек / Settings tab</p>
1743
- </sw-tabs-pane>
1715
+ <script setup>
1716
+ import { ref } from 'vue'
1717
+ const tabsIndex = ref(0)
1718
+ </script>
1719
+
1720
+ <sw-tabs v-model="tabsIndex">
1721
+ <template #header>
1722
+ <sw-button size="small" text>в шапке</sw-button>
1723
+ </template>
1724
+ <sw-tabs-pane title="one" label="Первая">Контент вкладки 1</sw-tabs-pane>
1725
+ <sw-tabs-pane title="two" label="Вторая">Контент вкладки 2</sw-tabs-pane>
1726
+ <sw-tabs-pane title="three" label="Третья">Контент вкладки 3</sw-tabs-pane>
1744
1727
  </sw-tabs>
1745
1728
  ```
1746
1729
  ---
@@ -1762,17 +1745,10 @@ Default - для вкладок
1762
1745
 
1763
1746
  ### Пример использования / Example Usage
1764
1747
 
1748
+ См. [SwTabs](#swtabs).
1749
+
1765
1750
  ```html
1766
- <script>let activeTabId = 0</script>
1767
-
1768
- <sw-tabs v-model="activeTabId" class="custom-class">
1769
- <sw-tabs-pane label="Профиль" title="profile">
1770
- <p>Содержимое вкладки профиля / Profile tab</p>
1771
- </sw-tabs-pane>
1772
- <sw-tabs-pane label="Настройки" title="settings">
1773
- <p>Содержимое вкладки настроек / Settings tab</p>
1774
- </sw-tabs-pane>
1775
- </sw-tabs>
1751
+ <sw-tabs-pane title="one" label="Первая">Контент вкладки 1</sw-tabs-pane>
1776
1752
  ```
1777
1753
  ---
1778
1754
 
@@ -1796,168 +1772,60 @@ Default - для вкладок
1796
1772
  ### Пример
1797
1773
 
1798
1774
  ```html
1799
- <sw-tag type="primary" label="Новое" />
1800
- <sw-tag type="danger" closable label="Удалить" @close="onClose" />
1801
- ```
1802
- ---
1803
-
1804
- ## SwBadge
1805
-
1806
- Индикатор поверх слота: число, текст или точка (`isDot`).
1807
-
1808
- ### Свойства / Properties
1809
-
1810
- | Имя | Тип | По умолчанию | Описание |
1811
- |-------------|-------------------|--------------|-----------------------------------|
1812
- | `value` | `Number`/`String` | `` | Значение на бейдже. |
1813
- | `max` | `Number` | `99` | При числе > max → `{max}+`. |
1814
- | `type` | `String` | `danger` | Цвет метки. |
1815
- | `isDot` | `Boolean` | `false` | Точка вместо текста. |
1816
- | `showZero` | `Boolean` | `false` | Показывать `0`. |
1817
- | `hidden` | `Boolean` | `false` | Скрыть метку. |
1818
- | `class` | `String` | `` | CSS-класс обёртки. |
1819
-
1820
- ### Пример
1821
-
1822
- ```html
1823
- <sw-badge :value="3">
1824
- <sw-button label="Сообщения" />
1825
- </sw-badge>
1826
- <sw-badge is-dot type="warning">
1827
- <sw-button label="Статус" />
1828
- </sw-badge>
1829
- ```
1830
- ---
1831
-
1832
- ## SwPagination
1833
-
1834
- Постраничная навигация. `v-model` — текущая страница (с 1).
1835
-
1836
- ### Свойства / Properties
1837
-
1838
- | Имя | Тип | По умолчанию | Описание |
1839
- |---------------|-----------|--------------|----------------------------------|
1840
- | `total` | `Number` | `0` | Всего элементов. |
1841
- | `pageSize` | `Number` | `10` | Элементов на странице (`v-model:page-size`). |
1842
- | `pageSizes` | `Number[]` | `[10, 20, 50, 100]` | Варианты в селекте размера. |
1843
- | `showSize` | `Boolean` | `true` | Показать выбор «N / стр.». |
1844
- | `pagerCount` | `Number` | `7` | Число кнопок страниц (нечётное). |
1845
- | `size` | `String` | `` | `small` / `large`. |
1846
- | `showTotal` | `Boolean` | `false` | Текст «Всего N». |
1847
- | `disabled` | `Boolean` | `false` | Блок неактивен. |
1848
- | `class` | `String` | `` | CSS-класс. |
1849
-
1850
- ### Модель / Events
1851
-
1852
- - `v-model` / `modelValue` — номер страницы
1853
- - `v-model:page-size` — размер страницы
1854
- - `change` — новая страница
1855
- - `size-change` — новый размер страницы
1856
-
1857
- ### Пример
1775
+ <script setup>
1776
+ import { ref } from 'vue'
1777
+ const tags = ref(['закрыть', 'ещё'])
1778
+ const star = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg'
1779
+ </script>
1858
1780
 
1859
- ```html
1860
- <sw-pagination
1861
- v-model="page"
1862
- v-model:page-size="pageSize"
1863
- :total="240"
1864
- :page-sizes="[10, 20, 50]"
1865
- show-total
1781
+ <sw-tag type="primary" label="primary" />
1782
+ <sw-tag type="info" :before="star" label="icon" />
1783
+ <sw-tag
1784
+ v-for="(t, i) in tags"
1785
+ :key="i"
1786
+ type="primary"
1787
+ closable
1788
+ :label="t"
1789
+ @close="tags.splice(i, 1)"
1866
1790
  />
1867
1791
  ```
1868
1792
  ---
1869
1793
 
1870
1794
  ## Изменения / Changelog
1871
1795
 
1872
- ### 0.13.18
1873
-
1874
- - Лицензия: **ISC** (вместо MIT / Apache в файле LICENSE)
1875
-
1876
- ### 0.13.17
1877
-
1878
- - **SwTag** — метки с `closable`, `type`, `size`, `before`
1879
- - **SwBadge** — индикатор поверх слота (`value` / `isDot` / `max`)
1880
- - **SwPagination** — страницы + выбор `page-size`
1881
- - **SwInput** — `textarea`, `password` (показать/скрыть), `clearable`
1882
- - **SwDropdown** — Escape / ↑↓ / Enter; hover как tooltip (см. README)
1883
- - **SwSelect** — стили `--sw-*`, клавиатура по подсказкам
1884
-
1885
- ---
1886
-
1887
- - SwTag, SwBadge, SwPagination; Input textarea/password/clearable; Dropdown keyboard; Select without Element tokens.
1888
-
1889
- ### 0.13.11
1890
-
1891
- **Alert**
1892
-
1893
- - Параметры позиции: `placement` (`top` | `bottom`), `align` (`left` | `center` | `right`).
1894
- - Стек: `top` — старые сверху; `bottom` — свежие сверху у нижнего края.
1895
- - `type: 'error'` → класс `danger`; пустой `#footer` не рендерится.
1796
+ ### 1.0.0
1896
1797
 
1897
- **SwDropdown**
1798
+ **Breaking:** переименование онбординг-компонента и CSS-классов.
1898
1799
 
1899
- - Уголок к триггеру; сторона/смещение по фактическому placement (после flip).
1900
- - Динамический `z-index` попапа: z предка + 3.
1901
- - Удалён `SwDropdownNew`.
1800
+ #### Миграция: SwGide → SwGuide
1902
1801
 
1903
- **SwFormItem**
1802
+ | Было (0.13.x) | Стало (1.0.0) |
1803
+ |---------------|---------------|
1804
+ | `SwGide` | `SwGuide` |
1805
+ | `<sw-gide>` | `<sw-guide>` |
1806
+ | `.sw-gide` | `.sw-guide` |
1807
+ | `.sw-dropdown-popup.gide` | `.sw-dropdown-popup.guide` |
1808
+ | класс `gide` на `SwDropdown` внутри гида | класс `guide` |
1904
1809
 
1905
- - Подписи к полям: `label`, `type` (цвет текста), `justify`, слоты `#label` / default / `#before` / `#after`.
1810
+ Props, слоты и поведение без изменений.
1906
1811
 
1907
- **SwGide**
1812
+ Также в 1.0.0:
1908
1813
 
1909
- - Динамический `z-index` оверлея (выше слайдеров/тултипов, ниже алертов).
1814
+ - **SwDadata** — DaData-автокомплит (миграция с прежнего SwSelect)
1815
+ - **SwSelect** — generic select: `options`, `multiple`, `clearable`
1816
+ - **SwDrawer** — боковая шторка (`left` / `right`, `modal`, анимация закрытия)
1817
+ - **SwAffix** — listing.js (studiowest): sticky/stop, boundary, offset
1818
+ - **SwBackTop** — кнопка «наверх» на базе SwButton
1819
+ - **SwSlider** — `track-color`: сегменты трека между thumb; вертикальный режим: min снизу
1910
1820
 
1911
- **SwSlider**
1821
+ ### 0.13.19
1912
1822
 
1913
- - Без лага ползунка при drag (transition только на `transform`).
1914
- - Сортировка значений массива при перетаскивании; тултип следует за активным бегунком.
1823
+ - README: примеры из `dev/App.vue`, секции по алфавиту, правки SwDatePicker / SwDropdown
1824
+ - `exports`: `./dist/component-sw.css` (вместо несуществующего `main.css`)
1915
1825
 
1916
- **SwMessage**
1917
-
1918
- - Блокировка прокрутки страницы при открытии.
1919
-
1920
- ---
1921
-
1922
- - Alert: `placement` / `align` stacking; `error` → `danger`.
1923
- - SwDropdown: caret toward trigger; dynamic popup z-index; removed `SwDropdownNew`.
1924
- - SwFormItem: form captions (`label`, `type`, `justify`).
1925
- - SwGide: dynamic overlay z-index.
1926
- - SwSlider: no drag lag; array sort while dragging; tooltip follows active thumb.
1927
- - SwMessage: lock body scroll while open.
1928
-
1929
- ---
1930
-
1931
- ### 0.13.9
1932
-
1933
- **Иконки: унификация `before` / `after`**
1934
-
1935
- - Единые пропсы иконок: `before` (слева) и `after` (справа) в `SwButton`, `SwDropdownItem`, `SwMessage`, `SwSection`, `SwGide`, `Alert`.
1936
- - Старые имена сохранены и помечены **Deprecated** (удалить в major): `prefix`/`postfix` (SwButton), `iconBefore`, `iconAfter`, `iconClose`.
1937
-
1938
- **SwDatePicker**
1939
-
1940
- - В `data.holiday`: `weekend` вместо `holidays`, `preholiday` вместо `preholidays` (старые ключи — **Deprecated**, удалить в major).
1941
-
1942
- ---
1943
-
1944
- - Unified icon props: `before` / `after` across `SwButton`, `SwDropdownItem`, `SwMessage`, `SwSection`, `SwGide`, `Alert`.
1945
- - Legacy names kept and marked **Deprecated** (remove in major): `prefix`/`postfix` (SwButton), `iconBefore`, `iconAfter`, `iconClose`.
1946
- - `SwDatePicker` `data.holiday`: `weekend` / `preholiday` (legacy `holidays` / `preholidays` deprecated).
1947
-
1948
- ---
1949
-
1950
- ### 0.13.4
1951
-
1952
- **SwFile**
1953
-
1954
- - Добавлен компонент `SwFile` — загрузчик файлов с режимами `photo` (предпросмотр и обрезка) и `document` (несколько файлов, просмотр в новой вкладке).
1955
- - Поддержка drag & drop, `v-model` (`File[]`), слоты зоны загрузки, списка файлов, удаления и действий редактора обрезки.
1956
-
1957
- ---
1826
+ ### 0.13.18
1958
1827
 
1959
- - Added `SwFile` — file uploader with `photo` (preview and crop) and `document` (multiple files, open in a new tab) modes.
1960
- - Supports drag & drop, `v-model` (`File[]`), slots for drop zone, file list, remove, and crop editor actions.
1828
+ - Лицензия: **ISC** (вместо MIT / Apache в файле LICENSE)
1961
1829
 
1962
1830
  ---
1963
1831