@erxes/ui 4.0.0-v2.0 → 4.0.0-v2.2

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 (318) hide show
  1. package/README.md +11 -8
  2. package/dist/base.css +17 -4
  3. package/dist/components/accordion.d.ts +6 -7
  4. package/dist/components/accordion.js +8 -13
  5. package/dist/components/alert-dialog.d.ts +12 -11
  6. package/dist/components/alert-dialog.js +26 -29
  7. package/dist/components/alert.js +2 -2
  8. package/dist/components/avatar.d.ts +7 -5
  9. package/dist/components/avatar.js +30 -19
  10. package/dist/components/background-gradient-animation.d.ts +2 -11
  11. package/dist/components/background-gradient-animation.js +21 -50
  12. package/dist/components/badge.d.ts +3 -2
  13. package/dist/components/badge.js +36 -21
  14. package/dist/components/breadcrumb.d.ts +6 -4
  15. package/dist/components/breadcrumb.js +18 -14
  16. package/dist/components/button.d.ts +15 -7
  17. package/dist/components/button.js +46 -23
  18. package/dist/components/calendar.js +1 -1
  19. package/dist/components/card.js +1 -1
  20. package/dist/components/chart-config.d.ts +4 -18
  21. package/dist/components/chart-config.js +1 -6
  22. package/dist/components/charts.d.ts +1 -1
  23. package/dist/components/charts.js +20 -28
  24. package/dist/components/checkbox.d.ts +2 -3
  25. package/dist/components/checkbox.js +4 -6
  26. package/dist/components/choicebox-group.d.ts +1 -1
  27. package/dist/components/choicebox-group.js +5 -9
  28. package/dist/components/collapsible.d.ts +5 -9
  29. package/dist/components/collapsible.js +8 -25
  30. package/dist/components/color-picker.js +9 -8
  31. package/dist/components/combobox.d.ts +6 -6
  32. package/dist/components/combobox.js +19 -18
  33. package/dist/components/command-bar.js +22 -19
  34. package/dist/components/command.d.ts +18 -8
  35. package/dist/components/command.js +62 -26
  36. package/dist/components/context-menu.d.ts +17 -29
  37. package/dist/components/context-menu.js +20 -66
  38. package/dist/components/copy-text.js +7 -11
  39. package/dist/components/date-picker.js +21 -18
  40. package/dist/components/date-text-input.js +3 -3
  41. package/dist/components/date-time-input.d.ts +12 -0
  42. package/dist/components/date-time-input.js +21 -0
  43. package/dist/components/dialog.d.ts +17 -12
  44. package/dist/components/dialog.js +36 -32
  45. package/dist/components/drag-handle.d.ts +2 -2
  46. package/dist/components/drag-handle.js +0 -1
  47. package/dist/components/dropdown-menu.d.ts +35 -16
  48. package/dist/components/dropdown-menu.js +78 -37
  49. package/dist/components/empty.js +2 -2
  50. package/dist/components/form.d.ts +15 -6
  51. package/dist/components/form.js +34 -17
  52. package/dist/components/hover-card.d.ts +6 -5
  53. package/dist/components/hover-card.js +18 -9
  54. package/dist/components/info-card.js +5 -6
  55. package/dist/components/input-group.d.ts +22 -0
  56. package/dist/components/input-group.js +42 -0
  57. package/dist/components/input.d.ts +11 -2
  58. package/dist/components/input.js +21 -8
  59. package/dist/components/kbd.js +2 -2
  60. package/dist/components/label.d.ts +3 -3
  61. package/dist/components/label.js +9 -6
  62. package/dist/components/multiselect.d.ts +21 -6
  63. package/dist/components/multiselect.js +81 -127
  64. package/dist/components/on-demand.d.ts +17 -0
  65. package/dist/components/on-demand.js +42 -0
  66. package/dist/components/popover.d.ts +18 -9
  67. package/dist/components/popover.js +38 -13
  68. package/dist/components/radio-group.d.ts +5 -5
  69. package/dist/components/radio-group.js +23 -29
  70. package/dist/components/resizable.d.ts +8 -21
  71. package/dist/components/resizable.js +5 -10
  72. package/dist/components/scroll-area.d.ts +12 -7
  73. package/dist/components/scroll-area.js +18 -18
  74. package/dist/components/select.d.ts +22 -14
  75. package/dist/components/select.js +90 -51
  76. package/dist/components/separator.d.ts +3 -3
  77. package/dist/components/separator.js +8 -12
  78. package/dist/components/sheet.d.ts +15 -11
  79. package/dist/components/sheet.js +66 -50
  80. package/dist/components/sidebar/context.js +4 -4
  81. package/dist/components/sidebar/group.d.ts +9 -8
  82. package/dist/components/sidebar/group.js +18 -13
  83. package/dist/components/sidebar/layout.d.ts +7 -2
  84. package/dist/components/sidebar/layout.js +11 -3
  85. package/dist/components/sidebar/menu-sub.d.ts +4 -3
  86. package/dist/components/sidebar/menu-sub.js +13 -13
  87. package/dist/components/sidebar/menu.d.ts +6 -6
  88. package/dist/components/sidebar/menu.js +28 -40
  89. package/dist/components/sidebar/panel.js +38 -21
  90. package/dist/components/sidebar/root.d.ts +1 -2
  91. package/dist/components/sidebar/root.js +7 -8
  92. package/dist/components/sidebar/trigger.js +1 -1
  93. package/dist/components/sidebar-tree-indicator.js +4 -4
  94. package/dist/components/skeleton.d.ts +7 -1
  95. package/dist/components/skeleton.js +18 -2
  96. package/dist/components/slider.d.ts +5 -5
  97. package/dist/components/slider.js +20 -11
  98. package/dist/components/spinner.d.ts +2 -2
  99. package/dist/components/spinner.js +24 -188
  100. package/dist/components/string-array.js +2 -2
  101. package/dist/components/switch.d.ts +2 -3
  102. package/dist/components/switch.js +6 -8
  103. package/dist/components/table.d.ts +14 -3
  104. package/dist/components/table.js +33 -9
  105. package/dist/components/tabs.d.ts +34 -8
  106. package/dist/components/tabs.js +96 -23
  107. package/dist/components/text-overflow.d.ts +8 -10
  108. package/dist/components/text-overflow.js +33 -39
  109. package/dist/components/textarea.d.ts +8 -1
  110. package/dist/components/textarea.js +24 -3
  111. package/dist/components/toaster.d.ts +1 -0
  112. package/dist/components/toaster.js +41 -20
  113. package/dist/components/toggle-group.d.ts +5 -3
  114. package/dist/components/toggle-group.js +11 -12
  115. package/dist/components/toggle.d.ts +3 -4
  116. package/dist/components/toggle.js +6 -6
  117. package/dist/components/tooltip.d.ts +7 -6
  118. package/dist/components/tooltip.js +18 -8
  119. package/dist/components/upload.d.ts +7 -2
  120. package/dist/components/upload.js +28 -7
  121. package/dist/components.css +325 -0
  122. package/dist/constants/CountryPhoneCodes.d.ts +1 -1
  123. package/dist/constants/CountryPhoneCodes.js +2 -2
  124. package/dist/federation.d.ts +13 -0
  125. package/dist/federation.js +28 -0
  126. package/dist/fonts.css +1 -1
  127. package/dist/hooks/use-confirm.js +17 -19
  128. package/dist/hooks/use-toast.d.ts +14 -16
  129. package/dist/hooks/use-toast.js +13 -108
  130. package/dist/index.d.ts +13 -8
  131. package/dist/index.js +11 -7
  132. package/dist/lib/cn-tables.d.ts +27 -0
  133. package/dist/lib/cn-tables.js +128 -0
  134. package/dist/lib/utils.d.ts +14 -2
  135. package/dist/lib/utils.js +14 -6
  136. package/dist/modules/attachments/attachment-media.js +56 -56
  137. package/dist/modules/blocks/components/BarcodeAttribute.js +11 -8
  138. package/dist/modules/blocks/components/BarcodeSizeSettings.js +5 -6
  139. package/dist/modules/blocks/components/BlockEditor.js +14 -4
  140. package/dist/modules/blocks/components/BlockEditorInlineContent.d.ts +26 -36
  141. package/dist/modules/blocks/components/BlockEditorInlineContent.js +2 -2
  142. package/dist/modules/blocks/components/BlockToolbar.d.ts +6 -0
  143. package/dist/modules/blocks/components/BlockToolbar.js +19 -4
  144. package/dist/modules/blocks/components/CustomFileBlock.d.ts +13 -39
  145. package/dist/modules/blocks/components/CustomFileBlock.js +8 -9
  146. package/dist/modules/blocks/components/CustomImageBlock.d.ts +28 -78
  147. package/dist/modules/blocks/components/CustomImageBlock.js +20 -99
  148. package/dist/modules/blocks/components/CustomVideoBlock.d.ts +26 -63
  149. package/dist/modules/blocks/components/CustomVideoBlock.js +10 -8
  150. package/dist/modules/blocks/components/DocumentPlaceholderBlock.d.ts +13 -39
  151. package/dist/modules/blocks/components/DocumentPlaceholderBlock.js +1 -2
  152. package/dist/modules/blocks/components/Editor.d.ts +1 -1
  153. package/dist/modules/blocks/components/Editor.js +5 -4
  154. package/dist/modules/blocks/components/FontFamilyButton.js +25 -21
  155. package/dist/modules/blocks/components/FontSizeButton.js +26 -22
  156. package/dist/modules/blocks/components/GalleryBlock.d.ts +7 -25
  157. package/dist/modules/blocks/components/GalleryBlock.js +2 -35
  158. package/dist/modules/blocks/components/GalleryBlockContent.js +8 -3
  159. package/dist/modules/blocks/components/GalleryBlockParts.js +23 -21
  160. package/dist/modules/blocks/components/GalleryExternalHtml.d.ts +2 -0
  161. package/dist/modules/blocks/components/GalleryExternalHtml.js +36 -0
  162. package/dist/modules/blocks/components/ImageExternalHtml.d.ts +2 -0
  163. package/dist/modules/blocks/components/ImageExternalHtml.js +51 -0
  164. package/dist/modules/blocks/components/ImageStyleButton.js +22 -18
  165. package/dist/modules/blocks/components/LazyEditor.d.ts +9 -0
  166. package/dist/modules/blocks/components/LazyEditor.js +14 -0
  167. package/dist/modules/blocks/components/MediaBlockWrapper.d.ts +24 -0
  168. package/dist/modules/blocks/components/MediaBlockWrapper.js +98 -0
  169. package/dist/modules/blocks/components/SlashMenu.js +2 -2
  170. package/dist/modules/blocks/components/SuggestionMenu.js +5 -6
  171. package/dist/modules/blocks/components/TableColorPicker.d.ts +1 -1
  172. package/dist/modules/blocks/components/TableColorPicker.js +20 -27
  173. package/dist/modules/blocks/components/TableHandleWithRemove.js +34 -50
  174. package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.d.ts +2 -2
  175. package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.js +3 -4
  176. package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.d.ts +2 -2
  177. package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.js +3 -4
  178. package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.d.ts +3 -0
  179. package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.js +8 -0
  180. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.js +1 -1
  181. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.d.ts +2 -2
  182. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.js +5 -16
  183. package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.d.ts +1 -1
  184. package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.js +24 -20
  185. package/dist/modules/blocks/constant/blockEditorSchema.d.ts +268 -653
  186. package/dist/modules/blocks/constant/blockEditorSchema.js +33 -41
  187. package/dist/modules/blocks/constant/galleryBlockConfig.d.ts +1 -2
  188. package/dist/modules/blocks/constant/imageBlockConfig.d.ts +46 -0
  189. package/dist/modules/blocks/constant/imageBlockConfig.js +39 -0
  190. package/dist/modules/blocks/constant/toolbar/editorUIComponents.d.ts +2 -3
  191. package/dist/modules/blocks/constant/toolbar/editorUIComponents.js +7 -9
  192. package/dist/modules/blocks/hooks/toolbar/useCodeActive.js +5 -7
  193. package/dist/modules/blocks/hooks/toolbar/useStringStyle.d.ts +9 -0
  194. package/dist/modules/blocks/hooks/toolbar/useStringStyle.js +27 -0
  195. package/dist/modules/blocks/hooks/useBlockEditor.d.ts +2 -0
  196. package/dist/modules/blocks/hooks/useBlockEditor.js +9 -3
  197. package/dist/modules/blocks/hooks/useEditorValue.d.ts +2 -1
  198. package/dist/modules/blocks/hooks/useEditorValue.js +8 -19
  199. package/dist/modules/blocks/types/TextEditor.d.ts +3 -1
  200. package/dist/modules/blocks/types/toolbar/ImageStyleOption.d.ts +1 -1
  201. package/dist/modules/blocks/utils/getSlashMenuItems.js +0 -15
  202. package/dist/modules/blocks/utils/parseBlocks.d.ts +3 -1
  203. package/dist/modules/blocks/utils/parseBlocks.js +14 -1
  204. package/dist/modules/display/components/EmailDisplay.js +26 -27
  205. package/dist/modules/display/components/PhoneDisplay.js +2 -2
  206. package/dist/modules/display/components/RelativeDateDisplay.d.ts +2 -2
  207. package/dist/modules/display/components/RelativeDateDisplay.js +7 -10
  208. package/dist/modules/filter/components/FilterBar.js +6 -6
  209. package/dist/modules/filter/components/FilterDialog.js +13 -20
  210. package/dist/modules/filter/components/FilterPopover.js +20 -28
  211. package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -4
  212. package/dist/modules/hotkey/components/PopoverScoped.js +5 -5
  213. package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +3 -3
  214. package/dist/modules/hotkey/hooks/useScopedHotkeys.js +15 -24
  215. package/dist/modules/icons/components/IconComponent.d.ts +1 -1
  216. package/dist/modules/icons/components/IconPicker.js +15 -14
  217. package/dist/modules/inputs/components/ContactFieldParts.js +13 -14
  218. package/dist/modules/inputs/components/EmailFieldForm.js +2 -3
  219. package/dist/modules/inputs/components/FullNameField.js +6 -4
  220. package/dist/modules/inputs/components/PhoneFieldForm.js +2 -1
  221. package/dist/modules/layout/components/AppLayout.js +18 -20
  222. package/dist/modules/layout/components/AppLayoutPageSlot.js +1 -1
  223. package/dist/modules/layout/components/AppLayoutResizeHandle.js +1 -1
  224. package/dist/modules/layout/components/Page.d.ts +6 -1
  225. package/dist/modules/layout/components/Page.js +11 -3
  226. package/dist/modules/layout/components/PageHeader.d.ts +10 -3
  227. package/dist/modules/layout/components/PageHeader.js +23 -5
  228. package/dist/modules/navigation-menu/components/NavigationMenu.js +12 -15
  229. package/dist/modules/pickers/EntityPicker.d.ts +30 -0
  230. package/dist/modules/pickers/EntityPicker.js +60 -0
  231. package/dist/modules/pickers/SelectMember.d.ts +41 -0
  232. package/dist/modules/pickers/SelectMember.js +122 -0
  233. package/dist/modules/pickers/members.d.ts +30 -0
  234. package/dist/modules/pickers/members.js +18 -0
  235. package/dist/modules/record-field/components/NumberField.d.ts +2 -2
  236. package/dist/modules/record-field/components/NumberField.js +22 -25
  237. package/dist/modules/record-field/components/TextField.d.ts +3 -3
  238. package/dist/modules/record-field/components/TextField.js +25 -28
  239. package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +3 -1
  240. package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +18 -12
  241. package/dist/modules/record-table/components/CheckboxColumn.d.ts +4 -3
  242. package/dist/modules/record-table/components/CheckboxColumn.js +52 -35
  243. package/dist/modules/record-table/components/MoreColumn.js +4 -3
  244. package/dist/modules/record-table/components/RecordTable.d.ts +3 -2
  245. package/dist/modules/record-table/components/RecordTable.js +2 -1
  246. package/dist/modules/record-table/components/RecordTableCell.d.ts +6 -3
  247. package/dist/modules/record-table/components/RecordTableCell.js +17 -11
  248. package/dist/modules/record-table/components/RecordTableCellInline.d.ts +15 -4
  249. package/dist/modules/record-table/components/RecordTableCellInline.js +48 -24
  250. package/dist/modules/record-table/components/RecordTableColumnSelector.d.ts +1 -2
  251. package/dist/modules/record-table/components/RecordTableColumnSelector.js +48 -45
  252. package/dist/modules/record-table/components/RecordTableContainer.d.ts +8 -3
  253. package/dist/modules/record-table/components/RecordTableContainer.js +28 -16
  254. package/dist/modules/record-table/components/RecordTableCursor.js +4 -4
  255. package/dist/modules/record-table/components/RecordTableHead.d.ts +9 -4
  256. package/dist/modules/record-table/components/RecordTableHead.js +40 -34
  257. package/dist/modules/record-table/components/RecordTableHeader.js +24 -15
  258. package/dist/modules/record-table/components/RecordTableProvider.d.ts +30 -7
  259. package/dist/modules/record-table/components/RecordTableProvider.js +32 -22
  260. package/dist/modules/record-table/components/RecordTableRoot.d.ts +2 -1
  261. package/dist/modules/record-table/components/RecordTableRoot.js +7 -12
  262. package/dist/modules/record-table/components/RecordTableRow.d.ts +8 -1
  263. package/dist/modules/record-table/components/RecordTableRow.js +13 -12
  264. package/dist/modules/record-table/components/RecordTableRowList.d.ts +6 -1
  265. package/dist/modules/record-table/components/RecordTableRowList.js +28 -20
  266. package/dist/modules/record-table/components/RecordTableRowSkeleton.js +8 -12
  267. package/dist/modules/record-table/hooks/useColumnLayout.d.ts +2 -2
  268. package/dist/modules/record-table/hooks/useColumnLayout.js +8 -5
  269. package/dist/modules/record-table/hooks/useTablePreferences.d.ts +5 -5
  270. package/dist/modules/record-table/hooks/useTablePreferences.js +3 -3
  271. package/dist/modules/record-table/utils/columnLayout.d.ts +4 -4
  272. package/dist/modules/record-table/utils/columnLayout.js +7 -7
  273. package/dist/modules/record-table/utils/columnUtils.d.ts +3 -2
  274. package/dist/modules/record-table/utils/rowFields.d.ts +1 -0
  275. package/dist/modules/record-table/utils/rowFields.js +10 -9
  276. package/dist/state/sidebarPanelState.d.ts +5 -1
  277. package/dist/state/sidebarPanelState.js +4 -1
  278. package/dist/styles.css +3 -0
  279. package/dist/theme.css +104 -70
  280. package/dist/utils/file-storage.d.ts +1 -1
  281. package/dist/utils/plugin-runtime.d.ts +1 -1
  282. package/dist/utils/plugin-styles.d.ts +6 -0
  283. package/dist/utils/plugin-styles.js +53 -0
  284. package/dist/utils/record-timeline.d.ts +1 -1
  285. package/dist/utils/record-timeline.js +1 -1
  286. package/package.json +27 -22
  287. package/dist/components/multiselect-options.d.ts +0 -16
  288. package/dist/components/multiselect-options.js +0 -13
  289. package/dist/components/multiselect-parts.d.ts +0 -23
  290. package/dist/components/multiselect-parts.js +0 -62
  291. package/dist/components/multiselect-state.d.ts +0 -66
  292. package/dist/components/multiselect-state.js +0 -131
  293. package/dist/components/time-picker.d.ts +0 -10
  294. package/dist/components/time-picker.js +0 -33
  295. package/dist/components/toasts.d.ts +0 -21
  296. package/dist/components/toasts.js +0 -69
  297. package/dist/modules/blocks/hooks/toolbar/useFontFamily.d.ts +0 -2
  298. package/dist/modules/blocks/hooks/toolbar/useFontFamily.js +0 -24
  299. package/dist/modules/blocks/hooks/toolbar/useFontSize.d.ts +0 -2
  300. package/dist/modules/blocks/hooks/toolbar/useFontSize.js +0 -24
  301. package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.d.ts +0 -6
  302. package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.js +0 -0
  303. package/dist/modules/blocks/types/toolbar/FontFamily.d.ts +0 -5
  304. package/dist/modules/blocks/types/toolbar/FontFamily.js +0 -0
  305. package/dist/modules/blocks/types/toolbar/FontSize.d.ts +0 -5
  306. package/dist/modules/blocks/types/toolbar/FontSize.js +0 -0
  307. package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.d.ts +0 -4
  308. package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.js +0 -0
  309. package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.d.ts +0 -3
  310. package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.js +0 -0
  311. package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.d.ts +0 -2
  312. package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.js +0 -30
  313. package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.d.ts +0 -2
  314. package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.js +0 -41
  315. package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.d.ts +0 -9
  316. package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.js +0 -15
  317. package/dist/modules/hotkey/states/internal/pendingHotkeyState.d.ts +0 -4
  318. package/dist/modules/hotkey/states/internal/pendingHotkeyState.js +0 -4
