@bacon-pos/ui 0.9.0 → 0.11.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 (175) hide show
  1. package/lib/commonjs/components/Alert/Alert.js +137 -0
  2. package/lib/commonjs/components/Alert/Alert.js.map +1 -0
  3. package/lib/commonjs/components/Alert/Alert.stories.js +104 -0
  4. package/lib/commonjs/components/Alert/Alert.stories.js.map +1 -0
  5. package/lib/commonjs/components/Alert/Alert.test.js +62 -0
  6. package/lib/commonjs/components/Alert/Alert.test.js.map +1 -0
  7. package/lib/commonjs/components/Alert/index.js +13 -0
  8. package/lib/commonjs/components/Alert/index.js.map +1 -0
  9. package/lib/commonjs/components/EmptyState/EmptyState.js +88 -0
  10. package/lib/commonjs/components/EmptyState/EmptyState.js.map +1 -0
  11. package/lib/commonjs/components/EmptyState/EmptyState.stories.js +46 -0
  12. package/lib/commonjs/components/EmptyState/EmptyState.stories.js.map +1 -0
  13. package/lib/commonjs/components/EmptyState/EmptyState.test.js +40 -0
  14. package/lib/commonjs/components/EmptyState/EmptyState.test.js.map +1 -0
  15. package/lib/commonjs/components/EmptyState/index.js +13 -0
  16. package/lib/commonjs/components/EmptyState/index.js.map +1 -0
  17. package/lib/commonjs/components/Sidebar/Sidebar.js +264 -0
  18. package/lib/commonjs/components/Sidebar/Sidebar.js.map +1 -0
  19. package/lib/commonjs/components/Sidebar/Sidebar.stories.js +229 -0
  20. package/lib/commonjs/components/Sidebar/Sidebar.stories.js.map +1 -0
  21. package/lib/commonjs/components/Sidebar/Sidebar.test.js +131 -0
  22. package/lib/commonjs/components/Sidebar/Sidebar.test.js.map +1 -0
  23. package/lib/commonjs/components/Sidebar/index.js +13 -0
  24. package/lib/commonjs/components/Sidebar/index.js.map +1 -0
  25. package/lib/commonjs/components/StatTile/StatTile.js +94 -0
  26. package/lib/commonjs/components/StatTile/StatTile.js.map +1 -0
  27. package/lib/commonjs/components/StatTile/StatTile.stories.js +100 -0
  28. package/lib/commonjs/components/StatTile/StatTile.stories.js.map +1 -0
  29. package/lib/commonjs/components/StatTile/StatTile.test.js +49 -0
  30. package/lib/commonjs/components/StatTile/StatTile.test.js.map +1 -0
  31. package/lib/commonjs/components/StatTile/index.js +13 -0
  32. package/lib/commonjs/components/StatTile/index.js.map +1 -0
  33. package/lib/commonjs/components/Table/DataTable.js +149 -0
  34. package/lib/commonjs/components/Table/DataTable.js.map +1 -0
  35. package/lib/commonjs/components/Table/DataTable.stories.js +214 -0
  36. package/lib/commonjs/components/Table/DataTable.stories.js.map +1 -0
  37. package/lib/commonjs/components/Table/DataTable.test.js +143 -0
  38. package/lib/commonjs/components/Table/DataTable.test.js.map +1 -0
  39. package/lib/commonjs/components/Table/Table.js +520 -0
  40. package/lib/commonjs/components/Table/Table.js.map +1 -0
  41. package/lib/commonjs/components/Table/Table.stories.js +385 -0
  42. package/lib/commonjs/components/Table/Table.stories.js.map +1 -0
  43. package/lib/commonjs/components/Table/Table.test.js +278 -0
  44. package/lib/commonjs/components/Table/Table.test.js.map +1 -0
  45. package/lib/commonjs/components/Table/index.js +20 -0
  46. package/lib/commonjs/components/Table/index.js.map +1 -0
  47. package/lib/commonjs/components/brand/BaconLogo.js +29 -0
  48. package/lib/commonjs/components/brand/BaconLogo.js.map +1 -0
  49. package/lib/commonjs/components/brand/index.js +7 -0
  50. package/lib/commonjs/components/brand/index.js.map +1 -1
  51. package/lib/commonjs/components/index.js +83 -28
  52. package/lib/commonjs/components/index.js.map +1 -1
  53. package/lib/module/components/Alert/Alert.js +133 -0
  54. package/lib/module/components/Alert/Alert.js.map +1 -0
  55. package/lib/module/components/Alert/Alert.stories.js +100 -0
  56. package/lib/module/components/Alert/Alert.stories.js.map +1 -0
  57. package/lib/module/components/Alert/Alert.test.js +62 -0
  58. package/lib/module/components/Alert/Alert.test.js.map +1 -0
  59. package/lib/module/components/Alert/index.js +4 -0
  60. package/lib/module/components/Alert/index.js.map +1 -0
  61. package/lib/module/components/EmptyState/EmptyState.js +84 -0
  62. package/lib/module/components/EmptyState/EmptyState.js.map +1 -0
  63. package/lib/module/components/EmptyState/EmptyState.stories.js +42 -0
  64. package/lib/module/components/EmptyState/EmptyState.stories.js.map +1 -0
  65. package/lib/module/components/EmptyState/EmptyState.test.js +40 -0
  66. package/lib/module/components/EmptyState/EmptyState.test.js.map +1 -0
  67. package/lib/module/components/EmptyState/index.js +4 -0
  68. package/lib/module/components/EmptyState/index.js.map +1 -0
  69. package/lib/module/components/Sidebar/Sidebar.js +260 -0
  70. package/lib/module/components/Sidebar/Sidebar.js.map +1 -0
  71. package/lib/module/components/Sidebar/Sidebar.stories.js +225 -0
  72. package/lib/module/components/Sidebar/Sidebar.stories.js.map +1 -0
  73. package/lib/module/components/Sidebar/Sidebar.test.js +131 -0
  74. package/lib/module/components/Sidebar/Sidebar.test.js.map +1 -0
  75. package/lib/module/components/Sidebar/index.js +4 -0
  76. package/lib/module/components/Sidebar/index.js.map +1 -0
  77. package/lib/module/components/StatTile/StatTile.js +90 -0
  78. package/lib/module/components/StatTile/StatTile.js.map +1 -0
  79. package/lib/module/components/StatTile/StatTile.stories.js +96 -0
  80. package/lib/module/components/StatTile/StatTile.stories.js.map +1 -0
  81. package/lib/module/components/StatTile/StatTile.test.js +49 -0
  82. package/lib/module/components/StatTile/StatTile.test.js.map +1 -0
  83. package/lib/module/components/StatTile/index.js +4 -0
  84. package/lib/module/components/StatTile/index.js.map +1 -0
  85. package/lib/module/components/Table/DataTable.js +145 -0
  86. package/lib/module/components/Table/DataTable.js.map +1 -0
  87. package/lib/module/components/Table/DataTable.stories.js +210 -0
  88. package/lib/module/components/Table/DataTable.stories.js.map +1 -0
  89. package/lib/module/components/Table/DataTable.test.js +143 -0
  90. package/lib/module/components/Table/DataTable.test.js.map +1 -0
  91. package/lib/module/components/Table/Table.js +516 -0
  92. package/lib/module/components/Table/Table.js.map +1 -0
  93. package/lib/module/components/Table/Table.stories.js +381 -0
  94. package/lib/module/components/Table/Table.stories.js.map +1 -0
  95. package/lib/module/components/Table/Table.test.js +278 -0
  96. package/lib/module/components/Table/Table.test.js.map +1 -0
  97. package/lib/module/components/Table/index.js +5 -0
  98. package/lib/module/components/Table/index.js.map +1 -0
  99. package/lib/module/components/brand/BaconLogo.js +25 -0
  100. package/lib/module/components/brand/BaconLogo.js.map +1 -0
  101. package/lib/module/components/brand/index.js +1 -0
  102. package/lib/module/components/brand/index.js.map +1 -1
  103. package/lib/module/components/index.js +5 -0
  104. package/lib/module/components/index.js.map +1 -1
  105. package/lib/typescript/commonjs/components/Alert/Alert.d.ts +41 -0
  106. package/lib/typescript/commonjs/components/Alert/Alert.d.ts.map +1 -0
  107. package/lib/typescript/commonjs/components/Alert/index.d.ts +3 -0
  108. package/lib/typescript/commonjs/components/Alert/index.d.ts.map +1 -0
  109. package/lib/typescript/commonjs/components/EmptyState/EmptyState.d.ts +30 -0
  110. package/lib/typescript/commonjs/components/EmptyState/EmptyState.d.ts.map +1 -0
  111. package/lib/typescript/commonjs/components/EmptyState/index.d.ts +3 -0
  112. package/lib/typescript/commonjs/components/EmptyState/index.d.ts.map +1 -0
  113. package/lib/typescript/commonjs/components/Sidebar/Sidebar.d.ts +57 -0
  114. package/lib/typescript/commonjs/components/Sidebar/Sidebar.d.ts.map +1 -0
  115. package/lib/typescript/commonjs/components/Sidebar/index.d.ts +3 -0
  116. package/lib/typescript/commonjs/components/Sidebar/index.d.ts.map +1 -0
  117. package/lib/typescript/commonjs/components/StatTile/StatTile.d.ts +31 -0
  118. package/lib/typescript/commonjs/components/StatTile/StatTile.d.ts.map +1 -0
  119. package/lib/typescript/commonjs/components/StatTile/index.d.ts +3 -0
  120. package/lib/typescript/commonjs/components/StatTile/index.d.ts.map +1 -0
  121. package/lib/typescript/commonjs/components/Table/DataTable.d.ts +53 -0
  122. package/lib/typescript/commonjs/components/Table/DataTable.d.ts.map +1 -0
  123. package/lib/typescript/commonjs/components/Table/Table.d.ts +85 -0
  124. package/lib/typescript/commonjs/components/Table/Table.d.ts.map +1 -0
  125. package/lib/typescript/commonjs/components/Table/index.d.ts +5 -0
  126. package/lib/typescript/commonjs/components/Table/index.d.ts.map +1 -0
  127. package/lib/typescript/commonjs/components/brand/BaconLogo.d.ts +13 -0
  128. package/lib/typescript/commonjs/components/brand/BaconLogo.d.ts.map +1 -0
  129. package/lib/typescript/commonjs/components/brand/index.d.ts +1 -0
  130. package/lib/typescript/commonjs/components/brand/index.d.ts.map +1 -1
  131. package/lib/typescript/commonjs/components/index.d.ts +5 -0
  132. package/lib/typescript/commonjs/components/index.d.ts.map +1 -1
  133. package/lib/typescript/module/components/Alert/Alert.d.ts +41 -0
  134. package/lib/typescript/module/components/Alert/Alert.d.ts.map +1 -0
  135. package/lib/typescript/module/components/Alert/index.d.ts +3 -0
  136. package/lib/typescript/module/components/Alert/index.d.ts.map +1 -0
  137. package/lib/typescript/module/components/EmptyState/EmptyState.d.ts +30 -0
  138. package/lib/typescript/module/components/EmptyState/EmptyState.d.ts.map +1 -0
  139. package/lib/typescript/module/components/EmptyState/index.d.ts +3 -0
  140. package/lib/typescript/module/components/EmptyState/index.d.ts.map +1 -0
  141. package/lib/typescript/module/components/Sidebar/Sidebar.d.ts +57 -0
  142. package/lib/typescript/module/components/Sidebar/Sidebar.d.ts.map +1 -0
  143. package/lib/typescript/module/components/Sidebar/index.d.ts +3 -0
  144. package/lib/typescript/module/components/Sidebar/index.d.ts.map +1 -0
  145. package/lib/typescript/module/components/StatTile/StatTile.d.ts +31 -0
  146. package/lib/typescript/module/components/StatTile/StatTile.d.ts.map +1 -0
  147. package/lib/typescript/module/components/StatTile/index.d.ts +3 -0
  148. package/lib/typescript/module/components/StatTile/index.d.ts.map +1 -0
  149. package/lib/typescript/module/components/Table/DataTable.d.ts +53 -0
  150. package/lib/typescript/module/components/Table/DataTable.d.ts.map +1 -0
  151. package/lib/typescript/module/components/Table/Table.d.ts +85 -0
  152. package/lib/typescript/module/components/Table/Table.d.ts.map +1 -0
  153. package/lib/typescript/module/components/Table/index.d.ts +5 -0
  154. package/lib/typescript/module/components/Table/index.d.ts.map +1 -0
  155. package/lib/typescript/module/components/brand/BaconLogo.d.ts +13 -0
  156. package/lib/typescript/module/components/brand/BaconLogo.d.ts.map +1 -0
  157. package/lib/typescript/module/components/brand/index.d.ts +1 -0
  158. package/lib/typescript/module/components/brand/index.d.ts.map +1 -1
  159. package/lib/typescript/module/components/index.d.ts +5 -0
  160. package/lib/typescript/module/components/index.d.ts.map +1 -1
  161. package/package.json +1 -1
  162. package/src/components/Alert/Alert.tsx +132 -0
  163. package/src/components/Alert/index.ts +2 -0
  164. package/src/components/EmptyState/EmptyState.tsx +91 -0
  165. package/src/components/EmptyState/index.ts +2 -0
  166. package/src/components/Sidebar/Sidebar.tsx +320 -0
  167. package/src/components/Sidebar/index.ts +2 -0
  168. package/src/components/StatTile/StatTile.tsx +98 -0
  169. package/src/components/StatTile/index.ts +2 -0
  170. package/src/components/Table/DataTable.tsx +173 -0
  171. package/src/components/Table/Table.tsx +556 -0
  172. package/src/components/Table/index.ts +10 -0
  173. package/src/components/brand/BaconLogo.tsx +25 -0
  174. package/src/components/brand/index.ts +1 -0
  175. package/src/components/index.ts +5 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_DataTable","_IconButton","_jsxRuntime","meta","title","component","DataTable","_default","exports","default","ALL","id","name","category","price","TABS","value","label","COLUMNS","key","header","flex","sortable","sortAccessor","r","align","Number","replace","Full","render","tab","setTab","useState","search","setSearch","data","useMemo","filter","toLowerCase","includes","jsx","View","style","padding","width","children","tabs","activeTab","onTabChange","searchable","searchValue","onSearchChange","searchPlaceholder","createLabel","onCreate","columns","keyExtractor","renderActions","jsxs","Fragment","IconButton","icon","accessibilityLabel","variant","size","onPress","emptyState","description","action","EmptyState","Paginated","page","setPage","pageSize","pageData","slice","pagination","total","length","onPageChange"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Table/DataTable.stories.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA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var _react = require("react");
