@atlaskit/table 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.
Files changed (108) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE.md +13 -0
  3. package/README.md +83 -0
  4. package/constellation/index/examples.mdx +19 -0
  5. package/constellation/index/props.mdx +32 -0
  6. package/dist/cjs/body.js +105 -0
  7. package/dist/cjs/head-cell.js +42 -0
  8. package/dist/cjs/hooks/selection-provider.js +52 -0
  9. package/dist/cjs/hooks/use-row-id.js +26 -0
  10. package/dist/cjs/hooks/use-selectable.js +183 -0
  11. package/dist/cjs/hooks/use-sorting.js +59 -0
  12. package/dist/cjs/hooks/use-table-body.js +28 -0
  13. package/dist/cjs/hooks/use-table.js +56 -0
  14. package/dist/cjs/index.js +63 -0
  15. package/dist/cjs/row.js +70 -0
  16. package/dist/cjs/selectable-cell.js +53 -0
  17. package/dist/cjs/sortable-column.js +129 -0
  18. package/dist/cjs/table.js +60 -0
  19. package/dist/cjs/thead.js +73 -0
  20. package/dist/cjs/ui/base-cell.js +72 -0
  21. package/dist/cjs/ui/bulk-action-overlay.js +39 -0
  22. package/dist/cjs/ui/index.js +69 -0
  23. package/dist/cjs/ui/selectable-cell.js +39 -0
  24. package/dist/cjs/ui/table.js +31 -0
  25. package/dist/cjs/ui/tbody.js +38 -0
  26. package/dist/cjs/ui/td.js +38 -0
  27. package/dist/cjs/ui/th.js +40 -0
  28. package/dist/cjs/ui/thead.js +40 -0
  29. package/dist/cjs/ui/tr.js +68 -0
  30. package/dist/cjs/version.json +5 -0
  31. package/dist/es2019/body.js +66 -0
  32. package/dist/es2019/head-cell.js +31 -0
  33. package/dist/es2019/hooks/selection-provider.js +33 -0
  34. package/dist/es2019/hooks/use-row-id.js +13 -0
  35. package/dist/es2019/hooks/use-selectable.js +158 -0
  36. package/dist/es2019/hooks/use-sorting.js +37 -0
  37. package/dist/es2019/hooks/use-table-body.js +13 -0
  38. package/dist/es2019/hooks/use-table.js +34 -0
  39. package/dist/es2019/index.js +7 -0
  40. package/dist/es2019/row.js +41 -0
  41. package/dist/es2019/selectable-cell.js +25 -0
  42. package/dist/es2019/sortable-column.js +109 -0
  43. package/dist/es2019/table.js +38 -0
  44. package/dist/es2019/thead.js +46 -0
  45. package/dist/es2019/ui/base-cell.js +54 -0
  46. package/dist/es2019/ui/bulk-action-overlay.js +27 -0
  47. package/dist/es2019/ui/index.js +11 -0
  48. package/dist/es2019/ui/selectable-cell.js +28 -0
  49. package/dist/es2019/ui/table.js +22 -0
  50. package/dist/es2019/ui/tbody.js +26 -0
  51. package/dist/es2019/ui/td.js +21 -0
  52. package/dist/es2019/ui/th.js +26 -0
  53. package/dist/es2019/ui/thead.js +31 -0
  54. package/dist/es2019/ui/tr.js +55 -0
  55. package/dist/es2019/version.json +5 -0
  56. package/dist/esm/body.js +84 -0
  57. package/dist/esm/head-cell.js +31 -0
  58. package/dist/esm/hooks/selection-provider.js +32 -0
  59. package/dist/esm/hooks/use-row-id.js +15 -0
  60. package/dist/esm/hooks/use-selectable.js +171 -0
  61. package/dist/esm/hooks/use-sorting.js +46 -0
  62. package/dist/esm/hooks/use-table-body.js +13 -0
  63. package/dist/esm/hooks/use-table.js +36 -0
  64. package/dist/esm/index.js +7 -0
  65. package/dist/esm/row.js +46 -0
  66. package/dist/esm/selectable-cell.js +31 -0
  67. package/dist/esm/sortable-column.js +114 -0
  68. package/dist/esm/table.js +39 -0
  69. package/dist/esm/thead.js +51 -0
  70. package/dist/esm/ui/base-cell.js +58 -0
  71. package/dist/esm/ui/bulk-action-overlay.js +28 -0
  72. package/dist/esm/ui/index.js +11 -0
  73. package/dist/esm/ui/selectable-cell.js +28 -0
  74. package/dist/esm/ui/table.js +21 -0
  75. package/dist/esm/ui/tbody.js +27 -0
  76. package/dist/esm/ui/td.js +26 -0
  77. package/dist/esm/ui/th.js +28 -0
  78. package/dist/esm/ui/thead.js +30 -0
  79. package/dist/esm/ui/tr.js +55 -0
  80. package/dist/esm/version.json +5 -0
  81. package/dist/types/body.d.ts +15 -0
  82. package/dist/types/head-cell.d.ts +10 -0
  83. package/dist/types/hooks/selection-provider.d.ts +25 -0
  84. package/dist/types/hooks/use-row-id.d.ts +10 -0
  85. package/dist/types/hooks/use-selectable.d.ts +14 -0
  86. package/dist/types/hooks/use-sorting.d.ts +6 -0
  87. package/dist/types/hooks/use-table-body.d.ts +7 -0
  88. package/dist/types/hooks/use-table.d.ts +21 -0
  89. package/dist/types/index.d.ts +7 -0
  90. package/dist/types/row.d.ts +14 -0
  91. package/dist/types/selectable-cell.d.ts +3 -0
  92. package/dist/types/sortable-column.d.ts +17 -0
  93. package/dist/types/table.d.ts +26 -0
  94. package/dist/types/thead.d.ts +7 -0
  95. package/dist/types/ui/base-cell.d.ts +30 -0
  96. package/dist/types/ui/bulk-action-overlay.d.ts +8 -0
  97. package/dist/types/ui/index.d.ts +11 -0
  98. package/dist/types/ui/selectable-cell.d.ts +10 -0
  99. package/dist/types/ui/table.d.ts +23 -0
  100. package/dist/types/ui/tbody.d.ts +8 -0
  101. package/dist/types/ui/td.d.ts +11 -0
  102. package/dist/types/ui/th.d.ts +11 -0
  103. package/dist/types/ui/thead.d.ts +10 -0
  104. package/dist/types/ui/tr.d.ts +16 -0
  105. package/package.json +101 -0
  106. package/primitives/package.json +15 -0
  107. package/report.api.md +139 -0
  108. package/tmp/api-report-tmp.d.ts +99 -0
