@shifl-inc/ui 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/README.md +86 -0
- package/dist/components/grid/GridColumnManager.vue.d.ts +45 -0
- package/dist/components/grid/ShiflGrid.vue.d.ts +27 -0
- package/dist/composables/useBreakpoints.d.ts +5 -0
- package/dist/composables/useGridColumns.d.ts +67 -0
- package/dist/composables/useGridData.d.ts +4 -0
- package/dist/composables/useGridEditing.d.ts +1 -0
- package/dist/composables/useGridFilter.d.ts +5 -0
- package/dist/composables/useGridInfiniteScroll.d.ts +1 -0
- package/dist/composables/useGridSelection.d.ts +11 -0
- package/dist/composables/useGridSort.d.ts +18 -0
- package/dist/composables/useGridTheme.d.ts +25 -0
- package/dist/composables/useGridTour.d.ts +1 -0
- package/dist/composables/useVirtualScroll.d.ts +1 -0
- package/dist/config/defaults.d.ts +2 -0
- package/dist/index.d.ts +15 -0
- package/dist/plugins/install.d.ts +5 -0
- package/dist/shifl-ui.js +685 -0
- package/dist/shifl-ui.umd +1 -0
- package/dist/stores/gridStore.d.ts +8 -0
- package/dist/style.css +778 -0
- package/dist/types/grid.d.ts +69 -0
- package/dist/types/theme.d.ts +10 -0
- package/dist/utils/normalize.d.ts +2 -0
- package/package.json +82 -0
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Shifl Grid (Vue 3)
|
|
2
|
+
|
|
3
|
+
JSON-driven data grid for Shifl UI, built with Vue 3 + TypeScript. Library-first output via Vite (library mode) with Tailwind + CSS variables for theming.
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
- ✅ Minimal grid (column visibility toggle, client-side sorting, global filter)
|
|
8
|
+
- 🚧 Everything else scaffolded/stubbed for incremental delivery (editing, virtual scroll, tours, views)
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
- Node `>=20.11.0` (matches Shifl UI constraint)
|
|
13
|
+
- Peer deps: `vue@^3.4.0`, `pinia@^2.2.0`
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @shifl-inc/ui
|
|
19
|
+
# peer deps
|
|
20
|
+
npm install vue pinia
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
// main.ts
|
|
27
|
+
import { createApp } from 'vue';
|
|
28
|
+
import App from './App.vue';
|
|
29
|
+
import { ShiflGridPlugin } from '@shifl-inc/ui';
|
|
30
|
+
import '@shifl-inc/ui/style.css';
|
|
31
|
+
|
|
32
|
+
const app = createApp(App);
|
|
33
|
+
app.use(ShiflGridPlugin);
|
|
34
|
+
app.mount('#app');
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { ShiflGrid } from '@shifl-inc/ui';
|
|
40
|
+
import type { GridConfig } from '@shifl-inc/ui';
|
|
41
|
+
|
|
42
|
+
const config: GridConfig = {
|
|
43
|
+
name: 'My Preferred Shipments',
|
|
44
|
+
columns: [
|
|
45
|
+
{ key: 'shifl_ref', label: 'Shifl Ref #', sortable: true, frozen: true },
|
|
46
|
+
{ key: 'company_name', label: 'Customer', sortable: true }
|
|
47
|
+
],
|
|
48
|
+
search: ['shifl_ref', 'company_name'],
|
|
49
|
+
sort: { key: 'shifl_ref', order: 'asc' },
|
|
50
|
+
rows: [
|
|
51
|
+
{ shifl_ref: 'SF-1001', company_name: 'GMA Inc' },
|
|
52
|
+
{ shifl_ref: 'SF-1002', company_name: 'Walads Autowash' }
|
|
53
|
+
]
|
|
54
|
+
};
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
<template>
|
|
58
|
+
<ShiflGrid :config="config" />
|
|
59
|
+
</template>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Scripts
|
|
63
|
+
|
|
64
|
+
- `npm run dev` — Vite dev server
|
|
65
|
+
- `npm run build` — Library build + d.ts via `vite-plugin-dts`
|
|
66
|
+
- `npm run lint` — ESLint (Vue + TS) flat config
|
|
67
|
+
- `npm run test` — Vitest (jsdom)
|
|
68
|
+
- `npm run storybook` — Storybook dev
|
|
69
|
+
- `npm run storybook:build` — Storybook static build
|
|
70
|
+
|
|
71
|
+
## Project structure (high level)
|
|
72
|
+
|
|
73
|
+
- `src/components/grid` — `ShiflGrid.vue` (minimal implementation)
|
|
74
|
+
- `src/composables` — Core behaviors (sort/filter/columns implemented, others stubbed/TODO)
|
|
75
|
+
- `src/types` — Grid + theme contracts
|
|
76
|
+
- `src/theme` — CSS tokens
|
|
77
|
+
- `src/styles` — Tailwind entry + component styles
|
|
78
|
+
- `src/utils` — Helpers (config normalization)
|
|
79
|
+
- `src/plugins` — Vue install plugin
|
|
80
|
+
- `stories/` — Storybook stories
|
|
81
|
+
- `.storybook/` — Storybook configuration
|
|
82
|
+
|
|
83
|
+
## Notes
|
|
84
|
+
|
|
85
|
+
- Config normalization supports both `frozen` and legacy `fixed` flags.
|
|
86
|
+
- Virtual scroll, editing, tours, saved/recommended views, telemetry are intentionally stubbed for later milestones.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { NormalizedGridColumn } from '../../types/grid';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
titlePrefix?: string;
|
|
4
|
+
columns: NormalizedGridColumn[];
|
|
5
|
+
};
|
|
6
|
+
declare const _default: import('vue').DefineComponent<
|
|
7
|
+
__VLS_Props,
|
|
8
|
+
{},
|
|
9
|
+
{},
|
|
10
|
+
{},
|
|
11
|
+
{},
|
|
12
|
+
import('vue').ComponentOptionsMixin,
|
|
13
|
+
import('vue').ComponentOptionsMixin,
|
|
14
|
+
{
|
|
15
|
+
close: () => any;
|
|
16
|
+
toggle: (key: string) => any;
|
|
17
|
+
move: (fromIndex: number, toIndex: number) => any;
|
|
18
|
+
toggleFrozen: (key: string) => any;
|
|
19
|
+
selectAll: () => any;
|
|
20
|
+
deselectAll: () => any;
|
|
21
|
+
restoreDefault: () => any;
|
|
22
|
+
},
|
|
23
|
+
string,
|
|
24
|
+
import('vue').PublicProps,
|
|
25
|
+
Readonly<__VLS_Props> &
|
|
26
|
+
Readonly<{
|
|
27
|
+
onClose?: (() => any) | undefined;
|
|
28
|
+
onToggle?: ((key: string) => any) | undefined;
|
|
29
|
+
onMove?: ((fromIndex: number, toIndex: number) => any) | undefined;
|
|
30
|
+
onToggleFrozen?: ((key: string) => any) | undefined;
|
|
31
|
+
onSelectAll?: (() => any) | undefined;
|
|
32
|
+
onDeselectAll?: (() => any) | undefined;
|
|
33
|
+
onRestoreDefault?: (() => any) | undefined;
|
|
34
|
+
}>,
|
|
35
|
+
{},
|
|
36
|
+
{},
|
|
37
|
+
{},
|
|
38
|
+
{},
|
|
39
|
+
string,
|
|
40
|
+
import('vue').ComponentProvideOptions,
|
|
41
|
+
false,
|
|
42
|
+
{},
|
|
43
|
+
HTMLDivElement
|
|
44
|
+
>;
|
|
45
|
+
export default _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GridConfig } from '../../types/grid';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
config: GridConfig<Record<string, unknown>>;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import('vue').DefineComponent<
|
|
6
|
+
__VLS_Props,
|
|
7
|
+
{},
|
|
8
|
+
{},
|
|
9
|
+
{},
|
|
10
|
+
{},
|
|
11
|
+
import('vue').ComponentOptionsMixin,
|
|
12
|
+
import('vue').ComponentOptionsMixin,
|
|
13
|
+
{},
|
|
14
|
+
string,
|
|
15
|
+
import('vue').PublicProps,
|
|
16
|
+
Readonly<__VLS_Props> & Readonly<{}>,
|
|
17
|
+
{},
|
|
18
|
+
{},
|
|
19
|
+
{},
|
|
20
|
+
{},
|
|
21
|
+
string,
|
|
22
|
+
import('vue').ComponentProvideOptions,
|
|
23
|
+
false,
|
|
24
|
+
{},
|
|
25
|
+
HTMLDivElement
|
|
26
|
+
>;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { NormalizedGridColumn } from '../types/grid';
|
|
2
|
+
export declare function useGridColumns(initialColumns: NormalizedGridColumn[]): {
|
|
3
|
+
columns: import('vue').Ref<
|
|
4
|
+
{
|
|
5
|
+
frozen: boolean;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
key: string;
|
|
8
|
+
label: string;
|
|
9
|
+
order?: number | undefined;
|
|
10
|
+
sortable?: boolean | undefined;
|
|
11
|
+
width?: string | undefined;
|
|
12
|
+
height?: string | undefined;
|
|
13
|
+
isDefault?: boolean | undefined;
|
|
14
|
+
fixed?: boolean | undefined;
|
|
15
|
+
cellMetadata?:
|
|
16
|
+
| {
|
|
17
|
+
format?: string | undefined;
|
|
18
|
+
emptyState?: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
| undefined;
|
|
21
|
+
}[],
|
|
22
|
+
| NormalizedGridColumn[]
|
|
23
|
+
| {
|
|
24
|
+
frozen: boolean;
|
|
25
|
+
visible: boolean;
|
|
26
|
+
key: string;
|
|
27
|
+
label: string;
|
|
28
|
+
order?: number | undefined;
|
|
29
|
+
sortable?: boolean | undefined;
|
|
30
|
+
width?: string | undefined;
|
|
31
|
+
height?: string | undefined;
|
|
32
|
+
isDefault?: boolean | undefined;
|
|
33
|
+
fixed?: boolean | undefined;
|
|
34
|
+
cellMetadata?:
|
|
35
|
+
| {
|
|
36
|
+
format?: string | undefined;
|
|
37
|
+
emptyState?: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
| undefined;
|
|
40
|
+
}[]
|
|
41
|
+
>;
|
|
42
|
+
visibleColumns: import('vue').ComputedRef<
|
|
43
|
+
{
|
|
44
|
+
frozen: boolean;
|
|
45
|
+
visible: boolean;
|
|
46
|
+
key: string;
|
|
47
|
+
label: string;
|
|
48
|
+
order?: number | undefined;
|
|
49
|
+
sortable?: boolean | undefined;
|
|
50
|
+
width?: string | undefined;
|
|
51
|
+
height?: string | undefined;
|
|
52
|
+
isDefault?: boolean | undefined;
|
|
53
|
+
fixed?: boolean | undefined;
|
|
54
|
+
cellMetadata?:
|
|
55
|
+
| {
|
|
56
|
+
format?: string | undefined;
|
|
57
|
+
emptyState?: string | undefined;
|
|
58
|
+
}
|
|
59
|
+
| undefined;
|
|
60
|
+
}[]
|
|
61
|
+
>;
|
|
62
|
+
toggleColumnVisibility: (key: string) => void;
|
|
63
|
+
setAllVisible: (visible: boolean) => void;
|
|
64
|
+
toggleFrozen: (key: string) => void;
|
|
65
|
+
moveColumn: (fromIndex: number, toIndex: number) => void;
|
|
66
|
+
resetColumns: () => void;
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useGridEditing(): {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useGridInfiniteScroll(): {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function useGridSelection<
|
|
2
|
+
T extends {
|
|
3
|
+
id?: string | number;
|
|
4
|
+
}
|
|
5
|
+
>(): {
|
|
6
|
+
selectedKeys: import('vue').Ref<
|
|
7
|
+
Set<string | number> & Omit<Set<string | number>, keyof Set<any>>,
|
|
8
|
+
Set<string | number> | (Set<string | number> & Omit<Set<string | number>, keyof Set<any>>)
|
|
9
|
+
>;
|
|
10
|
+
toggleRow: (row: T) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GridSort } from '../types/grid';
|
|
2
|
+
export declare function useGridSort(initialSort?: GridSort): {
|
|
3
|
+
sort: import('vue').Ref<
|
|
4
|
+
| {
|
|
5
|
+
key: string;
|
|
6
|
+
order: 'asc' | 'desc';
|
|
7
|
+
}
|
|
8
|
+
| undefined,
|
|
9
|
+
| GridSort
|
|
10
|
+
| {
|
|
11
|
+
key: string;
|
|
12
|
+
order: 'asc' | 'desc';
|
|
13
|
+
}
|
|
14
|
+
| undefined
|
|
15
|
+
>;
|
|
16
|
+
setSort: (key: string) => void;
|
|
17
|
+
applySort: <T extends Record<string, unknown>>(rows: T[]) => T[];
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ThemeTokens } from '../types/theme';
|
|
2
|
+
export declare function provideGridTheme(tokens?: Partial<ThemeTokens>): import('vue').Ref<
|
|
3
|
+
{
|
|
4
|
+
surface: string;
|
|
5
|
+
surfaceAlt: string;
|
|
6
|
+
border: string;
|
|
7
|
+
text: string;
|
|
8
|
+
textMuted: string;
|
|
9
|
+
accent: string;
|
|
10
|
+
accentStrong: string;
|
|
11
|
+
focus: string;
|
|
12
|
+
},
|
|
13
|
+
| ThemeTokens
|
|
14
|
+
| {
|
|
15
|
+
surface: string;
|
|
16
|
+
surfaceAlt: string;
|
|
17
|
+
border: string;
|
|
18
|
+
text: string;
|
|
19
|
+
textMuted: string;
|
|
20
|
+
accent: string;
|
|
21
|
+
accentStrong: string;
|
|
22
|
+
focus: string;
|
|
23
|
+
}
|
|
24
|
+
>;
|
|
25
|
+
export declare function useGridTheme(): import('vue').ComputedRef<ThemeTokens>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useGridTour(): {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useVirtualScroll(): {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { default as ShiflGrid } from './components/grid/ShiflGrid.vue';
|
|
2
|
+
export { default as ShiflGridPlugin } from './plugins/install';
|
|
3
|
+
export * from './composables/useGridColumns';
|
|
4
|
+
export * from './composables/useGridSort';
|
|
5
|
+
export * from './composables/useGridFilter';
|
|
6
|
+
export * from './composables/useGridData';
|
|
7
|
+
export * from './composables/useGridSelection';
|
|
8
|
+
export * from './composables/useGridEditing';
|
|
9
|
+
export * from './composables/useGridTheme';
|
|
10
|
+
export * from './composables/useBreakpoints';
|
|
11
|
+
export * from './composables/useGridInfiniteScroll';
|
|
12
|
+
export * from './composables/useVirtualScroll';
|
|
13
|
+
export * from './composables/useGridTour';
|
|
14
|
+
export * from './types/grid';
|
|
15
|
+
export * from './types/theme';
|