Create initial table tokens package

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2023-05-23 11:59:39 +03:00
1 parent a20a1eade1
commit 11d708d9c7
6 files changed
+81

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
# Description
The package exports tokens needed for external table configuration.
+30
View File
@@ -0,0 +1,30 @@
import React from "react";
import { getInjectionToken } from "@ogre-tools/injectable";
import type { KubeObject } from "@k8slens/kube-object/src/kube-object";
import type {
BaseKubeObjectListLayoutColumn,
GeneralKubeObjectListLayoutColumn,
SpecificKubeListLayoutColumn,
} from "@k8slens/list-layout/src/kube-list-layout-column";
export interface TableDataContextValue {
columns?: (
| BaseKubeObjectListLayoutColumn<KubeObject>
| SpecificKubeListLayoutColumn<KubeObject>
| GeneralKubeObjectListLayoutColumn
)[];
}
export const TableDataContext = React.createContext<TableDataContextValue>({
columns: [],
});
export type CreateTableState<Props> = (context: TableDataContextValue, props: Props) => any;
export const createTableStateInjectionToken = getInjectionToken<CreateTableState<any>>({
id: "create-table-state-injection-token",
});
export const tableComponentInjectionToken = getInjectionToken<React.ComponentType<any>>({
id: "table-component-injection-token",
});
+28
View File
@@ -0,0 +1,28 @@
{
"name": "@k8slens/table-tokens",
"version": "6.5.0-alpha.7",
"description": "Injection token exporter for table components",
"license": "MIT",
"type": "commonjs",
"private": false,
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"clean": "rimraf dist/",
"build": "lens-webpack-build"
},
"devDependencies": {
"@k8slens/webpack": "^6.5.0-alpha.8",
"rimraf": "^4.4.1"
},
"peerDependencies": {
"@ogre-tools/injectable": "^16.1.0"
}
}
+4
View File
@@ -0,0 +1,4 @@
{
"extends": "@k8slens/typescript/config/base.json",
"include": ["**/*.ts"]
}
+1
View File
@@ -0,0 +1 @@
module.exports = require("@k8slens/webpack").configForNode;