@khsura/sui 1.20.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/form/index.d.ts +1 -0
- package/@types/components/form/sFormRow.vue.d.ts +1 -1
- package/@types/components/form/sNumberInput.vue.d.ts +29 -0
- package/@types/components/form/sSelect.vue.d.ts +8 -3
- package/@types/components/index.d.ts +5 -0
- package/@types/components/sAutocomplete.vue.d.ts +8 -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/toggleButtonGroup/sToggleButtonGroup.vue.d.ts +2 -0
- package/@types/configs/fileInput.d.ts +5 -0
- package/@types/configs/index.d.ts +2 -0
- package/@types/configs/provider.d.ts +1 -0
- package/@types/configs/skeletonLoader.d.ts +57 -0
- package/@types/constants/avatar.d.ts +3 -0
- package/@types/constants/fileInput.d.ts +31 -0
- package/@types/constants/index.d.ts +5 -0
- package/@types/constants/layout.d.ts +2 -0
- package/@types/constants/numberInput.d.ts +22 -0
- package/@types/constants/pagination.d.ts +20 -0
- package/@types/constants/skeletonLoader.d.ts +33 -0
- package/@types/constants/tabs.d.ts +6 -0
- package/@types/definitions/props/index.d.ts +7 -0
- package/@types/definitions/props/propsAutocomplete.d.ts +2 -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/propsNumberInput.d.ts +46 -0
- package/@types/definitions/props/propsPagination.d.ts +32 -0
- package/@types/definitions/props/propsRow.d.ts +1 -0
- package/@types/definitions/props/propsSelect.d.ts +2 -0
- package/@types/definitions/props/propsSkeletonLoader.d.ts +18 -0
- package/@types/definitions/props/propsTabs.d.ts +4 -0
- package/@types/helpers/fileInputRules.d.ts +18 -0
- package/@types/helpers/index.d.ts +1 -0
- package/@types/lib/escapeHtml.d.ts +2 -0
- package/@types/lib/flattenVNodes.d.ts +2 -0
- package/@types/lib/index.d.ts +3 -0
- package/@types/lib/numberInput.d.ts +23 -0
- package/@types/lib/revealInScroller.d.ts +14 -0
- package/@types/services/appBarService.d.ts +14 -0
- package/@types/services/core/layoutCoreService.d.ts +4 -0
- package/@types/services/index.d.ts +2 -0
- package/@types/services/layoutProviderService.d.ts +6 -0
- package/@types/services/layoutService.d.ts +4 -0
- package/@types/services/paginationService.d.ts +39 -0
- package/@types/services/skeletonLoaderService.d.ts +22 -0
- package/@types/services/tabsService.d.ts +6 -1
- package/@types/types/emits.d.ts +12 -0
- package/@types/types/fileInput.d.ts +28 -0
- package/@types/types/index.d.ts +4 -0
- package/@types/types/numberInput.d.ts +12 -0
- package/@types/types/pagination.d.ts +17 -0
- package/@types/types/skeletonLoader.d.ts +16 -0
- package/dist/s-ui.css +1 -1
- package/dist/s-ui.js +3966 -2856
- 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/index.scss +1 -0
- package/dist/sui-api.json +1208 -235
- package/package.json +3 -2
- package/sui-plugin/.claude-plugin/plugin.json +1 -1
- package/sui-plugin/skills/sui-component/SKILL.md +10 -3
- package/sui-plugin/skills/sui-component/references/autocomplete.md +51 -48
- 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/button.md +11 -11
- package/sui-plugin/skills/sui-component/references/calendar.md +1 -1
- package/sui-plugin/skills/sui-component/references/cards.md +9 -9
- 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 +12 -12
- package/sui-plugin/skills/sui-component/references/dialog.md +8 -8
- 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/file-input.md +106 -0
- package/sui-plugin/skills/sui-component/references/form.md +27 -25
- package/sui-plugin/skills/sui-component/references/image.md +8 -8
- package/sui-plugin/skills/sui-component/references/layout.md +47 -44
- package/sui-plugin/skills/sui-component/references/list.md +1 -1
- package/sui-plugin/skills/sui-component/references/menu.md +8 -8
- 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 +4 -4
- 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 +1 -1
- package/sui-plugin/skills/sui-component/references/snackbar.md +3 -3
- package/sui-plugin/skills/sui-component/references/split-view.md +2 -2
- package/sui-plugin/skills/sui-component/references/table.md +2 -1
- package/sui-plugin/skills/sui-component/references/tabs.md +18 -15
- 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 +9 -9
- package/sui-plugin/skills/sui-component/references/window.md +1 -1
- package/sui-plugin/skills/sui-form/SKILL.md +6 -3
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type PropsFormInput } from './propsFormInput';
|
|
2
|
+
import { type PropsSizePreset } from './propsSizePreset';
|
|
3
|
+
import { type FileInputDisplayType, type FileInputVariantType } from '../../types';
|
|
4
|
+
export type PropsFileInput = {
|
|
5
|
+
/** Visible label above the field, tied to the file input. With `hideDetails` it is hidden and becomes the `aria-label`, as in SInput. */
|
|
6
|
+
label?: string | undefined;
|
|
7
|
+
/** Text shown in the field while no file is chosen. */
|
|
8
|
+
placeholder?: string | undefined;
|
|
9
|
+
/** Accessible name when there is no visible `label`; wins over `label`. */
|
|
10
|
+
ariaLabel?: string | undefined;
|
|
11
|
+
/** Id of the element that names the file input. */
|
|
12
|
+
ariaLabelledby?: string | undefined;
|
|
13
|
+
/** The native input's `name`, so a plain `<form>` submit sends the files. */
|
|
14
|
+
name?: string | undefined;
|
|
15
|
+
/** Allow several files. The model is always a `File[]` (or `null` when empty), even for one file. */
|
|
16
|
+
multiple?: boolean | undefined;
|
|
17
|
+
/** Allowed types in the native format: `.csv,.xlsx`, `image/*`, `application/pdf`. Dropped files that do not match are rejected (the `reject` event). */
|
|
18
|
+
accept?: string | undefined;
|
|
19
|
+
/** How the chosen files are shown: their names, one chip each, or a count such as `3 files`. */
|
|
20
|
+
display?: FileInputDisplayType | undefined;
|
|
21
|
+
/** `input`: a text-field box. `dropzone`: a large area that also takes dragged files. */
|
|
22
|
+
variant?: FileInputVariantType | undefined;
|
|
23
|
+
/** Show a button that clears the chosen files. */
|
|
24
|
+
clearable?: boolean | undefined;
|
|
25
|
+
/** Accessible name of the clear button. */
|
|
26
|
+
clearAriaLabel?: string | undefined;
|
|
27
|
+
/** Show each file's size next to its name. */
|
|
28
|
+
showSize?: boolean | undefined;
|
|
29
|
+
/** Show a spinner and block picking, e.g. while the chosen file uploads or is parsed. */
|
|
30
|
+
loading?: boolean | undefined;
|
|
31
|
+
/** Accessible name of the loading spinner. */
|
|
32
|
+
loadingAriaLabel?: string | undefined;
|
|
33
|
+
/** The `count` display text for several files; `{count}` is replaced by the number. */
|
|
34
|
+
countText?: string | undefined;
|
|
35
|
+
/** The `dropzone` variant's call to action. */
|
|
36
|
+
dropText?: string | undefined;
|
|
37
|
+
/** Material Design icon before the selection (`input`) or above the text (`dropzone`); `''` hides it. */
|
|
38
|
+
icon?: string | undefined;
|
|
39
|
+
/** Smaller paddings, as SInput's `dense`. */
|
|
40
|
+
dense?: boolean | undefined;
|
|
41
|
+
} & PropsSizePreset & PropsFormInput;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type PropsFormInput } from './propsFormInput';
|
|
2
|
+
import { type PropsSizePreset } from './propsSizePreset';
|
|
3
|
+
import { type NumberInputControlVariant } from '../../types';
|
|
4
|
+
export type PropsNumberInput = {
|
|
5
|
+
/** Text above the field. With `hideDetails` it is hidden and becomes the field's `aria-label`. */
|
|
6
|
+
label?: string | undefined | null;
|
|
7
|
+
/** Hint shown while the field is empty. */
|
|
8
|
+
placeholder?: string | undefined | null;
|
|
9
|
+
/** Lowest allowed value. A lower value is clamped up to it on blur, and the decrement button stops there. */
|
|
10
|
+
min?: number | string | undefined | null;
|
|
11
|
+
/** Highest allowed value. A higher value is clamped down to it on blur, and the increment button stops there. */
|
|
12
|
+
max?: number | string | undefined | null;
|
|
13
|
+
/** Amount the buttons and the ArrowUp / ArrowDown keys add or remove. Default `1`. */
|
|
14
|
+
step?: number | string | undefined | null;
|
|
15
|
+
/**
|
|
16
|
+
* Decimal places the value keeps. Default `0` (whole numbers; typing `.` is refused). Use `2` for money.
|
|
17
|
+
* `null` allows any number of decimals. The field shows exactly this many decimals once it loses focus.
|
|
18
|
+
*/
|
|
19
|
+
precision?: number | null | undefined;
|
|
20
|
+
/** Layout of the buttons: `stacked` (both at the end of the field, default) or `split` (minus first, plus last). */
|
|
21
|
+
controlVariant?: NumberInputControlVariant | undefined | null;
|
|
22
|
+
/** Hides the increment and decrement buttons; the arrow keys still step the value. */
|
|
23
|
+
hideControls?: boolean | undefined | null;
|
|
24
|
+
/** Text inside the field before the number, such as a currency sign. */
|
|
25
|
+
prefix?: string | undefined | null;
|
|
26
|
+
/** Text inside the field after the number, such as `%` or a unit. */
|
|
27
|
+
suffix?: string | undefined | null;
|
|
28
|
+
/** Aligns the number to the right, as in a column of amounts. */
|
|
29
|
+
textRight?: boolean | undefined | null;
|
|
30
|
+
/** Focuses the field when it mounts. */
|
|
31
|
+
autofocus?: boolean | undefined | null;
|
|
32
|
+
/** Name submitted with a native form. */
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
/** Accessible name when the visible `label` is not enough (or absent); with `hideDetails` the label is used. */
|
|
35
|
+
ariaLabel?: string | undefined;
|
|
36
|
+
/** Id of the element that names the field, instead of `label`. */
|
|
37
|
+
ariaLabelledby?: string | undefined;
|
|
38
|
+
/** Accessible name of the increment button. Default `Increase`. */
|
|
39
|
+
incrementAriaLabel?: string | undefined;
|
|
40
|
+
/** Accessible name of the decrement button. Default `Decrease`. */
|
|
41
|
+
decrementAriaLabel?: string | undefined;
|
|
42
|
+
/** Smaller padding, as on SInput. */
|
|
43
|
+
dense?: boolean | undefined;
|
|
44
|
+
/** Removes the rounded corners. */
|
|
45
|
+
tile?: boolean | undefined;
|
|
46
|
+
} & PropsSizePreset & PropsFormInput;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type PropsColor, type PropsDisabled } from './core';
|
|
2
|
+
import { type PropsSizePreset } from './propsSizePreset';
|
|
3
|
+
export type PropsPagination = {
|
|
4
|
+
/** Current page, starting at 1. Use `v-model`. Values outside `1…length` are clamped. Defaults to `1`. */
|
|
5
|
+
modelValue?: number | undefined;
|
|
6
|
+
/** Number of pages (not the number of rows): `Math.ceil(totalItems / itemsPerPage)`. */
|
|
7
|
+
length: number;
|
|
8
|
+
/**
|
|
9
|
+
* Most slots to show, pages and ellipses together (not counting the arrow buttons). Hidden pages become "…",
|
|
10
|
+
* and the first and last page stay visible. Defaults to `7`.
|
|
11
|
+
*/
|
|
12
|
+
totalVisible?: number | undefined;
|
|
13
|
+
/** Shows the first-page and last-page buttons beside the previous and next buttons. Hidden in compact mode. */
|
|
14
|
+
showFirstLastPage?: boolean | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Compact mode: no first/last buttons and at most 5 page slots. Leave it unset and SPagination switches to it
|
|
17
|
+
* by itself when the full list does not fit its width (on a phone, for example). `true` or `false` forces it.
|
|
18
|
+
*/
|
|
19
|
+
compact?: boolean | undefined;
|
|
20
|
+
/** Accessible name of the `<nav>` landmark. Defaults to `'Pagination'`. */
|
|
21
|
+
ariaLabel?: string | undefined;
|
|
22
|
+
/** Accessible name of a page button, followed by its number: `'Page'` gives "Page 3". Defaults to `'Page'`. */
|
|
23
|
+
pageAriaLabel?: string | undefined;
|
|
24
|
+
/** Accessible name of the first-page button. Defaults to `'First page'`. */
|
|
25
|
+
firstAriaLabel?: string | undefined;
|
|
26
|
+
/** Accessible name of the previous-page button. Defaults to `'Previous page'`. */
|
|
27
|
+
prevAriaLabel?: string | undefined;
|
|
28
|
+
/** Accessible name of the next-page button. Defaults to `'Next page'`. */
|
|
29
|
+
nextAriaLabel?: string | undefined;
|
|
30
|
+
/** Accessible name of the last-page button. Defaults to `'Last page'`. */
|
|
31
|
+
lastAriaLabel?: string | undefined;
|
|
32
|
+
} & Pick<PropsDisabled, 'disabled'> & PropsColor & PropsSizePreset;
|
|
@@ -5,6 +5,7 @@ export type PropsRow = PropsContent & {
|
|
|
5
5
|
align?: GridAlignPropertyType | null | undefined;
|
|
6
6
|
justify?: GridJustifyPropertyType | null | undefined;
|
|
7
7
|
fillHeight?: boolean | null | undefined;
|
|
8
|
+
/** Removes the row's own padding; columns keep theirs. Pair with `gap` to line the grid up with text beside it. */
|
|
8
9
|
noOuterGutters?: boolean | null | undefined;
|
|
9
10
|
dense?: boolean | null | undefined;
|
|
10
11
|
gap?: number | string | null | undefined;
|
|
@@ -14,4 +14,6 @@ export type PropsSelect = {
|
|
|
14
14
|
grow?: boolean;
|
|
15
15
|
text?: boolean;
|
|
16
16
|
divided?: boolean;
|
|
17
|
+
/** Message shown in the open menu when `items` is empty. Without it (and without the `noData` slot) an empty menu stays blank. Put an `SEmptyState` in the `noData` slot for an icon or an action. */
|
|
18
|
+
noDataText?: string | undefined;
|
|
17
19
|
} & PropsBorder & PropsMenu & PropsFormInput & PropsContent & PropsColor;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type PropsComponentTheme, type PropsMeasurableStyles } from './core';
|
|
2
|
+
export type PropsSkeletonLoader = {
|
|
3
|
+
/**
|
|
4
|
+
* What to draw: presets joined by commas, each with an optional `@N` repeat count. Presets: `text`, `heading`,
|
|
5
|
+
* `avatar`, `button`, `image`, `card`, `list-item`, `list-item-avatar`, `table-row`, `table`. Example:
|
|
6
|
+
* `'avatar, text@3'`. Unknown presets are ignored. Defaults to `'text'`.
|
|
7
|
+
*/
|
|
8
|
+
type?: string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Shows the skeleton while `true` and the default slot once `false`. Without a default slot the skeleton is always
|
|
11
|
+
* shown, so a standalone `<SSkeletonLoader type="card" />` needs no `loading`.
|
|
12
|
+
*/
|
|
13
|
+
loading?: boolean | undefined;
|
|
14
|
+
/** Draws still bones, without the shimmer animation (the shimmer also stops for `prefers-reduced-motion`). */
|
|
15
|
+
boilerplate?: boolean | undefined;
|
|
16
|
+
/** Accessible name announced while the skeleton is shown. Defaults to `'Loading…'`. */
|
|
17
|
+
loadingText?: string | undefined;
|
|
18
|
+
} & PropsComponentTheme & PropsMeasurableStyles;
|
|
@@ -9,4 +9,8 @@ export type PropsTabs = {
|
|
|
9
9
|
bordered?: boolean;
|
|
10
10
|
selectedTabColor?: string;
|
|
11
11
|
shrink?: boolean;
|
|
12
|
+
/** Lay the tabs out on several rows when they do not fit, instead of one row that scrolls sideways. */
|
|
13
|
+
wrap?: boolean;
|
|
14
|
+
/** Show a scroll arrow at each end of the row that hides tabs (pointer only; the row still swipes). Ignored with `wrap`. */
|
|
15
|
+
showArrows?: boolean;
|
|
12
16
|
} & PropsBorder;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FileInputRuleOptions, FormInputModelValue, FormInputModelValueRule } from '../types';
|
|
2
|
+
/** A byte count as a short text: `512 B`, `1.5 KB`, `5 MB`. */
|
|
3
|
+
export declare const formatFileSize: (bytes: number) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a file matches an `accept` string, the way the browser's picker filters: an extension (`.csv`), a MIME
|
|
6
|
+
* type (`application/pdf`) or a MIME family (`image/*`). An empty or missing `accept` accepts every file.
|
|
7
|
+
*/
|
|
8
|
+
export declare const getIsFileAccepted: (file: File, accept?: string | null) => boolean;
|
|
9
|
+
/** The files held by a form value: SFileInput's `File[]`, or nothing for any other value. */
|
|
10
|
+
export declare const getFilesOfValue: (value?: FormInputModelValue | null) => File[];
|
|
11
|
+
/**
|
|
12
|
+
* Validation rules for SFileInput's `rules` prop: required, a size limit, an `accept` type check (a dropped file
|
|
13
|
+
* skips the picker's filter) and a file count limit. Pure: no i18n, pass `messages` to translate the texts.
|
|
14
|
+
* The texts that name a file are HTML-escaped, because the error line renders HTML and a file name is user input.
|
|
15
|
+
*
|
|
16
|
+
* @example <SFileInput v-model="files" accept=".csv,.xlsx" :rules="getFileInputRules({ maxSize: 5 * 1024 * 1024, accept: '.csv,.xlsx' })" />
|
|
17
|
+
*/
|
|
18
|
+
export declare const getFileInputRules: (options: FileInputRuleOptions) => FormInputModelValueRule[];
|
package/@types/lib/index.d.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type NumberInputBounds } from '../types';
|
|
2
|
+
/** Decimal places a number is written with: `0.25` → 2, `3` → 0, `1e-7` → 7. */
|
|
3
|
+
export declare const getDecimalCount: (value: number) => number;
|
|
4
|
+
/** Rounds to `precision` decimal places, dropping binary noise such as `0.1 + 0.2`; `null` keeps the value. */
|
|
5
|
+
export declare const getRoundedNumber: (value: number, precision: number | null) => number;
|
|
6
|
+
/** Keeps a value inside `min` and `max` (either may be `null` for no bound). */
|
|
7
|
+
export declare const getClampedNumber: (value: number, { min, max }: Pick<NumberInputBounds, "min" | "max">) => number;
|
|
8
|
+
/** Rounds a value to the bounds' precision, then clamps it into their range. */
|
|
9
|
+
export declare const getNormalizedNumber: (value: number, bounds: NumberInputBounds) => number;
|
|
10
|
+
/** Reads the number typed into a field; empty or unfinished text (`-`, `.`) and anything else is `null`. */
|
|
11
|
+
export declare const getParsedNumberText: (text: string) => number | null;
|
|
12
|
+
/**
|
|
13
|
+
* Whether text may stay in the field while the user types: digits, one leading `-` when negatives are allowed,
|
|
14
|
+
* and a `.` followed by at most `precision` digits (none when `precision` is 0, any when it is `null`).
|
|
15
|
+
*/
|
|
16
|
+
export declare const getIsNumberTextAllowed: (text: string, { allowNegative, precision }: {
|
|
17
|
+
allowNegative: boolean;
|
|
18
|
+
precision: number | null;
|
|
19
|
+
}) => boolean;
|
|
20
|
+
/** The text a field shows for a value: `precision` fixed decimals, or the plain number when it is `null`. */
|
|
21
|
+
export declare const getNumberText: (value: number | null | undefined, precision: number | null) => string;
|
|
22
|
+
/** A numeric prop given as a number or a string (`min="0"`); `null` when it is missing or not a finite number. */
|
|
23
|
+
export declare const getOptionalNumber: (value: number | string | null | undefined) => number | null;
|
|
@@ -9,3 +9,17 @@ export interface HorizontalEdges {
|
|
|
9
9
|
* scroller is aligned to its start.
|
|
10
10
|
*/
|
|
11
11
|
export declare const getScrollLeftToReveal: (scroller: HorizontalEdges, item: HorizontalEdges, scrollLeft: number) => number;
|
|
12
|
+
/** The scroll metrics of a horizontal scroller (a subset of HTMLElement). */
|
|
13
|
+
export interface HorizontalScrollMetrics {
|
|
14
|
+
scrollLeft: number;
|
|
15
|
+
scrollWidth: number;
|
|
16
|
+
clientWidth: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Which ends of a horizontal scroller hide content: `start` when it is scrolled away from the left edge,
|
|
20
|
+
* `end` when more content lies past the right edge. `tolerance` absorbs sub-pixel rounding.
|
|
21
|
+
*/
|
|
22
|
+
export declare const getHiddenScrollEdges: (metrics: HorizontalScrollMetrics, tolerance: number) => {
|
|
23
|
+
start: boolean;
|
|
24
|
+
end: boolean;
|
|
25
|
+
};
|
|
@@ -12,6 +12,8 @@ export declare const useAppBarService: (props: PropsAppBar) => {
|
|
|
12
12
|
appBarPosition: import("..").Position;
|
|
13
13
|
appBarHeight: number;
|
|
14
14
|
footerHeight: number;
|
|
15
|
+
hasLeftSafeArea: boolean;
|
|
16
|
+
hasRightSafeArea: boolean;
|
|
15
17
|
}, {
|
|
16
18
|
left: number;
|
|
17
19
|
right: number;
|
|
@@ -20,6 +22,8 @@ export declare const useAppBarService: (props: PropsAppBar) => {
|
|
|
20
22
|
appBarPosition: import("..").Position;
|
|
21
23
|
appBarHeight: number;
|
|
22
24
|
footerHeight: number;
|
|
25
|
+
hasLeftSafeArea: boolean;
|
|
26
|
+
hasRightSafeArea: boolean;
|
|
23
27
|
}>;
|
|
24
28
|
classes: import("vue").ComputedRef<{
|
|
25
29
|
s_appBar: boolean;
|
|
@@ -35,6 +39,16 @@ export declare const useAppBarService: (props: PropsAppBar) => {
|
|
|
35
39
|
width: string;
|
|
36
40
|
top: string;
|
|
37
41
|
transform: string;
|
|
42
|
+
paddingLeft?: undefined;
|
|
43
|
+
paddingRight?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
marginLeft: string;
|
|
46
|
+
marginRight: string;
|
|
47
|
+
width: string;
|
|
48
|
+
top: string;
|
|
49
|
+
transform: string;
|
|
50
|
+
paddingLeft: string;
|
|
51
|
+
paddingRight: string;
|
|
38
52
|
}>>;
|
|
39
53
|
isActive: import("vue").Ref<boolean, boolean>;
|
|
40
54
|
updateIsAppBarDisplayStatus: () => void;
|
|
@@ -8,6 +8,8 @@ export declare const useLayoutCoreService: (props: PropsLayout | PropsLayoutProv
|
|
|
8
8
|
appBarPosition: import("../..").Position;
|
|
9
9
|
appBarHeight: number;
|
|
10
10
|
footerHeight: number;
|
|
11
|
+
hasLeftSafeArea: boolean;
|
|
12
|
+
hasRightSafeArea: boolean;
|
|
11
13
|
}, {
|
|
12
14
|
left: number;
|
|
13
15
|
right: number;
|
|
@@ -16,6 +18,8 @@ export declare const useLayoutCoreService: (props: PropsLayout | PropsLayoutProv
|
|
|
16
18
|
appBarPosition: import("../..").Position;
|
|
17
19
|
appBarHeight: number;
|
|
18
20
|
footerHeight: number;
|
|
21
|
+
hasLeftSafeArea: boolean;
|
|
22
|
+
hasRightSafeArea: boolean;
|
|
19
23
|
}>>>;
|
|
20
24
|
isApp: import("vue").ComputedRef<boolean>;
|
|
21
25
|
};
|
|
@@ -8,6 +8,8 @@ export declare const useLayoutProviderService: (props: PropsLayoutProvider, appS
|
|
|
8
8
|
appBarPosition: import("..").Position;
|
|
9
9
|
appBarHeight: number;
|
|
10
10
|
footerHeight: number;
|
|
11
|
+
hasLeftSafeArea: boolean;
|
|
12
|
+
hasRightSafeArea: boolean;
|
|
11
13
|
}, {
|
|
12
14
|
left: number;
|
|
13
15
|
right: number;
|
|
@@ -16,6 +18,8 @@ export declare const useLayoutProviderService: (props: PropsLayoutProvider, appS
|
|
|
16
18
|
appBarPosition: import("..").Position;
|
|
17
19
|
appBarHeight: number;
|
|
18
20
|
footerHeight: number;
|
|
21
|
+
hasLeftSafeArea: boolean;
|
|
22
|
+
hasRightSafeArea: boolean;
|
|
19
23
|
} | {
|
|
20
24
|
left: number;
|
|
21
25
|
right: number;
|
|
@@ -24,5 +28,7 @@ export declare const useLayoutProviderService: (props: PropsLayoutProvider, appS
|
|
|
24
28
|
appBarPosition: import("..").Position;
|
|
25
29
|
appBarHeight: number;
|
|
26
30
|
footerHeight: number;
|
|
31
|
+
hasLeftSafeArea: boolean;
|
|
32
|
+
hasRightSafeArea: boolean;
|
|
27
33
|
}>;
|
|
28
34
|
};
|
|
@@ -8,6 +8,8 @@ export declare const useLayoutService: (props: PropsLayout) => {
|
|
|
8
8
|
appBarPosition: import("..").Position;
|
|
9
9
|
appBarHeight: number;
|
|
10
10
|
footerHeight: number;
|
|
11
|
+
hasLeftSafeArea: boolean;
|
|
12
|
+
hasRightSafeArea: boolean;
|
|
11
13
|
}, {
|
|
12
14
|
left: number;
|
|
13
15
|
right: number;
|
|
@@ -16,6 +18,8 @@ export declare const useLayoutService: (props: PropsLayout) => {
|
|
|
16
18
|
appBarPosition: import("..").Position;
|
|
17
19
|
appBarHeight: number;
|
|
18
20
|
footerHeight: number;
|
|
21
|
+
hasLeftSafeArea: boolean;
|
|
22
|
+
hasRightSafeArea: boolean;
|
|
19
23
|
}>;
|
|
20
24
|
isApp: import("vue").ComputedRef<boolean>;
|
|
21
25
|
left: import("vue").ComputedRef<string | undefined>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter, type Ref } from 'vue';
|
|
2
|
+
import type { PaginationItem, PaginationItemRange, PaginationRangeOptions } from '../types';
|
|
3
|
+
/** Number of pages needed for `itemsCount` rows at `itemsPerPage` rows a page. */
|
|
4
|
+
export declare const getPageCount: (itemsCount: number, itemsPerPage: number) => number;
|
|
5
|
+
/** Keeps `page` (starting at 1) between the first and the last page. With no pages it returns the first page. */
|
|
6
|
+
export declare const clampPage: (page: number, pageCount: number) => number;
|
|
7
|
+
/** The rows that `page` (starting at 1) shows, such as `{ first: 11, last: 20 }`. */
|
|
8
|
+
export declare const getPageItemRange: (page: number, itemsPerPage: number, itemsCount: number) => PaginationItemRange;
|
|
9
|
+
/**
|
|
10
|
+
* The page list SPagination draws: exactly `totalVisible` slots (or every page, when they all fit), with the
|
|
11
|
+
* first and last page kept and the gaps drawn as an ellipsis. An ellipsis always hides two pages or more.
|
|
12
|
+
*
|
|
13
|
+
* `{ page: 10, length: 20, totalVisible: 7 }` gives `[1, '…', 9, 10, 11, '…', 20]`.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getPaginationItems: ({ page, length, totalVisible }: PaginationRangeOptions) => PaginationItem[];
|
|
16
|
+
type PaginationServiceOptions = {
|
|
17
|
+
page: MaybeRefOrGetter<number>;
|
|
18
|
+
length: MaybeRefOrGetter<number>;
|
|
19
|
+
totalVisible: MaybeRefOrGetter<number>;
|
|
20
|
+
/** `true` or `false` forces the mode; `undefined` turns compact mode on when the full list does not fit. */
|
|
21
|
+
compact: MaybeRefOrGetter<boolean | null | undefined>;
|
|
22
|
+
showFirstLastPage: MaybeRefOrGetter<boolean | null | undefined>;
|
|
23
|
+
/** Changes that resize the page buttons, such as the `size` prop. They reset the measured width. */
|
|
24
|
+
layoutKey: MaybeRefOrGetter<unknown>;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* SPagination's state. It measures how many page slots fit in `element` and switches to compact mode (no
|
|
28
|
+
* first/last buttons, at most five page slots) when the full list would overflow, so it never scrolls the page.
|
|
29
|
+
*/
|
|
30
|
+
export declare const usePaginationService: (options: PaginationServiceOptions, element: Readonly<Ref<HTMLElement | null>>) => {
|
|
31
|
+
page: import("vue").ComputedRef<number>;
|
|
32
|
+
pageCount: import("vue").ComputedRef<number>;
|
|
33
|
+
items: import("vue").ComputedRef<PaginationItem[]>;
|
|
34
|
+
isCompact: import("vue").ComputedRef<boolean>;
|
|
35
|
+
showFirstLast: import("vue").ComputedRef<boolean>;
|
|
36
|
+
canGoBack: import("vue").ComputedRef<boolean>;
|
|
37
|
+
canGoForward: import("vue").ComputedRef<boolean>;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { SkeletonLoaderNode, SkeletonLoaderPresetType, SkeletonLoaderTypeEntry } from '../types';
|
|
3
|
+
/** Whether `name` is one of SSkeletonLoader's presets. */
|
|
4
|
+
export declare const isSkeletonLoaderPreset: (name: string) => name is SkeletonLoaderPresetType;
|
|
5
|
+
/**
|
|
6
|
+
* Splits a `type` string such as `'avatar, text@3'` into its presets and repeat counts. Spaces and empty parts are
|
|
7
|
+
* ignored, an unknown preset is dropped, and a missing or invalid `@N` counts as 1 (at most 50).
|
|
8
|
+
*/
|
|
9
|
+
export declare const parseSkeletonLoaderType: (type: string) => SkeletonLoaderTypeEntry[];
|
|
10
|
+
/** The bones a `type` string draws, with every repeat and every group (`card`, `table`, …) expanded. */
|
|
11
|
+
export declare const getSkeletonLoaderNodes: (type: string) => SkeletonLoaderNode[];
|
|
12
|
+
/** The classes of one drawn node: `s_skeletonLoader__bone` for a bone, and the preset's own element class. */
|
|
13
|
+
export declare const getSkeletonLoaderNodeClass: (node: SkeletonLoaderNode) => {
|
|
14
|
+
[x: string]: boolean;
|
|
15
|
+
s_skeletonLoader__bone: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** How many levels deep a node tree goes: 1 for bones only, 3 for a `table` (table → row → cell). */
|
|
18
|
+
export declare const getSkeletonLoaderDepth: (nodes: SkeletonLoaderNode[]) => number;
|
|
19
|
+
/** SSkeletonLoader's bone tree for a reactive `type` string. */
|
|
20
|
+
export declare const useSkeletonLoaderService: (type: MaybeRefOrGetter<string>) => {
|
|
21
|
+
nodes: import("vue").ComputedRef<SkeletonLoaderNode[]>;
|
|
22
|
+
};
|
|
@@ -2,8 +2,13 @@ import { type Ref } from 'vue';
|
|
|
2
2
|
/**
|
|
3
3
|
* STabs keeps its tabs on one row that scrolls sideways when they do not fit. This keeps the selected tab
|
|
4
4
|
* scrolled into view, without scrolling the page: on mount, once the web fonts have loaded, and whenever the
|
|
5
|
-
* selection changes.
|
|
5
|
+
* selection changes. It also reports which ends of the row hide tabs, so STabs can fade the row out there
|
|
6
|
+
* (and, with `showArrows`, show a scroll arrow), and scrolls the row by most of its width when an arrow is clicked.
|
|
6
7
|
*/
|
|
7
8
|
export declare const useTabsService: (selected: Ref<number | string>, element: Ref<HTMLElement | null | undefined>) => {
|
|
9
|
+
isStartHidden: Ref<boolean, boolean>;
|
|
10
|
+
isEndHidden: Ref<boolean, boolean>;
|
|
8
11
|
revealSelectedTab: () => void;
|
|
12
|
+
scrollBackward: () => void;
|
|
13
|
+
scrollForward: () => void;
|
|
9
14
|
};
|
package/@types/types/emits.d.ts
CHANGED
|
@@ -15,3 +15,15 @@ export interface EmitFormTextInput<T extends FormInputModelValue = FormInputMode
|
|
|
15
15
|
paste: [ClipboardEvent];
|
|
16
16
|
autocomplete: [HTMLInputElement | null];
|
|
17
17
|
}
|
|
18
|
+
/** Events of SNumberInput: the value after each change, plus the native focus events of its text box. */
|
|
19
|
+
export interface EmitNumberInput extends EmitFormInput<number | null> {
|
|
20
|
+
blur: [FocusEvent];
|
|
21
|
+
focus: [FocusEvent];
|
|
22
|
+
keydown: [KeyboardEvent];
|
|
23
|
+
}
|
|
24
|
+
export interface EmitFileInput extends EmitFormInput<File[] | null> {
|
|
25
|
+
/** The clear button emptied the field. */
|
|
26
|
+
clear: [];
|
|
27
|
+
/** Files left out: a dropped file that does not match `accept`, or the extra files when `multiple` is off. */
|
|
28
|
+
reject: [File[]];
|
|
29
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type FileInputDisplay, type FileInputVariant } from '../constants';
|
|
2
|
+
/** How SFileInput shows its files: `'names'`, `'chips'` or `'count'`. */
|
|
3
|
+
export type FileInputDisplayType = `${FileInputDisplay}`;
|
|
4
|
+
/** The look of SFileInput: `'input'` or `'dropzone'`. */
|
|
5
|
+
export type FileInputVariantType = `${FileInputVariant}`;
|
|
6
|
+
/** The error texts `getFileInputRules` returns; each has an English default. */
|
|
7
|
+
export type FileInputRuleMessages = {
|
|
8
|
+
/** No file chosen while `required` is on. */
|
|
9
|
+
required?: (() => string) | undefined;
|
|
10
|
+
/** A file is larger than `maxSize`; `maxSizeText` is the formatted limit, such as `5 MB`. */
|
|
11
|
+
tooLarge?: ((file: File, maxSizeText: string) => string) | undefined;
|
|
12
|
+
/** A file matches no entry of `accept`. */
|
|
13
|
+
wrongType?: ((file: File, accept: string) => string) | undefined;
|
|
14
|
+
/** More files than `maxFiles` are chosen. */
|
|
15
|
+
tooMany?: ((count: number, maxFiles: number) => string) | undefined;
|
|
16
|
+
};
|
|
17
|
+
/** What `getFileInputRules` checks. Every option is optional; give only the checks you need. */
|
|
18
|
+
export type FileInputRuleOptions = {
|
|
19
|
+
/** At least one file must be chosen. */
|
|
20
|
+
required?: boolean | undefined;
|
|
21
|
+
/** The largest allowed file, in bytes: `5 * 1024 * 1024` for 5 MB. */
|
|
22
|
+
maxSize?: number | undefined;
|
|
23
|
+
/** The allowed types, in the `accept` attribute format: `.csv,.xlsx` or `image/*`. */
|
|
24
|
+
accept?: string | undefined;
|
|
25
|
+
/** The most files allowed with `multiple`. */
|
|
26
|
+
maxFiles?: number | undefined;
|
|
27
|
+
messages?: FileInputRuleMessages | undefined;
|
|
28
|
+
};
|
package/@types/types/index.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type numberInputControlVariants } from '../constants';
|
|
2
|
+
/** Layout of SNumberInput's buttons: `stacked` (both at the end of the field) or `split` (minus first, plus last). */
|
|
3
|
+
export type NumberInputControlVariant = (typeof numberInputControlVariants)[number];
|
|
4
|
+
/** The range and rounding SNumberInput applies to a value. */
|
|
5
|
+
export type NumberInputBounds = {
|
|
6
|
+
/** Lowest allowed value; `null` for no lower bound. */
|
|
7
|
+
min: number | null;
|
|
8
|
+
/** Highest allowed value; `null` for no upper bound. */
|
|
9
|
+
max: number | null;
|
|
10
|
+
/** Decimal places the value is rounded to; `null` keeps every decimal. */
|
|
11
|
+
precision: number | null;
|
|
12
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type paginationEllipsis } from '../constants';
|
|
2
|
+
/** One slot in SPagination's page list: a page number, or a gap drawn as "…". */
|
|
3
|
+
export type PaginationItem = number | typeof paginationEllipsis;
|
|
4
|
+
/** Inputs of the page-range calculation. */
|
|
5
|
+
export type PaginationRangeOptions = {
|
|
6
|
+
/** Current page, starting at 1. Out-of-range values are clamped. */
|
|
7
|
+
page: number;
|
|
8
|
+
/** Number of pages. */
|
|
9
|
+
length: number;
|
|
10
|
+
/** Most slots (pages and ellipses together) to show. */
|
|
11
|
+
totalVisible: number;
|
|
12
|
+
};
|
|
13
|
+
/** The rows a page shows, both ends included and starting at 1. */
|
|
14
|
+
export type PaginationItemRange = {
|
|
15
|
+
first: number;
|
|
16
|
+
last: number;
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type SkeletonLoaderPreset } from '../constants';
|
|
2
|
+
/** A preset name of SSkeletonLoader's `type` string: `'text'`, `'avatar'`, `'list-item-avatar'`, … */
|
|
3
|
+
export type SkeletonLoaderPresetType = `${SkeletonLoaderPreset}`;
|
|
4
|
+
/** One comma-separated part of a `type` string, such as `text@3`. */
|
|
5
|
+
export type SkeletonLoaderTypeEntry = {
|
|
6
|
+
preset: SkeletonLoaderPresetType;
|
|
7
|
+
/** Times the preset is drawn, at least 1. */
|
|
8
|
+
count: number;
|
|
9
|
+
};
|
|
10
|
+
/** One drawn preset: a bone (no children) or a group of bones (`card`, `table`, …). */
|
|
11
|
+
export type SkeletonLoaderNode = {
|
|
12
|
+
/** Stable key for `v-for`, made of the node's position: `'0'`, `'0-2'`. */
|
|
13
|
+
key: string;
|
|
14
|
+
preset: SkeletonLoaderPresetType;
|
|
15
|
+
children: SkeletonLoaderNode[];
|
|
16
|
+
};
|