@pezeshk-book/modules 0.1.91 → 0.2.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.
@@ -1,3 +1,3 @@
1
- import { DataTableProps } from './data-table.props';
2
- declare const DataTable: ({ type, ...rest }: DataTableProps) => import("react/jsx-runtime").JSX.Element;
1
+ import { DataTableProps, TableVariant } from './data-table.props';
2
+ declare const DataTable: <T extends TableVariant>(props: DataTableProps<T>) => import("react/jsx-runtime").JSX.Element;
3
3
  export default DataTable;
@@ -1,13 +1,12 @@
1
- import { __assign, __rest } from "tslib";
1
+ import { __assign } from "tslib";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import ComplexDataTable from './complex';
4
4
  import SimpleDataTable from './simple';
5
- var DataTable = function (_a) {
6
- var _b = _a.type, type = _b === void 0 ? 'complex' : _b, rest = __rest(_a, ["type"]);
7
- if (type === 'complex') {
8
- return _jsx(ComplexDataTable, __assign({}, rest));
5
+ var DataTable = function (props) {
6
+ if (props.variant === 'complex') {
7
+ return _jsx(ComplexDataTable, __assign({}, props));
9
8
  }
10
- return _jsx(SimpleDataTable, __assign({}, rest));
9
+ return _jsx(SimpleDataTable, __assign({}, props));
11
10
  };
12
11
  export default DataTable;
13
12
  //# sourceMappingURL=data-table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-table.js","sourceRoot":"","sources":["../../../modules/data-table/data-table.tsx"],"names":[],"mappings":";;AACA,OAAO,gBAAgB,MAAM,WAAW,CAAC;AACzC,OAAO,eAAe,MAAM,UAAU,CAAC;AAEvC,IAAM,SAAS,GAAG,UAAC,EAA6C;IAA3C,IAAA,YAAgB,EAAhB,IAAI,mBAAG,SAAS,KAAA,EAAK,IAAI,cAA3B,QAA6B,CAAF;IAC5C,IAAI,IAAI,KAAK,SAAS,EAAE;QACtB,OAAO,KAAC,gBAAgB,eAAK,IAAI,EAAI,CAAC;KACvC;IAED,OAAO,KAAC,eAAe,eAAK,IAAI,EAAI,CAAC;AACvC,CAAC,CAAC;AACF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"data-table.js","sourceRoot":"","sources":["../../../modules/data-table/data-table.tsx"],"names":[],"mappings":";;AACA,OAAO,gBAAgB,MAAM,WAAW,CAAC;AACzC,OAAO,eAAe,MAAM,UAAU,CAAC;AAIvC,IAAM,SAAS,GAAG,UAAyB,KAAwB;IACjE,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,EAAE;QAC/B,OAAO,KAAC,gBAAgB,eAAM,KAA+B,EAAI,CAAC;KACnE;IAED,OAAO,KAAC,eAAe,eAAM,KAA8B,EAAI,CAAC;AAClE,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -1,5 +1,8 @@
1
1
  import { ComplexDataTableProps } from './complex/complex-data-table.props';
2
2
  import { SimpleDataTableProps } from './simple/simple-data-table.props';
3
- export interface DataTableProps extends ComplexDataTableProps, SimpleDataTableProps {
4
- type?: 'simple' | 'complex';
5
- }
3
+ export type TableVariant = 'simple' | 'complex';
4
+ export type DataTableProps<T extends TableVariant> = T extends 'simple' ? {
5
+ variant: 'simple';
6
+ } & SimpleDataTableProps : {
7
+ variant: 'complex';
8
+ } & ComplexDataTableProps;
@@ -0,0 +1,7 @@
1
+ import { ComplexDataTableProps } from '../../modules/data-table/complex/complex-data-table.props';
2
+ /**
3
+ * Primary UI component for user interaction
4
+ */
5
+ export declare const ComplexDataTable: (props: {
6
+ variant: 'complex';
7
+ } & ComplexDataTableProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import CustomDataTable from '../../modules/data-table';
4
+ import dummyData from './dummy-data';
5
+ import { columns, header } from './data-table-columns';
6
+ /**
7
+ * Primary UI component for user interaction
8
+ */
9
+ export var ComplexDataTable = function (props) {
10
+ return (_jsx(CustomDataTable, __assign({}, props, { data: dummyData, header: header, column: columns })));
11
+ };
12
+ //# sourceMappingURL=complex-data-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complex-data-table.js","sourceRoot":"","sources":["../../../stories/data-table/complex-data-table.tsx"],"names":[],"mappings":";;AAAA,OAAO,eAAe,MAAM,0BAA0B,CAAC;AACvD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGvD;;GAEG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,KAAqD;IACpF,OAAO,CACL,KAAC,eAAe,eACV,KAAK,IACT,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,IACf,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { ComplexDataTable } from './complex-data-table';
3
+ declare const meta: Meta<typeof ComplexDataTable>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof ComplexDataTable>;
6
+ export declare const Complex: Story;
@@ -0,0 +1,18 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ComplexDataTable } from './complex-data-table';
4
+ var meta = {
5
+ title: 'DataTable',
6
+ component: ComplexDataTable,
7
+ argTypes: {}
8
+ };
9
+ export default meta;
10
+ export var Complex = {
11
+ render: function (args) {
12
+ return _jsx(ComplexDataTable, __assign({}, args));
13
+ },
14
+ args: {
15
+ variant: 'complex'
16
+ }
17
+ };
18
+ //# sourceMappingURL=complex-data-table.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"complex-data-table.stories.js","sourceRoot":"","sources":["../../../stories/data-table/complex-data-table.stories.tsx"],"names":[],"mappings":";;AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,IAAM,IAAI,GAAkC;IAC1C,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,EACT;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,IAAM,OAAO,GAAU;IAC5B,MAAM,EAAE,UAAC,IAAqD;QAC5D,OAAO,KAAC,gBAAgB,eAAK,IAAI,EAAI,CAAC;IACxC,CAAC;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,SAAS;KACnB;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { SimpleDataTableProps } from '../../modules/data-table/simple/simple-data-table.props';
2
+ /**
3
+ * Primary UI component for user interaction
4
+ */
5
+ export declare const SimpleDataTable: (props: {
6
+ variant: 'simple';
7
+ } & SimpleDataTableProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import CustomDataTable from '../../modules/data-table';
4
+ import dummyData from './dummy-data';
5
+ import { columns, header } from './data-table-columns';
6
+ /**
7
+ * Primary UI component for user interaction
8
+ */
9
+ export var SimpleDataTable = function (props) {
10
+ return (_jsx(CustomDataTable, __assign({}, props, { data: dummyData, header: header, column: columns })));
11
+ };
12
+ //# sourceMappingURL=simple-data-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-data-table.js","sourceRoot":"","sources":["../../../stories/data-table/simple-data-table.tsx"],"names":[],"mappings":";;AAAA,OAAO,eAAe,MAAM,0BAA0B,CAAC;AACvD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAGvD;;GAEG;AACH,MAAM,CAAC,IAAM,eAAe,GAAG,UAAC,KAAiD;IAC/E,OAAO,CACL,KAAC,eAAe,eACV,KAAK,IACT,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,IACf,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { SimpleDataTable } from './simple-data-table';
3
+ declare const meta: Meta<typeof SimpleDataTable>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof SimpleDataTable>;
6
+ export declare const Simple: Story;
@@ -0,0 +1,18 @@
1
+ import { __assign } from "tslib";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { SimpleDataTable } from './simple-data-table';
4
+ var meta = {
5
+ title: 'DataTable',
6
+ component: SimpleDataTable,
7
+ argTypes: {}
8
+ };
9
+ export default meta;
10
+ export var Simple = {
11
+ render: function (args) {
12
+ return _jsx(SimpleDataTable, __assign({}, args));
13
+ },
14
+ args: {
15
+ variant: 'simple'
16
+ }
17
+ };
18
+ //# sourceMappingURL=simple-data-table.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple-data-table.stories.js","sourceRoot":"","sources":["../../../stories/data-table/simple-data-table.stories.tsx"],"names":[],"mappings":";;AACA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAGtD,IAAM,IAAI,GAAiC;IACzC,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,eAAe;IAC1B,QAAQ,EAAE,EACT;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,IAAM,MAAM,GAAU;IAC3B,MAAM,EAAE,UAAC,IAAiD;QACxD,OAAO,KAAC,eAAe,eAAK,IAAI,EAAI,CAAC;IACvC,CAAC;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,QAAQ;KAClB;CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pezeshk-book/modules",
3
- "version": "0.1.91",
3
+ "version": "0.2.0",
4
4
  "types": "./dist/index.d.ts",
5
5
  "main": "./dist/index.ts",
6
6
  "module": "./dist/index.js",
@@ -1,5 +0,0 @@
1
- import { DataTableProps } from '../../modules/data-table/data-table.props';
2
- /**
3
- * Primary UI component for user interaction
4
- */
5
- export declare const DataTable: ({ ...props }: DataTableProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,13 +0,0 @@
1
- import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import CustomDataTable from '../../modules/data-table';
4
- import dummyData from './dummy-data';
5
- import { header, columns } from './data-table-columns';
6
- /**
7
- * Primary UI component for user interaction
8
- */
9
- export var DataTable = function (_a) {
10
- var props = __rest(_a, []);
11
- return (_jsx(CustomDataTable, __assign({}, props, { data: dummyData, header: header, total: 20, perPage: 20, lastPage: 1, column: columns })));
12
- };
13
- //# sourceMappingURL=data-table.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-table.js","sourceRoot":"","sources":["../../../stories/data-table/data-table.tsx"],"names":[],"mappings":";;AAAA,OAAO,eAAe,MAAM,0BAA0B,CAAC;AAEvD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAEG;AACH,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,EAA4B;QAAvB,KAAK,cAAV,EAAY,CAAF;IAClC,OAAO,CACL,KAAC,eAAe,eACV,KAAK,IACT,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,EAAE,EACT,OAAO,EAAE,EAAE,EACX,QAAQ,EAAE,CAAC,EACX,MAAM,EAAE,OAAO,IACf,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -1,6 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
- import { DataTable } from './data-table';
3
- declare const meta: Meta<typeof DataTable>;
4
- export default meta;
5
- type Story = StoryObj<typeof DataTable>;
6
- export declare const Default: Story;
@@ -1,15 +0,0 @@
1
- import { __assign } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { DataTable } from './data-table';
4
- var meta = {
5
- title: 'DataTable',
6
- component: DataTable,
7
- argTypes: {}
8
- };
9
- export default meta;
10
- export var Default = {
11
- render: function (args) {
12
- return _jsx(DataTable, __assign({}, args));
13
- }
14
- };
15
- //# sourceMappingURL=data-table.stories.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-table.stories.js","sourceRoot":"","sources":["../../../stories/data-table/data-table.stories.tsx"],"names":[],"mappings":";;AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,IAAM,IAAI,GAA2B;IACnC,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,SAAS;IACpB,QAAQ,EAAE,EACT;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,IAAM,OAAO,GAAU;IAC5B,MAAM,EAAE,UAAC,IAAqB;QAC5B,OAAO,KAAC,SAAS,eAAK,IAAI,EAAI,CAAC;IACjC,CAAC;CACF,CAAC"}