@nori-ui/core 1.4.0 → 1.6.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 (176) hide show
  1. package/dist/Table.shared-BymRgTnY.d.cts +54 -0
  2. package/dist/Table.shared-BymRgTnY.d.ts +54 -0
  3. package/dist/{chunk-HZKXPN6B.js → chunk-2HMQDJ22.js} +4 -4
  4. package/dist/{chunk-HZKXPN6B.js.map → chunk-2HMQDJ22.js.map} +1 -1
  5. package/dist/{chunk-KCLWPSV5.js → chunk-2RL6WCFC.js} +4 -4
  6. package/dist/{chunk-KCLWPSV5.js.map → chunk-2RL6WCFC.js.map} +1 -1
  7. package/dist/{chunk-FDBQOQMW.js → chunk-3BDDPFCI.js} +3 -3
  8. package/dist/{chunk-FDBQOQMW.js.map → chunk-3BDDPFCI.js.map} +1 -1
  9. package/dist/{chunk-WOF67PKT.js → chunk-3CEJ5TB4.js} +3 -3
  10. package/dist/{chunk-WOF67PKT.js.map → chunk-3CEJ5TB4.js.map} +1 -1
  11. package/dist/{chunk-BNDUQNG7.js → chunk-3OIWAS2P.js} +3 -3
  12. package/dist/{chunk-BNDUQNG7.js.map → chunk-3OIWAS2P.js.map} +1 -1
  13. package/dist/{chunk-6JVUVBZH.js → chunk-4PUPKWEP.js} +5 -5
  14. package/dist/{chunk-6JVUVBZH.js.map → chunk-4PUPKWEP.js.map} +1 -1
  15. package/dist/{chunk-6PO2IWB3.js → chunk-4UFAZLSZ.js} +5 -3
  16. package/dist/chunk-4UFAZLSZ.js.map +1 -0
  17. package/dist/{chunk-V2AWSDDZ.js → chunk-5PSC5HT4.js} +8 -125
  18. package/dist/chunk-5PSC5HT4.js.map +1 -0
  19. package/dist/{chunk-LWQZ257T.js → chunk-5XEGZFG5.js} +3 -3
  20. package/dist/{chunk-LWQZ257T.js.map → chunk-5XEGZFG5.js.map} +1 -1
  21. package/dist/{chunk-WAKKQROH.js → chunk-6AD6KCVB.js} +3 -3
  22. package/dist/{chunk-WAKKQROH.js.map → chunk-6AD6KCVB.js.map} +1 -1
  23. package/dist/chunk-73CUV7MW.js +125 -0
  24. package/dist/chunk-73CUV7MW.js.map +1 -0
  25. package/dist/{chunk-GRDVE3IR.js → chunk-BZLT6R62.js} +3 -3
  26. package/dist/{chunk-GRDVE3IR.js.map → chunk-BZLT6R62.js.map} +1 -1
  27. package/dist/{chunk-Y4ZRSW35.js → chunk-CCUXO2HN.js} +3 -3
  28. package/dist/{chunk-Y4ZRSW35.js.map → chunk-CCUXO2HN.js.map} +1 -1
  29. package/dist/{chunk-2UXKXUX2.js → chunk-CPIKN4BX.js} +3 -3
  30. package/dist/{chunk-2UXKXUX2.js.map → chunk-CPIKN4BX.js.map} +1 -1
  31. package/dist/{chunk-46OT4PA6.js → chunk-DDGMLLS3.js} +3 -3
  32. package/dist/{chunk-46OT4PA6.js.map → chunk-DDGMLLS3.js.map} +1 -1
  33. package/dist/{chunk-XP55RZ3D.js → chunk-FEPTH5RV.js} +3 -3
  34. package/dist/{chunk-XP55RZ3D.js.map → chunk-FEPTH5RV.js.map} +1 -1
  35. package/dist/{chunk-MJ4AGXS7.js → chunk-GJMHNEQ3.js} +3 -3
  36. package/dist/{chunk-MJ4AGXS7.js.map → chunk-GJMHNEQ3.js.map} +1 -1
  37. package/dist/{chunk-VCJF75T2.js → chunk-JQQ3FBN7.js} +3 -3
  38. package/dist/{chunk-VCJF75T2.js.map → chunk-JQQ3FBN7.js.map} +1 -1
  39. package/dist/chunk-JXLEMBDB.js +11 -0
  40. package/dist/chunk-JXLEMBDB.js.map +1 -0
  41. package/dist/{chunk-W3HMOOON.js → chunk-JZ774T7U.js} +3 -3
  42. package/dist/{chunk-W3HMOOON.js.map → chunk-JZ774T7U.js.map} +1 -1
  43. package/dist/{chunk-SINLREQV.js → chunk-MKSDYRWQ.js} +3 -3
  44. package/dist/{chunk-SINLREQV.js.map → chunk-MKSDYRWQ.js.map} +1 -1
  45. package/dist/{chunk-AFQIK6JI.js → chunk-MRJWPRCX.js} +3 -3
  46. package/dist/{chunk-AFQIK6JI.js.map → chunk-MRJWPRCX.js.map} +1 -1
  47. package/dist/{chunk-EFK7726V.js → chunk-NF7XG2FG.js} +3 -3
  48. package/dist/{chunk-EFK7726V.js.map → chunk-NF7XG2FG.js.map} +1 -1
  49. package/dist/{chunk-WTNDPO2V.js → chunk-NNFJKRXZ.js} +3 -3
  50. package/dist/{chunk-WTNDPO2V.js.map → chunk-NNFJKRXZ.js.map} +1 -1
  51. package/dist/{chunk-CGQIVFCN.js → chunk-NRYWNOG5.js} +3 -3
  52. package/dist/{chunk-CGQIVFCN.js.map → chunk-NRYWNOG5.js.map} +1 -1
  53. package/dist/{chunk-HTF6FDB6.js → chunk-OMU4R4Y5.js} +3 -3
  54. package/dist/{chunk-HTF6FDB6.js.map → chunk-OMU4R4Y5.js.map} +1 -1
  55. package/dist/{chunk-C6TRLHMW.js → chunk-PABG3IJ6.js} +3 -3
  56. package/dist/{chunk-C6TRLHMW.js.map → chunk-PABG3IJ6.js.map} +1 -1
  57. package/dist/{chunk-RM5TSXVE.js → chunk-PNP7L4TA.js} +3 -3
  58. package/dist/{chunk-RM5TSXVE.js.map → chunk-PNP7L4TA.js.map} +1 -1
  59. package/dist/{chunk-L5X4SYJ4.js → chunk-PZS4A4VQ.js} +3 -3
  60. package/dist/{chunk-L5X4SYJ4.js.map → chunk-PZS4A4VQ.js.map} +1 -1
  61. package/dist/{chunk-4I37QSEM.js → chunk-QJVS2VXS.js} +5 -5
  62. package/dist/{chunk-4I37QSEM.js.map → chunk-QJVS2VXS.js.map} +1 -1
  63. package/dist/{chunk-H7MFAFV4.js → chunk-RUWD35UI.js} +4 -4
  64. package/dist/{chunk-H7MFAFV4.js.map → chunk-RUWD35UI.js.map} +1 -1
  65. package/dist/{chunk-5BM6H2CD.js → chunk-SFNDR6DI.js} +3 -3
  66. package/dist/{chunk-5BM6H2CD.js.map → chunk-SFNDR6DI.js.map} +1 -1
  67. package/dist/{chunk-UF5OENHV.js → chunk-TLS54G6Y.js} +3 -3
  68. package/dist/{chunk-UF5OENHV.js.map → chunk-TLS54G6Y.js.map} +1 -1
  69. package/dist/{chunk-UUXWRDWW.js → chunk-UJWCEGQY.js} +3 -3
  70. package/dist/{chunk-UUXWRDWW.js.map → chunk-UJWCEGQY.js.map} +1 -1
  71. package/dist/{chunk-UJ5KFRDE.js → chunk-UZD77M3J.js} +3 -3
  72. package/dist/{chunk-UJ5KFRDE.js.map → chunk-UZD77M3J.js.map} +1 -1
  73. package/dist/chunk-VP7DRJUZ.js +3 -0
  74. package/dist/chunk-VP7DRJUZ.js.map +1 -0
  75. package/dist/{chunk-UPVNZPFV.js → chunk-VYRJ7OE5.js} +3 -3
  76. package/dist/{chunk-UPVNZPFV.js.map → chunk-VYRJ7OE5.js.map} +1 -1
  77. package/dist/{chunk-IGLMPAWE.js → chunk-WGT345SV.js} +3 -3
  78. package/dist/{chunk-IGLMPAWE.js.map → chunk-WGT345SV.js.map} +1 -1
  79. package/dist/{chunk-XXBN6CIK.js → chunk-WP2Z2ATO.js} +5 -5
  80. package/dist/{chunk-XXBN6CIK.js.map → chunk-WP2Z2ATO.js.map} +1 -1
  81. package/dist/chunk-WYPGQVDV.js +145 -0
  82. package/dist/chunk-WYPGQVDV.js.map +1 -0
  83. package/dist/{chunk-GELLSU64.js → chunk-XALU6LOT.js} +3 -3
  84. package/dist/{chunk-GELLSU64.js.map → chunk-XALU6LOT.js.map} +1 -1
  85. package/dist/{chunk-VMAGFYHG.js → chunk-Y5TJ7CAX.js} +3 -3
  86. package/dist/{chunk-VMAGFYHG.js.map → chunk-Y5TJ7CAX.js.map} +1 -1
  87. package/dist/chunk-YZ27OS2R.js +202 -0
  88. package/dist/chunk-YZ27OS2R.js.map +1 -0
  89. package/dist/client.cjs +453 -119
  90. package/dist/client.cjs.map +1 -1
  91. package/dist/client.d.cts +4 -0
  92. package/dist/client.d.ts +4 -0
  93. package/dist/client.js +50 -45
  94. package/dist/client.js.map +1 -1
  95. package/dist/components/Accordion/index.js +2 -2
  96. package/dist/components/Alert/index.js +2 -2
  97. package/dist/components/AlertDialog/index.js +2 -2
  98. package/dist/components/Avatar/index.js +2 -2
  99. package/dist/components/Badge/index.js +2 -2
  100. package/dist/components/Box/index.js +4 -4
  101. package/dist/components/Breadcrumb/index.cjs +3 -1
  102. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  103. package/dist/components/Breadcrumb/index.js +5 -5
  104. package/dist/components/Button/index.js +2 -2
  105. package/dist/components/Calendar/index.cjs +3 -1
  106. package/dist/components/Calendar/index.cjs.map +1 -1
  107. package/dist/components/Calendar/index.js +5 -5
  108. package/dist/components/Card/index.js +2 -2
  109. package/dist/components/Checkbox/index.js +2 -2
  110. package/dist/components/Combobox/index.cjs +1374 -0
  111. package/dist/components/Combobox/index.cjs.map +1 -0
  112. package/dist/components/Combobox/index.d.cts +17 -0
  113. package/dist/components/Combobox/index.d.ts +17 -0
  114. package/dist/components/Combobox/index.js +9 -0
  115. package/dist/components/Combobox/index.js.map +1 -0
  116. package/dist/components/ContextMenu/index.js +4 -4
  117. package/dist/components/DataTable/index.cjs +770 -0
  118. package/dist/components/DataTable/index.cjs.map +1 -0
  119. package/dist/components/DataTable/index.d.cts +53 -0
  120. package/dist/components/DataTable/index.d.ts +53 -0
  121. package/dist/components/DataTable/index.js +8 -0
  122. package/dist/components/DataTable/index.js.map +1 -0
  123. package/dist/components/DatePicker/index.cjs +3 -1
  124. package/dist/components/DatePicker/index.cjs.map +1 -1
  125. package/dist/components/DatePicker/index.js +7 -7
  126. package/dist/components/Dialog/index.js +2 -2
  127. package/dist/components/DropdownMenu/index.js +3 -3
  128. package/dist/components/Field/index.cjs +3 -1
  129. package/dist/components/Field/index.cjs.map +1 -1
  130. package/dist/components/Field/index.d.cts +2 -2
  131. package/dist/components/Field/index.d.ts +2 -2
  132. package/dist/components/Field/index.js +3 -3
  133. package/dist/components/FloatButton/index.cjs +3 -1
  134. package/dist/components/FloatButton/index.cjs.map +1 -1
  135. package/dist/components/FloatButton/index.js +5 -5
  136. package/dist/components/HStack/index.js +4 -4
  137. package/dist/components/InputGroup/index.js +2 -2
  138. package/dist/components/Label/index.cjs +3 -1
  139. package/dist/components/Label/index.cjs.map +1 -1
  140. package/dist/components/Label/index.js +3 -3
  141. package/dist/components/Pagination/index.cjs +3 -1
  142. package/dist/components/Pagination/index.cjs.map +1 -1
  143. package/dist/components/Pagination/index.js +6 -5
  144. package/dist/components/Popover/index.js +2 -2
  145. package/dist/components/Progress/index.js +2 -2
  146. package/dist/components/Radio/index.js +2 -2
  147. package/dist/components/SegmentedControl/index.js +2 -2
  148. package/dist/components/Select/index.js +2 -2
  149. package/dist/components/Sheet/index.js +2 -2
  150. package/dist/components/Switch/index.js +2 -2
  151. package/dist/components/Table/index.cjs +461 -0
  152. package/dist/components/Table/index.cjs.map +1 -0
  153. package/dist/components/Table/index.d.cts +16 -0
  154. package/dist/components/Table/index.d.ts +16 -0
  155. package/dist/components/Table/index.js +7 -0
  156. package/dist/components/Table/index.js.map +1 -0
  157. package/dist/components/Tabs/index.js +2 -2
  158. package/dist/components/Text/index.js +2 -2
  159. package/dist/components/TextArea/index.js +3 -3
  160. package/dist/components/TextInput/index.js +2 -2
  161. package/dist/components/Toggle/index.js +2 -2
  162. package/dist/components/Tooltip/index.js +2 -2
  163. package/dist/components/VStack/index.js +4 -4
  164. package/dist/i18n/index.cjs +3 -1
  165. package/dist/i18n/index.cjs.map +1 -1
  166. package/dist/i18n/index.js +1 -1
  167. package/dist/index.cjs +453 -119
  168. package/dist/index.cjs.map +1 -1
  169. package/dist/index.d.cts +4 -0
  170. package/dist/index.d.ts +4 -0
  171. package/dist/index.js +47 -42
  172. package/dist/slot/index.d.cts +2 -2
  173. package/dist/slot/index.d.ts +2 -2
  174. package/package.json +1 -1
  175. package/dist/chunk-6PO2IWB3.js.map +0 -1
  176. package/dist/chunk-V2AWSDDZ.js.map +0 -1
