@oneplatformdev/ui 0.1.99-beta.245 → 0.1.99-beta.247

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/.storybook/Wrappers.js.map +1 -1
  2. package/Accordion/Accordion.js.map +1 -1
  3. package/Alert/Alert.js.map +1 -1
  4. package/Alert/alertVariants.js.map +1 -1
  5. package/AlertDialog/AlertDialog.js.map +1 -1
  6. package/AlertDialog/AlertDialog.stories.js +4 -2
  7. package/AlertDialog/AlertDialog.stories.js.map +1 -1
  8. package/AlertDialog/AlertDialogRoot.js +20 -18
  9. package/AlertDialog/AlertDialogRoot.js.map +1 -1
  10. package/AreaChart/AreaChart.js.map +1 -1
  11. package/Aside/Aside.js.map +1 -1
  12. package/Aside/AsideSidebar.js.map +1 -1
  13. package/AspectRatio/AspectRatio.js.map +1 -1
  14. package/Avatar/Avatar.js.map +1 -1
  15. package/Badge/Badge.js.map +1 -1
  16. package/Badge/badgeVariants.js.map +1 -1
  17. package/Breadcrumb/Breadcrumb.js.map +1 -1
  18. package/Button/Button.js +11 -10
  19. package/Button/Button.js.map +1 -1
  20. package/Button/Button.stories.js.map +1 -1
  21. package/Button/Button.utils.js.map +1 -1
  22. package/Button/ButtonCounterBadge.js.map +1 -1
  23. package/Button/buttonVariants.js.map +1 -1
  24. package/ButtonIcon/ButtonIcon.js +22 -19
  25. package/ButtonIcon/ButtonIcon.js.map +1 -1
  26. package/ButtonIcon/ButtonIcon.stories.js.map +1 -1
  27. package/ButtonIcon/buttonIconVariants.js.map +1 -1
  28. package/CHANGELOG.md +3265 -3241
  29. package/Calendar/Calendar.js +6 -4
  30. package/Calendar/Calendar.js.map +1 -1
  31. package/Card/Card.js.map +1 -1
  32. package/Carousel/Carousel.js +7 -6
  33. package/Carousel/Carousel.js.map +1 -1
  34. package/Chart/Chart.js.map +1 -1
  35. package/Checkbox/Checkbox.js +1 -0
  36. package/Checkbox/Checkbox.js.map +1 -1
  37. package/Checkbox/Checkbox.stories.js.map +1 -1
  38. package/Collapsible/Collapsible.js.map +1 -1
  39. package/Combobox/Combobox.js +10 -10
  40. package/Combobox/Combobox.js.map +1 -1
  41. package/Combobox/Combobox.stories.js.map +1 -1
  42. package/Combobox/Combobox.types.js.map +1 -1
  43. package/Combobox/ComboboxOptionItem.js +20 -19
  44. package/Combobox/ComboboxOptionItem.js.map +1 -1
  45. package/Combobox/ComboboxRenderContent.js +15 -14
  46. package/Combobox/ComboboxRenderContent.js.map +1 -1
  47. package/Combobox/ComboboxRenderOptions.js +5 -5
  48. package/Combobox/ComboboxRenderOptions.js.map +1 -1
  49. package/Combobox/ComboboxRenderTrigger.js +30 -28
  50. package/Combobox/ComboboxRenderTrigger.js.map +1 -1
  51. package/Command/Command.js +22 -21
  52. package/Command/Command.js.map +1 -1
  53. package/ContextPopover/ContextDropdownMenu.js.map +1 -1
  54. package/ContextPopover/ContextPopover.js.map +1 -1
  55. package/ContextPopover/useContextPopoverHandler.js.map +1 -1
  56. package/DataTable/DataTable.js +26 -24
  57. package/DataTable/DataTable.js.map +1 -1
  58. package/DataTable/DataTableColumnFilter.js +7 -6
  59. package/DataTable/DataTableColumnFilter.js.map +1 -1
  60. package/DataTable/useDataTable.js.map +1 -1
  61. package/DatePicker/DatePicker.js +13 -12
  62. package/DatePicker/DatePicker.js.map +1 -1
  63. package/Dialog/Dialog.js +17 -16
  64. package/Dialog/Dialog.js.map +1 -1
  65. package/Dialog/Dialog.stories.js +15 -14
  66. package/Dialog/Dialog.stories.js.map +1 -1
  67. package/Dialog/DialogOverlayScope.js.map +1 -1
  68. package/Drawer/Drawer.js.map +1 -1
  69. package/DropdownMenu/DropdownMenu.js.map +1 -1
  70. package/Dropzone/Dropzone.js.map +1 -1
  71. package/Dropzone/Dropzone.stories.js.map +1 -1
  72. package/Dropzone/Dropzone.types.js.map +1 -1
  73. package/Dropzone/DropzoneFilePreview.js.map +1 -1
  74. package/Dropzone/DropzoneSinglePickPreview.js.map +1 -1
  75. package/Dropzone/DropzoneUtils.js.map +1 -1
  76. package/Form/Form.js +15 -14
  77. package/Form/Form.js.map +1 -1
  78. package/Form/FormRenderControl.d.ts.map +1 -1
  79. package/Form/FormRenderControl.js +17 -15
  80. package/Form/FormRenderControl.js.map +1 -1
  81. package/Form/FormRenderControl.types.d.ts +1 -0
  82. package/Form/FormRenderControl.types.d.ts.map +1 -1
  83. package/Form/Form_old.js +5 -4
  84. package/Form/Form_old.js.map +1 -1
  85. package/FormCheckbox/FormCheckbox.js +4 -4
  86. package/FormCheckbox/FormCheckbox.js.map +1 -1
  87. package/FormCombobox/FormCombobox.js +4 -4
  88. package/FormCombobox/FormCombobox.js.map +1 -1
  89. package/FormDatePicker/FormDatePicker.js +4 -4
  90. package/FormDatePicker/FormDatePicker.js.map +1 -1
  91. package/FormDropzone/FormDropzone.js +3 -3
  92. package/FormDropzone/FormDropzone.js.map +1 -1
  93. package/FormInput/FormInput.js +6 -6
  94. package/FormInput/FormInput.js.map +1 -1
  95. package/FormInput/FormInput.stories.js.map +1 -1
  96. package/FormRadio/FormRadio.js.map +1 -1
  97. package/FormSelect/FormSelect.js +9 -6
  98. package/FormSelect/FormSelect.js.map +1 -1
  99. package/FormTextarea/FormTextarea.js +4 -4
  100. package/FormTextarea/FormTextarea.js.map +1 -1
  101. package/Header/Header.js.map +1 -1
  102. package/HoverCard/HoverCard.js.map +1 -1
  103. package/InfoBlock/InfoBlock.js.map +1 -1
  104. package/InfoBlock/InfoBlock.stories.js.map +1 -1
  105. package/InfoBlock/infoBlockVariants.js.map +1 -1
  106. package/Input/Input.js.map +1 -1
  107. package/Input/Input.stories.js.map +1 -1
  108. package/Input/inputVariants.js.map +1 -1
  109. package/InputOTP/InputOTP.d.ts.map +1 -1
  110. package/InputOTP/InputOTP.js.map +1 -1
  111. package/LICENSE +21 -21
  112. package/Label/Label.js.map +1 -1
  113. package/Label/labelVariants.js.map +1 -1
  114. package/LazyLoader/LazyLoader.js +5 -4
  115. package/LazyLoader/LazyLoader.js.map +1 -1
  116. package/LoadedIcon/LoadedIcon.js.map +1 -1
  117. package/LoadingMask/LoadingMask.js.map +1 -1
  118. package/LoadingMask/RenderLoadingMask.js.map +1 -1
  119. package/LoadingProgress/LoadingProgress.js.map +1 -1
  120. package/LoadingProgress/loadingProgressVariants.js.map +1 -1
  121. package/Menubar/Menubar.js.map +1 -1
  122. package/NavigationMenu/NavigationMenu.js.map +1 -1
  123. package/NavigationMenu/navigationMenuVariants.js.map +1 -1
  124. package/Pagination/Pagination.js +1 -0
  125. package/Pagination/Pagination.js.map +1 -1
  126. package/Popover/Popover.js.map +1 -1
  127. package/Progress/Progress.js.map +1 -1
  128. package/README.md +7 -7
  129. package/Radio/Radio.js.map +1 -1
  130. package/RadioGroup/RadioGroup.js.map +1 -1
  131. package/Resizable/Resizable.js.map +1 -1
  132. package/Resizable/Resizable.stories.js.map +1 -1
  133. package/ScrollArea/ScrollArea.js.map +1 -1
  134. package/Search/Search.js +9 -9
  135. package/Search/Search.js.map +1 -1
  136. package/Search/Search.stories.js.map +1 -1
  137. package/Select/Select.js +7 -6
  138. package/Select/Select.js.map +1 -1
  139. package/Select/Select.stories.js.map +1 -1
  140. package/Select/SelectRoot.js.map +1 -1
  141. package/Separator/Separator.js.map +1 -1
  142. package/Sheet/Sheet.js.map +1 -1
  143. package/Sidebar/Sidebar.js +21 -20
  144. package/Sidebar/Sidebar.js.map +1 -1
  145. package/Skeleton/Skeleton.js.map +1 -1
  146. package/Slider/Slider.js.map +1 -1
  147. package/Sonner/Sonner.js.map +1 -1
  148. package/Switch/Switch.d.ts.map +1 -1
  149. package/Switch/Switch.js +19 -7
  150. package/Switch/Switch.js.map +1 -1
  151. package/Switch/Switch.stories.js +62 -0
  152. package/Switch/Switch.stories.js.map +1 -0
  153. package/Table/Table.js.map +1 -1
  154. package/TablePagination/TablePagination.js +26 -21
  155. package/TablePagination/TablePagination.js.map +1 -1
  156. package/Tabs/Tabs.js.map +1 -1
  157. package/Tabs/TabsRoot.js.map +1 -1
  158. package/Textarea/Textarea.js.map +1 -1
  159. package/Textarea/Textarea.stories.js.map +1 -1
  160. package/Textarea/useAutosizeTextArea.js.map +1 -1
  161. package/Theme/ThemeModeToggle.js +4 -3
  162. package/Theme/ThemeModeToggle.js.map +1 -1
  163. package/Theme/ThemeProvider.js.map +1 -1
  164. package/Toast/Toast.js.map +1 -1
  165. package/Toast/toast.constants.js.map +1 -1
  166. package/Toast/toastVariants.js.map +1 -1
  167. package/Toast/useToast.js.map +1 -1
  168. package/Toaster/Toaster.js.map +1 -1
  169. package/Toggle/Toggle.js.map +1 -1
  170. package/ToggleGroup/ToggleGroup.js.map +1 -1
  171. package/Tooltip/Tooltip.js.map +1 -1
  172. package/Tooltip/TooltipRoot.js.map +1 -1
  173. package/Tooltip/tooltipVariants.js.map +1 -1
  174. package/index.js +286 -286
  175. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxRenderTrigger.js","sources":["../../src/Combobox/ComboboxRenderTrigger.tsx"],"sourcesContent":["import {\r\n ComboboxCallbackStateParamsRenderHandler,\r\n ComboboxCallbackStateParamsUnion,\r\n ComboboxOption,\r\n ComboboxProps, ComboboxSelectedType,\r\n DEFAULT_COMBOBOX_TYPE\r\n} from \"./Combobox.types\";\r\nimport { Button } from \"../Button\";\r\nimport { cn } from \"@oneplatformdev/utils\";\r\nimport { LoadingMask } from \"../LoadingMask\";\r\nimport { ChevronDown, XIcon } from \"lucide-react\";\r\nimport { PopoverTrigger } from \"../Popover\";\r\nimport { HTMLAttributes, useMemo } from \"react\";\r\nimport { ScrollArea } from \"../ScrollArea\";\r\n\r\ntype ComboboxRenderTriggerProps<Data extends object = object> = {\r\n type: ComboboxSelectedType,\r\n value: ComboboxProps<Data, 'single'>['value'] | ComboboxProps<Data, 'multi'>['value'];\r\n open: boolean;\r\n initialLoading: boolean;\r\n flattenOptions: ComboboxOption<Data>[];\r\n selectedOptions?: Map<ComboboxOption<Data>['value'], ComboboxOption<Data>>;\r\n onSelect?: (option: ComboboxOption<Data>) => void;\r\n onClearSelections?: () => void;\r\n\r\n callbackStateParams: ComboboxCallbackStateParamsUnion<Data>;\r\n renderTrigger?: ComboboxCallbackStateParamsRenderHandler<Data>;\r\n\r\n placeholder?: string;\r\n disabled?: boolean;\r\n}\r\n\r\nconst useValues = <Data extends object>(\r\n props: ComboboxRenderTriggerProps<Data>\r\n): ComboboxOption<Data>[] => {\r\n const { value, flattenOptions = [], selectedOptions = new Map() } = props;\r\n return useMemo(() => {\r\n if (!value) return [];\r\n const selectedOption = Array.from(selectedOptions.values());\r\n const vls = Array.isArray(value) ? value : [ value ];\r\n const flattenedOptionValues = flattenOptions.filter(o => {\r\n return vls.find(v => String(v).toLowerCase() === String(o.value).toLowerCase())\r\n });\r\n\r\n const labels = [ ...flattenedOptionValues, ...selectedOption ]\r\n .reduce<Map<ComboboxOption<Data>['value'], ComboboxOption<Data>>>((acc, o) => {\r\n if (!o) return acc;\r\n if (acc.has(o.value)) return acc;\r\n acc.set(o.value, { ...o, label: o.label || o.value });\r\n return acc;\r\n }, new Map())\r\n if (!labels.size) return vls.map(v => ({ value: v, label: String(v) }));\r\n return Array.from(labels.values());\r\n }, [ value, flattenOptions, selectedOptions ])\r\n}\r\n\r\nconst ComboboxRenderTriggerLabel = <Data extends object = object>(\r\n props: ComboboxRenderTriggerProps<Data>\r\n) => {\r\n const { type = DEFAULT_COMBOBOX_TYPE, placeholder, onSelect, open } = props;\r\n const values = useValues(props);\r\n\r\n if (!values.length) {\r\n return (\r\n <span className=\"text-gray-400 whitespace-pre-wrap break-words line-clamp-1 pr-11\">\r\n {placeholder}\r\n </span>\r\n )\r\n }\r\n\r\n if (type === 'single') {\r\n return (\r\n <span className=\"truncate overflow-hidden whitespace-nowrap break-words line-clamp-1 pr-8\">\r\n {values[0].label}\r\n </span>\r\n )\r\n }\r\n\r\n if (type === 'multi') {\r\n return (\r\n <ScrollArea\r\n className={cn(\r\n \"w-full h-auto min-h-5 max-h-20.25\",\r\n 'overflow-y-auto overflow-x-hidden',\r\n )}\r\n slotProps={{\r\n viewport: {\r\n className: '[&>div]:block!',\r\n }\r\n }}\r\n >\r\n <div className=\"p-0 gap-1 flex flex-wrap w-full pr-11\">\r\n {values.map((item) => {\r\n if (!item) return null;\r\n return (\r\n <div\r\n key={item.value}\r\n className={cn(\r\n 'flex items-center justify-center',\r\n 'py-1 px-2 min-h-5 w-fit gap-1',\r\n 'bg-[#9368FF] rounded-sm',\r\n 'text-[#FCFCFC] leading-none text-xs font-semibold',\r\n 'cursor-pointer',\r\n 'truncate',\r\n )}\r\n onClick={(e) => {\r\n if(!open) return;\r\n e.preventDefault();\r\n e.stopPropagation();\r\n onSelect?.(item)\r\n }}\r\n >\r\n <span className='whitespace-pre-wrap wrap-break-word line-clamp-1'>\r\n {item.label}\r\n </span>\r\n <XIcon className='size-3! shrink-0 text-white!'/>\r\n </div>\r\n );\r\n })}\r\n </div>\r\n </ScrollArea>\r\n )\r\n }\r\n\r\n return 'No supported to render'\r\n}\r\n\r\nconst EndAdornmentWrapper = (\r\n props: HTMLAttributes<HTMLDivElement> & {\r\n prevented?: boolean;\r\n }\r\n) => {\r\n const { children, prevented = true, onClick, className, ...rest } = props;\r\n return (\r\n <div\r\n {...rest}\r\n className={cn(\r\n 'absolute top-1/2 -translate-y-1/2 right-1',\r\n 'flex items-center justify-center',\r\n 'w-10 h-10 [&_svg]:size-5!',\r\n 'opacity-50 cursor-pointer hover:opacity-100',\r\n className,\r\n )}\r\n onClick={(e) => {\r\n if (!prevented) return onClick?.(e);\r\n e.stopPropagation();\r\n e.preventDefault();\r\n onClick?.(e);\r\n }}\r\n >\r\n {children}\r\n </div>\r\n )\r\n}\r\nconst ComboboxRenderTriggerEndAdornment = <Data extends object = object>(\r\n props: ComboboxRenderTriggerProps<Data>\r\n) => {\r\n const { open, onClearSelections } = props;\r\n const values = useValues(props);\r\n\r\n if (!open) {\r\n return (\r\n <EndAdornmentWrapper prevented={false}>\r\n <ChevronDown/>\r\n </EndAdornmentWrapper>\r\n )\r\n }\r\n\r\n if (!values.length) return null\r\n\r\n return (\r\n <EndAdornmentWrapper onClick={() => onClearSelections?.()}>\r\n <XIcon/>\r\n </EndAdornmentWrapper>\r\n )\r\n}\r\n\r\nexport const ComboboxRenderTrigger = <Data extends object>(\r\n props: ComboboxRenderTriggerProps<Data>\r\n) => {\r\n const {\r\n type,\r\n open,\r\n initialLoading,\r\n callbackStateParams,\r\n disabled,\r\n renderTrigger,\r\n } = props;\r\n\r\n return (\r\n <PopoverTrigger asChild className=\"border-input\">\r\n <Button\r\n variant={renderTrigger ? 'none' : 'contained'}\r\n color='secondary'\r\n role=\"combobox\"\r\n aria-expanded={open}\r\n className={cn(\r\n 'relative w-full justify-between bg-transparent',\r\n !renderTrigger && 'font-normal text-sm',\r\n 'border border-border',\r\n open && 'border-1 outline-hidden ring-1 ring-ring',\r\n type === 'multi' && 'pr-0',\r\n 'focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring',\r\n renderTrigger && 'p-0',\r\n renderTrigger && open && 'p-0 border-1 ring-0 ring-transparent',\r\n )}\r\n disabled={disabled || initialLoading}\r\n >\r\n {initialLoading && <LoadingMask fullWidth/>}\r\n {!initialLoading && renderTrigger && renderTrigger(callbackStateParams)}\r\n {!initialLoading && !renderTrigger && (\r\n <>\r\n <ComboboxRenderTriggerLabel {...props} />\r\n <ComboboxRenderTriggerEndAdornment {...props} />\r\n </>\r\n )}\r\n </Button>\r\n </PopoverTrigger>\r\n )\r\n}\r\n"],"names":["useValues","props","value","flattenOptions","selectedOptions","useMemo","selectedOption","vls","labels","o","v","acc","ComboboxRenderTriggerLabel","type","DEFAULT_COMBOBOX_TYPE","placeholder","onSelect","open","values","jsx","ScrollArea","cn","item","jsxs","e","XIcon","EndAdornmentWrapper","children","prevented","onClick","className","rest","ComboboxRenderTriggerEndAdornment","onClearSelections","ChevronDown","ComboboxRenderTrigger","initialLoading","callbackStateParams","disabled","renderTrigger","Popo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":3,"file":"ComboboxRenderTrigger.js","sources":["../../src/Combobox/ComboboxRenderTrigger.tsx"],"sourcesContent":["import {\n ComboboxCallbackStateParamsRenderHandler,\n ComboboxCallbackStateParamsUnion,\n ComboboxOption,\n ComboboxProps, ComboboxSelectedType,\n DEFAULT_COMBOBOX_TYPE\n} from \"./Combobox.types\";\nimport { Button } from \"../Button\";\nimport { cn } from \"@oneplatformdev/utils\";\nimport { LoadingMask } from \"../LoadingMask\";\nimport { ChevronDown, XIcon } from \"lucide-react\";\nimport { PopoverTrigger } from \"../Popover\";\nimport { HTMLAttributes, useMemo } from \"react\";\nimport { ScrollArea } from \"../ScrollArea\";\n\ntype ComboboxRenderTriggerProps<Data extends object = object> = {\n type: ComboboxSelectedType,\n value: ComboboxProps<Data, 'single'>['value'] | ComboboxProps<Data, 'multi'>['value'];\n open: boolean;\n initialLoading: boolean;\n flattenOptions: ComboboxOption<Data>[];\n selectedOptions?: Map<ComboboxOption<Data>['value'], ComboboxOption<Data>>;\n onSelect?: (option: ComboboxOption<Data>) => void;\n onClearSelections?: () => void;\n\n callbackStateParams: ComboboxCallbackStateParamsUnion<Data>;\n renderTrigger?: ComboboxCallbackStateParamsRenderHandler<Data>;\n\n placeholder?: string;\n disabled?: boolean;\n}\n\nconst useValues = <Data extends object>(\n props: ComboboxRenderTriggerProps<Data>\n): ComboboxOption<Data>[] => {\n const { value, flattenOptions = [], selectedOptions = new Map() } = props;\n return useMemo(() => {\n if (!value) return [];\n const selectedOption = Array.from(selectedOptions.values());\n const vls = Array.isArray(value) ? value : [ value ];\n const flattenedOptionValues = flattenOptions.filter(o => {\n return vls.find(v => String(v).toLowerCase() === String(o.value).toLowerCase())\n });\n\n const labels = [ ...flattenedOptionValues, ...selectedOption ]\n .reduce<Map<ComboboxOption<Data>['value'], ComboboxOption<Data>>>((acc, o) => {\n if (!o) return acc;\n if (acc.has(o.value)) return acc;\n acc.set(o.value, { ...o, label: o.label || o.value });\n return acc;\n }, new Map())\n if (!labels.size) return vls.map(v => ({ value: v, label: String(v) }));\n return Array.from(labels.values());\n }, [ value, flattenOptions, selectedOptions ])\n}\n\nconst ComboboxRenderTriggerLabel = <Data extends object = object>(\n props: ComboboxRenderTriggerProps<Data>\n) => {\n const { type = DEFAULT_COMBOBOX_TYPE, placeholder, onSelect, open } = props;\n const values = useValues(props);\n\n if (!values.length) {\n return (\n <span className=\"text-gray-400 whitespace-pre-wrap break-words line-clamp-1 pr-11\">\n {placeholder}\n </span>\n )\n }\n\n if (type === 'single') {\n return (\n <span className=\"truncate overflow-hidden whitespace-nowrap break-words line-clamp-1 pr-8\">\n {values[0].label}\n </span>\n )\n }\n\n if (type === 'multi') {\n return (\n <ScrollArea\n className={cn(\n \"w-full h-auto min-h-5 max-h-20.25\",\n 'overflow-y-auto overflow-x-hidden',\n )}\n slotProps={{\n viewport: {\n className: '[&>div]:block!',\n }\n }}\n >\n <div className=\"p-0 gap-1 flex flex-wrap w-full pr-11\">\n {values.map((item) => {\n if (!item) return null;\n return (\n <div\n key={item.value}\n className={cn(\n 'flex items-center justify-center',\n 'py-1 px-2 min-h-5 w-fit gap-1',\n 'bg-[#9368FF] rounded-sm',\n 'text-[#FCFCFC] leading-none text-xs font-semibold',\n 'cursor-pointer',\n 'truncate',\n )}\n onClick={(e) => {\n if(!open) return;\n e.preventDefault();\n e.stopPropagation();\n onSelect?.(item)\n }}\n >\n <span className='whitespace-pre-wrap wrap-break-word line-clamp-1'>\n {item.label}\n </span>\n <XIcon className='size-3! shrink-0 text-white!'/>\n </div>\n );\n })}\n </div>\n </ScrollArea>\n )\n }\n\n return 'No supported to render'\n}\n\nconst EndAdornmentWrapper = (\n props: HTMLAttributes<HTMLDivElement> & {\n prevented?: boolean;\n }\n) => {\n const { children, prevented = true, onClick, className, ...rest } = props;\n return (\n <div\n {...rest}\n className={cn(\n 'absolute top-1/2 -translate-y-1/2 right-1',\n 'flex items-center justify-center',\n 'w-10 h-10 [&_svg]:size-5!',\n 'opacity-50 cursor-pointer hover:opacity-100',\n className,\n )}\n onClick={(e) => {\n if (!prevented) return onClick?.(e);\n e.stopPropagation();\n e.preventDefault();\n onClick?.(e);\n }}\n >\n {children}\n </div>\n )\n}\nconst ComboboxRenderTriggerEndAdornment = <Data extends object = object>(\n props: ComboboxRenderTriggerProps<Data>\n) => {\n const { open, onClearSelections } = props;\n const values = useValues(props);\n\n if (!open) {\n return (\n <EndAdornmentWrapper prevented={false}>\n <ChevronDown/>\n </EndAdornmentWrapper>\n )\n }\n\n if (!values.length) return null\n\n return (\n <EndAdornmentWrapper onClick={() => onClearSelections?.()}>\n <XIcon/>\n </EndAdornmentWrapper>\n )\n}\n\nexport const ComboboxRenderTrigger = <Data extends object>(\n props: ComboboxRenderTriggerProps<Data>\n) => {\n const {\n type,\n open,\n initialLoading,\n callbackStateParams,\n disabled,\n renderTrigger,\n } = props;\n\n return (\n <PopoverTrigger asChild className=\"border-input\">\n <Button\n variant={renderTrigger ? 'none' : 'contained'}\n color='secondary'\n role=\"combobox\"\n aria-expanded={open}\n className={cn(\n 'relative w-full justify-between bg-transparent',\n !renderTrigger && 'font-normal text-sm',\n 'border border-border',\n open && 'border-1 outline-hidden ring-1 ring-ring',\n type === 'multi' && 'pr-0',\n 'focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring',\n renderTrigger && 'p-0',\n renderTrigger && open && 'p-0 border-1 ring-0 ring-transparent',\n )}\n disabled={disabled || initialLoading}\n >\n {initialLoading && <LoadingMask fullWidth/>}\n {!initialLoading && renderTrigger && renderTrigger(callbackStateParams)}\n {!initialLoading && !renderTrigger && (\n <>\n <ComboboxRenderTriggerLabel {...props} />\n <ComboboxRenderTriggerEndAdornment {...props} />\n </>\n )}\n </Button>\n </PopoverTrigger>\n )\n}\n"],"names":["useValues","props","value","flattenOptions","selectedOptions","useMemo","selectedOption","vls","labels","o","v","acc","ComboboxRenderTriggerLabel","type","DEFAULT_COMBOBOX_TYPE","placeholder","onSelect","open","values","jsx","ScrollArea","cn","item","jsxs","e","XIcon","EndAdornmentWrapper","children","prevented","onClick","className","rest","ComboboxRenderTriggerEndAdornment","onClearSelections","ChevronDown","ComboboxRenderTrigger","initialLoading","callbackStateParams","disabled","renderTrigger","PopoverTrigger","Button","LoadingMask","Fragment"],"mappings":";;;;;;;;;;;AAgCA,MAAMA,IAAY,CAChBC,MAC2B;AAC3B,QAAM,EAAE,OAAAC,GAAO,gBAAAC,IAAiB,CAAA,GAAI,iBAAAC,IAAkB,oBAAI,IAAA,EAAI,IAAMH;AACpE,SAAOI,EAAQ,MAAM;AACnB,QAAI,CAACH,EAAO,QAAO,CAAA;AACnB,UAAMI,IAAiB,MAAM,KAAKF,EAAgB,QAAQ,GACpDG,IAAM,MAAM,QAAQL,CAAK,IAAIA,IAAQ,CAAEA,CAAM,GAK7CM,IAAS,CAAE,GAJaL,EAAe,OAAO,CAAAM,MAC3CF,EAAI,KAAK,CAAAG,MAAK,OAAOA,CAAC,EAAE,YAAA,MAAkB,OAAOD,EAAE,KAAK,EAAE,aAAa,CAC/E,GAE0C,GAAGH,CAAe,EAC1D,OAAiE,CAACK,GAAKF,OAClE,CAACA,KACDE,EAAI,IAAIF,EAAE,KAAK,KACnBE,EAAI,IAAIF,EAAE,OAAO,EAAE,GAAGA,GAAG,OAAOA,EAAE,SAASA,EAAE,MAAA,CAAO,GAC7CE,IACN,oBAAI,KAAK;AACd,WAAKH,EAAO,OACL,MAAM,KAAKA,EAAO,OAAA,CAAQ,IADRD,EAAI,IAAI,CAAAG,OAAM,EAAE,OAAOA,GAAG,OAAO,OAAOA,CAAC,IAAI;AAAA,EAExE,GAAG,CAAER,GAAOC,GAAgBC,CAAgB,CAAC;AAC/C,GAEMQ,IAA6B,CACjCX,MACG;AACH,QAAM,EAAE,MAAAY,IAAOC,GAAuB,aAAAC,GAAa,UAAAC,GAAU,MAAAC,MAAShB,GAChEiB,IAASlB,EAAUC,CAAK;AAE9B,SAAKiB,EAAO,SAQRL,MAAS,6BAER,QAAA,EAAK,WAAU,4EACb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AAkB,EAACa,GAAA,EAAmC,GAAG/B,EAAA,CAAO;AAAA,QAAA,EAAA,CAChD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}
@@ -1,9 +1,10 @@
1
1
  import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
2
  import { Command as r } from "cmdk";
3
- import { Command as P } from "cmdk";
3
+ import { Command as A } from "cmdk";
4
4
  import { SearchIcon as c } from "lucide-react";
5
5
  import { cn as a } from "@oneplatformdev/utils";
6
- import { Dialog as l, DialogHeader as p, DialogTitle as u, DialogDescription as g, DialogContent as h } from "../Dialog/Dialog.js";
6
+ import { Dialog as p, DialogHeader as l, DialogTitle as u, DialogDescription as g, DialogContent as h } from "../Dialog/Dialog.js";
7
+ import "../Dialog/DialogOverlayScope.js";
7
8
  function f({
8
9
  className: e,
9
10
  ...t
@@ -20,7 +21,7 @@ function f({
20
21
  }
21
22
  );
22
23
  }
23
- function N({
24
+ function C({
24
25
  title: e = "Command Palette",
25
26
  description: t = "Search for a command to run...",
26
27
  children: n,
@@ -28,8 +29,8 @@ function N({
28
29
  showCloseButton: s = !0,
29
30
  ...i
30
31
  }) {
31
- return /* @__PURE__ */ m(l, { ...i, children: [
32
- /* @__PURE__ */ m(p, { className: "sr-only", children: [
32
+ return /* @__PURE__ */ m(p, { ...i, children: [
33
+ /* @__PURE__ */ m(l, { className: "sr-only", children: [
33
34
  /* @__PURE__ */ o(u, { children: e }),
34
35
  /* @__PURE__ */ o(g, { children: t })
35
36
  ] }),
@@ -43,7 +44,7 @@ function N({
43
44
  )
44
45
  ] });
45
46
  }
46
- function C(e) {
47
+ function b(e) {
47
48
  const {
48
49
  className: t,
49
50
  slotProps: n,
@@ -84,7 +85,7 @@ function C(e) {
84
85
  }
85
86
  );
86
87
  }
87
- function b({
88
+ function y({
88
89
  className: e,
89
90
  ...t
90
91
  }) {
@@ -100,7 +101,7 @@ function b({
100
101
  }
101
102
  );
102
103
  }
103
- function y({
104
+ function D({
104
105
  ...e
105
106
  }) {
106
107
  return /* @__PURE__ */ o(
@@ -112,7 +113,7 @@ function y({
112
113
  }
113
114
  );
114
115
  }
115
- function D({
116
+ function E({
116
117
  className: e,
117
118
  ...t
118
119
  }) {
@@ -128,7 +129,7 @@ function D({
128
129
  }
129
130
  );
130
131
  }
131
- function E({
132
+ function I({
132
133
  className: e,
133
134
  ...t
134
135
  }) {
@@ -141,7 +142,7 @@ function E({
141
142
  }
142
143
  );
143
144
  }
144
- function I({
145
+ function S({
145
146
  className: e,
146
147
  ...t
147
148
  }) {
@@ -160,7 +161,7 @@ function I({
160
161
  }
161
162
  );
162
163
  }
163
- function S({
164
+ function j({
164
165
  className: e,
165
166
  ...t
166
167
  }) {
@@ -178,14 +179,14 @@ function S({
178
179
  }
179
180
  export {
180
181
  f as Command,
181
- N as CommandDialog,
182
- y as CommandEmpty,
183
- D as CommandGroup,
184
- C as CommandInput,
185
- I as CommandItem,
186
- b as CommandList,
187
- P as CommandPrimitive,
188
- E as CommandSeparator,
189
- S as CommandShortcut
182
+ C as CommandDialog,
183
+ D as CommandEmpty,
184
+ E as CommandGroup,
185
+ b as CommandInput,
186
+ S as CommandItem,
187
+ y as CommandList,
188
+ A as CommandPrimitive,
189
+ I as CommandSeparator,
190
+ j as CommandShortcut
190
191
  };
191
192
  //# sourceMappingURL=Command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Command.js","sources":["../../src/Command/Command.tsx"],"sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { Command as CommandPrimitive } from \"cmdk\"\r\nimport { SearchIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@oneplatformdev/utils\"\r\nimport {\r\n Dialog,\r\n DialogContent,\r\n DialogDescription,\r\n DialogHeader,\r\n DialogTitle,\r\n} from \"../Dialog\"\r\nimport { HTMLAttributes } from \"react\";\r\n\r\nfunction Command({\r\n className,\r\n ...props\r\n }: React.ComponentProps<typeof CommandPrimitive>) {\r\n return (\r\n <CommandPrimitive\r\n data-slot=\"command\"\r\n className={cn(\r\n \"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction CommandDialog({\r\n title = \"Command Palette\",\r\n description = \"Search for a command to run...\",\r\n children,\r\n className,\r\n showCloseButton = true,\r\n ...props\r\n }: React.ComponentProps<typeof Dialog> & {\r\n title?: string\r\n description?: string\r\n className?: string\r\n showCloseButton?: boolean\r\n}) {\r\n return (\r\n <Dialog {...props}>\r\n <DialogHeader className=\"sr-only\">\r\n <DialogTitle>{title}</DialogTitle>\r\n <DialogDescription>{description}</DialogDescription>\r\n </DialogHeader>\r\n <DialogContent\r\n className={cn(\"overflow-hidden p-0\", className)}\r\n showCloseButton={showCloseButton}\r\n >\r\n <Command className=\"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\r\n {children}\r\n </Command>\r\n </DialogContent>\r\n </Dialog>\r\n )\r\n}\r\n\r\nfunction CommandInput(\r\n props: React.ComponentProps<typeof CommandPrimitive.Input> & {\r\n slotProps?: {\r\n wrapper?: HTMLAttributes<HTMLDivElement>,\r\n }\r\n }\r\n) {\r\n const {\r\n className,\r\n slotProps,\r\n ...rest\r\n } = props;\r\n return (\r\n <div\r\n data-slot=\"command-input-wrapper\"\r\n {...slotProps?.wrapper}\r\n className={cn(\r\n \"flex min-h-10 items-center gap-0 border-b border-[#E8E9EB] p-0 pb-2\",\r\n slotProps?.wrapper?.className\r\n )}\r\n >\r\n <div className='flex items-center justify-center h-10 px-2'>\r\n <SearchIcon\r\n strokeWidth={1.5}\r\n className=\"size-6 shrink-0 text-[#666A78]\"\r\n />\r\n </div>\r\n <CommandPrimitive.Input\r\n data-slot=\"command-input\"\r\n className={cn(\r\n 'flex h-10 w-full',\r\n 'placeholder:text-[#666A78] text-base',\r\n 'bg-transparent rounded-md outline-hidden',\r\n 'disabled:cursor-not-allowed disabled:opacity-50',\r\n className\r\n )}\r\n {...rest}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\n\r\nfunction CommandList({\r\n className,\r\n ...props\r\n }: React.ComponentProps<typeof CommandPrimitive.List>) {\r\n return (\r\n <CommandPrimitive.List\r\n data-slot=\"command-list\"\r\n className={cn(\r\n \"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction CommandEmpty({\r\n ...props\r\n }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\r\n return (\r\n <CommandPrimitive.Empty\r\n data-slot=\"command-empty\"\r\n className=\"py-6 text-center text-sm\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction CommandGroup({\r\n className,\r\n ...props\r\n }: React.ComponentProps<typeof CommandPrimitive.Group>) {\r\n return (\r\n <CommandPrimitive.Group\r\n data-slot=\"command-group\"\r\n className={cn(\r\n \"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction CommandSeparator({\r\n className,\r\n ...props\r\n }: React.ComponentProps<typeof CommandPrimitive.Separator>) {\r\n return (\r\n <CommandPrimitive.Separator\r\n data-slot=\"command-separator\"\r\n className={cn(\"bg-border -mx-1 h-px\", className)}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction CommandItem({\r\n className,\r\n ...props\r\n }: React.ComponentProps<typeof CommandPrimitive.Item>) {\r\n return (\r\n <CommandPrimitive.Item\r\n data-slot=\"command-item\"\r\n className={cn(\r\n 'relative flex items-center gap-2 rounded-md px-2 py-1.5 min-h-10 text-sm',\r\n 'cursor-pointer select-none',\r\n 'outline-hidden data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\\'size-\\'])]:size-4',\r\n \"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction CommandShortcut({\r\n className,\r\n ...props\r\n }: React.ComponentProps<\"span\">) {\r\n return (\r\n <span\r\n data-slot=\"command-shortcut\"\r\n className={cn(\r\n \"text-muted-foreground ml-auto text-xs tracking-widest\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport {\r\n Command,\r\n CommandDialog,\r\n CommandInput,\r\n CommandList,\r\n CommandEmpty,\r\n CommandGroup,\r\n CommandItem,\r\n CommandShortcut,\r\n CommandSeparator,\r\n CommandPrimitive\r\n}\r\n"],"names":["Command","className","props","jsx","CommandPrimitive","cn","CommandDialog","title","description","children","showCloseButton","jsxs","Dialog","DialogHeader","DialogTitle","DialogDescription","DialogContent","CommandInput","slotProps","rest","SearchIcon","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","CommandShortcut"],"mappings":";;;;;;AAgBA,SAASA,EAAQ;AAAA,EACE,WAAAC;AAAA,EACA,GAAGC;AACL,GAAkD;AACjE,SACE,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWC;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASI,EAAc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,EAAgB;AAAA,EACE,WAAAzB;AAAA,EACA,GAAGC;AACL,GAAiC;AACxD,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWE;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
1
+ {"version":3,"file":"Command.js","sources":["../../src/Command/Command.tsx"],"sourcesContent":["\"use client\"\n\nimport * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { SearchIcon } from \"lucide-react\"\n\nimport { cn } from \"@oneplatformdev/utils\"\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"../Dialog\"\nimport { HTMLAttributes } from \"react\";\n\nfunction Command({\n className,\n ...props\n }: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = true,\n ...props\n }: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\"overflow-hidden p-0\", className)}\n showCloseButton={showCloseButton}\n >\n <Command className=\"[&_[cmdk-group-heading]]:text-muted-foreground **:data-[slot=command-input-wrapper]:h-12 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]]:px-2 [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput(\n props: React.ComponentProps<typeof CommandPrimitive.Input> & {\n slotProps?: {\n wrapper?: HTMLAttributes<HTMLDivElement>,\n }\n }\n) {\n const {\n className,\n slotProps,\n ...rest\n } = props;\n return (\n <div\n data-slot=\"command-input-wrapper\"\n {...slotProps?.wrapper}\n className={cn(\n \"flex min-h-10 items-center gap-0 border-b border-[#E8E9EB] p-0 pb-2\",\n slotProps?.wrapper?.className\n )}\n >\n <div className='flex items-center justify-center h-10 px-2'>\n <SearchIcon\n strokeWidth={1.5}\n className=\"size-6 shrink-0 text-[#666A78]\"\n />\n </div>\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n 'flex h-10 w-full',\n 'placeholder:text-[#666A78] text-base',\n 'bg-transparent rounded-md outline-hidden',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n className\n )}\n {...rest}\n />\n </div>\n )\n}\n\n\nfunction CommandList({\n className,\n ...props\n }: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n ...props\n }: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n }: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n }: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"bg-border -mx-1 h-px\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n ...props\n }: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n 'relative flex items-center gap-2 rounded-md px-2 py-1.5 min-h-10 text-sm',\n 'cursor-pointer select-none',\n 'outline-hidden data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\\'size-\\'])]:size-4',\n \"data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n }: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"text-muted-foreground ml-auto text-xs tracking-widest\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n CommandPrimitive\n}\n"],"names":["Command","className","props","jsx","CommandPrimitive","cn","CommandDialog","title","description","children","showCloseButton","jsxs","Dialog","DialogHeader","DialogTitle","DialogDescription","DialogContent","CommandInput","slotProps","rest","SearchIcon","CommandList","CommandEmpty","CommandGroup","CommandSeparator","CommandItem","CommandShortcut"],"mappings":";;;;;;;AAgBA,SAASA,EAAQ;AAAA,EACE,WAAAC;AAAA,EACA,GAAGC;AACL,GAAkD;AACjE,SACE,gBAAAC;AAAA,IAACC;AAAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV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A;AAAA,QACA;AAAA,QACA;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;AAEA,SAASwB,EAAgB;AAAA,EACE,WAAAzB;AAAA,EACA,GAAGC;AACL,GAAiC;AACxD,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAU;AAAA,MACV,WAAWE;AAAA,QACT;AAAA,QACAJ;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContextDropdownMenu.js","sources":["../../src/ContextPopover/ContextDropdownMenu.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ComponentPropsWithoutRef, forwardRef, PropsWithChildren } from \"react\";\r\nimport {\r\n\tDropdownMenu,\r\n\tDropdownMenuContent,\r\n\tDropdownMenuTrigger\r\n} from \"../DropdownMenu\";\r\n\r\nexport interface IContextDropdownMenuProps\r\n\textends ComponentPropsWithoutRef<typeof DropdownMenu> {\r\n\tcoords: { x: number; y: number };\r\n}\r\n\r\nexport const ContextDropdownMenu = forwardRef<\r\n\tHTMLDivElement,\r\n\tPropsWithChildren<IContextDropdownMenuProps>\r\n>((props, ref) => {\r\n\tconst { coords, children, ...rest } = props;\r\n\tconst virtualTriggerRect = new DOMRect(coords.x, coords.y, 0, 0);\r\n\treturn (\r\n\t\t<DropdownMenu {...rest}>\r\n\t\t\t<DropdownMenuTrigger asChild>\r\n\t\t\t\t<div\r\n\t\t\t\t\tref={(node) => {\r\n\t\t\t\t\t\tif (node) {\r\n\t\t\t\t\t\t\tObject.defineProperty(node, 'getBoundingClientRect', {\r\n\t\t\t\t\t\t\t\tvalue: () => virtualTriggerRect,\r\n\t\t\t\t\t\t\t\twritable: true,\r\n\t\t\t\t\t\t\t\tconfigurable: true,\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}}\r\n\t\t\t\t\tclassName='fixed w-[1px] h-[1px] opacity-0 pointer-events-none z-50'\r\n\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\tleft: coords?.x || 0,\r\n\t\t\t\t\t\ttop: coords?.y || 0,\r\n\t\t\t\t\t}}\r\n\t\t\t\t/>\r\n\t\t\t</DropdownMenuTrigger>\r\n\t\t\t<DropdownMenuContent\r\n\t\t\t\tref={ref}\r\n\t\t\t\tclassName=\"p-2 relative w-auto h-fit min-w-[150px] max-h-[300px] overflow-y-auto\"\r\n\t\t\t\talign=\"start\"\r\n\t\t\t\tsideOffset={5}\r\n\t\t\t\tonCloseAutoFocus={(event) => event.preventDefault()}\r\n\t\t\t>\r\n\t\t\t\t{children}\r\n\t\t\t</DropdownMenuContent>\r\n\t\t</DropdownMenu>\r\n\t)\r\n})\r\n\r\nContextDropdownMenu.displayName = 'ContextDropdownMenu'\r\n"],"names":["ContextDropdownMenu","forwardRef","props","ref","coords","children","rest","virtualTriggerRect","jsxs","DropdownMenu","jsx","DropdownMenuTrigger","node","DropdownMenuContent","event"],"mappings":";;;AAcO,MAAMA,IAAsBC,EAGjC,CAACC,GAAOC,MAAQ;AACjB,QAAM,EAAE,QAAAC,GAAQ,UAAAC,GAAU,GAAGC,MAASJ,GAChCK,IAAqB,IAAI,QAAQH,EAAO,GAAGA,EAAO,GAAG,GAAG,CAAC;AAC/D,SACC,gBAAAI,EAACC,GAAA,EAAc,GAAGH,GACjB,UAAA;AAAA,IAAA,gBAAAI,EAACC,GAAA,EAAoB,SAAO,IAC3B,UAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,KAAK,CAACE,MAAS;AACd,UAAIA,KACH,OAAO,eAAeA,GAAM,yBAAyB;AAAA,YACpD,OAAO,MAAML;AAAA,YACb,UAAU;AAAA,YACV,cAAc;AAAA,UAAA,CACd;AAAA,QAEH;AAAA,QACA,WAAU;AAAA,QACV,OAAO;AAAA,UACN,MAAMH,GAAQ,KAAK;AAAA,UACnB,KAAKA,GAAQ,KAAK;AAAA,QAAA;AAAA,MACnB;AAAA,IAAA,GAEF;AAAA,IACA,gBAAAM;AAAA,MAACG;AAAA,MAAA;AAAA,QACA,KAAAV;AAAA,QACA,WAAU;AAAA,QACV,OAAM;AAAA,QACN,YAAY;AAAA,QACZ,kBAAkB,CAACW,MAAUA,EAAM,eAAA;AAAA,QAElC,UAAAT;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACD;AAEF,CAAC;AAEDL,EAAoB,cAAc;"}
1
+ {"version":3,"file":"ContextDropdownMenu.js","sources":["../../src/ContextPopover/ContextDropdownMenu.tsx"],"sourcesContent":["'use client';\n\nimport { ComponentPropsWithoutRef, forwardRef, PropsWithChildren } from \"react\";\nimport {\n\tDropdownMenu,\n\tDropdownMenuContent,\n\tDropdownMenuTrigger\n} from \"../DropdownMenu\";\n\nexport interface IContextDropdownMenuProps\n\textends ComponentPropsWithoutRef<typeof DropdownMenu> {\n\tcoords: { x: number; y: number };\n}\n\nexport const ContextDropdownMenu = forwardRef<\n\tHTMLDivElement,\n\tPropsWithChildren<IContextDropdownMenuProps>\n>((props, ref) => {\n\tconst { coords, children, ...rest } = props;\n\tconst virtualTriggerRect = new DOMRect(coords.x, coords.y, 0, 0);\n\treturn (\n\t\t<DropdownMenu {...rest}>\n\t\t\t<DropdownMenuTrigger asChild>\n\t\t\t\t<div\n\t\t\t\t\tref={(node) => {\n\t\t\t\t\t\tif (node) {\n\t\t\t\t\t\t\tObject.defineProperty(node, 'getBoundingClientRect', {\n\t\t\t\t\t\t\t\tvalue: () => virtualTriggerRect,\n\t\t\t\t\t\t\t\twritable: true,\n\t\t\t\t\t\t\t\tconfigurable: true,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tclassName='fixed w-[1px] h-[1px] opacity-0 pointer-events-none z-50'\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tleft: coords?.x || 0,\n\t\t\t\t\t\ttop: coords?.y || 0,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</DropdownMenuTrigger>\n\t\t\t<DropdownMenuContent\n\t\t\t\tref={ref}\n\t\t\t\tclassName=\"p-2 relative w-auto h-fit min-w-[150px] max-h-[300px] overflow-y-auto\"\n\t\t\t\talign=\"start\"\n\t\t\t\tsideOffset={5}\n\t\t\t\tonCloseAutoFocus={(event) => event.preventDefault()}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</DropdownMenuContent>\n\t\t</DropdownMenu>\n\t)\n})\n\nContextDropdownMenu.displayName = 'ContextDropdownMenu'\n"],"names":["ContextDropdownMenu","forwardRef","props","ref","coords","children","rest","virtualTriggerRect","jsxs","DropdownMenu","jsx","DropdownMenuTrigger","node","DropdownMenuContent","event"],"mappings":";;;AAcO,MAAMA,IAAsBC,EAGjC,CAACC,GAAOC,MAAQ;AACjB,QAAM,EAAE,QAAAC,GAAQ,UAAAC,GAAU,GAAGC,MAASJ,GAChCK,IAAqB,IAAI,QAAQH,EAAO,GAAGA,EAAO,GAAG,GAAG,CAAC;AAC/D,SACC,gBAAAI,EAACC,GAAA,EAAc,GAAGH,GACjB,UAAA;AAAA,IAAA,gBAAAI,EAACC,GAAA,EAAoB,SAAO,IAC3B,UAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,KAAK,CAACE,MAAS;AACd,UAAIA,KACH,OAAO,eAAeA,GAAM,yBAAyB;AAAA,YACpD,OAAO,MAAML;AAAA,YACb,UAAU;AAAA,YACV,cAAc;AAAA,UAAA,CACd;AAAA,QAEH;AAAA,QACA,WAAU;AAAA,QACV,OAAO;AAAA,UACN,MAAMH,GAAQ,KAAK;AAAA,UACnB,KAAKA,GAAQ,KAAK;AAAA,QAAA;AAAA,MACnB;AAAA,IAAA,GAEF;AAAA,IACA,gBAAAM;AAAA,MAACG;AAAA,MAAA;AAAA,QACA,KAAAV;AAAA,QACA,WAAU;AAAA,QACV,OAAM;AAAA,QACN,YAAY;AAAA,QACZ,kBAAkB,CAACW,MAAUA,EAAM,eAAA;AAAA,QAElC,UAAAT;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACD;AAEF,CAAC;AAEDL,EAAoB,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContextPopover.js","sources":["../../src/ContextPopover/ContextPopover.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, PropsWithChildren } from \"react\";\r\nimport { Popover, PopoverContent, PopoverTrigger } from \"../Popover\";\r\n\r\nexport interface IContextPopoverProps\r\n\textends ComponentPropsWithoutRef<typeof Popover> {\r\n\tcoords: { x: number; y: number };\r\n}\r\n\r\nexport const ContextPopover = forwardRef<\r\n\tHTMLDivElement,\r\n\tPropsWithChildren<IContextPopoverProps>\r\n>((props, ref) => {\r\n\tconst { coords, children, ...rest } = props;\r\n\treturn (\r\n\t\t<Popover {...rest}>\r\n\t\t\t<PopoverTrigger asChild>\r\n\t\t\t\t<div\r\n\t\t\t\t\tclassName='fixed w-[1px] h-[1px] opacity-0 pointer-events-none z-50'\r\n\t\t\t\t\tstyle={{\r\n\t\t\t\t\t\tleft: coords?.x || 0,\r\n\t\t\t\t\t\ttop: coords?.y || 0,\r\n\t\t\t\t\t}}\r\n\t\t\t\t/>\r\n\t\t\t</PopoverTrigger>\r\n\t\t\t<PopoverContent\r\n\t\t\t\tref={ref}\r\n\t\t\t\tclassName=\"p-2 relative w-auto h-fit min-w-[150px] max-h-[300px] overflow-y-auto\"\r\n\t\t\t\talign=\"start\"\r\n\t\t\t\tsideOffset={5}\r\n\t\t\t\tonOpenAutoFocus={(event) => event.preventDefault()}\r\n\t\t\t>\r\n\t\t\t\t{children}\r\n\t\t\t</PopoverContent>\r\n\t\t</Popover>\r\n\t)\r\n})\r\n\r\nContextPopover.displayName = 'ContextPopover'\r\n"],"names":["ContextPopover","forwardRef","props","ref","coords","children","rest","jsxs","Popover","jsx","PopoverTrigger","PopoverContent","event"],"mappings":";;;AAQO,MAAMA,IAAiBC,EAG5B,CAACC,GAAOC,MAAQ;AACjB,QAAM,EAAE,QAAAC,GAAQ,UAAAC,GAAU,GAAGC,MAASJ;AACtC,SACC,gBAAAK,EAACC,GAAA,EAAS,GAAGF,GACZ,UAAA;AAAA,IAAA,gBAAAG,EAACC,GAAA,EAAe,SAAO,IACtB,UAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAU;AAAA,QACV,OAAO;AAAA,UACN,MAAML,GAAQ,KAAK;AAAA,UACnB,KAAKA,GAAQ,KAAK;AAAA,QAAA;AAAA,MACnB;AAAA,IAAA,GAEF;AAAA,IACA,gBAAAK;AAAA,MAACE;AAAA,MAAA;AAAA,QACA,KAAAR;AAAA,QACA,WAAU;AAAA,QACV,OAAM;AAAA,QACN,YAAY;AAAA,QACZ,iBAAiB,CAACS,MAAUA,EAAM,eAAA;AAAA,QAEjC,UAAAP;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACD;AAEF,CAAC;AAEDL,EAAe,cAAc;"}
1
+ {"version":3,"file":"ContextPopover.js","sources":["../../src/ContextPopover/ContextPopover.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, PropsWithChildren } from \"react\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../Popover\";\n\nexport interface IContextPopoverProps\n\textends ComponentPropsWithoutRef<typeof Popover> {\n\tcoords: { x: number; y: number };\n}\n\nexport const ContextPopover = forwardRef<\n\tHTMLDivElement,\n\tPropsWithChildren<IContextPopoverProps>\n>((props, ref) => {\n\tconst { coords, children, ...rest } = props;\n\treturn (\n\t\t<Popover {...rest}>\n\t\t\t<PopoverTrigger asChild>\n\t\t\t\t<div\n\t\t\t\t\tclassName='fixed w-[1px] h-[1px] opacity-0 pointer-events-none z-50'\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tleft: coords?.x || 0,\n\t\t\t\t\t\ttop: coords?.y || 0,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</PopoverTrigger>\n\t\t\t<PopoverContent\n\t\t\t\tref={ref}\n\t\t\t\tclassName=\"p-2 relative w-auto h-fit min-w-[150px] max-h-[300px] overflow-y-auto\"\n\t\t\t\talign=\"start\"\n\t\t\t\tsideOffset={5}\n\t\t\t\tonOpenAutoFocus={(event) => event.preventDefault()}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</PopoverContent>\n\t\t</Popover>\n\t)\n})\n\nContextPopover.displayName = 'ContextPopover'\n"],"names":["ContextPopover","forwardRef","props","ref","coords","children","rest","jsxs","Popover","jsx","PopoverTrigger","PopoverContent","event"],"mappings":";;;AAQO,MAAMA,IAAiBC,EAG5B,CAACC,GAAOC,MAAQ;AACjB,QAAM,EAAE,QAAAC,GAAQ,UAAAC,GAAU,GAAGC,MAASJ;AACtC,SACC,gBAAAK,EAACC,GAAA,EAAS,GAAGF,GACZ,UAAA;AAAA,IAAA,gBAAAG,EAACC,GAAA,EAAe,SAAO,IACtB,UAAA,gBAAAD;AAAA,MAAC;AAAA,MAAA;AAAA,QACA,WAAU;AAAA,QACV,OAAO;AAAA,UACN,MAAML,GAAQ,KAAK;AAAA,UACnB,KAAKA,GAAQ,KAAK;AAAA,QAAA;AAAA,MACnB;AAAA,IAAA,GAEF;AAAA,IACA,gBAAAK;AAAA,MAACE;AAAA,MAAA;AAAA,QACA,KAAAR;AAAA,QACA,WAAU;AAAA,QACV,OAAM;AAAA,QACN,YAAY;AAAA,QACZ,iBAAiB,CAACS,MAAUA,EAAM,eAAA;AAAA,QAEjC,UAAAP;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,GACD;AAEF,CAAC;AAEDL,EAAe,cAAc;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useContextPopoverHandler.js","sources":["../../src/ContextPopover/useContextPopoverHandler.ts"],"sourcesContent":["import { MouseEvent, useCallback, useRef, useState } from \"react\";\r\nimport { useOnClickOutside } from \"@oneplatformdev/hooks\";\r\n\r\nexport const useContextPopoverHandler = <\r\n\tData,\r\n\tElement extends HTMLDivElement = HTMLDivElement\r\n>() => {\r\n\tconst [ open, setOpen ] = useState(false);\r\n\tconst [ coords, setCoords ] = useState({ x: 0, y: 0 });\r\n\tconst [ data, setData ] = useState<Data | null>(null);\r\n\r\n\tconst ref = useRef<Element>(null!);\r\n\r\n\tuseOnClickOutside(ref, () => {\r\n\t\tif (open) {\r\n\t\t\tsetOpen(false);\r\n\t\t\tsetData(null);\r\n\t\t}\r\n\t});\r\n\r\n\tconst onContext = useCallback((event: MouseEvent, data: Data) => {\r\n\t\tevent.preventDefault()\r\n\r\n\t\tsetCoords({ x: event.clientX, y: event.clientY });\r\n\t\tsetData(data);\r\n\t\tsetOpen(true);\r\n\t}, [])\r\n\r\n\treturn {\r\n\t\tonContext,\r\n\t\tref,\r\n\t\topen,\r\n\t\tsetOpen,\r\n\t\tcoords,\r\n\t\tdata,\r\n\t}\r\n}\r\n\r\nexport type IUseContextPopoverHandler<Data> = ReturnType<typeof useContextPopoverHandler<Data>>;\r\n"],"names":["useContextPopoverHandler","open","setOpen","useState","coords","setCoords","data","setData","ref","useRef","useOnClickOutside","useCallback","event"],"mappings":";;AAGO,MAAMA,IAA2B,MAGjC;AACN,QAAM,CAAEC,GAAMC,CAAQ,IAAIC,EAAS,EAAK,GAClC,CAAEC,GAAQC,CAAU,IAAIF,EAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GAC/C,CAAEG,GAAMC,CAAQ,IAAIJ,EAAsB,IAAI,GAE9CK,IAAMC,EAAgB,IAAK;AAEjC,SAAAC,EAAkBF,GAAK,MAAM;AAC5B,IAAIP,MACHC,EAAQ,EAAK,GACbK,EAAQ,IAAI;AAAA,EAEd,CAAC,GAUM;AAAA,IACN,WATiBI,EAAY,CAACC,GAAmBN,MAAe;AAChE,MAAAM,EAAM,eAAA,GAENP,EAAU,EAAE,GAAGO,EAAM,SAAS,GAAGA,EAAM,SAAS,GAChDL,EAAQD,CAAI,GACZJ,EAAQ,EAAI;AAAA,IACb,GAAG,CAAA,CAAE;AAAA,IAIJ,KAAAM;AAAA,IACA,MAAAP;AAAA,IACA,SAAAC;AAAA,IACA,QAAAE;AAAA,IACA,MAAAE;AAAA,EAAA;AAEF;"}
1
+ {"version":3,"file":"useContextPopoverHandler.js","sources":["../../src/ContextPopover/useContextPopoverHandler.ts"],"sourcesContent":["import { MouseEvent, useCallback, useRef, useState } from \"react\";\nimport { useOnClickOutside } from \"@oneplatformdev/hooks\";\n\nexport const useContextPopoverHandler = <\n\tData,\n\tElement extends HTMLDivElement = HTMLDivElement\n>() => {\n\tconst [ open, setOpen ] = useState(false);\n\tconst [ coords, setCoords ] = useState({ x: 0, y: 0 });\n\tconst [ data, setData ] = useState<Data | null>(null);\n\n\tconst ref = useRef<Element>(null!);\n\n\tuseOnClickOutside(ref, () => {\n\t\tif (open) {\n\t\t\tsetOpen(false);\n\t\t\tsetData(null);\n\t\t}\n\t});\n\n\tconst onContext = useCallback((event: MouseEvent, data: Data) => {\n\t\tevent.preventDefault()\n\n\t\tsetCoords({ x: event.clientX, y: event.clientY });\n\t\tsetData(data);\n\t\tsetOpen(true);\n\t}, [])\n\n\treturn {\n\t\tonContext,\n\t\tref,\n\t\topen,\n\t\tsetOpen,\n\t\tcoords,\n\t\tdata,\n\t}\n}\n\nexport type IUseContextPopoverHandler<Data> = ReturnType<typeof useContextPopoverHandler<Data>>;\n"],"names":["useContextPopoverHandler","open","setOpen","useState","coords","setCoords","data","setData","ref","useRef","useOnClickOutside","useCallback","event"],"mappings":";;AAGO,MAAMA,IAA2B,MAGjC;AACN,QAAM,CAAEC,GAAMC,CAAQ,IAAIC,EAAS,EAAK,GAClC,CAAEC,GAAQC,CAAU,IAAIF,EAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GAC/C,CAAEG,GAAMC,CAAQ,IAAIJ,EAAsB,IAAI,GAE9CK,IAAMC,EAAgB,IAAK;AAEjC,SAAAC,EAAkBF,GAAK,MAAM;AAC5B,IAAIP,MACHC,EAAQ,EAAK,GACbK,EAAQ,IAAI;AAAA,EAEd,CAAC,GAUM;AAAA,IACN,WATiBI,EAAY,CAACC,GAAmBN,MAAe;AAChE,MAAAM,EAAM,eAAA,GAENP,EAAU,EAAE,GAAGO,EAAM,SAAS,GAAGA,EAAM,SAAS,GAChDL,EAAQD,CAAI,GACZJ,EAAQ,EAAI;AAAA,IACb,GAAG,CAAA,CAAE;AAAA,IAIJ,KAAAM;AAAA,IACA,MAAAP;AAAA,IACA,SAAAC;AAAA,IACA,QAAAE;AAAA,IACA,MAAAE;AAAA,EAAA;AAEF;"}
@@ -1,54 +1,56 @@
1
1
  import { jsxs as i, jsx as l } from "react/jsx-runtime";
2
+ import { Button as m } from "../Button/Button.js";
3
+ import "../Button/buttonVariants.js";
4
+ import "react";
5
+ import { DropdownMenu as h, DropdownMenuTrigger as p, DropdownMenuContent as g, DropdownMenuCheckboxItem as u } from "../DropdownMenu/DropdownMenu.js";
6
+ import { Table as C, TableHeader as f, TableRow as t, TableHead as w, TableBody as x, TableCell as o } from "../Table/Table.js";
2
7
  import { flexRender as d } from "@tanstack/react-table";
3
- import { ChevronDown as m } from "lucide-react";
4
- import { Button as h } from "../Button/Button.js";
5
- import { DropdownMenu as g, DropdownMenuTrigger as p, DropdownMenuContent as u, DropdownMenuCheckboxItem as C } from "../DropdownMenu/DropdownMenu.js";
6
- import { Table as f, TableHeader as w, TableRow as t, TableHead as x, TableBody as b, TableCell as o } from "../Table/Table.js";
7
- const R = ({
8
- table: r,
8
+ import { ChevronDown as b } from "lucide-react";
9
+ const y = ({
10
+ table: n,
9
11
  ToolBar: a,
10
12
  tColumns: s = "Columns",
11
13
  tNoResults: c = "No results"
12
14
  }) => /* @__PURE__ */ i("div", { className: "w-full", children: [
13
15
  /* @__PURE__ */ i("div", { className: "flex items-center py-4", children: [
14
16
  a,
15
- /* @__PURE__ */ i(g, { children: [
16
- /* @__PURE__ */ l(p, { asChild: !0, children: /* @__PURE__ */ i(h, { variant: "outline", className: "ml-auto", children: [
17
+ /* @__PURE__ */ i(h, { children: [
18
+ /* @__PURE__ */ l(p, { asChild: !0, children: /* @__PURE__ */ i(m, { variant: "outline", className: "ml-auto", children: [
17
19
  s,
18
20
  " ",
19
- /* @__PURE__ */ l(m, { className: "ml-2 h-4 w-4" })
21
+ /* @__PURE__ */ l(b, { className: "ml-2 h-4 w-4" })
20
22
  ] }) }),
21
- /* @__PURE__ */ l(u, { align: "end", children: r.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ l(
22
- C,
23
+ /* @__PURE__ */ l(g, { align: "end", children: n.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ l(
24
+ u,
23
25
  {
24
26
  className: "capitalize",
25
27
  checked: e.getIsVisible(),
26
- onCheckedChange: (n) => e.toggleVisibility(!!n),
28
+ onCheckedChange: (r) => e.toggleVisibility(!!r),
27
29
  children: e.id
28
30
  },
29
31
  e.id
30
32
  )) })
31
33
  ] })
32
34
  ] }),
33
- /* @__PURE__ */ l("div", { className: "rounded-md border", children: /* @__PURE__ */ i(f, { children: [
34
- /* @__PURE__ */ l(w, { children: r.getHeaderGroups().map((e) => /* @__PURE__ */ l(t, { children: e.headers.map((n) => /* @__PURE__ */ l(x, { children: n.isPlaceholder ? null : d(
35
- n.column.columnDef.header,
36
- n.getContext()
37
- ) }, n.id)) }, e.id)) }),
38
- /* @__PURE__ */ l(b, { children: r.getRowModel().rows?.length ? r.getRowModel().rows.map((e) => /* @__PURE__ */ l(
35
+ /* @__PURE__ */ l("div", { className: "rounded-md border", children: /* @__PURE__ */ i(C, { children: [
36
+ /* @__PURE__ */ l(f, { children: n.getHeaderGroups().map((e) => /* @__PURE__ */ l(t, { children: e.headers.map((r) => /* @__PURE__ */ l(w, { children: r.isPlaceholder ? null : d(
37
+ r.column.columnDef.header,
38
+ r.getContext()
39
+ ) }, r.id)) }, e.id)) }),
40
+ /* @__PURE__ */ l(x, { children: n.getRowModel().rows?.length ? n.getRowModel().rows.map((e) => /* @__PURE__ */ l(
39
41
  t,
40
42
  {
41
43
  "data-state": e.getIsSelected() && "selected",
42
- children: e.getVisibleCells().map((n) => /* @__PURE__ */ l(o, { children: d(
43
- n.column.columnDef.cell,
44
- n.getContext()
45
- ) }, n.id))
44
+ children: e.getVisibleCells().map((r) => /* @__PURE__ */ l(o, { children: d(
45
+ r.column.columnDef.cell,
46
+ r.getContext()
47
+ ) }, r.id))
46
48
  },
47
49
  e.id
48
50
  )) : /* @__PURE__ */ l(t, { children: /* @__PURE__ */ l(
49
51
  o,
50
52
  {
51
- colSpan: r.getAllColumns().length,
53
+ colSpan: n.getAllColumns().length,
52
54
  className: "h-24 text-center",
53
55
  children: c
54
56
  }
@@ -56,6 +58,6 @@ const R = ({
56
58
  ] }) })
57
59
  ] });
58
60
  export {
59
- R as DataTable
61
+ y as DataTable
60
62
  };
61
63
  //# sourceMappingURL=DataTable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","sources":["../../src/DataTable/DataTable.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { Button } from '../Button';\r\nimport {\r\n DropdownMenu,\r\n DropdownMenuCheckboxItem,\r\n DropdownMenuContent,\r\n DropdownMenuTrigger,\r\n} from '../DropdownMenu';\r\nimport {\r\n Table,\r\n TableBody,\r\n TableCell,\r\n TableHead,\r\n TableHeader,\r\n TableRow,\r\n} from '../Table';\r\nimport { flexRender, type Table as ReactTable } from '@tanstack/react-table';\r\nimport { ChevronDown } from 'lucide-react';\r\nimport React, { FC } from 'react';\r\n\r\ninterface IProps {\r\n table: ReactTable<any>;\r\n ToolBar?: React.ReactNode;\r\n tColumns?: string;\r\n tNoResults?: string;\r\n}\r\n\r\nexport const DataTable: FC<IProps> = ({\r\n table,\r\n ToolBar,\r\n tColumns = 'Columns',\r\n tNoResults = 'No results',\r\n}) => {\r\n return (\r\n <div className=\"w-full\">\r\n <div className=\"flex items-center py-4\">\r\n {ToolBar}\r\n <DropdownMenu>\r\n <DropdownMenuTrigger asChild>\r\n <Button variant=\"outline\" className=\"ml-auto\">\r\n {tColumns} <ChevronDown className=\"ml-2 h-4 w-4\" />\r\n </Button>\r\n </DropdownMenuTrigger>\r\n <DropdownMenuContent align=\"end\">\r\n {table\r\n .getAllColumns()\r\n .filter((column) => column.getCanHide())\r\n .map((column) => {\r\n return (\r\n <DropdownMenuCheckboxItem\r\n key={column.id}\r\n className=\"capitalize\"\r\n checked={column.getIsVisible()}\r\n onCheckedChange={(value) =>\r\n column.toggleVisibility(!!value)\r\n }\r\n >\r\n {column.id}\r\n </DropdownMenuCheckboxItem>\r\n );\r\n })}\r\n </DropdownMenuContent>\r\n </DropdownMenu>\r\n </div>\r\n <div className=\"rounded-md border\">\r\n <Table>\r\n <TableHeader>\r\n {table.getHeaderGroups().map((headerGroup) => (\r\n <TableRow key={headerGroup.id}>\r\n {headerGroup.headers.map((header) => {\r\n return (\r\n <TableHead key={header.id}>\r\n {header.isPlaceholder\r\n ? null\r\n : flexRender(\r\n header.column.columnDef.header,\r\n header.getContext()\r\n )}\r\n </TableHead>\r\n );\r\n })}\r\n </TableRow>\r\n ))}\r\n </TableHeader>\r\n <TableBody>\r\n {table.getRowModel().rows?.length ? (\r\n table.getRowModel().rows.map((row) => (\r\n <TableRow\r\n key={row.id}\r\n data-state={row.getIsSelected() && 'selected'}\r\n >\r\n {row.getVisibleCells().map((cell) => (\r\n <TableCell key={cell.id}>\r\n {flexRender(\r\n cell.column.columnDef.cell,\r\n cell.getContext()\r\n )}\r\n </TableCell>\r\n ))}\r\n </TableRow>\r\n ))\r\n ) : (\r\n <TableRow>\r\n <TableCell\r\n colSpan={table.getAllColumns().length}\r\n className=\"h-24 text-center\"\r\n >\r\n {tNoResults}\r\n </TableCell>\r\n </TableRow>\r\n )}\r\n </TableBody>\r\n </Table>\r\n </div>\r\n </div>\r\n );\r\n};\r\n"],"names":["DataTable","table","ToolBar","tColumns","tNoResults","jsxs","DropdownMenu","jsx","DropdownMenuTrigger","Button","ChevronDown","DropdownMenuContent","column","DropdownMenuCheckboxItem","value","Table","TableHeader","headerGroup","TableRow","header","TableHead","flexRender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A,MACxBA,EAAO,WAAA;AAAA,IAAW,EACpB,GANUA,EAAO,EAOvB,CAEH,EAAA,GAZYF,EAAY,EAa3B,CACD,EAAA,CACH;AAAA,IACA,gBAAAV,EAACe,GAAA,EACE,UAAArB,EAAM,YAAA,EAAc,MAAM,SACzBA,EAAM,YAAA,EAAc,KAAK,IAAI,CAACsB,MAC5B,gBAAAhB;AAAA,MAACW;AAAA,MAAA;AAAA,QAEC,cAAYK,EAAI,cAAA,KAAmB;AAAA,QAElC,YAAI,gBAAA,EAAkB,IAAI,CAACC,wBACzBC,GAAA,EACE,UAAAJ;AAAA,UACCG,EAAK,OAAO,UAAU;AAAA,UACtBA,EAAK,WAAA;AAAA,QAAW,EAClB,GAJcA,EAAK,EAKrB,CACD;AAAA,MAAA;AAAA,MAVID,EAAI;AAAA,IAAA,CAYZ,IAED,gBAAAhB,EAACW,GAAA,EACC,UAAA,gBAAAX;AAAA,MAACkB;AAAA,MAAA;AAAA,QACC,SAASxB,EAAM,cAAA,EAAgB;AAAA,QAC/B,WAAU;AAAA,QAET,UAAAG;AAAA,MAAA;AAAA,IAAA,GAEL,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAAA,GACF;"}
1
+ {"version":3,"file":"DataTable.js","sources":["../../src/DataTable/DataTable.tsx"],"sourcesContent":["'use client';\n\nimport { Button } from '../Button';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from '../DropdownMenu';\nimport {\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableHeader,\n TableRow,\n} from '../Table';\nimport { flexRender, type Table as ReactTable } from '@tanstack/react-table';\nimport { ChevronDown } from 'lucide-react';\nimport React, { FC } from 'react';\n\ninterface IProps {\n table: ReactTable<any>;\n ToolBar?: React.ReactNode;\n tColumns?: string;\n tNoResults?: string;\n}\n\nexport const DataTable: FC<IProps> = ({\n table,\n ToolBar,\n tColumns = 'Columns',\n tNoResults = 'No results',\n}) => {\n return (\n <div className=\"w-full\">\n <div className=\"flex items-center py-4\">\n {ToolBar}\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" className=\"ml-auto\">\n {tColumns} <ChevronDown className=\"ml-2 h-4 w-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {table\n .getAllColumns()\n .filter((column) => column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n className=\"capitalize\"\n checked={column.getIsVisible()}\n onCheckedChange={(value) =>\n column.toggleVisibility(!!value)\n }\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <div className=\"rounded-md border\">\n <Table>\n <TableHeader>\n {table.getHeaderGroups().map((headerGroup) => (\n <TableRow key={headerGroup.id}>\n {headerGroup.headers.map((header) => {\n return (\n <TableHead key={header.id}>\n {header.isPlaceholder\n ? null\n : flexRender(\n header.column.columnDef.header,\n header.getContext()\n )}\n </TableHead>\n );\n })}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody>\n {table.getRowModel().rows?.length ? (\n table.getRowModel().rows.map((row) => (\n <TableRow\n key={row.id}\n data-state={row.getIsSelected() && 'selected'}\n >\n {row.getVisibleCells().map((cell) => (\n <TableCell key={cell.id}>\n {flexRender(\n cell.column.columnDef.cell,\n cell.getContext()\n )}\n </TableCell>\n ))}\n </TableRow>\n ))\n ) : (\n <TableRow>\n <TableCell\n colSpan={table.getAllColumns().length}\n className=\"h-24 text-center\"\n >\n {tNoResults}\n </TableCell>\n </TableRow>\n )}\n </TableBody>\n </Table>\n </div>\n </div>\n );\n};\n"],"names":["DataTable","table","ToolBar","tColumns","tNoResults","jsxs","DropdownMenu","jsx","DropdownMenuTrigger","Button","ChevronDown","DropdownMenuContent","column","DropdownMenuCheckboxItem","value","Table","TableHeader","headerGroup","TableRow","header","TableHead","flexRender","TableBody","row","cell","TableCell"],"mappings":";;;;;;;;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EACpB,GANUA,EAAO,EAOvB,CAEH,EAAA,GAZYF,EAAY,EAa3B,CACD,EAAA,CACH;AAAA,IACA,gBAAAV,EAACe,GAAA,EACE,UAAArB,EAAM,YAAA,EAAc,MAAM,SACzBA,EAAM,YAAA,EAAc,KAAK,IAAI,CAACsB,MAC5B,gBAAAhB;AAAA,MAACW;AAAA,MAAA;AAAA,QAEC,cAAYK,EAAI,cAAA,KAAmB;AAAA,QAElC,YAAI,gBAAA,EAAkB,IAAI,CAACC,wBACzBC,GAAA,EACE,UAAAJ;AAAA,UACCG,EAAK,OAAO,UAAU;AAAA,UACtBA,EAAK,WAAA;AAAA,QAAW,EAClB,GAJcA,EAAK,EAKrB,CACD;AAAA,MAAA;AAAA,MAVID,EAAI;AAAA,IAAA,CAYZ,IAED,gBAAAhB,EAACW,GAAA,EACC,UAAA,gBAAAX;AAAA,MAACkB;AAAA,MAAA;AAAA,QACC,SAASxB,EAAM,cAAA,EAAgB;AAAA,QAC/B,WAAU;AAAA,QAET,UAAAG;AAAA,MAAA;AAAA,IAAA,GAEL,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAAA,GACF;"}
@@ -1,13 +1,14 @@
1
1
  import { jsx as n, jsxs as t } from "react/jsx-runtime";
2
- import { ChevronDown as s } from "lucide-react";
3
- import { useMemo as m } from "react";
2
+ import { ChevronDown as m } from "lucide-react";
3
+ import { useMemo as s } from "react";
4
4
  import { Button as d } from "../Button/Button.js";
5
+ import "../Button/buttonVariants.js";
5
6
  import { DropdownMenuCheckboxItem as c, DropdownMenu as u, DropdownMenuTrigger as h, DropdownMenuContent as p } from "../DropdownMenu/DropdownMenu.js";
6
- const D = (i) => {
7
+ const x = (i) => {
7
8
  const {
8
9
  table: r,
9
10
  columnsLabel: l = "Columns"
10
- } = i, o = m(() => r.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ n(
11
+ } = i, o = s(() => r.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ n(
11
12
  c,
12
13
  {
13
14
  className: "capitalize",
@@ -20,12 +21,12 @@ const D = (i) => {
20
21
  return o.length ? /* @__PURE__ */ t(u, { children: [
21
22
  /* @__PURE__ */ n(h, { asChild: !0, children: /* @__PURE__ */ t(d, { variant: "outline", className: "ml-auto", children: [
22
23
  l,
23
- /* @__PURE__ */ n(s, { className: "ml-2 h-4 w-4" })
24
+ /* @__PURE__ */ n(m, { className: "ml-2 h-4 w-4" })
24
25
  ] }) }),
25
26
  /* @__PURE__ */ n(p, { align: "end", children: o })
26
27
  ] }) : null;
27
28
  };
28
29
  export {
29
- D as DataTableColumnFilter
30
+ x as DataTableColumnFilter
30
31
  };
31
32
  //# sourceMappingURL=DataTableColumnFilter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataTableColumnFilter.js","sources":["../../src/DataTable/DataTableColumnFilter.tsx"],"sourcesContent":["'use client';\r\n\r\nimport { ChevronDown } from 'lucide-react';\r\nimport React, { FC, useMemo } from 'react';\r\n\r\nimport { Button } from '../Button';\r\nimport {\r\n DropdownMenu,\r\n DropdownMenuCheckboxItem,\r\n DropdownMenuContent,\r\n DropdownMenuTrigger,\r\n} from '../DropdownMenu';\r\nimport { DataTableProps } from './DataTable.types';\r\n\r\n// TODO: refactor this component to use the new Table component\r\nexport const DataTableColumnFilter: FC<DataTableProps> = (props) => {\r\n const {\r\n table,\r\n columnsLabel = 'Columns',\r\n } = props;\r\n\r\n const columnsCheckboxRender = useMemo(() => {\r\n return table\r\n .getAllColumns()\r\n .filter((column) => column.getCanHide())\r\n .map((column) => {\r\n return (\r\n <DropdownMenuCheckboxItem\r\n key={column.id}\r\n className=\"capitalize\"\r\n checked={column.getIsVisible()}\r\n onCheckedChange={(value) =>\r\n column.toggleVisibility(!!value)\r\n }\r\n >\r\n {column.id}\r\n </DropdownMenuCheckboxItem>\r\n );\r\n })\r\n }, [table])\r\n\r\n if(!columnsCheckboxRender.length) return null;\r\n\r\n return (\r\n <DropdownMenu>\r\n <DropdownMenuTrigger asChild>\r\n <Button variant=\"outline\" className=\"ml-auto\">\r\n {columnsLabel}\r\n <ChevronDown className=\"ml-2 h-4 w-4\" />\r\n </Button>\r\n </DropdownMenuTrigger>\r\n <DropdownMenuContent align=\"end\">\r\n {columnsCheckboxRender}\r\n </DropdownMenuContent>\r\n </DropdownMenu>\r\n );\r\n};\r\n"],"names":["DataTableColumnFilter","props","table","columnsLabel","columnsCheckboxRender","useMemo","column","jsx","DropdownMenuCheckboxItem","value","DropdownMenu","DropdownMenuTrigger","jsxs","Button","ChevronDown","DropdownMenuContent"],"mappings":";;;;;AAeO,MAAMA,IAA4C,CAACC,MAAU;AAClE,QAAM;AAAA,IACJ,OAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,EAAA,IACbF,GAEEG,IAAwBC,EAAQ,MAC7BH,EACJ,gBACA,OAAO,CAACI,MAAWA,EAAO,WAAA,CAAY,EACtC,IAAI,CAACA,MAEF,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,WAAU;AAAA,MACV,SAASF,EAAO,aAAA;AAAA,MAChB,iBAAiB,CAACG,MAChBH,EAAO,iBAAiB,CAAC,CAACG,CAAK;AAAA,MAGhC,UAAAH,EAAO;AAAA,IAAA;AAAA,IAPHA,EAAO;AAAA,EAAA,CAUjB,GACF,CAACJ,CAAK,CAAC;AAEV,SAAIE,EAAsB,2BAGvBM,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAH,EAACI,GAAA,EAAoB,SAAO,IAC1B,UAAA,gBAAAC,EAACC,KAAO,SAAQ,WAAU,WAAU,WACjC,UAAA;AAAA,MAAAV;AAAA,MACD,gBAAAI,EAACO,GAAA,EAAY,WAAU,eAAA,CAAe;AAAA,IAAA,EAAA,CACxC,EAAA,CACF;AAAA,IACA,gBAAAP,EAACQ,GAAA,EAAoB,OAAM,OACxB,UAAAX,EAAA,CACH;AAAA,EAAA,GACF,IAbuC;AAe3C;"}
1
+ {"version":3,"file":"DataTableColumnFilter.js","sources":["../../src/DataTable/DataTableColumnFilter.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown } from 'lucide-react';\nimport React, { FC, useMemo } from 'react';\n\nimport { Button } from '../Button';\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuTrigger,\n} from '../DropdownMenu';\nimport { DataTableProps } from './DataTable.types';\n\n// TODO: refactor this component to use the new Table component\nexport const DataTableColumnFilter: FC<DataTableProps> = (props) => {\n const {\n table,\n columnsLabel = 'Columns',\n } = props;\n\n const columnsCheckboxRender = useMemo(() => {\n return table\n .getAllColumns()\n .filter((column) => column.getCanHide())\n .map((column) => {\n return (\n <DropdownMenuCheckboxItem\n key={column.id}\n className=\"capitalize\"\n checked={column.getIsVisible()}\n onCheckedChange={(value) =>\n column.toggleVisibility(!!value)\n }\n >\n {column.id}\n </DropdownMenuCheckboxItem>\n );\n })\n }, [table])\n\n if(!columnsCheckboxRender.length) return null;\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"outline\" className=\"ml-auto\">\n {columnsLabel}\n <ChevronDown className=\"ml-2 h-4 w-4\" />\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\">\n {columnsCheckboxRender}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n};\n"],"names":["DataTableColumnFilter","props","table","columnsLabel","columnsCheckboxRender","useMemo","column","jsx","DropdownMenuCheckboxItem","value","DropdownMenu","DropdownMenuTrigger","jsxs","Button","ChevronDown","DropdownMenuContent"],"mappings":";;;;;;AAeO,MAAMA,IAA4C,CAACC,MAAU;AAClE,QAAM;AAAA,IACJ,OAAAC;AAAA,IACA,cAAAC,IAAe;AAAA,EAAA,IACbF,GAEEG,IAAwBC,EAAQ,MAC7BH,EACJ,gBACA,OAAO,CAACI,MAAWA,EAAO,WAAA,CAAY,EACtC,IAAI,CAACA,MAEF,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MAEC,WAAU;AAAA,MACV,SAASF,EAAO,aAAA;AAAA,MAChB,iBAAiB,CAACG,MAChBH,EAAO,iBAAiB,CAAC,CAACG,CAAK;AAAA,MAGhC,UAAAH,EAAO;AAAA,IAAA;AAAA,IAPHA,EAAO;AAAA,EAAA,CAUjB,GACF,CAACJ,CAAK,CAAC;AAEV,SAAIE,EAAsB,2BAGvBM,GAAA,EACC,UAAA;AAAA,IAAA,gBAAAH,EAACI,GAAA,EAAoB,SAAO,IAC1B,UAAA,gBAAAC,EAACC,KAAO,SAAQ,WAAU,WAAU,WACjC,UAAA;AAAA,MAAAV;AAAA,MACD,gBAAAI,EAACO,GAAA,EAAY,WAAU,eAAA,CAAe;AAAA,IAAA,EAAA,CACxC,EAAA,CACF;AAAA,IACA,gBAAAP,EAACQ,GAAA,EAAoB,OAAM,OACxB,UAAAX,EAAA,CACH;AAAA,EAAA,GACF,IAbuC;AAe3C;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDataTable.js","sources":["../../src/DataTable/useDataTable.ts"],"sourcesContent":["import React from 'react';\r\nimport {\r\n ColumnFiltersState,\r\n SortingState,\r\n VisibilityState,\r\n getCoreRowModel,\r\n getFilteredRowModel,\r\n getPaginationRowModel,\r\n getSortedRowModel,\r\n useReactTable,\r\n} from '@tanstack/react-table';\r\n\r\n// TODO: refactor any type\r\nexport const useDataTable = (data: any, columns: any) => {\r\n const [sorting, setSorting] = React.useState<SortingState>([]);\r\n const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(\r\n []\r\n );\r\n const [columnVisibility, setColumnVisibility] =\r\n React.useState<VisibilityState>({});\r\n\r\n const table = useReactTable({\r\n data,\r\n columns,\r\n onSortingChange: setSorting,\r\n onColumnFiltersChange: setColumnFilters,\r\n getCoreRowModel: getCoreRowModel(),\r\n getPaginationRowModel: getPaginationRowModel(),\r\n getSortedRowModel: getSortedRowModel(),\r\n getFilteredRowModel: getFilteredRowModel(),\r\n onColumnVisibilityChange: setColumnVisibility,\r\n enableRowSelection: true,\r\n manualPagination: true,\r\n manualSorting: true,\r\n manualFiltering: true,\r\n state: {\r\n sorting,\r\n columnFilters,\r\n columnVisibility,\r\n },\r\n });\r\n\r\n return { table };\r\n};\r\n"],"names":["useDataTable","data","columns","sorting","setSorting","React","columnFilters","setColumnFilters","columnVisibility","setColumnVisibility","useReactTable","getCoreRowModel","getPaginationRowModel","getSortedRowModel","getFilteredRowModel"],"mappings":";;AAaO,MAAMA,IAAe,CAACC,GAAWC,MAAiB;AACvD,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAM,SAAuB,CAAA,CAAE,GACvD,CAACC,GAAeC,CAAgB,IAAIF,EAAM;AAAA,IAC9C,CAAA;AAAA,EAAC,GAEG,CAACG,GAAkBC,CAAmB,IAC1CJ,EAAM,SAA0B,CAAA,CAAE;AAuBpC,SAAO,EAAE,OArBKK,EAAc;AAAA,IAC1B,MAAAT;AAAA,IACA,SAAAC;AAAA,IACA,iBAAiBE;AAAA,IACjB,uBAAuBG;AAAA,IACvB,iBAAiBI,EAAA;AAAA,IACjB,uBAAuBC,EAAA;AAAA,IACvB,mBAAmBC,EAAA;AAAA,IACnB,qBAAqBC,EAAA;AAAA,IACrB,0BAA0BL;AAAA,IAC1B,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,OAAO;AAAA,MACL,SAAAN;AAAA,MACA,eAAAG;AAAA,MACA,kBAAAE;AAAA,IAAA;AAAA,EACF,CACD,EAEQ;AACX;"}
1
+ {"version":3,"file":"useDataTable.js","sources":["../../src/DataTable/useDataTable.ts"],"sourcesContent":["import React from 'react';\nimport {\n ColumnFiltersState,\n SortingState,\n VisibilityState,\n getCoreRowModel,\n getFilteredRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n useReactTable,\n} from '@tanstack/react-table';\n\n// TODO: refactor any type\nexport const useDataTable = (data: any, columns: any) => {\n const [sorting, setSorting] = React.useState<SortingState>([]);\n const [columnFilters, setColumnFilters] = React.useState<ColumnFiltersState>(\n []\n );\n const [columnVisibility, setColumnVisibility] =\n React.useState<VisibilityState>({});\n\n const table = useReactTable({\n data,\n columns,\n onSortingChange: setSorting,\n onColumnFiltersChange: setColumnFilters,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getFilteredRowModel: getFilteredRowModel(),\n onColumnVisibilityChange: setColumnVisibility,\n enableRowSelection: true,\n manualPagination: true,\n manualSorting: true,\n manualFiltering: true,\n state: {\n sorting,\n columnFilters,\n columnVisibility,\n },\n });\n\n return { table };\n};\n"],"names":["useDataTable","data","columns","sorting","setSorting","React","columnFilters","setColumnFilters","columnVisibility","setColumnVisibility","useReactTable","getCoreRowModel","getPaginationRowModel","getSortedRowModel","getFilteredRowModel"],"mappings":";;AAaO,MAAMA,IAAe,CAACC,GAAWC,MAAiB;AACvD,QAAM,CAACC,GAASC,CAAU,IAAIC,EAAM,SAAuB,CAAA,CAAE,GACvD,CAACC,GAAeC,CAAgB,IAAIF,EAAM;AAAA,IAC9C,CAAA;AAAA,EAAC,GAEG,CAACG,GAAkBC,CAAmB,IAC1CJ,EAAM,SAA0B,CAAA,CAAE;AAuBpC,SAAO,EAAE,OArBKK,EAAc;AAAA,IAC1B,MAAAT;AAAA,IACA,SAAAC;AAAA,IACA,iBAAiBE;AAAA,IACjB,uBAAuBG;AAAA,IACvB,iBAAiBI,EAAA;AAAA,IACjB,uBAAuBC,EAAA;AAAA,IACvB,mBAAmBC,EAAA;AAAA,IACnB,qBAAqBC,EAAA;AAAA,IACrB,0BAA0BL;AAAA,IAC1B,oBAAoB;AAAA,IACpB,kBAAkB;AAAA,IAClB,eAAe;AAAA,IACf,iBAAiB;AAAA,IACjB,OAAO;AAAA,MACL,SAAAN;AAAA,MACA,eAAAG;AAAA,MACA,kBAAAE;AAAA,IAAA;AAAA,EACF,CACD,EAEQ;AACX;"}
@@ -1,32 +1,33 @@
1
- import { jsxs as o, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
2
  import * as i from "react";
3
3
  import { format as d } from "date-fns";
4
4
  import { Calendar as s } from "lucide-react";
5
5
  import { cn as c } from "@oneplatformdev/utils";
6
- import { uk as t } from "date-fns/locale";
7
6
  import { Button as f } from "../Button/Button.js";
7
+ import "../Button/buttonVariants.js";
8
8
  import { Calendar as p } from "../Calendar/Calendar.js";
9
9
  import { Popover as u, PopoverTrigger as h, PopoverContent as y } from "../Popover/Popover.js";
10
+ import { uk as t } from "date-fns/locale";
10
11
  const g = i.forwardRef(
11
- (a, l) => {
12
+ (a, m) => {
12
13
  const {
13
- selectedDate: e,
14
- onDateChange: m,
14
+ selectedDate: o,
15
+ onDateChange: l,
15
16
  disabled: n = !1
16
17
  } = a;
17
- return /* @__PURE__ */ o(u, { children: [
18
- /* @__PURE__ */ r(h, { asChild: !0, children: /* @__PURE__ */ o(
18
+ return /* @__PURE__ */ e(u, { children: [
19
+ /* @__PURE__ */ r(h, { asChild: !0, children: /* @__PURE__ */ e(
19
20
  f,
20
21
  {
21
- ref: l,
22
+ ref: m,
22
23
  disabled: n,
23
24
  variant: "outline-solid",
24
25
  className: c(
25
26
  "w-full justify-start text-left font-normal border h-10",
26
- !e && "text-muted-foreground"
27
+ !o && "text-muted-foreground"
27
28
  ),
28
29
  children: [
29
- e ? d(e, "LLL dd, y", { locale: t }) : /* @__PURE__ */ r("span", { children: "dd/mm/yyyy" }),
30
+ o ? d(o, "LLL dd, y", { locale: t }) : /* @__PURE__ */ r("span", { children: "dd/mm/yyyy" }),
30
31
  /* @__PURE__ */ r(s, { className: "mr-2 h-4 w-4 ml-auto" })
31
32
  ]
32
33
  }
@@ -36,8 +37,8 @@ const g = i.forwardRef(
36
37
  {
37
38
  mode: "single",
38
39
  captionLayout: "dropdown-buttons",
39
- selected: e,
40
- onSelect: m,
40
+ selected: o,
41
+ onSelect: l,
41
42
  fromYear: 1960,
42
43
  toYear: 2030,
43
44
  locale: t
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sources":["../../src/DatePicker/DatePicker.tsx"],"sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { format } from 'date-fns';\r\nimport { Calendar as CalendarIcon } from 'lucide-react';\r\nimport { cn } from '@oneplatformdev/utils';\r\nimport { Button } from '../Button';\r\nimport { Calendar } from '../Calendar';\r\nimport { Popover, PopoverContent, PopoverTrigger } from '../Popover';\r\nimport { uk } from 'date-fns/locale';\r\nimport { DatePickerProps } from './DatePicker.types';\r\n\r\nexport const DatePicker = React.forwardRef<HTMLButtonElement, DatePickerProps>(\r\n (props, ref) => {\r\n const {\r\n selectedDate,\r\n onDateChange,\r\n disabled = false\r\n } = props;\r\n return (\r\n <Popover>\r\n <PopoverTrigger asChild>\r\n <Button\r\n ref={ref}\r\n disabled={disabled}\r\n variant={'outline-solid'}\r\n className={cn(\r\n 'w-full justify-start text-left font-normal border h-10',\r\n !selectedDate && 'text-muted-foreground'\r\n )}\r\n >\r\n {selectedDate ? (\r\n format(selectedDate, 'LLL dd, y', { locale: uk })\r\n ) : (\r\n <span>dd/mm/yyyy</span>\r\n )}\r\n <CalendarIcon className=\"mr-2 h-4 w-4 ml-auto\" />\r\n </Button>\r\n </PopoverTrigger>\r\n <PopoverContent align=\"start\" className=\"w-auto p-0\">\r\n <Calendar\r\n mode=\"single\"\r\n captionLayout=\"dropdown-buttons\"\r\n selected={selectedDate}\r\n onSelect={onDateChange}\r\n fromYear={1960}\r\n toYear={2030}\r\n locale={uk}\r\n />\r\n </PopoverContent>\r\n </Popover>\r\n );\r\n }\r\n);\r\n\r\nDatePicker.displayName = 'DatePicker';\r\n"],"names":["DatePicker","React","props","ref","selectedDate","onDateChange","disabled","Popover","jsx","PopoverTrigger","jsxs","Button","cn","format","uk","CalendarIcon","PopoverContent","Calendar"],"mappings":";;;;;;;;;AAYO,MAAMA,IAAaC,EAAM;AAAA,EAC9B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC,IAAW;AAAA,IAAA,IACTJ;AACJ,6BACGK,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAC,EAACC,GAAA,EAAe,SAAO,IACrB,UAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,KAAAR;AAAA,UACA,UAAAG;AAAA,UACA,SAAS;AAAA,UACT,WAAWM;AAAA,YACT;AAAA,YACA,CAACR,KAAgB;AAAA,UAAA;AAAA,UAGlB,UAAA;AAAA,YAAAA,IACCS,EAAOT,GAAc,aAAa,EAAE,QAAQU,GAAI,IAEhD,gBAAAN,EAAC,QAAA,EAAK,UAAA,aAAA,CAAU;AAAA,YAElB,gBAAAA,EAACO,GAAA,EAAa,WAAU,uBAAA,CAAuB;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,GAEnD;AAAA,MACA,gBAAAP,EAACQ,GAAA,EAAe,OAAM,SAAQ,WAAU,cACtC,UAAA,gBAAAR;AAAA,QAACS;AAAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAc;AAAA,UACd,UAAUb;AAAA,UACV,UAAUC;AAAA,UACV,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,QAAQS;AAAA,QAAA;AAAA,MAAA,EACV,CACF;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AAEAd,EAAW,cAAc;"}
1
+ {"version":3,"file":"DatePicker.js","sources":["../../src/DatePicker/DatePicker.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { format } from 'date-fns';\nimport { Calendar as CalendarIcon } from 'lucide-react';\nimport { cn } from '@oneplatformdev/utils';\nimport { Button } from '../Button';\nimport { Calendar } from '../Calendar';\nimport { Popover, PopoverContent, PopoverTrigger } from '../Popover';\nimport { uk } from 'date-fns/locale';\nimport { DatePickerProps } from './DatePicker.types';\n\nexport const DatePicker = React.forwardRef<HTMLButtonElement, DatePickerProps>(\n (props, ref) => {\n const {\n selectedDate,\n onDateChange,\n disabled = false\n } = props;\n return (\n <Popover>\n <PopoverTrigger asChild>\n <Button\n ref={ref}\n disabled={disabled}\n variant={'outline-solid'}\n className={cn(\n 'w-full justify-start text-left font-normal border h-10',\n !selectedDate && 'text-muted-foreground'\n )}\n >\n {selectedDate ? (\n format(selectedDate, 'LLL dd, y', { locale: uk })\n ) : (\n <span>dd/mm/yyyy</span>\n )}\n <CalendarIcon className=\"mr-2 h-4 w-4 ml-auto\" />\n </Button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-auto p-0\">\n <Calendar\n mode=\"single\"\n captionLayout=\"dropdown-buttons\"\n selected={selectedDate}\n onSelect={onDateChange}\n fromYear={1960}\n toYear={2030}\n locale={uk}\n />\n </PopoverContent>\n </Popover>\n );\n }\n);\n\nDatePicker.displayName = 'DatePicker';\n"],"names":["DatePicker","React","props","ref","selectedDate","onDateChange","disabled","Popover","jsx","PopoverTrigger","jsxs","Button","cn","format","uk","CalendarIcon","PopoverContent","Calendar"],"mappings":";;;;;;;;;;AAYO,MAAMA,IAAaC,EAAM;AAAA,EAC9B,CAACC,GAAOC,MAAQ;AACd,UAAM;AAAA,MACJ,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,UAAAC,IAAW;AAAA,IAAA,IACTJ;AACJ,6BACGK,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAC,EAACC,GAAA,EAAe,SAAO,IACrB,UAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,KAAAR;AAAA,UACA,UAAAG;AAAA,UACA,SAAS;AAAA,UACT,WAAWM;AAAA,YACT;AAAA,YACA,CAACR,KAAgB;AAAA,UAAA;AAAA,UAGlB,UAAA;AAAA,YAAAA,IACCS,EAAOT,GAAc,aAAa,EAAE,QAAQU,GAAI,IAEhD,gBAAAN,EAAC,QAAA,EAAK,UAAA,aAAA,CAAU;AAAA,YAElB,gBAAAA,EAACO,GAAA,EAAa,WAAU,uBAAA,CAAuB;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA,GAEnD;AAAA,MACA,gBAAAP,EAACQ,GAAA,EAAe,OAAM,SAAQ,WAAU,cACtC,UAAA,gBAAAR;AAAA,QAACS;AAAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,eAAc;AAAA,UACd,UAAUb;AAAA,UACV,UAAUC;AAAA,UACV,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,QAAQS;AAAA,QAAA;AAAA,MAAA,EACV,CACF;AAAA,IAAA,GACF;AAAA,EAEJ;AACF;AAEAd,EAAW,cAAc;"}