@@ -1,20 +1,38 @@
1
1
  import { Separator } from "../../../components/separator.js";
2
2
  import { cn } from "../../../lib/utils.js";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { cva } from "class-variance-authority";
4
5
  // src/modules/layout/components/PageHeader.tsx
5
- const PageHeaderRoot = ({ ref, children, className, separatorClassName, ...props }) => /* @__PURE__ */ jsxs("div", {
6
+ const pageHeaderVariants = cva("box-border flex shrink-0 items-center justify-between bg-background px-3 navigation-collapsed:pl-13 styled-scroll", {
7
+ variants: { variant: {
8
+ default: "h-10 gap-8 overflow-auto",
9
+ wrap: "h-auto min-h-10 flex-wrap gap-x-3 gap-y-1 overflow-visible py-1"
10
+ } },
11
+ defaultVariants: { variant: "default" }
12
+ });
13
+ const PageHeaderRoot = ({ ref, children, className, separatorClassName, variant, ...props }) => /* @__PURE__ */ jsxs("div", {
6
14
  ref,
7
15
  ...props,
8
16
  children: [/* @__PURE__ */ jsx("header", {
9
- className: cn("box-border flex h-10 shrink-0 items-center justify-between overflow-auto bg-background px-3 styled-scroll", className),
17
+ className: cn(pageHeaderVariants({ variant }), className),
10
18
  children
11
19
  }), /* @__PURE__ */ jsx(Separator, { className: cn("w-auto flex-none", separatorClassName) })]
12
20
  });
13
- const PageHeaderStart = ({ ref, children, className, ...props }) => /* @__PURE__ */ jsx("div", {
21
+ const pageHeaderStartVariants = cva("flex flex-none items-center gap-2", {
22
+ variants: { variant: {
23
+ default: "",
24
+ flush: "[&>nav:first-of-type>ol>li:first-child_a]:-ml-2 [&>nav:first-of-type>ol>li:first-child_a]:pl-2 [&>nav:first-of-type>ol>li:first-child_button]:-ml-2 [&>nav:first-of-type>ol>li:first-child_button]:pl-2"
25
+ } },
26
+ defaultVariants: { variant: "default" }
27
+ });
28
+ const PageHeaderStart = ({ ref, children, className, variant, ...props }) => /* @__PURE__ */ jsxs("div", {
14
29
  ref,
15
- className: cn("flex flex-none items-center gap-2 pr-8", className),
30
+ className: cn(pageHeaderStartVariants({ variant }), className),
16
31
  ...props,
17
- children
32
+ children: [/* @__PURE__ */ jsx("span", {
33
+ "data-sidebar-panel-slot": "",
34
+ className: "contents"
35
+ }), children]
18
36
  });
19
37
  const PageHeaderEnd = ({ ref, children, className, ...props }) => /* @__PURE__ */ jsx("div", {
20
38
  ref,
@@ -11,27 +11,24 @@ const NavigationMenuLinkItem = ({ ref, name, icon: IconComponent, path, pathPref
11
11
  const controls = useNavigationMenuItemControls();
12
12
  const order = controls?.getOrder(fullPath);
13
13
  return /* @__PURE__ */ jsxs(Sidebar.MenuItem, {
14
- className: itemClassName,
14
+ className: cn(itemClassName, order !== void 0 && "order-(--order)"),
15
15
  "data-nav-path": controls ? fullPath : void 0,
16
- style: order === void 0 ? void 0 : { order },
16
+ style: { "--order": order },
17
17
  children: [
18
- /* @__PURE__ */ jsx(Sidebar.MenuButton, {
19
- asChild: true,
18
+ /* @__PURE__ */ jsxs(Sidebar.MenuButton, {
20
19
  isActive: isActiveProp === true || isActive,
21
20
  ref,
22
21
  className,
23
22
  ...props,
24
- children: /* @__PURE__ */ jsxs(Link, {
25
- to: fullPath,
26
- children: [
27
- IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: cn("text-accent-foreground", isActive && "text-primary") }),
28
- label || /* @__PURE__ */ jsx("span", {
29
- className: "min-w-0 flex-1 truncate capitalize",
30
- children: name
31
- }),
32
- children
33
- ]
34
- })
23
+ render: /* @__PURE__ */ jsx(Link, { to: fullPath }),
24
+ children: [
25
+ IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: cn("text-accent-foreground", isActive && "text-primary-text") }),
26
+ label || /* @__PURE__ */ jsx("span", {
27
+ className: "min-w-0 flex-1 truncate capitalize",
28
+ children: name
29
+ }),
30
+ children
31
+ ]
35
32
  }),
36
33
  action,
37
34
  controls?.renderActions({
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from "react";
2
+ interface EntityPickerProps<T, K extends string> {
3
+ items: T[];
4
+ /** The id and the text a search matches. */
5
+ itemKey: (item: T) => {
6
+ id: K;
7
+ label: string;
8
+ };
9
+ /** How an item reads in the list; its label by default. */
10
+ renderItem?: (item: T) => ReactNode;
11
+ value: K[];
12
+ /** The picked ids. One pick replaces the value unless `multiple`, where it toggles. */
13
+ onValueChange: (ids: K[]) => void;
14
+ multiple?: boolean;
15
+ /** Items keep their order (a tree reads top down); otherwise the picked ones come first. */
16
+ keepOrder?: boolean;
17
+ loading?: boolean;
18
+ error?: Error | null;
19
+ /** Searching on the server: `items` are already the matches, so they are not filtered here. */
20
+ onSearchChange?: (search: string) => void;
21
+ searchPlaceholder?: string;
22
+ /** A first row that picks nothing. */
23
+ noneLabel?: string;
24
+ /** Above the list, e.g. the picked tags as badges. */
25
+ header?: ReactNode;
26
+ /** A row for what was searched, e.g. "Add tag: VIP"; `clear` empties the search. */
27
+ renderCreate?: (search: string, clear: () => void) => ReactNode;
28
+ }
29
+ export declare const EntityPicker: <T, K extends string = string>({ items, itemKey, renderItem, value, onValueChange, multiple, keepOrder, loading, error, onSearchChange, searchPlaceholder, noneLabel, header, renderCreate }: EntityPickerProps<T, K>) => import("react").JSX.Element;
30
+ export {};
@@ -0,0 +1,60 @@
1
+ import { Combobox } from "../../components/combobox.js";
2
+ import { Command } from "../../components/command.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { useState } from "react";
5
+ // src/modules/pickers/EntityPicker.tsx
6
+ const EntityPicker = ({ items, itemKey, renderItem, value, onValueChange, multiple, keepOrder, loading, error, onSearchChange, searchPlaceholder, noneLabel, header, renderCreate }) => {
7
+ const [search, setSearch] = useState("");
8
+ const [pickedAtOpen] = useState(value);
9
+ const term = search.trim().toLowerCase();
10
+ const matches = items.map((item) => ({
11
+ item,
12
+ ...itemKey(item)
13
+ })).filter((row) => onSearchChange !== void 0 || row.label.toLowerCase().includes(term));
14
+ const rows = keepOrder ? matches : matches.toSorted((a, b) => Number(pickedAtOpen.includes(b.id)) - Number(pickedAtOpen.includes(a.id)));
15
+ const pick = (id) => onValueChange(!multiple ? [id] : value.includes(id) ? value.filter((item) => item !== id) : [...value, id]);
16
+ const changeSearch = (next) => {
17
+ setSearch(next);
18
+ onSearchChange?.(next);
19
+ };
20
+ return /* @__PURE__ */ jsxs(Command, {
21
+ shouldFilter: false,
22
+ children: [
23
+ /* @__PURE__ */ jsx(Command.Input, {
24
+ value: search,
25
+ onValueChange: changeSearch,
26
+ placeholder: searchPlaceholder,
27
+ variant: "secondary",
28
+ wrapperClassName: "flex-auto",
29
+ focusOnMount: true
30
+ }),
31
+ header,
32
+ error && /* @__PURE__ */ jsx("p", {
33
+ role: "alert",
34
+ className: "text-destructive px-3 py-2 text-sm",
35
+ children: error.message
36
+ }),
37
+ /* @__PURE__ */ jsxs(Command.List, {
38
+ className: "max-h-75 overflow-y-auto",
39
+ children: [
40
+ noneLabel && !term && /* @__PURE__ */ jsxs(Command.Item, {
41
+ value: "__none__",
42
+ onSelect: () => onValueChange([]),
43
+ children: [/* @__PURE__ */ jsx("span", {
44
+ className: "text-muted-foreground",
45
+ children: noneLabel
46
+ }), /* @__PURE__ */ jsx(Combobox.Check, { checked: value.length === 0 })]
47
+ }),
48
+ renderCreate?.(search.trim(), () => changeSearch("")),
49
+ !error && /* @__PURE__ */ jsx(Combobox.Empty, { loading }),
50
+ rows.map(({ item, id, label }) => /* @__PURE__ */ jsxs(Command.Item, {
51
+ value: id,
52
+ onSelect: () => pick(id),
53
+ children: [renderItem ? renderItem(item) : label, /* @__PURE__ */ jsx(Combobox.Check, { checked: value.includes(id) })]
54
+ }, id))
55
+ ]
56
+ })
57
+ ]
58
+ });
59
+ };
60
+ export { EntityPicker };
@@ -0,0 +1,41 @@
1
+ import { AvatarProps } from "../../components/avatar.js";
2
+ import { Combobox } from "../../components/combobox.js";
3
+ import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
4
+ import { MemberQueries } from "./members.js";
5
+ import { ComponentProps, ComponentRef, RefAttributes } from "react";
6
+ /** One member by id: avatar and name, or the placeholder when there is none. */
7
+ export declare const MemberInline: ({ memberId, members, placeholder, size, className }: {
8
+ memberId: string | null | undefined;
9
+ members: MemberQueries;
10
+ placeholder?: string;
11
+ size?: AvatarProps['size'];
12
+ className?: string;
13
+ }) => import("react").JSX.Element;
14
+ interface SelectMemberProps {
15
+ value: string | null | undefined;
16
+ onValueChange: (id: string | null) => void;
17
+ /** Where the members come from: `memberQueries` from `@erxes/core-contract/client`. */
18
+ members: MemberQueries;
19
+ placeholder?: string;
20
+ /** A first row that picks no member, e.g. "Anyone" on a filter. */
21
+ noneLabel?: string;
22
+ }
23
+ /** The member as a record table cell; click to pick another. */
24
+ declare const SelectMemberInlineCell: ({ ref, value, onValueChange, members, noneLabel, scope, placeholder, size, className, variant, id, 'aria-label': ariaLabel }: SelectMemberProps & {
25
+ scope?: string;
26
+ size?: AvatarProps['size'];
27
+ className?: string;
28
+ /** `field` beside its label in a side panel; a table cell by default. */
29
+ variant?: ComponentProps<typeof RecordTableInlineCell.Trigger>['variant'];
30
+ id?: string;
31
+ /** Names the picker while it shows no member. */
32
+ 'aria-label'?: string;
33
+ } & RefAttributes<ComponentRef<typeof RecordTableInlineCell.Trigger>>) => import("react").JSX.Element;
34
+ /** A member picker button; its other props (an id, `Form.Control`'s aria wiring) go to the button. */
35
+ declare const SelectMemberField: ({ value, onValueChange, members, noneLabel, placeholder, className, ...trigger }: SelectMemberProps & Omit<ComponentProps<typeof Combobox.Trigger>, 'value' | 'children' | 'placeholder'>) => import("react").JSX.Element;
36
+ /** The member picker as a table cell and as a field. */
37
+ export declare const SelectMember: {
38
+ InlineCell: typeof SelectMemberInlineCell;
39
+ Field: typeof SelectMemberField;
40
+ };
41
+ export {};
@@ -0,0 +1,122 @@
1
+ import { Avatar } from "../../components/avatar.js";
2
+ import { Badge } from "../../components/badge.js";
3
+ import { Combobox } from "../../components/combobox.js";
4
+ import { Popover } from "../../components/popover.js";
5
+ import { cn } from "../../lib/utils.js";
6
+ import { readImage } from "../../utils/core.js";
7
+ import { PopoverScoped } from "../hotkey/components/PopoverScoped.js";
8
+ import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
9
+ import { EntityPicker } from "./EntityPicker.js";
10
+ import { memberName, useMembersById } from "./members.js";
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ import { useState } from "react";
13
+ import { useQuery } from "@tanstack/react-query";
14
+ // src/modules/pickers/SelectMember.tsx
15
+ /** A member's name, with an "Inactive" badge for disabled ones. */
16
+ const MemberLabel = ({ member }) => member.status === "active" ? /* @__PURE__ */ jsx(Fragment, { children: memberName(member) }) : /* @__PURE__ */ jsxs("span", {
17
+ className: "inline-flex items-center gap-1",
18
+ children: [/* @__PURE__ */ jsx("span", { children: memberName(member) }), /* @__PURE__ */ jsx(Badge, {
19
+ variant: "destructive",
20
+ size: "sm",
21
+ className: "h-5 shrink-0",
22
+ children: "Inactive"
23
+ })]
24
+ });
25
+ /** One member by id: avatar and name, or the placeholder when there is none. */
26
+ const MemberInline = ({ memberId, members, placeholder, size = "lg", className }) => {
27
+ const member = useMembersById([memberId], members).get(memberId ?? "");
28
+ return /* @__PURE__ */ jsxs(Fragment, { children: [member && /* @__PURE__ */ jsxs(Avatar, {
29
+ size,
30
+ children: [/* @__PURE__ */ jsx(Avatar.Image, { src: readImage(member.avatarUrl) }), /* @__PURE__ */ jsx(Avatar.Fallback, { children: memberName(member).charAt(0) })]
31
+ }), /* @__PURE__ */ jsx(Combobox.Value, {
32
+ value: member && /* @__PURE__ */ jsx(MemberLabel, { member }),
33
+ loading: Boolean(memberId) && !member,
34
+ placeholder: placeholder ?? "Select a member",
35
+ className
36
+ })] });
37
+ };
38
+ /** Active members, searched on their name and email; picking one reports its id. */
39
+ const MemberList = ({ value, members, noneLabel, onPick }) => {
40
+ const team = useQuery(members.team);
41
+ return /* @__PURE__ */ jsx(EntityPicker, {
42
+ items: team.data?.data ?? [],
43
+ itemKey: (member) => ({
44
+ id: member.id,
45
+ label: `${memberName(member)} ${member.email}`
46
+ }),
47
+ renderItem: (member) => /* @__PURE__ */ jsx(MemberInline, {
48
+ memberId: member.id,
49
+ members,
50
+ placeholder: "Unnamed user"
51
+ }),
52
+ value: value ? [value] : [],
53
+ onValueChange: ([id]) => onPick(id ?? null),
54
+ noneLabel,
55
+ loading: team.isPending,
56
+ error: team.error
57
+ });
58
+ };
59
+ /** The member as a record table cell; click to pick another. */
60
+ const SelectMemberInlineCell = ({ ref, value, onValueChange, members, noneLabel, scope, placeholder, size = "lg", className, variant, id, "aria-label": ariaLabel }) => {
61
+ const [open, setOpen] = useState(false);
62
+ return /* @__PURE__ */ jsxs(PopoverScoped, {
63
+ scope,
64
+ open,
65
+ onOpenChange: setOpen,
66
+ children: [/* @__PURE__ */ jsx(RecordTableInlineCell.Trigger, {
67
+ ref,
68
+ id,
69
+ "aria-label": ariaLabel,
70
+ variant,
71
+ className,
72
+ children: /* @__PURE__ */ jsx("span", {
73
+ className: "contents text-xs",
74
+ children: /* @__PURE__ */ jsx(MemberInline, {
75
+ memberId: value,
76
+ members,
77
+ placeholder: placeholder ?? "",
78
+ size
79
+ })
80
+ })
81
+ }), /* @__PURE__ */ jsx(RecordTableInlineCell.Content, { children: /* @__PURE__ */ jsx(MemberList, {
82
+ value,
83
+ members,
84
+ noneLabel,
85
+ onPick: (next) => {
86
+ onValueChange(next);
87
+ setOpen(false);
88
+ }
89
+ }) })]
90
+ });
91
+ };
92
+ /** A member picker button; its other props (an id, `Form.Control`'s aria wiring) go to the button. */
93
+ const SelectMemberField = ({ value, onValueChange, members, noneLabel, placeholder, className, ...trigger }) => {
94
+ const [open, setOpen] = useState(false);
95
+ return /* @__PURE__ */ jsxs(Popover, {
96
+ open,
97
+ onOpenChange: setOpen,
98
+ children: [/* @__PURE__ */ jsx(Combobox.Trigger, {
99
+ ...trigger,
100
+ className: cn("w-full", className),
101
+ children: /* @__PURE__ */ jsx(MemberInline, {
102
+ memberId: value,
103
+ members,
104
+ placeholder
105
+ })
106
+ }), /* @__PURE__ */ jsx(Combobox.Content, { children: /* @__PURE__ */ jsx(MemberList, {
107
+ value,
108
+ members,
109
+ noneLabel,
110
+ onPick: (next) => {
111
+ onValueChange(next);
112
+ setOpen(false);
113
+ }
114
+ }) })]
115
+ });
116
+ };
117
+ /** The member picker as a table cell and as a field. */
118
+ const SelectMember = {
119
+ InlineCell: SelectMemberInlineCell,
120
+ Field: SelectMemberField
121
+ };
122
+ export { MemberInline, SelectMember };
@@ -0,0 +1,30 @@
1
+ import { UseQueryOptions } from "@tanstack/react-query";
2
+ /** A team member as the pickers show one: core's `User` has these fields and more. */
3
+ export interface Member {
4
+ id: string;
5
+ email: string;
6
+ fullName: string | null;
7
+ username: string | null;
8
+ avatarUrl: string | null;
9
+ status: string;
10
+ }
11
+ type MemberQuery = UseQueryOptions<{
12
+ data: Member[];
13
+ }, Error, {
14
+ data: Member[];
15
+ }>;
16
+ /**
17
+ * Where members come from, as TanStack query options. erxes-ui knows nothing of core: web and
18
+ * plugin UIs pass `memberQueries` from `@erxes/core-contract/client`.
19
+ */
20
+ export interface MemberQueries {
21
+ /** The active team: every picker's list, and the names most screens show. */
22
+ team: MemberQuery;
23
+ /** Members by id, for those outside the active team (disabled ones). */
24
+ byIds: (ids: string[]) => MemberQuery;
25
+ }
26
+ /** How a member reads: the display name, else the username, else the email. */
27
+ export declare const memberName: (member: Pick<Member, 'fullName' | 'username' | 'email'>) => string;
28
+ /** Members by id, any status. The active team answers most; only the rest are fetched. */
29
+ export declare const useMembersById: (ids: (string | null | undefined)[], members: MemberQueries) => Map<string, Member>;
30
+ export {};
@@ -0,0 +1,18 @@
1
+ import { useMemo } from "react";
2
+ import { keepPreviousData, useQuery } from "@tanstack/react-query";
3
+ // src/modules/pickers/members.ts
4
+ /** How a member reads: the display name, else the username, else the email. */
5
+ const memberName = (member) => member.fullName || member.username || member.email;
6
+ /** Members by id, any status. The active team answers most; only the rest are fetched. */
7
+ const useMembersById = (ids, members) => {
8
+ const team = useQuery(members.team);
9
+ const known = useMemo(() => new Set((team.data?.data ?? []).map((user) => user.id)), [team.data]);
10
+ const wanted = useMemo(() => [...new Set(ids.filter((id) => Boolean(id) && !known.has(id ?? "")))].toSorted((a, b) => a.localeCompare(b)), [ids, known]);
11
+ const others = useQuery({
12
+ ...members.byIds(wanted),
13
+ enabled: team.isFetched && wanted.length > 0,
14
+ placeholderData: keepPreviousData
15
+ });
16
+ return useMemo(() => new Map([...team.data?.data ?? [], ...others.data?.data ?? []].map((user) => [user.id, user])), [team.data, others.data]);
17
+ };
18
+ export { memberName, useMembersById };
@@ -1,6 +1,6 @@
1
- import { ButtonProps } from "../../../components/button.js";
1
+ import { RecordTableInlineCell } from "../../record-table/components/RecordTableCellInline.js";
2
2
  import React from "react";
3
- type NumberFieldProps = ButtonProps & React.RefAttributes<HTMLButtonElement> & {
3
+ type NumberFieldProps = React.ComponentProps<typeof RecordTableInlineCell.Trigger> & {
4
4
  placeholder?: string;
5
5
  value: number;
6
6
  scope: string;
@@ -2,8 +2,8 @@ import { Input } from "../../../components/input.js";
2
2
  import { TextOverflowTooltip } from "../../../components/text-overflow.js";
3
3
  import { PopoverScoped } from "../../hotkey/components/PopoverScoped.js";
4
4
  import { RecordTableInlineCell } from "../../record-table/components/RecordTableCellInline.js";
5
- import { useState } from "react";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useState } from "react";
7
7
  // src/modules/record-field/components/NumberField.tsx
8
8
  const NumberField = ({ placeholder, value, scope, onSave, onValueChange, formatValue, children, ...props }) => {
9
9
  const [isOpen, setIsOpen] = useState(false);
@@ -38,30 +38,27 @@ const NumberField = ({ placeholder, value, scope, onSave, onValueChange, formatV
38
38
  children: [/* @__PURE__ */ jsxs(RecordTableInlineCell.Trigger, {
39
39
  ...props,
40
40
  children: [children, /* @__PURE__ */ jsx(TextOverflowTooltip, { value: shown ?? placeholder })]
41
- }), /* @__PURE__ */ jsx(RecordTableInlineCell.Content, {
42
- asChild: true,
43
- children: /* @__PURE__ */ jsxs("form", {
44
- onSubmit: handleAction,
45
- children: [/* @__PURE__ */ jsx(Input, {
46
- type: "text",
47
- value: editingValue.toLocaleString(),
48
- onChange: (e) => {
49
- const rawValue = e.target.value.replace(/,/g, "");
50
- if (/^-?\d*\.?\d*$/.test(rawValue)) {
51
- setEditingValue(rawValue);
52
- setIsEdited(true);
53
- const numValue = Number(rawValue);
54
- if (!isNaN(numValue)) onValueChange?.(numValue);
55
- }
56
- setIsOpen(true);
57
- },
58
- onKeyDown: handleKeyDown
59
- }), /* @__PURE__ */ jsx("button", {
60
- type: "submit",
61
- className: "sr-only",
62
- children: "Save"
63
- })]
64
- })
41
+ }), /* @__PURE__ */ jsxs(RecordTableInlineCell.Content, {
42
+ render: /* @__PURE__ */ jsx("form", { onSubmit: handleAction }),
43
+ children: [/* @__PURE__ */ jsx(Input, {
44
+ type: "text",
45
+ value: editingValue.toLocaleString(),
46
+ onChange: (e) => {
47
+ const rawValue = e.target.value.replace(/,/g, "");
48
+ if (/^-?\d*\.?\d*$/.test(rawValue)) {
49
+ setEditingValue(rawValue);
50
+ setIsEdited(true);
51
+ const numValue = Number(rawValue);
52
+ if (!isNaN(numValue)) onValueChange?.(numValue);
53
+ }
54
+ setIsOpen(true);
55
+ },
56
+ onKeyDown: handleKeyDown
57
+ }), /* @__PURE__ */ jsx("button", {
58
+ type: "submit",
59
+ className: "sr-only",
60
+ children: "Save"
61
+ })]
65
62
  })]
66
63
  });
67
64
  };
@@ -1,6 +1,6 @@
1
- import { ButtonProps } from "../../../components/button.js";
1
+ import { RecordTableInlineCell } from "../../record-table/components/RecordTableCellInline.js";
2
2
  import React from "react";
3
- type TextFieldProps = ButtonProps & React.RefAttributes<HTMLButtonElement> & {
3
+ type TextFieldProps = React.ComponentProps<typeof RecordTableInlineCell.Trigger> & {
4
4
  placeholder?: string;
5
5
  value: string;
6
6
  scope?: string;
@@ -8,5 +8,5 @@ type TextFieldProps = ButtonProps & React.RefAttributes<HTMLButtonElement> & {
8
8
  onSave?: (value: string) => void;
9
9
  defaultOpen?: boolean;
10
10
  };
11
- export declare const TextField: ({ ref, placeholder, value, scope, onSave, onValueChange, defaultOpen, children, ...props }: TextFieldProps) => React.JSX.Element;
11
+ export declare const TextField: ({ ref, placeholder, value, scope, onSave, onValueChange, defaultOpen, variant, children, ...props }: TextFieldProps) => React.JSX.Element;
12
12
  export {};
@@ -1,12 +1,11 @@
1
1
  import { Input } from "../../../components/input.js";
2
2
  import { TextOverflowTooltip } from "../../../components/text-overflow.js";
3
- import { cn } from "../../../lib/utils.js";
4
3
  import { PopoverScoped } from "../../hotkey/components/PopoverScoped.js";
5
4
  import { RecordTableInlineCell } from "../../record-table/components/RecordTableCellInline.js";
6
- import { useState } from "react";
7
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { useState } from "react";
8
7
  // src/modules/record-field/components/TextField.tsx
9
- const TextField = ({ ref, placeholder, value, scope, onSave, onValueChange, defaultOpen = false, children, ...props }) => {
8
+ const TextField = ({ ref, placeholder, value, scope, onSave, onValueChange, defaultOpen = false, variant = "input", children, ...props }) => {
10
9
  const [isOpen, setIsOpen] = useState(defaultOpen);
11
10
  const [editingValue, setEditingValue] = useState(value);
12
11
  /** Saves a changed text value and closes the inline editor. */
@@ -26,39 +25,37 @@ const TextField = ({ ref, placeholder, value, scope, onSave, onValueChange, defa
26
25
  modal: false,
27
26
  scope,
28
27
  open: isOpen,
29
- onOpenChange: (open) => {
28
+ onOpenChange: (open, details) => {
29
+ if (details?.reason === "escape-key") {
30
+ setEditingValue(value);
31
+ setIsOpen(false);
32
+ return;
33
+ }
30
34
  setIsOpen(open);
31
35
  if (open) setEditingValue(value);
32
36
  else if (editingValue !== value) onSave?.(editingValue);
33
37
  },
34
38
  children: [/* @__PURE__ */ jsxs(RecordTableInlineCell.Trigger, {
35
- className: cn("shadow-xs rounded-sm", props.className),
39
+ variant,
40
+ empty: !value,
36
41
  ...props,
37
42
  ref,
38
43
  children: [children, /* @__PURE__ */ jsx(TextOverflowTooltip, { value: (isOpen ? editingValue : value) || placeholder })]
39
- }), /* @__PURE__ */ jsx(RecordTableInlineCell.Content, {
40
- asChild: true,
41
- onEscapeKeyDown: (event) => {
42
- event.preventDefault();
43
- setEditingValue(value);
44
- setIsOpen(false);
45
- },
46
- children: /* @__PURE__ */ jsxs("form", {
47
- onSubmit: handleAction,
48
- children: [/* @__PURE__ */ jsx(Input, {
49
- placeholder,
50
- value: editingValue,
51
- onChange: (e) => {
52
- setEditingValue(e.target.value);
53
- onValueChange?.(e.target.value);
54
- },
55
- onKeyDown: handleKeyDown
56
- }), /* @__PURE__ */ jsx("button", {
57
- type: "submit",
58
- className: "sr-only",
59
- children: "Save"
60
- })]
61
- })
44
+ }), /* @__PURE__ */ jsxs(RecordTableInlineCell.Content, {
45
+ render: /* @__PURE__ */ jsx("form", { onSubmit: handleAction }),
46
+ children: [/* @__PURE__ */ jsx(Input, {
47
+ placeholder,
48
+ value: editingValue,
49
+ onChange: (e) => {
50
+ setEditingValue(e.target.value);
51
+ onValueChange?.(e.target.value);
52
+ },
53
+ onKeyDown: handleKeyDown
54
+ }), /* @__PURE__ */ jsx("button", {
55
+ type: "submit",
56
+ className: "sr-only",
57
+ children: "Save"
58
+ })]
62
59
  })]
63
60
  });
64
61
  };
@@ -4,11 +4,13 @@ interface PhoneInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElemen
4
4
  value?: string;
5
5
  onChange?: (value: string, defaultCountryCode: CountryCode | undefined) => void;
6
6
  className?: string;
7
+ /** `secondary`: on a muted fill without a border, as in the phone list's popover. */
8
+ variant?: 'default' | 'secondary';
7
9
  /** The flag shown until the number names a country. */
8
10
  defaultCountry?: CountryCode;
9
11
  placeholder?: string;
10
12
  onEnter?: (phone: string) => void;
11
13
  onValidationChange?: (isValid: boolean, error?: string) => void;
12
14
  }
13
- export declare const PhoneInput: ({ ref, value, onChange, className, defaultCountry, placeholder, onEnter, onValidationChange, onKeyDown, onBlur, ...props }: PhoneInputProps & React.RefAttributes<HTMLInputElement>) => React.JSX.Element;
15
+ export declare const PhoneInput: ({ ref, value, onChange, className, defaultCountry, placeholder, onEnter, onValidationChange, onKeyDown, onBlur, variant, ...props }: PhoneInputProps & React.RefAttributes<HTMLInputElement>) => React.JSX.Element;
14
16
  export {};