@@ -0,0 +1,770 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+ var reactNative = require('react-native');
5
+ var jsxRuntime = require('nativewind/jsx-runtime');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ var range = /* @__PURE__ */ __name((from, to) => {
10
+ if (to < from) {
11
+ return [];
12
+ }
13
+ const out = new Array(to - from + 1);
14
+ for (let i = 0; i < out.length; i += 1) {
15
+ out[i] = from + i;
16
+ }
17
+ return out;
18
+ }, "range");
19
+ function usePagination(args) {
20
+ const {
21
+ page: controlledPage,
22
+ defaultPage = 1,
23
+ pageCount,
24
+ siblingCount = 1,
25
+ boundaryCount = 1,
26
+ showFirstLast = false,
27
+ showPrevNext = true,
28
+ onPageChange
29
+ } = args;
30
+ const isControlled = controlledPage !== void 0;
31
+ const [uncontrolledPage, setUncontrolledPage] = react.useState(defaultPage);
32
+ const onChangeRef = react.useRef(onPageChange);
33
+ onChangeRef.current = onPageChange;
34
+ const safePageCount = Math.max(1, Math.floor(pageCount));
35
+ const rawPage = isControlled ? controlledPage : uncontrolledPage;
36
+ const currentPage = Math.min(Math.max(1, Math.floor(rawPage)), safePageCount);
37
+ const goToPage = react.useCallback(
38
+ (next2) => {
39
+ const clamped = Math.min(Math.max(1, Math.floor(next2)), Math.max(1, Math.floor(pageCount)));
40
+ if (!isControlled) {
41
+ setUncontrolledPage(clamped);
42
+ }
43
+ onChangeRef.current?.(clamped);
44
+ },
45
+ [isControlled, pageCount]
46
+ );
47
+ const prev = react.useCallback(() => goToPage(currentPage - 1), [goToPage, currentPage]);
48
+ const next = react.useCallback(() => goToPage(currentPage + 1), [goToPage, currentPage]);
49
+ const first = react.useCallback(() => goToPage(1), [goToPage]);
50
+ const last = react.useCallback(() => goToPage(safePageCount), [goToPage, safePageCount]);
51
+ const pages = react.useMemo(() => {
52
+ const items = [];
53
+ const safeSibling = Math.max(0, Math.floor(siblingCount));
54
+ const safeBoundary = Math.max(0, Math.floor(boundaryCount));
55
+ if (showFirstLast) {
56
+ items.push({ type: "first", disabled: currentPage <= 1 });
57
+ }
58
+ if (showPrevNext) {
59
+ items.push({ type: "prev", disabled: currentPage <= 1 });
60
+ }
61
+ const startPages = range(1, Math.min(safeBoundary, safePageCount));
62
+ const endPages = range(Math.max(safePageCount - safeBoundary + 1, safeBoundary + 1), safePageCount);
63
+ const siblingsStart = Math.max(
64
+ Math.min(currentPage - safeSibling, safePageCount - safeBoundary - safeSibling * 2 - 1),
65
+ safeBoundary + 2
66
+ );
67
+ const siblingsEnd = Math.min(
68
+ Math.max(currentPage + safeSibling, safeBoundary + safeSibling * 2 + 2),
69
+ endPages.length > 0 ? endPages[0] - 2 : safePageCount - 1
70
+ );
71
+ const middle = [];
72
+ if (siblingsStart > safeBoundary + 2) {
73
+ middle.push("ellipsis");
74
+ } else if (safeBoundary + 1 < safePageCount - safeBoundary) {
75
+ middle.push(safeBoundary + 1);
76
+ }
77
+ for (const p of range(siblingsStart, siblingsEnd)) {
78
+ middle.push(p);
79
+ }
80
+ if (siblingsEnd < safePageCount - safeBoundary - 1) {
81
+ middle.push("ellipsis");
82
+ } else if (safePageCount - safeBoundary > safeBoundary) {
83
+ middle.push(safePageCount - safeBoundary);
84
+ }
85
+ const seen = /* @__PURE__ */ new Set();
86
+ const pushPage = /* @__PURE__ */ __name((n) => {
87
+ if (n < 1 || n > safePageCount || seen.has(n)) {
88
+ return;
89
+ }
90
+ seen.add(n);
91
+ items.push({ type: "page", page: n, selected: n === currentPage });
92
+ }, "pushPage");
93
+ for (const n of startPages) {
94
+ pushPage(n);
95
+ }
96
+ for (const m of middle) {
97
+ if (m === "ellipsis") {
98
+ items.push({ type: "ellipsis" });
99
+ } else {
100
+ pushPage(m);
101
+ }
102
+ }
103
+ for (const n of endPages) {
104
+ pushPage(n);
105
+ }
106
+ if (showPrevNext) {
107
+ items.push({ type: "next", disabled: currentPage >= safePageCount });
108
+ }
109
+ if (showFirstLast) {
110
+ items.push({ type: "last", disabled: currentPage >= safePageCount });
111
+ }
112
+ return items;
113
+ }, [currentPage, safePageCount, siblingCount, boundaryCount, showFirstLast, showPrevNext]);
114
+ return {
115
+ page: currentPage,
116
+ pages,
117
+ canPrev: currentPage > 1,
118
+ canNext: currentPage < safePageCount,
119
+ goToPage,
120
+ prev,
121
+ next,
122
+ first,
123
+ last
124
+ };
125
+ }
126
+ __name(usePagination, "usePagination");
127
+
128
+ // ../tokens/build/theme.ts
129
+ var theme = {
130
+ color: {
131
+ danger: "#ef4444",
132
+ info: "#3b82f6",
133
+ neutral: {
134
+ "100": "#f4f4f5",
135
+ "200": "#e4e4e7",
136
+ "300": "#d4d4d8",
137
+ "400": "#a1a1aa",
138
+ "50": "#fafafa",
139
+ "500": "#71717a",
140
+ "600": "#52525b",
141
+ "700": "#3f3f46",
142
+ "800": "#27272a",
143
+ "900": "#18181b"
144
+ },
145
+ primary: {
146
+ "100": "#ccfbf1",
147
+ "200": "#99f6e4",
148
+ "300": "#5eead4",
149
+ "400": "#2dd4bf",
150
+ "50": "#f0fdfa",
151
+ "500": "#14b8a6",
152
+ "600": "#0d9488",
153
+ "700": "#0f766e",
154
+ "800": "#115e59",
155
+ "900": "#134e4a"
156
+ },
157
+ success: "#22c55e",
158
+ warning: "#f59e0b"
159
+ },
160
+ fontFamily: {
161
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
162
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
163
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
164
+ },
165
+ fontSize: {
166
+ "2xl": "24px",
167
+ "3xl": "30px",
168
+ "4xl": "36px",
169
+ lg: "18px",
170
+ md: "16px",
171
+ sm: "14px",
172
+ xl: "20px",
173
+ xs: "12px"
174
+ },
175
+ fontWeight: {
176
+ bold: "700",
177
+ medium: "500",
178
+ regular: "400",
179
+ semibold: "600"
180
+ },
181
+ lineHeight: {
182
+ normal: "1.4",
183
+ relaxed: "1.6",
184
+ tight: "1.2"
185
+ },
186
+ radius: {
187
+ "2xl": "16px",
188
+ full: "9999px",
189
+ lg: "8px",
190
+ md: "6px",
191
+ none: "0px",
192
+ sm: "4px",
193
+ xl: "12px"
194
+ },
195
+ semantic: {
196
+ background: {
197
+ default: "#fafafa",
198
+ elevated: "#ffffff",
199
+ subtle: "#f4f4f5"
200
+ },
201
+ border: {
202
+ default: "#e4e4e7",
203
+ strong: "#d4d4d8"
204
+ },
205
+ interactive: {
206
+ destructive: "#ef4444",
207
+ primary: "#0d9488",
208
+ primaryHover: "#0f766e",
209
+ primaryPressed: "#115e59"
210
+ },
211
+ text: {
212
+ default: "#18181b",
213
+ inverted: "#fafafa",
214
+ muted: "#52525b"
215
+ }
216
+ },
217
+ shadow: {
218
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
219
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
220
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
221
+ },
222
+ spacing: {
223
+ "0": "0px",
224
+ "1": "4px",
225
+ "10": "40px",
226
+ "12": "48px",
227
+ "16": "64px",
228
+ "2": "8px",
229
+ "20": "80px",
230
+ "24": "96px",
231
+ "3": "12px",
232
+ "4": "16px",
233
+ "5": "20px",
234
+ "6": "24px",
235
+ "8": "32px"
236
+ }
237
+ };
238
+ var themeDark = {
239
+ color: {
240
+ danger: "#ef4444",
241
+ info: "#3b82f6",
242
+ neutral: {
243
+ "100": "#f4f4f5",
244
+ "200": "#e4e4e7",
245
+ "300": "#d4d4d8",
246
+ "400": "#a1a1aa",
247
+ "50": "#fafafa",
248
+ "500": "#71717a",
249
+ "600": "#52525b",
250
+ "700": "#3f3f46",
251
+ "800": "#27272a",
252
+ "900": "#18181b"
253
+ },
254
+ primary: {
255
+ "100": "#ccfbf1",
256
+ "200": "#99f6e4",
257
+ "300": "#5eead4",
258
+ "400": "#2dd4bf",
259
+ "50": "#f0fdfa",
260
+ "500": "#14b8a6",
261
+ "600": "#0d9488",
262
+ "700": "#0f766e",
263
+ "800": "#115e59",
264
+ "900": "#134e4a"
265
+ },
266
+ success: "#22c55e",
267
+ warning: "#f59e0b"
268
+ },
269
+ fontFamily: {
270
+ body: "system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif",
271
+ display: "ui-serif, Georgia, 'Times New Roman', serif",
272
+ mono: "ui-monospace, 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace"
273
+ },
274
+ fontSize: {
275
+ "2xl": "24px",
276
+ "3xl": "30px",
277
+ "4xl": "36px",
278
+ lg: "18px",
279
+ md: "16px",
280
+ sm: "14px",
281
+ xl: "20px",
282
+ xs: "12px"
283
+ },
284
+ fontWeight: {
285
+ bold: "700",
286
+ medium: "500",
287
+ regular: "400",
288
+ semibold: "600"
289
+ },
290
+ lineHeight: {
291
+ normal: "1.4",
292
+ relaxed: "1.6",
293
+ tight: "1.2"
294
+ },
295
+ radius: {
296
+ "2xl": "16px",
297
+ full: "9999px",
298
+ lg: "8px",
299
+ md: "6px",
300
+ none: "0px",
301
+ sm: "4px",
302
+ xl: "12px"
303
+ },
304
+ semantic: {
305
+ background: {
306
+ default: "#18181b",
307
+ elevated: "#3f3f46",
308
+ subtle: "#27272a"
309
+ },
310
+ border: {
311
+ default: "#3f3f46",
312
+ strong: "#52525b"
313
+ },
314
+ interactive: {
315
+ destructive: "#ef4444",
316
+ primary: "#2dd4bf",
317
+ primaryHover: "#5eead4",
318
+ primaryPressed: "#99f6e4"
319
+ },
320
+ text: {
321
+ default: "#fafafa",
322
+ inverted: "#18181b",
323
+ muted: "#a1a1aa"
324
+ }
325
+ },
326
+ shadow: {
327
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1)",
328
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1)",
329
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.05)"
330
+ },
331
+ spacing: {
332
+ "0": "0px",
333
+ "1": "4px",
334
+ "10": "40px",
335
+ "12": "48px",
336
+ "16": "64px",
337
+ "2": "8px",
338
+ "20": "80px",
339
+ "24": "96px",
340
+ "3": "12px",
341
+ "4": "16px",
342
+ "5": "20px",
343
+ "6": "24px",
344
+ "8": "32px"
345
+ }
346
+ };
347
+ var defaultTheme = {
348
+ light: theme,
349
+ dark: themeDark
350
+ };
351
+ var ThemeContext = react.createContext(defaultTheme);
352
+ ThemeContext.displayName = "ThemeContext";
353
+ var ColorSchemeOverrideContext = react.createContext(null);
354
+ ColorSchemeOverrideContext.displayName = "ColorSchemeOverrideContext";
355
+ var isWeb = reactNative.Platform.OS === "web";
356
+ function readWebScheme() {
357
+ if (typeof document === "undefined") {
358
+ return "light";
359
+ }
360
+ const root = document.documentElement;
361
+ if (root.classList.contains("dark")) {
362
+ return "dark";
363
+ }
364
+ if (root.getAttribute("data-theme") === "dark") {
365
+ return "dark";
366
+ }
367
+ return "light";
368
+ }
369
+ __name(readWebScheme, "readWebScheme");
370
+ function useColorScheme() {
371
+ const override = react.useContext(ColorSchemeOverrideContext);
372
+ const [scheme, setScheme] = react.useState(() => {
373
+ if (isWeb) {
374
+ return readWebScheme();
375
+ }
376
+ return reactNative.Appearance.getColorScheme() ?? "light";
377
+ });
378
+ react.useEffect(() => {
379
+ if (isWeb) {
380
+ const root = document.documentElement;
381
+ const update = /* @__PURE__ */ __name(() => setScheme(readWebScheme()), "update");
382
+ const observer = new MutationObserver(update);
383
+ observer.observe(root, { attributes: true, attributeFilter: ["class", "data-theme"] });
384
+ update();
385
+ return () => observer.disconnect();
386
+ }
387
+ const sub = reactNative.Appearance.addChangeListener(({ colorScheme }) => {
388
+ setScheme(colorScheme ?? "light");
389
+ });
390
+ return () => sub.remove();
391
+ }, []);
392
+ return override ?? scheme;
393
+ }
394
+ __name(useColorScheme, "useColorScheme");
395
+
396
+ // src/theme/use-theme-colors.ts
397
+ function useThemeColors() {
398
+ const scheme = useColorScheme();
399
+ const themePair = react.useContext(ThemeContext);
400
+ return scheme === "dark" ? themePair.dark : themePair.light;
401
+ }
402
+ __name(useThemeColors, "useThemeColors");
403
+
404
+ // src/utils/cn.ts
405
+ function cn(...inputs) {
406
+ const out = [];
407
+ for (const input of inputs) {
408
+ append(out, input);
409
+ }
410
+ return out.join(" ");
411
+ }
412
+ __name(cn, "cn");
413
+ function append(out, input) {
414
+ if (!input) {
415
+ return;
416
+ }
417
+ if (typeof input === "string") {
418
+ if (input.length > 0) {
419
+ out.push(input);
420
+ }
421
+ return;
422
+ }
423
+ if (typeof input === "number") {
424
+ return;
425
+ }
426
+ if (Array.isArray(input)) {
427
+ for (const inner of input) {
428
+ append(out, inner);
429
+ }
430
+ return;
431
+ }
432
+ if (typeof input === "object") {
433
+ for (const key of Object.keys(input)) {
434
+ if (input[key]) {
435
+ out.push(key);
436
+ }
437
+ }
438
+ }
439
+ }
440
+ __name(append, "append");
441
+ var TableContext = react.createContext({
442
+ striped: false,
443
+ compact: false,
444
+ bordered: false,
445
+ rowIndex: 0,
446
+ setRowIndex: /* @__PURE__ */ __name(() => {
447
+ }, "setRowIndex")
448
+ });
449
+ function buildTableCompound(parts) {
450
+ return Object.assign(parts.Root, {
451
+ Header: parts.Header,
452
+ Body: parts.Body,
453
+ Footer: parts.Footer,
454
+ Row: parts.Row,
455
+ HeaderCell: parts.HeaderCell,
456
+ Cell: parts.Cell,
457
+ Caption: parts.Caption
458
+ });
459
+ }
460
+ __name(buildTableCompound, "buildTableCompound");
461
+ var TableRoot = /* @__PURE__ */ __name(({ striped = false, compact = false, bordered = false, children, className, testID }) => {
462
+ const [rowIndex, setRowIndex] = react.useState(0);
463
+ const ctxValue = {
464
+ striped,
465
+ compact,
466
+ bordered,
467
+ rowIndex,
468
+ setRowIndex
469
+ };
470
+ return /* @__PURE__ */ jsxRuntime.jsx(TableContext.Provider, { value: ctxValue, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("w-full overflow-auto", className), children: /* @__PURE__ */ jsxRuntime.jsx(
471
+ "table",
472
+ {
473
+ className: cn(
474
+ "w-full caption-bottom text-sm",
475
+ bordered && "border border-semantic-border-default",
476
+ className
477
+ ),
478
+ ...testID !== void 0 ? { "data-testid": testID } : {},
479
+ children
480
+ }
481
+ ) }) });
482
+ }, "TableRoot");
483
+ var TableHeader = /* @__PURE__ */ __name(({ children, className, testID }) => /* @__PURE__ */ jsxRuntime.jsx(
484
+ "thead",
485
+ {
486
+ className: cn("[&_tr]:border-b [&_tr]:border-semantic-border-default", className),
487
+ ...testID !== void 0 ? { "data-testid": testID } : {},
488
+ children
489
+ }
490
+ ), "TableHeader");
491
+ var TableBody = /* @__PURE__ */ __name(({ children, className, testID }) => /* @__PURE__ */ jsxRuntime.jsx(
492
+ "tbody",
493
+ {
494
+ className: cn("[&_tr:last-child]:border-0", className),
495
+ ...testID !== void 0 ? { "data-testid": testID } : {},
496
+ children
497
+ }
498
+ ), "TableBody");
499
+ var TableFooter = /* @__PURE__ */ __name(({ children, className, testID }) => /* @__PURE__ */ jsxRuntime.jsx(
500
+ "tfoot",
501
+ {
502
+ className: cn("border-t border-semantic-border-default font-medium", className),
503
+ ...testID !== void 0 ? { "data-testid": testID } : {},
504
+ children
505
+ }
506
+ ), "TableFooter");
507
+ var TableRow = /* @__PURE__ */ __name(({ selected = false, onPress, children, className, testID }) => {
508
+ const colors = useThemeColors();
509
+ const handleClick = react.useCallback(() => {
510
+ onPress?.();
511
+ }, [onPress]);
512
+ return /* @__PURE__ */ jsxRuntime.jsx(
513
+ "tr",
514
+ {
515
+ className: cn(
516
+ "border-b border-semantic-border-default transition-colors",
517
+ onPress && "cursor-pointer hover:bg-semantic-background-subtle",
518
+ selected && "bg-semantic-background-subtle",
519
+ className
520
+ ),
521
+ style: selected ? { backgroundColor: colors.semantic.background.subtle } : void 0,
522
+ onClick: onPress ? handleClick : void 0,
523
+ ...testID !== void 0 ? { "data-testid": testID } : {},
524
+ children
525
+ }
526
+ );
527
+ }, "TableRow");
528
+ var TableHeaderCell = /* @__PURE__ */ __name(({ align = "left", colSpan, children, className, testID }) => /* @__PURE__ */ jsxRuntime.jsx(
529
+ "th",
530
+ {
531
+ className: cn(
532
+ "h-10 px-4 font-medium text-semantic-text-secondary",
533
+ align === "right" && "text-right",
534
+ align === "center" && "text-center",
535
+ align === "left" && "text-left",
536
+ className
537
+ ),
538
+ colSpan,
539
+ ...testID !== void 0 ? { "data-testid": testID } : {},
540
+ children
541
+ }
542
+ ), "TableHeaderCell");
543
+ var TableCell = /* @__PURE__ */ __name(({ align = "left", colSpan, children, className, testID }) => /* @__PURE__ */ jsxRuntime.jsx(
544
+ "td",
545
+ {
546
+ className: cn(
547
+ "p-4 align-middle",
548
+ align === "right" && "text-right",
549
+ align === "center" && "text-center",
550
+ align === "left" && "text-left",
551
+ className
552
+ ),
553
+ colSpan,
554
+ ...testID !== void 0 ? { "data-testid": testID } : {},
555
+ children
556
+ }
557
+ ), "TableCell");
558
+ var TableCaption = /* @__PURE__ */ __name(({ children, className, testID }) => /* @__PURE__ */ jsxRuntime.jsx(
559
+ "caption",
560
+ {
561
+ className: cn("mt-4 text-sm text-semantic-text-secondary", className),
562
+ ...testID !== void 0 ? { "data-testid": testID } : {},
563
+ children
564
+ }
565
+ ), "TableCaption");
566
+ var Table = buildTableCompound({
567
+ Root: TableRoot,
568
+ Header: TableHeader,
569
+ Body: TableBody,
570
+ Footer: TableFooter,
571
+ Row: TableRow,
572
+ HeaderCell: TableHeaderCell,
573
+ Cell: TableCell,
574
+ Caption: TableCaption
575
+ });
576
+ function sortData(data, sort) {
577
+ if (!sort) {
578
+ return data;
579
+ }
580
+ const key = sort.id;
581
+ return [...data].sort((a, b) => {
582
+ const av = a[key];
583
+ const bv = b[key];
584
+ if (av == null && bv == null) {
585
+ return 0;
586
+ }
587
+ if (av == null) {
588
+ return 1;
589
+ }
590
+ if (bv == null) {
591
+ return -1;
592
+ }
593
+ const cmp = av < bv ? -1 : av > bv ? 1 : 0;
594
+ return sort.direction === "asc" ? cmp : -cmp;
595
+ });
596
+ }
597
+ __name(sortData, "sortData");
598
+ function SortIndicator({ direction }) {
599
+ if (direction === void 0) {
600
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { marginLeft: 4, opacity: 0.3 }, children: "\u21C5" });
601
+ }
602
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { style: { marginLeft: 4 }, children: direction === "asc" ? "\u2191" : "\u2193" });
603
+ }
604
+ __name(SortIndicator, "SortIndicator");
605
+ function DataTable({
606
+ data,
607
+ columns,
608
+ pageSize = 10,
609
+ defaultSort,
610
+ onRowPress,
611
+ emptyState,
612
+ striped,
613
+ compact,
614
+ bordered,
615
+ testID,
616
+ className
617
+ }) {
618
+ const [sort, setSort] = react.useState(defaultSort ?? null);
619
+ const sorted = react.useMemo(() => sortData(data, sort), [data, sort]);
620
+ const pageCount = Math.max(1, Math.ceil(sorted.length / pageSize));
621
+ const { page, goToPage, canPrev, canNext } = usePagination({ pageCount, defaultPage: 1 });
622
+ const pageSlice = react.useMemo(() => {
623
+ const start = (page - 1) * pageSize;
624
+ return sorted.slice(start, start + pageSize);
625
+ }, [sorted, page, pageSize]);
626
+ const handleSort = /* @__PURE__ */ __name((colId) => {
627
+ setSort((prev) => {
628
+ if (prev?.id !== colId) {
629
+ goToPage(1);
630
+ return { id: colId, direction: "asc" };
631
+ }
632
+ if (prev.direction === "asc") {
633
+ return { id: colId, direction: "desc" };
634
+ }
635
+ goToPage(1);
636
+ return null;
637
+ });
638
+ }, "handleSort");
639
+ const tableProps = {};
640
+ if (striped !== void 0) {
641
+ tableProps.striped = striped;
642
+ }
643
+ if (compact !== void 0) {
644
+ tableProps.compact = compact;
645
+ }
646
+ if (bordered !== void 0) {
647
+ tableProps.bordered = bordered;
648
+ }
649
+ if (testID !== void 0) {
650
+ tableProps.testID = testID;
651
+ }
652
+ if (className !== void 0) {
653
+ tableProps.className = className;
654
+ }
655
+ return /* @__PURE__ */ jsxRuntime.jsxs(reactNative.View, { style: { width: "100%" }, children: [
656
+ /* @__PURE__ */ jsxRuntime.jsxs(Table, { ...tableProps, children: [
657
+ /* @__PURE__ */ jsxRuntime.jsx(Table.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(Table.Row, { children: columns.map((col) => {
658
+ const align = col.align;
659
+ return /* @__PURE__ */ jsxRuntime.jsx(Table.HeaderCell, { ...align !== void 0 ? { align } : {}, children: col.sortable ? /* @__PURE__ */ jsxRuntime.jsxs(
660
+ reactNative.Pressable,
661
+ {
662
+ accessibilityRole: "button",
663
+ accessibilityLabel: `Sort by ${col.id}`,
664
+ "aria-label": `Sort by ${col.id}`,
665
+ onPress: () => handleSort(col.id),
666
+ style: { flexDirection: "row", alignItems: "center" },
667
+ children: [
668
+ typeof col.header === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { children: col.header }) : col.header,
669
+ /* @__PURE__ */ jsxRuntime.jsx(
670
+ SortIndicator,
671
+ {
672
+ ...sort?.id === col.id ? { direction: sort.direction } : {}
673
+ }
674
+ )
675
+ ]
676
+ }
677
+ ) : col.header }, col.id);
678
+ }) }) }),
679
+ /* @__PURE__ */ jsxRuntime.jsx(Table.Body, { children: pageSlice.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(Table.Row, { children: /* @__PURE__ */ jsxRuntime.jsx(Table.Cell, { colSpan: columns.length, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: emptyState ?? "No data" }) }) }) : pageSlice.map((row, i) => /* @__PURE__ */ jsxRuntime.jsx(
680
+ Table.Row,
681
+ {
682
+ ...onRowPress !== void 0 ? { onPress: /* @__PURE__ */ __name(() => onRowPress(row), "onPress") } : {},
683
+ children: columns.map((col) => {
684
+ const colAlign = col.align;
685
+ return /* @__PURE__ */ jsxRuntime.jsx(
686
+ Table.Cell,
687
+ {
688
+ ...colAlign !== void 0 ? { align: colAlign } : {},
689
+ children: col.cell(row)
690
+ },
691
+ col.id
692
+ );
693
+ })
694
+ },
695
+ i
696
+ )) })
697
+ ] }),
698
+ pageCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(
699
+ PaginationControls,
700
+ {
701
+ page,
702
+ pageCount,
703
+ canPrev,
704
+ canNext,
705
+ goToPage
706
+ }
707
+ )
708
+ ] });
709
+ }
710
+ __name(DataTable, "DataTable");
711
+ function EmptyState({ children }) {
712
+ return /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { paddingVertical: 32, alignItems: "center" }, children: typeof children === "string" ? /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { color: "#888", fontSize: 14 }, children }) : children });
713
+ }
714
+ __name(EmptyState, "EmptyState");
715
+ function PaginationControls({
716
+ page,
717
+ pageCount,
718
+ canPrev,
719
+ canNext,
720
+ goToPage
721
+ }) {
722
+ return /* @__PURE__ */ jsxRuntime.jsxs(
723
+ reactNative.View,
724
+ {
725
+ style: {
726
+ flexDirection: "row",
727
+ justifyContent: "flex-end",
728
+ alignItems: "center",
729
+ paddingVertical: 8,
730
+ gap: 8
731
+ },
732
+ children: [
733
+ /* @__PURE__ */ jsxRuntime.jsx(
734
+ reactNative.Pressable,
735
+ {
736
+ onPress: canPrev ? () => goToPage(page - 1) : void 0,
737
+ accessibilityRole: "button",
738
+ accessibilityLabel: "Previous page",
739
+ "aria-label": "Previous page",
740
+ "aria-disabled": !canPrev,
741
+ style: { opacity: canPrev ? 1 : 0.4, paddingHorizontal: 8 },
742
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { fontSize: 14 }, children: "\u2039 Prev" })
743
+ }
744
+ ),
745
+ /* @__PURE__ */ jsxRuntime.jsxs(reactNative.Text, { style: { fontSize: 14 }, "aria-live": "polite", children: [
746
+ page,
747
+ " / ",
748
+ pageCount
749
+ ] }),
750
+ /* @__PURE__ */ jsxRuntime.jsx(
751
+ reactNative.Pressable,
752
+ {
753
+ onPress: canNext ? () => goToPage(page + 1) : void 0,
754
+ accessibilityRole: "button",
755
+ accessibilityLabel: "Next page",
756
+ "aria-label": "Next page",
757
+ "aria-disabled": !canNext,
758
+ style: { opacity: canNext ? 1 : 0.4, paddingHorizontal: 8 },
759
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Text, { style: { fontSize: 14 }, children: "Next \u203A" })
760
+ }
761
+ )
762
+ ]
763
+ }
764
+ );
765
+ }
766
+ __name(PaginationControls, "PaginationControls");
767
+
768
+ exports.DataTable = DataTable;
769
+ //# sourceMappingURL=index.cjs.map
770
+ //# sourceMappingURL=index.cjs.map