@@ -0,0 +1,16 @@
1
+ /** @jsx jsx */
2
+ import { FC } from 'react';
3
+ interface TRProps {
4
+ testId?: string;
5
+ isSelected?: boolean;
6
+ isBodyRow?: boolean;
7
+ }
8
+ /**
9
+ * __Row__
10
+ *
11
+ * A row primitive.
12
+ *
13
+ * - [Examples](https://atlassian.design/components/table/examples)
14
+ */
15
+ export declare const TR: FC<TRProps>;
16
+ export {};
package/package.json ADDED
@@ -0,0 +1,101 @@
1
+ {
2
+ "name": "@atlaskit/table",
3
+ "version": "0.1.0",
4
+ "description": "A table is used to display data.",
5
+ "author": "Atlassian Pty Ltd",
6
+ "license": "Apache-2.0",
7
+ "publishConfig": {
8
+ "registry": "https://registry.npmjs.org/"
9
+ },
10
+ "homepage": "https://atlassian.design/components/table",
11
+ "atlassian": {
12
+ "team": "Design System Team",
13
+ "inPublicMirror": false,
14
+ "releaseModel": "continuous",
15
+ "website": {
16
+ "name": "Table",
17
+ "category": "Components",
18
+ "draft": true
19
+ }
20
+ },
21
+ "repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
22
+ "main": "dist/cjs/index.js",
23
+ "module": "dist/esm/index.js",
24
+ "module:es2019": "dist/es2019/index.js",
25
+ "types": "dist/types/index.d.ts",
26
+ "sideEffects": false,
27
+ "atlaskit:src": "src/index.tsx",
28
+ "af:exports": {
29
+ ".": "./src/index.tsx",
30
+ "./primitives": "./src/ui/index.tsx"
31
+ },
32
+ "dependencies": {
33
+ "@atlaskit/button": "^16.4.1",
34
+ "@atlaskit/checkbox": "^12.4.1",
35
+ "@atlaskit/ds-explorations": "^1.3.2",
36
+ "@atlaskit/ds-lib": "^2.1.2",
37
+ "@atlaskit/focus-ring": "^1.2.1",
38
+ "@atlaskit/icon": "^21.11.2",
39
+ "@atlaskit/tokens": "^0.11.4",
40
+ "@atlaskit/tooltip": "^17.5.16",
41
+ "@atlaskit/visually-hidden": "^1.0.0",
42
+ "@babel/runtime": "^7.0.0",
43
+ "@emotion/react": "^11.7.1",
44
+ "tiny-invariant": "^1.2.0"
45
+ },
46
+ "peerDependencies": {
47
+ "react": "^16.8.0"
48
+ },
49
+ "devDependencies": {
50
+ "@atlaskit/avatar": "*",
51
+ "@atlaskit/code": "*",
52
+ "@atlaskit/date": "*",
53
+ "@atlaskit/docs": "*",
54
+ "@atlaskit/ds-lib": "*",
55
+ "@atlaskit/dynamic-table": "*",
56
+ "@atlaskit/lozenge": "*",
57
+ "@atlaskit/ssr": "*",
58
+ "@atlaskit/visual-regression": "*",
59
+ "@atlaskit/webdriver-runner": "*",
60
+ "@atlassian/atlassian-frontend-prettier-config-1.0.0": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.0",
61
+ "@testing-library/react": "^12.1.5",
62
+ "@testing-library/react-hooks": "^8.0.1",
63
+ "react-dom": "^16.8.0",
64
+ "storybook-addon-designs": "^6.3.1",
65
+ "typescript": "4.5.5",
66
+ "wait-for-expect": "^1.2.0"
67
+ },
68
+ "techstack": {
69
+ "@atlassian/frontend": {
70
+ "import-structure": [
71
+ "atlassian-conventions"
72
+ ],
73
+ "circular-dependencies": [
74
+ "file-and-folder-level"
75
+ ]
76
+ },
77
+ "@repo/internal": {
78
+ "dom-events": "use-bind-event-listener",
79
+ "analytics": [
80
+ "analytics-next"
81
+ ],
82
+ "theming": [
83
+ "react-context",
84
+ "tokens"
85
+ ],
86
+ "ui-components": [
87
+ "lite-mode"
88
+ ],
89
+ "design-system": "v1",
90
+ "design-tokens": "spacing",
91
+ "deprecation": [
92
+ "no-deprecated-imports"
93
+ ],
94
+ "styling": [
95
+ "static",
96
+ "emotion"
97
+ ]
98
+ }
99
+ },
100
+ "prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
101
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "@atlaskit/table/primitives",
3
+ "main": "../dist/cjs/ui/index.js",
4
+ "module": "../dist/esm/ui/index.js",
5
+ "module:es2019": "../dist/es2019/ui/index.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/ui/index.d.ts",
8
+ "typesVersions": {
9
+ ">=4.0 <4.5": {
10
+ "*": [
11
+ "../dist/types-ts4.0/ui/index.d.ts"
12
+ ]
13
+ }
14
+ }
15
+ }
package/report.api.md ADDED
@@ -0,0 +1,139 @@
1
+ <!-- API Report Version: 2.3 -->
2
+
3
+ ## API Report File for "@atlaskit/table"
4
+
5
+ > Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
6
+ > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
7
+
8
+ ### Table of contents
9
+
10
+ - [Main Entry Types](#main-entry-types)
11
+ - [Peer Dependencies](#peer-dependencies)
12
+
13
+ ### Main Entry Types
14
+
15
+ <!--SECTION START: Main Entry Types-->
16
+
17
+ ```ts
18
+ import { BoxProps } from '@atlaskit/ds-explorations/box';
19
+ import { FC } from 'react';
20
+ import { jsx } from '@emotion/react';
21
+ import { ReactElement } from 'react';
22
+ import { ReactNode } from 'react';
23
+
24
+ // @public (undocumented)
25
+ const alignMap: {
26
+ readonly text: 'flexStart';
27
+ readonly number: 'flexEnd';
28
+ readonly icon: 'center';
29
+ };
30
+
31
+ // @public (undocumented)
32
+ type BaseCellProps = {
33
+ align?: keyof typeof alignMap;
34
+ as?: 'td' | 'th';
35
+ scope?: 'col' | 'row';
36
+ testId?: string;
37
+ children?: ReactNode;
38
+ } & Pick<
39
+ BoxProps,
40
+ 'backgroundColor' | 'className' | 'paddingBlock' | 'paddingInline'
41
+ >;
42
+
43
+ // @public (undocumented)
44
+ type BodyProps<Item extends object> =
45
+ | {
46
+ rows: Item[];
47
+ children: (row: Item) => ReactElement;
48
+ }
49
+ | {
50
+ rows?: never;
51
+ children: ReactElement | ReactElement[];
52
+ };
53
+
54
+ // @public
55
+ export const Cell: FC<Omit<BaseCellProps, 'as'>>;
56
+
57
+ // @public (undocumented)
58
+ interface CellProps {
59
+ name: string;
60
+ // (undocumented)
61
+ onClick?: React.MouseEventHandler;
62
+ // (undocumented)
63
+ testId?: string;
64
+ }
65
+
66
+ // @public
67
+ export const HeadCell: FC<THProps>;
68
+
69
+ // @public
70
+ export const Row: FC<RowProps>;
71
+
72
+ // @public (undocumented)
73
+ type RowProps = {
74
+ testId?: string;
75
+ };
76
+
77
+ // @public
78
+ export const SortableColumn: FC<CellProps>;
79
+
80
+ // @public (undocumented)
81
+ type SortKey<Key extends number | string | symbol> = 'unset' | Key;
82
+
83
+ // @public
84
+ function Table<ItemType extends object = object>({
85
+ children,
86
+ isSelectable,
87
+ sortKey,
88
+ testId,
89
+ }: TableProps<ItemType>): jsx.JSX.Element;
90
+ export default Table;
91
+
92
+ // @public (undocumented)
93
+ type TableProps<ItemType extends object = {}> = {
94
+ testId?: string;
95
+ sortKey?: SortKey<keyof ItemType>;
96
+ children: ReactElement | ReactElement[];
97
+ } & (
98
+ | {
99
+ isSelectable: true;
100
+ defaultSelected?: number;
101
+ }
102
+ | {
103
+ isSelectable?: false;
104
+ }
105
+ );
106
+
107
+ // @public
108
+ export function TBody<ObjectType extends object>({
109
+ rows,
110
+ children,
111
+ }: BodyProps<ObjectType>): jsx.JSX.Element;
112
+
113
+ // @public (undocumented)
114
+ export const THead: FC<THeadProps>;
115
+
116
+ // @public (undocumented)
117
+ type THeadProps = {
118
+ actions?: (selected: number[]) => ReactNode;
119
+ };
120
+
121
+ // @public (undocumented)
122
+ type THProps = Omit<BaseCellProps, 'as'>;
123
+
124
+ // (No @packageDocumentation comment for this package)
125
+ ```
126
+
127
+ <!--SECTION END: Main Entry Types-->
128
+
129
+ ### Peer Dependencies
130
+
131
+ <!--SECTION START: Peer Dependencies-->
132
+
133
+ ```json
134
+ {
135
+ "react": "^16.8.0"
136
+ }
137
+ ```
138
+
139
+ <!--SECTION END: Peer Dependencies-->
@@ -0,0 +1,99 @@
1
+ ## API Report File for "@atlaskit/table"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { BoxProps } from '@atlaskit/ds-explorations/box';
8
+ import { FC } from 'react';
9
+ import { jsx } from '@emotion/react';
10
+ import { ReactElement } from 'react';
11
+ import { ReactNode } from 'react';
12
+
13
+ // @public (undocumented)
14
+ const alignMap: {
15
+ readonly text: "flexStart";
16
+ readonly number: "flexEnd";
17
+ readonly icon: "center";
18
+ };
19
+
20
+ // @public (undocumented)
21
+ type BaseCellProps = {
22
+ align?: keyof typeof alignMap;
23
+ as?: 'td' | 'th';
24
+ scope?: 'col' | 'row';
25
+ testId?: string;
26
+ children?: ReactNode;
27
+ } & Pick<BoxProps, 'backgroundColor' | 'className' | 'paddingBlock' | 'paddingInline'>;
28
+
29
+ // @public (undocumented)
30
+ type BodyProps<Item extends object> = {
31
+ rows: Item[];
32
+ children: (row: Item) => ReactElement;
33
+ } | {
34
+ rows?: never;
35
+ children: ReactElement | ReactElement[];
36
+ };
37
+
38
+ // @public
39
+ export const Cell: FC<Omit<BaseCellProps, 'as'>>;
40
+
41
+ // @public (undocumented)
42
+ interface CellProps {
43
+ name: string;
44
+ // (undocumented)
45
+ onClick?: React.MouseEventHandler;
46
+ // (undocumented)
47
+ testId?: string;
48
+ }
49
+
50
+ // @public
51
+ export const HeadCell: FC<THProps>;
52
+
53
+ // @public
54
+ export const Row: FC<RowProps>;
55
+
56
+ // @public (undocumented)
57
+ type RowProps = {
58
+ testId?: string;
59
+ };
60
+
61
+ // @public
62
+ export const SortableColumn: FC<CellProps>;
63
+
64
+ // @public (undocumented)
65
+ type SortKey<Key extends number | string | symbol> = 'unset' | Key;
66
+
67
+ // @public
68
+ function Table<ItemType extends object = object>({ children, isSelectable, sortKey, testId, }: TableProps<ItemType>): jsx.JSX.Element;
69
+ export default Table;
70
+
71
+ // @public (undocumented)
72
+ type TableProps<ItemType extends object = {}> = {
73
+ testId?: string;
74
+ sortKey?: SortKey<keyof ItemType>;
75
+ children: ReactElement | ReactElement[];
76
+ } & ({
77
+ isSelectable: true;
78
+ defaultSelected?: number;
79
+ } | {
80
+ isSelectable?: false;
81
+ });
82
+
83
+ // @public
84
+ export function TBody<ObjectType extends object>({ rows, children, }: BodyProps<ObjectType>): jsx.JSX.Element;
85
+
86
+ // @public (undocumented)
87
+ export const THead: FC<THeadProps>;
88
+
89
+ // @public (undocumented)
90
+ type THeadProps = {
91
+ actions?: (selected: number[]) => ReactNode;
92
+ };
93
+
94
+ // @public (undocumented)
95
+ type THProps = Omit<BaseCellProps, 'as'>;
96
+
97
+ // (No @packageDocumentation comment for this package)
98
+
99
+ ```