@nubisco/ui 1.53.0 → 1.53.2
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/dist/components/AiLabel.d.ts +19 -0
- package/dist/components/Badge.d.ts +23 -0
- package/dist/components/BlueprintControls.d.ts +21 -0
- package/dist/components/BlueprintMinimap.d.ts +17 -0
- package/dist/components/Board.d.ts +64 -0
- package/dist/components/BottomPanel.d.ts +13 -0
- package/dist/components/Button.d.ts +34 -0
- package/dist/components/Button.vue.d.ts +1 -1
- package/dist/components/Calendar.d.ts +32 -0
- package/dist/components/Charts/BarChart.d.ts +12 -0
- package/dist/components/Charts/GanttChart.d.ts +81 -0
- package/dist/components/Charts/InterpolationChart.d.ts +33 -0
- package/dist/components/Charts/LineChart.d.ts +15 -0
- package/dist/components/Charts/PieChart.d.ts +11 -0
- package/dist/components/Charts/Sparkline.d.ts +11 -0
- package/dist/components/Charts/shared/types.d.ts +53 -0
- package/dist/components/Checkbox.d.ts +9 -0
- package/dist/components/CheckboxGroup.d.ts +17 -0
- package/dist/components/ColorStrip.d.ts +22 -0
- package/dist/components/CommandPalette.d.ts +40 -0
- package/dist/components/DataTable.d.ts +131 -0
- package/dist/components/DatePicker.d.ts +52 -0
- package/dist/components/Field.d.ts +33 -0
- package/dist/components/FileUploader.d.ts +27 -0
- package/dist/components/FileUploader.vue.d.ts +1 -1
- package/dist/components/Flag.d.ts +9 -0
- package/dist/components/Form.d.ts +5 -0
- package/dist/components/Grid.d.ts +345 -0
- package/dist/components/Icon.d.ts +59 -0
- package/dist/components/Icon.vue.d.ts +1 -1
- package/dist/components/ImageCropper.d.ts +27 -0
- package/dist/components/JsonTree.d.ts +33 -0
- package/dist/components/Label.d.ts +14 -0
- package/dist/components/Menu.d.ts +53 -0
- package/dist/components/Message.d.ts +17 -0
- package/dist/components/Modal.d.ts +10 -0
- package/dist/components/Modal.vue.d.ts +1 -1
- package/dist/components/NumberInput.vue.d.ts +1 -1
- package/dist/components/Pagination.d.ts +38 -0
- package/dist/components/Pagination.vue.d.ts +1 -1
- package/dist/components/ProgressBar.d.ts +27 -0
- package/dist/components/Radio.d.ts +28 -0
- package/dist/components/Select.d.ts +23 -0
- package/dist/components/Shell.d.ts +60 -0
- package/dist/components/ShellPanel.d.ts +33 -0
- package/dist/components/SidebarBrand.d.ts +14 -0
- package/dist/components/SidebarLink.d.ts +24 -0
- package/dist/components/SidebarMenu.d.ts +10 -0
- package/dist/components/SidebarMenuGroup.d.ts +16 -0
- package/dist/components/SidebarMenuItem.d.ts +42 -0
- package/dist/components/Slider.d.ts +26 -0
- package/dist/components/Switch.d.ts +20 -0
- package/dist/components/TextInput.vue.d.ts +1 -1
- package/dist/components/Tree.d.ts +68 -0
- package/dist/components/TreeNode.vue.d.ts.map +1 -1
- package/dist/components/UserMenu.d.ts +43 -0
- package/dist/components/labs/Spreadsheet.d.ts +104 -0
- package/dist/directives/ToolTip.directive.d.ts +1 -1
- package/dist/global.d.ts +135 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/Decoration.d.ts +6 -0
- package/dist/types/Option.d.ts +29 -0
- package/dist/types/Props.d.ts +121 -0
- package/dist/types/Size.d.ts +33 -0
- package/dist/types/Variants.d.ts +12 -0
- package/dist/types/Vite.d.ts +3 -0
- package/dist/ui.css +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue'
|
|
2
|
+
import type { ESizeShort } from '../types/Size.d'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* NbDataTable: presentational, data-driven table for read-mostly application
|
|
6
|
+
* lists, modeled on the Carbon Design System Data Table. It renders full
|
|
7
|
+
* `<table>` semantics with sorting, selection, states, density, sticky header
|
|
8
|
+
* and horizontal scroll. It is NOT an editable spreadsheet. Reach for
|
|
9
|
+
* `NbSpreadsheet` when cells must be edited in place.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// #region alignment / identity helpers
|
|
13
|
+
/** Horizontal alignment for a column's header and body cells. */
|
|
14
|
+
export type TColumnAlign = 'left' | 'center' | 'right'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Value used to identify a row. Either the name of a property on the row, or a
|
|
18
|
+
* function deriving a stable key from the row. Keys drive selection, sorting
|
|
19
|
+
* reconciliation and Vue's `:key`.
|
|
20
|
+
*/
|
|
21
|
+
export type TRowKey<T> = keyof T | ((row: T) => string | number)
|
|
22
|
+
// #endregion
|
|
23
|
+
|
|
24
|
+
// #region column
|
|
25
|
+
/**
|
|
26
|
+
* A single column definition. Custom cell content can be supplied three ways,
|
|
27
|
+
* in precedence order: the `#cell-<key>` slot, then the `render` function, then
|
|
28
|
+
* the raw value read from `row[key]`.
|
|
29
|
+
*/
|
|
30
|
+
export interface IDataTableColumn<T = Record<string, unknown>> {
|
|
31
|
+
/** Stable identifier, also the default property read from each row and the
|
|
32
|
+
* value emitted in sort events / used to target the `#cell-<key>` slot. */
|
|
33
|
+
key: string
|
|
34
|
+
/** Header label shown in the `<th>`. */
|
|
35
|
+
header: string
|
|
36
|
+
/** Fixed column width. A number is treated as pixels, a string is used
|
|
37
|
+
* verbatim (e.g. `'20%'`, `'12rem'`). Applied via `<colgroup>`. */
|
|
38
|
+
width?: string | number
|
|
39
|
+
/** Horizontal alignment of the header and its body cells. Default `left`. */
|
|
40
|
+
align?: TColumnAlign
|
|
41
|
+
/** Enables click / keyboard sorting on the header and exposes `aria-sort`. */
|
|
42
|
+
sortable?: boolean
|
|
43
|
+
/** Per-column cell renderer. Receives the row and the resolved cell value and
|
|
44
|
+
* returns renderable content. Overridden by a `#cell-<key>` slot when both
|
|
45
|
+
* are present. */
|
|
46
|
+
render?: (row: T, value: unknown, rowIndex: number) => VNodeChild
|
|
47
|
+
/** Extra class applied to every body cell in this column. */
|
|
48
|
+
cellClass?: string
|
|
49
|
+
/** Accessible-but-hidden columns still occupy a `<col>`. Set to hide. */
|
|
50
|
+
hidden?: boolean
|
|
51
|
+
}
|
|
52
|
+
// #endregion
|
|
53
|
+
|
|
54
|
+
// #region sorting
|
|
55
|
+
/** Sort directions. `none` clears sorting for the column. */
|
|
56
|
+
export type TSortDirection = 'asc' | 'desc' | 'none'
|
|
57
|
+
|
|
58
|
+
/** Controlled sort descriptor. `key` matches an `IDataTableColumn.key`. */
|
|
59
|
+
export interface IDataTableSortState {
|
|
60
|
+
key: string
|
|
61
|
+
direction: TSortDirection
|
|
62
|
+
}
|
|
63
|
+
// #endregion
|
|
64
|
+
|
|
65
|
+
// #region selection
|
|
66
|
+
/** Selection mode for the leading control column. */
|
|
67
|
+
export type TDataTableSelectable = 'none' | 'single' | 'multiple'
|
|
68
|
+
// #endregion
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Props for `NbDataTable`. Sorting, selection and pagination are all
|
|
72
|
+
* *controlled*: the component emits intent and reflects the props you pass
|
|
73
|
+
* back, it does not mutate `rows` itself. This keeps it honest for server-side
|
|
74
|
+
* paging and sorting.
|
|
75
|
+
*/
|
|
76
|
+
export interface IDataTableProps<T = Record<string, unknown>> {
|
|
77
|
+
/** Column definitions, left to right. */
|
|
78
|
+
columns: IDataTableColumn<T>[]
|
|
79
|
+
/** Row data. Order is respected as-is (sort server- or parent-side). */
|
|
80
|
+
rows: T[]
|
|
81
|
+
/** Row identity. See {@link TRowKey}. */
|
|
82
|
+
rowKey: TRowKey<T>
|
|
83
|
+
/** Density. Matches the shared `ESizeShort` scale. Default `md`. */
|
|
84
|
+
size?: ESizeShort | 'sm' | 'md' | 'lg'
|
|
85
|
+
/** Controlled sort state, reflected in header UI and `aria-sort`. */
|
|
86
|
+
sortState?: IDataTableSortState | null
|
|
87
|
+
/** Row selection mode. Default `none`. */
|
|
88
|
+
selectable?: TDataTableSelectable
|
|
89
|
+
/** Controlled selected row keys (`v-model:selected`). */
|
|
90
|
+
selected?: (string | number)[]
|
|
91
|
+
/** Renders skeleton placeholder rows instead of data. */
|
|
92
|
+
loading?: boolean
|
|
93
|
+
/** Number of skeleton rows shown while `loading`. Default 5. */
|
|
94
|
+
skeletonRows?: number
|
|
95
|
+
/** Error message shown in place of the body. Overrides `empty`. */
|
|
96
|
+
error?: string
|
|
97
|
+
/** Message shown when there are no rows and not loading. */
|
|
98
|
+
emptyMessage?: string
|
|
99
|
+
/** Pins the header while the body scrolls vertically. Default true. */
|
|
100
|
+
stickyHeader?: boolean
|
|
101
|
+
/** Alternating row background (Carbon "zebra"). Default false. */
|
|
102
|
+
zebra?: boolean
|
|
103
|
+
/** Optional toolbar title. */
|
|
104
|
+
title?: string
|
|
105
|
+
/** Optional toolbar sub-text under the title. */
|
|
106
|
+
description?: string
|
|
107
|
+
/** Accessible name for the `<table>` (rendered as a visually-hidden
|
|
108
|
+
* `<caption>` when no `title` is set). */
|
|
109
|
+
ariaLabel?: string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Payload emitted by `NbDataTable` events. */
|
|
113
|
+
export interface IDataTableEmits<T = Record<string, unknown>> {
|
|
114
|
+
/** Next sort state after the user activates a sortable header. */
|
|
115
|
+
sort: [state: IDataTableSortState]
|
|
116
|
+
/** Updated selected keys (`v-model:selected`). */
|
|
117
|
+
'update:selected': [keys: (string | number)[]]
|
|
118
|
+
/** A body row was clicked (not fired for checkbox / action clicks). */
|
|
119
|
+
'row-click': [row: T, rowIndex: number]
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export type {
|
|
123
|
+
IDataTableColumn as NbDataTableColumn,
|
|
124
|
+
IDataTableProps as NbDataTableProps,
|
|
125
|
+
IDataTableSortState as NbDataTableSortState,
|
|
126
|
+
IDataTableEmits as NbDataTableEmits,
|
|
127
|
+
TColumnAlign as NbDataTableAlign,
|
|
128
|
+
TSortDirection as NbDataTableSortDirection,
|
|
129
|
+
TDataTableSelectable as NbDataTableSelectable,
|
|
130
|
+
TRowKey as NbDataTableRowKey,
|
|
131
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { IReadableFieldComponent } from '../types/Props.d'
|
|
2
|
+
|
|
3
|
+
interface IDatePickerProps extends IReadableFieldComponent {
|
|
4
|
+
/**
|
|
5
|
+
* Selected date as an ISO string (YYYY-MM-DD) or null.
|
|
6
|
+
* For range type, use `modelValue` for the start date and `endValue` for the end date.
|
|
7
|
+
*/
|
|
8
|
+
modelValue?: string | null
|
|
9
|
+
/**
|
|
10
|
+
* Picker type:
|
|
11
|
+
* - `simple` — text-only input, no calendar dropdown.
|
|
12
|
+
* - `single` — text input with a calendar dropdown for picking one date.
|
|
13
|
+
* - `range` — two inputs for selecting a start and end date.
|
|
14
|
+
*/
|
|
15
|
+
type?: 'simple' | 'single' | 'range'
|
|
16
|
+
/** End date for range type (ISO string YYYY-MM-DD). */
|
|
17
|
+
endValue?: string | null
|
|
18
|
+
/** Minimum selectable date (ISO string YYYY-MM-DD). */
|
|
19
|
+
min?: string
|
|
20
|
+
/** Maximum selectable date (ISO string YYYY-MM-DD). */
|
|
21
|
+
max?: string
|
|
22
|
+
/** First day of the week: 0 = Sunday, 1 = Monday. Defaults to 1. */
|
|
23
|
+
weekStart?: 0 | 1
|
|
24
|
+
/** BCP 47 locale tag for month and weekday labels. Defaults to browser locale. */
|
|
25
|
+
locale?: string
|
|
26
|
+
/** Placeholder for the end date input (range type only). */
|
|
27
|
+
endPlaceholder?: string
|
|
28
|
+
/**
|
|
29
|
+
* Label for the end date field (range type only).
|
|
30
|
+
* When set, each field renders its own label: `label` above the start
|
|
31
|
+
* field and `endLabel` above the end field.
|
|
32
|
+
*/
|
|
33
|
+
endLabel?: string
|
|
34
|
+
/**
|
|
35
|
+
* Validation error for the end date field (range type only).
|
|
36
|
+
* Marks only the end field as invalid, so users can tell which of the
|
|
37
|
+
* two fields needs correction. Takes precedence over `endWarning`.
|
|
38
|
+
*/
|
|
39
|
+
endError?: string
|
|
40
|
+
/** Non-blocking caution message for the end date field (range type only). */
|
|
41
|
+
endWarning?: string
|
|
42
|
+
/**
|
|
43
|
+
* Dates that cannot be selected, in addition to `min`/`max`:
|
|
44
|
+
* either an array of ISO strings (YYYY-MM-DD) or a predicate that
|
|
45
|
+
* receives an ISO string and returns true when the date is disabled.
|
|
46
|
+
*/
|
|
47
|
+
disabledDates?: string[] | ((date: string) => boolean)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type { IDatePickerProps }
|
|
51
|
+
|
|
52
|
+
export type { IDatePickerProps as NbDatePickerProps }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
interface IFieldProps {
|
|
2
|
+
/** Label text. Omit and use the `#label` slot for a custom label. */
|
|
3
|
+
label?: string
|
|
4
|
+
/** Helper text shown under the control, muted. */
|
|
5
|
+
hint?: string
|
|
6
|
+
/**
|
|
7
|
+
* `row` (default): label sits beside the control, sharing the container's
|
|
8
|
+
* label-column spine so every field lines up. `stack`: label on its own
|
|
9
|
+
* line above a full-width control.
|
|
10
|
+
*/
|
|
11
|
+
orientation?: 'row' | 'stack'
|
|
12
|
+
/**
|
|
13
|
+
* Vertical alignment of the label against the control. `center` (default)
|
|
14
|
+
* suits single-line controls; `start` top-aligns the label against a tall
|
|
15
|
+
* control such as a multiline text area.
|
|
16
|
+
*/
|
|
17
|
+
align?: 'center' | 'start'
|
|
18
|
+
/**
|
|
19
|
+
* `fill` (default): the control fills the value column so every field's
|
|
20
|
+
* value shares one right edge. `fit`: the control shrinks to its content and
|
|
21
|
+
* the label takes the remaining width — for a small control such as a switch,
|
|
22
|
+
* so its short label can run wide instead of being clipped to the column.
|
|
23
|
+
*/
|
|
24
|
+
control?: 'fill' | 'fit'
|
|
25
|
+
/**
|
|
26
|
+
* Id of the control the label points at. Defaults to an auto-generated id
|
|
27
|
+
* that is also exposed to the default slot as `{ id }` — bind it to the
|
|
28
|
+
* control for a proper label/control association.
|
|
29
|
+
*/
|
|
30
|
+
labelFor?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { IFieldProps }
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IDefaultProps } from '../types/Props.d'
|
|
2
|
+
import { EVariant } from '../types/Variants.d'
|
|
3
|
+
|
|
4
|
+
enum EFileUploaderStatus {
|
|
5
|
+
Idle = 'idle',
|
|
6
|
+
Loading = 'loading',
|
|
7
|
+
Success = 'success',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface IFileItem {
|
|
11
|
+
file: File
|
|
12
|
+
status: EFileUploaderStatus
|
|
13
|
+
error?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface IFileUploaderProps extends IDefaultProps {
|
|
17
|
+
heading?: string
|
|
18
|
+
description?: string
|
|
19
|
+
buttonLabel?: string
|
|
20
|
+
variant?: EVariant
|
|
21
|
+
accept?: string
|
|
22
|
+
multiple?: boolean
|
|
23
|
+
maxSize?: number
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { EFileUploaderStatus, IFileItem, IFileUploaderProps }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EVariant } from '
|
|
1
|
+
import { EVariant } from '../types/Variants.d';
|
|
2
2
|
import { EFileUploaderStatus, IFileItem, IFileUploaderProps } from './FileUploader.d';
|
|
3
3
|
/** Programmatically set file status (useful after async upload). */
|
|
4
4
|
declare function setFileStatus(index: number, status: IFileItem['status'], error?: string): void;
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
import type { PropType } from 'vue'
|
|
2
|
+
|
|
3
|
+
// Breakpoint names — mobile-first (min-width)
|
|
4
|
+
export type TBreakpoint = 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
5
|
+
|
|
6
|
+
// Grid direction types
|
|
7
|
+
export type TGridType = 'row' | 'col' | 'row-reverse' | 'col-reverse'
|
|
8
|
+
export type TGridTypeResponsive = Partial<Record<TBreakpoint, TGridType>>
|
|
9
|
+
export type TGridTypeFn = () => TGridType
|
|
10
|
+
export type TGridTypeInput = TGridType | TGridTypeResponsive | TGridTypeFn
|
|
11
|
+
|
|
12
|
+
// Alignment types
|
|
13
|
+
export type TGridAlign = 'start' | 'end' | 'center' | 'baseline' | 'stretch'
|
|
14
|
+
export type TGridAlignResponsive = Partial<Record<TBreakpoint, TGridAlign>>
|
|
15
|
+
export type TGridAlignFn = () => TGridAlign
|
|
16
|
+
export type TGridAlignInput = TGridAlign | TGridAlignResponsive | TGridAlignFn
|
|
17
|
+
|
|
18
|
+
// Justify types
|
|
19
|
+
export type TGridJustify =
|
|
20
|
+
| 'around'
|
|
21
|
+
| 'between'
|
|
22
|
+
| 'center'
|
|
23
|
+
| 'end'
|
|
24
|
+
| 'evenly'
|
|
25
|
+
| 'start'
|
|
26
|
+
export type TGridJustifyResponsive = Partial<Record<TBreakpoint, TGridJustify>>
|
|
27
|
+
export type TGridJustifyFn = () => TGridJustify
|
|
28
|
+
export type TGridJustifyInput =
|
|
29
|
+
| TGridJustify
|
|
30
|
+
| TGridJustifyResponsive
|
|
31
|
+
| TGridJustifyFn
|
|
32
|
+
|
|
33
|
+
// Wrap types
|
|
34
|
+
export type TGridWrap = 'nowrap' | 'wrap' | 'reverse'
|
|
35
|
+
export type TGridWrapResponsive = Partial<Record<TBreakpoint, TGridWrap>>
|
|
36
|
+
export type TGridWrapFn = () => TGridWrap
|
|
37
|
+
export type TGridWrapInput = TGridWrap | TGridWrapResponsive | TGridWrapFn
|
|
38
|
+
|
|
39
|
+
// Gap types
|
|
40
|
+
export type TGapSize = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
|
|
41
|
+
export type TGridGap = TGapSize | Partial<Record<TBreakpoint, TGapSize>>
|
|
42
|
+
export type TGridGapFn = () => TGapSize
|
|
43
|
+
export type TGridGapInput =
|
|
44
|
+
| TGapSize
|
|
45
|
+
| Partial<Record<TBreakpoint, TGapSize>>
|
|
46
|
+
| TGridGapFn
|
|
47
|
+
|
|
48
|
+
// Grid columns (1-16)
|
|
49
|
+
export type TGridColumns =
|
|
50
|
+
| 1
|
|
51
|
+
| 2
|
|
52
|
+
| 3
|
|
53
|
+
| 4
|
|
54
|
+
| 5
|
|
55
|
+
| 6
|
|
56
|
+
| 7
|
|
57
|
+
| 8
|
|
58
|
+
| 9
|
|
59
|
+
| 10
|
|
60
|
+
| 11
|
|
61
|
+
| 12
|
|
62
|
+
| 13
|
|
63
|
+
| 14
|
|
64
|
+
| 15
|
|
65
|
+
| 16
|
|
66
|
+
export type TGridColumnsResponsive = Partial<Record<TBreakpoint, TGridColumns>>
|
|
67
|
+
export type TGridColumnsFn = () => TGridColumns
|
|
68
|
+
export type TGridColumnsInput =
|
|
69
|
+
| TGridColumns
|
|
70
|
+
| TGridColumnsResponsive
|
|
71
|
+
| TGridColumnsFn
|
|
72
|
+
|
|
73
|
+
// Grid shift (0-15)
|
|
74
|
+
export type TGridShift =
|
|
75
|
+
| 0
|
|
76
|
+
| 1
|
|
77
|
+
| 2
|
|
78
|
+
| 3
|
|
79
|
+
| 4
|
|
80
|
+
| 5
|
|
81
|
+
| 6
|
|
82
|
+
| 7
|
|
83
|
+
| 8
|
|
84
|
+
| 9
|
|
85
|
+
| 10
|
|
86
|
+
| 11
|
|
87
|
+
| 12
|
|
88
|
+
| 13
|
|
89
|
+
| 14
|
|
90
|
+
| 15
|
|
91
|
+
export type TGridShiftResponsive = Partial<Record<TBreakpoint, TGridShift>>
|
|
92
|
+
export type TGridShiftFn = () => TGridShift
|
|
93
|
+
export type TGridShiftInput = TGridShift | TGridShiftResponsive | TGridShiftFn
|
|
94
|
+
|
|
95
|
+
// Visible types
|
|
96
|
+
export type TGridVisibleResponsive = Partial<Record<TBreakpoint, boolean>>
|
|
97
|
+
export type TGridVisibleFn = () => boolean
|
|
98
|
+
export type TGridVisibleInput =
|
|
99
|
+
| boolean
|
|
100
|
+
| TGridVisibleResponsive
|
|
101
|
+
| TGridVisibleFn
|
|
102
|
+
|
|
103
|
+
// Boolean responsive type (for first, last, reverse — array of breakpoints, not objects)
|
|
104
|
+
export type TBooleanResponsive = boolean | TBreakpoint[]
|
|
105
|
+
|
|
106
|
+
// Grid mode
|
|
107
|
+
export type TGridMode = 'wide' | 'narrow' | 'condensed'
|
|
108
|
+
|
|
109
|
+
// Class collection type
|
|
110
|
+
export type TClassCollection = Record<string, boolean>
|
|
111
|
+
|
|
112
|
+
// Handler context for class generation
|
|
113
|
+
export interface IHandlerContext {
|
|
114
|
+
collection: TClassCollection
|
|
115
|
+
breakpoint?: string
|
|
116
|
+
classMap?: Record<string, string>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Component props interface
|
|
120
|
+
export interface IGridProps {
|
|
121
|
+
id?: string | null
|
|
122
|
+
is?: string
|
|
123
|
+
dir?: TGridTypeInput
|
|
124
|
+
align?: TGridAlignInput | null
|
|
125
|
+
justify?: TGridJustifyInput | null
|
|
126
|
+
gap?: TGridGapInput | null
|
|
127
|
+
grid?: TGridColumnsInput | null
|
|
128
|
+
shift?: TGridShiftInput | null
|
|
129
|
+
wrap?: TGridWrapInput | null
|
|
130
|
+
first?: TBooleanResponsive | null
|
|
131
|
+
last?: TBooleanResponsive | null
|
|
132
|
+
visible?: TGridVisibleInput | null
|
|
133
|
+
reverse?: TBooleanResponsive
|
|
134
|
+
grow?: boolean | null
|
|
135
|
+
flex?: boolean | null
|
|
136
|
+
shrink?: boolean | null
|
|
137
|
+
distributed?: boolean
|
|
138
|
+
mode?: TGridMode
|
|
139
|
+
tabIndex?: string | null
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Prop definitions for defineProps
|
|
143
|
+
export const gridPropDefinitions = {
|
|
144
|
+
id: {
|
|
145
|
+
type: String as PropType<string>,
|
|
146
|
+
default: null,
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
is: {
|
|
150
|
+
type: String as PropType<string>,
|
|
151
|
+
default: 'div',
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
dir: {
|
|
155
|
+
type: [String, Object, Function] as PropType<TGridTypeInput>,
|
|
156
|
+
default: 'row',
|
|
157
|
+
validator: (value: TGridTypeInput): boolean => {
|
|
158
|
+
if (typeof value === 'function') return true
|
|
159
|
+
if (typeof value === 'string') {
|
|
160
|
+
return (['row', 'col', 'row-reverse', 'col-reverse'] as const).includes(
|
|
161
|
+
value as TGridType,
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
return Object.values(value).every((v) =>
|
|
165
|
+
(['row', 'col', 'row-reverse', 'col-reverse'] as const).includes(
|
|
166
|
+
v as TGridType,
|
|
167
|
+
),
|
|
168
|
+
)
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
|
|
172
|
+
align: {
|
|
173
|
+
type: [String, Object, Function] as PropType<TGridAlignInput>,
|
|
174
|
+
default: null,
|
|
175
|
+
validator: (value: TGridAlignInput): boolean => {
|
|
176
|
+
if (value == null || typeof value === 'function') return true
|
|
177
|
+
if (typeof value === 'string') {
|
|
178
|
+
return (
|
|
179
|
+
['start', 'end', 'center', 'baseline', 'stretch'] as const
|
|
180
|
+
).includes(value as TGridAlign)
|
|
181
|
+
}
|
|
182
|
+
return Object.values(value).every((v) =>
|
|
183
|
+
(['start', 'end', 'center', 'baseline', 'stretch'] as const).includes(
|
|
184
|
+
v as TGridAlign,
|
|
185
|
+
),
|
|
186
|
+
)
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
|
|
190
|
+
justify: {
|
|
191
|
+
type: [String, Object, Function] as PropType<TGridJustifyInput>,
|
|
192
|
+
default: null,
|
|
193
|
+
validator: (value: TGridJustifyInput): boolean => {
|
|
194
|
+
if (value == null || typeof value === 'function') return true
|
|
195
|
+
if (typeof value === 'string') {
|
|
196
|
+
return (
|
|
197
|
+
['around', 'between', 'center', 'end', 'evenly', 'start'] as const
|
|
198
|
+
).includes(value as TGridJustify)
|
|
199
|
+
}
|
|
200
|
+
return Object.values(value).every((v) =>
|
|
201
|
+
(
|
|
202
|
+
['around', 'between', 'center', 'end', 'evenly', 'start'] as const
|
|
203
|
+
).includes(v as TGridJustify),
|
|
204
|
+
)
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
gap: {
|
|
209
|
+
type: [String, Object, Function] as PropType<TGridGapInput>,
|
|
210
|
+
default: null,
|
|
211
|
+
validator: (value: TGridGapInput): boolean => {
|
|
212
|
+
if (value == null || typeof value === 'function') return true
|
|
213
|
+
const validSizes = ['xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl'] as const
|
|
214
|
+
if (typeof value === 'string') {
|
|
215
|
+
return validSizes.includes(value as TGapSize)
|
|
216
|
+
}
|
|
217
|
+
return Object.values(value).every((v) =>
|
|
218
|
+
validSizes.includes(v as TGapSize),
|
|
219
|
+
)
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
|
|
223
|
+
grid: {
|
|
224
|
+
type: [Number, String, Object, Function] as PropType<TGridColumnsInput>,
|
|
225
|
+
default: null,
|
|
226
|
+
validator: (value: TGridColumnsInput): boolean => {
|
|
227
|
+
if (value == null || typeof value === 'function') return true
|
|
228
|
+
const isValidColumn = (v: number | string) => {
|
|
229
|
+
const num = typeof v === 'string' ? parseInt(v, 10) : v
|
|
230
|
+
return num >= 1 && num <= 16 && !isNaN(num)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
234
|
+
return isValidColumn(value)
|
|
235
|
+
}
|
|
236
|
+
return Object.values(value).every(isValidColumn)
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
shift: {
|
|
241
|
+
type: [Number, String, Object, Function] as PropType<TGridShiftInput>,
|
|
242
|
+
default: null,
|
|
243
|
+
validator: (value: TGridShiftInput): boolean => {
|
|
244
|
+
if (value == null || typeof value === 'function') return true
|
|
245
|
+
const isValidShift = (v: number | string) => {
|
|
246
|
+
const num = typeof v === 'string' ? parseInt(v, 10) : v
|
|
247
|
+
return num >= 0 && num <= 15 && !isNaN(num)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (typeof value === 'number' || typeof value === 'string') {
|
|
251
|
+
return isValidShift(value)
|
|
252
|
+
}
|
|
253
|
+
return Object.values(value).every(isValidShift)
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
|
|
257
|
+
wrap: {
|
|
258
|
+
type: [String, Object, Function] as PropType<TGridWrapInput>,
|
|
259
|
+
default: null,
|
|
260
|
+
validator: (value: TGridWrapInput): boolean => {
|
|
261
|
+
if (value == null || typeof value === 'function') return true
|
|
262
|
+
if (typeof value === 'string') {
|
|
263
|
+
return (['nowrap', 'wrap', 'reverse'] as const).includes(
|
|
264
|
+
value as TGridWrap,
|
|
265
|
+
)
|
|
266
|
+
}
|
|
267
|
+
return Object.values(value).every((v) =>
|
|
268
|
+
(['nowrap', 'wrap', 'reverse'] as const).includes(v as TGridWrap),
|
|
269
|
+
)
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
|
|
273
|
+
first: {
|
|
274
|
+
type: [Boolean, Array] as PropType<TBooleanResponsive>,
|
|
275
|
+
default: null,
|
|
276
|
+
validator: (value: TBooleanResponsive): boolean => {
|
|
277
|
+
if (value == null) return true
|
|
278
|
+
if (typeof value === 'boolean') return true
|
|
279
|
+
const validBreakpoints = ['sm', 'md', 'lg', 'xl', 'xxl'] as const
|
|
280
|
+
return value.every((bp) => validBreakpoints.includes(bp as TBreakpoint))
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
|
|
284
|
+
last: {
|
|
285
|
+
type: [Boolean, Array] as PropType<TBooleanResponsive>,
|
|
286
|
+
default: null,
|
|
287
|
+
validator: (value: TBooleanResponsive): boolean => {
|
|
288
|
+
if (value == null) return true
|
|
289
|
+
if (typeof value === 'boolean') return true
|
|
290
|
+
const validBreakpoints = ['sm', 'md', 'lg', 'xl', 'xxl'] as const
|
|
291
|
+
return value.every((bp) => validBreakpoints.includes(bp as TBreakpoint))
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
visible: {
|
|
296
|
+
type: [Boolean, Object, Function] as PropType<TGridVisibleInput>,
|
|
297
|
+
default: null,
|
|
298
|
+
},
|
|
299
|
+
|
|
300
|
+
reverse: {
|
|
301
|
+
type: [Boolean, Array] as PropType<TBooleanResponsive>,
|
|
302
|
+
default: false,
|
|
303
|
+
validator: (value: TBooleanResponsive): boolean => {
|
|
304
|
+
if (value == null) return true
|
|
305
|
+
if (typeof value === 'boolean') return true
|
|
306
|
+
const validBreakpoints = ['sm', 'md', 'lg', 'xl', 'xxl'] as const
|
|
307
|
+
return value.every((bp) => validBreakpoints.includes(bp as TBreakpoint))
|
|
308
|
+
},
|
|
309
|
+
},
|
|
310
|
+
|
|
311
|
+
grow: {
|
|
312
|
+
type: Boolean as PropType<boolean>,
|
|
313
|
+
default: null,
|
|
314
|
+
},
|
|
315
|
+
|
|
316
|
+
flex: {
|
|
317
|
+
type: Boolean as PropType<boolean>,
|
|
318
|
+
default: null,
|
|
319
|
+
},
|
|
320
|
+
|
|
321
|
+
shrink: {
|
|
322
|
+
type: Boolean as PropType<boolean>,
|
|
323
|
+
default: null,
|
|
324
|
+
},
|
|
325
|
+
|
|
326
|
+
distributed: {
|
|
327
|
+
type: Boolean as PropType<boolean>,
|
|
328
|
+
default: false,
|
|
329
|
+
},
|
|
330
|
+
|
|
331
|
+
mode: {
|
|
332
|
+
type: String as PropType<TGridMode>,
|
|
333
|
+
default: 'wide',
|
|
334
|
+
validator: (value: string): boolean => {
|
|
335
|
+
return (['wide', 'narrow', 'condensed'] as const).includes(
|
|
336
|
+
value as TGridMode,
|
|
337
|
+
)
|
|
338
|
+
},
|
|
339
|
+
},
|
|
340
|
+
|
|
341
|
+
tabIndex: {
|
|
342
|
+
type: String as PropType<string>,
|
|
343
|
+
default: null,
|
|
344
|
+
},
|
|
345
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ESize } from '../types/Size.d'
|
|
2
|
+
|
|
3
|
+
enum EAnimation {
|
|
4
|
+
SwingRight = 'swing-right',
|
|
5
|
+
Wobble = 'wobble',
|
|
6
|
+
Expand = 'expand',
|
|
7
|
+
Refresh = 'refresh',
|
|
8
|
+
Heart = 'heart',
|
|
9
|
+
Undo = 'undo',
|
|
10
|
+
Italic = 'italic',
|
|
11
|
+
Cog = 'cog',
|
|
12
|
+
Wrench = 'wrench',
|
|
13
|
+
Mouse = 'mouse-pointer',
|
|
14
|
+
Magic = 'magic',
|
|
15
|
+
Lock = 'lock',
|
|
16
|
+
Unlock = 'unlock',
|
|
17
|
+
Hourglass = 'hourglass',
|
|
18
|
+
Eraser = 'eraser',
|
|
19
|
+
Rocket = 'rocket',
|
|
20
|
+
Times = 'times',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
enum EAnimationMode {
|
|
24
|
+
Hover = 'hover',
|
|
25
|
+
Always = 'always',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
enum EWeight {
|
|
29
|
+
Thin = 'thin',
|
|
30
|
+
Light = 'light',
|
|
31
|
+
Regular = 'regular',
|
|
32
|
+
Bold = 'bold',
|
|
33
|
+
Fill = 'fill',
|
|
34
|
+
Duotone = 'duotone',
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
enum EIconSize {
|
|
38
|
+
XXL = 92,
|
|
39
|
+
XL = 60,
|
|
40
|
+
LG = 20,
|
|
41
|
+
MD = 16,
|
|
42
|
+
SM = 14,
|
|
43
|
+
XS = 12,
|
|
44
|
+
XXS = 8,
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface IIconProps {
|
|
48
|
+
name: string
|
|
49
|
+
size?: ESize | string | number
|
|
50
|
+
animation?: EAnimation | null
|
|
51
|
+
animationMode?: EAnimationMode
|
|
52
|
+
color?: string
|
|
53
|
+
weight?: EWeight
|
|
54
|
+
title?: string
|
|
55
|
+
clickable?: boolean
|
|
56
|
+
hoverable?: boolean
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { EAnimation, EAnimationMode, EWeight, EIconSize, IIconProps }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ESize } from '
|
|
1
|
+
import { ESize } from '../types/Size.d';
|
|
2
2
|
import { EAnimationMode, EWeight, IIconProps } from './Icon.d';
|
|
3
3
|
declare const __VLS_export: import("vue").DefineComponent<IIconProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
4
|
click: (...args: any[]) => void;
|