@ternarytech-io/gears-ui 0.0.0-stage → 0.1.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/LICENSE +373 -0
- package/README.md +160 -2
- package/package.json +104 -6
- package/src/code-editor.ts +25 -0
- package/src/components/TAccentPicker.vue +41 -0
- package/src/components/TAdvancedSelect.vue +128 -0
- package/src/components/TAdvancedTable.vue +130 -0
- package/src/components/TAlert.vue +41 -0
- package/src/components/TAuthLayout.vue +32 -0
- package/src/components/TAvatar.vue +28 -0
- package/src/components/TBadge.vue +29 -0
- package/src/components/TButton.vue +60 -0
- package/src/components/TCard.vue +40 -0
- package/src/components/TCheckbox.vue +29 -0
- package/src/components/TCodeEditor.vue +128 -0
- package/src/components/TColorModeButton.vue +14 -0
- package/src/components/TColorPicker.vue +61 -0
- package/src/components/TCommandPalette.vue +109 -0
- package/src/components/TCopyButton.vue +72 -0
- package/src/components/TDatePicker.vue +83 -0
- package/src/components/TDropdown.vue +76 -0
- package/src/components/TDropzone.vue +76 -0
- package/src/components/TEmpty.vue +21 -0
- package/src/components/TFieldGroup.vue +11 -0
- package/src/components/TFileUpload.vue +92 -0
- package/src/components/TFontPicker.vue +23 -0
- package/src/components/TFormField.vue +40 -0
- package/src/components/TIcon.vue +12 -0
- package/src/components/TImageUpload.vue +131 -0
- package/src/components/TInput.vue +52 -0
- package/src/components/TInputMask.vue +70 -0
- package/src/components/TInputNumber.vue +62 -0
- package/src/components/TInputTags.vue +53 -0
- package/src/components/TLogView.vue +39 -0
- package/src/components/TModal.vue +54 -0
- package/src/components/TNav.vue +75 -0
- package/src/components/TPage.vue +48 -0
- package/src/components/TPagination.vue +44 -0
- package/src/components/TPanelList.vue +29 -0
- package/src/components/TProgress.vue +18 -0
- package/src/components/TRadioGroup.vue +68 -0
- package/src/components/TRadiusPicker.vue +21 -0
- package/src/components/TRangeSlider.vue +63 -0
- package/src/components/TRichEditor.vue +82 -0
- package/src/components/TSearchButton.vue +20 -0
- package/src/components/TSectionLayout.vue +37 -0
- package/src/components/TSelect.vue +60 -0
- package/src/components/TSelectMenu.vue +126 -0
- package/src/components/TSeparator.vue +10 -0
- package/src/components/TShell.vue +72 -0
- package/src/components/TSkeleton.vue +17 -0
- package/src/components/TSlideover.vue +47 -0
- package/src/components/TSortable.vue +61 -0
- package/src/components/TSpinner.vue +14 -0
- package/src/components/TSplitter.vue +85 -0
- package/src/components/TStatCard.vue +26 -0
- package/src/components/TSteps.vue +19 -0
- package/src/components/TSwitch.vue +18 -0
- package/src/components/TTable.vue +134 -0
- package/src/components/TTabs.vue +38 -0
- package/src/components/TTextarea.vue +42 -0
- package/src/components/TThemeBasePicker.vue +22 -0
- package/src/components/TThemeScope.vue +22 -0
- package/src/components/TToaster.vue +27 -0
- package/src/components/TTooltip.vue +33 -0
- package/src/components/TTopbar.vue +17 -0
- package/src/components/TVectorMap.vue +74 -0
- package/src/composables/useColorMode.ts +41 -0
- package/src/composables/useCommandPalette.ts +11 -0
- package/src/composables/useField.ts +26 -0
- package/src/composables/useOverlay.ts +55 -0
- package/src/composables/useToast.ts +33 -0
- package/src/index.ts +199 -0
- package/src/monaco.ts +27 -0
- package/src/plugins/coloris.ts +8 -0
- package/src/plugins/datepicker.ts +7 -0
- package/src/plugins/dropzone.ts +5 -0
- package/src/plugins/index.ts +49 -0
- package/src/plugins/inputMask.ts +7 -0
- package/src/plugins/once.ts +8 -0
- package/src/plugins/richEditor.ts +37 -0
- package/src/plugins/slider.ts +4 -0
- package/src/plugins/sortable.ts +7 -0
- package/src/plugins/tomSelect.ts +4 -0
- package/src/shims.d.ts +17 -0
- package/src/styles/gears.css +560 -0
- package/src/styles/plugins.css +10 -0
- package/src/theme.ts +28 -0
- package/src/types.ts +160 -0
- package/src/vectorMap.ts +14 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
// Shared prop types. Colors and sizes use the same names as Nuxt UI, so code moving from it keeps
|
|
2
|
+
// its props; `toTabler` maps a color to the name Tabler's classes use.
|
|
3
|
+
|
|
4
|
+
export type Color = 'primary' | 'neutral' | 'success' | 'warning' | 'error' | 'info'
|
|
5
|
+
export type Size = 'xs' | 'sm' | 'md' | 'lg'
|
|
6
|
+
|
|
7
|
+
const tablerColors: Record<Color, string> = {
|
|
8
|
+
primary: 'primary',
|
|
9
|
+
neutral: 'secondary',
|
|
10
|
+
success: 'success',
|
|
11
|
+
warning: 'warning',
|
|
12
|
+
error: 'danger',
|
|
13
|
+
info: 'info'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function toTabler(color: Color): string {
|
|
17
|
+
return tablerColors[color]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// A route location for RouterLink, or a plain URL.
|
|
21
|
+
export type Target = string | Record<string, unknown>
|
|
22
|
+
|
|
23
|
+
export interface DropdownItem {
|
|
24
|
+
label?: string
|
|
25
|
+
description?: string
|
|
26
|
+
icon?: string
|
|
27
|
+
trailingIcon?: string
|
|
28
|
+
// `label` items are headings; they can't be chosen.
|
|
29
|
+
type?: 'item' | 'label'
|
|
30
|
+
color?: Color
|
|
31
|
+
to?: Target
|
|
32
|
+
href?: string
|
|
33
|
+
disabled?: boolean
|
|
34
|
+
onSelect?: (event: Event) => void
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface NavItem {
|
|
38
|
+
label: string
|
|
39
|
+
icon?: string
|
|
40
|
+
to?: Target
|
|
41
|
+
// Active only on this exact route, not on routes under it.
|
|
42
|
+
exact?: boolean
|
|
43
|
+
badge?: string | { label: string; color?: Color }
|
|
44
|
+
children?: NavItem[]
|
|
45
|
+
defaultOpen?: boolean
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface SelectItem<T = unknown> {
|
|
49
|
+
label: string
|
|
50
|
+
value: T
|
|
51
|
+
description?: string
|
|
52
|
+
disabled?: boolean
|
|
53
|
+
// Items with the same group are listed together under it.
|
|
54
|
+
group?: string
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// An item of TAdvancedSelect: an icon or avatar initials can show beside the label.
|
|
58
|
+
export interface AdvancedSelectItem<T = unknown> extends SelectItem<T> {
|
|
59
|
+
icon?: string
|
|
60
|
+
avatar?: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface TabItem {
|
|
64
|
+
label: string
|
|
65
|
+
value: string
|
|
66
|
+
icon?: string
|
|
67
|
+
badge?: string | number
|
|
68
|
+
disabled?: boolean
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface TableColumn<Row = Record<string, unknown>> {
|
|
72
|
+
key: string
|
|
73
|
+
label?: string
|
|
74
|
+
align?: 'start' | 'center' | 'end'
|
|
75
|
+
width?: string
|
|
76
|
+
sortable?: boolean
|
|
77
|
+
// TAdvancedTable: whether the column has a filter (on unless false; columns without a label have none).
|
|
78
|
+
filterable?: boolean
|
|
79
|
+
// Shown when the cell has no slot; defaults to `row[key]`.
|
|
80
|
+
value?: (row: Row) => unknown
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface TableSort {
|
|
84
|
+
key: string
|
|
85
|
+
direction: 'asc' | 'desc'
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// How a TAdvancedTable column filter compares a cell with its value.
|
|
89
|
+
export type TableFilterOperator = 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan' | 'atLeast' | 'atMost'
|
|
90
|
+
|
|
91
|
+
export interface TableFilter {
|
|
92
|
+
operator: TableFilterOperator
|
|
93
|
+
value: string
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export interface StepItem {
|
|
97
|
+
title: string
|
|
98
|
+
description?: string
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface LogLine {
|
|
102
|
+
id?: string | number
|
|
103
|
+
time?: string
|
|
104
|
+
text: string
|
|
105
|
+
level?: 'error' | 'warning' | 'highlight' | 'muted'
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// A suggestion a TCodeEditor offers while typing.
|
|
109
|
+
export interface CodeCompletion {
|
|
110
|
+
label: string
|
|
111
|
+
kind?: 'keyword' | 'table' | 'field' | 'function' | 'value' | 'snippet'
|
|
112
|
+
// What's inserted; the label when omitted.
|
|
113
|
+
insertText?: string
|
|
114
|
+
detail?: string
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface PanelListItem<T = string> {
|
|
118
|
+
value: T
|
|
119
|
+
label: string
|
|
120
|
+
icon?: string
|
|
121
|
+
// Small text at the item's end, such as a count or a tag.
|
|
122
|
+
trailing?: string
|
|
123
|
+
title?: string
|
|
124
|
+
// Shown in red: something in it needs fixing.
|
|
125
|
+
invalid?: boolean
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// An item of TCommandPalette: a page to go to (`to`) or an action (`onSelect`).
|
|
129
|
+
export interface CommandItem {
|
|
130
|
+
label: string
|
|
131
|
+
icon?: string
|
|
132
|
+
// Shown after the label, smaller; searched too (a project's namespace, a page's section).
|
|
133
|
+
suffix?: string
|
|
134
|
+
// More words that find the item without being shown.
|
|
135
|
+
keywords?: string[]
|
|
136
|
+
to?: Target
|
|
137
|
+
onSelect?: () => void
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface CommandGroup {
|
|
141
|
+
id: string
|
|
142
|
+
label?: string
|
|
143
|
+
items: CommandItem[]
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// An application's theme, as Tabler's theme settings (the data-bs-theme-* attributes) take it.
|
|
147
|
+
export type ThemeFont = 'sans-serif' | 'serif' | 'monospace' | 'comic'
|
|
148
|
+
export type ThemeBase = 'slate' | 'gray' | 'zinc' | 'neutral' | 'stone' | 'mist'
|
|
149
|
+
export type ThemeRadius = '0' | '0.5' | '1' | '1.5' | '2'
|
|
150
|
+
// Tabler's named colors, or a custom color as #rrggbb.
|
|
151
|
+
export type ThemeAccent = 'blue' | 'azure' | 'indigo' | 'purple' | 'pink' | 'red' | 'orange' | 'yellow' | 'lime' | 'green' | 'teal' | 'cyan' | (string & {})
|
|
152
|
+
|
|
153
|
+
export interface ThemeSettings {
|
|
154
|
+
accent?: ThemeAccent
|
|
155
|
+
font?: ThemeFont
|
|
156
|
+
base?: ThemeBase
|
|
157
|
+
radius?: ThemeRadius
|
|
158
|
+
// Light or dark; unset follows the surrounding page.
|
|
159
|
+
mode?: 'light' | 'dark'
|
|
160
|
+
}
|
package/src/vectorMap.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference path="./shims.d.ts" />
|
|
2
|
+
// Loads Tabler's vector map and the world map data the first time a TVectorMap is shown. Both ship
|
|
3
|
+
// with @tabler/core, so this needs no optional library.
|
|
4
|
+
let promise: Promise<typeof import('@tabler/core/dist/js/tabler-vector-map.esm.js').VectorMap> | undefined
|
|
5
|
+
|
|
6
|
+
export function loadVectorMap() {
|
|
7
|
+
return promise ??= Promise.all([
|
|
8
|
+
import('@tabler/core/dist/js/tabler-vector-map.esm.js'),
|
|
9
|
+
import('@tabler/core/dist/js/maps/world.esm.js')
|
|
10
|
+
]).then(([{ VectorMap }, { world }]) => {
|
|
11
|
+
VectorMap.addMap('world', world)
|
|
12
|
+
return VectorMap
|
|
13
|
+
})
|
|
14
|
+
}
|