@xemahq/ui-kernel 0.1.12 → 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.
Files changed (195) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/biome-host/host-bridge.d.ts +2 -0
  6. package/dist/lib/biome-host/host-bridge.d.ts.map +1 -1
  7. package/dist/lib/biome-host/host-bridge.js.map +1 -1
  8. package/dist/lib/capabilities/capability-provider.d.ts +15 -0
  9. package/dist/lib/capabilities/capability-provider.d.ts.map +1 -0
  10. package/dist/lib/capabilities/capability-provider.js +36 -0
  11. package/dist/lib/capabilities/capability-provider.js.map +1 -0
  12. package/dist/lib/capabilities/index.d.ts +4 -0
  13. package/dist/lib/capabilities/index.d.ts.map +1 -0
  14. package/dist/lib/capabilities/index.js +20 -0
  15. package/dist/lib/capabilities/index.js.map +1 -0
  16. package/dist/lib/capabilities/types.d.ts +18 -0
  17. package/dist/lib/capabilities/types.d.ts.map +1 -0
  18. package/dist/lib/capabilities/types.js +3 -0
  19. package/dist/lib/capabilities/types.js.map +1 -0
  20. package/dist/lib/capabilities/use-capability.d.ts +18 -0
  21. package/dist/lib/capabilities/use-capability.d.ts.map +1 -0
  22. package/dist/lib/capabilities/use-capability.js +21 -0
  23. package/dist/lib/capabilities/use-capability.js.map +1 -0
  24. package/dist/ui/chrome/AsyncBoundary.d.ts +22 -0
  25. package/dist/ui/chrome/AsyncBoundary.d.ts.map +1 -0
  26. package/dist/ui/chrome/AsyncBoundary.js +23 -0
  27. package/dist/ui/chrome/AsyncBoundary.js.map +1 -0
  28. package/dist/ui/chrome/EmptyState.d.ts +34 -0
  29. package/dist/ui/chrome/EmptyState.d.ts.map +1 -0
  30. package/dist/ui/chrome/EmptyState.js +27 -0
  31. package/dist/ui/chrome/EmptyState.js.map +1 -0
  32. package/dist/ui/chrome/ErrorCard.d.ts +11 -0
  33. package/dist/ui/chrome/ErrorCard.d.ts.map +1 -0
  34. package/dist/ui/chrome/ErrorCard.js +21 -0
  35. package/dist/ui/chrome/ErrorCard.js.map +1 -0
  36. package/dist/ui/chrome/LoadingState.d.ts +10 -0
  37. package/dist/ui/chrome/LoadingState.d.ts.map +1 -0
  38. package/dist/ui/chrome/LoadingState.js +17 -0
  39. package/dist/ui/chrome/LoadingState.js.map +1 -0
  40. package/dist/ui/chrome/PageHeader.d.ts +20 -0
  41. package/dist/ui/chrome/PageHeader.d.ts.map +1 -0
  42. package/dist/ui/chrome/PageHeader.js +26 -0
  43. package/dist/ui/chrome/PageHeader.js.map +1 -0
  44. package/dist/ui/chrome/StateCard.d.ts +24 -0
  45. package/dist/ui/chrome/StateCard.d.ts.map +1 -0
  46. package/dist/ui/chrome/StateCard.js +17 -0
  47. package/dist/ui/chrome/StateCard.js.map +1 -0
  48. package/dist/ui/cn.d.ts +3 -0
  49. package/dist/ui/cn.d.ts.map +1 -0
  50. package/dist/ui/cn.js +18 -0
  51. package/dist/ui/cn.js.map +1 -0
  52. package/dist/ui/index.d.ts +33 -0
  53. package/dist/ui/index.d.ts.map +1 -0
  54. package/dist/ui/index.js +61 -0
  55. package/dist/ui/index.js.map +1 -0
  56. package/dist/ui/primitives/alert-dialog.d.ts +21 -0
  57. package/dist/ui/primitives/alert-dialog.d.ts.map +1 -0
  58. package/dist/ui/primitives/alert-dialog.js +72 -0
  59. package/dist/ui/primitives/alert-dialog.js.map +1 -0
  60. package/dist/ui/primitives/badge.d.ts +10 -0
  61. package/dist/ui/primitives/badge.d.ts.map +1 -0
  62. package/dist/ui/primitives/badge.js +60 -0
  63. package/dist/ui/primitives/badge.js.map +1 -0
  64. package/dist/ui/primitives/button.d.ts +12 -0
  65. package/dist/ui/primitives/button.d.ts.map +1 -0
  66. package/dist/ui/primitives/button.js +71 -0
  67. package/dist/ui/primitives/button.js.map +1 -0
  68. package/dist/ui/primitives/card.d.ts +9 -0
  69. package/dist/ui/primitives/card.d.ts.map +1 -0
  70. package/dist/ui/primitives/card.js +58 -0
  71. package/dist/ui/primitives/card.js.map +1 -0
  72. package/dist/ui/primitives/checkbox.d.ts +5 -0
  73. package/dist/ui/primitives/checkbox.d.ts.map +1 -0
  74. package/dist/ui/primitives/checkbox.js +45 -0
  75. package/dist/ui/primitives/checkbox.js.map +1 -0
  76. package/dist/ui/primitives/collapsible.d.ts +6 -0
  77. package/dist/ui/primitives/collapsible.d.ts.map +1 -0
  78. package/dist/ui/primitives/collapsible.js +44 -0
  79. package/dist/ui/primitives/collapsible.js.map +1 -0
  80. package/dist/ui/primitives/dialog.d.ts +22 -0
  81. package/dist/ui/primitives/dialog.d.ts.map +1 -0
  82. package/dist/ui/primitives/dialog.js +68 -0
  83. package/dist/ui/primitives/dialog.js.map +1 -0
  84. package/dist/ui/primitives/dropdown-menu.d.ts +28 -0
  85. package/dist/ui/primitives/dropdown-menu.d.ts.map +1 -0
  86. package/dist/ui/primitives/dropdown-menu.js +83 -0
  87. package/dist/ui/primitives/dropdown-menu.js.map +1 -0
  88. package/dist/ui/primitives/input.d.ts +4 -0
  89. package/dist/ui/primitives/input.d.ts.map +1 -0
  90. package/dist/ui/primitives/input.js +45 -0
  91. package/dist/ui/primitives/input.js.map +1 -0
  92. package/dist/ui/primitives/label.d.ts +6 -0
  93. package/dist/ui/primitives/label.d.ts.map +1 -0
  94. package/dist/ui/primitives/label.js +46 -0
  95. package/dist/ui/primitives/label.js.map +1 -0
  96. package/dist/ui/primitives/overflow-tabs.d.ts +18 -0
  97. package/dist/ui/primitives/overflow-tabs.d.ts.map +1 -0
  98. package/dist/ui/primitives/overflow-tabs.js +84 -0
  99. package/dist/ui/primitives/overflow-tabs.js.map +1 -0
  100. package/dist/ui/primitives/popover.d.ts +9 -0
  101. package/dist/ui/primitives/popover.d.ts.map +1 -0
  102. package/dist/ui/primitives/popover.js +48 -0
  103. package/dist/ui/primitives/popover.js.map +1 -0
  104. package/dist/ui/primitives/radio-group.d.ts +6 -0
  105. package/dist/ui/primitives/radio-group.d.ts.map +1 -0
  106. package/dist/ui/primitives/radio-group.js +52 -0
  107. package/dist/ui/primitives/radio-group.js.map +1 -0
  108. package/dist/ui/primitives/resizable.d.ts +12 -0
  109. package/dist/ui/primitives/resizable.d.ts.map +1 -0
  110. package/dist/ui/primitives/resizable.js +18 -0
  111. package/dist/ui/primitives/resizable.js.map +1 -0
  112. package/dist/ui/primitives/scroll-area.d.ts +6 -0
  113. package/dist/ui/primitives/scroll-area.d.ts.map +1 -0
  114. package/dist/ui/primitives/scroll-area.js +47 -0
  115. package/dist/ui/primitives/scroll-area.js.map +1 -0
  116. package/dist/ui/primitives/select.d.ts +14 -0
  117. package/dist/ui/primitives/select.d.ts.map +1 -0
  118. package/dist/ui/primitives/select.js +71 -0
  119. package/dist/ui/primitives/select.js.map +1 -0
  120. package/dist/ui/primitives/separator.d.ts +5 -0
  121. package/dist/ui/primitives/separator.d.ts.map +1 -0
  122. package/dist/ui/primitives/separator.js +44 -0
  123. package/dist/ui/primitives/separator.js.map +1 -0
  124. package/dist/ui/primitives/sheet.d.ts +26 -0
  125. package/dist/ui/primitives/sheet.d.ts.map +1 -0
  126. package/dist/ui/primitives/sheet.js +82 -0
  127. package/dist/ui/primitives/sheet.js.map +1 -0
  128. package/dist/ui/primitives/skeleton.d.ts +13 -0
  129. package/dist/ui/primitives/skeleton.d.ts.map +1 -0
  130. package/dist/ui/primitives/skeleton.js +29 -0
  131. package/dist/ui/primitives/skeleton.js.map +1 -0
  132. package/dist/ui/primitives/switch.d.ts +5 -0
  133. package/dist/ui/primitives/switch.d.ts.map +1 -0
  134. package/dist/ui/primitives/switch.js +44 -0
  135. package/dist/ui/primitives/switch.js.map +1 -0
  136. package/dist/ui/primitives/table.d.ts +11 -0
  137. package/dist/ui/primitives/table.d.ts.map +1 -0
  138. package/dist/ui/primitives/table.js +64 -0
  139. package/dist/ui/primitives/table.js.map +1 -0
  140. package/dist/ui/primitives/tabs.d.ts +8 -0
  141. package/dist/ui/primitives/tabs.d.ts.map +1 -0
  142. package/dist/ui/primitives/tabs.js +52 -0
  143. package/dist/ui/primitives/tabs.js.map +1 -0
  144. package/dist/ui/primitives/tag-multi-select.d.ts +19 -0
  145. package/dist/ui/primitives/tag-multi-select.d.ts.map +1 -0
  146. package/dist/ui/primitives/tag-multi-select.js +92 -0
  147. package/dist/ui/primitives/tag-multi-select.js.map +1 -0
  148. package/dist/ui/primitives/textarea.d.ts +5 -0
  149. package/dist/ui/primitives/textarea.d.ts.map +1 -0
  150. package/dist/ui/primitives/textarea.js +45 -0
  151. package/dist/ui/primitives/textarea.js.map +1 -0
  152. package/dist/ui/primitives/tooltip.d.ts +8 -0
  153. package/dist/ui/primitives/tooltip.d.ts.map +1 -0
  154. package/dist/ui/primitives/tooltip.js +50 -0
  155. package/dist/ui/primitives/tooltip.js.map +1 -0
  156. package/package.json +24 -1
  157. package/src/index.ts +1 -0
  158. package/src/lib/biome-host/host-bridge.ts +10 -0
  159. package/src/lib/capabilities/capability-provider.tsx +95 -0
  160. package/src/lib/capabilities/index.ts +16 -0
  161. package/src/lib/capabilities/types.ts +69 -0
  162. package/src/lib/capabilities/use-capability.ts +72 -0
  163. package/src/ui/chrome/AsyncBoundary.tsx +66 -0
  164. package/src/ui/chrome/EmptyState.tsx +184 -0
  165. package/src/ui/chrome/ErrorCard.tsx +68 -0
  166. package/src/ui/chrome/LoadingState.tsx +61 -0
  167. package/src/ui/chrome/PageHeader.tsx +137 -0
  168. package/src/ui/chrome/StateCard.tsx +150 -0
  169. package/src/ui/cn.ts +32 -0
  170. package/src/ui/index.ts +53 -0
  171. package/src/ui/primitives/alert-dialog.tsx +104 -0
  172. package/src/ui/primitives/badge.tsx +32 -0
  173. package/src/ui/primitives/button.tsx +47 -0
  174. package/src/ui/primitives/card.tsx +43 -0
  175. package/src/ui/primitives/checkbox.tsx +26 -0
  176. package/src/ui/primitives/collapsible.tsx +9 -0
  177. package/src/ui/primitives/dialog.tsx +103 -0
  178. package/src/ui/primitives/dropdown-menu.tsx +179 -0
  179. package/src/ui/primitives/input.tsx +22 -0
  180. package/src/ui/primitives/label.tsx +17 -0
  181. package/src/ui/primitives/overflow-tabs.tsx +281 -0
  182. package/src/ui/primitives/popover.tsx +33 -0
  183. package/src/ui/primitives/radio-group.tsx +36 -0
  184. package/src/ui/primitives/resizable.tsx +67 -0
  185. package/src/ui/primitives/scroll-area.tsx +38 -0
  186. package/src/ui/primitives/select.tsx +143 -0
  187. package/src/ui/primitives/separator.tsx +20 -0
  188. package/src/ui/primitives/sheet.tsx +107 -0
  189. package/src/ui/primitives/skeleton.tsx +99 -0
  190. package/src/ui/primitives/switch.tsx +27 -0
  191. package/src/ui/primitives/table.tsx +72 -0
  192. package/src/ui/primitives/tabs.tsx +53 -0
  193. package/src/ui/primitives/tag-multi-select.tsx +241 -0
  194. package/src/ui/primitives/textarea.tsx +21 -0
  195. package/src/ui/primitives/tooltip.tsx +30 -0
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TableCaption = exports.TableCell = exports.TableRow = exports.TableHead = exports.TableFooter = exports.TableBody = exports.TableHeader = exports.Table = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ const cn_1 = require("../cn");
40
+ const Table = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("div", { className: "relative w-full overflow-auto", children: (0, jsx_runtime_1.jsx)("table", { ref: ref, className: (0, cn_1.cn)("w-full caption-bottom text-body-1", className), ...props }) })));
41
+ exports.Table = Table;
42
+ Table.displayName = "Table";
43
+ const TableHeader = React.forwardRef(({ className, ...props }, ref) => (0, jsx_runtime_1.jsx)("thead", { ref: ref, className: (0, cn_1.cn)("[&_tr]:border-b", className), ...props }));
44
+ exports.TableHeader = TableHeader;
45
+ TableHeader.displayName = "TableHeader";
46
+ const TableBody = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("tbody", { ref: ref, className: (0, cn_1.cn)("[&_tr:last-child]:border-0", className), ...props })));
47
+ exports.TableBody = TableBody;
48
+ TableBody.displayName = "TableBody";
49
+ const TableFooter = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("tfoot", { ref: ref, className: (0, cn_1.cn)("border-t bg-paper-elev/60 font-medium [&>tr]:last:border-b-0", className), ...props })));
50
+ exports.TableFooter = TableFooter;
51
+ TableFooter.displayName = "TableFooter";
52
+ const TableRow = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("tr", { ref: ref, className: (0, cn_1.cn)("border-b transition-colors data-[state=selected]:bg-muted hover:bg-paper-elev", className), ...props })));
53
+ exports.TableRow = TableRow;
54
+ TableRow.displayName = "TableRow";
55
+ const TableHead = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("th", { ref: ref, className: (0, cn_1.cn)("h-12 px-4 text-left align-middle font-medium text-ink-3 [&:has([role=checkbox])]:pr-0", className), ...props })));
56
+ exports.TableHead = TableHead;
57
+ TableHead.displayName = "TableHead";
58
+ const TableCell = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("td", { ref: ref, className: (0, cn_1.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props })));
59
+ exports.TableCell = TableCell;
60
+ TableCell.displayName = "TableCell";
61
+ const TableCaption = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)("caption", { ref: ref, className: (0, cn_1.cn)("mt-4 text-body-1 text-ink-3", className), ...props })));
62
+ exports.TableCaption = TableCaption;
63
+ TableCaption.displayName = "TableCaption";
64
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/ui/primitives/table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAE/B,8BAA2B;AAE3B,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,gCAAK,SAAS,EAAC,+BAA+B,YAC5C,kCAAO,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,OAAE,EAAC,mCAAmC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,GACzF,CACP,CACF,CAAC;AA6DO,sBAAK;AA5Dd,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAClC,CA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AAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,+BACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,OAAE,EACX,uFAAuF,EACvF,SAAS,CACV,KACG,KAAK,GACT,CACH,CACF,CAAC;AAiBmD,8BAAS;AAhB9D,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,+BAAI,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,OAAE,EAAC,gDAAgD,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACxG,CACF,CAAC;AAUwE,8BAAS;AATnF,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CACnC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,oCAAS,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAA,OAAE,EAAC,6BAA6B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAC1F,CACF,CAAC;AAGmF,oCAAY;AAFjG,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
2
+ import * as React from "react";
3
+ declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
4
+ declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
8
+ //# sourceMappingURL=tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../src/ui/primitives/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,IAAI,gGAAqB,CAAC;AAEhC,QAAA,MAAM,QAAQ,uJAYZ,CAAC;AAGH,QAAA,MAAM,WAAW,gKAYf,CAAC;AAGH,QAAA,MAAM,WAAW,0JAYf,CAAC;AAGH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TabsContent = exports.TabsTrigger = exports.TabsList = exports.Tabs = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const TabsPrimitive = __importStar(require("@radix-ui/react-tabs"));
39
+ const React = __importStar(require("react"));
40
+ const cn_1 = require("../cn");
41
+ const Tabs = TabsPrimitive.Root;
42
+ exports.Tabs = Tabs;
43
+ const TabsList = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(TabsPrimitive.List, { ref: ref, className: (0, cn_1.cn)("inline-flex h-10 items-center justify-center rounded-md bg-paper-elev/60 p-1 text-ink-3", className), ...props })));
44
+ exports.TabsList = TabsList;
45
+ TabsList.displayName = TabsPrimitive.List.displayName;
46
+ const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(TabsPrimitive.Trigger, { ref: ref, className: (0, cn_1.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-body-1 font-medium text-ink-2 ring-offset-background transition-[background-color,color,border-color,box-shadow] hover:text-ink data-[state=active]:bg-paper-elev data-[state=active]:text-ink data-[state=active]:shadow-[var(--shadow-2)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", className), ...props })));
47
+ exports.TabsTrigger = TabsTrigger;
48
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
49
+ const TabsContent = React.forwardRef(({ className, ...props }, ref) => ((0, jsx_runtime_1.jsx)(TabsPrimitive.Content, { ref: ref, className: (0, cn_1.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", className), ...props })));
50
+ exports.TabsContent = TabsContent;
51
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
52
+ //# sourceMappingURL=tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../../src/ui/primitives/tabs.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oEAAsD;AACtD,6CAA+B;AAE/B,8BAA2B;AAE3B,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,CAAC;AA+CvB,oBAAI;AA7Cb,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAG/B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,uBAAC,aAAa,CAAC,IAAI,IACjB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,OAAE,EACX,yFAAyF,EACzF,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AAiCY,4BAAQ;AAhCvB,QAAQ,CAAC,WAAW,GAAG,aAAa,CAAC,IAAI,CAAC,WAAW,CAAC;AAEtD,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAGlC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,uBAAC,aAAa,CAAC,OAAO,IACpB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,OAAE,EACX,wdAAwd,EACxd,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AAkBsB,kCAAW;AAjBpC,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;AAE5D,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAGlC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,uBAAC,aAAa,CAAC,OAAO,IACpB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,OAAE,EACX,iIAAiI,EACjI,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC,CAAC;AAGmC,kCAAW;AAFjD,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC"}
@@ -0,0 +1,19 @@
1
+ export interface TagOption {
2
+ value: string;
3
+ label: string;
4
+ hint?: string;
5
+ }
6
+ export interface TagMultiSelectProps {
7
+ value: string[];
8
+ onChange: (next: string[]) => void;
9
+ options: TagOption[];
10
+ placeholder?: string;
11
+ searchPlaceholder?: string;
12
+ emptyMessage?: string;
13
+ allowCustom?: boolean;
14
+ chipVariant?: 'default' | 'secondary' | 'success' | 'destructive';
15
+ triggerClassName?: string;
16
+ disabled?: boolean;
17
+ }
18
+ export declare function TagMultiSelect({ value, onChange, options, placeholder, searchPlaceholder, emptyMessage, allowCustom, chipVariant, triggerClassName, disabled, }: Readonly<TagMultiSelectProps>): import("react").JSX.Element;
19
+ //# sourceMappingURL=tag-multi-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag-multi-select.d.ts","sourceRoot":"","sources":["../../../src/ui/primitives/tag-multi-select.tsx"],"names":[],"mappings":"AAUA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACnC,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,WAAW,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC;IAElE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AASD,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAuB,EACvB,iBAA6B,EAC7B,YAA2B,EAC3B,WAAmB,EACnB,WAAuB,EACvB,gBAAgB,EAChB,QAAQ,GACT,EAAE,QAAQ,CAAC,mBAAmB,CAAC,+BA8L/B"}
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TagMultiSelect = TagMultiSelect;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const lucide_react_1 = require("lucide-react");
6
+ const react_1 = require("react");
7
+ const badge_1 = require("./badge");
8
+ const button_1 = require("./button");
9
+ const input_1 = require("./input");
10
+ const popover_1 = require("./popover");
11
+ const scroll_area_1 = require("./scroll-area");
12
+ const cn_1 = require("../cn");
13
+ const CHIP_CLASSES = {
14
+ default: 'bg-primary/10 text-primary border-primary/20',
15
+ secondary: 'bg-secondary text-secondary-foreground border-secondary',
16
+ success: 'bg-success/10 text-success border-success/20',
17
+ destructive: 'bg-destructive/10 text-destructive border-destructive/20',
18
+ };
19
+ function TagMultiSelect({ value, onChange, options, placeholder = 'Select…', searchPlaceholder = 'Search…', emptyMessage = 'No matches', allowCustom = false, chipVariant = 'default', triggerClassName, disabled, }) {
20
+ const [open, setOpen] = (0, react_1.useState)(false);
21
+ const [search, setSearch] = (0, react_1.useState)('');
22
+ const inputRef = (0, react_1.useRef)(null);
23
+ const selectedSet = (0, react_1.useMemo)(() => new Set(value), [value]);
24
+ const optionByValue = (0, react_1.useMemo)(() => {
25
+ const map = new Map();
26
+ options.forEach((o) => map.set(o.value, o));
27
+ return map;
28
+ }, [options]);
29
+ const filteredOptions = (0, react_1.useMemo)(() => {
30
+ const q = search.trim().toLowerCase();
31
+ if (!q)
32
+ return options;
33
+ return options.filter((o) => o.label.toLowerCase().includes(q) ||
34
+ o.value.toLowerCase().includes(q) ||
35
+ (o.hint?.toLowerCase().includes(q) ?? false));
36
+ }, [options, search]);
37
+ const normalizedSearch = search.trim();
38
+ const canAddCustom = allowCustom &&
39
+ normalizedSearch.length > 0 &&
40
+ !optionByValue.has(normalizedSearch) &&
41
+ !selectedSet.has(normalizedSearch);
42
+ const toggle = (val) => {
43
+ if (selectedSet.has(val)) {
44
+ onChange(value.filter((v) => v !== val));
45
+ }
46
+ else {
47
+ onChange([...value, val]);
48
+ }
49
+ };
50
+ const remove = (val, e) => {
51
+ e?.stopPropagation();
52
+ onChange(value.filter((v) => v !== val));
53
+ };
54
+ const addCustom = () => {
55
+ if (!canAddCustom)
56
+ return;
57
+ onChange([...value, normalizedSearch]);
58
+ setSearch('');
59
+ inputRef.current?.focus();
60
+ };
61
+ const onKeyDown = (e) => {
62
+ if (e.key === 'Enter') {
63
+ e.preventDefault();
64
+ if (canAddCustom) {
65
+ addCustom();
66
+ }
67
+ else if (filteredOptions.length === 1) {
68
+ toggle(filteredOptions[0].value);
69
+ }
70
+ }
71
+ };
72
+ const chipClass = CHIP_CLASSES[chipVariant];
73
+ return ((0, jsx_runtime_1.jsxs)(popover_1.Popover, { open: open, onOpenChange: setOpen, children: [(0, jsx_runtime_1.jsx)(popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)(button_1.Button, { variant: "outline", role: "combobox", "aria-expanded": open, disabled: disabled, className: (0, cn_1.cn)('w-full min-h-9 h-auto justify-between font-normal py-1.5', triggerClassName), children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-wrap gap-1 flex-1 text-left", children: [value.length === 0 && ((0, jsx_runtime_1.jsx)("span", { className: "text-ink-3 text-body-1", children: placeholder })), value.map((val) => {
74
+ const opt = optionByValue.get(val);
75
+ return ((0, jsx_runtime_1.jsxs)(badge_1.Badge, { variant: "outline", className: (0, cn_1.cn)('text-body-1 gap-1 pr-1', chipClass), children: [(0, jsx_runtime_1.jsx)("span", { className: "truncate max-w-[160px]", children: opt?.label ?? val }), (0, jsx_runtime_1.jsx)("span", { role: "button", tabIndex: -1, onClick: (e) => remove(val, e), onKeyDown: (e) => {
76
+ if (e.key === 'Enter' || e.key === ' ') {
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+ remove(val);
80
+ }
81
+ }, className: "rounded-sm hover:bg-paper-elev p-0.5", "aria-label": `Remove ${opt?.label ?? val}`, children: (0, jsx_runtime_1.jsx)(lucide_react_1.X, { className: "h-4 w-4" }) })] }, val));
82
+ })] }), (0, jsx_runtime_1.jsx)(lucide_react_1.ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })] }) }), (0, jsx_runtime_1.jsxs)(popover_1.PopoverContent, { className: "w-[--radix-popover-trigger-width] p-0", align: "start", onOpenAutoFocus: (e) => {
83
+ e.preventDefault();
84
+ setTimeout(() => inputRef.current?.focus(), 30);
85
+ }, children: [(0, jsx_runtime_1.jsxs)("div", { className: "relative border-b", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Search, { className: "absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-ink-3" }), (0, jsx_runtime_1.jsx)(input_1.Input, { ref: inputRef, value: search, onChange: (e) => setSearch(e.target.value), onKeyDown: onKeyDown, placeholder: searchPlaceholder, className: "h-9 text-body-1 pl-8 border-0 rounded-none focus-visible:ring-0 focus-visible:ring-offset-0" })] }), (0, jsx_runtime_1.jsx)(scroll_area_1.ScrollArea, { className: "max-h-56", children: (0, jsx_runtime_1.jsxs)("div", { className: "p-1", children: [filteredOptions.length === 0 && !canAddCustom && ((0, jsx_runtime_1.jsx)("p", { className: "text-body-1 text-ink-3 text-center py-3", children: emptyMessage })), filteredOptions.map((opt) => {
86
+ const selected = selectedSet.has(opt.value);
87
+ return ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: () => toggle(opt.value), className: (0, cn_1.cn)('w-full text-left text-body-1 px-2 py-1.5 rounded hover:bg-paper-elev transition-colors flex items-start gap-2', selected && 'bg-paper-elev/60'), children: [(0, jsx_runtime_1.jsx)("span", { className: (0, cn_1.cn)('mt-0.5 h-4 w-4 shrink-0 rounded border flex items-center justify-center', selected
88
+ ? 'bg-primary border-primary text-primary-foreground'
89
+ : 'border-muted-foreground/40'), children: selected && (0, jsx_runtime_1.jsx)(lucide_react_1.Check, { className: "h-4 w-4" }) }), (0, jsx_runtime_1.jsxs)("span", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsx)("span", { className: "font-medium block truncate", children: opt.label }), opt.hint && ((0, jsx_runtime_1.jsx)("span", { className: "text-body-1 text-ink-3 block truncate", children: opt.hint }))] })] }, opt.value));
90
+ }), canAddCustom && ((0, jsx_runtime_1.jsxs)("button", { type: "button", onClick: addCustom, className: "w-full text-left text-body-1 px-2 py-1.5 rounded hover:bg-paper-elev transition-colors flex items-center gap-2 border-t mt-1 pt-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Plus, { className: "h-4 w-4 text-ink-3" }), (0, jsx_runtime_1.jsxs)("span", { children: ["Add ", (0, jsx_runtime_1.jsx)("span", { className: "font-mono font-medium", children: normalizedSearch })] })] }))] }) })] })] }));
91
+ }
92
+ //# sourceMappingURL=tag-multi-select.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag-multi-select.js","sourceRoot":"","sources":["../../../src/ui/primitives/tag-multi-select.tsx"],"names":[],"mappings":";;AAuCA,wCAyMC;;AAhPD,+CAAsE;AACtE,iCAAsE;AAEtE,mCAAgC;AAChC,qCAAkC;AAClC,mCAAgC;AAChC,uCAAoE;AACpE,+CAA2C;AAC3C,8BAA2B;AAwB3B,MAAM,YAAY,GAAoE;IACpF,OAAO,EAAE,8CAA8C;IACvD,SAAS,EAAE,yDAAyD;IACpE,OAAO,EAAE,8CA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A,CACV,IACG,GACK,IACE,IACT,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ export type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>;
3
+ declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
4
+ export { Textarea };
5
+ //# sourceMappingURL=textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/ui/primitives/textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,CAAC;AAE9E,QAAA,MAAM,QAAQ,2FAWZ,CAAC;AAGH,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Textarea = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const React = __importStar(require("react"));
39
+ const cn_1 = require("../cn");
40
+ const Textarea = React.forwardRef(({ className, ...props }, ref) => {
41
+ return ((0, jsx_runtime_1.jsx)("textarea", { className: (0, cn_1.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-body-1 ring-offset-background placeholder:text-ink-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref, ...props }));
42
+ });
43
+ exports.Textarea = Textarea;
44
+ Textarea.displayName = "Textarea";
45
+ //# sourceMappingURL=textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/ui/primitives/textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAE/B,8BAA2B;AAI3B,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAqC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IACrG,OAAO,CACL,qCACE,SAAS,EAAE,IAAA,OAAE,EACX,+RAA+R,EAC/R,SAAS,CACV,EACD,GAAG,EAAE,GAAG,KACJ,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAGM,4BAAQ;AAFjB,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ import * as TooltipPrimitive from "@radix-ui/react-tooltip";
2
+ import * as React from "react";
3
+ declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
4
+ declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
5
+ declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
+ declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
8
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/ui/primitives/tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,eAAe,iDAA4B,CAAC;AAElD,QAAA,MAAM,OAAO,yCAAwB,CAAC;AAEtC,QAAA,MAAM,cAAc,gHAA2B,CAAC;AAEhD,QAAA,MAAM,cAAc,gKAelB,CAAC;AAGH,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TooltipProvider = exports.TooltipContent = exports.TooltipTrigger = exports.Tooltip = void 0;
37
+ const jsx_runtime_1 = require("react/jsx-runtime");
38
+ const TooltipPrimitive = __importStar(require("@radix-ui/react-tooltip"));
39
+ const React = __importStar(require("react"));
40
+ const cn_1 = require("../cn");
41
+ const TooltipProvider = TooltipPrimitive.Provider;
42
+ exports.TooltipProvider = TooltipProvider;
43
+ const Tooltip = TooltipPrimitive.Root;
44
+ exports.Tooltip = Tooltip;
45
+ const TooltipTrigger = TooltipPrimitive.Trigger;
46
+ exports.TooltipTrigger = TooltipTrigger;
47
+ const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => ((0, jsx_runtime_1.jsx)(TooltipPrimitive.Portal, { children: (0, jsx_runtime_1.jsx)(TooltipPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: (0, cn_1.cn)("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-body-1 text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props }) })));
48
+ exports.TooltipContent = TooltipContent;
49
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
50
+ //# sourceMappingURL=tooltip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/ui/primitives/tooltip.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0EAA4D;AAC5D,6CAA+B;AAE/B,8BAA2B;AAE3B,MAAM,eAAe,GAAG,gBAAgB,CAAC,QAAQ,CAAC;AAwBA,0CAAe;AAtBjE,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAsB7B,0BAAO;AApBhB,MAAM,cAAc,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAoB9B,wCAAc;AAlBhC,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClD,uBAAC,gBAAgB,CAAC,MAAM,cACtB,uBAAC,gBAAgB,CAAC,OAAO,IACvB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,IAAA,OAAE,EACX,wYAAwY,EACxY,SAAS,CACV,KACG,KAAK,GACT,GACsB,CAC3B,CAAC,CAAC;AAG+B,wCAAc;AAFhD,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xemahq/ui-kernel",
3
- "version": "0.1.12",
3
+ "version": "0.2.0",
4
4
  "description": "Host-framework-agnostic UI kernel for the Xema OS. Defines the SystemBus orchestration contract (capability.invoke, cross-biome intents, command palette, xema:// deeplinks, window manager) AND the biome-host contract surface (FrontendBiome/FrontendBiomeFactory, HostBridge, the singleton biomeRegistry, session contributions) that every frontend biome composes against. No Vite, Next.js, or React-Router — React itself IS allowed as the shared component model (the contracts traffic in ReactNode/ComponentType and a React context). Concrete host adapters (router/auth/toast wiring) live in separate packages that consume this kernel. The SystemBus is pure orchestration: it never authorizes, the backend capability-router enforces all policy.",
5
5
  "keywords": [
6
6
  "xema",
@@ -35,8 +35,26 @@
35
35
  "LICENSE"
36
36
  ],
37
37
  "dependencies": {
38
+ "@radix-ui/react-alert-dialog": "^1.1.14",
39
+ "@radix-ui/react-checkbox": "^1.3.2",
40
+ "@radix-ui/react-collapsible": "^1.1.11",
41
+ "@radix-ui/react-dialog": "^1.1.14",
42
+ "@radix-ui/react-dropdown-menu": "^2.1.15",
43
+ "@radix-ui/react-label": "^2.1.7",
44
+ "@radix-ui/react-popover": "^1.1.14",
45
+ "@radix-ui/react-radio-group": "^1.3.7",
46
+ "@radix-ui/react-scroll-area": "^1.2.9",
47
+ "@radix-ui/react-select": "^2.2.5",
48
+ "@radix-ui/react-separator": "^1.1.7",
49
+ "@radix-ui/react-slot": "^1.2.3",
50
+ "@radix-ui/react-switch": "^1.2.5",
51
+ "@radix-ui/react-tabs": "^1.1.12",
52
+ "@radix-ui/react-tooltip": "^1.2.7",
38
53
  "@xemahq/registry": "^0.1.3",
54
+ "class-variance-authority": "^0.7.1",
39
55
  "clsx": "^2.1.1",
56
+ "lucide-react": "^0.462.0",
57
+ "react-resizable-panels": "^4.9.0",
40
58
  "tailwind-merge": "^2.5.4"
41
59
  },
42
60
  "peerDependencies": {
@@ -64,6 +82,11 @@
64
82
  "xema-source": "./src/index.ts",
65
83
  "default": "./dist/index.js"
66
84
  },
85
+ "./ui": {
86
+ "types": "./dist/ui/index.d.ts",
87
+ "xema-source": "./src/ui/index.ts",
88
+ "default": "./dist/ui/index.js"
89
+ },
67
90
  "./*": {
68
91
  "types": "./dist/*/index.d.ts",
69
92
  "xema-source": "./src/*/index.ts",
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from './lib/system-bus';
2
2
  export * from './lib/biome-host';
3
+ export * from './lib/capabilities';
@@ -2,6 +2,7 @@ import type { QueryClient } from '@tanstack/react-query';
2
2
 
3
3
  import { createContext, useContext, type ReactNode } from 'react';
4
4
 
5
+ import type { CapabilityPort } from '../capabilities';
5
6
  import type { SystemBus } from '../system-bus';
6
7
 
7
8
  /**
@@ -191,6 +192,15 @@ export interface HostBridge {
191
192
  * policy / audit (see {@link SystemBus}).
192
193
  */
193
194
  readonly system: SystemBus;
195
+ /**
196
+ * Server-authoritative capability port — how a biome UI gates on the
197
+ * caller's effective capability set (`GET /bff/me/capabilities`) instead of
198
+ * cosmetic role booleans. The HOST implements this against its Orval client
199
+ * and maps the response onto the kernel's `MeCapabilitiesSnapshot` shape so
200
+ * the kernel stays fetch-free and host-agnostic. Consumed by
201
+ * `<CapabilityProvider>` + `useCapability()` (see `../capabilities`).
202
+ */
203
+ readonly capabilities: CapabilityPort;
194
204
  }
195
205
 
196
206
  export const HostBridgeContext = createContext<HostBridge | null>(null);
@@ -0,0 +1,95 @@
1
+ import { useQuery } from '@tanstack/react-query';
2
+ import { createContext, useContext, type ReactNode } from 'react';
3
+
4
+ import { useHostBridge } from '../biome-host/host-bridge';
5
+
6
+ import type { CapabilityPort, MeCapabilitiesSnapshot } from './types';
7
+
8
+ /**
9
+ * The value exposed by {@link CapabilityProvider} through React context.
10
+ * `snapshot` is `undefined` until the first successful fetch; `isLoading`
11
+ * and `error` let callers distinguish "still unknown" and "fetch failed"
12
+ * from "explicitly denied" — the gate hook must NOT treat an errored fetch
13
+ * as "no capabilities".
14
+ */
15
+ export interface CapabilityContextValue {
16
+ readonly snapshot: MeCapabilitiesSnapshot | undefined;
17
+ readonly isLoading: boolean;
18
+ readonly error: unknown;
19
+ }
20
+
21
+ const CapabilityContext = createContext<CapabilityContextValue | null>(null);
22
+ CapabilityContext.displayName = 'CapabilityContext';
23
+
24
+ /**
25
+ * Stable query-key root for the capability snapshot. Folded with the active
26
+ * org so each org caches independently and a re-fetch fires when the org
27
+ * changes — same tenant-isolation discipline as `useScopedQuery`.
28
+ */
29
+ const CAPABILITIES_QUERY_ROOT = ['xema', 'capabilities', 'me'] as const;
30
+
31
+ export interface CapabilityProviderProps {
32
+ readonly children: ReactNode;
33
+ /**
34
+ * Override the host-provided port. Defaults to `bridge.capabilities`. Exists
35
+ * for tests and for hosts that compose the provider outside a bridge subtree;
36
+ * production wiring reads it OFF the bridge so biomes need no extra prop.
37
+ */
38
+ readonly port?: CapabilityPort;
39
+ /**
40
+ * Override the active org. Defaults to `null` (the host's
41
+ * currently-selected org). When provided, the port is asked for that org and
42
+ * the cache key includes it.
43
+ */
44
+ readonly orgId?: string | null;
45
+ }
46
+
47
+ /**
48
+ * Fetches the caller's server-authoritative capability set once per active org
49
+ * and exposes it (plus loading/error) to descendants via React context.
50
+ *
51
+ * Wiring: the {@link CapabilityPort} is read OFF `HostBridge.capabilities`
52
+ * (not prop-drilled) — the same decoupling the rest of the kernel uses to
53
+ * reach the host. The active org is read from the bridge's auth source. The
54
+ * bridge's `QueryClient` (TanStack Query) owns caching/refetch; the kernel
55
+ * rolls no bespoke state. The query re-runs when the org changes because the
56
+ * org is part of the query key.
57
+ *
58
+ * Rendering is fail-soft (callers can show a loading state), but failures are
59
+ * SURFACED via `error` rather than masquerading as an empty capability set.
60
+ */
61
+ export function CapabilityProvider(props: CapabilityProviderProps): JSX.Element {
62
+ const bridge = useHostBridge();
63
+ const port = props.port ?? bridge.capabilities;
64
+ const orgId = props.orgId !== undefined ? props.orgId : bridge.auth.getOrgId();
65
+
66
+ const query = useQuery<MeCapabilitiesSnapshot>({
67
+ queryKey: [...CAPABILITIES_QUERY_ROOT, orgId],
68
+ queryFn: () => port.list(orgId ? { orgId } : undefined),
69
+ });
70
+
71
+ const value: CapabilityContextValue = {
72
+ snapshot: query.data,
73
+ isLoading: query.isLoading,
74
+ error: query.error,
75
+ };
76
+
77
+ return <CapabilityContext.Provider value={value}>{props.children}</CapabilityContext.Provider>;
78
+ }
79
+
80
+ /**
81
+ * Internal accessor for the capability context. Throws fail-fast if used
82
+ * outside {@link CapabilityProvider} — a missing provider is a wiring bug,
83
+ * not a "deny everything" condition.
84
+ */
85
+ export function useCapabilityContext(): CapabilityContextValue {
86
+ const ctx = useContext(CapabilityContext);
87
+ if (!ctx) {
88
+ throw new Error(
89
+ '[xema-ui-kernel] useCapability()/useCapabilities() called outside ' +
90
+ '<CapabilityProvider>. The host (or biome shell) must mount the ' +
91
+ 'capability provider above any capability-gated subtree.',
92
+ );
93
+ }
94
+ return ctx;
95
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Host-agnostic capabilities SDK for `@xemahq/ui-kernel`.
3
+ *
4
+ * Lets a biome UI gate on SERVER-AUTHORITATIVE capabilities (the caller's
5
+ * effective set from `GET /bff/me/capabilities`) instead of cosmetic role
6
+ * booleans. The kernel defines the contract and the React surface; it never
7
+ * fetches — the HOST implements {@link CapabilityPort} (hung off
8
+ * `HostBridge.capabilities`) and maps its Orval client response onto the
9
+ * local {@link MeCapabilitiesSnapshot} shape.
10
+ *
11
+ * Biome usage:
12
+ * import { CapabilityProvider, useCapability } from '@xemahq/ui-kernel';
13
+ */
14
+ export * from './types';
15
+ export * from './capability-provider';
16
+ export * from './use-capability';