@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.
Files changed (180) hide show
  1. package/@types/components/avatar/index.d.ts +2 -0
  2. package/@types/components/avatar/sAvatar.vue.d.ts +13 -0
  3. package/@types/components/avatar/sAvatarGroup.vue.d.ts +16 -0
  4. package/@types/components/cards/sCardText.vue.d.ts +2 -2
  5. package/@types/components/datePicker/sDatePickerSwitch.vue.d.ts +2 -0
  6. package/@types/components/form/index.d.ts +2 -0
  7. package/@types/components/form/radio/sRadio.vue.d.ts +3 -0
  8. package/@types/components/form/sFormRow.vue.d.ts +18 -0
  9. package/@types/components/form/sInput.vue.d.ts +1 -0
  10. package/@types/components/form/sNumberInput.vue.d.ts +29 -0
  11. package/@types/components/form/sSelect.vue.d.ts +10 -3
  12. package/@types/components/index.d.ts +5 -0
  13. package/@types/components/layout/sNavigationDrawer.vue.d.ts +6 -6
  14. package/@types/components/progress/sProgressCircular.vue.d.ts +1 -0
  15. package/@types/components/progress/sProgressLinear.vue.d.ts +1 -0
  16. package/@types/components/sAutocomplete.vue.d.ts +11 -1
  17. package/@types/components/sEmptyState.vue.d.ts +26 -0
  18. package/@types/components/sFileInput.vue.d.ts +35 -0
  19. package/@types/components/sPagination.vue.d.ts +21 -0
  20. package/@types/components/sSkeletonLoader.vue.d.ts +19 -0
  21. package/@types/components/slideGroup/sSlideGroup.vue.d.ts +4 -1
  22. package/@types/components/table/sTable.vue.d.ts +2 -0
  23. package/@types/components/tabs/sTabs.vue.d.ts +2 -2
  24. package/@types/components/toggleButtonGroup/sToggleButtonGroup.vue.d.ts +2 -0
  25. package/@types/configs/app.d.ts +4 -0
  26. package/@types/configs/fileInput.d.ts +5 -0
  27. package/@types/configs/i18n.d.ts +3 -0
  28. package/@types/configs/index.d.ts +2 -0
  29. package/@types/configs/provider.d.ts +2 -0
  30. package/@types/configs/skeletonLoader.d.ts +57 -0
  31. package/@types/constants/avatar.d.ts +3 -0
  32. package/@types/constants/color.d.ts +15 -0
  33. package/@types/constants/cssVariables.d.ts +4 -0
  34. package/@types/constants/datePicker.d.ts +7 -0
  35. package/@types/constants/fileInput.d.ts +31 -0
  36. package/@types/constants/i18n.d.ts +3 -0
  37. package/@types/constants/index.d.ts +8 -0
  38. package/@types/constants/keyboard.d.ts +12 -0
  39. package/@types/constants/layout.d.ts +2 -0
  40. package/@types/constants/listbox.d.ts +1 -0
  41. package/@types/constants/numberInput.d.ts +22 -0
  42. package/@types/constants/overlay.d.ts +5 -0
  43. package/@types/constants/pagination.d.ts +20 -0
  44. package/@types/constants/skeletonLoader.d.ts +33 -0
  45. package/@types/constants/tabs.d.ts +10 -0
  46. package/@types/definitions/props/core/propsLink.d.ts +2 -2
  47. package/@types/definitions/props/index.d.ts +7 -0
  48. package/@types/definitions/props/propsAutocomplete.d.ts +8 -0
  49. package/@types/definitions/props/propsAvatar.d.ts +13 -0
  50. package/@types/definitions/props/propsAvatarGroup.d.ts +8 -0
  51. package/@types/definitions/props/propsEmptyState.d.ts +17 -0
  52. package/@types/definitions/props/propsFileInput.d.ts +41 -0
  53. package/@types/definitions/props/propsInput.d.ts +1 -0
  54. package/@types/definitions/props/propsLink.d.ts +2 -2
  55. package/@types/definitions/props/propsNumberInput.d.ts +46 -0
  56. package/@types/definitions/props/propsPagination.d.ts +32 -0
  57. package/@types/definitions/props/propsProgressCircular.d.ts +2 -0
  58. package/@types/definitions/props/propsProgressLinear.d.ts +2 -0
  59. package/@types/definitions/props/propsRow.d.ts +1 -0
  60. package/@types/definitions/props/propsSelect.d.ts +6 -0
  61. package/@types/definitions/props/propsSkeletonLoader.d.ts +18 -0
  62. package/@types/definitions/props/propsSlideGroup.d.ts +4 -0
  63. package/@types/definitions/props/propsTable.d.ts +1 -0
  64. package/@types/definitions/props/propsTabs.d.ts +4 -0
  65. package/@types/definitions/props/propsTextarea.d.ts +3 -0
  66. package/@types/helpers/colorHelpers.d.ts +1 -1
  67. package/@types/helpers/createAppStore.d.ts +4 -0
  68. package/@types/helpers/fileInputRules.d.ts +18 -0
  69. package/@types/helpers/index.d.ts +1 -0
  70. package/@types/lib/color.d.ts +21 -2
  71. package/@types/lib/escapeHtml.d.ts +2 -0
  72. package/@types/lib/flattenVNodes.d.ts +2 -0
  73. package/@types/lib/index.d.ts +7 -0
  74. package/@types/lib/linkLocation.d.ts +9 -0
  75. package/@types/lib/numberInput.d.ts +23 -0
  76. package/@types/lib/overlayPlacement.d.ts +11 -0
  77. package/@types/lib/revealInScroller.d.ts +25 -0
  78. package/@types/lib/safeArea.d.ts +3 -0
  79. package/@types/playwright.visual.config.d.ts +3 -0
  80. package/@types/services/appBarService.d.ts +14 -0
  81. package/@types/services/backgroundScrollService.d.ts +8 -2
  82. package/@types/services/core/layoutCoreService.d.ts +4 -0
  83. package/@types/services/datePicker/datePickerItemDateService.d.ts +1 -0
  84. package/@types/services/dialogService.d.ts +4 -8
  85. package/@types/services/fieldLayoutService.d.ts +19 -0
  86. package/@types/services/formInputService.d.ts +6 -0
  87. package/@types/services/index.d.ts +9 -0
  88. package/@types/services/layoutProviderService.d.ts +6 -0
  89. package/@types/services/layoutService.d.ts +4 -0
  90. package/@types/services/linkService.d.ts +11 -1
  91. package/@types/services/listboxNavigationService.d.ts +20 -0
  92. package/@types/services/menuService.d.ts +2 -0
  93. package/@types/services/overlayFocusService.d.ts +10 -0
  94. package/@types/services/paginationService.d.ts +39 -0
  95. package/@types/services/routerLinkService.d.ts +19 -0
  96. package/@types/services/scrollableFocusService.d.ts +10 -0
  97. package/@types/services/skeletonLoaderService.d.ts +22 -0
  98. package/@types/services/surfaceTextColorService.d.ts +8 -0
  99. package/@types/services/tabsService.d.ts +14 -0
  100. package/@types/store/index.d.ts +1 -0
  101. package/@types/store/scrollLockStore.d.ts +1 -0
  102. package/@types/tests/visual/constants/a11yAudit.d.ts +4 -0
  103. package/@types/tests/visual/constants/index.d.ts +4 -0
  104. package/@types/tests/visual/constants/resizeScroll.d.ts +10 -0
  105. package/@types/tests/visual/constants/storyRender.d.ts +5 -0
  106. package/@types/tests/visual/constants/visualMatrix.d.ts +20 -0
  107. package/@types/tests/visual/schemas/index.d.ts +1 -0
  108. package/@types/tests/visual/schemas/storyIndex.d.ts +17 -0
  109. package/@types/tests/visual/types/a11yAudit.d.ts +2 -0
  110. package/@types/tests/visual/types/index.d.ts +2 -0
  111. package/@types/tests/visual/types/visualStory.d.ts +8 -0
  112. package/@types/types/app.d.ts +2 -0
  113. package/@types/types/breadcrumbs.d.ts +2 -2
  114. package/@types/types/emits.d.ts +12 -0
  115. package/@types/types/fileInput.d.ts +28 -0
  116. package/@types/types/index.d.ts +6 -0
  117. package/@types/types/link.d.ts +20 -0
  118. package/@types/types/menu.d.ts +17 -0
  119. package/@types/types/numberInput.d.ts +12 -0
  120. package/@types/types/pagination.d.ts +17 -0
  121. package/@types/types/safeArea.d.ts +1 -0
  122. package/@types/types/skeletonLoader.d.ts +16 -0
  123. package/@types/vite.config.d.ts +1 -0
  124. package/README.md +12 -0
  125. package/dist/base.css.map +1 -1
  126. package/dist/s-ui.css +1 -1
  127. package/dist/s-ui.js +4792 -3038
  128. package/dist/s-ui.umd.cjs +1 -1
  129. package/dist/styles/components/avatar/_variables.scss +17 -0
  130. package/dist/styles/components/avatar/index.scss +1 -0
  131. package/dist/styles/components/button/mixins.scss +5 -0
  132. package/dist/styles/components/form/_variables.scss +11 -0
  133. package/dist/styles/components/form/index.scss +1 -0
  134. package/dist/styles/components/index.scss +2 -0
  135. package/dist/styles/mixins/_app.scss +7 -0
  136. package/dist/styles/tools/_safeArea.scss +8 -0
  137. package/dist/styles/tools/index.scss +1 -0
  138. package/dist/sui-api.json +1295 -212
  139. package/package.json +15 -4
  140. package/sui-plugin/.claude-plugin/plugin.json +1 -1
  141. package/sui-plugin/skills/sui-component/SKILL.md +21 -6
  142. package/sui-plugin/skills/sui-component/references/autocomplete.md +54 -46
  143. package/sui-plugin/skills/sui-component/references/avatar-group.md +66 -0
  144. package/sui-plugin/skills/sui-component/references/avatar.md +76 -0
  145. package/sui-plugin/skills/sui-component/references/badge.md +4 -4
  146. package/sui-plugin/skills/sui-component/references/breadcrumbs.md +3 -2
  147. package/sui-plugin/skills/sui-component/references/button.md +13 -13
  148. package/sui-plugin/skills/sui-component/references/calendar.md +1 -1
  149. package/sui-plugin/skills/sui-component/references/cards.md +12 -12
  150. package/sui-plugin/skills/sui-component/references/carousel.md +9 -9
  151. package/sui-plugin/skills/sui-component/references/chip.md +1 -1
  152. package/sui-plugin/skills/sui-component/references/date-picker.md +14 -13
  153. package/sui-plugin/skills/sui-component/references/dialog.md +11 -10
  154. package/sui-plugin/skills/sui-component/references/droppable.md +8 -8
  155. package/sui-plugin/skills/sui-component/references/empty-state.md +104 -0
  156. package/sui-plugin/skills/sui-component/references/expansion-panels.md +1 -1
  157. package/sui-plugin/skills/sui-component/references/file-input.md +106 -0
  158. package/sui-plugin/skills/sui-component/references/form.md +155 -105
  159. package/sui-plugin/skills/sui-component/references/image.md +11 -10
  160. package/sui-plugin/skills/sui-component/references/layout.md +53 -49
  161. package/sui-plugin/skills/sui-component/references/list.md +6 -3
  162. package/sui-plugin/skills/sui-component/references/menu.md +12 -9
  163. package/sui-plugin/skills/sui-component/references/number-input.md +102 -0
  164. package/sui-plugin/skills/sui-component/references/pagination.md +83 -0
  165. package/sui-plugin/skills/sui-component/references/progress.md +20 -18
  166. package/sui-plugin/skills/sui-component/references/sheet.md +8 -8
  167. package/sui-plugin/skills/sui-component/references/skeleton-loader.md +75 -0
  168. package/sui-plugin/skills/sui-component/references/slide-group.md +14 -12
  169. package/sui-plugin/skills/sui-component/references/snackbar.md +7 -5
  170. package/sui-plugin/skills/sui-component/references/split-view.md +2 -2
  171. package/sui-plugin/skills/sui-component/references/table.md +10 -3
  172. package/sui-plugin/skills/sui-component/references/tabs.md +19 -13
  173. package/sui-plugin/skills/sui-component/references/toggle-button-group.md +5 -4
  174. package/sui-plugin/skills/sui-component/references/toolbar.md +5 -5
  175. package/sui-plugin/skills/sui-component/references/tooltip.md +10 -9
  176. package/sui-plugin/skills/sui-component/references/window.md +6 -1
  177. package/sui-plugin/skills/sui-form/SKILL.md +25 -17
  178. package/sui-plugin/skills/sui-getting-started/SKILL.md +32 -7
  179. package/sui-plugin/skills/sui-layout/SKILL.md +3 -1
  180. package/sui-plugin/skills/sui-utilities/docs/classes.md +1 -1
