@1337exp/taoui 1.13.1 → 2.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 +74 -14
- package/README.ru.md +621 -561
- package/dist/index.cjs +1171 -602
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +737 -380
- package/dist/index.mjs +1172 -603
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -4785
- package/package.json +66 -61
- package/src/styles/index.css +2 -1
- package/src/styles/primitives.css +42 -5
- package/src/styles/size.css +57 -0
package/README.md
CHANGED
|
@@ -47,9 +47,9 @@ change a handful of CSS variables and the whole kit follows.
|
|
|
47
47
|
- **TaoFormField** — shared label / hint / error for form controls
|
|
48
48
|
- **TaoInputNumber** — number with min/max/step and ± on the right. Empty value is `null`. `@commit` fires once when an edit is finished (blur, Enter, ±, arrow), unlike `v-model`, which updates on every keystroke
|
|
49
49
|
- **TaoQuantity** — cart quantity: `− | field | +`, integers, stock; minus at the minimum can remove the row
|
|
50
|
-
- **TaoTextarea** — autosizing multiline. `maxlength` caps input, `count` shows “entered / max
|
|
50
|
+
- **TaoTextarea** — autosizing multiline. `maxlength` caps input, `count` shows “entered / max”. `variant`: `bar` (default) / `outline` (frame like Input) / `filled` / `plain`; `readonly`. `noBorder`, `noBackground`, `borderInverse`, `dummy` are deprecated
|
|
51
51
|
- **TaoPinCode** — N cells. By default a click clears the cell and everything to the right (`clear-on="focus"`); `clear-on="input"` replaces the digit only when typing. The last cell blurs and emits `complete`
|
|
52
|
-
- **TaoSlider** — mouse, touch, and arrows. Optional precise input on right-click. `
|
|
52
|
+
- **TaoSlider** — mouse, touch, and arrows. Optional precise input on right-click. `variant="thin"` is a thin track for seek / volume; `size` scales either track
|
|
53
53
|
- **TaoFileDrop** — drop zone (drag & drop + click). File names listed under the zone, `v-model` is `File[]`. Clearing the whole batch is the parent’s job (`clear-request`)
|
|
54
54
|
|
|
55
55
|
### Data display
|
|
@@ -85,17 +85,35 @@ change a handful of CSS variables and the whole kit follows.
|
|
|
85
85
|
|
|
86
86
|
## Conventions
|
|
87
87
|
|
|
88
|
-
Visual tones: `success` | `danger` | `warning` | `info` | `neutral
|
|
88
|
+
Visual tones: `success` | `danger` | `warning` | `info` | `neutral` (type `TaoTone`), always the `tone` prop: Button, Alert, Tag. `type` on Alert / Tag is a deprecated alias.
|
|
89
89
|
`error` on Alert, Tag, and `toast()` is an alias of `danger`. Button already uses `danger`.
|
|
90
90
|
Stages describe a process, not a tone: `wait` / `work` / `ok` / `bad` (`danger` is accepted as `bad`).
|
|
91
91
|
|
|
92
|
-
Control sizes: `small` | `medium` | `large
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
Control sizes: `small` | `medium` | `large` (type `TaoSize`). One scale for Button, Input, InputNumber, Quantity, Textarea, Select, Combobox, Date, DateRange, Segmented, InputGroup and FormField — controls of one size line up in a row. Checkbox, Radio / RadioGroup and Switch scale the indicator (14 / 18 / 22px) and the label; Tag scales its height (18 / 20 / 24px); Tabs, Pagination buttons and List rows take the Button height; Table scales cell padding (`size="small"` replaces `compact`); FileDrop scales the zone and file rows; Slider scales the track and thumb.
|
|
93
|
+
Without `size` a control takes the size of its ancestors, `medium` at the root. Set it for a whole block with the class `tao-size-small` / `-medium` / `-large` on any element, or with `size` on `TaoFormField` / `TaoInputGroup`. An explicit `size` on a control wins.
|
|
94
|
+
|
|
95
|
+
```vue
|
|
96
|
+
<div class="tao-size-small">
|
|
97
|
+
<TaoInput v-model="q" />
|
|
98
|
+
<TaoButton>Find</TaoButton>
|
|
99
|
+
</div>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Content and layout keep their own scale and do not inherit: Avatar (24 / 32 / 48px; `s` / `m` / `l` are deprecated), Divider `gap` (`big` is a deprecated alias of `large`), Loader / Icon / ScrollTop (pixels).
|
|
103
|
+
Container lives on another axis — width: `width="wide" | "slim" | "ultra-slim"` (`size` is a deprecated alias).
|
|
95
104
|
|
|
96
105
|
Font size scale (primitives): `xs` 12 … `xl` 18 for controls; `2xl` 24, `3xl` 32, `4xl` 36 for titles and prose.
|
|
97
106
|
There is no heading component — use `h1 { font-size: var(--tao-font-size-3xl) }`.
|
|
98
107
|
|
|
108
|
+
API rules — every component follows them; old names stay as deprecated aliases:
|
|
109
|
+
|
|
110
|
+
- **Fields** take `v-model`, `disabled`, `error` (red frame) and `size`. Label, hint and error text come from `TaoFormField`.
|
|
111
|
+
- **Events**: `update:X` for v-model plus `change` when the user finished a change (Slider, Split — on release). Other events are verbs in the present tense: `select`, `close`, `create`.
|
|
112
|
+
- **Texts**: visible ones are `*Text` (`clearText`, `successText`), screen-reader ones are `*Label` (`closeLabel`).
|
|
113
|
+
- **Lists**: data arrays are `items`; selectable items carry `value` + `label` (`TaoSelectOption`, `TaoTabItem`). Identifiers of plain data (table columns, stages) stay `key`.
|
|
114
|
+
- **Booleans** are adjectives without `is` / `has` / `as`: `closable`, `clickable`, `masked`, `newTab`. Layout axis is `direction: 'row' | 'column'`, not `vertical`.
|
|
115
|
+
- **Lengths** (`padding`, `radius`, `gap`, `maxHeight`): a number is pixels, a string goes to CSS as is (type `TaoLength`).
|
|
116
|
+
|
|
99
117
|
## Icons
|
|
100
118
|
|
|
101
119
|
`TaoIcon` does not ship its own set — it renders `icon-<name>`
|
|
@@ -151,17 +169,56 @@ app.use(TaoUI)
|
|
|
151
169
|
app.mount('#app')
|
|
152
170
|
```
|
|
153
171
|
|
|
172
|
+
### Language
|
|
173
|
+
|
|
174
|
+
Built-in texts (placeholders, “Clear”, aria labels, dates) are Russian by default. English ships with the library:
|
|
175
|
+
|
|
176
|
+
```javascript
|
|
177
|
+
import TaoUI, { localeEn } from '@1337exp/taoui'
|
|
178
|
+
|
|
179
|
+
app.use(TaoUI, { locale: localeEn })
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Change single texts — the rest stays from the default:
|
|
183
|
+
|
|
184
|
+
```javascript
|
|
185
|
+
app.use(TaoUI, { locale: { select: { placeholder: 'Pick one' } } })
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Another language: copy `localeEn`, translate, pass it the same way (type `TaoLocale`). Keys repeat prop names —
|
|
189
|
+
`locale.select.placeholder` is the default of TaoSelect `placeholder`, and a prop passed by hand always wins.
|
|
190
|
+
|
|
191
|
+
Switch the language at any moment — from your settings, a language picker, a route. Components already on the page
|
|
192
|
+
update at once, without a reload and without losing what users typed:
|
|
193
|
+
|
|
194
|
+
```javascript
|
|
195
|
+
import { setTaoLocale, localeEn, localeRu } from '@1337exp/taoui'
|
|
196
|
+
|
|
197
|
+
function onLanguageChange(lang) {
|
|
198
|
+
setTaoLocale(lang === 'en' ? localeEn : localeRu)
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Without the plugin (individual components) `setTaoLocale()` is the only call you need.
|
|
203
|
+
|
|
204
|
+
### Upgrading from 1.x
|
|
205
|
+
|
|
206
|
+
See [CHANGELOG.md](CHANGELOG.md): what broke, and a table of old names → new ones. Old names still work in 2.x and
|
|
207
|
+
warn in the console during development.
|
|
208
|
+
|
|
154
209
|
### Individual components
|
|
155
210
|
|
|
156
211
|
```vue
|
|
157
212
|
<script setup>
|
|
158
|
-
import { TaoButton, TaoInput, TaoModal } from '@1337exp/taoui'
|
|
213
|
+
import { TaoButton, TaoFormField, TaoInput, TaoModal } from '@1337exp/taoui'
|
|
159
214
|
import '@1337exp/taoui/styles.css'
|
|
160
215
|
</script>
|
|
161
216
|
|
|
162
217
|
<template>
|
|
163
218
|
<TaoButton variant="primary">Press me</TaoButton>
|
|
164
|
-
<
|
|
219
|
+
<TaoFormField label="Your text">
|
|
220
|
+
<TaoInput v-model="text" />
|
|
221
|
+
</TaoFormField>
|
|
165
222
|
<TaoModal v-model="isOpen" title="Title">
|
|
166
223
|
Modal body
|
|
167
224
|
</TaoModal>
|
|
@@ -262,14 +319,14 @@ confirm.defaults({ ok: 'Yes', cancel: 'No' })
|
|
|
262
319
|
<TaoSegmentedOption value="year">Year</TaoSegmentedOption>
|
|
263
320
|
</TaoSegmented>
|
|
264
321
|
|
|
265
|
-
<TaoAlert
|
|
322
|
+
<TaoAlert tone="warning" title="Draft">Save before you leave.</TaoAlert>
|
|
266
323
|
```
|
|
267
324
|
|
|
268
325
|
`TaoSegmented` is a short exclusive choice with every option visible. It is not page navigation — that is `TaoTabs`. Longer labels or more than 5–6 items belong in `TaoRadioGroup` or `TaoSelect`.
|
|
269
326
|
|
|
270
327
|
`TaoSelect` opens from the keyboard (arrows, Enter, Esc); the list flips at the viewport edge. Delete or “Clear” at the bottom of the list resets the value to `null`.
|
|
271
328
|
|
|
272
|
-
When `null` is not a valid value (a grid step, a sort order), pass `:clearable="false"`: the clear row and the Delete / Backspace shortcut disappear. The clear row label is `clear-text`; for an icon or any markup use the `#clear` slot. `size` is `small` / `medium`
|
|
329
|
+
When `null` is not a valid value (a grid step, a sort order), pass `:clearable="false"`: the clear row and the Delete / Backspace shortcut disappear. The clear row label is `clear-text`; for an icon or any markup use the `#clear` slot. `size` is `small` / `medium` / `large` (inherited from ancestors when not set) and also scales the open list.
|
|
273
330
|
|
|
274
331
|
```vue
|
|
275
332
|
<TaoSelect v-model="step" :options="steps" size="small" :clearable="false" />
|
|
@@ -281,12 +338,12 @@ When `null` is not a valid value (a grid step, a sort order), pass `:clearable="
|
|
|
281
338
|
|
|
282
339
|
`TaoCombobox` is the same menu with a field. Typing filters options. `allow-create` writes the typed string into `v-model` when there is no exact match. The list does not mutate itself: listen to `create` and append an option from the parent.
|
|
283
340
|
|
|
284
|
-
`TaoFormField` also wraps `TaoTextarea`, `TaoCheckbox`, `TaoSwitch`, `TaoRadioGroup`, and `TaoSegmented` — id, hint, and error are forwarded for you.
|
|
341
|
+
Label, hint and error text always come from `TaoFormField`; `label` / `error-message` on `TaoInput` are deprecated. `TaoFormField` also wraps `TaoTextarea`, `TaoCheckbox`, `TaoSwitch`, `TaoRadioGroup`, and `TaoSegmented` — id, hint, and error are forwarded for you.
|
|
285
342
|
|
|
286
343
|
`TaoTag` can be a chip: `#prefix` on the left (usually `TaoAvatar`), `closable` draws a cross and emits `close`. The close click does not bubble. `flat` drops the border and keeps the fill.
|
|
287
344
|
|
|
288
345
|
```vue
|
|
289
|
-
<TaoTag
|
|
346
|
+
<TaoTag tone="neutral" closable @close="remove">
|
|
290
347
|
<template #prefix>
|
|
291
348
|
<TaoAvatar name="Anna Kozlova" size="small" />
|
|
292
349
|
</template>
|
|
@@ -306,7 +363,7 @@ The table renders what you pass in: it does not slice or sort the data. That wor
|
|
|
306
363
|
empty-text="No records yet"
|
|
307
364
|
>
|
|
308
365
|
<template #cell-status="{ row }">
|
|
309
|
-
<TaoTag :
|
|
366
|
+
<TaoTag :tone="row.status === 'active' ? 'success' : 'neutral'">
|
|
310
367
|
{{ row.status }}
|
|
311
368
|
</TaoTag>
|
|
312
369
|
</template>
|
|
@@ -491,7 +548,7 @@ document.documentElement.setAttribute('data-tao-theme', 'light')
|
|
|
491
548
|
- `--tao-radius-control`, `--tao-radius-panel` — radii (small controls vs large panels)
|
|
492
549
|
- `--tao-shadow-panel`, `--tao-shadow-overlay` — shadows
|
|
493
550
|
- `--tao-font-size-*` — type scale in `primitives.css`: `xs`–`xl` controls, `2xl`–`4xl` titles / prose
|
|
494
|
-
- `--tao-control-height-
|
|
551
|
+
- `--tao-control-height-*` (26 / 36 / 44px), `--tao-control-padding-x-*`, `--tao-control-padding-y-*`, `--tao-control-font-size-*`, `--tao-control-font-size-secondary-*`, `--tao-button-padding-x-*`, `--tao-indicator-size-*`, `--tao-tag-height-*` / `-padding-x-*` / `-font-size-*` — the size scale in `primitives.css`. Components read the current values from `size.css`: `--tao-control-height`, `--tao-control-padding-x` / `-y`, `--tao-control-font-size`, `--tao-control-font-size-secondary`, `--tao-button-padding-x`, `--tao-indicator-size`, `--tao-tag-height` / `-padding-x` / `-font-size`. Use them in your own controls to match the size around them. `--tao-field-height` is a deprecated alias of `--tao-control-height`
|
|
495
552
|
|
|
496
553
|
The full list lives in `src/styles/semantic.css` — the only file worth opening
|
|
497
554
|
to see the whole theming API.
|
|
@@ -532,6 +589,9 @@ npm run dev
|
|
|
532
589
|
|
|
533
590
|
# Type check
|
|
534
591
|
npm run type-check
|
|
592
|
+
|
|
593
|
+
# Tests (Vitest)
|
|
594
|
+
npm test
|
|
535
595
|
```
|
|
536
596
|
|
|
537
597
|
## Publishing to npm
|