@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
|
@@ -18,16 +18,16 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/props<AppBar|Navigatio
|
|
|
18
18
|
|
|
19
19
|
## How layouts are linked (read this first)
|
|
20
20
|
|
|
21
|
-
- **`SApp`** is the root. It provides the app state and is itself an *app-level* layout. Wrap the whole app in it (after installing the `createSUI()` plugin).
|
|
21
|
+
- **`SApp`** is the root. It provides the app state and is itself an *app-level* layout. Wrap the whole app in it (after installing the `createSUI()` plugin). It is at least the viewport height (`100dvh`), and an `SLayout` directly inside it grows with it, so don't add your own `min-height: 100vh` wrapper. A direct child with `s_height--fill` grows the same way, so a page root with `s_display__flex s_justify__center s_align__center s_height--fill` centres its content in the viewport (see the `centered-page` recipe).
|
|
22
22
|
- **`SLayout`** creates a layout scope. Children find it by name:
|
|
23
23
|
- SLayout without `name` → children **without `for`** join it as the **app-level** layout (inside `SApp`).
|
|
24
24
|
- SLayout with `name="x"` → **every** child needs `for="x"`. A child without `for` joins the app-level layout instead, so offsets silently break.
|
|
25
25
|
- **App-level vs nested.** A layout is app-level when its name equals the plugin name (`'sui'` by default, so: no `name`) or when it has the `app` prop. A named layout (`name="x"` with no `app` prop on it and its children) is a *nested* layout:
|
|
26
26
|
- `SNavigationDrawer` is `position: absolute` inside the layout (not fixed), and `permanent` has **no effect**.
|
|
27
27
|
- `SFooter` ignores `position`. `SBottomNavigation` is not fixed unless you set `position="fixed"`.
|
|
28
|
-
- `SMain` renders `<section>` with `min-height: 100%` instead of `<main>` with `100vh
|
|
28
|
+
- `SMain` renders `<section>` with `min-height: 100%` instead of `<main>` with `100vh` (minus the app bar and footer heights).
|
|
29
29
|
- Without `SApp`, an unnamed `SLayout` and its children do **not** link up.
|
|
30
|
-
- Below the `md` breakpoint (or with `forceMobile`), a drawer becomes a mobile overlay. It does not push `SMain`, opens by swiping in from the screen edge, and closes on an outside click.
|
|
30
|
+
- Below the `md` breakpoint (or with `forceMobile`), a drawer becomes a mobile overlay. It does not push `SMain`, opens by swiping in from the screen edge, dims what is behind it with a scrim (the page for an app-level drawer, the layout for a nested one), and closes on an outside click or a tap on the scrim.
|
|
31
31
|
|
|
32
32
|
```vue
|
|
33
33
|
<!-- Recommended: app-level layout -->
|
|
@@ -52,13 +52,13 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/props<AppBar|Navigatio
|
|
|
52
52
|
| Prop | Type | Default | Required | Values |
|
|
53
53
|
| --- | --- | --- | --- | --- |
|
|
54
54
|
| `app` | `boolean` | — | no | — |
|
|
55
|
-
| `height` | `
|
|
56
|
-
| `maxHeight` | `
|
|
57
|
-
| `maxWidth` | `
|
|
58
|
-
| `minHeight` | `
|
|
59
|
-
| `minWidth` | `
|
|
55
|
+
| `height` | `number \| string \| null` | — | no | — |
|
|
56
|
+
| `maxHeight` | `number \| string \| null` | — | no | — |
|
|
57
|
+
| `maxWidth` | `number \| string \| null` | — | no | — |
|
|
58
|
+
| `minHeight` | `number \| string \| null` | — | no | — |
|
|
59
|
+
| `minWidth` | `number \| string \| null` | — | no | — |
|
|
60
60
|
| `name` | `string` | — | no | — |
|
|
61
|
-
| `width` | `
|
|
61
|
+
| `width` | `number \| string \| null` | — | no | — |
|
|
62
62
|
|
|
63
63
|
**SLayout slots**
|
|
64
64
|
|
|
@@ -116,21 +116,21 @@ Built on SToolbar. It renders a `<header>`.
|
|
|
116
116
|
| Prop | Type | Default | Required | Values |
|
|
117
117
|
| --- | --- | --- | --- | --- |
|
|
118
118
|
| `app` | `boolean` | — | no | — |
|
|
119
|
-
| `borderRadius` | `` number \| "
|
|
119
|
+
| `borderRadius` | `` number \| "rounded" \| "tile" \| `${number}%` \| `${number}em` \| `${number}px` \| `${number}rem` \| `${number}vh` \| `${number}vw` \| null `` | — | no | — |
|
|
120
120
|
| `color` | `string` | `"appBar"` | no | — |
|
|
121
121
|
| `colorThreshold` | `number` | — | no | — |
|
|
122
|
-
| `contentClass` | `string \|
|
|
122
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — |
|
|
123
123
|
| `contentStyle` | `StyleValue` | — | no | — |
|
|
124
124
|
| `density` | `ToolbarDensityType \| null` | — | no | `comfortable`, `compact`, `default` |
|
|
125
125
|
| `elevateOnScroll` | `boolean` | — | no | — |
|
|
126
|
-
| `elevation` | `"" \|
|
|
126
|
+
| `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 | — |
|
|
127
127
|
| `extended` | `boolean \| null` | — | no | — |
|
|
128
128
|
| `extensionClass` | `string \| Record<string, boolean \| undefined>` | — | no | — |
|
|
129
|
-
| `extensionHeight` | `
|
|
129
|
+
| `extensionHeight` | `number \| string` | `defaultToolbarExtensionHeight` | no | — |
|
|
130
130
|
| `extensionStyle` | `Record<string, string>` | — | no | — |
|
|
131
131
|
| `fixedExtension` | `boolean` | — | no | — |
|
|
132
132
|
| `for` | `string` | — | no | — |
|
|
133
|
-
| `height` | `
|
|
133
|
+
| `height` | `number \| string \| null` | `defaultToolbarContentHeight` | no | — |
|
|
134
134
|
| `hideOnScroll` | `boolean` | — | no | — |
|
|
135
135
|
| `outlined` | `boolean \| null` | — | no | — |
|
|
136
136
|
| `position` | `Position` | — | no | `absolute`, `fixed`, `relative`, `static`, `sticky` |
|
|
@@ -171,7 +171,7 @@ None.
|
|
|
171
171
|
- `color`: Background
|
|
172
172
|
- `elevation`, `outlined`, `underlined`, `borderRadius`, `tag`: Shared props (default: `tag: 'header'`)
|
|
173
173
|
|
|
174
|
-
**Slots:** `default`, `extension`. SAppBar does **not** forward `prepend`/`append`, so put everything in `default` and use `SSpacer`.
|
|
174
|
+
**Slots:** `default`, `extension`. SAppBar does **not** forward `prepend`/`append`, so put everything in `default` and use `SSpacer`. The content keeps an inset from the bar edges (the title and any other first/last item 16px, toolbar buttons 10px); no extra padding is needed.
|
|
175
175
|
|
|
176
176
|
## SAppBarTitle
|
|
177
177
|
|
|
@@ -214,19 +214,19 @@ None.
|
|
|
214
214
|
|
|
215
215
|
| Prop | Type | Default | Required | Values |
|
|
216
216
|
| --- | --- | --- | --- | --- |
|
|
217
|
-
| `activator` | `string \|
|
|
217
|
+
| `activator` | `string \| ComponentPublicInstance \| HTMLElement \| null` | — | no | — |
|
|
218
218
|
| `app` | `boolean` | — | no | — |
|
|
219
|
-
| `elevation` | `"" \|
|
|
219
|
+
| `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 | — |
|
|
220
220
|
| `expandOnHover` | `boolean` | — | no | — |
|
|
221
221
|
| `for` | `string` | — | no | — |
|
|
222
222
|
| `forceMobile` | `boolean` | — | no | — |
|
|
223
|
-
| `height` | `
|
|
223
|
+
| `height` | `number \| string \| null` | — | no | — |
|
|
224
224
|
| `hideOverlay` | `boolean` | — | no | — |
|
|
225
225
|
| `location` | `LocationRaw` | — | no | — |
|
|
226
226
|
| `maxWidth` | `number` | — | no | — |
|
|
227
227
|
| `minWidth` | `number` | — | no | — |
|
|
228
228
|
| `miniVariant` | `boolean` | — | no | — |
|
|
229
|
-
| `miniVariantWidth` | `
|
|
229
|
+
| `miniVariantWidth` | `number \| string` | — | no | — |
|
|
230
230
|
| `modelValue` | `boolean` | — | no | — |
|
|
231
231
|
| `offsetX` | `number \| null` | — | no | — |
|
|
232
232
|
| `offsetY` | `number \| null` | — | no | — |
|
|
@@ -236,7 +236,7 @@ None.
|
|
|
236
236
|
| `resizable` | `boolean` | — | no | — |
|
|
237
237
|
| `tag` | `"div" \| "nav" \| "section" \| null` | — | no | `div`, `nav`, `section` |
|
|
238
238
|
| `touchless` | `boolean` | — | no | — |
|
|
239
|
-
| `width` | `
|
|
239
|
+
| `width` | `number \| string` | — | no | — |
|
|
240
240
|
|
|
241
241
|
**SNavigationDrawer slots**
|
|
242
242
|
|
|
@@ -260,7 +260,7 @@ None.
|
|
|
260
260
|
**SNavigationDrawer notes**
|
|
261
261
|
|
|
262
262
|
- `for` / `app`: Layout link
|
|
263
|
-
- `v-model`: Open state.
|
|
263
|
+
- `v-model`: Open state. At mount and on every resize it opens itself on desktop and closes itself on mobile, whatever the starting value (unless `persistent`)
|
|
264
264
|
- `location`: Side. `bottom` is always mobile-style (default: `'left'`)
|
|
265
265
|
- `permanent`: Always open on desktop (**app-level layout only**)
|
|
266
266
|
- `persistent`: Desktop: ignore outside clicks and resizes
|
|
@@ -276,7 +276,7 @@ None.
|
|
|
276
276
|
- `height`: Height. App-level = the drawer has `app`, or its `for` is the app's name (default: `100vh` when app-level, else `100%`)
|
|
277
277
|
- `position`, `elevation`: Shared props
|
|
278
278
|
- `tag`: Root element (default: `nav` when app-level, else `aside`)
|
|
279
|
-
- `hideOverlay`:
|
|
279
|
+
- `hideOverlay`: Don't dim the page (or the nested layout) behind an open mobile drawer
|
|
280
280
|
|
|
281
281
|
**Slots:** `prepend`, `default` (scope `{ on }`: `click`, `transitionend`, `mouseenter`, `mouseleave` handlers), `append`.
|
|
282
282
|
**Events:** `update:modelValue`, `update:width` (resize end), `update:miniVariant`, `transitionend`.
|
|
@@ -330,19 +330,19 @@ None.
|
|
|
330
330
|
| `app` | `boolean` | — | no | — |
|
|
331
331
|
| `color` | `string` | — | no | — |
|
|
332
332
|
| `colorThreshold` | `number` | — | no | — |
|
|
333
|
-
| `elevation` | `"" \|
|
|
333
|
+
| `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 | — |
|
|
334
334
|
| `for` | `string` | — | no | — |
|
|
335
|
-
| `height` | `
|
|
335
|
+
| `height` | `number \| string \| null` | — | no | — |
|
|
336
336
|
| `inset` | `boolean` | `false` | no | — |
|
|
337
|
-
| `maxHeight` | `
|
|
338
|
-
| `maxWidth` | `
|
|
339
|
-
| `minHeight` | `
|
|
340
|
-
| `minWidth` | `
|
|
337
|
+
| `maxHeight` | `number \| string \| null` | — | no | — |
|
|
338
|
+
| `maxWidth` | `number \| string \| null` | — | no | — |
|
|
339
|
+
| `minHeight` | `number \| string \| null` | — | no | — |
|
|
340
|
+
| `minWidth` | `number \| string \| null` | — | no | — |
|
|
341
341
|
| `padless` | `boolean` | `false` | no | — |
|
|
342
342
|
| `position` | `Position` | — | no | `absolute`, `fixed`, `relative`, `static`, `sticky` |
|
|
343
343
|
| `tag` | `"div" \| "footer" \| null` | `"footer"` | no | `div`, `footer` |
|
|
344
344
|
| `theme` | `AppThemeType` | — | no | `dark`, `light` |
|
|
345
|
-
| `width` | `
|
|
345
|
+
| `width` | `number \| string \| null` | — | no | — |
|
|
346
346
|
|
|
347
347
|
**SFooter slots**
|
|
348
348
|
|
|
@@ -377,21 +377,21 @@ Slot: `default`. Its width tracks the drawers.
|
|
|
377
377
|
| --- | --- | --- | --- | --- |
|
|
378
378
|
| `activeClass` | `string` | — | no | — |
|
|
379
379
|
| `app` | `boolean` | — | no | — |
|
|
380
|
-
| `borderRadius` | `` number \| "
|
|
380
|
+
| `borderRadius` | `` number \| "rounded" \| "tile" \| `${number}%` \| `${number}em` \| `${number}px` \| `${number}rem` \| `${number}vh` \| `${number}vw` \| null `` | — | no | — |
|
|
381
381
|
| `bordered` | `boolean` | — | no | — |
|
|
382
382
|
| `continuous` | `boolean` | — | no | — |
|
|
383
383
|
| `dense` | `boolean` | — | no | — |
|
|
384
384
|
| `for` | `string` | — | no | — |
|
|
385
385
|
| `grow` | `boolean` | — | no | — |
|
|
386
|
-
| `height` | `
|
|
386
|
+
| `height` | `number \| string \| null` | — | no | — |
|
|
387
387
|
| `hideOnScroll` | `boolean` | — | no | — |
|
|
388
388
|
| `horizontal` | `boolean` | — | no | — |
|
|
389
389
|
| `inputValue` | `boolean` | — | no | — |
|
|
390
390
|
| `mandatory` | `boolean` | — | no | — |
|
|
391
|
-
| `maxHeight` | `
|
|
392
|
-
| `maxWidth` | `
|
|
393
|
-
| `minHeight` | `
|
|
394
|
-
| `minWidth` | `
|
|
391
|
+
| `maxHeight` | `number \| string \| null` | — | no | — |
|
|
392
|
+
| `maxWidth` | `number \| string \| null` | — | no | — |
|
|
393
|
+
| `minHeight` | `number \| string \| null` | — | no | — |
|
|
394
|
+
| `minWidth` | `number \| string \| null` | — | no | — |
|
|
395
395
|
| `modelValue` | `GroupItemValue` | — | no | — |
|
|
396
396
|
| `outlined` | `boolean \| null` | — | no | — |
|
|
397
397
|
| `position` | `Position` | — | no | `absolute`, `fixed`, `relative`, `static`, `sticky` |
|
|
@@ -401,7 +401,7 @@ Slot: `default`. Its width tracks the drawers.
|
|
|
401
401
|
| `shift` | `boolean` | — | no | — |
|
|
402
402
|
| `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` |
|
|
403
403
|
| `underlined` | `boolean \| null` | — | no | — |
|
|
404
|
-
| `width` | `
|
|
404
|
+
| `width` | `number \| string \| null` | — | no | — |
|
|
405
405
|
|
|
406
406
|
**SBottomNavigation slots**
|
|
407
407
|
|
|
@@ -452,17 +452,17 @@ The column component is **`SColumn`**. There is no `SCol`.
|
|
|
452
452
|
|
|
453
453
|
**SRow props**
|
|
454
454
|
|
|
455
|
-
| Prop | Type | Default | Required | Values |
|
|
456
|
-
| --- | --- | --- | --- | --- |
|
|
457
|
-
| `align` | `GridAlignPropertyType \| null` | — | no | `baseline`, `center`, `end`, `start`, `stretch` |
|
|
458
|
-
| `contentClass` | `string \|
|
|
459
|
-
| `contentStyle` | `StyleValue` | — | no | — |
|
|
460
|
-
| `dense` | `boolean \| null` | — | no | — |
|
|
461
|
-
| `fillHeight` | `boolean \| null` | — | no | — |
|
|
462
|
-
| `gap` | `
|
|
463
|
-
| `justify` | `GridJustifyPropertyType \| null` | — | no | `center`, `end`, `spaceAround`, `spaceBetween`, `start` |
|
|
464
|
-
| `noGutters` | `boolean \| null` | — | no | — |
|
|
465
|
-
| `noOuterGutters` | `boolean \| null` | — | no | — |
|
|
455
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
456
|
+
| --- | --- | --- | --- | --- | --- |
|
|
457
|
+
| `align` | `GridAlignPropertyType \| null` | — | no | `baseline`, `center`, `end`, `start`, `stretch` | — |
|
|
458
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — | — |
|
|
459
|
+
| `contentStyle` | `StyleValue` | — | no | — | — |
|
|
460
|
+
| `dense` | `boolean \| null` | — | no | — | — |
|
|
461
|
+
| `fillHeight` | `boolean \| null` | — | no | — | — |
|
|
462
|
+
| `gap` | `number \| string \| null` | — | no | — | — |
|
|
463
|
+
| `justify` | `GridJustifyPropertyType \| null` | — | no | `center`, `end`, `spaceAround`, `spaceBetween`, `start` | — |
|
|
464
|
+
| `noGutters` | `boolean \| null` | — | no | — | — |
|
|
465
|
+
| `noOuterGutters` | `boolean \| null` | — | no | — | Removes the row's own padding; columns keep theirs. Pair with `gap` to line the grid up with text beside it. |
|
|
466
466
|
|
|
467
467
|
**SRow slots**
|
|
468
468
|
|
|
@@ -482,6 +482,8 @@ None.
|
|
|
482
482
|
- `justify`: Main-axis (**camelCase**)
|
|
483
483
|
- `noGutters` / `noOuterGutters` / `dense` / `fillHeight`: Gutters / height
|
|
484
484
|
- `gap`: Custom gap (replaces gutters)
|
|
485
|
+
|
|
486
|
+
**Lining a grid up with text:** a default `SRow` pads itself by 8px and each `SColumn` pads by 8px, so the columns start 16px inside a heading or paragraph next to the row. A grid next to a heading or paragraph needs `no-outer-gutters` **and** `:gap="16"` to line up (`no-outer-gutters` alone still leaves the columns' 8px). Separate stacked gap rows with `class="s_mt__4"`. See the `responsive-grid` recipe.
|
|
485
487
|
- `contentClass` / `contentStyle`: Inner wrapper class/style
|
|
486
488
|
|
|
487
489
|
**SColumn:** `cols`, `sm`, `md`, `lg` (`1`–`12 \| 'auto' \| 'grow'`), `order` (number), `alignSelf`, `contentClass`/`contentStyle`. There is no `xl`.
|
|
@@ -533,9 +535,9 @@ None.
|
|
|
533
535
|
|
|
534
536
|
| Prop | Type | Default | Required | Values |
|
|
535
537
|
| --- | --- | --- | --- | --- |
|
|
536
|
-
| `alignSelf` | `"
|
|
538
|
+
| `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` |
|
|
537
539
|
| `cols` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
538
|
-
| `contentClass` | `string \|
|
|
540
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — |
|
|
539
541
|
| `contentStyle` | `StyleValue` | — | no | — |
|
|
540
542
|
| `lg` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
541
543
|
| `md` | `"1" \| "2" \| "3" \| "4" \| "5" \| "6" \| "7" \| "8" \| "9" \| "10" \| "11" \| "12" \| ColumnNumber \| null` | — | no | — |
|
|
@@ -608,5 +610,7 @@ None.
|
|
|
608
610
|
| `<SAppBar><template #prepend>…` | Not forwarded. Put content in `default` |
|
|
609
611
|
| `<SRow justify="space-between">` | `justify="spaceBetween"` |
|
|
610
612
|
| `<SCol>` | `<SColumn>` |
|
|
613
|
+
| `<h2>` then a plain `<SRow>`: the cards sit 16px inside the heading | `<SRow no-outer-gutters :gap="16">` so the first column starts where the heading does |
|
|
611
614
|
| `<SBottomNavigation v-model="tab">` with no `height`/`active-class` | Set `:height` and `active-class` |
|
|
612
615
|
| `<SAppBar elevate-on-scroll>` with no position | Add `position="fixed"` |
|
|
616
|
+
| `padding-top: env(safe-area-inset-top)` on a fixed `SAppBar` / `SBottomNavigation` / mobile drawer, or `padding-left: env(safe-area-inset-left)` on a `permanent` drawer / `SMain` | They pad by the iPhone safe areas themselves; only add `viewport-fit=cover` to the viewport meta (getting-started skill). Your own `env()` padding doubles the inset |
|
|
@@ -76,8 +76,8 @@ A flex row with a minimum height of 48px (40px when the list is `dense`).
|
|
|
76
76
|
| `rel` | `string` | — | no | — |
|
|
77
77
|
| `selectable` | `boolean \| null` | — | no | — |
|
|
78
78
|
| `tag` | `"div" \| "li" \| null` | — | no | `div`, `li` |
|
|
79
|
-
| `target` | `"_blank" \| "
|
|
80
|
-
| `to` | `
|
|
79
|
+
| `target` | `"_blank" \| "_parent" \| "_self" \| "_top"` | — | no | `_blank`, `_parent`, `_self`, `_top` |
|
|
80
|
+
| `to` | `LinkLocation \| null` | — | no | — |
|
|
81
81
|
|
|
82
82
|
**SListItem slots**
|
|
83
83
|
|
|
@@ -100,7 +100,7 @@ A flex row with a minimum height of 48px (40px when the list is `dense`).
|
|
|
100
100
|
- `lines`: Subtitle line clamp for this item (overrides the list's `lines`)
|
|
101
101
|
- `disabled`: Disabled state
|
|
102
102
|
- `href`: Render as `<a>`
|
|
103
|
-
- `to`: Render as `router-link`
|
|
103
|
+
- `to`: Render as `router-link` (plain `<a href>` without vue-router)
|
|
104
104
|
- `target` / `rel`: Link attributes
|
|
105
105
|
- `tag`: Root element (when not a link) (default: `'div'`)
|
|
106
106
|
- `default` (slot): Item content
|
|
@@ -177,6 +177,8 @@ None.
|
|
|
177
177
|
|
|
178
178
|
Leading icon area and trailing action area. `default` slot.
|
|
179
179
|
|
|
180
|
+
`SListItemContent` keeps a minimum width of `min(40%, 160px)`. When the icon and the actions leave less room than that (two text buttons on a phone), the list item moves the `SListItemAction` onto its own line below the text, aligned to the right edge, instead of squeezing the title to one letter. (Older versions squeezed it.)
|
|
181
|
+
|
|
180
182
|
<!-- generated:api:start SListItemIcon -->
|
|
181
183
|
<!-- Generated from sui-api.json by `yarn sync:skills` (packages/app). Do not edit by hand. -->
|
|
182
184
|
|
|
@@ -319,3 +321,4 @@ A collapsible sub-list. By default it renders a clickable header row (title, sub
|
|
|
319
321
|
| `<SListItem selectable>` expecting a selected highlight | Manage the active state yourself (e.g. a class), since `selectable` only changes the cursor |
|
|
320
322
|
| `<SListItemGroup>` used for single/multi selection | It only expands and collapses. Track selection yourself |
|
|
321
323
|
| `<SList inset>` | No effect |
|
|
324
|
+
| Shrinking the actions (or the title's font) so two text buttons fit next to a long title on a phone | Not needed: the actions move below the text when it would get narrower than `min(40%, 160px)` |
|
|
@@ -13,19 +13,19 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsMenu.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
|
-
| `contentClass` | `string \|
|
|
20
|
+
| `contentClass` | `string \| Record<string, boolean> \| string[]` | — | no | — |
|
|
21
21
|
| `contentStyle` | `StyleValue` | — | no | — |
|
|
22
22
|
| `disabled` | `boolean \| null` | — | no | — |
|
|
23
|
-
| `height` | `
|
|
23
|
+
| `height` | `number \| string \| null` | — | no | — |
|
|
24
24
|
| `location` | `LocationRaw` | — | no | — |
|
|
25
|
-
| `maxHeight` | `
|
|
26
|
-
| `maxWidth` | `
|
|
27
|
-
| `minHeight` | `
|
|
28
|
-
| `minWidth` | `
|
|
25
|
+
| `maxHeight` | `number \| string \| null` | — | no | — |
|
|
26
|
+
| `maxWidth` | `number \| string \| null` | — | no | — |
|
|
27
|
+
| `minHeight` | `number \| string \| null` | — | no | — |
|
|
28
|
+
| `minWidth` | `number \| string \| null` | — | no | — |
|
|
29
29
|
| `modelValue` | `boolean` | — | no | — |
|
|
30
30
|
| `offsetX` | `number \| null` | — | no | — |
|
|
31
31
|
| `offsetY` | `number \| null` | — | no | — |
|
|
@@ -33,7 +33,7 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsMenu.d.ts`
|
|
|
33
33
|
| `preventCloseOnClick` | `boolean` | — | no | — |
|
|
34
34
|
| `readonly` | `boolean \| null` | — | no | — |
|
|
35
35
|
| `screenPadding` | `number \| null` | — | no | — |
|
|
36
|
-
| `width` | `
|
|
36
|
+
| `width` | `number \| string \| null` | — | no | — |
|
|
37
37
|
|
|
38
38
|
**SMenu slots**
|
|
39
39
|
|
|
@@ -58,7 +58,7 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsMenu.d.ts`
|
|
|
58
58
|
- `closeOnScroll`: Close on window scroll
|
|
59
59
|
- `position`: `'fixed'` positions relative to the viewport (use inside fixed containers)
|
|
60
60
|
- `offsetX` / `offsetY`: Extra offset in px
|
|
61
|
-
- `screenPadding`:
|
|
61
|
+
- `screenPadding`: Gap in px the menu keeps from the viewport edges (default 8)
|
|
62
62
|
- `contentClass`: Classes on the content element
|
|
63
63
|
- `contentStyle`: Styles on the content element
|
|
64
64
|
- `preventCloseOnClick`: Activator click only opens, never closes
|
|
@@ -105,3 +105,6 @@ Types: `node_modules/@khsura/sui/@types/definitions/props/propsMenu.d.ts`
|
|
|
105
105
|
|
|
106
106
|
- The app must be wrapped in `<SApp>` (menus teleport into its overlay container).
|
|
107
107
|
- `closeOnClick` exists in the prop types but has no effect; outside clicks always close the menu.
|
|
108
|
+
- The menu stays inside the viewport: it flips above or below its activator when the other side has room, otherwise shifts, and keeps an 8px gutter from every edge (`screenPadding` overrides the gutter). It follows its activator when the page or a scroll container scrolls, so a row menu inside an `SList` or table is safe.
|
|
109
|
+
- The menu is as wide as its items (capped at 90vw), so list titles are not cut off.
|
|
110
|
+
- Esc closes the menu and returns focus to the activator.
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# SNumberInput
|
|
2
|
+
|
|
3
|
+
**Import:** `import { SNumberInput } from '@khsura/sui'` (since 1.21.0; on older releases use `SInput type="number"`)
|
|
4
|
+
|
|
5
|
+
The numeric field: a quantity, an amount of money, a percentage. `v-model` is `number | null` (`null` when empty). It renders a labelled `<input type="text" role="spinbutton">` with increment/decrement buttons (`stacked` at the end, or `split` around the number), steps with ArrowUp/ArrowDown, keeps `precision` decimals and clamps to `min`/`max` on blur. Label, `rules`, `hide-details`, `hide-error` and the error line work as on `SInput`, so it lines up in `SForm` and `SFormRow`.
|
|
6
|
+
|
|
7
|
+
Types: `node_modules/@khsura/sui/@types/definitions/props/propsNumberInput.d.ts`
|
|
8
|
+
|
|
9
|
+
Docs: https://sui.surakh.com/?path=/docs/ui-components-form-numberinput--docs
|
|
10
|
+
|
|
11
|
+
<!-- generated:api:start SNumberInput -->
|
|
12
|
+
<!-- Generated from sui-api.json by `yarn sync:skills` (packages/app). Do not edit by hand. -->
|
|
13
|
+
|
|
14
|
+
**SNumberInput props**
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
17
|
+
| --- | --- | --- | --- | --- | --- |
|
|
18
|
+
| `ariaLabel` | `string` | — | no | — | Accessible name when the visible `label` is not enough (or absent); with `hideDetails` the label is used. |
|
|
19
|
+
| `ariaLabelledby` | `string` | — | no | — | Id of the element that names the field, instead of `label`. |
|
|
20
|
+
| `autofocus` | `boolean \| null` | — | no | — | Focuses the field when it mounts. |
|
|
21
|
+
| `controlVariant` | `"split" \| "stacked" \| null` | — | no | `split`, `stacked` | Layout of the buttons: `stacked` (both at the end of the field, default) or `split` (minus first, plus last). |
|
|
22
|
+
| `decrementAriaLabel` | `string` | — | no | — | Accessible name of the decrement button. Default `Decrease`. |
|
|
23
|
+
| `dense` | `boolean` | — | no | — | Smaller padding, as on SInput. |
|
|
24
|
+
| `dirty` | `boolean` | — | no | — | — |
|
|
25
|
+
| `disabled` | `boolean \| null` | — | no | — | — |
|
|
26
|
+
| `error` | `boolean` | — | no | — | — |
|
|
27
|
+
| `hideControls` | `boolean \| null` | — | no | — | Hides the increment and decrement buttons; the arrow keys still step the value. |
|
|
28
|
+
| `hideDetails` | `boolean` | — | no | — | — |
|
|
29
|
+
| `hideError` | `boolean` | — | no | — | — |
|
|
30
|
+
| `id` | `string` | — | no | — | — |
|
|
31
|
+
| `incrementAriaLabel` | `string` | — | no | — | Accessible name of the increment button. Default `Increase`. |
|
|
32
|
+
| `label` | `string \| null` | — | no | — | Text above the field. With `hideDetails` it is hidden and becomes the field's `aria-label`. |
|
|
33
|
+
| `max` | `number \| string \| null` | — | no | — | Highest allowed value. A higher value is clamped down to it on blur, and the increment button stops there. |
|
|
34
|
+
| `min` | `number \| string \| null` | — | no | — | Lowest allowed value. A lower value is clamped up to it on blur, and the decrement button stops there. |
|
|
35
|
+
| `modelValue` | `number \| null` | `null` | no | — | — |
|
|
36
|
+
| `name` | `string` | — | no | — | Name submitted with a native form. |
|
|
37
|
+
| `placeholder` | `string \| null` | — | no | — | Hint shown while the field is empty. |
|
|
38
|
+
| `precision` | `number \| null` | — | no | — | Decimal places the value keeps. Default `0` (whole numbers; typing `.` is refused). Use `2` for money. `null` allows any number of decimals. The field shows exactly this many decimals once it loses focus. |
|
|
39
|
+
| `prefix` | `string \| null` | — | no | — | Text inside the field before the number, such as a currency sign. |
|
|
40
|
+
| `readonly` | `boolean \| null` | — | no | — | — |
|
|
41
|
+
| `rules` | `FormInputModelValueRule[]` | — | no | — | — |
|
|
42
|
+
| `size` | `SizePropertyType` | — | no | `default`, `extra`, `large`, `mini`, `small` | — |
|
|
43
|
+
| `step` | `number \| string \| null` | — | no | — | Amount the buttons and the ArrowUp / ArrowDown keys add or remove. Default `1`. |
|
|
44
|
+
| `suffix` | `string \| null` | — | no | — | Text inside the field after the number, such as `%` or a unit. |
|
|
45
|
+
| `textRight` | `boolean \| null` | — | no | — | Aligns the number to the right, as in a column of amounts. |
|
|
46
|
+
| `tile` | `boolean` | — | no | — | Removes the rounded corners. |
|
|
47
|
+
|
|
48
|
+
**SNumberInput slots**
|
|
49
|
+
|
|
50
|
+
None.
|
|
51
|
+
|
|
52
|
+
**SNumberInput events**
|
|
53
|
+
|
|
54
|
+
| Event | Payload |
|
|
55
|
+
| --- | --- |
|
|
56
|
+
| `blur` | `[FocusEvent]` |
|
|
57
|
+
| `change` | `[number \| null]` |
|
|
58
|
+
| `focus` | `[FocusEvent]` |
|
|
59
|
+
| `keydown` | `[KeyboardEvent]` |
|
|
60
|
+
| `update:dirty` | `[boolean]` |
|
|
61
|
+
| `update:error` | `[boolean]` |
|
|
62
|
+
| `update:errors` | `[string[]]` |
|
|
63
|
+
| `update:modelValue` | `[value: number \| null]` |
|
|
64
|
+
|
|
65
|
+
<!-- generated:api:end SNumberInput -->
|
|
66
|
+
|
|
67
|
+
**SNumberInput notes**
|
|
68
|
+
|
|
69
|
+
- `precision` defaults to `0` (whole numbers; `.` is refused). `2` for money, `null` for any decimals. A finer `step` (`0.5`) raises it to the step's decimals. Once the field loses focus it shows exactly `precision` decimals (`5.00`).
|
|
70
|
+
- `min`/`max` are not enforced while typing; the value is clamped on blur, and the buttons stop at the bounds (disabled there). Use a rule when the user should see a message instead.
|
|
71
|
+
- A value below `min` (a `0` default with `:min="1"`) is shown, not hidden, and clamped on blur.
|
|
72
|
+
- `inputmode` is automatic: `numeric` / `decimal` when `min` ≥ 0, `text` when negatives are allowed (a phone's number keypad has no minus). Set `:min="0"` for the number keypad.
|
|
73
|
+
- No native `min`/`max`/`step` attributes, so the browser's validation bubble never shows inside `SForm`.
|
|
74
|
+
- In `SFormRow`, number fields share the free width equally (a long label doesn't make one wider), so two number fields and a button fit on one line at 375 px. Keep their labels short: a label that wraps pushes its box down.
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<SForm>
|
|
80
|
+
<SNumberInput v-model="quantity" label="Quantity" :min="1" control-variant="split" :rules="[atLeastOne]" />
|
|
81
|
+
<SNumberInput v-model="price" label="Price" prefix="₮" :precision="2" :min="0" text-right />
|
|
82
|
+
<SNumberInput v-model="vatRate" label="VAT rate" suffix="%" :min="0" :max="100" :precision="1" />
|
|
83
|
+
<SFormRow>
|
|
84
|
+
<SNumberInput v-model="quantity" label="Qty" :min="1" />
|
|
85
|
+
<SButton>Add</SButton>
|
|
86
|
+
</SFormRow>
|
|
87
|
+
</SForm>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Gotchas
|
|
91
|
+
|
|
92
|
+
| ❌ | ✅ |
|
|
93
|
+
|----|----|
|
|
94
|
+
| `<SInput type="number" v-model="qty" />` (1.21.0+) | `<SNumberInput v-model="qty" :min="0" />` |
|
|
95
|
+
| `<SNumberInput v-model.number="qty" />` | `<SNumberInput v-model="qty" />` — the value is already a number |
|
|
96
|
+
| `<SNumberInput type="number" />` / `inputmode="decimal"` | No `type` or `inputmode`; it picks the keyboard from `min` and `precision` |
|
|
97
|
+
| `<SNumberInput allow-decimal />` (SInput prop) | `<SNumberInput :precision="2" />` |
|
|
98
|
+
| `<SNumberInput positive />` (SInput prop) | `<SNumberInput :min="1" />` (or `:min="0"` and a rule) |
|
|
99
|
+
| `<SNumberInput step="0.01" />` for money, expecting `5.00` | `<SNumberInput :precision="2" :step="0.01" />` (precision controls the decimals shown) |
|
|
100
|
+
| `control-variant="default"` / `"hidden"` (Vuetify) | `control-variant="stacked"` / `"split"`, or `hide-controls` |
|
|
101
|
+
| `<SNumberInput :rules="[v => !!v \|\| 'Required']" />` | `v => v !== null \|\| 'Required'` — `0` is falsy but a valid value |
|
|
102
|
+
| A row of `SNumberInput` + `SButton` in a plain flex `div` | Wrap them in `SFormRow` so the button lines up with the field box |
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# SPagination
|
|
2
|
+
|
|
3
|
+
**Import:** `import { SPagination } from '@khsura/sui'`
|
|
4
|
+
|
|
5
|
+
Standalone page navigation: a `<nav aria-label="Pagination">` with previous/next buttons, page buttons (hidden pages become "…"), and optional first/last buttons. The current page gets `aria-current="page"`. It switches to a compact layout by itself when it does not fit (at 375 px, for example), so it never scrolls the page sideways. Inside `STable`, use the table's built-in pagination instead.
|
|
6
|
+
|
|
7
|
+
Types: `node_modules/@khsura/sui/@types/definitions/props/propsPagination.d.ts`
|
|
8
|
+
|
|
9
|
+
Docs: https://sui.surakh.com/?path=/docs/ui-components-pagination--docs
|
|
10
|
+
|
|
11
|
+
<!-- generated:api:start SPagination -->
|
|
12
|
+
<!-- Generated from sui-api.json by `yarn sync:skills` (packages/app). Do not edit by hand. -->
|
|
13
|
+
|
|
14
|
+
**SPagination props**
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
17
|
+
| --- | --- | --- | --- | --- | --- |
|
|
18
|
+
| `ariaLabel` | `string` | `"Pagination"` | no | — | Accessible name of the `<nav>` landmark. Defaults to `'Pagination'`. |
|
|
19
|
+
| `color` | `string` | `"primary"` | no | — | — |
|
|
20
|
+
| `colorThreshold` | `number` | — | no | — | — |
|
|
21
|
+
| `compact` | `boolean` | `undefined` | no | — | Compact mode: no first/last buttons and at most 5 page slots. Leave it unset and SPagination switches to it by itself when the full list does not fit its width (on a phone, for example). `true` or `false` forces it. |
|
|
22
|
+
| `disabled` | `boolean \| null` | `false` | no | — | — |
|
|
23
|
+
| `firstAriaLabel` | `string` | `"First page"` | no | — | Accessible name of the first-page button. Defaults to `'First page'`. |
|
|
24
|
+
| `lastAriaLabel` | `string` | `"Last page"` | no | — | Accessible name of the last-page button. Defaults to `'Last page'`. |
|
|
25
|
+
| `length` | `number` | — | yes | — | Number of pages (not the number of rows): `Math.ceil(totalItems / itemsPerPage)`. |
|
|
26
|
+
| `modelValue` | `number` | `undefined` | no | — | Current page, starting at 1. Use `v-model`. Values outside `1…length` are clamped. Defaults to `1`. |
|
|
27
|
+
| `nextAriaLabel` | `string` | `"Next page"` | no | — | Accessible name of the next-page button. Defaults to `'Next page'`. |
|
|
28
|
+
| `pageAriaLabel` | `string` | `"Page"` | no | — | Accessible name of a page button, followed by its number: `'Page'` gives "Page 3". Defaults to `'Page'`. |
|
|
29
|
+
| `prevAriaLabel` | `string` | `"Previous page"` | no | — | Accessible name of the previous-page button. Defaults to `'Previous page'`. |
|
|
30
|
+
| `showFirstLastPage` | `boolean` | `false` | no | — | Shows the first-page and last-page buttons beside the previous and next buttons. Hidden in compact mode. |
|
|
31
|
+
| `size` | `SizePropertyType` | — | no | `default`, `extra`, `large`, `mini`, `small` | — |
|
|
32
|
+
| `theme` | `AppThemeType` | — | no | `dark`, `light` | — |
|
|
33
|
+
| `totalVisible` | `number` | `undefined` | no | — | Most slots to show, pages and ellipses together (not counting the arrow buttons). Hidden pages become "…", and the first and last page stay visible. Defaults to `7`. |
|
|
34
|
+
|
|
35
|
+
**SPagination slots**
|
|
36
|
+
|
|
37
|
+
None.
|
|
38
|
+
|
|
39
|
+
**SPagination events**
|
|
40
|
+
|
|
41
|
+
| Event | Payload |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| `update:modelValue` | `[value: number]` |
|
|
44
|
+
|
|
45
|
+
<!-- generated:api:end SPagination -->
|
|
46
|
+
|
|
47
|
+
**SPagination notes**
|
|
48
|
+
|
|
49
|
+
- `length` is the number of **pages**, not rows: `Math.ceil(totalItems / itemsPerPage)`.
|
|
50
|
+
- `modelValue` starts at 1 (STable's `pageIndex` starts at 0). Out-of-range values are clamped; `update:modelValue` is not emitted for a click on the current page.
|
|
51
|
+
- `totalVisible` (default 7) counts pages **and** ellipses, not the arrow buttons. An ellipsis always hides two pages or more; the first and last page stay visible.
|
|
52
|
+
- `compact` unset = automatic: when the full row does not fit, it hides the first/last buttons and shows at most 5 page slots. `true` / `false` force it.
|
|
53
|
+
- `color` (default `primary`) colours only the current page; the other pages are text buttons.
|
|
54
|
+
- Every button has an English accessible name; translate with `ariaLabel`, `pageAriaLabel`, `prevAriaLabel`, `nextAriaLabel`, `firstAriaLabel`, `lastAriaLabel`.
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<script setup lang="ts">
|
|
60
|
+
import { computed, ref } from 'vue'
|
|
61
|
+
import { SPagination } from '@khsura/sui'
|
|
62
|
+
|
|
63
|
+
const page = ref(1)
|
|
64
|
+
const itemsPerPage = 20
|
|
65
|
+
const totalItems = ref(482)
|
|
66
|
+
const pageCount = computed(() => Math.ceil(totalItems.value / itemsPerPage))
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<template>
|
|
70
|
+
<SPagination v-model="page" :length="pageCount" show-first-last-page />
|
|
71
|
+
</template>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Gotchas
|
|
75
|
+
|
|
76
|
+
| ❌ | ✅ |
|
|
77
|
+
|----|----|
|
|
78
|
+
| `:length="items.length"` or `:length="totalItems"` (rows) | `:length="Math.ceil(totalItems / itemsPerPage)"` (pages) — the validator's `pagination-length-rows` rule flags it |
|
|
79
|
+
| `v-model="pageIndex"` (0-based, copied from STable) | A 1-based `page` ref; derive `page - 1` where an index is needed — `pagination-zero-based` rule |
|
|
80
|
+
| `:items-per-page`, `:total-items`, `rows-per-page` | Not props. Compute `length` yourself; put an `SSelect` beside it for rows per page, or use STable's pagination |
|
|
81
|
+
| Vuetify `rounded`, `variant`, `density`, `active-color`, `prev-icon`, `start` | Not supported. `color` colours the current page; `size` scales the buttons |
|
|
82
|
+
| Wrapping it in `overflow-x: auto` "for mobile" | Not needed: it switches to compact mode by itself when it does not fit |
|
|
83
|
+
| `<STablePagination>` | Not exported. `SPagination` standalone, or STable's built-in pagination |
|
|
@@ -15,15 +15,16 @@ Horizontal progress bar.
|
|
|
15
15
|
|
|
16
16
|
**SProgressLinear props**
|
|
17
17
|
|
|
18
|
-
| Prop | Type | Default | Required | Values |
|
|
19
|
-
| --- | --- | --- | --- | --- |
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
18
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
19
|
+
| --- | --- | --- | --- | --- | --- |
|
|
20
|
+
| `ariaLabel` | `string` | `"Loading"` | no | — | Accessible name of the progress bar. Defaults to `'Loading'`; name what is loading when you can. |
|
|
21
|
+
| `backgroundColor` | `string \| null` | — | no | — | — |
|
|
22
|
+
| `backgroundOpacity` | `number \| string \| null` | — | no | — | — |
|
|
23
|
+
| `color` | `string` | `"info"` | no | — | — |
|
|
24
|
+
| `indeterminate` | `boolean` | — | no | — | — |
|
|
25
|
+
| `position` | `Position` | — | no | `absolute`, `fixed`, `relative`, `static`, `sticky` | — |
|
|
26
|
+
| `size` | `number \| string \| null` | — | no | — | — |
|
|
27
|
+
| `value` | `number \| string` | `0` | no | — | — |
|
|
27
28
|
|
|
28
29
|
**SProgressLinear slots**
|
|
29
30
|
|
|
@@ -61,15 +62,16 @@ Circular progress / spinner.
|
|
|
61
62
|
|
|
62
63
|
**SProgressCircular props**
|
|
63
64
|
|
|
64
|
-
| Prop | Type | Default | Required | Values |
|
|
65
|
-
| --- | --- | --- | --- | --- |
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
65
|
+
| Prop | Type | Default | Required | Values | Description |
|
|
66
|
+
| --- | --- | --- | --- | --- | --- |
|
|
67
|
+
| `ariaLabel` | `string` | `"Loading"` | no | — | Accessible name of the progress bar. Defaults to `'Loading'`; name what is loading when you can. |
|
|
68
|
+
| `color` | `string \| null` | — | no | — | — |
|
|
69
|
+
| `indeterminate` | `boolean` | — | no | — | — |
|
|
70
|
+
| `rotate` | `number` | — | no | — | — |
|
|
71
|
+
| `size` | `number \| string` | `32` | no | — | — |
|
|
72
|
+
| `theme` | `AppThemeType` | — | no | `dark`, `light` | — |
|
|
73
|
+
| `value` | `number` | `0` | no | — | — |
|
|
74
|
+
| `width` | `number` | `4` | no | — | — |
|
|
73
75
|
|
|
74
76
|
**SProgressCircular slots**
|
|
75
77
|
|