@@ -27,7 +27,20 @@ Older versions were published to GitHub Packages. If your project still points t
27
27
  - `.yarnrc.yml` (Yarn 4): delete the `npmScopes.khsura` block (`npmRegistryServer`, `npmAlwaysAuth`, `npmAuthToken`).
28
28
  - CI: the GitHub token secret your install step used for SUI is no longer needed.
29
29
 
30
- `vue`, `vue-i18n` and `dayjs` come in as dependencies of `@khsura/sui`. `@mdi/font` is **not** included — install it yourself (see step 3).
30
+ `vue` is a **peer dependency** (`^3.5.41`): the app provides it. `vue-i18n` and `dayjs` come in as dependencies of `@khsura/sui`. `@mdi/font` is **not** included — install it yourself (see step 3). `vue-router` is **optional**: with it, `to` props render a `router-link`; without it, they render a plain `<a href>`.
31
+
32
+ ### Vue version — 3.5.41 or newer
33
+
34
+ Use **Vue 3.5.41 or newer** in the app — it is the peer range, so npm reports a peer conflict on an older Vue. If the app pins or locks `vue` at 3.5.40 or older, upgrade it (`npm i vue@^3.5.41`). Don't add a second copy of Vue.
35
+
36
+ Vue 3.5.40 and older have a template compiler bug (fixed in vuejs/core#11682). It hits an element in a `v-for` over a constant array that has `:key` and `v-show` and no other dynamic binding: its `v-show` never updates. The usual case is a tab panel per section, and the tabs look broken even though `STabs` updates its `v-model`:
37
+
38
+ ```vue
39
+ <!-- With Vue ≤ 3.5.40 and a `const sections = [...]`, the panels never switch -->
40
+ <section v-for="section in sections" v-show="activeTab === section.key" :key="section.key">
41
+ ```
42
+
43
+ Upgrade Vue. If you can't, render the panels with `SWindow` / `SWindowItem` bound to the same model (it sizes itself to the active panel; on `@khsura/sui` 1.19.0 and earlier give `SWindow` a `height` or it renders at 0 height), or move `:key` to a wrapping `<template v-for="section in sections" :key="section.key">` and keep `v-show` on the element inside it.
31
44
 
32
45
  ---
33
46
 
@@ -64,6 +77,16 @@ import { SApp } from '@khsura/sui'
64
77
 
65
78
  Import components where you use them (Vue): `import { SButton, SCard } from '@khsura/sui'`.
66
79
 
80
+ ### iPhone notch and home indicator — `viewport-fit=cover`
81
+
82
+ For a full-screen app on iPhone (a PWA, a Capacitor/Cordova shell, a web view), opt in to the safe areas in `index.html` (Nuxt: `app.head.meta` in `nuxt.config.ts`):
83
+
84
+ ```html
85
+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
86
+ ```
87
+
88
+ `SApp` then reads `env(safe-area-inset-*)` into `--s-safe-area-top|right|bottom|left`, and these components pad by them: a fixed `SAppBar` (below the notch, plus the side insets in landscape; `SMain` and a desktop drawer start below it), `SBottomNavigation` (grows above the home indicator), the mobile `SNavigationDrawer` (top, bottom and the side it opens from), a `fullscreen` `SDialog` (all sides) and `SSnackbar` (above the home indicator, or below the notch with `location="top"`). Without `viewport-fit=cover`, on desktop and on Android the insets are `0px` and nothing changes. Don't add your own `env(safe-area-inset-*)` padding to these components: it would double the inset. Content you place at a screen edge yourself can use the same variables, e.g. `padding-bottom: var(--s-safe-area-bottom)`.
89
+
67
90
  ---
68
91
 
69
92
  ## 3. Styles and icons
@@ -139,7 +162,8 @@ app.use(
139
162
  ```
140
163
 
141
164
  - **`presetColors` keys:** `primary`, `secondary`, `success`, `info`, `warning`, `important`, `error` — usable as `color="..."` on components. Extra keys you add become usable too.
142
- - **`appColors` keys:** `appBar`, `title`, `text`, `secondaryText`, `anchor`, `background`, `card`, `button`, `switch`, `border`, `disabled`, `snackbar`, `inputPlaceholderShown`, `textErrorHover`.
165
+ - **`appColors` keys:** `appBar`, `title`, `text`, `secondaryText`, `anchor`, `background`, `card`, `button`, `switch`, `border`, `disabled`, `snackbar`, `inputPlaceholderShown`, `textErrorHover`, `textError`, `focusRing`.
166
+ - **Contrast:** each preset's text colour (`--s-color-<name>--text`) is the light or dark theme `text` colour with the higher WCAG contrast ratio. Pick preset values that reach 4.5:1 with one of them; `getContrastRatio` is not exported, so check with any contrast tool. `textError` (form error text) must reach 4.5:1 and `focusRing` 3:1 on `background` and `card`.
143
167
  - Use **opaque hex** values (`#ffc107`). An alpha hex (`#ffc10799`) looks washed out everywhere; for translucency use `color-mix(in srgb, #{s_getPresetColor('warning')} 60%, transparent)` in SCSS.
144
168
 
145
169
  ### Dark mode — `useTheme()`
@@ -164,7 +188,7 @@ Set a prop once for every instance instead of repeating it (or overriding classe
164
188
  app.use(
165
189
  createSUI({
166
190
  components: {
167
- SSelect: { outlined: true },
191
+ SSelect: { grow: true },
168
192
  SButton: { color: 'primary', size: 'small' },
169
193
  SInput: { dense: true },
170
194
  },
@@ -265,7 +289,7 @@ Available on most components (check the component's reference when unsure):
265
289
  | `disabled` | `boolean` | Disable interaction |
266
290
  | `width` / `height` / `maxWidth` / `minWidth` | `string \| number` | Dimensions |
267
291
  | `tag` | `string` | Override root element |
268
- | `href` / `to` | `string` / `RouteLocationRaw` | Render as `<a>` / `router-link` |
292
+ | `href` / `to` | `string` / `LinkLocation` | Render as `<a>` / `router-link` (`to` falls back to `<a href>` without vue-router) |
269
293
 
270
294
  ---
271
295
 
@@ -312,6 +336,7 @@ Directives (`v-scroll`, `v-resize`) and utility classes: **sui-utilities**.
312
336
  | ❌ | ✅ |
313
337
  |---|---|
314
338
  | `npm i @khsura/sui` → 404/401 | A leftover `@khsura` scope override still points at GitHub Packages — remove it from `.npmrc` / `.yarnrc.yml` (step 1, *Migrating from GitHub Packages*) |
339
+ | Tab panels (`v-for` + `:key` + `v-show`) never switch although `STabs` updates its model | Vue 3.5.40 or older: upgrade to Vue 3.5.41 or newer (step 1, *Vue version*) |
315
340
  | Icons render as empty boxes | Load `@mdi/font` — `import '@mdi/font/css/materialdesignicons.css'` (Vue) or `css: ['@mdi/font/css/materialdesignicons.css']` (Nuxt) |
316
341
  | Only `style.css` (or only `base.css`) imported | Import both in plain Vue; the Nuxt module loads them |
317
342
  | No `<SApp>` root → no colors, dialogs/menus never show | Wrap the app in `<SApp>` |
@@ -323,10 +348,10 @@ Directives (`v-scroll`, `v-resize`) and utility classes: **sui-utilities**.
323
348
  | `SMenu` without `location` opens on top of its button | `location="bottom"` |
324
349
  | Named `SLayout` with un-`for`ed children | `for` on every child, or `name`/`for` on none |
325
350
  | Items as `{ title, value }` / `{ label, id }` | `{ text, value }` or plain strings |
326
- | `SSelect multiple / chips / clearable / placeholder` | `SAutocomplete` |
351
+ | `SSelect multiple / chips / clearable` | `SAutocomplete` |
327
352
  | Rule returns `false` | Return a message string |
328
353
  | `if (!formRef.value.validate()) return` | `validate()` returns `true` when there **are** errors |
329
- | `hideDetails` to hide just the error | `hideError` (`hideDetails` hides the label too) |
354
+ | `hideDetails` to hide just the error | `hideError` (`hideDetails` hides the label above a field too; `SCheckbox`/`SRadio` keep their own label) |
330
355
  | Unknown props (`SDialog title`, `persistent-hint`, `app`) | Silently ignored — check `@types/definitions/props` |
331
356
  | `:deep(.s_*) { … !important }` | A prop, a `createSUI({ components })` default, or theme colors |
332
357
  | `alpha` hex in `presetColors` | Opaque hex + `color-mix()` where you need translucency |
@@ -348,7 +373,7 @@ It merges a `sui` entry (`{ "command": "npx", "args": ["-y", "@khsura/sui-mcp"]
348
373
  When the server is connected:
349
374
 
350
375
  - Call `get_component_api` before using a component you have not checked; it reports the project's version. If it says the component needs a newer `@khsura/sui`, upgrade or pick another component.
351
- - Start common patterns (app shell, validated form, activator overlays, data table, responsive grid, theme setup) from `get_recipe`.
376
+ - Start common patterns (app shell, validated form, activator overlays, data table, responsive grid, theme setup, filter bar, centered page) from `get_recipe`.
352
377
  - Run `validate_sui_template` on every template you write and fix every error before finishing.
353
378
 
354
379
  Per-client snippets: the package README at https://www.npmjs.com/package/@khsura/sui-mcp and the **AI / MCP** page at https://sui.surakh.com/.
@@ -24,7 +24,9 @@ Then generate a complete Vue SFC using these rules:
24
24
  - `SMain for="app"` — wraps all page content
25
25
  - `SFooter for="app"` — optional bottom bar
26
26
  - `SBottomNavigation for="app" v-model="activeNav" :height="56" active-class="…"` — mobile bottom tabs. Set `height` (it collapses without one) and `active-class` (there is no active styling otherwise)
27
- - Below the `md` breakpoint the drawer becomes a mobile overlay; toggle it with `v-model`
27
+ - The drawer opens itself on desktop and closes itself below the `md` breakpoint, at mount and on resize (unless `persistent`). On mobile it is an overlay with a scrim: toggle it with `v-model`; a tap on the scrim closes it
28
+ - `SApp` already fills the viewport height (`100dvh`) and `SAppBar` already insets its content from the edges — don't add a `min-height: 100vh` wrapper or app bar padding
29
+ - Centred page without an app shell (login, error page): make the page root a **direct child of `SApp`** with `s_display__flex s_justify__center s_align__center s_height--fill`. A direct child with `s_height--fill` grows to fill `SApp`, so the card is centred vertically (since `@khsura/sui` 1.20.0; on older versions `height: 100%` resolves to auto there, so put `style="min-height: 100dvh"` on that child). Start from the `centered-page` recipe
28
30
  - Keep one app-level `SLayout`. A nested/secondary `SLayout` does not offset its `SMain` for a drawer and `permanent` has no effect there — use the grid or `SSplitView` inside pages instead
29
31
  - `SDivider` in a flex column collapses to zero width (it's an `<hr>` with auto margins) — give it `width: 100%` / `align-self: stretch`
30
32
  - Use `SSpacer` inside `SAppBar` to push items right
@@ -390,7 +390,7 @@ Adds a Material Design box shadow. Maps to the same values as the `elevation` co
390
390
 
391
391
  | Class | CSS |
392
392
  |-------|-----|
393
- | `s_height--fill` | `height: 100%` |
393
+ | `s_height--fill` | `height: 100%`. On a direct child of `SApp` it also sets `flex: 1 1 auto`, so the child fills the viewport-tall app (a percentage height of a `min-height` parent would resolve to auto) |
394
394
  | `s_width--fill` | `width: 100%` |
395
395
 
396
396
  ---