4
+ var _reactNative = require("@testing-library/react-native");
5
+ var _index = require("../../theme/index.js");
6
+ var _DataTable = require("./DataTable.js");
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ function wrap(ui) {
9
+ return (0, _reactNative.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ThemeProvider, {
10
+ children: ui
11
+ }));
12
+ }
13
+ const DATA = [{
14
+ id: 'a',
15
+ name: 'Alpha',
16
+ price: '$3'
17
+ }, {
18
+ id: 'b',
19
+ name: 'Beta',
20
+ price: '$1'
21
+ }];
22
+ const COLS = [{
23
+ key: 'name',
24
+ header: 'Name'
25
+ }, {
26
+ key: 'price',
27
+ header: 'Price'
28
+ }];
29
+ const TABS = [{
30
+ value: 'menu',
31
+ label: 'Menu items'
32
+ }, {
33
+ value: 'cats',
34
+ label: 'Categories'
35
+ }];
36
+ const desktop = {
37
+ mobileBreakpoint: 0
38
+ };
39
+ describe('DataTable', () => {
40
+ it('renders tabs, search, create and the table', () => {
41
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_DataTable.DataTable, {
42
+ ...desktop,
43
+ tabs: TABS,
44
+ searchable: true,
45
+ createLabel: "Create new item",
46
+ columns: COLS,
47
+ data: DATA,
48
+ keyExtractor: r => r.id
49
+ }));
50
+ expect(_reactNative.screen.getByText('Menu items')).toBeTruthy();
51
+ expect(_reactNative.screen.getByText('Create new item')).toBeTruthy();
52
+ expect(_reactNative.screen.getByText('Alpha')).toBeTruthy();
53
+ });
54
+ it('changes tab on press', () => {
55
+ const onTabChange = jest.fn();
56
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_DataTable.DataTable, {
57
+ ...desktop,
58
+ tabs: TABS,
59
+ activeTab: "menu",
60
+ onTabChange: onTabChange,
61
+ columns: COLS,
62
+ data: DATA,
63
+ keyExtractor: r => r.id
64
+ }));
65
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Categories'));
66
+ expect(onTabChange).toHaveBeenCalledWith('cats');
67
+ });
68
+ it('emits search text', () => {
69
+ const onSearchChange = jest.fn();
70
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_DataTable.DataTable, {
71
+ ...desktop,
72
+ searchable: true,
73
+ searchValue: "",
74
+ onSearchChange: onSearchChange,
75
+ columns: COLS,
76
+ data: DATA,
77
+ keyExtractor: r => r.id,
78
+ searchPlaceholder: "Search\u2026"
79
+ }));
80
+ _reactNative.fireEvent.changeText(_reactNative.screen.getByPlaceholderText('Search…'), 'alp');
81
+ expect(onSearchChange).toHaveBeenCalledWith('alp');
82
+ });
83
+ it('fires create', () => {
84
+ const onCreate = jest.fn();
85
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_DataTable.DataTable, {
86
+ ...desktop,
87
+ createLabel: "Create",
88
+ onCreate: onCreate,
89
+ columns: COLS,
90
+ data: DATA,
91
+ keyExtractor: r => r.id
92
+ }));
93
+ _reactNative.fireEvent.press(_reactNative.screen.getByText('Create'));
94
+ expect(onCreate).toHaveBeenCalledTimes(1);
95
+ });
96
+ it('shows the structured empty state when there is no data', () => {
97
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(_DataTable.DataTable, {
98
+ ...desktop,
99
+ columns: COLS,
100
+ data: [],
101
+ keyExtractor: r => r.id,
102
+ emptyState: {
103
+ title: 'No items yet',
104
+ action: {
105
+ label: 'Create item',
106
+ onPress: () => {}
107
+ }
108
+ }
109
+ }));
110
+ expect(_reactNative.screen.getByText('No items yet')).toBeTruthy();
111
+ expect(_reactNative.screen.getByText('Create item')).toBeTruthy();
112
+ });
113
+ it('paginates', () => {
114
+ function Paged() {
115
+ const [page, setPage] = (0, _react.useState)(1);
116
+ const all = Array.from({
117
+ length: 5
118
+ }).map((_, i) => ({
119
+ id: String(i),
120
+ name: `N${i}`,
121
+ price: '$1'
122
+ }));
123
+ const data = all.slice((page - 1) * 2, page * 2);
124
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DataTable.DataTable, {
125
+ ...desktop,
126
+ columns: COLS,
127
+ data: data,
128
+ keyExtractor: r => r.id,
129
+ pagination: {
130
+ page,
131
+ pageSize: 2,
132
+ total: all.length,
133
+ onPageChange: setPage
134
+ }
135
+ });
136
+ }
137
+ wrap(/*#__PURE__*/(0, _jsxRuntime.jsx)(Paged, {}));
138
+ expect(_reactNative.screen.getByText('1–2 of 5')).toBeTruthy();
139
+ _reactNative.fireEvent.press(_reactNative.screen.getByLabelText('Next page'));
140
+ expect(_reactNative.screen.getByText('3–4 of 5')).toBeTruthy();
141
+ });
142
+ });
143
+ //# sourceMappingURL=DataTable.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_index","_DataTable","_jsxRuntime","wrap","ui","render","jsx","ThemeProvider","children","DATA","id","name","price","COLS","key","header","TABS","value","label","desktop","mobileBreakpoint","describe","it","DataTable","tabs","searchable","createLabel","columns","data","keyExtractor","r","expect","screen","getByText","toBeTruthy","onTabChange","jest","fn","activeTab","fireEvent","press","toHaveBeenCalledWith","onSearchChange","searchValue","searchPlaceholder","changeText","getByPlaceholderText","onCreate","toHaveBeenCalledTimes","emptyState","title","action","onPress","Paged","page","setPage","useState","all","Array","from","length","map","_","i","String","slice","pagination","pageSize","total","onPageChange","getByLabelText"],"sourceRoot":"..\\..\\..\\..\\src","sources":["components/Table/DataTable.test.tsx"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA2D,IAAAI,WAAA,GAAAJ,OAAA;AAG3D,SAASK,IAAIA,CAACC,EAAsB,EAAE;EACpC,OAAO,IAAAC,mBAAM,eAAC,IAAAH,WAAA,CAAAI,GAAA,EAACN,MAAA,CAAAO,aAAa;IAAAC,QAAA,EAAEJ;EAAE,CAAgB,CAAC,CAAC;AACpD;AAOA,MAAMK,IAAW,GAAG,CAClB;EAAEC,EAAE,EAAE,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AAEC,CAAC,MAAM;QAAErD,EAAE,EAAEsD,MAAM,CAACD,CAAC,CAAC;QAAEpD,IAAI,EAAE,IAAIoD,CAAC,EAAE;QAAEnD,KAAK,EAAE;MAAK,CAAC,CAAC,CAAC;MACpG,MAAMgB,IAAI,GAAG6B,GAAG,CAACQ,KAAK,CAAC,CAACX,IAAI,GAAG,CAAC,IAAI,CAAC,EAAEA,IAAI,GAAG,CAAC,CAAC;MAChD,oBACE,IAAApD,WAAA,CAAAI,GAAA,EAACL,UAAA,CAAAsB,SAAS;QAAA,GACJJ,OAAO;QACXQ,OAAO,EAAEd,IAAK;QACde,IAAI,EAAEA,IAAK;QACXC,YAAY,EAAGC,CAAC,IAAKA,CAAC,CAACpB,EAAG;QAC1BwD,UAAU,EAAE;UAAEZ,IAAI;UAAEa,QAAQ,EAAE,CAAC;UAAEC,KAAK,EAAEX,GAAG,CAACG,MAAM;UAAES,YAAY,EAAEd;QAAQ;MAAE,CAC7E,CAAC;IAEN;IACApD,IAAI,cAAC,IAAAD,WAAA,CAAAI,GAAA,EAAC+C,KAAK,IAAE,CAAC,CAAC;IACftB,MAAM,CAACC,mBAAM,CAACC,SAAS,CAAC,UAAU,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;IACjDK,sBAAS,CAACC,KAAK,CAACR,mBAAM,CAACsC,cAAc,CAAC,WAAW,CAAC,CAAC;IACnDvC,MAAM,CAACC,mBAAM,CAACC,SAAS,CAAC,UAAU,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;EACnD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,520 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Table = Table;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _index = require("../../theme/index.js");
10
+ var _Checkbox = require("../Checkbox/Checkbox.js");
11
+ var _Icon = require("../Icon/Icon.js");
12
+ var _Spinner = require("../Spinner/Spinner.js");
13
+ var _Text = require("../Text/Text.js");
14
+ var _ScrollArea = require("../_internal/ScrollArea.js");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ const ROW_HEIGHT = 72;
17
+ const PADDING = 24;
18
+ const CELL_GAP = 8;
19
+ const SEL_WIDTH = 24;
20
+ const CHEVRON_WIDTH = 24;
21
+ function alignToJustify(a) {
22
+ return a === 'center' ? 'center' : a === 'right' ? 'flex-end' : 'flex-start';
23
+ }
24
+ function alignToText(a) {
25
+ return a === 'center' ? 'center' : a === 'right' ? 'right' : 'left';
26
+ }
27
+
28
+ /**
29
+ * Table — a flexible, token-driven data table (Figma "Table"). Columns define
30
+ * width/flex, alignment and cell renderers (text, `Badge`, anything). Supports
31
+ * sortable headers, checkbox selection, and accordion rows (expand on row press)
32
+ * OR a trailing actions column (the two are mutually exclusive). A sticky header
33
+ * with an elegant scrolling body (`maxHeight`), loading and empty states, and a
34
+ * card fallback below `mobileBreakpoint`.
35
+ */
36
+ function Table({
37
+ columns,
38
+ data,
39
+ keyExtractor,
40
+ onRowPress,
41
+ expandable = false,
42
+ renderExpanded,
43
+ expansionMode = 'single',
44
+ expandedKeys,
45
+ defaultExpandedKeys,
46
+ onExpandedChange,
47
+ renderActions,
48
+ actionsWidth = 96,
49
+ selectable = false,
50
+ selectedKeys,
51
+ defaultSelectedKeys,
52
+ onSelectionChange,
53
+ sort,
54
+ defaultSort,
55
+ onSortChange,
56
+ rounded = true,
57
+ maxHeight,
58
+ scrollbarColor,
59
+ loading = false,
60
+ loadingVariant = 'spinner',
61
+ loadingText = 'Loading data',
62
+ skeletonRows = 5,
63
+ empty,
64
+ mobileBreakpoint = 640,
65
+ style
66
+ }) {
67
+ const theme = (0, _index.useTheme)();
68
+ const {
69
+ width: screenWidth
70
+ } = (0, _reactNative.useWindowDimensions)();
71
+ const isMobile = screenWidth < mobileBreakpoint;
72
+
73
+ // Expandable and actions are mutually exclusive; expandable wins if both set.
74
+ const hasActions = !expandable && !!renderActions;
75
+ const trailingWidth = expandable ? CHEVRON_WIDTH : hasActions ? actionsWidth : 0;
76
+
77
+ // ---- sort ----
78
+ const sortControlled = sort !== undefined;
79
+ const [sortInternal, setSortInternal] = (0, _react.useState)(defaultSort);
80
+ const activeSort = sortControlled ? sort : sortInternal;
81
+ const setSort = next => {
82
+ if (!sortControlled) setSortInternal(next);
83
+ onSortChange?.(next);
84
+ };
85
+ const onHeaderPress = col => {
86
+ if (!col.sortable) return;
87
+ const direction = activeSort?.key === col.key && activeSort.direction === 'asc' ? 'desc' : 'asc';
88
+ setSort({
89
+ key: col.key,
90
+ direction
91
+ });
92
+ };
93
+ const sortedData = (0, _react.useMemo)(() => {
94
+ if (sortControlled || !activeSort) return data; // controlled → consumer sorts
95
+ const col = columns.find(c => c.key === activeSort.key);
96
+ if (!col?.sortAccessor) return data;
97
+ const accessor = col.sortAccessor;
98
+ const arr = [...data].sort((a, b) => {
99
+ const av = accessor(a);
100
+ const bv = accessor(b);
101
+ if (av < bv) return -1;
102
+ if (av > bv) return 1;
103
+ return 0;
104
+ });
105
+ return activeSort.direction === 'asc' ? arr : arr.reverse();
106
+ }, [data, activeSort, sortControlled, columns]);
107
+
108
+ // ---- selection ----
109
+ const selControlled = selectedKeys !== undefined;
110
+ const [selInternal, setSelInternal] = (0, _react.useState)(defaultSelectedKeys ?? []);
111
+ const selected = selControlled ? selectedKeys : selInternal;
112
+ const setSelected = keys => {
113
+ if (!selControlled) setSelInternal(keys);
114
+ onSelectionChange?.(keys);
115
+ };
116
+ const allKeys = sortedData.map((r, i) => keyExtractor(r, i));
117
+ const allSelected = allKeys.length > 0 && allKeys.every(k => selected.includes(k));
118
+ const someSelected = !allSelected && allKeys.some(k => selected.includes(k));
119
+ const toggleRowSel = k => setSelected(selected.includes(k) ? selected.filter(x => x !== k) : [...selected, k]);
120
+ const toggleAllSel = () => setSelected(allSelected ? [] : allKeys);
121
+
122
+ // ---- expansion ----
123
+ const expControlled = expandedKeys !== undefined;
124
+ const [expInternal, setExpInternal] = (0, _react.useState)(defaultExpandedKeys ?? []);
125
+ const expanded = expControlled ? expandedKeys : expInternal;
126
+ const setExpanded = keys => {
127
+ if (!expControlled) setExpInternal(keys);
128
+ onExpandedChange?.(keys);
129
+ };
130
+ const toggleExpand = k => {
131
+ const isOpen = expanded.includes(k);
132
+ if (expansionMode === 'single') setExpanded(isOpen ? [] : [k]);else setExpanded(isOpen ? expanded.filter(x => x !== k) : [...expanded, k]);
133
+ };
134
+ const cellStyle = col => ({
135
+ ...(col.width != null ? {
136
+ width: col.width
137
+ } : {
138
+ flex: col.flex ?? 1
139
+ }),
140
+ minWidth: 0,
141
+ flexDirection: 'row',
142
+ alignItems: 'center',
143
+ justifyContent: alignToJustify(col.align)
144
+ });
145
+ const renderCellContent = (col, row, index) => {
146
+ const content = col.render ? col.render(row, index) : row[col.key];
147
+ if (content == null || typeof content === 'string' || typeof content === 'number') {
148
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
149
+ variant: "bodyMedium",
150
+ color: theme.colors.action.secondaryForeground,
151
+ numberOfLines: 1,
152
+ style: {
153
+ flexShrink: 1,
154
+ textAlign: alignToText(col.align)
155
+ },
156
+ children: content == null ? '' : String(content)
157
+ });
158
+ }
159
+ return content;
160
+ };
161
+
162
+ // ---------- Desktop ----------
163
+ const header = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
164
+ style: {
165
+ flexDirection: 'row',
166
+ alignItems: 'center',
167
+ gap: CELL_GAP,
168
+ paddingHorizontal: PADDING,
169
+ paddingVertical: 16,
170
+ backgroundColor: theme.colors.background.muted,
171
+ ...(rounded ? {
172
+ borderTopLeftRadius: theme.radii.lg,
173
+ borderTopRightRadius: theme.radii.lg
174
+ } : null)
175
+ },
176
+ children: [selectable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
177
+ style: {
178
+ width: SEL_WIDTH,
179
+ flexShrink: 0
180
+ },
181
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
182
+ checked: allSelected,
183
+ indeterminate: someSelected,
184
+ onChange: toggleAllSel
185
+ })
186
+ }) : null, columns.map(col => {
187
+ const isSorted = activeSort?.key === col.key;
188
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
189
+ disabled: !col.sortable,
190
+ onPress: () => onHeaderPress(col),
191
+ style: [cellStyle(col), {
192
+ gap: 4
193
+ }],
194
+ children: [typeof col.header === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
195
+ variant: "bodyMedium",
196
+ weight: "medium",
197
+ color: "secondary",
198
+ numberOfLines: 1,
199
+ style: {
200
+ flexShrink: 1,
201
+ textAlign: alignToText(col.align)
202
+ },
203
+ children: col.header
204
+ }) : col.header, col.sortable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
205
+ style: {
206
+ transform: [{
207
+ rotate: isSorted && activeSort?.direction === 'asc' ? '180deg' : '0deg'
208
+ }]
209
+ },
210
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
211
+ name: "chevron-down",
212
+ size: 16,
213
+ color: isSorted ? 'secondary' : 'tertiary'
214
+ })
215
+ }) : null]
216
+ }, col.key);
217
+ }), trailingWidth > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
218
+ style: {
219
+ width: trailingWidth,
220
+ flexShrink: 0
221
+ }
222
+ }) : null]
223
+ });
224
+ const renderDesktopRow = (row, index) => {
225
+ const k = keyExtractor(row, index);
226
+ const isOpen = expanded.includes(k);
227
+ const rowPressable = expandable || !!onRowPress;
228
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
229
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
230
+ onPress: rowPressable ? () => expandable ? toggleExpand(k) : onRowPress?.(row, index) : undefined,
231
+ disabled: !rowPressable,
232
+ style: ({
233
+ pressed
234
+ }) => ({
235
+ flexDirection: 'row',
236
+ alignItems: 'center',
237
+ gap: CELL_GAP,
238
+ minHeight: ROW_HEIGHT,
239
+ paddingHorizontal: PADDING,
240
+ paddingVertical: 12,
241
+ backgroundColor: pressed && rowPressable ? theme.colors.background.subtle : theme.colors.background.default,
242
+ borderBottomWidth: 1,
243
+ borderBottomColor: theme.colors.border.subtle
244
+ }),
245
+ children: [selectable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
246
+ style: {
247
+ width: SEL_WIDTH,
248
+ flexShrink: 0
249
+ },
250
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
251
+ checked: selected.includes(k),
252
+ onChange: () => toggleRowSel(k)
253
+ })
254
+ }) : null, columns.map(col => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
255
+ style: cellStyle(col),
256
+ children: renderCellContent(col, row, index)
257
+ }, col.key)), expandable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
258
+ style: {
259
+ width: CHEVRON_WIDTH,
260
+ flexShrink: 0,
261
+ transform: [{
262
+ rotate: isOpen ? '180deg' : '0deg'
263
+ }]
264
+ },
265
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
266
+ name: "chevron-down",
267
+ size: 24,
268
+ color: "secondary"
269
+ })
270
+ }) : hasActions ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
271
+ style: {
272
+ width: actionsWidth,
273
+ flexShrink: 0,
274
+ flexDirection: 'row',
275
+ justifyContent: 'flex-end',
276
+ gap: 4
277
+ },
278
+ children: renderActions(row, index)
279
+ }) : null]
280
+ }), expandable && isOpen && renderExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
281
+ style: {
282
+ paddingHorizontal: PADDING,
283
+ paddingVertical: 16,
284
+ backgroundColor: theme.colors.background.subtle,
285
+ borderBottomWidth: 1,
286
+ borderBottomColor: theme.colors.border.subtle
287
+ },
288
+ children: renderExpanded(row, index)
289
+ }) : null]
290
+ }, k);
291
+ };
292
+
293
+ // ---------- Mobile (cards) ----------
294
+ const renderMobileCard = (row, index) => {
295
+ const k = keyExtractor(row, index);
296
+ const isOpen = expanded.includes(k);
297
+ const rowPressable = expandable || !!onRowPress;
298
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
299
+ style: {
300
+ borderWidth: 1,
301
+ borderColor: theme.colors.border.default,
302
+ borderRadius: theme.radii.lg,
303
+ backgroundColor: theme.colors.background.default,
304
+ overflow: 'hidden'
305
+ },
306
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Pressable, {
307
+ onPress: rowPressable ? () => expandable ? toggleExpand(k) : onRowPress?.(row, index) : undefined,
308
+ disabled: !rowPressable,
309
+ style: {
310
+ padding: 16,
311
+ gap: 10
312
+ },
313
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
314
+ style: {
315
+ flexDirection: 'row',
316
+ alignItems: 'center',
317
+ gap: 12
318
+ },
319
+ children: [selectable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.Checkbox, {
320
+ checked: selected.includes(k),
321
+ onChange: () => toggleRowSel(k)
322
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
323
+ style: {
324
+ flex: 1,
325
+ gap: 8
326
+ },
327
+ children: columns.map(col => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
328
+ style: {
329
+ flexDirection: 'row',
330
+ alignItems: 'center',
331
+ justifyContent: 'space-between',
332
+ gap: 12
333
+ },
334
+ children: [typeof col.header === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
335
+ variant: "bodySmall",
336
+ color: "tertiary",
337
+ numberOfLines: 1,
338
+ children: col.header
339
+ }) : col.header, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
340
+ style: {
341
+ flexShrink: 1,
342
+ alignItems: 'flex-end'
343
+ },
344
+ children: renderCellContent(col, row, index)
345
+ })]
346
+ }, col.key))
347
+ }), expandable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
348
+ style: {
349
+ transform: [{
350
+ rotate: isOpen ? '180deg' : '0deg'
351
+ }]
352
+ },
353
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon.Icon, {
354
+ name: "chevron-down",
355
+ size: 24,
356
+ color: "secondary"
357
+ })
358
+ }) : null]
359
+ }), hasActions ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
360
+ style: {
361
+ flexDirection: 'row',
362
+ justifyContent: 'flex-end',
363
+ gap: 4
364
+ },
365
+ children: renderActions(row, index)
366
+ }) : null]
367
+ }), expandable && isOpen && renderExpanded ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
368
+ style: {
369
+ padding: 16,
370
+ paddingTop: 0
371
+ },
372
+ children: renderExpanded(row, index)
373
+ }) : null]
374
+ }, k);
375
+ };
376
+
377
+ // ---------- Loading ----------
378
+ const pulse = (0, _react.useRef)(new _reactNative.Animated.Value(0)).current;
379
+ (0, _react.useEffect)(() => {
380
+ if (!loading || loadingVariant !== 'skeleton') return;
381
+ const loop = _reactNative.Animated.loop(_reactNative.Animated.sequence([_reactNative.Animated.timing(pulse, {
382
+ toValue: 1,
383
+ duration: 700,
384
+ easing: _reactNative.Easing.inOut(_reactNative.Easing.ease),
385
+ useNativeDriver: _reactNative.Platform.OS !== 'web'
386
+ }), _reactNative.Animated.timing(pulse, {
387
+ toValue: 0,
388
+ duration: 700,
389
+ easing: _reactNative.Easing.inOut(_reactNative.Easing.ease),
390
+ useNativeDriver: _reactNative.Platform.OS !== 'web'
391
+ })]));
392
+ loop.start();
393
+ return () => loop.stop();
394
+ }, [loading, loadingVariant, pulse]);
395
+ const barOpacity = pulse.interpolate({
396
+ inputRange: [0, 1],
397
+ outputRange: [0.45, 0.9]
398
+ });
399
+ const bar = style => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, {
400
+ style: [{
401
+ height: 16,
402
+ borderRadius: 8,
403
+ backgroundColor: theme.colors.background.muted,
404
+ opacity: barOpacity
405
+ }, style]
406
+ });
407
+ const renderSkeleton = () => isMobile ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
408
+ style: {
409
+ gap: 12
410
+ },
411
+ children: Array.from({
412
+ length: skeletonRows
413
+ }).map((_, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
414
+ style: {
415
+ borderWidth: 1,
416
+ borderColor: theme.colors.border.default,
417
+ borderRadius: theme.radii.lg,
418
+ padding: 16,
419
+ gap: 10
420
+ },
421
+ children: columns.map(col => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
422
+ style: {
423
+ flexDirection: 'row',
424
+ justifyContent: 'space-between',
425
+ gap: 12
426
+ },
427
+ children: [bar({
428
+ width: 72
429
+ }), bar({
430
+ width: 96
431
+ })]
432
+ }, col.key))
433
+ }, i))
434
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
435
+ children: Array.from({
436
+ length: skeletonRows
437
+ }).map((_, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
438
+ style: {
439
+ flexDirection: 'row',
440
+ alignItems: 'center',
441
+ gap: CELL_GAP,
442
+ minHeight: 64,
443
+ paddingHorizontal: PADDING,
444
+ borderBottomWidth: 1,
445
+ borderBottomColor: theme.colors.border.subtle
446
+ },
447
+ children: [selectable ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
448
+ style: {
449
+ width: SEL_WIDTH,
450
+ flexShrink: 0
451
+ },
452
+ children: bar({
453
+ width: 20,
454
+ height: 20,
455
+ borderRadius: 6
456
+ })
457
+ }) : null, columns.map(col => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
458
+ style: cellStyle(col),
459
+ children: bar({
460
+ width: '70%',
461
+ maxWidth: 180
462
+ })
463
+ }, col.key)), trailingWidth > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
464
+ style: {
465
+ width: trailingWidth,
466
+ flexShrink: 0
467
+ }
468
+ }) : null]
469
+ }, i))
470
+ });
471
+ const renderSpinner = () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
472
+ style: {
473
+ paddingVertical: 48,
474
+ alignItems: 'center',
475
+ gap: 12
476
+ },
477
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Spinner.Spinner, {}), loadingText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Text.Text, {
478
+ variant: "bodyMedium",
479
+ color: "secondary",
480
+ children: loadingText
481
+ }) : null]
482
+ });
483
+
484
+ // ---------- Body ----------
485
+ const bodyContent = loading ? loadingVariant === 'skeleton' ? renderSkeleton() : renderSpinner() : sortedData.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
486
+ children: empty ?? null
487
+ }) : isMobile ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
488
+ style: {
489
+ gap: 12
490
+ },
491
+ children: sortedData.map(renderMobileCard)
492
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
493
+ children: sortedData.map(renderDesktopRow)
494
+ });
495
+ const body = maxHeight != null ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScrollArea.ScrollArea, {
496
+ style: {
497
+ maxHeight
498
+ },
499
+ indicatorColor: scrollbarColor ?? theme.colors.border.strong,
500
+ children: bodyContent
501
+ }) : bodyContent;
502
+ if (isMobile) {
503
+ // Cards don't use the table header; labels live inside each card.
504
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
505
+ style: [{
506
+ gap: 12
507
+ }, style],
508
+ children: body
509
+ });
510
+ }
511
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
512
+ style: [{
513
+ borderRadius: rounded ? theme.radii.lg : 0,
514
+ overflow: 'hidden',
515
+ backgroundColor: theme.colors.background.default
516
+ }, style],
517
+ children: [header, body]
518
+ });
519
+ }
520
+ //# sourceMappingURL=Table.js.map