@khsura/sui 1.19.0 → 1.21.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/@types/components/avatar/index.d.ts +2 -0
- package/@types/components/avatar/sAvatar.vue.d.ts +13 -0
- package/@types/components/avatar/sAvatarGroup.vue.d.ts +16 -0
- package/@types/components/cards/sCardText.vue.d.ts +2 -2
- package/@types/components/datePicker/sDatePickerSwitch.vue.d.ts +2 -0
- package/@types/components/form/index.d.ts +2 -0
- package/@types/components/form/radio/sRadio.vue.d.ts +3 -0
- package/@types/components/form/sFormRow.vue.d.ts +18 -0
- package/@types/components/form/sInput.vue.d.ts +1 -0
- package/@types/components/form/sNumberInput.vue.d.ts +29 -0
- package/@types/components/form/sSelect.vue.d.ts +10 -3
- package/@types/components/index.d.ts +5 -0
- package/@types/components/layout/sNavigationDrawer.vue.d.ts +6 -6
- package/@types/components/progress/sProgressCircular.vue.d.ts +1 -0
- package/@types/components/progress/sProgressLinear.vue.d.ts +1 -0
- package/@types/components/sAutocomplete.vue.d.ts +11 -1
- package/@types/components/sEmptyState.vue.d.ts +26 -0
- package/@types/components/sFileInput.vue.d.ts +35 -0
- package/@types/components/sPagination.vue.d.ts +21 -0
- package/@types/components/sSkeletonLoader.vue.d.ts +19 -0
- package/@types/components/slideGroup/sSlideGroup.vue.d.ts +4 -1
- package/@types/components/table/sTable.vue.d.ts +2 -0
- package/@types/components/tabs/sTabs.vue.d.ts +2 -2
- package/@types/components/toggleButtonGroup/sToggleButtonGroup.vue.d.ts +2 -0
- package/@types/configs/app.d.ts +4 -0
- package/@types/configs/fileInput.d.ts +5 -0
- package/@types/configs/i18n.d.ts +3 -0
- package/@types/configs/index.d.ts +2 -0
- package/@types/configs/provider.d.ts +2 -0
- package/@types/configs/skeletonLoader.d.ts +57 -0
- package/@types/constants/avatar.d.ts +3 -0
- package/@types/constants/color.d.ts +15 -0
- package/@types/constants/cssVariables.d.ts +4 -0
- package/@types/constants/datePicker.d.ts +7 -0
- package/@types/constants/fileInput.d.ts +31 -0
- package/@types/constants/i18n.d.ts +3 -0
- package/@types/constants/index.d.ts +8 -0
- package/@types/constants/keyboard.d.ts +12 -0
- package/@types/constants/layout.d.ts +2 -0
- package/@types/constants/listbox.d.ts +1 -0
- package/@types/constants/numberInput.d.ts +22 -0
- package/@types/constants/overlay.d.ts +5 -0
- package/@types/constants/pagination.d.ts +20 -0
- package/@types/constants/skeletonLoader.d.ts +33 -0
- package/@types/constants/tabs.d.ts +10 -0
- package/@types/definitions/props/core/propsLink.d.ts +2 -2
- package/@types/definitions/props/index.d.ts +7 -0
- package/@types/definitions/props/propsAutocomplete.d.ts +8 -0
- package/@types/definitions/props/propsAvatar.d.ts +13 -0
- package/@types/definitions/props/propsAvatarGroup.d.ts +8 -0
- package/@types/definitions/props/propsEmptyState.d.ts +17 -0
- package/@types/definitions/props/propsFileInput.d.ts +41 -0
- package/@types/definitions/props/propsInput.d.ts +1 -0
- package/@types/definitions/props/propsLink.d.ts +2 -2
- package/@types/definitions/props/propsNumberInput.d.ts +46 -0
- package/@types/definitions/props/propsPagination.d.ts +32 -0
- package/@types/definitions/props/propsProgressCircular.d.ts +2 -0
- package/@types/definitions/props/propsProgressLinear.d.ts +2 -0
- package/@types/definitions/props/propsRow.d.ts +1 -0
- package/@types/definitions/props/propsSelect.d.ts +6 -0
- package/@types/definitions/props/propsSkeletonLoader.d.ts +18 -0
- package/@types/definitions/props/propsSlideGroup.d.ts +4 -0
- package/@types/definitions/props/propsTable.d.ts +1 -0
- package/@types/definitions/props/propsTabs.d.ts +4 -0
- package/@types/definitions/props/propsTextarea.d.ts +3 -0
- package/@types/helpers/colorHelpers.d.ts +1 -1
- package/@types/helpers/createAppStore.d.ts +4 -0
- package/@types/helpers/fileInputRules.d.ts +18 -0
- package/@types/helpers/index.d.ts +1 -0
- package/@types/lib/color.d.ts +21 -2
- package/@types/lib/escapeHtml.d.ts +2 -0
- package/@types/lib/flattenVNodes.d.ts +2 -0
- package/@types/lib/index.d.ts +7 -0
- package/@types/lib/linkLocation.d.ts +9 -0
- package/@types/lib/numberInput.d.ts +23 -0
- package/@types/lib/overlayPlacement.d.ts +11 -0
- package/@types/lib/revealInScroller.d.ts +25 -0
- package/@types/lib/safeArea.d.ts +3 -0
- package/@types/playwright.visual.config.d.ts +3 -0
- package/@types/services/appBarService.d.ts +14 -0
- package/@types/services/backgroundScrollService.d.ts +8 -2
- package/@types/services/core/layoutCoreService.d.ts +4 -0
- package/@types/services/datePicker/datePickerItemDateService.d.ts +1 -0
- package/@types/services/dialogService.d.ts +4 -8
- package/@types/services/fieldLayoutService.d.ts +19 -0
- package/@types/services/formInputService.d.ts +6 -0
- package/@types/services/index.d.ts +9 -0
- package/@types/services/layoutProviderService.d.ts +6 -0
- package/@types/services/layoutService.d.ts +4 -0
- package/@types/services/linkService.d.ts +11 -1
- package/@types/services/listboxNavigationService.d.ts +20 -0
- package/@types/services/menuService.d.ts +2 -0
- package/@types/services/overlayFocusService.d.ts +10 -0
- package/@types/services/paginationService.d.ts +39 -0
- package/@types/services/routerLinkService.d.ts +19 -0
- package/@types/services/scrollableFocusService.d.ts +10 -0
- package/@types/services/skeletonLoaderService.d.ts +22 -0
- package/@types/services/surfaceTextColorService.d.ts +8 -0
- package/@types/services/tabsService.d.ts +14 -0
- package/@types/store/index.d.ts +1 -0
- package/@types/store/scrollLockStore.d.ts +1 -0
- package/@types/tests/visual/constants/a11yAudit.d.ts +4 -0
- package/@types/tests/visual/constants/index.d.ts +4 -0
- package/@types/tests/visual/constants/resizeScroll.d.ts +10 -0
- package/@types/tests/visual/constants/storyRender.d.ts +5 -0
- package/@types/tests/visual/constants/visualMatrix.d.ts +20 -0
- package/@types/tests/visual/schemas/index.d.ts +1 -0
- package/@types/tests/visual/schemas/storyIndex.d.ts +17 -0
- package/@types/tests/visual/types/a11yAudit.d.ts +2 -0
- package/@types/tests/visual/types/index.d.ts +2 -0
- package/@types/tests/visual/types/visualStory.d.ts +8 -0
- package/@types/types/app.d.ts +2 -0
- package/@types/types/breadcrumbs.d.ts +2 -2
- package/@types/types/emits.d.ts +12 -0
- package/@types/types/fileInput.d.ts +28 -0
- package/@types/types/index.d.ts +6 -0
- package/@types/types/link.d.ts +20 -0
- package/@types/types/menu.d.ts +17 -0
- package/@types/types/numberInput.d.ts +12 -0
- package/@types/types/pagination.d.ts +17 -0
- package/@types/types/safeArea.d.ts +1 -0
- package/@types/types/skeletonLoader.d.ts +16 -0
- package/@types/vite.config.d.ts +1 -0
- package/README.md +12 -0
- package/dist/base.css.map +1 -1
- package/dist/s-ui.css +1 -1
- package/dist/s-ui.js +4792 -3038
- package/dist/s-ui.umd.cjs +1 -1
- package/dist/styles/components/avatar/_variables.scss +17 -0
- package/dist/styles/components/avatar/index.scss +1 -0
- package/dist/styles/components/button/mixins.scss +5 -0
- package/dist/styles/components/form/_variables.scss +11 -0
- package/dist/styles/components/form/index.scss +1 -0
- package/dist/styles/components/index.scss +2 -0
- package/dist/styles/mixins/_app.scss +7 -0
- package/dist/styles/tools/_safeArea.scss +8 -0
- package/dist/styles/tools/index.scss +1 -0
- package/dist/sui-api.json +1295 -212
- package/package.json +15 -4
- package/sui-plugin/.claude-plugin/plugin.json +1 -1
- package/sui-plugin/skills/sui-component/SKILL.md +21 -6
- package/sui-plugin/skills/sui-component/references/autocomplete.md +54 -46
- package/sui-plugin/skills/sui-component/references/avatar-group.md +66 -0
- package/sui-plugin/skills/sui-component/references/avatar.md +76 -0
- package/sui-plugin/skills/sui-component/references/badge.md +4 -4
- package/sui-plugin/skills/sui-component/references/breadcrumbs.md +3 -2
- package/sui-plugin/skills/sui-component/references/button.md +13 -13
- package/sui-plugin/skills/sui-component/references/calendar.md +1 -1
- package/sui-plugin/skills/sui-component/references/cards.md +12 -12
- package/sui-plugin/skills/sui-component/references/carousel.md +9 -9
- package/sui-plugin/skills/sui-component/references/chip.md +1 -1
- package/sui-plugin/skills/sui-component/references/date-picker.md +14 -13
- package/sui-plugin/skills/sui-component/references/dialog.md +11 -10
- package/sui-plugin/skills/sui-component/references/droppable.md +8 -8
- package/sui-plugin/skills/sui-component/references/empty-state.md +104 -0
- package/sui-plugin/skills/sui-component/references/expansion-panels.md +1 -1
- package/sui-plugin/skills/sui-component/references/file-input.md +106 -0
- package/sui-plugin/skills/sui-component/references/form.md +155 -105
- package/sui-plugin/skills/sui-component/references/image.md +11 -10
- package/sui-plugin/skills/sui-component/references/layout.md +53 -49
- package/sui-plugin/skills/sui-component/references/list.md +6 -3
- package/sui-plugin/skills/sui-component/references/menu.md +12 -9
- package/sui-plugin/skills/sui-component/references/number-input.md +102 -0
- package/sui-plugin/skills/sui-component/references/pagination.md +83 -0
- package/sui-plugin/skills/sui-component/references/progress.md +20 -18
- package/sui-plugin/skills/sui-component/references/sheet.md +8 -8
- package/sui-plugin/skills/sui-component/references/skeleton-loader.md +75 -0
- package/sui-plugin/skills/sui-component/references/slide-group.md +14 -12
- package/sui-plugin/skills/sui-component/references/snackbar.md +7 -5
- package/sui-plugin/skills/sui-component/references/split-view.md +2 -2
- package/sui-plugin/skills/sui-component/references/table.md +10 -3
- package/sui-plugin/skills/sui-component/references/tabs.md +19 -13
- package/sui-plugin/skills/sui-component/references/toggle-button-group.md +5 -4
- package/sui-plugin/skills/sui-component/references/toolbar.md +5 -5
- package/sui-plugin/skills/sui-component/references/tooltip.md +10 -9
- package/sui-plugin/skills/sui-component/references/window.md +6 -1
- package/sui-plugin/skills/sui-form/SKILL.md +25 -17
- package/sui-plugin/skills/sui-getting-started/SKILL.md +32 -7
- package/sui-plugin/skills/sui-layout/SKILL.md +3 -1
- package/sui-plugin/skills/sui-utilities/docs/classes.md +1 -1
|
@@ -13,20 +13,20 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsSheet.d.ts`
|
|
|
13
13
|
|
|
14
14
|
| Prop | Type | Default | Required | Values |
|
|
15
15
|
| --- | --- | --- | --- | --- |
|
|
16
|
-
| `borderRadius` | `` number \| "
|
|
16
|
+
| `borderRadius` | `` number \| "rounded" \| "tile" \| `${number}%` \| `${number}em` \| `${number}px` \| `${number}rem` \| `${number}vh` \| `${number}vw` \| null `` | — | no | — |
|
|
17
17
|
| `color` | `string` | — | no | — |
|
|
18
18
|
| `colorThreshold` | `number` | — | no | — |
|
|
19
|
-
| `elevation` | `"" \|
|
|
20
|
-
| `height` | `
|
|
21
|
-
| `maxHeight` | `
|
|
22
|
-
| `maxWidth` | `
|
|
23
|
-
| `minHeight` | `
|
|
24
|
-
| `minWidth` | `
|
|
19
|
+
| `elevation` | `"" \| "1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| "13" \| "14" \| "15" \| "16" \| "17" \| "18" \| "19" \| "20" \| "21" \| "22" \| "23" \| "24" \| 0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13 \| 14 \| 15 \| 16 \| 17 \| 18 \| 19 \| 20 \| 21 \| 22 \| 23 \| 24 \| null` | — | no | — |
|
|
20
|
+
| `height` | `number \| string \| null` | — | no | — |
|
|
21
|
+
| `maxHeight` | `number \| string \| null` | — | no | — |
|
|
22
|
+
| `maxWidth` | `number \| string \| null` | — | no | — |
|
|
23
|
+
| `minHeight` | `number \| string \| null` | — | no | — |
|
|
24
|
+
| `minWidth` | `number \| string \| null` | — | no | — |
|
|
25
25
|
| `outlined` | `boolean \| null` | — | no | — |
|
|
26
26
|
| `tag` | `HtmlTagName \| null` | — | no | `a`, `abbr`, `acronym`, `address`, `applet`, `area`, `article`, `aside`, `audio`, `b`, `base`, `basefont`, `bdi`, `bdo`, `big`, `blockquote`, `body`, `br`, `button`, `canvas`, `caption`, `center`, `cite`, `code`, `col`, `colgroup`, `data`, `datalist`, `dd`, `del`, `details`, `dfn`, `dialog`, `dir`, `div`, `dl`, `dt`, `em`, `embed`, `fieldset`, `figcaption`, `figure`, `font`, `footer`, `form`, `frame`, `frameset`, `h1`, `h1> to <h6`, `h2`, `h3`, `h4`, `h5`, `h6`, `head`, `header`, `hr`, `html`, `i`, `iframe`, `img`, `input`, `ins`, `kbd`, `label`, `legend`, `li`, `link`, `main`, `map`, `mark`, `meta`, `meter`, `nav`, `noframes`, `noscript`, `object`, `ol`, `optgroup`, `option`, `output`, `p`, `param`, `picture`, `pre`, `progress`, `q`, `rp`, `rt`, `ruby`, `s`, `samp`, `script`, `section`, `select`, `small`, `source`, `span`, `strike`, `strong`, `style`, `sub`, `summary`, `sup`, `svg`, `table`, `tbody`, `td`, `template`, `textarea`, `tfoot`, `th`, `thead`, `time`, `title`, `tr`, `track`, `tt`, `u`, `ul`, `var`, `video`, `wbr` |
|
|
27
27
|
| `theme` | `AppThemeType` | — | no | `dark`, `light` |
|
|
28
28
|
| `underlined` | `boolean \| null` | — | no | — |
|
|
29
|
-
| `width` | `
|
|
29
|
+
| `width` | `number \| string \| null` | — | no | — |
|
|
30
30
|
|
|
31
31
|
**SSheet slots**
|
|
32
32
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# SSkeletonLoader
|
|
2
|
+
|
|
3
|
+
**Import:** `import { SSkeletonLoader } from '@khsura/sui'`
|
|
4
|
+
|
|
5
|
+
Loading placeholder: draws bones in the shape of the coming content (text lines, avatar, card, list items, table), then shows its default slot once `loading` is `false`. While loading it is one `role="status"` with `aria-busy="true"`; the bones are `aria-hidden`. The shimmer stops for `prefers-reduced-motion`, and the bones follow the light/dark theme by themselves.
|
|
6
|
+
|
|
7
|
+
Types: `node_modules/@khsura/sui/@types/definitions/props/propsSkeletonLoader.d.ts`
|
|
8
|
+
|
|
9
|
+
Docs: https://sui.surakh.com/?path=/docs/ui-components-skeletonloader--docs
|
|
10
|
+
|
|
11
|
+
<!-- generated:api:start SSkeletonLoader -->
|
|
12
|
+
<!-- Generated from sui-api.json by `yarn sync:skills` (packages/app). Do not edit by hand. -->
|
|
13
|
+
|
|
14
|
+
**SSkeletonLoader props**
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
17
|
+
| --- | --- | --- | --- | --- | --- |
|
|
18
|
+
| `boilerplate` | `boolean` | `false` | no | — | Draws still bones, without the shimmer animation (the shimmer also stops for `prefers-reduced-motion`). |
|
|
19
|
+
| `height` | `number \| string \| null` | — | no | — | — |
|
|
20
|
+
| `loading` | `boolean` | `false` | no | — | Shows the skeleton while `true` and the default slot once `false`. Without a default slot the skeleton is always shown, so a standalone `<SSkeletonLoader type="card" />` needs no `loading`. |
|
|
21
|
+
| `loadingText` | `string` | `"Loading…"` | no | — | Accessible name announced while the skeleton is shown. Defaults to `'Loading…'`. |
|
|
22
|
+
| `maxHeight` | `number \| string \| null` | — | no | — | — |
|
|
23
|
+
| `maxWidth` | `number \| string \| null` | — | no | — | — |
|
|
24
|
+
| `minHeight` | `number \| string \| null` | — | no | — | — |
|
|
25
|
+
| `minWidth` | `number \| string \| null` | — | no | — | — |
|
|
26
|
+
| `theme` | `AppThemeType` | — | no | `dark`, `light` | — |
|
|
27
|
+
| `type` | `string` | `"text"` | no | — | What to draw: presets joined by commas, each with an optional `@N` repeat count. Presets: `text`, `heading`, `avatar`, `button`, `image`, `card`, `list-item`, `list-item-avatar`, `table-row`, `table`. Example: `'avatar, text@3'`. Unknown presets are ignored. Defaults to `'text'`. |
|
|
28
|
+
| `width` | `number \| string \| null` | — | no | — | — |
|
|
29
|
+
|
|
30
|
+
**SSkeletonLoader slots**
|
|
31
|
+
|
|
32
|
+
| Slot | Slot props | Description |
|
|
33
|
+
| --- | --- | --- |
|
|
34
|
+
| `default` | `any` | The real content, shown once `loading` is `false`. |
|
|
35
|
+
|
|
36
|
+
**SSkeletonLoader events**
|
|
37
|
+
|
|
38
|
+
None.
|
|
39
|
+
|
|
40
|
+
<!-- generated:api:end SSkeletonLoader -->
|
|
41
|
+
|
|
42
|
+
**SSkeletonLoader notes**
|
|
43
|
+
|
|
44
|
+
- `type` presets: `text`, `heading`, `avatar`, `button`, `image`, `card`, `list-item`, `list-item-avatar`, `table-row`, `table`. Join with commas, repeat with `@N`: `type="avatar, text@3"`. Unknown presets are silently ignored.
|
|
45
|
+
- Preset sizes match SUI: `avatar` 40px (SAvatar), `button` 36px (SButton), `list-item` 48px (SListItem), `table-row` 48px (STable), `card` with SCard's 16px padding. The layout does not jump when the content replaces the skeleton.
|
|
46
|
+
- `loading` + content inside = swap. No content inside = the skeleton always shows (`loading` is ignored).
|
|
47
|
+
- The root is full width; narrow it with `width` / `max-width`.
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<SSkeletonLoader type="card" :loading="isLoading">
|
|
53
|
+
<SCard>…</SCard>
|
|
54
|
+
</SSkeletonLoader>
|
|
55
|
+
|
|
56
|
+
<SSkeletonLoader type="list-item-avatar@3" :loading="isLoading" loading-text="Loading contacts">
|
|
57
|
+
<SList>…</SList>
|
|
58
|
+
</SSkeletonLoader>
|
|
59
|
+
|
|
60
|
+
<!-- standalone placeholder, toggled with v-if -->
|
|
61
|
+
<SSkeletonLoader v-if="isLoading" type="table" />
|
|
62
|
+
<STable v-else :headers="headers" :items="items" />
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Gotchas
|
|
66
|
+
|
|
67
|
+
| ❌ | ✅ |
|
|
68
|
+
|----|----|
|
|
69
|
+
| `<SSkeletonLoader :loading="isLoading" type="card" />` then the content as a sibling (the skeleton never hides) | Put the content inside: `<SSkeletonLoader :loading="isLoading" type="card"><SCard>…</SCard></SSkeletonLoader>`, or `v-if` / `v-else` |
|
|
70
|
+
| Vuetify presets: `type="paragraph"`, `sentences`, `article`, `list-item-two-line`, `chip`, `actions`, `table-tbody` | `text@3`, `text@2`, `heading, text@3`, `list-item-avatar`, `button`, `button@2`, `table-row@5` |
|
|
71
|
+
| `type="text*3"` or `type="text x3"` | `type="text@3"` |
|
|
72
|
+
| `:type="['avatar', 'text']"` (an array) | One string: `type="avatar, text"` |
|
|
73
|
+
| `color="grey"`, `elevation="2"`, `size="large"` on SSkeletonLoader | Not props. Size it with `width` / `max-width` / `height`; it takes its tint from the theme |
|
|
74
|
+
| `SProgressCircular indeterminate` as a list placeholder | `SSkeletonLoader type="list-item-avatar@5"` keeps the layout steady |
|
|
75
|
+
| Hard-coded dark bones (`style="background: #333"`) | Nothing: bones follow the theme; use `theme="dark"` only to force one |
|
|
@@ -15,17 +15,19 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsSlideGroup.d.ts`
|
|
|
15
15
|
|
|
16
16
|
**SSlideGroup props**
|
|
17
17
|
|
|
18
|
-
| Prop | Type | Default | Required | Values |
|
|
19
|
-
| --- | --- | --- | --- | --- |
|
|
20
|
-
| `activeClass` | `string \| null` | — | no | — |
|
|
21
|
-
| `centerActive` | `boolean` | — | no | — |
|
|
22
|
-
| `contentClass` | `string \|
|
|
23
|
-
| `contentStyle` | `StyleValue` | — | no | — |
|
|
24
|
-
| `mandatory` | `boolean` | — | no | — |
|
|
25
|
-
| `modelValue` | `GroupItemValue[]` | `[]` | no | — |
|
|
26
|
-
| `multiple` | `boolean` | — | no | — |
|
|
27
|
-
| `
|
|
28
|
-
| `
|
|
18
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- | --- |
|
|
20
|
+
| `activeClass` | `string \| null` | — | no | — | — |
|
|
21
|
+
| `centerActive` | `boolean` | — | no | — | — |
|
|
22
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — | — |
|
|
23
|
+
| `contentStyle` | `StyleValue` | — | no | — | — |
|
|
24
|
+
| `mandatory` | `boolean` | — | no | — | — |
|
|
25
|
+
| `modelValue` | `GroupItemValue[]` | `[]` | no | — | — |
|
|
26
|
+
| `multiple` | `boolean` | — | no | — | — |
|
|
27
|
+
| `nextAriaLabel` | `string` | `"Next"` | no | — | Accessible name of the next arrow button. Defaults to `'Next'`. |
|
|
28
|
+
| `prevAriaLabel` | `string` | `"Previous"` | no | — | Accessible name of the previous arrow button. Defaults to `'Previous'`. |
|
|
29
|
+
| `scrollable` | `boolean \| null` | — | no | — | — |
|
|
30
|
+
| `slideStep` | `number \| null` | — | no | — | — |
|
|
29
31
|
|
|
30
32
|
**SSlideGroup slots**
|
|
31
33
|
|
|
@@ -156,5 +158,5 @@ const activeFilters = ref<string[]>([])
|
|
|
156
158
|
| `#default="{ isSelected, select }"` + `@click="select"` | Only `isSelected` exists; the item itself toggles on click |
|
|
157
159
|
| `scrollable` to get arrows | Arrows appear when `scrollable` is **off** and items overflow |
|
|
158
160
|
|
|
159
|
-
-
|
|
161
|
+
- Each slot's `attrs.disabled` is `true` only at that arrow's own edge, so `v-bind="attrs"` is enough for a custom arrow. Before 1.20.0 the `right` slot's `attrs.disabled` mirrored the *previous* button's state; there, compute your own disabled state for a custom "next" button.
|
|
160
162
|
- `disabled` on an item blocks clicks via CSS (`pointer-events: none`) and dims it.
|
|
@@ -13,10 +13,10 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsSnackbar.d.ts`
|
|
|
13
13
|
|
|
14
14
|
| Prop | Type | Default | Required | Values |
|
|
15
15
|
| --- | --- | --- | --- | --- |
|
|
16
|
-
| `activator` | `string \|
|
|
17
|
-
| `borderRadius` | `` number \| "
|
|
16
|
+
| `activator` | `string \| ComponentPublicInstance \| HTMLElement \| null` | — | no | — |
|
|
17
|
+
| `borderRadius` | `` number \| "rounded" \| "tile" \| `${number}%` \| `${number}em` \| `${number}px` \| `${number}rem` \| `${number}vh` \| `${number}vw` \| null `` | — | no | — |
|
|
18
18
|
| `disabled` | `boolean \| null` | — | no | — |
|
|
19
|
-
| `location` | `"
|
|
19
|
+
| `location` | `"bottom" \| "top" \| null` | — | no | `bottom`, `top` |
|
|
20
20
|
| `modelValue` | `boolean` | — | no | — |
|
|
21
21
|
| `multiLine` | `boolean \| null` | — | no | — |
|
|
22
22
|
| `outlined` | `boolean \| null` | — | no | — |
|
|
@@ -68,7 +68,7 @@ None — use `v-model`.
|
|
|
68
68
|
<SSnackbar v-model="offline" location="top">
|
|
69
69
|
Connection lost.
|
|
70
70
|
<template #action>
|
|
71
|
-
<SButton variant="text"
|
|
71
|
+
<SButton variant="text" @click="retry">Retry</SButton>
|
|
72
72
|
<SButton variant="icon" @click="offline = false"><SIcon icon="mdi-close" /></SButton>
|
|
73
73
|
</template>
|
|
74
74
|
</SSnackbar>
|
|
@@ -81,8 +81,10 @@ None — use `v-model`.
|
|
|
81
81
|
## Gotchas
|
|
82
82
|
|
|
83
83
|
- No `color` prop — colors come from the theme's `snackbar` color.
|
|
84
|
-
- The snackbar is dark (`#424242`) in both themes.
|
|
84
|
+
- The snackbar is dark (`#424242`) in both themes. Give a `variant="text"` (or `variant="icon"`) action **no** `color`: it takes the snackbar's light text colour, so the readable action is `<SButton variant="text">Undo</SButton>`. Since 1.20.0 a preset `color` (`warning`, `primary`, ...) inside the snackbar uses a variant that reaches 4.5:1 on it, but adds nothing over the default. A CSS colour (`color="#1976d2"`) is used as is, so pick a light one such as `color="#ffffff"`. Before 1.20.0 an action without `color` kept the page's dark text colour (about 1.3:1) and `primary`, `secondary`, `success`, `info` and `error` were below 4.5:1 (`primary` 2.18:1), so use `color="warning"` or a light CSS colour there.
|
|
85
|
+
- One snackbar per location: two open at the same `location` overlap. Show one at a time (or one `top`, one bottom); a queue component for stacking is planned.
|
|
85
86
|
- `outlined`, `underlined` and `borderRadius` appear in the prop types but are not applied.
|
|
86
87
|
- Without `timeout`, provide a close action in `#action`.
|
|
87
88
|
- Single-line by default: long text is cut with an ellipsis — use `multi-line`.
|
|
88
89
|
- The app must be wrapped in `<SApp>` (the snackbar teleports into its overlay container).
|
|
90
|
+
- On an iPhone with `viewport-fit=cover` the snackbar clears the home indicator (or the notch with `location="top"`) by itself.
|
|
@@ -17,9 +17,9 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsSplitView.d.ts`
|
|
|
17
17
|
|
|
18
18
|
| Prop | Type | Default | Required | Values |
|
|
19
19
|
| --- | --- | --- | --- | --- |
|
|
20
|
-
| `height` | `
|
|
20
|
+
| `height` | `number \| string` | `"100%"` | no | — |
|
|
21
21
|
| `vertical` | `boolean` | — | no | — |
|
|
22
|
-
| `width` | `
|
|
22
|
+
| `width` | `number \| string` | `"100%"` | no | — |
|
|
23
23
|
|
|
24
24
|
**SSplitView slots**
|
|
25
25
|
|
|
@@ -37,6 +37,7 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsTable.d.ts`. The
|
|
|
37
37
|
| `itemsPerPage` | `number` | — | no | — |
|
|
38
38
|
| `itemsPerPageLabel` | `string` | — | no | — |
|
|
39
39
|
| `loading` | `boolean` | — | no | — |
|
|
40
|
+
| `loadingText` | `string` | — | no | — |
|
|
40
41
|
| `multiSort` | `boolean` | `false` | no | — |
|
|
41
42
|
| `noDataText` | `string` | — | no | — |
|
|
42
43
|
| `outlined` | `boolean` | `false` | no | — |
|
|
@@ -65,6 +66,7 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsTable.d.ts`. The
|
|
|
65
66
|
| `itemFooter` | `TableItemFooterSlotProps<T>` | Full-width row below an item, rendered when `itemFooter` is set and the item has that key. |
|
|
66
67
|
| `itemHeader` | `TableItemHeaderSlotProps<T>` | Full-width row above an item, rendered when `itemHeader` is set and the item has that key. |
|
|
67
68
|
| `itemsPerPageLabel` | `any` | Label of the items-per-page selector in the pagination. |
|
|
69
|
+
| `loadingData` | `any` | Shown instead of the rows while `loading` is set and `items` is still empty. |
|
|
68
70
|
| `noData` | `any` | Shown instead of the rows when `items` is empty and not loading. |
|
|
69
71
|
|
|
70
72
|
**STable events**
|
|
@@ -86,14 +88,15 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsTable.d.ts`. The
|
|
|
86
88
|
- `items`: Row objects
|
|
87
89
|
- `itemKey`: Field used to match **expanded** rows (default: first header's `value`)
|
|
88
90
|
- `dense`: Compact cells
|
|
89
|
-
- `loading`: Indeterminate progress bar. Hides the no-data row
|
|
91
|
+
- `loading`: Indeterminate progress bar. Hides the no-data row; while `items` is still empty it shows a full-width loading row instead
|
|
92
|
+
- `loadingText`: Text of that loading row (`#loadingData` slot overrides it) (default: i18n `table.loading` → `'Loading…'`)
|
|
90
93
|
- `outlined` / `underlined`: Border styles
|
|
91
94
|
- `rounded` / `tile`: Declared, but **no effect** (the table never reads them)
|
|
92
95
|
- `hideHeader`: Hide `<thead>`
|
|
93
96
|
- `hideVerticalBorders`: Remove column borders
|
|
94
97
|
- `hideTopBottomBorders`: Remove outer top/bottom borders
|
|
95
98
|
- `hidePagination`: Hides the pager only when `itemsPerPage` is unset or greater than the total
|
|
96
|
-
- `stickyHeader`: Sticky header row
|
|
99
|
+
- `stickyHeader`: Sticky header row. Give the table a height limit (`style="max-height: 400px"` or a `height`): the rows scroll inside the table, the header sticks and the pagination stays visible below
|
|
97
100
|
- `multiSort`: Sort by several columns
|
|
98
101
|
- `groupBy`: Group rows by item field(s). Group name = values joined with a space
|
|
99
102
|
- `foldable`: Clicking a group row collapses or expands it
|
|
@@ -121,7 +124,8 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsTable.d.ts`. The
|
|
|
121
124
|
- `group` (slot): Group row content (default: the group name)
|
|
122
125
|
- `itemHeader` / `itemFooter` (slot): Full-width rows from `itemHeader`/`itemFooter`
|
|
123
126
|
- `expanded` (slot): Content of an expanded row
|
|
124
|
-
- `noData` (slot): Empty state
|
|
127
|
+
- `noData` (slot): Empty state — put an `SEmptyState` here for an icon, title or action: `<template #noData><SEmptyState size="small" icon="mdi-cart-outline" title="No orders yet" /></template>`
|
|
128
|
+
- `loadingData` (slot): Loading row, shown while `loading` is set and `items` is empty
|
|
125
129
|
- `itemsPerPageLabel` (slot): Pager label
|
|
126
130
|
|
|
127
131
|
### TableHeader
|
|
@@ -203,6 +207,7 @@ const perPage = ref(10)
|
|
|
203
207
|
|
|
204
208
|
| ❌ | ✅ |
|
|
205
209
|
|----|----|
|
|
210
|
+
| A hand-made `<div><SIcon …/><p>No data</p></div>` in `#noData` | `<SEmptyState size="small" icon="…" title="…" />` in `#noData` |
|
|
206
211
|
| `{ key: 'name', title: 'Name' }` | `{ text: 'Name', value: 'name' }`. Using `key` throws a `TypeError` (`value` is undefined) |
|
|
207
212
|
| `#item.name` slot with a header whose `value` is not `'name'` | The slot suffix is the header's `value` |
|
|
208
213
|
| Expecting a built-in checkbox column with `v-model:selected` | No select column exists. Render one with `select` / `isSelected` from the slot scope |
|
|
@@ -211,3 +216,5 @@ const perPage = ref(10)
|
|
|
211
216
|
| Waiting for `update:options` to fetch on sort change | It fires only for page/page-size changes. Sorting is always client-side |
|
|
212
217
|
| Rebuilding item objects and expecting `selected` to persist | Selection matches by **object identity** (`itemKey` applies only to expansion) |
|
|
213
218
|
| Buttons inside a row also trigger `click:row` | Use `@click.stop` |
|
|
219
|
+
| Using `STable` without importing it (registered globally with `app.component` and no `GlobalComponents` types) and expecting typed `#item.<value>` slots | The slot `item` is typed from `items` only when the template knows the component type: import `STable` from `@khsura/sui` in the SFC (Nuxt's generated component types also work). Otherwise `item` is `any` |
|
|
220
|
+
| Wrapping `STable` in a fixed-height `div` to get a sticky header | Put the height limit on `STable` itself. Older versions clipped the rows and the pagination instead of scrolling them |
|
|
@@ -6,6 +6,8 @@ Single-select tab strip, built on the toggle-button group. It renders only the t
|
|
|
6
6
|
|
|
7
7
|
Types: `node_modules/@khsura/sui/@types/definitions/props/propsTabs.d.ts`, `propsTab.d.ts`
|
|
8
8
|
|
|
9
|
+
The tabs stay on **one row**. Each tab keeps the width of its label (tabs stretch to fill spare room), and when they do not fit, the row scrolls sideways (touch, trackpad, shift+wheel) with no scrollbar. An end that hides tabs fades out, so on a phone the row visibly scrolls (swipe it) instead of looking clipped; when every tab fits there is no fade. `show-arrows` adds a scroll arrow at each end that hides tabs (pointer only); `wrap` lays the tabs out on several rows instead. The selected tab is scrolled into view on mount and whenever the selection changes. Don't wrap `STabs` in `SSlideGroup` or add `overflow-x: auto` yourself. (Older versions always wrapped the tabs onto several rows on phones; `wrap` keeps that layout.)
|
|
10
|
+
|
|
9
11
|
---
|
|
10
12
|
|
|
11
13
|
## STabs
|
|
@@ -15,16 +17,18 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsTabs.d.ts`, `prop
|
|
|
15
17
|
|
|
16
18
|
**STabs props**
|
|
17
19
|
|
|
18
|
-
| Prop | Type | Default | Required | Values |
|
|
19
|
-
| --- | --- | --- | --- | --- |
|
|
20
|
-
| `borderRadius` | `` number \| "
|
|
21
|
-
| `bordered` | `boolean` | — | no | — |
|
|
22
|
-
| `dense` | `boolean` | — | no | — |
|
|
23
|
-
| `modelValue` | `
|
|
24
|
-
| `outlined` | `boolean \| null` | — | no | — |
|
|
25
|
-
| `selectedTabColor` | `string` | `"primary"` | no | — |
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
20
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
21
|
+
| --- | --- | --- | --- | --- | --- |
|
|
22
|
+
| `borderRadius` | `` number \| "rounded" \| "tile" \| `${number}%` \| `${number}em` \| `${number}px` \| `${number}rem` \| `${number}vh` \| `${number}vw` \| null `` | — | no | — | — |
|
|
23
|
+
| `bordered` | `boolean` | — | no | — | — |
|
|
24
|
+
| `dense` | `boolean` | — | no | — | — |
|
|
25
|
+
| `modelValue` | `number \| string` | — | yes | — | — |
|
|
26
|
+
| `outlined` | `boolean \| null` | — | no | — | — |
|
|
27
|
+
| `selectedTabColor` | `string` | `"primary"` | no | — | — |
|
|
28
|
+
| `showArrows` | `boolean` | — | no | — | Show a scroll arrow at each end of the row that hides tabs (pointer only; the row still swipes). Ignored with `wrap`. |
|
|
29
|
+
| `shrink` | `boolean` | — | no | — | — |
|
|
30
|
+
| `underlined` | `boolean \| null` | — | no | — | — |
|
|
31
|
+
| `wrap` | `boolean` | — | no | — | Lay the tabs out on several rows when they do not fit, instead of one row that scrolls sideways. |
|
|
28
32
|
|
|
29
33
|
**STabs slots**
|
|
30
34
|
|
|
@@ -66,16 +70,16 @@ Always exactly one tab active (mandatory, single-select).
|
|
|
66
70
|
|
|
67
71
|
| Prop | Type | Default | Required | Values |
|
|
68
72
|
| --- | --- | --- | --- | --- |
|
|
69
|
-
| `alignSelf` | `"
|
|
73
|
+
| `alignSelf` | `"auto" \| "baseline" \| "center" \| "end" \| "first baseline" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "last baseline" \| "normal" \| "safe center" \| "self-end" \| "self-start" \| "start" \| "stretch" \| "unsafe center" \| null` | — | no | `auto`, `baseline`, `center`, `end`, `first baseline`, `flex-end`, `flex-start`, `inherit`, `initial`, `last baseline`, `normal`, `safe center`, `self-end`, `self-start`, `start`, `stretch`, `unsafe center` |
|
|
70
74
|
| `cols` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
71
|
-
| `contentClass` | `string \|
|
|
75
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — |
|
|
72
76
|
| `contentStyle` | `StyleValue` | — | no | — |
|
|
73
77
|
| `disabled` | `boolean` | — | no | — |
|
|
74
78
|
| `lg` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
75
79
|
| `md` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
76
80
|
| `order` | `number \| null` | — | no | — |
|
|
77
81
|
| `sm` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
78
|
-
| `tab` | `
|
|
82
|
+
| `tab` | `number \| string` | — | yes | — |
|
|
79
83
|
|
|
80
84
|
**STab slots**
|
|
81
85
|
|
|
@@ -130,4 +134,6 @@ const active = ref<'overview' | 'api'>('overview')
|
|
|
130
134
|
| `<STab value="a">` / `<STab :index="0">` | `<STab tab="a">`. The identifier prop is `tab` |
|
|
131
135
|
| `<STabs>` without `v-model` | `modelValue` is required |
|
|
132
136
|
| Panels that slide between tabs | Bind the same model to [SWindow](./window.md) with `SWindowItem value` = the `STab tab` |
|
|
137
|
+
| Many tabs on a phone wrapping onto several rows | By default the row scrolls sideways (swipe); set `wrap` to keep the several-row layout. Keep labels short either way |
|
|
138
|
+
| `shrink`, `cols`, a wrapper or CSS truncation to fit tabs on a 375px phone | The plain `<STabs v-model><STab v-for … :tab>` setup: tabs that do not fit scroll sideways with an edge fade (or set `wrap` for several rows). See the `tabbed-sections` recipe |
|
|
133
139
|
| `underlined` to get an active underline | It styles the strip's border. Use `selectedTabColor` for the active state |
|
|
@@ -17,7 +17,7 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsToggleButtonGroup
|
|
|
17
17
|
|
|
18
18
|
| Prop | Type | Default | Required | Values |
|
|
19
19
|
| --- | --- | --- | --- | --- |
|
|
20
|
-
| `borderRadius` | `` number \| "
|
|
20
|
+
| `borderRadius` | `` number \| "rounded" \| "tile" \| `${number}%` \| `${number}em` \| `${number}px` \| `${number}rem` \| `${number}vh` \| `${number}vw` \| null `` | — | no | — |
|
|
21
21
|
| `bordered` | `boolean` | — | no | — |
|
|
22
22
|
| `dense` | `boolean` | — | no | — |
|
|
23
23
|
| `mandatory` | `boolean` | — | no | — |
|
|
@@ -28,13 +28,14 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsToggleButtonGroup
|
|
|
28
28
|
| `selectedColor` | `string` | `"primary"` | no | — |
|
|
29
29
|
| `shrink` | `boolean` | — | no | — |
|
|
30
30
|
| `underlined` | `boolean \| null` | — | no | — |
|
|
31
|
-
| `variant` | `"
|
|
31
|
+
| `variant` | `"inset" \| "underlined" \| null` | — | no | `inset`, `underlined` |
|
|
32
32
|
|
|
33
33
|
**SToggleButtonGroup slots**
|
|
34
34
|
|
|
35
35
|
| Slot | Slot props |
|
|
36
36
|
| --- | --- |
|
|
37
37
|
| `default` | `{}` |
|
|
38
|
+
| `overlay` | `{}` |
|
|
38
39
|
|
|
39
40
|
**SToggleButtonGroup events**
|
|
40
41
|
|
|
@@ -76,9 +77,9 @@ Must be inside `SToggleButtonGroup` (throws otherwise).
|
|
|
76
77
|
| Prop | Type | Default | Required | Values |
|
|
77
78
|
| --- | --- | --- | --- | --- |
|
|
78
79
|
| `activeClass` | `string \| null` | — | no | — |
|
|
79
|
-
| `alignSelf` | `"
|
|
80
|
+
| `alignSelf` | `"auto" \| "baseline" \| "center" \| "end" \| "first baseline" \| "flex-end" \| "flex-start" \| "inherit" \| "initial" \| "last baseline" \| "normal" \| "safe center" \| "self-end" \| "self-start" \| "start" \| "stretch" \| "unsafe center" \| null` | — | no | `auto`, `baseline`, `center`, `end`, `first baseline`, `flex-end`, `flex-start`, `inherit`, `initial`, `last baseline`, `normal`, `safe center`, `self-end`, `self-start`, `start`, `stretch`, `unsafe center` |
|
|
80
81
|
| `cols` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
81
|
-
| `contentClass` | `string \|
|
|
82
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — |
|
|
82
83
|
| `contentStyle` | `StyleValue` | — | no | — |
|
|
83
84
|
| `disabled` | `boolean` | — | no | — |
|
|
84
85
|
| `index` | `GroupItemValue \| null` | — | no | — |
|
|
@@ -17,18 +17,18 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsToolbar.d.ts`, `p
|
|
|
17
17
|
|
|
18
18
|
| Prop | Type | Default | Required | Values |
|
|
19
19
|
| --- | --- | --- | --- | --- |
|
|
20
|
-
| `borderRadius` | `` number \| "
|
|
20
|
+
| `borderRadius` | `` number \| "rounded" \| "tile" \| `${number}%` \| `${number}em` \| `${number}px` \| `${number}rem` \| `${number}vh` \| `${number}vw` \| null `` | — | no | — |
|
|
21
21
|
| `color` | `string` | — | no | — |
|
|
22
22
|
| `colorThreshold` | `number` | — | no | — |
|
|
23
|
-
| `contentClass` | `string \|
|
|
23
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — |
|
|
24
24
|
| `contentStyle` | `StyleValue` | — | no | — |
|
|
25
25
|
| `density` | `ToolbarDensityType \| null` | — | no | `comfortable`, `compact`, `default` |
|
|
26
|
-
| `elevation` | `"" \|
|
|
26
|
+
| `elevation` | `"" \| "1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| "13" \| "14" \| "15" \| "16" \| "17" \| "18" \| "19" \| "20" \| "21" \| "22" \| "23" \| "24" \| 0 \| 1 \| 2 \| 3 \| 4 \| 5 \| 6 \| 7 \| 8 \| 9 \| 10 \| 11 \| 12 \| 13 \| 14 \| 15 \| 16 \| 17 \| 18 \| 19 \| 20 \| 21 \| 22 \| 23 \| 24 \| null` | — | no | — |
|
|
27
27
|
| `extended` | `boolean \| null` | — | no | — |
|
|
28
28
|
| `extensionClass` | `string \| Record<string, boolean \| undefined>` | — | no | — |
|
|
29
|
-
| `extensionHeight` | `
|
|
29
|
+
| `extensionHeight` | `number \| string` | `defaultToolbarExtensionHeight` | no | — |
|
|
30
30
|
| `extensionStyle` | `Record<string, string>` | — | no | — |
|
|
31
|
-
| `height` | `
|
|
31
|
+
| `height` | `number \| string \| null` | `defaultToolbarContentHeight` | no | — |
|
|
32
32
|
| `outlined` | `boolean \| null` | — | no | — |
|
|
33
33
|
| `position` | `Position` | — | no | `absolute`, `fixed`, `relative`, `static`, `sticky` |
|
|
34
34
|
| `tag` | `HtmlTagName \| null` | — | no | `a`, `abbr`, `acronym`, `address`, `applet`, `area`, `article`, `aside`, `audio`, `b`, `base`, `basefont`, `bdi`, `bdo`, `big`, `blockquote`, `body`, `br`, `button`, `canvas`, `caption`, `center`, `cite`, `code`, `col`, `colgroup`, `data`, `datalist`, `dd`, `del`, `details`, `dfn`, `dialog`, `dir`, `div`, `dl`, `dt`, `em`, `embed`, `fieldset`, `figcaption`, `figure`, `font`, `footer`, `form`, `frame`, `frameset`, `h1`, `h1> to <h6`, `h2`, `h3`, `h4`, `h5`, `h6`, `head`, `header`, `hr`, `html`, `i`, `iframe`, `img`, `input`, `ins`, `kbd`, `label`, `legend`, `li`, `link`, `main`, `map`, `mark`, `meta`, `meter`, `nav`, `noframes`, `noscript`, `object`, `ol`, `optgroup`, `option`, `output`, `p`, `param`, `picture`, `pre`, `progress`, `q`, `rp`, `rt`, `ruby`, `s`, `samp`, `script`, `section`, `select`, `small`, `source`, `span`, `strike`, `strong`, `style`, `sub`, `summary`, `sup`, `svg`, `table`, `tbody`, `td`, `template`, `textarea`, `tfoot`, `th`, `thead`, `time`, `title`, `tr`, `track`, `tt`, `u`, `ul`, `var`, `video`, `wbr` |
|
|
@@ -13,31 +13,31 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsTooltip.d.ts`
|
|
|
13
13
|
|
|
14
14
|
| Prop | Type | Default | Required | Values |
|
|
15
15
|
| --- | --- | --- | --- | --- |
|
|
16
|
-
| `activator` | `string \|
|
|
16
|
+
| `activator` | `string \| ComponentPublicInstance \| HTMLElement \| null` | — | no | — |
|
|
17
17
|
| `closeOnClick` | `boolean` | — | no | — |
|
|
18
18
|
| `closeOnContentClick` | `boolean` | — | no | — |
|
|
19
19
|
| `closeOnScroll` | `boolean` | — | no | — |
|
|
20
20
|
| `color` | `string` | — | no | — |
|
|
21
21
|
| `colorThreshold` | `number` | — | no | — |
|
|
22
|
-
| `contentClass` | `string \|
|
|
22
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — |
|
|
23
23
|
| `contentStyle` | `StyleValue` | — | no | — |
|
|
24
24
|
| `disabled` | `boolean \| null` | — | no | — |
|
|
25
|
-
| `height` | `
|
|
25
|
+
| `height` | `number \| string \| null` | — | no | — |
|
|
26
26
|
| `location` | `LocationRaw` | — | no | — |
|
|
27
|
-
| `maxHeight` | `
|
|
28
|
-
| `maxWidth` | `
|
|
29
|
-
| `minHeight` | `
|
|
30
|
-
| `minWidth` | `
|
|
27
|
+
| `maxHeight` | `number \| string \| null` | — | no | — |
|
|
28
|
+
| `maxWidth` | `number \| string \| null` | — | no | — |
|
|
29
|
+
| `minHeight` | `number \| string \| null` | — | no | — |
|
|
30
|
+
| `minWidth` | `number \| string \| null` | — | no | — |
|
|
31
31
|
| `modelValue` | `boolean` | — | no | — |
|
|
32
32
|
| `offsetX` | `number \| null` | — | no | — |
|
|
33
33
|
| `offsetY` | `number \| null` | — | no | — |
|
|
34
|
-
| `opacity` | `
|
|
34
|
+
| `opacity` | `number \| string` | — | no | — |
|
|
35
35
|
| `position` | `Position` | — | no | `absolute`, `fixed`, `relative`, `static`, `sticky` |
|
|
36
36
|
| `preventCloseOnClick` | `boolean` | — | no | — |
|
|
37
37
|
| `readonly` | `boolean \| null` | — | no | — |
|
|
38
38
|
| `screenPadding` | `number \| null` | — | no | — |
|
|
39
39
|
| `theme` | `AppThemeType` | — | no | `dark`, `light` |
|
|
40
|
-
| `width` | `
|
|
40
|
+
| `width` | `number \| string \| null` | — | no | — |
|
|
41
41
|
|
|
42
42
|
**STooltip slots**
|
|
43
43
|
|
|
@@ -98,5 +98,6 @@ Other `SMenu` props are accepted by the types but are not meaningful for a toolt
|
|
|
98
98
|
| `disabled` to suppress the tooltip | Not supported — hover still opens it; use `v-if` on the tooltip |
|
|
99
99
|
|
|
100
100
|
- The activator wrapper is a block `<div>`; wrap inline text if layout matters.
|
|
101
|
+
- Long text wraps at 320px (less on narrow screens), and the tooltip flips or shifts to stay 8px inside the viewport.
|
|
101
102
|
- The app must be wrapped in `<SApp>` (tooltips teleport into its overlay container).
|
|
102
103
|
- `opacity` appears in the prop types but has no effect.
|
|
@@ -69,7 +69,7 @@ Shows one panel at a time with a slide transition, arrows and swipe. Use it for
|
|
|
69
69
|
| --- | --- | --- | --- | --- |
|
|
70
70
|
| `activeClass` | `string \| null` | — | no | — |
|
|
71
71
|
| `selected` | `boolean` | — | no | — |
|
|
72
|
-
| `value` | `
|
|
72
|
+
| `value` | `boolean \| number \| string` | — | no | — |
|
|
73
73
|
|
|
74
74
|
**SWindowItem slots**
|
|
75
75
|
|
|
@@ -87,6 +87,11 @@ None.
|
|
|
87
87
|
|
|
88
88
|
- `value`: Identifier matched against the window's `v-model`
|
|
89
89
|
|
|
90
|
+
**Sizing**
|
|
91
|
+
|
|
92
|
+
- Without a `height`, `SWindow` takes the height of the active `SWindowItem`, so tab panels need no height. Set `height` only when every panel must be the same size (for example a fixed-height slideshow).
|
|
93
|
+
- `@khsura/sui` 1.19.0 and earlier rendered a window without `height` at 0 height (all items were absolutely positioned). On those versions set a `height`, or use `v-show` panels instead.
|
|
94
|
+
|
|
90
95
|
## Template ref
|
|
91
96
|
|
|
92
97
|
The component also exposes `goNext()` and `goPrev()` through a template ref.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sui-form
|
|
3
|
-
description: Build validated forms in a Vue or Nuxt app with @khsura/sui — SForm, SInput, STextarea, SSelect, SAutocomplete, SCheckbox, SRadioGroup/SRadio, SSwitch, SDatePickerInput. Use when creating a form, login/registration/settings/data-entry UI, adding validation rules (inline or the i18n-backed getFormInputModelValueRules), handling submit with SForm.validate(), async/searchable selects, or fixing a SUI form whose validation, error display or v-model doesn't behave.
|
|
3
|
+
description: Build validated forms in a Vue or Nuxt app with @khsura/sui — SForm, SInput, SNumberInput, STextarea, SSelect, SAutocomplete, SCheckbox, SRadioGroup/SRadio, SSwitch, SDatePickerInput. Use when creating a form, login/registration/settings/data-entry UI, adding validation rules (inline or the i18n-backed getFormInputModelValueRules), handling submit with SForm.validate(), async/searchable selects, or fixing a SUI form whose validation, error display or v-model doesn't behave.
|
|
4
4
|
argument-hint: [describe the form fields and purpose]
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -18,17 +18,18 @@ Then generate a complete Vue SFC using these rules:
|
|
|
18
18
|
**Form rules:**
|
|
19
19
|
|
|
20
20
|
- Wrap everything in `<SForm ref="formRef" @submit.prevent="submit">` and validate in `submit` (see **SForm.validate()** below — its return value is inverted from what you'd expect)
|
|
21
|
+
- `SForm` renders `<form novalidate>`: the SUI `rules` are the only validation, so `type="email"`, `required` or `pattern` never pop the browser's own bubble over the SUI error. Validate emails with a rule. `:novalidate="false"` turns native validation back on. Before 1.20.0 `SForm` did not add `novalidate`; add it yourself there
|
|
22
|
+
- Every validated field reserves one line under itself for its error message, so the rhythm stays even when errors appear. For an action row (a field next to a button: a search bar, a filter bar), wrap the fields and buttons in `<SFormRow>`: each button lines up with the field box, with or without a label and while an error shows, and the row wraps on a phone. Never use a plain flex `<div>` there (the button lines up with the label); before 1.20.0, without `SFormRow`, put `hide-details` on the field. `SCheckbox` keeps its label with `hide-details` (before 1.20.0 it hid it; use `hide-error` there)
|
|
23
|
+
- Bind an empty `SDatePickerInput` as `''` or `null` — both mean "no date" (before 1.20.0 `''` opened on "Invalid date"; use `null` there)
|
|
21
24
|
- Use `SInput` for text/email/password/number — always include `label` and `v-model`
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- Use `STextarea` for multi-line text (add `autogrow` if height should expand — all lowercase, not `auto-grow`)
|
|
25
|
-
- Use `SSelect` for a plain single-value dropdown — `items` must be `SelectItem[]` or `string[]`. Type `SelectItem` from `@khsura/sui` (`text`, `value`, optional `disabled`). **SSelect has no `multiple`, `chips`, `clearable` or `placeholder`** — when you need any of those, use `SAutocomplete`.
|
|
25
|
+
- Use `STextarea` for multi-line text (add `autogrow` if height should expand — all lowercase, not `auto-grow`). For a character count use its `counter` prop (with `maxlength`: `12 / 200`), never a `<p>` after the field — that lands below the reserved error line, far from the field
|
|
26
|
+
- Use `SSelect` for a plain single-value dropdown — `items` must be `SelectItem[]` or `string[]`. Type `SelectItem` from `@khsura/sui` (`text`, `value`, optional `disabled`). It is outlined like `SInput` by default, never repeats its `label` inside the field (use `placeholder` for an empty-state hint) and is as wide as its longest option — add `grow` for full width. **SSelect has no `multiple`, `chips` or `clearable`** — when you need any of those, use `SAutocomplete`.
|
|
26
27
|
- Use `SAutocomplete` for searchable, clearable or multi-select — same `items` shape, add `multiple chips closable-chips` for multi-select. **It has no `rules` and does not register with `SForm`** — check its value yourself in `submit`
|
|
27
|
-
- Use `SCheckbox` for a single boolean — `label` prop, not slot. It has no `value`/`indeterminate`, so build checkbox groups from several boolean models
|
|
28
|
+
- Use `SCheckbox` for a single boolean — `label` prop, not slot. Its error line sits under the box and reserves the same space as under an input, and it keeps an 8px gap above the box (both dropped with `hide-details`). It has no `value`/`indeterminate`, so build checkbox groups from several boolean models
|
|
28
29
|
- Use `SRadioGroup` with `<SRadio value="..." label="...">` children (slot-based); use `column` for vertical layout
|
|
29
30
|
- Use `SSwitch` for on/off toggles — it never runs `rules`, shows no error and is not validated by `SForm`
|
|
30
|
-
- Submit: `<SButton type="submit" color="primary" :loading="submitting">Submit</SButton>`
|
|
31
|
-
- `:loading` on `SButton` implicitly disables it — do not also
|
|
31
|
+
- Submit: `<SButton type="submit" color="primary" class="s_mt__2" :loading="submitting">Submit</SButton>` — `s_mt__2` keeps the last field's error message off the button
|
|
32
|
+
- `:loading` on `SButton` implicitly disables it — do not also bind `:disabled` to the submitting flag
|
|
32
33
|
|
|
33
34
|
**Validation rules signature:** `(value: unknown) => true | string`
|
|
34
35
|
|
|
@@ -59,20 +60,24 @@ if (hasErrors) return
|
|
|
59
60
|
- `v-model:error="hasError"` — `true` while any input has an error
|
|
60
61
|
- `v-model:errors="messages"` — all current error strings
|
|
61
62
|
|
|
62
|
-
Use
|
|
63
|
+
Use `v-model:error` to disable the submit button **only after a failed submit**: set `submitAttempted = true` in `submit` and bind `:disabled="submitAttempted && hasError"`; it re-enables as soon as every rule passes. Never disable it from page load (a disabled button gives no reason and cannot be focused), and keep the inline errors so users see why. `resetValidation()` (exposed) clears every input's errors.
|
|
63
64
|
|
|
64
65
|
---
|
|
65
66
|
|
|
66
67
|
## `hideDetails` vs `hideError`
|
|
67
68
|
|
|
68
|
-
| Prop | Hides the label | Hides the error message | Red error frame |
|
|
69
|
-
| ------------- |
|
|
70
|
-
| _(neither)_ | no
|
|
71
|
-
| `hideError` | no
|
|
72
|
-
| `hideDetails` | **yes**
|
|
69
|
+
| Prop | Hides the label above the field | Hides the error message | Red error frame |
|
|
70
|
+
| ------------- | ------------------------------- | ----------------------- | --------------------- |
|
|
71
|
+
| _(neither)_ | no | no | shown |
|
|
72
|
+
| `hideError` | no | **yes** | shown |
|
|
73
|
+
| `hideDetails` | **yes** | **yes** | shown |
|
|
74
|
+
|
|
75
|
+
`SCheckbox` and `SRadio` labels are the control's own text, not a label above a field: `hideDetails` keeps them and only removes the error area.
|
|
73
76
|
|
|
74
77
|
- Use **`hideError`** when you only want to drop the message line (dense tables, inline filters) but keep the label.
|
|
75
78
|
- Use **`hideDetails`** only when the field should have no label either — it is not a "compact" switch. On `SCheckbox` the label is the only text, so `hideDetails` leaves a bare box ("Remember me" disappears); use `hideError` there.
|
|
79
|
+
- With `hideDetails` the hidden label still names the field (it becomes the control's `aria-label`). On screen only the placeholder (or slot content) is left, so make the placeholder say what the field is for (`label="Search" placeholder="Search by name"`, not `placeholder="e.g. Anna"`); `validate_sui_template` warns otherwise (`hidden-label-no-visible-name`). A field with no `label` at all needs `aria-label` (`ariaLabel` on SInput, STextarea, SSelect, SAutocomplete; on each SRadio without a `label`).
|
|
80
|
+
- Labels, ids and errors are wired for you: an `id` is generated when you don't pass one, and an invalid field gets `aria-invalid` and `aria-describedby` pointing at its error message. Don't add your own `<label for>` or `aria-describedby`.
|
|
76
81
|
- The field frame turns red on error even with either flag set (`SInput`, `STextarea`, `SSelect`, `SCheckbox`, `SRadioGroup`, `SDatePickerInput`), so users can still see which field is invalid. Don't add your own `:deep()` error border.
|
|
77
82
|
|
|
78
83
|
---
|
|
@@ -138,13 +143,14 @@ const numeric = (v: string) => /^\d+$/.test(v) || 'Must be a number'
|
|
|
138
143
|
|
|
139
144
|
Use this to choose the right component and props for each field.
|
|
140
145
|
|
|
141
|
-
**Common to the validated inputs** (`SInput`, `STextarea`, `SSelect`, `SCheckbox`, `SRadioGroup`, `SDatePickerInput`): `label`, `rules`, `disabled`, `hideDetails`, `hideError`, `error`, `dirty`, `id`. `SAutocomplete` and `SSwitch` don't run rules.
|
|
146
|
+
**Common to the validated inputs** (`SInput`, `SNumberInput`, `STextarea`, `SSelect`, `SCheckbox`, `SRadioGroup`, `SDatePickerInput`): `label`, `rules`, `disabled`, `hideDetails`, `hideError`, `error`, `dirty`, `id`. `SAutocomplete` and `SSwitch` don't run rules.
|
|
142
147
|
|
|
143
148
|
| Component | v-model | Key props | When to use |
|
|
144
149
|
| ----------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------- |
|
|
145
150
|
| **SInput** | `string \| number` | `label`, `type` (`text` \| `email` \| `password` \| `number` \| `tel` \| `url` \| `search`), `placeholder`, `suffix`, `dense`, `readonly`, `max`/`min`, `maxlength`/`minlength`, `inputmode` (`numeric` \| `decimal` \| `email` \| `tel`), `positive` / `allowDecimal` (numbers), `size` | Single-line text, email, password, number |
|
|
146
|
-
| **
|
|
147
|
-
| **
|
|
151
|
+
| **SNumberInput** | `number \| null` | `label`, `min`/`max`, `step`, `precision` (decimals; default `0`, `2` for money, `null` for any), `controlVariant` (`stacked` \| `split`), `hideControls`, `prefix`/`suffix`, `textRight`, `placeholder`, `readonly`, `dense`, `tile`, `size` | Quantities, amounts, percentages: any number (since 1.21.0) |
|
|
152
|
+
| **STextarea** | `string` | `label`, `placeholder`, `rows`, `cols`, `autogrow`, `resize`, `counter`, `dense`, `tile`, `maxlength`/`minlength`, `readonly` | Multi-line text |
|
|
153
|
+
| **SSelect** | `string \| number` | `items`: `SelectItem[]` or `string[]` (type from `@khsura/sui`: `text`, `value`, optional `disabled`). Also `label`, `placeholder`, `dense`, `grow`, `text`, `divided`, `color`, `outlined` (default `true`)/`underlined`/`borderRadius`. **No** `multiple`/`chips`/`clearable` | Single-value dropdown |
|
|
148
154
|
| **SAutocomplete** | `any` or `any[]` | Same `items` as SSelect; + `multiple`, `chips`, `closableChips`, `clearable`, `placeholder`, `filter`, `filterMode`, `debounce`, `loading`, `allowUnlisted`, `delimiter`. `debounce` defaults to 500 ms. Events: **`@search-item`** (search text, for async options), **`@create-item`** (with `allowUnlisted`). No `rules`; `disabled` does not disable its text field | Searchable / multi / async select |
|
|
149
155
|
| **SCheckbox** | `boolean` | `label`, `color`, `size` (`'default'` \| `'large'`), `block`, `bordered`, `readonly` | Single boolean |
|
|
150
156
|
| **SRadioGroup** | `any` | Slot content: `<SRadio value="..." label="...">` children (no `items` prop). Props: `column`, `grow`, `color`, `name` | Single choice from list |
|
|
@@ -155,6 +161,8 @@ Use this to choose the right component and props for each field.
|
|
|
155
161
|
|
|
156
162
|
**SAutocomplete async search:** listen to `@search-item`, not `@update:search-input` (that name is accepted by the typings but never emitted).
|
|
157
163
|
|
|
164
|
+
**Numbers: prefer `SNumberInput`** (since `@khsura/sui` 1.21.0). It writes `number | null`, steps with +/- buttons and ArrowUp/ArrowDown, keeps `precision` decimals, clamps to `min`/`max` on blur and has spinbutton semantics. It renders `type="text"` with the right `inputmode`, so a browser validation bubble never covers the SUI error inside `SForm`. Older SUI versions don't have it — use SInput `type="number"` there.
|
|
165
|
+
|
|
158
166
|
**SInput `type="number"`:** bind a plain `v-model` — SInput already writes a `number | null` to the model, so `.number` is unnecessary. Use `min`/`max`/`positive` when the value should be clamped while typing; use a rule when the user should see a message instead. Number inputs are **integer-only by default** — `.` is blocked and pasted decimals are rounded; add `allowDecimal` (with `inputmode="decimal"`) to accept decimals, in which case `min`/`positive` are enforced on blur so values like `0.5` can be typed.
|
|
159
167
|
|
|
160
168
|
**Imports:** form components and `getFormInputModelValueRules` from `@khsura/sui`.
|