@studio-west/component-sw 0.13.17 → 0.13.19

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 (3) hide show
  1. package/LICENSE +12 -198
  2. package/README.md +435 -767
  3. package/package.json +8 -4
package/README.md CHANGED
@@ -45,10 +45,10 @@ Interactive playground of the latest version with live examples, demonstration o
45
45
 
46
46
  - [SwFormItem](#swformitem)
47
47
 
48
- - [SwIcon](#swicon)
49
-
50
48
  - [SwGide](#swgide)
51
49
 
50
+ - [SwIcon](#swicon)
51
+
52
52
  - [SwInput](#swinput)
53
53
 
54
54
  - [SwMenu](#swmenu)
@@ -57,10 +57,10 @@ Interactive playground of the latest version with live examples, demonstration o
57
57
 
58
58
  - [SwPagination](#swpagination)
59
59
 
60
- - [SwSelect](#swselect)
61
-
62
60
  - [SwSection](#swsection)
63
61
 
62
+ - [SwSelect](#swselect)
63
+
64
64
  - [SwSkeleton](#swskeleton)
65
65
 
66
66
  - [SwSkeletonItem](#swskeletonitem)
@@ -85,18 +85,7 @@ Interactive playground of the latest version with live examples, demonstration o
85
85
  npm install @studio-west/component-sw
86
86
  ```
87
87
 
88
- ### Разработка / Development
89
-
90
- Нужен **Node 24** через [nvm](https://github.com/nvm-sh/nvm) (см. `.nvmrc`). Системный Node 21 с Vite 8 не совместим.
91
-
92
- ```bash
93
- nvm use # или: nvm install
94
- npm run dev # scripts/with-node.sh сам переключает Node
95
- npm run build
96
- ```
97
-
98
- Не вызывайте `npx vite` напрямую на системном Node — используйте `npm run …`. /
99
- 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`.
88
+ Registry: [npmjs](https://www.npmjs.com/package/@studio-west/component-sw).
100
89
 
101
90
  ### Глобальное подключение / global add to main.js
102
91
  ```js
@@ -115,6 +104,7 @@ const {
115
104
  } = components;
116
105
 
117
106
  ```
107
+
118
108
  Установка в ручную светлой и темной темы - добавление к тегу `html` классов `dark` или `light` / Installation in a manual light and dark theme - adding to the tag `html` classes` dark` or `light`
119
109
 
120
110
  ### Пример использования / Example Usage
@@ -139,7 +129,7 @@ const darkMode = () => {
139
129
 
140
130
  ## SwAlert
141
131
 
142
- Функция `Alert()` — система всплывающих сообщений. Несколько алертов стекаются; позиция и порядок задаются параметрами `placement` / `align`.
132
+ Функция `Alert()` — система всплывающих сообщений. Несколько сообщений групируются; позиция и порядок задаются параметрами `placement` / `align`.
143
133
 
144
134
  The `Alert()` function shows toast messages. Multiple alerts stack; position and order are controlled by `placement` / `align`.
145
135
 
@@ -152,7 +142,7 @@ The `Alert()` function shows toast messages. Multiple alerts stack; position and
152
142
  | `type` | `String` | `info` | `'primary'`, `'success'`, `'info'`, `'warning'`, `'danger'` (алиас `'error'` → `danger`). |
153
143
  | `message` | `String` | `Default message` | Текст сообщения. |
154
144
  | `duration` | `Number` | `6000` | Время отображения в миллисекундах. |
155
- | `placement` | `String` | `top` | Вертикаль: `'top'` — старые сверху, новые ниже; `'bottom'` — свежие сверху стека у низа экрана. |
145
+ | `placement` | `String` | `top` | Вертикаль: `'top'` — старые сверху в верху экрана; `'bottom'` — новые сверху у низа экрана. |
156
146
  | `align` | `String` | `center` | Горизонталь: `'left'`, `'center'`, `'right'`. |
157
147
  | `before` | `String` | `` | Иконка в начале: имя из SVG-спрайта или URL. См. [SwIcon](#swicon). |
158
148
  | `after` | `String` | `` | Иконка в конце (закрыть): имя из спрайта или URL. См. [SwIcon](#swicon). |
@@ -170,34 +160,83 @@ Default - Текст описания или модуль / модули
170
160
 
171
161
  ### Пример использования / Example Usage
172
162
 
173
- ```js
174
- // .js addons
175
- import { Alert, components } from "@studio-west/component-sw"
176
- import { h } from 'vue'
177
- Alert({
178
- message: 'Message',
179
- type: 'danger',
180
- duration: 10000,
181
- placement: 'bottom',
182
- align: 'right',
183
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/bell.svg',
184
- footer: h(components.SwButton, { onClick: () => console.log('Клик по кнопке в футере') }, () => 'OK')
185
- })
163
+ ```html
164
+ <script setup>
165
+ import { Alert } from '@studio-west/component-sw'
186
166
 
187
- // Composition API / <script setup>:
188
- import { inject, h } from "vue"
189
- import { components } from "@studio-west/component-sw"
190
- const Alert = inject('Alert')
191
- Alert({
192
- message: 'Alarm!',
193
- type: 'warning',
194
- placement: 'top',
195
- align: 'center',
196
- suffix: h(components.SwIcon, { iconClass: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/info-circle.svg' })
197
- })
167
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
168
+ const icons = {
169
+ star: `${TABLER}/star.svg`,
170
+ close: `${TABLER}/x.svg`
171
+ }
172
+
173
+ let alertSeq = 0
174
+
175
+ function showAlert(type, placement = 'top', align = 'center') {
176
+ alertSeq += 1
177
+ Alert({
178
+ message: `#${alertSeq} ${type} (${placement}/${align})`,
179
+ type,
180
+ placement,
181
+ align,
182
+ duration: 8000,
183
+ before: icons.star,
184
+ after: icons.close
185
+ })
186
+ }
187
+ </script>
188
+
189
+ <sw-button type="info" label="info" @click="showAlert('info')" />
190
+ <sw-button type="success" label="success" @click="showAlert('success')" />
191
+ <sw-button type="warning" label="warning" @click="showAlert('warning')" />
192
+ <sw-button type="danger" label="error" @click="showAlert('error')" />
193
+
194
+ <!-- позиция: повторный клик — стек -->
195
+ <sw-button
196
+ v-for="pos in [
197
+ { placement: 'top', align: 'left' },
198
+ { placement: 'top', align: 'center' },
199
+ { placement: 'bottom', align: 'right' }
200
+ ]"
201
+ :key="`${pos.placement}-${pos.align}`"
202
+ type="primary"
203
+ :label="`${pos.placement}/${pos.align}`"
204
+ @click="showAlert('info', pos.placement, pos.align)"
205
+ />
206
+ ```
207
+ ---
208
+
209
+ ## SwBadge
210
+
211
+ Индикатор поверх слота: число, текст или точка (`isDot`).
212
+
213
+ ### Свойства / Properties
214
+
215
+ | Имя | Тип | По умолчанию | Описание |
216
+ |-------------|-------------------|--------------|-----------------------------------|
217
+ | `value` | `Number`/`String` | `` | Значение на бейдже. |
218
+ | `max` | `Number` | `99` | При числе > max → `{max}+`. |
219
+ | `type` | `String` | `danger` | Цвет метки. |
220
+ | `isDot` | `Boolean` | `false` | Точка вместо текста. |
221
+ | `showZero` | `Boolean` | `false` | Показывать `0`. |
222
+ | `hidden` | `Boolean` | `false` | Скрыть метку. |
223
+ | `class` | `String` | `` | CSS-класс обёртки. |
224
+
225
+ ### Пример
198
226
 
199
- // Options API:
200
- this.$Alert({ message: 'Welcome!', type: 'success', prefix: 'Дополнительная информация' })
227
+ ```html
228
+ <sw-badge :value="3">
229
+ <sw-button type="primary" label="Сообщения" />
230
+ </sw-badge>
231
+ <sw-badge :value="120" :max="99" type="warning">
232
+ <sw-button label="Уведомления" />
233
+ </sw-badge>
234
+ <sw-badge is-dot type="danger">
235
+ <sw-button type="info" label="Точка" />
236
+ </sw-badge>
237
+ <sw-badge value="new" type="success">
238
+ <sw-button label="Текст" />
239
+ </sw-badge>
201
240
  ```
202
241
  ---
203
242
 
@@ -218,10 +257,10 @@ this.$Alert({ message: 'Welcome!', type: 'success', prefix: 'Дополните
218
257
  | `href` | `String` | `` | URL, на который будет перенаправлен пользователь при клике (если `link=true`). |
219
258
  | `disabled` | `Boolean` | `false` | Блокирует кнопку, делая её неактивной. |
220
259
  | `label` | `String` | `` | Текст кнопки (альтернатива содержимому слота). |
221
- | `before` | `String` | `` | Иконка перед текстом: имя из SVG-спрайта или URL (`https://…`). См. [SwIcon](#swicon). |
260
+ | `before` | `String` | `` | Иконка перед текстом: имя из SVG-спрайта или URL. См. [SwIcon](#swicon). |
222
261
  | `after` | `String` | `` | Иконка после текста: имя из спрайта или URL. См. [SwIcon](#swicon). |
223
- | `prefix` | `String` | `` | **Deprecated** (удалить в major) — используйте `before`. |
224
- | `postfix` | `String` | `` | **Deprecated** (удалить в major) — используйте `after`. |
262
+ | `prefix` | `String` | `` | **Deprecated** (удалю в major) — используйте `before`. |
263
+ | `postfix` | `String` | `` | **Deprecated** (удалю в major) — используйте `after`. |
225
264
 
226
265
  ### Слоты / Slots
227
266
 
@@ -229,42 +268,32 @@ Default - содержимое кнопки (текст, иконки или д
229
268
 
230
269
  ### Пример использования / Example Usage
231
270
 
232
- #### Базовый пример:
233
-
234
271
  ```html
235
- <sw-button
236
- class="custom-class"
237
- size="large"
238
- type="primary"
239
- round
240
- text
241
- link
242
- href="https://example.com"
243
- >
244
- Нажми меня / Click Me
245
- </sw-button>
246
- ```
247
-
248
- #### С иконками и label:
272
+ <script setup>
273
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
274
+ const icons = {
275
+ floppy: `${TABLER}/device-floppy.svg`,
276
+ arrow: `${TABLER}/arrow-right.svg`,
277
+ star: `${TABLER}/star.svg`,
278
+ chevron: `${TABLER}/chevron-down.svg`,
279
+ search: `${TABLER}/search.svg`
280
+ }
281
+ </script>
249
282
 
250
- ```html
283
+ <sw-button type="primary" label="Primary" />
284
+ <sw-button type="success" label="Success" />
285
+ <sw-button size="small" type="primary" label="Small" />
286
+ <sw-button type="primary" round label="Round" />
287
+ <sw-button type="primary" text label="Text" />
288
+ <sw-button type="primary" link label="Link" />
289
+ <sw-button type="primary" disabled label="Disabled" />
251
290
  <sw-button
252
- label="Сохранить"
253
- before="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/device-floppy.svg"
254
- after="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/arrow-right.svg"
255
291
  type="success"
292
+ label="Сохранить"
293
+ :before="icons.floppy"
294
+ :after="icons.arrow"
256
295
  />
257
- ```
258
-
259
- #### Отключенная кнопка:
260
-
261
- ```html
262
- <sw-button
263
- disabled="true"
264
- type="primary"
265
- >
266
- Недоступно
267
- </sw-button>
296
+ <sw-button type="warning" :before="icons.search">Слот</sw-button>
268
297
  ```
269
298
  ---
270
299
 
@@ -294,16 +323,15 @@ model - индекс активной кнопки.
294
323
  ### Пример использования / Example Usage
295
324
 
296
325
  ```html
297
- <script>let active = 0 </script>
298
- <sw-button-group
299
- class="custom-class"
300
- radio
301
- v-model="active"
302
- vertical
303
- >
304
- <sw-button type="primary" size="small">Нажми меня 1 / Click Me 1</sw-button>
305
- <sw-button type="primary" >Нажми меня 2 / Click Me 2</sw-button>
306
- <sw-button type="danger">Нажми меня 3 / Click Me 3</sw-button>
326
+ <script setup>
327
+ import { ref } from 'vue'
328
+ const buttonGroupActive = ref(0)
329
+ </script>
330
+
331
+ <sw-button-group radio v-model="buttonGroupActive">
332
+ <sw-button type="primary" size="small">Один</sw-button>
333
+ <sw-button type="primary">Два</sw-button>
334
+ <sw-button type="danger">Три</sw-button>
307
335
  </sw-button-group>
308
336
  ```
309
337
  ---
@@ -325,7 +353,6 @@ Default - Контент для скрытия
325
353
  ### Особенности реализации
326
354
 
327
355
  - Плавная анимация открытия/закрытия с использованием CSS transitions
328
- - Автоматический расчет высоты контента через ResizeObserver
329
356
  - Адаптивное изменение размеров при динамическом контенте
330
357
 
331
358
  ### Пример использования / Example Usage
@@ -333,14 +360,14 @@ Default - Контент для скрытия
333
360
  ```html
334
361
  <script setup>
335
362
  import { ref } from 'vue'
336
-
337
- const open = ref(true)
363
+ const collapseOpen = ref(true)
338
364
  </script>
339
365
 
340
- <sw-button label="Показать / скрыть" type="primary" @click="open = !open" />
341
-
342
- <sw-collapse :visual="open">
343
- <p>Скрываемый контент / Collapsible content</p>
366
+ <sw-button size="small" @click="collapseOpen = !collapseOpen">
367
+ {{ collapseOpen ? 'Свернуть' : 'Развернуть' }}
368
+ </sw-button>
369
+ <sw-collapse :visual="collapseOpen">
370
+ <p>Скрываемый контент коллапса.</p>
344
371
  </sw-collapse>
345
372
  ```
346
373
  ---
@@ -359,7 +386,7 @@ const open = ref(true)
359
386
 
360
387
  ### События / Events
361
388
 
362
- input - событие выбора с данными {dateStart: "11.11.2011", dateEnd: "14-12-2011" ( при range), count: 1 }
389
+ input — событие выбора: `{ dateStart: "11.11.2011", dateEnd: "14.12.2011" /* при range */, count: 1 }` (формат `DD.MM.YYYY`)
363
390
 
364
391
  ### Слоты / Slots
365
392
 
@@ -425,11 +452,9 @@ const datePickerLimitation = ref([
425
452
 
426
453
  ## SwDropdown
427
454
 
428
- Компонент `SwDropdown` — всплывающее меню с настройкой места открытия и типа триггера. У попапа есть **уголок**, который указывает на триггер; сторона и смещение считаются по фактической позиции (с учётом flip у края экрана). `z-index` попапа = z-index ближайшего предка + 3 (`Teleport` в `body`). Клавиатура: **Escape** закрывает, **↑/↓** по пунктам, **Enter** / **Space** выбирает.
455
+ Компонент `SwDropdown` — всплывающее меню с настройкой места открытия и типа триггера. У попапа есть **уголок**, который указывает на триггер; сторона и смещение считаются по фактической позиции (с учётом flip у края экрана). `z-index` попапа динамический = z-index ближайшего предка + 3. Клавиатура: **Escape** закрывает, **↑/↓** по пунктам, **Enter** / **Space** выбирает.
429
456
 
430
- **Tooltip:** отдельный `SwTooltip` не нужен. Тот же компонент с `trigger="hover"` и текстом/разметкой в `#dropdown` работает как подсказка (без `SwDropdownItem`, если это не меню).
431
-
432
- 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.
457
+ Компонент с `trigger="hover"` и текстом/разметкой в `#dropdown` работает как подсказка **Tooltip** (без `SwDropdownItem`, если это не меню).
433
458
 
434
459
  ### Свойства / Properties
435
460
 
@@ -457,10 +482,22 @@ model - состояние меню, булевое значение откры
457
482
  Меню:
458
483
 
459
484
  ```html
460
- <sw-dropdown class="custom-class" placement="bottom" :max-width="250">
461
- <sw-button label="Меню" type="primary" />
485
+ <script setup>
486
+ import { ref } from 'vue'
487
+ const open = ref(false)
488
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
489
+ const star = `${TABLER}/star.svg`
490
+ const chevron = `${TABLER}/chevron-down.svg`
491
+ </script>
492
+
493
+ <sw-dropdown v-model="open" trigger="click" placement="bottom-left">
494
+ <sw-button size="small">
495
+ Меню <sw-icon :icon-class="chevron" />
496
+ </sw-button>
462
497
  <template #dropdown>
463
- <sw-dropdown-item>содержание / context</sw-dropdown-item>
498
+ <sw-dropdown-item :before="star">Пункт со звездой</sw-dropdown-item>
499
+ <sw-dropdown-item>Обычный пункт</sw-dropdown-item>
500
+ <sw-dropdown-item type="danger">Опасный</sw-dropdown-item>
464
501
  </template>
465
502
  </sw-dropdown>
466
503
  ```
@@ -497,13 +534,16 @@ Default - текст названия или модуль
497
534
 
498
535
  ### Пример использования / Example Usage
499
536
 
537
+ См. [SwDropdown](#swdropdown). Кратко с иконкой:
538
+
500
539
  ```html
501
- <sw-dropdown class="custom-class" :max-width="250">
502
- <sw-button label="Меню" type="primary" />
503
- <template #dropdown>
504
- <sw-dropdown-item before="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/files.svg">содержание / context</sw-dropdown-item>
505
- </template>
506
- </sw-dropdown>
540
+ <script setup>
541
+ const star = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg'
542
+ </script>
543
+
544
+ <sw-dropdown-item :before="star">Пункт со звездой</sw-dropdown-item>
545
+ <sw-dropdown-item>Обычный пункт</sw-dropdown-item>
546
+ <sw-dropdown-item type="danger">Пункт внимание</sw-dropdown-item>
507
547
  ```
508
548
  ---
509
549
 
@@ -638,8 +678,6 @@ const documentFiles = ref([])
638
678
 
639
679
  Компонент `SwFormItem` — **подписи к полям формы** (не обёртка контрола): строка с подписью слева и текстом справа (подсказка / ошибка). Выравнивание через `justify`, цвет текста через `type`.
640
680
 
641
- `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.
642
-
643
681
  ### Свойства / Properties
644
682
 
645
683
  | Имя | Тип | По умолчанию | Значения/Описание |
@@ -647,7 +685,7 @@ const documentFiles = ref([])
647
685
  | `label` | `String` | `` | Подпись слева. |
648
686
  | `type` | `String` | `` | Цвет текста: `'primary'`, `'success'`, `'info'`, `'warning'`, `'danger'` (`'error'` → `danger`). Без фонов кнопок. |
649
687
  | `justify` | `String` | `` | Выравнивание: `''` → `space-between`; `'start'`, `'end'`, `'around'`, `'center'`. |
650
- | `class` | `String` | `` | Дополнительный CSS-класс. |
688
+ | `class` | `String` | `` | Пользовательски CSS-класс корня модуля. |
651
689
 
652
690
  ### Слоты / Slots
653
691
 
@@ -660,46 +698,28 @@ Default — текст справа (подсказка / ошибка)
660
698
  ### Пример использования / Example Usage
661
699
 
662
700
  ```html
663
- <sw-form-item label="Пароль" type="danger">слишком короткий</sw-form-item>
664
- <sw-input v-model="pass" name="pass" label="Пароль" />
665
-
666
- <sw-form-item justify="start" type="info">Подсказка под полем</sw-form-item>
667
- ```
668
- ---
669
-
670
- ## SwIcon
671
-
672
- Компонент `SwIcon` отображает SVG-иконку из встроенного спрайта или по-внешнему URL.
673
-
674
- Если `iconClass` начинается с `http://`, `https://`, иконка загружается как внешний SVG через CSS `mask` (класс `sw-external-icon`). Иначе используется символ из спрайта: `#prefix-iconClass`.
675
-
676
- Компонент используется внутри SwButton, SwInput, SwAlert, SwDropdownItem, SwSection, SwMessage, SwGide (`before` / `after`) — во всех этих props можно передавать как имя из спрайта, так и полный URL. Старые имена (`prefix`/`postfix`, `iconBefore`, `iconAfter`, `iconClose`) пока работают, будут удалены в major.
677
-
678
- ### Свойства / Properties
679
-
680
- | Имя | Тип | По умолчанию | Значения/Описание |
681
- |-------------|----------|--------------|-------------------------------------------------|
682
- | `iconClass` | `String` | `required` | Имя иконки в спрайте или URL (`https://…`). |
683
- | `prefix` | `String` | `icon` | Префикс символа в спрайте: `#prefix-iconClass`. |
684
- | `className` | `String` | `` | Дополнительный CSS-класс для элемента `<svg>`. |
685
-
686
- ### Пример использования / Example Usage
687
-
688
- ```html
689
- <!-- из спрайта -->
690
- <sw-icon icon-class="star" />
701
+ <script setup>
702
+ import { ref } from 'vue'
703
+ const formPlain = ref('')
704
+ const formOk = ref('ok')
705
+ const formBad = ref('')
706
+ </script>
691
707
 
692
- <!-- внешний URL (Tabler Icons) -->
693
- <sw-icon icon-class="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg" />
708
+ <sw-form-item label="Имя">
709
+ <sw-input v-model="formPlain" name="form-plain" label="Имя" />необязательно
710
+ </sw-form-item>
711
+ <sw-form-item label="Email" type="success">
712
+ <sw-input v-model="formOk" name="form-ok" label="Email" />ок
713
+ </sw-form-item>
714
+ <sw-form-item label="Пароль" justify="center" type="danger">
715
+ <sw-input v-model="formBad" name="form-bad" label="Пароль" />слишком короткий
716
+ </sw-form-item>
694
717
  ```
695
-
696
718
  ---
697
719
 
698
720
  ## SwGide
699
721
 
700
- Компонент `SwGide` создаёт затемнение вокруг блока по селектору и показывает [SwDropdown](#swdropdown) с шагами из `steps`. `z-index` гида динамический: выше контента страницы (в т.ч. тултипов слайдера), ниже алертов (`9999`).
701
-
702
- `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`).
722
+ Компонент `SwGide` создаёт затемнение вокруг блока по селектору и показывает [SwDropdown](#swdropdown) с шагами из `steps`. `z-index` гида динамический: выше контента страницы (в т.ч. тултипов слайдера), ниже алертов.
703
723
 
704
724
  ### Свойства / Properties
705
725
 
@@ -727,27 +747,63 @@ model - массив обьектов шагов обучения
727
747
  ```html
728
748
  <script setup>
729
749
  import { ref } from 'vue'
750
+ const gideOn = ref(false)
751
+ const gideStep = ref(0)
752
+ const close = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg'
753
+ const gideSteps = [
754
+ { header: 'Dropdown', text: 'Клик открывает список пунктов.', tag: '#gide-demo', placement: 'bottom' },
755
+ { header: 'Календарь', text: 'Ниже на странице — SwDatePicker.', tag: '#sw-datepicker', placement: 'bottom' }
756
+ ]
757
+ </script>
730
758
 
731
- const settings = ref({ gide: true })
732
- const step = ref(0)
733
- const steps = ref([
734
- {header: 'заголовок',
735
- text: 'текст сообщения',
736
- tag: 'nav',
737
- placement: 'bottom',
738
- img: 'assets/teme_sw/images/sw.png'
739
- }
740
- ])
759
+ <sw-button type="primary" size="small" @click="gideStep = 0; gideOn = true">Запустить гид</sw-button>
760
+ <sw-gide
761
+ v-if="gideOn"
762
+ v-model="gideStep"
763
+ :steps="gideSteps"
764
+ :after="close"
765
+ @close="gideOn = false"
766
+ />
767
+ ```
768
+ ---
769
+
770
+ ## SwIcon
771
+
772
+ Компонент `SwIcon` отображает SVG-иконку из встроенного спрайта или по-внешнему URL.
773
+
774
+ Если `iconClass` начинается с `http://`, `https://`, иконка загружается как внешний SVG через CSS `mask` (класс `sw-external-icon`). Иначе используется символ из спрайта: `#prefix-iconClass`.
775
+
776
+ Компонент используется внутри библиотеки, и во многих компонентов в props можно передавать как имя из спрайта, так и полный URL.
777
+
778
+ ### Свойства / Properties
779
+
780
+ | Имя | Тип | По умолчанию | Значения/Описание |
781
+ |-------------|----------|--------------|-------------------------------------------------|
782
+ | `iconClass` | `String` | `required` | Имя иконки в спрайте или URL (`https://…`). |
783
+ | `prefix` | `String` | `icon` | Префикс символа в спрайте: `#prefix-iconClass`. |
784
+ | `className` | `String` | `` | Пользовательский CSS-класс для элемента `<svg>`. |
785
+
786
+ ### Пример использования / Example Usage
787
+
788
+ ```html
789
+ <script setup>
790
+ const TABLER = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline'
791
+ const icons = {
792
+ star: `${TABLER}/star.svg`,
793
+ search: `${TABLER}/search.svg`,
794
+ phone: `${TABLER}/phone.svg`,
795
+ chevron: `${TABLER}/chevron-down.svg`
796
+ }
741
797
  </script>
742
- <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">
743
- <template #header>
744
- Блок {{ steps[step].header }}
745
- <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>
746
- </template>
747
- <template #arrow><sw-icon icon-class="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-left.svg" /></template>
748
- </sw-gide>
798
+
799
+ <sw-icon :icon-class="icons.star" />
800
+ <sw-icon :icon-class="icons.search" />
801
+ <sw-icon :icon-class="icons.phone" />
802
+ <sw-icon :icon-class="icons.chevron" />
749
803
  ```
804
+
750
805
  ---
806
+
751
807
  ## SwInput
752
808
 
753
809
  Компонент `SwInput` представляет собой поле ввода с возможностью настройки внешнего вида и поведения.
@@ -797,23 +853,15 @@ clear - очистка через `clearable`
797
853
  ```html
798
854
  <script setup>
799
855
  import { ref } from 'vue'
800
-
801
- const model = ref('')
856
+ const inputSmall = ref('')
857
+ const inputPassword = ref('')
858
+ const inputTextarea = ref('')
859
+ const phone = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/phone.svg'
802
860
  </script>
803
861
 
804
- <sw-input
805
- v-model="model"
806
- name="input"
807
- class="custom-class"
808
- size="large"
809
- type="phone"
810
- before="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/phone.svg"
811
- placeholder="Your phone"
812
- label="Телефон"
813
- @prefix="console.log('before')"
814
- >
815
- <template #suffix>#</template>
816
- </sw-input>
862
+ <sw-input v-model="inputSmall" name="input-small" size="small" :before="phone" label="Small" clearable />
863
+ <sw-input v-model="inputPassword" name="input-password" type="password" label="Password" clearable />
864
+ <sw-input v-model="inputTextarea" name="input-textarea" type="textarea" label="Комментарий" :rows="4" clearable />
817
865
  ```
818
866
  ---
819
867
 
@@ -927,204 +975,18 @@ change - событие изменения значения компонента
927
975
 
928
976
  ### Пример использования / Example Usage
929
977
 
930
- #### Базовый пример с объектом:
931
-
932
978
  ```html
933
979
  <script setup>
934
980
  import { ref } from 'vue'
935
-
936
- const menuState = ref([false, false])
937
-
938
- const menuConfig = {
939
- 'SwButton': {
940
- label: 'Нажми меня',
941
- type: 'primary',
942
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg'
943
- },
944
- 'SwSwitch': [
945
- {
946
- label: 'Уведомления',
947
- on: 'Вкл',
948
- off: 'Выкл'
949
- },
950
- {
951
- label: 'Звук',
952
- checkbox: true
953
- }
954
- ]
955
- }
956
-
957
- const handleClick = (data) => {
958
- console.log('Clicked:', data)
959
- }
960
-
961
- const handleChange = (data) => {
962
- console.log('Changed:', data)
963
- }
964
- </script>
965
-
966
- <style>
967
- .demo-menu {
968
- display: flex;
969
- flex-wrap: wrap;
970
- gap: 12px;
971
- align-items: center;
972
- padding: 12px;
973
- }
974
- </style>
975
-
976
- <sw-menu
977
- class="demo-menu"
978
- :menu-items="menuConfig"
979
- v-model="menuState"
980
- @click="handleClick"
981
- @change="handleChange"
982
- />
983
- ```
984
-
985
- #### Пример с массивом:
986
-
987
- ```html
988
- <script setup>
989
- import { ref } from 'vue'
990
-
981
+ const menuModel = ref([])
991
982
  const menuItems = [
992
- {
993
- 'SwButton': {
994
- label: 'Главная',
995
- type: 'info',
996
- link: true,
997
- href: '/'
998
- }
999
- },
1000
- {
1001
- 'SwButton': {
1002
- label: 'О нас',
1003
- type: 'info',
1004
- link: true,
1005
- href: '/about'
1006
- }
1007
- },
1008
- {
1009
- 'SwInput': {
1010
- name: 'search',
1011
- placeholder: 'Поиск...',
1012
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/search.svg',
1013
- size: 'small'
1014
- }
1015
- }
983
+ { SwButton: { type: 'primary', size: 'small', slot: 'Пункт 1' } },
984
+ { SwButton: { size: 'small', slot: 'Пункт 2' } },
985
+ { SwSwitch: { id: 'menu-sw', name: 'menu-sw', on: 'On', off: 'Off' } }
1016
986
  ]
1017
987
  </script>
1018
988
 
1019
- <style>
1020
- .demo-menu {
1021
- display: flex;
1022
- flex-wrap: wrap;
1023
- gap: 12px;
1024
- align-items: center;
1025
- padding: 12px;
1026
- }
1027
- </style>
1028
-
1029
- <sw-menu
1030
- class="demo-menu"
1031
- :menu-items="menuItems"
1032
- />
1033
- ```
1034
-
1035
- #### Пример с вложенными компонентами:
1036
-
1037
- ```html
1038
- <script setup>
1039
- import { ref } from 'vue'
1040
-
1041
- const dropdownMenu = {
1042
- 'SwDropdown': {
1043
- trigger: 'hover',
1044
- placement: 'bottom-left',
1045
- slot: {
1046
- 'SwButton': {
1047
- label: 'Меню',
1048
- type: 'primary',
1049
- after: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-down.svg'
1050
- }
1051
- },
1052
- 'slot.dropdown': [
1053
- {
1054
- 'SwDropdownItem': {
1055
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/user.svg',
1056
- slot: 'Профиль'
1057
- }
1058
- },
1059
- {
1060
- 'SwDropdownItem': {
1061
- before: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/settings.svg',
1062
- slot: 'Настройки'
1063
- }
1064
- }
1065
- ]
1066
- }
1067
- }
1068
- </script>
1069
-
1070
- <style>
1071
- .demo-menu {
1072
- display: flex;
1073
- flex-wrap: wrap;
1074
- gap: 12px;
1075
- align-items: center;
1076
- padding: 12px;
1077
- }
1078
- </style>
1079
-
1080
- <sw-menu class="demo-menu" :menu-items="dropdownMenu" />
1081
- ```
1082
-
1083
- #### Пример с использованием слотов:
1084
-
1085
- ```html
1086
- <script setup>
1087
- import { h } from 'vue'
1088
- import { components } from '@studio-west/component-sw'
1089
-
1090
- const complexMenu = {
1091
- 'SwSection': {
1092
- name: 'Панель управления',
1093
- after: 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-down.svg',
1094
- slot: 'Основное содержимое секции',
1095
- 'slot.footer': {
1096
- 'SwButtonGroup': {
1097
- radio: true,
1098
- slot: [
1099
- {
1100
- 'SwButton': {
1101
- label: 'Опция 1',
1102
- type: 'primary'
1103
- }
1104
- },
1105
- {
1106
- 'SwButton': {
1107
- label: 'Опция 2'
1108
- }
1109
- }
1110
- ]
1111
- }
1112
- }
1113
- }
1114
- }
1115
- </script>
1116
-
1117
- <style>
1118
- .demo-menu {
1119
- display: flex;
1120
- flex-wrap: wrap;
1121
- gap: 12px;
1122
- align-items: center;
1123
- padding: 12px;
1124
- }
1125
- </style>
1126
-
1127
- <sw-menu class="demo-menu" :menu-items="complexMenu" />
989
+ <sw-menu v-model="menuModel" :menu-items="menuItems" @click="console.log" />
1128
990
  ```
1129
991
  ---
1130
992
 
@@ -1158,21 +1020,66 @@ model - состояние компонента булевое значение,
1158
1020
  ### Пример использования / Example Usage
1159
1021
 
1160
1022
  ```html
1161
- <script>let model = false</script>
1162
-
1163
- <sw-button label="Показать сообщение" type="primary" @click="model = true" />
1023
+ <script setup>
1024
+ import { ref } from 'vue'
1025
+ const messageOpen = ref(false)
1026
+ const close = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg'
1027
+ </script>
1164
1028
 
1165
- <sw-message
1166
- v-model="model"
1167
- name="Message"
1168
- class="custom-class"
1169
- after="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg"
1170
- >
1171
- <p>Описание / Description</p>
1029
+ <sw-button type="primary" label="Открыть сообщение" @click="messageOpen = true" />
1030
+ <sw-message v-model="messageOpen" name="Сообщение" :after="close">
1031
+ Текст диалога. Клик снаружи закрывает окно.
1032
+ <template #footer>
1033
+ <sw-button type="primary" size="small" @click="messageOpen = false">OK</sw-button>
1034
+ </template>
1172
1035
  </sw-message>
1173
1036
  ```
1174
1037
  ---
1175
1038
 
1039
+ ## SwPagination
1040
+
1041
+ Постраничная навигация. `v-model` — текущая страница (с 1).
1042
+
1043
+ ### Свойства / Properties
1044
+
1045
+ | Имя | Тип | По умолчанию | Описание |
1046
+ |---------------|-----------|--------------|----------------------------------|
1047
+ | `total` | `Number` | `0` | Всего элементов. |
1048
+ | `pageSize` | `Number` | `10` | Элементов на странице (`v-model:page-size`). |
1049
+ | `pageSizes` | `Number[]` | `[10, 20, 50, 100]` | Варианты в селекте размера. |
1050
+ | `showSize` | `Boolean` | `true` | Показать выбор «N / стр.». |
1051
+ | `pagerCount` | `Number` | `7` | Число кнопок страниц (нечётное). |
1052
+ | `size` | `String` | `` | `small` / `large`. |
1053
+ | `showTotal` | `Boolean` | `false` | Текст «Всего N». |
1054
+ | `disabled` | `Boolean` | `false` | Блок неактивен. |
1055
+ | `class` | `String` | `` | CSS-класс. |
1056
+
1057
+ ### Модель / Events
1058
+
1059
+ - `v-model` / `modelValue` — номер страницы
1060
+ - `v-model:page-size` — размер страницы
1061
+ - `change` — новая страница
1062
+ - `size-change` — новый размер страницы
1063
+
1064
+ ### Пример
1065
+
1066
+ ```html
1067
+ <script setup>
1068
+ import { ref } from 'vue'
1069
+ const page = ref(1)
1070
+ const pageSize = ref(10)
1071
+ </script>
1072
+
1073
+ <sw-pagination
1074
+ v-model="page"
1075
+ v-model:page-size="pageSize"
1076
+ :total="240"
1077
+ :page-sizes="[10, 20, 50, 100]"
1078
+ show-total
1079
+ />
1080
+ ```
1081
+ ---
1082
+
1176
1083
  ## SwSection
1177
1084
 
1178
1085
  Компонент `SwSection` это тег section с шаблоном из слотов, по умолчанию в слот #header добавлено заголовок и иконка.
@@ -1201,14 +1108,14 @@ header - клик по всему Header
1201
1108
  ### Пример использования / Example Usage
1202
1109
 
1203
1110
  ```html
1204
- <sw-section
1205
- name="section"
1206
- class="custom-class"
1207
- after="https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/x.svg"
1208
- >
1209
- <p>Содержимое / Content</p>
1111
+ <script setup>
1112
+ const chevron = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/chevron-down.svg'
1113
+ </script>
1114
+
1115
+ <sw-section name="Заголовок секции" :after="chevron" @header="console.log('section header')">
1116
+ <p>Контент секции. Клик по шапке эмитит header.</p>
1210
1117
  <template #footer>
1211
- <p>Footer!</p>
1118
+ <sw-button size="small" type="primary">В футере</sw-button>
1212
1119
  </template>
1213
1120
  </sw-section>
1214
1121
  ```
@@ -1236,17 +1143,10 @@ model - текст ввода или выбора из списка
1236
1143
  ```html
1237
1144
  <script setup>
1238
1145
  import { ref } from 'vue'
1239
-
1240
- const model = ref({ text: '', coords: [0, 0] })
1241
- const token = ref('') // API-ключ DADATA
1146
+ const selectGeo = ref({ text: '', coords: [0, 0], suggestion: null })
1242
1147
  </script>
1243
1148
 
1244
- <sw-select
1245
- v-model="model"
1246
- class="custom-class"
1247
- placeholder="Введите адрес"
1248
- :token="token"
1249
- />
1149
+ <sw-select v-model="selectGeo" placeholder="Город, улица, дом" size="small" />
1250
1150
  ```
1251
1151
  ---
1252
1152
 
@@ -1271,10 +1171,21 @@ Default - Содержимое
1271
1171
  ### Пример использования / Example Usage
1272
1172
 
1273
1173
  ```html
1274
- <sw-skeleton
1275
- :visual="visual"
1276
- >
1277
- <p>Содержимое / Content</p>
1174
+ <script setup>
1175
+ import { ref } from 'vue'
1176
+ const skeletonReady = ref(false)
1177
+ </script>
1178
+
1179
+ <sw-button size="small" @click="skeletonReady = !skeletonReady">
1180
+ {{ skeletonReady ? 'Показать скелетон' : 'Показать контент' }}
1181
+ </sw-button>
1182
+ <sw-skeleton :visual="skeletonReady">
1183
+ <p>Загруженный контент.</p>
1184
+ <template #skeleton>
1185
+ <sw-skeleton-item animate width="80" />
1186
+ <sw-skeleton-item animate size="small" width="60" />
1187
+ <sw-skeleton-item animate width="40" />
1188
+ </template>
1278
1189
  </sw-skeleton>
1279
1190
  ```
1280
1191
  ---
@@ -1307,9 +1218,7 @@ Default - Содержимое
1307
1218
 
1308
1219
  ## SwSlider
1309
1220
 
1310
- Компонент `SwSlider` — слайдер с одним или несколькими ползунками: число → 1 бегунок, массив из n чисел → n бегунков. Значения в массиве **сортируются** при перетаскивании; тултип следует за тянущимся ползунком при перескоке. Без CSS-lag на `left`/`top` во время drag.
1311
-
1312
- `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.
1221
+ Компонент `SwSlider` — слайдер с одним или несколькими ползунками: число в v-model → 1 бегунок, массив из n чисел → n бегунков. Значения в массиве **сортируются** при перетаскивании; тултип следует за тянущимся ползунком при перескоке. Без CSS-lag на `left`/`top` во время drag.
1313
1222
 
1314
1223
  ### Свойства / Properties
1315
1224
 
@@ -1334,25 +1243,14 @@ Default - содержимое бегунка (`index`, `value` в слот-пр
1334
1243
  ### Пример использования / Example Usage
1335
1244
 
1336
1245
  ```html
1337
- <!-- один ползунок -->
1338
- <sw-slider v-model="value" :min="0" :max="100" show-value />
1339
-
1340
- <!-- несколько ползунков -->
1341
1246
  <script setup>
1342
1247
  import { ref } from 'vue'
1343
- const multi = ref([15, 35, 60, 85])
1248
+ const sliderValue = ref(40)
1249
+ const sliderMulti = ref([15, 35, 60, 85])
1344
1250
  </script>
1345
- <sw-slider
1346
- v-model="multi"
1347
- :min="0"
1348
- :max="100"
1349
- :step="1"
1350
- show-value
1351
- >
1352
- <template #default="{ value }">
1353
- <!-- опционально: иконка внутри бегунка -->
1354
- </template>
1355
- </sw-slider>
1251
+
1252
+ <sw-slider v-model="sliderValue" :min="0" :max="100" show-value />
1253
+ <sw-slider v-model="sliderMulti" :min="0" :max="100" show-value />
1356
1254
  ```
1357
1255
  ---
1358
1256
 
@@ -1383,16 +1281,14 @@ model - состояние чекбокса (checked ) булевое знач
1383
1281
  ### Пример использования / Example Usage
1384
1282
 
1385
1283
  ```html
1386
- <sw-switch
1387
- v-model="model"
1388
- name="switch"
1389
- class="custom-class"
1390
- id="switch"
1391
- on="on"
1392
- off="off"
1393
- >
1394
- <p>Описание / Description</p>
1395
- </sw-switch>
1284
+ <script setup>
1285
+ import { ref } from 'vue'
1286
+ const switchOn = ref(true)
1287
+ const switchCheck = ref(false)
1288
+ </script>
1289
+
1290
+ <sw-switch v-model="switchOn" id="sw-demo-1" name="sw-demo-1" on="Вкл" off="Выкл">С подписями</sw-switch>
1291
+ <sw-switch v-model="switchCheck" id="sw-demo-2" name="sw-demo-2" checkbox>checkbox</sw-switch>
1396
1292
  ```
1397
1293
  ---
1398
1294
 
@@ -1400,12 +1296,8 @@ model - состояние чекбокса (checked ) булевое знач
1400
1296
 
1401
1297
  Компонент `SwTable` — динамическая таблица с вложенными заголовками, объединением ячеек (`rowspan` / `colspan`), кастомизацией через слоты, подсветкой строк и столбцов при наведении, изменением ширины колонок и фиксацией крайних колонок при горизонтальном скролле.
1402
1298
 
1403
- 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.
1404
-
1405
1299
  Колонки описываются дочерним компонентом `SwTableColumn`.
1406
1300
 
1407
- Columns are defined with the child `SwTableColumn` component.
1408
-
1409
1301
  ### Свойства SwTable / SwTable Properties
1410
1302
 
1411
1303
  | Имя | Тип | По умолчанию | Значения/Описание |
@@ -1432,9 +1324,7 @@ The `SwTable` component is a dynamic table with nested headers, cell merging (`r
1432
1324
  | `minWidth` | `String` \| `Number` | `48` | Минимальная ширина при ресайзе (px). |
1433
1325
  | `fixed` | `String` | — | `'left'` \| `'right'` — фиксация колонки при горизонтальном скролле. |
1434
1326
 
1435
- `SwTableColumn` без `prop` используется как групповой заголовок; внутри него задаются дочерние `SwTableColumn`.
1436
-
1437
- A `SwTableColumn` without `prop` is a group header; place child `SwTableColumn` components inside it.
1327
+ `SwTableColumn` без `prop` используется как групповой заголовок; внутри него задаются дочерние `SwTableColumn`.
1438
1328
 
1439
1329
  ### Подсветка при наведении / Hover highlight
1440
1330
 
@@ -1466,109 +1356,78 @@ The `SwTable` component is a dynamic table with nested headers, cell merging (`r
1466
1356
 
1467
1357
  ### Пример использования / Example Usage
1468
1358
 
1469
- #### Базовый пример с вложенными колонками:
1470
-
1471
- ```html
1472
- <script>
1473
- let table = [
1474
- {city:{label:'Moscow', rowspan:2},district:'Center',speed:{max:80,min:50,midl:70}},
1475
- {city:'Moscow',district:'MRCR',speed:{max:130,min:90,midl:120}},
1476
- ]
1477
- </script>
1478
-
1479
- <style>
1480
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1481
- </style>
1482
-
1483
- <sw-table :data="table">
1484
- <sw-table-column label="Label">
1485
- <sw-table-column label="City" prop="city"/>
1486
- <sw-table-column label="District" prop="district"/>
1487
- </sw-table-column>
1488
- <sw-table-column label="Speed" prop="speed.midl"/>
1489
- </sw-table>
1490
- ```
1491
-
1492
- #### Ресайз колонок:
1359
+ #### Базовая таблица с ресайзом и слотами:
1493
1360
 
1494
1361
  ```html
1495
1362
  <script setup>
1496
- const users = [
1497
- { name: 'Иван', age: 25 },
1498
- { name: 'Мария', age: 30 },
1499
- { name: 'Петр', age: 35 }
1500
- ]
1501
-
1502
- function onColumnResize({ prop, width }) {
1503
- console.log(prop, width)
1363
+ import { ref } from 'vue'
1364
+ const users = ref([
1365
+ { name: 'Иван Петров', age: 25, status: 'active' },
1366
+ { name: 'Мария Сидорова', age: 30, status: 'inactive' },
1367
+ { name: 'Петр Иванов', age: 35, status: 'active' }
1368
+ ])
1369
+ function logRow(row) {
1370
+ console.log('row:', row)
1504
1371
  }
1505
1372
  </script>
1506
1373
 
1507
- <style>
1508
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1509
- </style>
1510
-
1511
- <sw-table :data="users" @column-resize="onColumnResize">
1374
+ <sw-table :data="users" :resizable="true" @column-resize="console.log">
1512
1375
  <sw-table-column prop="name" label="Имя" width="180px" />
1513
1376
  <sw-table-column prop="age" label="Возраст" width="100px" />
1514
- <sw-table-column
1515
- prop="actions"
1516
- label="Действия"
1517
- width="150px"
1518
- :resizable="false"
1519
- />
1377
+ <sw-table-column prop="status" label="Статус" width="120px" />
1378
+ <sw-table-column prop="actions" label="Действия" width="150px" :resizable="false" />
1379
+
1380
+ <template #name="{ value }">
1381
+ <strong>{{ value }}</strong>
1382
+ </template>
1383
+ <template #status="{ value }">
1384
+ {{ value === 'active' ? 'Активен' : 'Неактивен' }}
1385
+ </template>
1386
+ <template #actions="{ row }">
1387
+ <sw-button type="info" size="small" text @click="logRow(row)">...</sw-button>
1388
+ </template>
1520
1389
  </sw-table>
1521
1390
  ```
1522
1391
 
1523
- #### Фиксированные крайние колонки:
1392
+ #### Вложенные заголовки:
1524
1393
 
1525
1394
  ```html
1526
1395
  <script setup>
1527
- const rows = [
1528
- { id: 1, name: 'Иван', email: 'ivan@example.com', note: 'Примечание 1' },
1529
- { id: 2, name: 'Мария', email: 'maria@example.com', note: 'Примечание 2' },
1530
- { id: 3, name: 'Петр', email: 'petr@example.com', note: 'Примечание 3' }
1531
- ]
1396
+ import { ref } from 'vue'
1397
+ const nestedData = ref([
1398
+ { city: 'Москва', district: 'Центр', speed: 70 },
1399
+ { city: 'Санкт-Петербург', district: 'Невский', speed: 60 }
1400
+ ])
1532
1401
  </script>
1533
1402
 
1534
- <style>
1535
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1536
- </style>
1537
-
1538
- <sw-table :data="rows" max-width="520px">
1539
- <sw-table-column prop="id" label="ID" width="70px" fixed="left" />
1540
- <sw-table-column prop="name" label="Имя" width="160px" fixed="left" />
1541
- <sw-table-column prop="email" label="Email" width="200px" />
1542
- <sw-table-column prop="note" label="Примечание" width="180px" fixed="right" />
1403
+ <sw-table :data="nestedData">
1404
+ <sw-table-column label="Адрес">
1405
+ <sw-table-column prop="city" label="Город" width="140px" />
1406
+ <sw-table-column prop="district" label="Район" width="120px" />
1407
+ </sw-table-column>
1408
+ <sw-table-column prop="speed" label="Скорость" width="100px" />
1543
1409
  </sw-table>
1544
1410
  ```
1545
1411
 
1546
- #### Пример с v-for для динамических колонок:
1412
+ #### Динамические колонки (v-for):
1547
1413
 
1548
1414
  ```html
1549
1415
  <script setup>
1550
1416
  import { ref } from 'vue'
1551
-
1552
- const columns = ref([
1553
- { prop: 'name', label: 'Имя', width: '150px' },
1554
- { prop: 'age', label: 'Возраст', width: '100px' },
1555
- { prop: 'email', label: 'Email', width: '200px' }
1417
+ const productColumns = ref([
1418
+ { prop: 'name', label: 'Название', width: '200px' },
1419
+ { prop: 'price', label: 'Цена', width: '100px' },
1420
+ { prop: 'quantity', label: 'Кол-во', width: '90px' }
1556
1421
  ])
1557
-
1558
- const tableData = ref([
1559
- { name: 'Иван', age: 25, email: 'ivan@example.com' },
1560
- { name: 'Мария', age: 30, email: 'maria@example.com' },
1561
- { name: 'Петр', age: 35, email: 'petr@example.com' }
1422
+ const products = ref([
1423
+ { name: 'Товар 1', price: 1000, quantity: 5 },
1424
+ { name: 'Товар 2', price: 2500, quantity: 3 }
1562
1425
  ])
1563
1426
  </script>
1564
1427
 
1565
- <style>
1566
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1567
- </style>
1568
-
1569
- <sw-table :data="tableData">
1570
- <sw-table-column
1571
- v-for="column in columns"
1428
+ <sw-table :data="products">
1429
+ <sw-table-column
1430
+ v-for="column in productColumns"
1572
1431
  :key="column.prop"
1573
1432
  :prop="column.prop"
1574
1433
  :label="column.label"
@@ -1577,122 +1436,51 @@ const tableData = ref([
1577
1436
  </sw-table>
1578
1437
  ```
1579
1438
 
1580
- #### Пример с кастомизацией через слоты:
1439
+ #### Фиксированные крайние колонки:
1581
1440
 
1582
1441
  ```html
1583
1442
  <script setup>
1584
1443
  import { ref } from 'vue'
1585
-
1586
- const users = ref([
1587
- { id: 1, name: 'Иван Петров', age: 25, status: 'active', email: 'ivan@example.com' },
1588
- { id: 2, name: 'Мария Сидорова', age: 30, status: 'inactive', email: 'maria@example.com' },
1589
- { id: 3, name: 'Петр Иванов', age: 35, status: 'active', email: 'petr@example.com' }
1444
+ const wideColumns = ref([
1445
+ { prop: 'dept', label: 'Отдел', width: '140px' },
1446
+ { prop: 'email', label: 'Email', width: '200px' }
1590
1447
  ])
1591
-
1592
- const deleteUser = (id) => {
1593
- console.log('Delete user:', id)
1594
- }
1595
- </script>
1596
-
1597
- <style>
1598
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1599
- </style>
1600
-
1601
- <sw-table :data="users">
1602
- <sw-table-column prop="name" label="Имя" />
1603
- <sw-table-column prop="age" label="Возраст" />
1604
- <sw-table-column prop="status" label="Статус" />
1605
- <sw-table-column prop="actions" label="Действия" width="150px" />
1606
-
1607
- <!-- Именованный слот для конкретной колонки -->
1608
- <template #name="{ row, value }">
1609
- <strong>{{ value }}</strong>
1610
- </template>
1611
-
1612
- <template #age="{ value }">
1613
- <span style="color: blue">{{ value }} лет</span>
1614
- </template>
1615
-
1616
- <template #status="{ value }">
1617
- <span :style="{ color: value === 'active' ? 'green' : 'red' }">
1618
- {{ value === 'active' ? '✓ Активен' : '✗ Неактивен' }}
1619
- </span>
1620
- </template>
1621
-
1622
- <!-- Default слот для колонки actions -->
1623
- <template #actions="{ row }">
1624
- <button @click="deleteUser(row.id)">Удалить</button>
1625
- <a :href="`mailto:${row.email}`">Написать</a>
1626
- </template>
1627
- </sw-table>
1628
- ```
1629
-
1630
- #### Пример с универсальным слотом cell:
1631
-
1632
- ```html
1633
- <script setup>
1634
- import { ref } from 'vue'
1635
-
1636
- const products = ref([
1637
- { name: 'Товар 1', price: 1000, quantity: 5 },
1638
- { name: 'Товар 2', price: 2500, quantity: 3 },
1639
- { name: 'Товар 3', price: 750, quantity: 10 }
1448
+ const wideRows = ref([
1449
+ { id: 1, name: 'Иван Петров', dept: 'Разработка', email: 'ivan@example.com', note: 'В отпуске' },
1450
+ { id: 2, name: 'Мария Сидорова', dept: 'Дизайн', email: 'maria@example.com', note: 'Удалённо' }
1640
1451
  ])
1641
1452
  </script>
1642
1453
 
1643
- <style>
1644
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1645
- </style>
1646
-
1647
- <sw-table :data="products">
1648
- <sw-table-column prop="name" label="Название" />
1649
- <sw-table-column prop="price" label="Цена" />
1650
- <sw-table-column prop="quantity" label="Количество" />
1651
-
1652
- <template #cell="{ column, value }">
1653
- <span v-if="column === 'price'" style="font-weight: bold">
1654
- {{ value }} ₽
1655
- </span>
1656
- <span v-else-if="column === 'quantity' && value < 5" style="color: red">
1657
- {{ value }} ⚠️ Мало
1658
- </span>
1659
- <span v-else>{{ value }}</span>
1660
- </template>
1454
+ <sw-table :data="wideRows" max-width="520px">
1455
+ <sw-table-column prop="id" label="ID" width="70px" fixed="left" />
1456
+ <sw-table-column prop="name" label="Имя" width="160px" fixed="left" />
1457
+ <sw-table-column
1458
+ v-for="column in wideColumns"
1459
+ :key="column.prop"
1460
+ :prop="column.prop"
1461
+ :label="column.label"
1462
+ :width="column.width"
1463
+ />
1464
+ <sw-table-column prop="note" label="Примечание" width="180px" fixed="right" />
1661
1465
  </sw-table>
1662
1466
  ```
1663
1467
 
1664
- #### Пример с объединением ячеек (rowspan/colspan):
1468
+ #### Объединение ячеек (rowspan / colspan):
1665
1469
 
1666
1470
  ```html
1667
1471
  <script setup>
1668
1472
  import { ref } from 'vue'
1669
-
1670
- const complexData = ref([
1671
- {
1672
- city: { label: 'Москва', rowspan: 2 },
1673
- district: 'Центр',
1674
- population: 500000
1675
- },
1676
- {
1677
- city: 'Москва', // будет скрыта из-за rowspan
1678
- district: 'Север',
1679
- population: 300000
1680
- },
1681
- {
1682
- city: { label: 'Общая статистика', colspan: 2 },
1683
- population: 800000
1684
- }
1473
+ const mergedData = ref([
1474
+ { city: { label: 'Москва', rowspan: 2 }, district: 'Центр', population: 500000 },
1475
+ { city: 'Москва', district: 'Север', population: 300000 },
1476
+ { city: { label: 'Итого', colspan: 2 }, population: 800000 }
1685
1477
  ])
1686
1478
  </script>
1687
1479
 
1688
- <style>
1689
- .sw-table th, .sw-table td { border: 1px solid #d6d6d6; padding: 6px 10px; }
1690
- </style>
1691
-
1692
- <sw-table :data="complexData">
1693
- <sw-table-column label="Город" prop="city" />
1694
- <sw-table-column label="Район" prop="district" />
1695
- <sw-table-column label="Население" prop="population" />
1480
+ <sw-table :data="mergedData">
1481
+ <sw-table-column prop="city" label="Город" width="120px" />
1482
+ <sw-table-column prop="district" label="Район" width="120px" />
1483
+ <sw-table-column prop="population" label="Население" width="120px" />
1696
1484
  </sw-table>
1697
1485
  ```
1698
1486
  ---
@@ -1720,15 +1508,18 @@ model - индекс активной вкладки (по порядку в к
1720
1508
  ### Пример использования / Example Usage
1721
1509
 
1722
1510
  ```html
1723
- <script>let activeTabId = 0</script>
1724
-
1725
- <sw-tabs v-model="activeTabId" class="custom-class">
1726
- <sw-tabs-pane label="Профиль" title="profile">
1727
- <p>Содержимое вкладки профиля / Profile tab</p>
1728
- </sw-tabs-pane>
1729
- <sw-tabs-pane label="Настройки" title="settings">
1730
- <p>Содержимое вкладки настроек / Settings tab</p>
1731
- </sw-tabs-pane>
1511
+ <script setup>
1512
+ import { ref } from 'vue'
1513
+ const tabsIndex = ref(0)
1514
+ </script>
1515
+
1516
+ <sw-tabs v-model="tabsIndex">
1517
+ <template #header>
1518
+ <sw-button size="small" text>в шапке</sw-button>
1519
+ </template>
1520
+ <sw-tabs-pane title="one" label="Первая">Контент вкладки 1</sw-tabs-pane>
1521
+ <sw-tabs-pane title="two" label="Вторая">Контент вкладки 2</sw-tabs-pane>
1522
+ <sw-tabs-pane title="three" label="Третья">Контент вкладки 3</sw-tabs-pane>
1732
1523
  </sw-tabs>
1733
1524
  ```
1734
1525
  ---
@@ -1750,17 +1541,10 @@ Default - для вкладок
1750
1541
 
1751
1542
  ### Пример использования / Example Usage
1752
1543
 
1544
+ См. [SwTabs](#swtabs).
1545
+
1753
1546
  ```html
1754
- <script>let activeTabId = 0</script>
1755
-
1756
- <sw-tabs v-model="activeTabId" class="custom-class">
1757
- <sw-tabs-pane label="Профиль" title="profile">
1758
- <p>Содержимое вкладки профиля / Profile tab</p>
1759
- </sw-tabs-pane>
1760
- <sw-tabs-pane label="Настройки" title="settings">
1761
- <p>Содержимое вкладки настроек / Settings tab</p>
1762
- </sw-tabs-pane>
1763
- </sw-tabs>
1547
+ <sw-tabs-pane title="one" label="Первая">Контент вкладки 1</sw-tabs-pane>
1764
1548
  ```
1765
1549
  ---
1766
1550
 
@@ -1784,78 +1568,35 @@ Default - для вкладок
1784
1568
  ### Пример
1785
1569
 
1786
1570
  ```html
1787
- <sw-tag type="primary" label="Новое" />
1788
- <sw-tag type="danger" closable label="Удалить" @close="onClose" />
1789
- ```
1790
- ---
1791
-
1792
- ## SwBadge
1793
-
1794
- Индикатор поверх слота: число, текст или точка (`isDot`).
1795
-
1796
- ### Свойства / Properties
1797
-
1798
- | Имя | Тип | По умолчанию | Описание |
1799
- |-------------|-------------------|--------------|-----------------------------------|
1800
- | `value` | `Number`/`String` | `` | Значение на бейдже. |
1801
- | `max` | `Number` | `99` | При числе > max → `{max}+`. |
1802
- | `type` | `String` | `danger` | Цвет метки. |
1803
- | `isDot` | `Boolean` | `false` | Точка вместо текста. |
1804
- | `showZero` | `Boolean` | `false` | Показывать `0`. |
1805
- | `hidden` | `Boolean` | `false` | Скрыть метку. |
1806
- | `class` | `String` | `` | CSS-класс обёртки. |
1807
-
1808
- ### Пример
1571
+ <script setup>
1572
+ import { ref } from 'vue'
1573
+ const tags = ref(['закрыть', 'ещё'])
1574
+ const star = 'https://cdn.jsdelivr.net/npm/@tabler/icons@3.19.0/icons/outline/star.svg'
1575
+ </script>
1809
1576
 
1810
- ```html
1811
- <sw-badge :value="3">
1812
- <sw-button label="Сообщения" />
1813
- </sw-badge>
1814
- <sw-badge is-dot type="warning">
1815
- <sw-button label="Статус" />
1816
- </sw-badge>
1577
+ <sw-tag type="primary" label="primary" />
1578
+ <sw-tag type="info" :before="star" label="icon" />
1579
+ <sw-tag
1580
+ v-for="(t, i) in tags"
1581
+ :key="i"
1582
+ type="primary"
1583
+ closable
1584
+ :label="t"
1585
+ @close="tags.splice(i, 1)"
1586
+ />
1817
1587
  ```
1818
1588
  ---
1819
1589
 
1820
- ## SwPagination
1821
-
1822
- Постраничная навигация. `v-model` — текущая страница (с 1).
1823
-
1824
- ### Свойства / Properties
1825
-
1826
- | Имя | Тип | По умолчанию | Описание |
1827
- |---------------|-----------|--------------|----------------------------------|
1828
- | `total` | `Number` | `0` | Всего элементов. |
1829
- | `pageSize` | `Number` | `10` | Элементов на странице (`v-model:page-size`). |
1830
- | `pageSizes` | `Number[]` | `[10, 20, 50, 100]` | Варианты в селекте размера. |
1831
- | `showSize` | `Boolean` | `true` | Показать выбор «N / стр.». |
1832
- | `pagerCount` | `Number` | `7` | Число кнопок страниц (нечётное). |
1833
- | `size` | `String` | `` | `small` / `large`. |
1834
- | `showTotal` | `Boolean` | `false` | Текст «Всего N». |
1835
- | `disabled` | `Boolean` | `false` | Блок неактивен. |
1836
- | `class` | `String` | `` | CSS-класс. |
1837
-
1838
- ### Модель / Events
1590
+ ## Изменения / Changelog
1839
1591
 
1840
- - `v-model` / `modelValue` — номер страницы
1841
- - `v-model:page-size` — размер страницы
1842
- - `change` — новая страница
1843
- - `size-change` — новый размер страницы
1592
+ ### 0.13.19
1844
1593
 
1845
- ### Пример
1594
+ - README: примеры из `dev/App.vue`, секции по алфавиту, правки SwDatePicker / SwDropdown
1595
+ - `exports`: `./dist/component-sw.css` (вместо несуществующего `main.css`)
1846
1596
 
1847
- ```html
1848
- <sw-pagination
1849
- v-model="page"
1850
- v-model:page-size="pageSize"
1851
- :total="240"
1852
- :page-sizes="[10, 20, 50]"
1853
- show-total
1854
- />
1855
- ```
1856
- ---
1597
+ ### 0.13.18
1857
1598
 
1858
- ## Изменения / Changelog
1599
+ - Лицензия: **ISC** (вместо MIT / Apache в файле LICENSE)
1859
1600
 
1860
1601
  ### 0.13.17
1861
1602
 
@@ -1866,85 +1607,12 @@ Default - для вкладок
1866
1607
  - **SwDropdown** — Escape / ↑↓ / Enter; hover как tooltip (см. README)
1867
1608
  - **SwSelect** — стили `--sw-*`, клавиатура по подсказкам
1868
1609
 
1869
- ### 0.13.11
1870
-
1871
- **Alert**
1872
-
1873
- - Параметры позиции: `placement` (`top` | `bottom`), `align` (`left` | `center` | `right`).
1874
- - Стек: `top` — старые сверху; `bottom` — свежие сверху у нижнего края.
1875
- - `type: 'error'` → класс `danger`; пустой `#footer` не рендерится.
1876
-
1877
- **SwDropdown**
1878
-
1879
- - Уголок к триггеру; сторона/смещение по фактическому placement (после flip).
1880
- - Динамический `z-index` попапа: z предка + 3.
1881
- - Удалён `SwDropdownNew`.
1882
-
1883
- **SwFormItem**
1884
-
1885
- - Подписи к полям: `label`, `type` (цвет текста), `justify`, слоты `#label` / default / `#before` / `#after`.
1886
-
1887
- **SwGide**
1888
-
1889
- - Динамический `z-index` оверлея (выше слайдеров/тултипов, ниже алертов).
1890
-
1891
- **SwSlider**
1892
-
1893
- - Без лага ползунка при drag (transition только на `transform`).
1894
- - Сортировка значений массива при перетаскивании; тултип следует за активным бегунком.
1895
-
1896
- **SwMessage**
1897
-
1898
- - Блокировка прокрутки страницы при открытии.
1899
-
1900
- ---
1901
-
1902
- - Alert: `placement` / `align` stacking; `error` → `danger`.
1903
- - SwDropdown: caret toward trigger; dynamic popup z-index; removed `SwDropdownNew`.
1904
- - SwFormItem: form captions (`label`, `type`, `justify`).
1905
- - SwGide: dynamic overlay z-index.
1906
- - SwSlider: no drag lag; array sort while dragging; tooltip follows active thumb.
1907
- - SwMessage: lock body scroll while open.
1908
-
1909
- ---
1910
-
1911
- ### 0.13.9
1912
-
1913
- **Иконки: унификация `before` / `after`**
1914
-
1915
- - Единые пропсы иконок: `before` (слева) и `after` (справа) в `SwButton`, `SwDropdownItem`, `SwMessage`, `SwSection`, `SwGide`, `Alert`.
1916
- - Старые имена сохранены и помечены **Deprecated** (удалить в major): `prefix`/`postfix` (SwButton), `iconBefore`, `iconAfter`, `iconClose`.
1917
-
1918
- **SwDatePicker**
1919
-
1920
- - В `data.holiday`: `weekend` вместо `holidays`, `preholiday` вместо `preholidays` (старые ключи — **Deprecated**, удалить в major).
1921
-
1922
- ---
1923
-
1924
- - Unified icon props: `before` / `after` across `SwButton`, `SwDropdownItem`, `SwMessage`, `SwSection`, `SwGide`, `Alert`.
1925
- - Legacy names kept and marked **Deprecated** (remove in major): `prefix`/`postfix` (SwButton), `iconBefore`, `iconAfter`, `iconClose`.
1926
- - `SwDatePicker` `data.holiday`: `weekend` / `preholiday` (legacy `holidays` / `preholidays` deprecated).
1927
-
1928
- ---
1929
-
1930
- ### 0.13.4
1931
-
1932
- **SwFile**
1933
-
1934
- - Добавлен компонент `SwFile` — загрузчик файлов с режимами `photo` (предпросмотр и обрезка) и `document` (несколько файлов, просмотр в новой вкладке).
1935
- - Поддержка drag & drop, `v-model` (`File[]`), слоты зоны загрузки, списка файлов, удаления и действий редактора обрезки.
1936
-
1937
- ---
1938
-
1939
- - Added `SwFile` — file uploader with `photo` (preview and crop) and `document` (multiple files, open in a new tab) modes.
1940
- - Supports drag & drop, `v-model` (`File[]`), slots for drop zone, file list, remove, and crop editor actions.
1941
-
1942
1610
  ---
1943
1611
 
1944
1612
  ## Лицензия / License
1945
1613
 
1946
- Этот проект распространяется под лицензией MIT. Подробности см. в файле [LICENSE](./LICENSE) . /
1947
- This project is distributed under the MIT License. For details, see the [LICENSE](./LICENSE) file.
1614
+ Этот проект распространяется под лицензией ISC. Подробности см. в файле [LICENSE](./LICENSE). /
1615
+ This project is distributed under the ISC License. For details, see the [LICENSE](./LICENSE) file.
1948
1616
 
1949
1617
  ---
1950
1618