@economic/taco 2.39.2 → 2.40.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. package/dist/components/OverflowGroup/OverflowGroup.d.ts +0 -1
  2. package/dist/components/Table/hooks/useRowCreation.d.ts +4 -4
  3. package/dist/components/Table/types.d.ts +19 -19
  4. package/dist/components/Tabs/Tabs.d.ts +0 -5
  5. package/dist/esm/packages/taco/src/components/Alert/Alert.js.map +1 -1
  6. package/dist/esm/packages/taco/src/components/Badge/Badge.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/BadgeIcon/BadgeIcon.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Banner/Banner.js +1 -1
  9. package/dist/esm/packages/taco/src/components/Banner/Banner.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js +4 -4
  12. package/dist/esm/packages/taco/src/components/Calendar/Calendar.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Card/Card.js +2 -2
  14. package/dist/esm/packages/taco/src/components/Card/Card.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js +2 -2
  16. package/dist/esm/packages/taco/src/components/Checkbox/Checkbox.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js +2 -2
  18. package/dist/esm/packages/taco/src/components/Combobox/Combobox.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js +6 -6
  20. package/dist/esm/packages/taco/src/components/Datepicker/Datepicker.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +2 -2
  22. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Drawer/Drawer.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +5 -5
  25. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  26. package/dist/esm/packages/taco/src/components/Field/Field.js +1 -1
  27. package/dist/esm/packages/taco/src/components/Field/Field.js.map +1 -1
  28. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js +1 -1
  29. package/dist/esm/packages/taco/src/components/Hanger/Hanger.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Display.js.map +1 -1
  31. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js +1 -1
  32. package/dist/esm/packages/taco/src/components/Header/components/Agreement/Item.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js +2 -2
  34. package/dist/esm/packages/taco/src/components/Header/components/AgreementSelector.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Header/components/Link.js +1 -1
  36. package/dist/esm/packages/taco/src/components/Header/components/Link.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js +1 -1
  38. package/dist/esm/packages/taco/src/components/Header/components/PrimaryNavigation.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Icon/Icon.js +1 -1
  40. package/dist/esm/packages/taco/src/components/Icon/Icon.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Input/Input.js +1 -1
  42. package/dist/esm/packages/taco/src/components/Input/Input.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js +1 -1
  44. package/dist/esm/packages/taco/src/components/Layout/components/Sidebar.js.map +1 -1
  45. package/dist/esm/packages/taco/src/components/List/components/Item.js +1 -1
  46. package/dist/esm/packages/taco/src/components/List/components/Item.js.map +1 -1
  47. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js +4 -4
  48. package/dist/esm/packages/taco/src/components/Listbox/ScrollableList.js.map +1 -1
  49. package/dist/esm/packages/taco/src/components/Listbox/useMultiListbox.js.map +1 -1
  50. package/dist/esm/packages/taco/src/components/Listbox/util.js.map +1 -1
  51. package/dist/esm/packages/taco/src/components/Menu/components/Item.js +2 -2
  52. package/dist/esm/packages/taco/src/components/Menu/components/Item.js.map +1 -1
  53. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js +1 -1
  54. package/dist/esm/packages/taco/src/components/Navigation/Navigation.js.map +1 -1
  55. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js +2 -2
  56. package/dist/esm/packages/taco/src/components/Navigation2/components/Link.js.map +1 -1
  57. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js +1 -1
  58. package/dist/esm/packages/taco/src/components/Navigation2/components/Section.js.map +1 -1
  59. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js +1 -4
  60. package/dist/esm/packages/taco/src/components/OverflowGroup/OverflowGroup.js.map +1 -1
  61. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js +1 -1
  62. package/dist/esm/packages/taco/src/components/Pagination/PageNumbers.js.map +1 -1
  63. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js +3 -3
  64. package/dist/esm/packages/taco/src/components/Pagination/Pagination.js.map +1 -1
  65. package/dist/esm/packages/taco/src/components/Popover/Popover.js +2 -2
  66. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  67. package/dist/esm/packages/taco/src/components/Progress/Progress.js.map +1 -1
  68. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  69. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js +1 -1
  70. package/dist/esm/packages/taco/src/components/RadioGroup/RadioGroup.js.map +1 -1
  71. package/dist/esm/packages/taco/src/components/ScrollArea/ScrollArea.js.map +1 -1
  72. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js +1 -1
  73. package/dist/esm/packages/taco/src/components/SearchInput/SearchInput.js.map +1 -1
  74. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +5 -5
  75. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  76. package/dist/esm/packages/taco/src/components/Select/Select.js.map +1 -1
  77. package/dist/esm/packages/taco/src/components/Select/useSelect.js +1 -1
  78. package/dist/esm/packages/taco/src/components/Select/useSelect.js.map +1 -1
  79. package/dist/esm/packages/taco/src/components/Select2/Select2.js +7 -7
  80. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  81. package/dist/esm/packages/taco/src/components/Select2/components/Create.js +2 -2
  82. package/dist/esm/packages/taco/src/components/Select2/components/Create.js.map +1 -1
  83. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js +5 -5
  84. package/dist/esm/packages/taco/src/components/Select2/components/Edit.js.map +1 -1
  85. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +4 -4
  86. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  87. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +5 -5
  88. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  89. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js +1 -1
  90. package/dist/esm/packages/taco/src/components/Shortcut/Shortcut.js.map +1 -1
  91. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  92. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js +2 -2
  93. package/dist/esm/packages/taco/src/components/Table/components/BaseTable.js.map +1 -1
  94. package/dist/esm/packages/taco/src/components/Table/components/PaginatedTable.js.map +1 -1
  95. package/dist/esm/packages/taco/src/components/Table/components/Table.js.map +1 -1
  96. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js +1 -1
  97. package/dist/esm/packages/taco/src/components/Table/components/WindowedTable.js.map +1 -1
  98. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js +8 -8
  99. package/dist/esm/packages/taco/src/components/Table/hooks/plugins/useRowActions.js.map +1 -1
  100. package/dist/esm/packages/taco/src/components/Table/hooks/useRowCreation.js.map +1 -1
  101. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js +1 -1
  102. package/dist/esm/packages/taco/src/components/Table/util/renderColumn.js.map +1 -1
  103. package/dist/esm/packages/taco/src/components/Table/util/renderRow.js.map +1 -1
  104. package/dist/esm/packages/taco/src/components/Table/util/rowIndexPath.js.map +1 -1
  105. package/dist/esm/packages/taco/src/components/Table3/Table3.js +3 -3
  106. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  107. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/RowMoveIndicator.js.map +1 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js.map +1 -1
  109. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +1 -1
  110. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  111. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +1 -1
  112. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  113. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +2 -2
  114. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  115. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +1 -1
  116. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  117. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  118. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js +2 -11
  119. package/dist/esm/packages/taco/src/components/Tabs/Tabs.js.map +1 -1
  120. package/dist/esm/packages/taco/src/components/Tag/Tag.js +3 -3
  121. package/dist/esm/packages/taco/src/components/Tag/Tag.js.map +1 -1
  122. package/dist/esm/packages/taco/src/components/Toast/Toaster.js +1 -1
  123. package/dist/esm/packages/taco/src/components/Toast/Toaster.js.map +1 -1
  124. package/dist/esm/packages/taco/src/components/Toast/util.js.map +1 -1
  125. package/dist/esm/packages/taco/src/components/Tour/Tour.js +2 -2
  126. package/dist/esm/packages/taco/src/components/Tour/Tour.js.map +1 -1
  127. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js +1 -1
  128. package/dist/esm/packages/taco/src/components/Treeview/Treeview.js.map +1 -1
  129. package/dist/esm/packages/taco/src/hooks/useIntersectionObserver.js.map +1 -1
  130. package/dist/esm/packages/taco/src/primitives/BubbleSelect.js.map +1 -1
  131. package/dist/esm/packages/taco/src/primitives/Collection/components/Root.js.map +1 -1
  132. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Root.js.map +1 -1
  133. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +4 -4
  134. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  135. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +1 -1
  136. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  137. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +3 -3
  138. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  139. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  140. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
  141. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  142. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js +3 -3
  143. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/Header.js.map +1 -1
  144. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Goto.js.map +1 -1
  145. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js +9 -9
  146. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Header/components/Menu.js.map +1 -1
  147. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +2 -2
  148. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  149. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +1 -1
  150. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  151. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js +1 -1
  152. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/Toolbar.js.map +1 -1
  153. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js +1 -1
  154. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/Filters.js.map +1 -1
  155. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js +1 -1
  156. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/ManageFiltersPopover.js.map +1 -1
  157. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js +1 -1
  158. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.js.map +1 -1
  159. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js +1 -1
  160. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterComparator.js.map +1 -1
  161. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js +1 -1
  162. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/util.js.map +1 -1
  163. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +1 -1
  164. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  165. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js +4 -4
  166. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/PrintDialog.js.map +1 -1
  167. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  168. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js +3 -3
  169. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/HideOrOrderPopover.js.map +1 -1
  170. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js +6 -6
  171. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Settings/Settings.js.map +1 -1
  172. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
  173. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
  174. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTablePrinting.js.map +1 -1
  175. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/features/useTableSettings.js.map +1 -1
  176. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  177. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +2 -2
  178. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  179. package/dist/esm/packages/taco/src/utils/date.js +1 -1
  180. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  181. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  182. package/dist/taco.cjs.development.js +160 -170
  183. package/dist/taco.cjs.development.js.map +1 -1
  184. package/dist/taco.cjs.production.min.js +1 -1
  185. package/dist/taco.cjs.production.min.js.map +1 -1
  186. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PrimitiveSwitch from '@radix-ui/react-switch';\nimport { useId } from '../../hooks/useId';\n\ntype SwitchBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /** Label for the switch */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\nexport interface UncontrolledSwitchProps extends SwitchBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\nexport interface ControlledSwitchProps extends SwitchBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\n\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLButtonElement>) {\n const { label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus',\n {\n 'mr-2': !!label,\n 'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,\n 'bg-grey-500/50 aria-checked:bg-blue-500/50 cursor-not-allowed': props.disabled,\n },\n props.className\n );\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n const element = (\n <PrimitiveSwitch.Root\n {...otherProps}\n {...labelledByProps}\n className={className}\n data-taco=\"switch\"\n onCheckedChange={onChange}\n ref={ref}>\n <PrimitiveSwitch.Thumb className=\"'will-change-transform mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]\" />\n </PrimitiveSwitch.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex self-start cursor-pointer', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName} data-taco=\"switch-container\">\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nSwitch.displayName = 'Switch';\n"],"names":["Switch","React","props","ref","label","onChange","otherProps","id","useId","className","cn","disabled","labelledByProps","element","PrimitiveSwitch","onCheckedChange","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;MA6BaA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAMA,CAACE,KAAkB,EAAEC,GAAiC;EACxG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAChD,MAAMK,EAAE,GAAGC,KAAK,CAACN,KAAK,CAACK,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,kFAAkF,EAClF;IACI,MAAM,EAAE,CAAC,CAACN,KAAK;IACf,uFAAuF,EAAE,CAACF,KAAK,CAACS,QAAQ;IACxG,+DAA+D,EAAET,KAAK,CAACS;GAC1E,EACDT,KAAK,CAACO,SAAS,CAClB;EAED,IAAIG,eAAe,GAAkC,IAAI;EAEzD,IAAIR,KAAK,EAAE;IACPQ,eAAe,GAAG;MACd,iBAAiB,KAAKL,UAAU;MAChCA;KACH;;EAGL,MAAMM,OAAO,gBACTZ,cAACa,IAAoB,oBACbR,UAAU,EACVM,eAAe;IACnBH,SAAS,EAAEA,SAAS;iBACV,QAAQ;IAClBM,eAAe,EAAEV,QAAQ;IACzBF,GAAG,EAAEA;mBACLF,cAACa,KAAqB;IAACL,SAAS,EAAC;IAA6K,CAErN;EAED,IAAIL,KAAK,EAAE;IACP,MAAMY,uBAAuB,GAAGN,EAAE,CAAC,gCAAgC,EAAE;MACjE,kCAAkC,EAAER,KAAK,CAACS;KAC7C,CAAC;IAEF,oBACIV;MAAMQ,SAAS,EAAEO,uBAAuB;mBAAY;OAC/CH,OAAO,eACRZ;MAAOgB,OAAO,EAAEV,EAAE;MAAEA,EAAE,KAAKA;OACtBH,KAAK,CACF,CACL;;EAIf,OAAOS,OAAO;AAClB,CAAC;AACDb,MAAM,CAACkB,WAAW,GAAG,QAAQ;;;;"}
1
+ {"version":3,"file":"Switch.js","sources":["../../../../../../../src/components/Switch/Switch.tsx"],"sourcesContent":["import * as React from 'react';\nimport cn from 'clsx';\nimport * as PrimitiveSwitch from '@radix-ui/react-switch';\nimport { useId } from '../../hooks/useId';\n\ntype SwitchBaseProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onChange'> & {\n /** Label for the switch */\n label?: React.ReactNode;\n /* Whether user input is required */\n required?: boolean;\n};\n\nexport interface UncontrolledSwitchProps extends SwitchBaseProps {\n checked?: never;\n onChange?: never;\n /* The default checked state (uncontrolled) */\n defaultChecked?: boolean;\n}\n\nexport interface ControlledSwitchProps extends SwitchBaseProps {\n defaultChecked?: never;\n /* The current checked state (controlled) */\n checked: boolean;\n /* Handler called when the checked state changes */\n onChange: (checked: boolean) => void;\n}\n\nexport type SwitchProps = UncontrolledSwitchProps | ControlledSwitchProps;\n\nexport const Switch = React.forwardRef(function Switch(props: SwitchProps, ref: React.Ref<HTMLButtonElement>) {\n const { label, onChange, ...otherProps } = props;\n const id = useId(props.id);\n\n const className = cn(\n 'group h-5 w-9 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus',\n {\n 'mr-2': !!label,\n 'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,\n 'bg-grey-500/50 aria-checked:bg-blue-500/50 cursor-not-allowed': props.disabled,\n },\n props.className\n );\n\n let labelledByProps: Record<string, string> | null = null;\n\n if (label) {\n labelledByProps = {\n 'aria-labelledby': `${id}-label`,\n id,\n };\n }\n\n const element = (\n <PrimitiveSwitch.Root\n {...otherProps}\n {...labelledByProps}\n className={className}\n data-taco=\"switch\"\n onCheckedChange={onChange}\n ref={ref}>\n <PrimitiveSwitch.Thumb className=\"'will-change-transform mt-0.5 h-4 w-4 translate-x-[0.15rem] rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[1.1rem]\" />\n </PrimitiveSwitch.Root>\n );\n\n if (label) {\n const labelContainerClassName = cn('flex self-start cursor-pointer', {\n 'cursor-not-allowed text-grey-300': props.disabled,\n });\n\n return (\n <span className={labelContainerClassName} data-taco=\"switch-container\">\n {element}\n <label htmlFor={id} id={`${id}-label`}>\n {label}\n </label>\n </span>\n );\n }\n\n return element;\n});\nSwitch.displayName = 'Switch';\n"],"names":["Switch","React","props","ref","label","onChange","otherProps","id","useId","className","cn","disabled","labelledByProps","element","PrimitiveSwitch","onCheckedChange","labelContainerClassName","htmlFor","displayName"],"mappings":";;;;;MA6BaA,MAAM,gBAAGC,UAAgB,CAAC,SAASD,MAAMA,CAACE,KAAkB,EAAEC,GAAiC;EACxG,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EAChD,MAAMK,EAAE,GAAGC,KAAK,CAACN,KAAK,CAACK,EAAE,CAAC;EAE1B,MAAME,SAAS,GAAGC,EAAE,CAChB,kFAAkF,EAClF;IACI,MAAM,EAAE,CAAC,CAACN,KAAK;IACf,uFAAuF,EAAE,CAACF,KAAK,CAACS,QAAQ;IACxG,+DAA+D,EAAET,KAAK,CAACS;GAC1E,EACDT,KAAK,CAACO,SAAS,CAClB;EAED,IAAIG,eAAe,GAAkC,IAAI;EAEzD,IAAIR,KAAK,EAAE;IACPQ,eAAe,GAAG;MACd,iBAAiB,EAAE,GAAGL,EAAE,QAAQ;MAChCA;KACH;;EAGL,MAAMM,OAAO,gBACTZ,cAACa,IAAoB,oBACbR,UAAU,EACVM,eAAe;IACnBH,SAAS,EAAEA,SAAS;iBACV,QAAQ;IAClBM,eAAe,EAAEV,QAAQ;IACzBF,GAAG,EAAEA;mBACLF,cAACa,KAAqB;IAACL,SAAS,EAAC;IAA6K,CAErN;EAED,IAAIL,KAAK,EAAE;IACP,MAAMY,uBAAuB,GAAGN,EAAE,CAAC,gCAAgC,EAAE;MACjE,kCAAkC,EAAER,KAAK,CAACS;KAC7C,CAAC;IAEF,oBACIV;MAAMQ,SAAS,EAAEO,uBAAuB;mBAAY;OAC/CH,OAAO,eACRZ;MAAOgB,OAAO,EAAEV,EAAE;MAAEA,EAAE,EAAE,GAAGA,EAAE;OACxBH,KAAK,CACF,CACL;;EAIf,OAAOS,OAAO;AAClB,CAAC;AACDb,MAAM,CAACkB,WAAW,GAAG,QAAQ;;;;"}
@@ -29,11 +29,11 @@ const BaseTable = /*#__PURE__*/React__default.forwardRef(function BaseTable(prop
29
29
  role: "rowgroup",
30
30
  className: "yt-table__head",
31
31
  ref: headerRef
32
- }, headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup, index) => ( /*#__PURE__*/React__default.createElement("div", {
32
+ }, headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups.map((headerGroup, index) => (/*#__PURE__*/React__default.createElement("div", {
33
33
  key: index,
34
34
  role: "row",
35
35
  className: "border-grey-300 flex h-auto min-h-[2.5rem] w-full select-none border-b-2 border-t-0 font-bold"
36
- }, headerGroup.headers.map((cell, index) => ( /*#__PURE__*/React__default.createElement(Column, {
36
+ }, headerGroup.headers.map((cell, index) => (/*#__PURE__*/React__default.createElement(Column, {
37
37
  key: index,
38
38
  index: index,
39
39
  cell: cell
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTable.js","sources":["../../../../../../../../src/components/Table/components/BaseTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { HeaderGroup } from 'react-table';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { InternalBaseTable } from '../types';\nimport './Table.css';\nimport { Column } from '../util/renderColumn';\n\nexport const DefaultEmptyState = (): React.ReactNode => null;\n\nexport const BaseTable = React.forwardRef(function BaseTable(props: InternalBaseTable, ref: React.Ref<HTMLDivElement>) {\n const tableRef = useMergedRef<HTMLDivElement>(ref);\n const { autoFocus, children, disableSorting: _, headerGroups, headerRef, bodyRef, ...otherProps } = props;\n\n React.useEffect(() => {\n if (autoFocus && tableRef.current) {\n tableRef.current.focus();\n }\n }, []);\n\n const className = cn('yt-table flex flex-col focus:yt-focus focus:rounded-sm', props.className);\n\n return (\n <div {...otherProps} role=\"table\" className={className} ref={tableRef}>\n <div role=\"rowgroup\" className=\"yt-table__head\" ref={headerRef}>\n {headerGroups?.map((headerGroup: HeaderGroup<object>, index: number) => (\n <div\n key={index}\n role=\"row\"\n className=\"border-grey-300 flex h-auto min-h-[2.5rem] w-full select-none border-b-2 border-t-0 font-bold\">\n {headerGroup.headers.map((cell: any, index: number) => (\n <Column key={index} index={index} cell={cell} />\n ))}\n </div>\n ))}\n </div>\n\n <div role=\"rowgroup\" className=\"yt-table__body\" ref={bodyRef}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["DefaultEmptyState","BaseTable","React","forwardRef","props","ref","tableRef","useMergedRef","autoFocus","children","disableSorting","_","headerGroups","headerRef","bodyRef","otherProps","useEffect","current","focus","className","cn","role","map","headerGroup","index","key","headers","cell","Column"],"mappings":";;;;;MAQaA,iBAAiB,GAAGA,MAAuB;MAE3CC,SAAS,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,SAASA,CAACG,KAAwB,EAAEC,GAA8B;EACjH,MAAMC,QAAQ,GAAGC,YAAY,CAAiBF,GAAG,CAAC;EAClD,MAAM;IAAEG,SAAS;IAAEC,QAAQ;IAAEC,cAAc,EAAEC,CAAC;IAAEC,YAAY;IAAEC,SAAS;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGX,KAAK;EAEzGF,cAAK,CAACc,SAAS,CAAC;IACZ,IAAIR,SAAS,IAAIF,QAAQ,CAACW,OAAO,EAAE;MAC/BX,QAAQ,CAACW,OAAO,CAACC,KAAK,EAAE;;GAE/B,EAAE,EAAE,CAAC;EAEN,MAAMC,SAAS,GAAGC,EAAE,CAAC,wDAAwD,EAAEhB,KAAK,CAACe,SAAS,CAAC;EAE/F,oBACIjB,sDAASa,UAAU;IAAEM,IAAI,EAAC,OAAO;IAACF,SAAS,EAAEA,SAAS;IAAEd,GAAG,EAAEC;mBACzDJ;IAAKmB,IAAI,EAAC,UAAU;IAACF,SAAS,EAAC,gBAAgB;IAACd,GAAG,EAAEQ;KAChDD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEU,GAAG,CAAC,CAACC,WAAgC,EAAEC,KAAa,oBAC/DtB;IACIuB,GAAG,EAAED,KAAK;IACVH,IAAI,EAAC,KAAK;IACVF,SAAS,EAAC;KACTI,WAAW,CAACG,OAAO,CAACJ,GAAG,CAAC,CAACK,IAAS,EAAEH,KAAa,oBAC9CtB,6BAAC0B,MAAM;IAACH,GAAG,EAAED,KAAK;IAAEA,KAAK,EAAEA,KAAK;IAAEG,IAAI,EAAEA;IAAQ,CACnD,CAAC,CACA,CACT,CAAC,CACA,eAENzB;IAAKmB,IAAI,EAAC,UAAU;IAACF,SAAS,EAAC,gBAAgB;IAACd,GAAG,EAAES;KAChDL,QAAQ,CACP,CACJ;AAEd,CAAC;;;;"}
1
+ {"version":3,"file":"BaseTable.js","sources":["../../../../../../../../src/components/Table/components/BaseTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { HeaderGroup } from 'react-table';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { InternalBaseTable } from '../types';\nimport './Table.css';\nimport { Column } from '../util/renderColumn';\n\nexport const DefaultEmptyState = (): React.ReactNode => null;\n\nexport const BaseTable = React.forwardRef(function BaseTable(props: InternalBaseTable, ref: React.Ref<HTMLDivElement>) {\n const tableRef = useMergedRef<HTMLDivElement>(ref);\n const { autoFocus, children, disableSorting: _, headerGroups, headerRef, bodyRef, ...otherProps } = props;\n\n React.useEffect(() => {\n if (autoFocus && tableRef.current) {\n tableRef.current.focus();\n }\n }, []);\n\n const className = cn('yt-table flex flex-col focus:yt-focus focus:rounded-sm', props.className);\n\n return (\n <div {...otherProps} role=\"table\" className={className} ref={tableRef}>\n <div role=\"rowgroup\" className=\"yt-table__head\" ref={headerRef}>\n {headerGroups?.map((headerGroup: HeaderGroup<object>, index: number) => (\n <div\n key={index}\n role=\"row\"\n className=\"border-grey-300 flex h-auto min-h-[2.5rem] w-full select-none border-b-2 border-t-0 font-bold\">\n {headerGroup.headers.map((cell: any, index: number) => (\n <Column key={index} index={index} cell={cell} />\n ))}\n </div>\n ))}\n </div>\n\n <div role=\"rowgroup\" className=\"yt-table__body\" ref={bodyRef}>\n {children}\n </div>\n </div>\n );\n});\n"],"names":["DefaultEmptyState","BaseTable","React","forwardRef","props","ref","tableRef","useMergedRef","autoFocus","children","disableSorting","_","headerGroups","headerRef","bodyRef","otherProps","useEffect","current","focus","className","cn","role","map","headerGroup","index","key","headers","cell","Column"],"mappings":";;;;;MAQaA,iBAAiB,GAAGA,MAAuB;MAE3CC,SAAS,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,SAASA,CAACG,KAAwB,EAAEC,GAA8B;EACjH,MAAMC,QAAQ,GAAGC,YAAY,CAAiBF,GAAG,CAAC;EAClD,MAAM;IAAEG,SAAS;IAAEC,QAAQ;IAAEC,cAAc,EAAEC,CAAC;IAAEC,YAAY;IAAEC,SAAS;IAAEC,OAAO;IAAE,GAAGC;GAAY,GAAGX,KAAK;EAEzGF,cAAK,CAACc,SAAS,CAAC;IACZ,IAAIR,SAAS,IAAIF,QAAQ,CAACW,OAAO,EAAE;MAC/BX,QAAQ,CAACW,OAAO,CAACC,KAAK,EAAE;;GAE/B,EAAE,EAAE,CAAC;EAEN,MAAMC,SAAS,GAAGC,EAAE,CAAC,wDAAwD,EAAEhB,KAAK,CAACe,SAAS,CAAC;EAE/F,oBACIjB,sDAASa,UAAU;IAAEM,IAAI,EAAC,OAAO;IAACF,SAAS,EAAEA,SAAS;IAAEd,GAAG,EAAEC;mBACzDJ;IAAKmB,IAAI,EAAC,UAAU;IAACF,SAAS,EAAC,gBAAgB;IAACd,GAAG,EAAEQ;KAChDD,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEU,GAAG,CAAC,CAACC,WAAgC,EAAEC,KAAa,mBAC/DtB;IACIuB,GAAG,EAAED,KAAK;IACVH,IAAI,EAAC,KAAK;IACVF,SAAS,EAAC;KACTI,WAAW,CAACG,OAAO,CAACJ,GAAG,CAAC,CAACK,IAAS,EAAEH,KAAa,mBAC9CtB,6BAAC0B,MAAM;IAACH,GAAG,EAAED,KAAK;IAAEA,KAAK,EAAEA,KAAK;IAAEG,IAAI,EAAEA;IAAQ,CACnD,CAAC,CACA,CACT,CAAC,CACA,eAENzB;IAAKmB,IAAI,EAAC,UAAU;IAACF,SAAS,EAAC,gBAAgB;IAACd,GAAG,EAAES;KAChDL,QAAQ,CACP,CACJ;AAEd,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedTable.js","sources":["../../../../../../../../src/components/Table/components/PaginatedTable.tsx"],"sourcesContent":["import React from 'react';\nimport { ForwardedGenericTableWithStatics, LegacyTableProps, LegacyTableRef } from '../types';\nimport { Table } from './Table';\n\nexport const PaginatedTable = React.forwardRef(function PaginatedTable<T>(\n props: LegacyTableProps<T>,\n ref: React.Ref<LegacyTableRef>\n) {\n return <Table {...props} disablePagination={false} ref={ref} />;\n}) as ForwardedGenericTableWithStatics;\n\nPaginatedTable.Column = () => null;\nPaginatedTable.Group = () => null;\n"],"names":["PaginatedTable","React","forwardRef","props","ref","Table","disablePagination","Column","Group"],"mappings":";;;MAIaA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,cAAcA,CAClEG,KAA0B,EAC1BC,GAA8B;EAE9B,oBAAOH,6BAACI,KAAK,oBAAKF,KAAK;IAAEG,iBAAiB,EAAE,KAAK;IAAEF,GAAG,EAAEA;KAAO;AACnE,CAAC;AAEDJ,cAAc,CAACO,MAAM,GAAG,MAAM,IAAI;AAClCP,cAAc,CAACQ,KAAK,GAAG,MAAM,IAAI;;;;"}
1
+ {"version":3,"file":"PaginatedTable.js","sources":["../../../../../../../../src/components/Table/components/PaginatedTable.tsx"],"sourcesContent":["import React from 'react';\nimport { ForwardedGenericTableWithStatics, LegacyTableProps, LegacyTableRef } from '../types';\nimport { Table } from './Table';\n\nexport const PaginatedTable = React.forwardRef(function PaginatedTable<T extends {}>(\n props: LegacyTableProps<T>,\n ref: React.Ref<LegacyTableRef>\n) {\n return <Table {...props} disablePagination={false} ref={ref} />;\n}) as ForwardedGenericTableWithStatics;\n\nPaginatedTable.Column = () => null;\nPaginatedTable.Group = () => null;\n"],"names":["PaginatedTable","React","forwardRef","props","ref","Table","disablePagination","Column","Group"],"mappings":";;;MAIaA,cAAc,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,cAAcA,CAClEG,KAA0B,EAC1BC,GAA8B;EAE9B,oBAAOH,6BAACI,KAAK,oBAAKF,KAAK;IAAEG,iBAAiB,EAAE,KAAK;IAAEF,GAAG,EAAEA;KAAO;AACnE,CAAC;AAEDJ,cAAc,CAACO,MAAM,GAAG,MAAM,IAAI;AAClCP,cAAc,CAACQ,KAAK,GAAG,MAAM,IAAI;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"Table.js","sources":["../../../../../../../../src/components/Table/components/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { LegacyTableProps, InternalTableRow, ForwardedGenericTableWithStatics, LegacyTableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { Pagination } from '../../Pagination/Pagination';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\n\nexport const Table = React.forwardRef(function Table<T>(\n props: LegacyTableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<LegacyTableRef>\n) {\n const { emptyStateRenderer = DefaultEmptyState, ...otherProps } = props;\n const tableRef: any = useMergedRef<HTMLDivElement>(ref);\n const { rowProps, tableProps, rows, prepareRow, pagination, instance } = useTable(otherProps, tableRef);\n\n let paginationElement;\n\n if (pagination) {\n paginationElement = (\n <Pagination\n className=\"my-4 w-full\"\n length={pagination.length}\n pageIndex={pagination.pageIndex}\n pageSize={pagination.pageSize}\n setPageIndex={pagination.setPageIndex}\n setPageSize={pagination.setPageSize}\n showPageControls={pagination.length > pagination.pageSize}\n dangerouslyHijackGlobalKeyboardNavigation={props.dangerouslyHijackGlobalKeyboardNavigation}\n />\n );\n }\n\n return (\n <>\n {paginationElement}\n <BaseTable {...tableProps} ref={tableRef}>\n {rows.length\n ? rows.map((row: InternalTableRow, index: number) => {\n prepareRow(row, index);\n return (\n <Row\n {...rowProps}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n />\n );\n })\n : emptyStateRenderer()}\n </BaseTable>\n {paginationElement}\n </>\n );\n}) as ForwardedGenericTableWithStatics;\n\nTable.Column = () => null;\nTable.Group = () => null;\n"],"names":["Table","React","forwardRef","props","ref","emptyStateRenderer","DefaultEmptyState","otherProps","tableRef","useMergedRef","rowProps","tableProps","rows","prepareRow","pagination","instance","useTable","paginationElement","Pagination","className","length","pageIndex","pageSize","setPageIndex","setPageSize","showPageControls","dangerouslyHijackGlobalKeyboardNavigation","BaseTable","map","row","index","Row","key","headerGroups","Column","Group"],"mappings":";;;;;;;MASaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAChDG,KAA0D,EAC1DC,GAA8B;EAE9B,MAAM;IAAEC,kBAAkB,GAAGC,iBAAiB;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EACvE,MAAMK,QAAQ,GAAQC,YAAY,CAAiBL,GAAG,CAAC;EACvD,MAAM;IAAEM,QAAQ;IAAEC,UAAU;IAAEC,IAAI;IAAEC,UAAU;IAAEC,UAAU;IAAEC;GAAU,GAAGC,QAAQ,CAACT,UAAU,EAAEC,QAAQ,CAAC;EAEvG,IAAIS,iBAAiB;EAErB,IAAIH,UAAU,EAAE;IACZG,iBAAiB,gBACbhB,6BAACiB,UAAU;MACPC,SAAS,EAAC,aAAa;MACvBC,MAAM,EAAEN,UAAU,CAACM,MAAM;MACzBC,SAAS,EAAEP,UAAU,CAACO,SAAS;MAC/BC,QAAQ,EAAER,UAAU,CAACQ,QAAQ;MAC7BC,YAAY,EAAET,UAAU,CAACS,YAAY;MACrCC,WAAW,EAAEV,UAAU,CAACU,WAAW;MACnCC,gBAAgB,EAAEX,UAAU,CAACM,MAAM,GAAGN,UAAU,CAACQ,QAAQ;MACzDI,yCAAyC,EAAEvB,KAAK,CAACuB;MAExD;;EAGL,oBACIzB,4DACKgB,iBAAiB,eAClBhB,6BAAC0B,SAAS,oBAAKhB,UAAU;IAAEP,GAAG,EAAEI;MAC3BI,IAAI,CAACQ,MAAM,GACNR,IAAI,CAACgB,GAAG,CAAC,CAACC,GAAqB,EAAEC,KAAa;IAC1CjB,UAAU,CAACgB,GAAG,EAAEC,KAAK,CAAC;IACtB,oBACI7B,6BAAC8B,GAAG,oBACIrB,QAAQ;MACZsB,GAAG,EAAEF,KAAK;MACVA,KAAK,EAAEA,KAAK;MACZD,GAAG,EAAEA,GAAG;MACRd,QAAQ,EAAEA,QAAQ;MAClBkB,YAAY,EAAEtB,UAAU,CAACsB;OAC3B;GAET,CAAC,GACF5B,kBAAkB,EAAE,CAClB,EACXY,iBAAiB,CACnB;AAEX,CAAC;AAEDjB,KAAK,CAACkC,MAAM,GAAG,MAAM,IAAI;AACzBlC,KAAK,CAACmC,KAAK,GAAG,MAAM,IAAI;;;;"}
1
+ {"version":3,"file":"Table.js","sources":["../../../../../../../../src/components/Table/components/Table.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { LegacyTableProps, InternalTableRow, ForwardedGenericTableWithStatics, LegacyTableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { Pagination } from '../../Pagination/Pagination';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\n\nexport const Table = React.forwardRef(function Table<T extends {}>(\n props: LegacyTableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<LegacyTableRef>\n) {\n const { emptyStateRenderer = DefaultEmptyState, ...otherProps } = props;\n const tableRef: any = useMergedRef<HTMLDivElement>(ref);\n const { rowProps, tableProps, rows, prepareRow, pagination, instance } = useTable(otherProps, tableRef);\n\n let paginationElement;\n\n if (pagination) {\n paginationElement = (\n <Pagination\n className=\"my-4 w-full\"\n length={pagination.length}\n pageIndex={pagination.pageIndex}\n pageSize={pagination.pageSize}\n setPageIndex={pagination.setPageIndex}\n setPageSize={pagination.setPageSize}\n showPageControls={pagination.length > pagination.pageSize}\n dangerouslyHijackGlobalKeyboardNavigation={props.dangerouslyHijackGlobalKeyboardNavigation}\n />\n );\n }\n\n return (\n <>\n {paginationElement}\n <BaseTable {...tableProps} ref={tableRef}>\n {rows.length\n ? rows.map((row: InternalTableRow, index: number) => {\n prepareRow(row, index);\n return (\n <Row\n {...rowProps}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n />\n );\n })\n : emptyStateRenderer()}\n </BaseTable>\n {paginationElement}\n </>\n );\n}) as ForwardedGenericTableWithStatics;\n\nTable.Column = () => null;\nTable.Group = () => null;\n"],"names":["Table","React","forwardRef","props","ref","emptyStateRenderer","DefaultEmptyState","otherProps","tableRef","useMergedRef","rowProps","tableProps","rows","prepareRow","pagination","instance","useTable","paginationElement","Pagination","className","length","pageIndex","pageSize","setPageIndex","setPageSize","showPageControls","dangerouslyHijackGlobalKeyboardNavigation","BaseTable","map","row","index","Row","key","headerGroups","Column","Group"],"mappings":";;;;;;;MASaA,KAAK,gBAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAChDG,KAA0D,EAC1DC,GAA8B;EAE9B,MAAM;IAAEC,kBAAkB,GAAGC,iBAAiB;IAAE,GAAGC;GAAY,GAAGJ,KAAK;EACvE,MAAMK,QAAQ,GAAQC,YAAY,CAAiBL,GAAG,CAAC;EACvD,MAAM;IAAEM,QAAQ;IAAEC,UAAU;IAAEC,IAAI;IAAEC,UAAU;IAAEC,UAAU;IAAEC;GAAU,GAAGC,QAAQ,CAACT,UAAU,EAAEC,QAAQ,CAAC;EAEvG,IAAIS,iBAAiB;EAErB,IAAIH,UAAU,EAAE;IACZG,iBAAiB,gBACbhB,6BAACiB,UAAU;MACPC,SAAS,EAAC,aAAa;MACvBC,MAAM,EAAEN,UAAU,CAACM,MAAM;MACzBC,SAAS,EAAEP,UAAU,CAACO,SAAS;MAC/BC,QAAQ,EAAER,UAAU,CAACQ,QAAQ;MAC7BC,YAAY,EAAET,UAAU,CAACS,YAAY;MACrCC,WAAW,EAAEV,UAAU,CAACU,WAAW;MACnCC,gBAAgB,EAAEX,UAAU,CAACM,MAAM,GAAGN,UAAU,CAACQ,QAAQ;MACzDI,yCAAyC,EAAEvB,KAAK,CAACuB;MAExD;;EAGL,oBACIzB,4DACKgB,iBAAiB,eAClBhB,6BAAC0B,SAAS,oBAAKhB,UAAU;IAAEP,GAAG,EAAEI;MAC3BI,IAAI,CAACQ,MAAM,GACNR,IAAI,CAACgB,GAAG,CAAC,CAACC,GAAqB,EAAEC,KAAa;IAC1CjB,UAAU,CAACgB,GAAG,EAAEC,KAAK,CAAC;IACtB,oBACI7B,6BAAC8B,GAAG,oBACIrB,QAAQ;MACZsB,GAAG,EAAEF,KAAK;MACVA,KAAK,EAAEA,KAAK;MACZD,GAAG,EAAEA,GAAG;MACRd,QAAQ,EAAEA,QAAQ;MAClBkB,YAAY,EAAEtB,UAAU,CAACsB;OAC3B;GAET,CAAC,GACF5B,kBAAkB,EAAE,CAClB,EACXY,iBAAiB,CACnB;AAEX,CAAC;AAEDjB,KAAK,CAACkC,MAAM,GAAG,MAAM,IAAI;AACzBlC,KAAK,CAACmC,KAAK,GAAG,MAAM,IAAI;;;;"}
@@ -148,7 +148,7 @@ const WindowedTable = /*#__PURE__*/React__default.forwardRef(function WindowedTa
148
148
  }, ({
149
149
  onItemsRendered,
150
150
  ref
151
- }) => ( /*#__PURE__*/React__default.createElement(VariableSizeList, Object.assign({}, listProps, {
151
+ }) => (/*#__PURE__*/React__default.createElement(VariableSizeList, Object.assign({}, listProps, {
152
152
  itemCount: length,
153
153
  onItemsRendered: onItemsRendered,
154
154
  ref: list => {
@@ -1 +1 @@
1
- {"version":3,"file":"WindowedTable.js","sources":["../../../../../../../../src/components/Table/components/WindowedTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { PluginHook } from 'react-table';\nimport { areEqual, VariableSizeList } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport { LegacyTableProps, ForwardedGenericTableWithStatics, LegacyTableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst ROW_HEIGHT = 40;\n\nconst VariableRow = React.memo(({ data, index, style: { height: _, ...style } }: any) => {\n const { texts } = useLocalization();\n const { rows, setRowHeight, rowProps, tableProps, instance, prepareRow, rowHeights } = data;\n const row = rows[index];\n const ref = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (ref?.current) {\n setRowHeight(index, ref.current.getBoundingClientRect().height);\n }\n }, [rowHeights[index]]);\n\n if (row) {\n prepareRow(row, index);\n\n return (\n <Row\n {...rowProps}\n style={style}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n setRowHeight={setRowHeight}\n ref={ref}\n />\n );\n }\n\n return (\n <div className=\"yt-table__row\" role=\"row\" style={style}>\n <div className=\"yt-table__cell text-grey-300\">{texts.legacyTable.loading}</div>\n </div>\n );\n}, areEqual);\n\nconst getAverageRowHeight = (rowHeights = {}) => {\n const keys = Object.keys(rowHeights);\n const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);\n return estimatedHeight / keys.length;\n};\n\nexport const WindowedTable = React.forwardRef(function WindowedTable<T>(\n props: LegacyTableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<LegacyTableRef>\n) {\n const tableRef: any = useMergedRef<HTMLDivElement>(ref);\n const { emptyStateRenderer = DefaultEmptyState, length, loadMore, ...otherProps } = props;\n const { rowProps, tableProps, rows, prepareRow, instance, state } = useTable<T>({ ...otherProps, windowed: true }, tableRef);\n\n // determine heights for windowing calculations\n const headerRef = React.useRef<HTMLDivElement>(null);\n const [rowsRef, setRowsRef] = React.useState<any>(null);\n const tableDimensions = useBoundingClientRectListener(tableRef);\n const headerDimensions = useBoundingClientRectListener(headerRef);\n const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null;\n\n // variable row height calculations\n const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;\n const rowHeights = React.useRef<Record<string, number>>({});\n const setRowHeight = React.useCallback((index: number, size: number) => {\n if (rowHeights.current[index] !== size) {\n rowHeights.current = {\n ...rowHeights.current,\n [index]: size,\n };\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }\n }, []);\n const getRowHeight = React.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);\n\n React.useEffect(() => {\n if (rowsRef && rowProps.activeIndex !== undefined) {\n rowsRef.scrollToItem(rowProps.activeIndex, 'start');\n }\n }, [rowsRef, rowProps.activeIndex]);\n\n // trigger recalculation of variable row heights if the data changes\n React.useEffect(() => {\n rowHeights.current = {};\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }, [rows.length]);\n\n const contentHeight = estimatedRowHeight * props.data.length || 0;\n const isScrollbarVisible = height !== null ? contentHeight > height : false;\n\n const className = cn(tableProps.className, 'yt-table--windowed', { 'table-with-scrollbar': isScrollbarVisible });\n\n let list;\n\n const itemData = {\n rows,\n setRowHeight,\n rowProps,\n tableProps,\n instance,\n prepareRow,\n state,\n rowHeights: rowHeights.current,\n };\n\n if (height && rows.length) {\n const listProps = {\n height,\n itemData,\n estimatedItemSize: getAverageRowHeight(rowHeights.current),\n itemSize: getRowHeight,\n width: '100%',\n };\n\n if (loadMore && length) {\n const isLoaded = (index: number) => !!rows[index];\n\n list = (\n <InfiniteLoader isItemLoaded={isLoaded} itemCount={length} loadMoreItems={loadMore as any}>\n {({ onItemsRendered, ref }: any) => (\n <VariableSizeList\n {...listProps}\n itemCount={length}\n onItemsRendered={onItemsRendered}\n ref={list => {\n ref(list);\n setRowsRef(list);\n }}>\n {VariableRow}\n </VariableSizeList>\n )}\n </InfiniteLoader>\n );\n } else {\n list = (\n <VariableSizeList\n {...listProps}\n itemCount={rows.length}\n ref={ref => {\n setRowsRef(ref);\n }}>\n {VariableRow}\n </VariableSizeList>\n );\n }\n }\n\n return (\n <BaseTable {...tableProps} className={className} headerRef={headerRef} ref={tableRef}>\n {list ? list : emptyStateRenderer()}\n </BaseTable>\n );\n}) as ForwardedGenericTableWithStatics;\n\nWindowedTable.Column = () => null;\nWindowedTable.Group = () => null;\n"],"names":["ROW_HEIGHT","VariableRow","React","memo","data","index","style","height","_","texts","useLocalization","rows","setRowHeight","rowProps","tableProps","instance","prepareRow","rowHeights","row","ref","useRef","useEffect","current","getBoundingClientRect","Row","key","headerGroups","className","role","legacyTable","loading","areEqual","getAverageRowHeight","keys","Object","estimatedHeight","reduce","p","i","length","WindowedTable","forwardRef","props","tableRef","useMergedRef","emptyStateRenderer","DefaultEmptyState","loadMore","otherProps","state","useTable","windowed","headerRef","rowsRef","setRowsRef","useState","tableDimensions","useBoundingClientRectListener","headerDimensions","estimatedRowHeight","rowHeight","useCallback","size","resetAfterIndex","getRowHeight","activeIndex","undefined","scrollToItem","contentHeight","isScrollbarVisible","cn","list","itemData","listProps","estimatedItemSize","itemSize","width","isLoaded","InfiniteLoader","isItemLoaded","itemCount","loadMoreItems","onItemsRendered","VariableSizeList","BaseTable","Column","Group"],"mappings":";;;;;;;;;;;AAaA,MAAMA,UAAU,GAAG,EAAE;AAErB,MAAMC,WAAW,gBAAGC,cAAK,CAACC,IAAI,CAAC,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC,KAAK,EAAE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AM,IAAI;AACjC7C,aAAa,CAAC8C,KAAK,GAAG,MAAM,IAAI;;;;"}
1
+ {"version":3,"file":"WindowedTable.js","sources":["../../../../../../../../src/components/Table/components/WindowedTable.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { PluginHook } from 'react-table';\nimport { areEqual, VariableSizeList } from 'react-window';\nimport InfiniteLoader from 'react-window-infinite-loader';\nimport { LegacyTableProps, ForwardedGenericTableWithStatics, LegacyTableRef } from '../types';\nimport { useTable } from '../hooks/useTable';\nimport { useBoundingClientRectListener } from '../../../hooks/useBoundingClientRectListener';\nimport { useMergedRef } from '../../../hooks/useMergedRef';\nimport { Row } from '../util/renderRow';\nimport { DefaultEmptyState, BaseTable } from './BaseTable';\nimport { useLocalization } from '../../Provider/Localization';\n\nconst ROW_HEIGHT = 40;\n\nconst VariableRow = React.memo(({ data, index, style: { height: _, ...style } }: any) => {\n const { texts } = useLocalization();\n const { rows, setRowHeight, rowProps, tableProps, instance, prepareRow, rowHeights } = data;\n const row = rows[index];\n const ref = React.useRef<HTMLDivElement>(null);\n\n React.useEffect(() => {\n if (ref?.current) {\n setRowHeight(index, ref.current.getBoundingClientRect().height);\n }\n }, [rowHeights[index]]);\n\n if (row) {\n prepareRow(row, index);\n\n return (\n <Row\n {...rowProps}\n style={style}\n key={index}\n index={index}\n row={row}\n instance={instance}\n headerGroups={tableProps.headerGroups}\n setRowHeight={setRowHeight}\n ref={ref}\n />\n );\n }\n\n return (\n <div className=\"yt-table__row\" role=\"row\" style={style}>\n <div className=\"yt-table__cell text-grey-300\">{texts.legacyTable.loading}</div>\n </div>\n );\n}, areEqual);\n\nconst getAverageRowHeight = (rowHeights = {}) => {\n const keys = Object.keys(rowHeights);\n const estimatedHeight = keys.reduce((p, i) => p + rowHeights[i], 0);\n return estimatedHeight / keys.length;\n};\n\nexport const WindowedTable = React.forwardRef(function WindowedTable<T extends {}>(\n props: LegacyTableProps<T> & { plugins: PluginHook<{}>[] },\n ref: React.Ref<LegacyTableRef>\n) {\n const tableRef: any = useMergedRef<HTMLDivElement>(ref);\n const { emptyStateRenderer = DefaultEmptyState, length, loadMore, ...otherProps } = props;\n const { rowProps, tableProps, rows, prepareRow, instance, state } = useTable<T>({ ...otherProps, windowed: true }, tableRef);\n\n // determine heights for windowing calculations\n const headerRef = React.useRef<HTMLDivElement>(null);\n const [rowsRef, setRowsRef] = React.useState<any>(null);\n const tableDimensions = useBoundingClientRectListener(tableRef);\n const headerDimensions = useBoundingClientRectListener(headerRef);\n const height = tableDimensions && headerDimensions ? tableDimensions.height - headerDimensions.height : null;\n\n // variable row height calculations\n const estimatedRowHeight = rowProps.rowHeight || ROW_HEIGHT;\n const rowHeights = React.useRef<Record<string, number>>({});\n const setRowHeight = React.useCallback((index: number, size: number) => {\n if (rowHeights.current[index] !== size) {\n rowHeights.current = {\n ...rowHeights.current,\n [index]: size,\n };\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }\n }, []);\n const getRowHeight = React.useCallback(index => rowHeights.current[index] || estimatedRowHeight, []);\n\n React.useEffect(() => {\n if (rowsRef && rowProps.activeIndex !== undefined) {\n rowsRef.scrollToItem(rowProps.activeIndex, 'start');\n }\n }, [rowsRef, rowProps.activeIndex]);\n\n // trigger recalculation of variable row heights if the data changes\n React.useEffect(() => {\n rowHeights.current = {};\n\n if (rowsRef) {\n rowsRef.resetAfterIndex(0);\n }\n }, [rows.length]);\n\n const contentHeight = estimatedRowHeight * props.data.length || 0;\n const isScrollbarVisible = height !== null ? contentHeight > height : false;\n\n const className = cn(tableProps.className, 'yt-table--windowed', { 'table-with-scrollbar': isScrollbarVisible });\n\n let list;\n\n const itemData = {\n rows,\n setRowHeight,\n rowProps,\n tableProps,\n instance,\n prepareRow,\n state,\n rowHeights: rowHeights.current,\n };\n\n if (height && rows.length) {\n const listProps = {\n height,\n itemData,\n estimatedItemSize: getAverageRowHeight(rowHeights.current),\n itemSize: getRowHeight,\n width: '100%',\n };\n\n if (loadMore && length) {\n const isLoaded = (index: number) => !!rows[index];\n\n list = (\n <InfiniteLoader isItemLoaded={isLoaded} itemCount={length} loadMoreItems={loadMore as any}>\n {({ onItemsRendered, ref }: any) => (\n <VariableSizeList\n {...listProps}\n itemCount={length}\n onItemsRendered={onItemsRendered}\n ref={list => {\n ref(list);\n setRowsRef(list);\n }}>\n {VariableRow}\n </VariableSizeList>\n )}\n </InfiniteLoader>\n );\n } else {\n list = (\n <VariableSizeList\n {...listProps}\n itemCount={rows.length}\n ref={ref => {\n setRowsRef(ref);\n }}>\n {VariableRow}\n </VariableSizeList>\n );\n }\n }\n\n return (\n <BaseTable {...tableProps} className={className} headerRef={headerRef} ref={tableRef}>\n {list ? list : emptyStateRenderer()}\n </BaseTable>\n );\n}) as ForwardedGenericTableWithStatics;\n\nWindowedTable.Column = () => null;\nWindowedTable.Group = () => null;\n"],"names":["ROW_HEIGHT","VariableRow","React","memo","data","index","style","height","_","texts","useLocalization","rows","setRowHeight","rowProps","tableProps","instance","prepareRow","rowHeights","row","ref","useRef","useEffect","current","getBoundingClientRect","Row","key","headerGroups","className","role","legacyTable","loading","areEqual","getAverageRowHeight","keys","Object","estimatedHeight","reduce","p","i","length","WindowedTable","forwardRef","props","tableRef","useMergedRef","emptyStateRenderer","DefaultEmptyState","loadMore","otherProps","state","useTable","windowed","headerRef","rowsRef","setRowsRef","useState","tableDimensions","useBoundingClientRectListener","headerDimensions","estimatedRowHeight","rowHeight","useCallback","size","resetAfterIndex","getRowHeight","activeIndex","undefined","scrollToItem","contentHeight","isScrollbarVisible","cn","list","itemData","listProps","estimatedItemSize","itemSize","width","isLoaded","InfiniteLoader","isItemLoaded","itemCount","loadMoreItems","onItemsRendered","VariableSizeList","BaseTable","Column","Group"],"mappings":";;;;;;;;;;;AAaA,MAAMA,UAAU,GAAG,EAAE;AAErB,MAAMC,WAAW,gBAAGC,cAAK,CAACC,IAAI,CAAC,CAAC;EAAEC,IAAI;EAAEC,KAAK;EAAEC,KAAK,EAAE;IAAEC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I;AACjC7C,aAAa,CAAC8C,KAAK,GAAG,MAAM,IAAI;;;;"}
@@ -107,7 +107,7 @@ const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRen
107
107
  }
108
108
  const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);
109
109
  const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);
110
- const output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, handlers.onRowCreate && ( /*#__PURE__*/React__default.createElement(IconButton, {
110
+ const output = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, handlers.onRowCreate && (/*#__PURE__*/React__default.createElement(IconButton, {
111
111
  appearance: "discrete",
112
112
  icon: "circle-plus",
113
113
  "aria-label": texts.legacyTable.newSubRow,
@@ -122,7 +122,7 @@ const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRen
122
122
  }
123
123
  handlers.onRowCreate(sanitizedRow, event);
124
124
  }
125
- })), (inlineEditing || handlers.onRowEdit) && ( /*#__PURE__*/React__default.createElement(IconButton, {
125
+ })), (inlineEditing || handlers.onRowEdit) && (/*#__PURE__*/React__default.createElement(IconButton, {
126
126
  appearance: "discrete",
127
127
  icon: "edit",
128
128
  "aria-label": texts.legacyTable.edit,
@@ -138,7 +138,7 @@ const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRen
138
138
  handlers.onRowEdit(sanitizedRow, event);
139
139
  }
140
140
  }
141
- })), handlers.onRowCopy && ( /*#__PURE__*/React__default.createElement(IconButton, {
141
+ })), handlers.onRowCopy && (/*#__PURE__*/React__default.createElement(IconButton, {
142
142
  appearance: "discrete",
143
143
  icon: "copy",
144
144
  "aria-label": texts.legacyTable.copy,
@@ -150,7 +150,7 @@ const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRen
150
150
  row.setActive();
151
151
  handlers.onRowCopy(sanitizedRow, event);
152
152
  }
153
- })), handlers.onRowDelete && ( /*#__PURE__*/React__default.createElement(IconButton, {
153
+ })), handlers.onRowDelete && (/*#__PURE__*/React__default.createElement(IconButton, {
154
154
  appearance: "discrete",
155
155
  icon: "delete",
156
156
  "aria-label": texts.legacyTable.del,
@@ -162,12 +162,12 @@ const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRen
162
162
  row.setActive();
163
163
  handlers.onRowDelete(sanitizedRow, event);
164
164
  }
165
- })), primaryActions.map((action, index) => ( /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, getActionProps(action, sanitizedRow), {
165
+ })), primaryActions.map((action, index) => (/*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, getActionProps(action, sanitizedRow), {
166
166
  key: index,
167
167
  appearance: "discrete",
168
168
  icon: typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon,
169
169
  tooltip: typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip
170
- })))), secondaryActions.length ? ( /*#__PURE__*/React__default.createElement(Menu, null, /*#__PURE__*/React__default.createElement(Menu.Trigger, null, /*#__PURE__*/React__default.createElement(IconButton, {
170
+ })))), secondaryActions.length ? (/*#__PURE__*/React__default.createElement(Menu, null, /*#__PURE__*/React__default.createElement(Menu.Trigger, null, /*#__PURE__*/React__default.createElement(IconButton, {
171
171
  appearance: "discrete",
172
172
  icon: "ellipsis-vertical",
173
173
  "aria-label": texts.legacyTable.actions,
@@ -177,7 +177,7 @@ const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRen
177
177
  event.stopPropagation();
178
178
  row.setActive();
179
179
  }
180
- })), /*#__PURE__*/React__default.createElement(Menu.Content, null, secondaryActions.map((action, index) => ( /*#__PURE__*/React__default.createElement(Menu.Item, Object.assign({
180
+ })), /*#__PURE__*/React__default.createElement(Menu.Content, null, secondaryActions.map((action, index) => (/*#__PURE__*/React__default.createElement(Menu.Item, Object.assign({
181
181
  key: index,
182
182
  icon: typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon
183
183
  }, getActionProps(action, sanitizedRow)), typeof action.text === 'function' ? action.text(sanitizedRow) : action.text)))))) : null);
@@ -191,7 +191,7 @@ const useRowActions = (inlineEditingUniqueId, handlers, actions, rowExpansionRen
191
191
  }, ({
192
192
  inView,
193
193
  ref
194
- }) => ( /*#__PURE__*/React__default.createElement("div", {
194
+ }) => (/*#__PURE__*/React__default.createElement("div", {
195
195
  className: actionGroupClassName,
196
196
  ref: ref
197
197
  }, inView ? output : null)));
@@ -1 +1 @@
1
- {"version":3,"file":"useRowActions.js","sources":["../../../../../../../../../src/components/Table/hooks/plugins/useRowActions.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { InView } from 'react-intersection-observer';\nimport { sanitizeRowProps } from '../../util';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { LocalizationTexts } from '../../../Provider/Localization';\nimport { Menu } from '../../../Menu/Menu';\nimport { RowAction, RowActionHandler, LegacyTableRow } from '../../types';\n\nconst actionGroupClassName = '-mt-1 -mb-1 h-8 flex';\n\nconst hasActions = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n return (\n !!actions ||\n handlers.onRowCreate ||\n handlers.onRowCopy ||\n handlers.onRowDelete ||\n !!inlineEditingUniqueId ||\n handlers.onRowEdit\n );\n};\n\nconst getActions = (\n actions: RowActionHandler<any>[] | undefined,\n row: LegacyTableRow<any> | undefined = undefined\n): [RowAction<any>[], RowAction<any>[]] => {\n const primary: RowAction<any>[] = [];\n const secondary: RowAction<any>[] = [];\n\n if (actions) {\n let visibleActions = actions.filter(x => !!x && typeof x !== 'boolean') as RowAction<any>[];\n\n if (row) {\n visibleActions = visibleActions.filter(action => {\n if (action.visible !== undefined) {\n if (typeof action.visible === 'function') {\n return action.visible(row);\n }\n\n return action.visible;\n }\n\n return true;\n });\n }\n\n visibleActions.forEach(action => {\n if (action.showOnRow) {\n primary.push(action);\n } else {\n secondary.push(action);\n }\n });\n }\n\n return [primary, secondary];\n};\n\nconst getLength = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n const [primaryActions, secondaryActions] = getActions(actions);\n\n let length = primaryActions.length + (secondaryActions.length ? 1 : 0);\n\n if (handlers.onRowCreate) {\n length++;\n }\n\n if (handlers.onRowCopy) {\n length++;\n }\n\n if (handlers.onRowDelete) {\n length++;\n }\n\n if (!!inlineEditingUniqueId || handlers.onRowEdit) {\n length++;\n\n if (length < 2) {\n length++;\n }\n }\n\n return length;\n};\n\nconst getActionProps = (action: RowAction<any>, row: LegacyTableRow<any>) => {\n return {\n 'aria-label': typeof action.tooltip === 'function' ? action.tooltip(row) : action.tooltip,\n disabled: typeof action.disabled === 'function' ? action.disabled(row) : action.disabled,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.key === 'Escape' && event.target?.form?.reset) {\n event.preventDefault();\n event.target.form.reset();\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n document.removeEventListener('keydown', listener);\n };\n }, []);\n\n return (\n <div className={actionGroupClassName}>\n <IconButton appearance=\"primary\" icon=\"tick\" type=\"submit\" className=\"mr-2\" />\n <IconButton appearance=\"ghost\" icon=\"close\" type=\"reset\" />\n </div>\n );\n};\n\nexport const useRowActions = <T extends {}>(\n inlineEditingUniqueId: keyof T | undefined,\n handlers: any,\n actions: RowActionHandler<T>[] | undefined,\n rowExpansionRenderer: any,\n texts: LocalizationTexts,\n windowed = false\n): PluginHook<{}> => {\n const inlineEditing = !!inlineEditingUniqueId;\n const actionsLength = getLength(inlineEditingUniqueId, handlers, actions);\n\n const plugin = (hooks: any): void => {\n if (hasActions(inlineEditingUniqueId, handlers, actions)) {\n hooks.visibleColumns.push((columns: any) => [\n ...columns,\n {\n id: '_actions',\n className: 'flex justify-end px-1 overflow-visible',\n flex: `0 0 calc((${actionsLength} * 2rem) + .5rem)`,\n Cell: ({ row }: any) => {\n if (row.isEditing) {\n return <EditModeActions />;\n }\n\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);\n\n const output = (\n <>\n {handlers.onRowCreate && (\n <IconButton\n appearance=\"discrete\"\n icon=\"circle-plus\"\n aria-label={texts.legacyTable.newSubRow}\n tooltip={texts.legacyTable.newSubRow}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n\n if (!row.isExpanded) {\n row.toggleRowExpanded();\n }\n\n handlers.onRowCreate(sanitizedRow, event);\n }}\n />\n )}\n {(inlineEditing || handlers.onRowEdit) && (\n <IconButton\n appearance=\"discrete\"\n icon=\"edit\"\n aria-label={texts.legacyTable.edit}\n tooltip={texts.legacyTable.edit}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n\n if (inlineEditing) {\n row.toggleRowEditing();\n } else if (handlers.onRowEdit) {\n event.persist();\n handlers.onRowEdit(sanitizedRow, event);\n }\n }}\n />\n )}\n {handlers.onRowCopy && (\n <IconButton\n appearance=\"discrete\"\n icon=\"copy\"\n aria-label={texts.legacyTable.copy}\n tooltip={texts.legacyTable.copy}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowCopy(sanitizedRow, event);\n }}\n />\n )}\n {handlers.onRowDelete && (\n <IconButton\n appearance=\"discrete\"\n icon=\"delete\"\n aria-label={texts.legacyTable.del}\n tooltip={texts.legacyTable.del}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowDelete(sanitizedRow, event);\n }}\n />\n )}\n {primaryActions.map((action: RowAction<T>, index: number) => (\n <IconButton\n {...getActionProps(action, sanitizedRow)}\n key={index}\n appearance=\"discrete\"\n icon={typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon}\n tooltip={\n typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip\n }\n />\n ))}\n {secondaryActions.length ? (\n <Menu>\n <Menu.Trigger>\n <IconButton\n appearance=\"discrete\"\n icon=\"ellipsis-vertical\"\n aria-label={texts.legacyTable.actions}\n tooltip={texts.legacyTable.actions}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n }}\n />\n </Menu.Trigger>\n <Menu.Content>\n {secondaryActions.map((action: RowAction<T>, index: number) => (\n <Menu.Item\n key={index}\n icon={\n typeof action.icon === 'function'\n ? action.icon(sanitizedRow)\n : action.icon\n }\n {...getActionProps(action, sanitizedRow)}>\n {typeof action.text === 'function' ? action.text(sanitizedRow) : action.text}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n\n if (windowed) {\n return <div className={actionGroupClassName}>{output}</div>;\n }\n\n return (\n <InView rootMargin=\"100px 0px\">\n {({ inView, ref }) => (\n <div className={actionGroupClassName} ref={ref}>\n {inView ? output : null}\n </div>\n )}\n </InView>\n );\n },\n },\n ]);\n }\n };\n plugin.pluginName = 'useRowActions';\n return plugin;\n};\n"],"names":["actionGroupClassName","hasActions","inlineEditingUniqueId","handlers","actions","onRowCreate","onRowCopy","onRowDelete","onRowEdit","getActions","row","undefined","primary","secondary","visibleActions","filter","x","action","visible","forEach","showOnRow","push","getLength","primaryActions","secondaryActions","length","getActionProps","tooltip","disabled","onClick","event","EditModeActions","React","useEffect","listener","key","_event$target","target","_event$target$form","form","reset","preventDefault","document","addEventListener","removeEventListener","className","IconButton","appearance","icon","type","useRowActions","rowExpansionRenderer","texts","windowed","inlineEditing","actionsLength","plugin","hooks","visibleColumns","columns","id","flex","Cell","isEditing","sanitizedRow","sanitizeRowProps","output","legacyTable","newSubRow","canEdit","stopPropagation","persist","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","Menu","Trigger","Content","Item","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ACC,UAAU,EAAC;aACd,CAAC;YAAEC,MAAM;YAAEC;WAAK,oBACbzD;YAAKa,SAAS,EAAE7C,oBAAoB;YAAEyF,GAAG,EAAEA;aACtCD,MAAM,GAAGtB,MAAM,GAAG,IAAI,CACrB,CACT,CACI;;OAGpB,CACJ,CAAC;;GAET;EACDV,MAAM,CAACkC,UAAU,GAAG,eAAe;EACnC,OAAOlC,MAAM;AACjB;;;;"}
1
+ {"version":3,"file":"useRowActions.js","sources":["../../../../../../../../../src/components/Table/hooks/plugins/useRowActions.tsx"],"sourcesContent":["import React from 'react';\nimport { PluginHook } from 'react-table';\nimport { InView } from 'react-intersection-observer';\nimport { sanitizeRowProps } from '../../util';\nimport { IconButton } from '../../../IconButton/IconButton';\nimport { LocalizationTexts } from '../../../Provider/Localization';\nimport { Menu } from '../../../Menu/Menu';\nimport { RowAction, RowActionHandler, LegacyTableRow } from '../../types';\n\nconst actionGroupClassName = '-mt-1 -mb-1 h-8 flex';\n\nconst hasActions = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n return (\n !!actions ||\n handlers.onRowCreate ||\n handlers.onRowCopy ||\n handlers.onRowDelete ||\n !!inlineEditingUniqueId ||\n handlers.onRowEdit\n );\n};\n\nconst getActions = (\n actions: RowActionHandler<any>[] | undefined,\n row: LegacyTableRow<any> | undefined = undefined\n): [RowAction<any>[], RowAction<any>[]] => {\n const primary: RowAction<any>[] = [];\n const secondary: RowAction<any>[] = [];\n\n if (actions) {\n let visibleActions = actions.filter(x => !!x && typeof x !== 'boolean') as RowAction<any>[];\n\n if (row) {\n visibleActions = visibleActions.filter(action => {\n if (action.visible !== undefined) {\n if (typeof action.visible === 'function') {\n return action.visible(row);\n }\n\n return action.visible;\n }\n\n return true;\n });\n }\n\n visibleActions.forEach(action => {\n if (action.showOnRow) {\n primary.push(action);\n } else {\n secondary.push(action);\n }\n });\n }\n\n return [primary, secondary];\n};\n\nconst getLength = (inlineEditingUniqueId: any, handlers: any, actions: RowActionHandler<any>[] | undefined): number => {\n const [primaryActions, secondaryActions] = getActions(actions);\n\n let length = primaryActions.length + (secondaryActions.length ? 1 : 0);\n\n if (handlers.onRowCreate) {\n length++;\n }\n\n if (handlers.onRowCopy) {\n length++;\n }\n\n if (handlers.onRowDelete) {\n length++;\n }\n\n if (!!inlineEditingUniqueId || handlers.onRowEdit) {\n length++;\n\n if (length < 2) {\n length++;\n }\n }\n\n return length;\n};\n\nconst getActionProps = (action: RowAction<any>, row: LegacyTableRow<any>) => {\n return {\n 'aria-label': typeof action.tooltip === 'function' ? action.tooltip(row) : action.tooltip,\n disabled: typeof action.disabled === 'function' ? action.disabled(row) : action.disabled,\n onClick: (event: React.MouseEvent<HTMLElement>) => {\n action.onClick(row, event);\n },\n };\n};\n\nconst EditModeActions = () => {\n React.useEffect(() => {\n const listener = (event: any) => {\n if (event.key === 'Escape' && event.target?.form?.reset) {\n event.preventDefault();\n event.target.form.reset();\n }\n };\n\n document.addEventListener('keydown', listener);\n\n return () => {\n document.removeEventListener('keydown', listener);\n };\n }, []);\n\n return (\n <div className={actionGroupClassName}>\n <IconButton appearance=\"primary\" icon=\"tick\" type=\"submit\" className=\"mr-2\" />\n <IconButton appearance=\"ghost\" icon=\"close\" type=\"reset\" />\n </div>\n );\n};\n\nexport const useRowActions = <T extends {}>(\n inlineEditingUniqueId: keyof T | undefined,\n handlers: any,\n actions: RowActionHandler<T>[] | undefined,\n rowExpansionRenderer: any,\n texts: LocalizationTexts,\n windowed = false\n): PluginHook<{}> => {\n const inlineEditing = !!inlineEditingUniqueId;\n const actionsLength = getLength(inlineEditingUniqueId, handlers, actions);\n\n const plugin = (hooks: any): void => {\n if (hasActions(inlineEditingUniqueId, handlers, actions)) {\n hooks.visibleColumns.push((columns: any) => [\n ...columns,\n {\n id: '_actions',\n className: 'flex justify-end px-1 overflow-visible',\n flex: `0 0 calc((${actionsLength} * 2rem) + .5rem)`,\n Cell: ({ row }: any) => {\n if (row.isEditing) {\n return <EditModeActions />;\n }\n\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n const [primaryActions, secondaryActions] = getActions(actions, sanitizedRow);\n\n const output = (\n <>\n {handlers.onRowCreate && (\n <IconButton\n appearance=\"discrete\"\n icon=\"circle-plus\"\n aria-label={texts.legacyTable.newSubRow}\n tooltip={texts.legacyTable.newSubRow}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n\n if (!row.isExpanded) {\n row.toggleRowExpanded();\n }\n\n handlers.onRowCreate(sanitizedRow, event);\n }}\n />\n )}\n {(inlineEditing || handlers.onRowEdit) && (\n <IconButton\n appearance=\"discrete\"\n icon=\"edit\"\n aria-label={texts.legacyTable.edit}\n tooltip={texts.legacyTable.edit}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n\n if (inlineEditing) {\n row.toggleRowEditing();\n } else if (handlers.onRowEdit) {\n event.persist();\n handlers.onRowEdit(sanitizedRow, event);\n }\n }}\n />\n )}\n {handlers.onRowCopy && (\n <IconButton\n appearance=\"discrete\"\n icon=\"copy\"\n aria-label={texts.legacyTable.copy}\n tooltip={texts.legacyTable.copy}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowCopy(sanitizedRow, event);\n }}\n />\n )}\n {handlers.onRowDelete && (\n <IconButton\n appearance=\"discrete\"\n icon=\"delete\"\n aria-label={texts.legacyTable.del}\n tooltip={texts.legacyTable.del}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n event.persist();\n row.setActive();\n handlers.onRowDelete(sanitizedRow, event);\n }}\n />\n )}\n {primaryActions.map((action: RowAction<T>, index: number) => (\n <IconButton\n {...getActionProps(action, sanitizedRow)}\n key={index}\n appearance=\"discrete\"\n icon={typeof action.icon === 'function' ? action.icon(sanitizedRow) : action.icon}\n tooltip={\n typeof action.tooltip === 'function' ? action.tooltip(sanitizedRow) : action.tooltip\n }\n />\n ))}\n {secondaryActions.length ? (\n <Menu>\n <Menu.Trigger>\n <IconButton\n appearance=\"discrete\"\n icon=\"ellipsis-vertical\"\n aria-label={texts.legacyTable.actions}\n tooltip={texts.legacyTable.actions}\n disabled={inlineEditing && !row.canEdit}\n onClick={(event: React.MouseEvent) => {\n event.stopPropagation();\n row.setActive();\n }}\n />\n </Menu.Trigger>\n <Menu.Content>\n {secondaryActions.map((action: RowAction<T>, index: number) => (\n <Menu.Item\n key={index}\n icon={\n typeof action.icon === 'function'\n ? action.icon(sanitizedRow)\n : action.icon\n }\n {...getActionProps(action, sanitizedRow)}>\n {typeof action.text === 'function' ? action.text(sanitizedRow) : action.text}\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu>\n ) : null}\n </>\n );\n\n if (windowed) {\n return <div className={actionGroupClassName}>{output}</div>;\n }\n\n return (\n <InView rootMargin=\"100px 0px\">\n {({ inView, ref }) => (\n <div className={actionGroupClassName} ref={ref}>\n {inView ? output : null}\n </div>\n )}\n </InView>\n );\n },\n },\n ]);\n }\n };\n plugin.pluginName = 'useRowActions';\n return plugin;\n};\n"],"names":["actionGroupClassName","hasActions","inlineEditingUniqueId","handlers","actions","onRowCreate","onRowCopy","onRowDelete","onRowEdit","getActions","row","undefined","primary","secondary","visibleActions","filter","x","action","visible","forEach","showOnRow","push","getLength","primaryActions","secondaryActions","length","getActionProps","tooltip","disabled","onClick","event","EditModeActions","React","useEffect","listener","key","_event$target","target","_event$target$form","form","reset","preventDefault","document","addEventListener","removeEventListener","className","IconButton","appearance","icon","type","useRowActions","rowExpansionRenderer","texts","windowed","inlineEditing","actionsLength","plugin","hooks","visibleColumns","columns","id","flex","Cell","isEditing","sanitizedRow","sanitizeRowProps","output","legacyTable","newSubRow","canEdit","stopPropagation","persist","setActive","isExpanded","toggleRowExpanded","edit","toggleRowEditing","copy","del","map","index","Men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D,oBACIlC,6BAACsD,MAAM;YAACC,UAAU,EAAC;aACd,CAAC;YAAEC,MAAM;YAAEC;WAAK,mBACbzD;YAAKa,SAAS,EAAE7C,oBAAoB;YAAEyF,GAAG,EAAEA;aACtCD,MAAM,GAAGtB,MAAM,GAAG,IAAI,CACrB,CACT,CACI;;OAGpB,CACJ,CAAC;;GAET;EACDV,MAAM,CAACkC,UAAU,GAAG,eAAe;EACnC,OAAOlC,MAAM;AACjB;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"useRowCreation.js","sources":["../../../../../../../../src/components/Table/hooks/useRowCreation.tsx"],"sourcesContent":["import React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\nimport get from 'lodash/get';\nimport compact from 'lodash/compact';\nimport pullAt from 'lodash/pullAt';\n\nimport { convertRowIndexPathToNumberArray, getByRowIndexPath, getParentRowIndexPath } from '../util/rowIndexPath';\nimport { Row, RowIndexPath, LegacyTableRef } from '../types';\n\nexport const insertChildTableRow = <TRow,>(\n data: Row<TRow>[],\n rowIndexPath: RowIndexPath = undefined,\n values: any = {}\n): [Row<TRow>[], RowIndexPath] => {\n const nexTRow: Row<TRow>[] = JSON.parse(JSON.stringify(data));\n\n let childRowIndexPath;\n\n if (rowIndexPath) {\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const currentRow = getByRowIndexPath(nexTRow, rowIndexes.join('.'));\n const nextSubRows = currentRow?.subRows ?? [];\n\n const path = rowIndexes.map(i => `[${i}]`).join('.subRows') + '.subRows';\n nextSubRows.unshift(values);\n set(nexTRow, path, nextSubRows);\n\n // rebuild the new id\n rowIndexes.push(0);\n childRowIndexPath = rowIndexes.join('.');\n } else {\n nexTRow.unshift(values);\n childRowIndexPath = '0';\n }\n\n return [nexTRow, childRowIndexPath];\n};\n\nexport const removeChildTableRow = <TRow,>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow>[] => {\n const nexTRow = JSON.parse(JSON.stringify(data));\n\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const rootIndex = Number(rowIndexes.shift());\n\n if (rowIndexes.length) {\n // unset\n const unsetPath = rowIndexes.map(index => `subRows[${index}]`).join('.');\n unset(nexTRow[rootIndex], unsetPath);\n\n // remove empty value from subRows\n rowIndexes.pop();\n const setPath = rowIndexes.length ? rowIndexes.map(index => `subRows[${index}]`).join('.') + '.subRows' : 'subRows';\n set(nexTRow[rootIndex], setPath, compact(get(nexTRow[rootIndex], setPath)));\n } else {\n pullAt(nexTRow, rootIndex);\n }\n\n return nexTRow;\n};\n\nexport type useTableRowCreation<TRow> = {\n data: Row<TRow>[];\n create: (rowIndexPath: RowIndexPath, values?: object | undefined) => RowIndexPath;\n remove: (rowIndexPath: RowIndexPath) => void;\n isCreating: boolean;\n};\n\nexport const useTableRowCreation = <TRow,>(\n data: Row<TRow>[],\n tableRef: React.RefObject<LegacyTableRef>\n): useTableRowCreation<TRow> => {\n const [internalData, setInternalData] = React.useState(JSON.parse(JSON.stringify(data)));\n const [activeRowIndexPath, setActiveRowIndexPath] = React.useState<string | undefined>(undefined);\n\n React.useEffect(() => {\n if (activeRowIndexPath !== undefined) {\n // keep the same edit key, so that we don't remount the row/form\n const currentRow: any = getByRowIndexPath(internalData, activeRowIndexPath);\n\n // get the active creation rows parent\n const parentId = getParentRowIndexPath(activeRowIndexPath);\n\n // insert a new empty row in the external data (with the same key)\n const [nexTRow, newRowIndexPath] = insertChildTableRow(JSON.parse(JSON.stringify(data)), parentId, currentRow);\n\n // update and set that row as active, we basically just changed it's position in our internal data\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(currentRow?._createKey);\n }\n } else {\n setInternalData(data);\n }\n }, [JSON.stringify(data)]);\n\n const create = (rowIndexPath: RowIndexPath = undefined, values: object | undefined = {}): RowIndexPath => {\n const _createKey = uuid();\n const [nexTRow, newRowIndexPath] = insertChildTableRow(internalData, rowIndexPath, { ...values, _createKey });\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(_createKey);\n }\n\n return newRowIndexPath;\n };\n\n const remove = (rowIndexPath: any): void => {\n const nexTRow = removeChildTableRow(internalData, rowIndexPath);\n setInternalData(nexTRow);\n setActiveRowIndexPath(undefined);\n };\n\n return {\n data: internalData,\n create,\n remove,\n isCreating: activeRowIndexPath !== undefined,\n };\n};\n"],"names":["insertChildTableRow","data","rowIndexPath","undefined","values","nexTRow","JSON","parse","stringify","childRowIndexPath","_currentRow$subRows","rowIndexes","convertRowIndexPathToNumberArray","currentRow","getByRowIndexPath","join","nextSubRows","subRows","path","map","i","unshift","set","push","removeChildTableRow","rootIndex","Number","shift","length","unsetPath","index","unset","pop","setPath","compact","get","pullAt","useTableRowCreation","tableRef","internalData","setInternalData","React","useState","activeRowIndexPath","setActiveRowIndexPath","useEffect","parentId","getParentRowIndexPath","newRowIndexPath","current","instance","toggleRowEditing","_createKey","create","uuid","remove","isCreating"],"mappings":";;;;;;;;;MAWaA,mBAAmB,GAAGA,CAC/BC,IAAiB,EACjBC,eAA6BC,SAAS,EACtCC,SAAc,EAAE;EAEhB,MAAMC,OAAO,GAAgBC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,SAAS,CAACP,IAAI,CAAC,CAAC;EAE7D,IAAIQ,iBAAiB;EAErB,IAAIP,YAAY,EAAE;IAAA,IAAAQ,mBAAA;IACd,MAAMC,UAAU,GAAGC,gCAAgC,CAACV,YAAY,CAAC;IACjE,MAAMW,UAAU,GAAGC,iBAAiB,CAACT,OAAO,EAAEM,UAAU,CAACI,IAAI,CAAC,GAAG,CAAC,CAAC;IACnE,MAAMC,WAAW,IAAAN,mBAAA,GAAGG,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEI,OAAO,cAAAP,mBAAA,cAAAA,mBAAA,GAAI,EAAE;IAE7C,MAAMQ,I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AACnD,eAA6BC,SAAS,EAAEC,SAA6B,EAAE;IACnF,MAAMgD,UAAU,GAAGE,EAAI,EAAE;IACzB,MAAM,CAACjD,OAAO,EAAE2C,eAAe,CAAC,GAAGhD,mBAAmB,CAACuC,YAAY,EAAErC,YAAY,EAAE;MAAE,GAAGE,MAAM;MAAEgD;KAAY,CAAC;IAC7GR,qBAAqB,CAACI,eAAe,CAAC;IACtCR,eAAe,CAACnC,OAAO,CAAC;IAExB,IAAIiC,QAAQ,aAARA,QAAQ,eAARA,QAAQ,CAAEW,OAAO,EAAE;MACnBX,QAAQ,CAACW,OAAO,CAACC,QAAQ,CAACC,gBAAgB,CAACC,UAAU,CAAC;;IAG1D,OAAOJ,eAAe;GACzB;EAED,MAAMO,MAAM,GAAIrD,YAAiB;IAC7B,MAAMG,OAAO,GAAGmB,mBAAmB,CAACe,YAAY,EAAErC,YAAY,CAAC;IAC/DsC,eAAe,CAACnC,OAAO,CAAC;IACxBuC,qBAAqB,CAACzC,SAAS,CAAC;GACnC;EAED,OAAO;IACHF,IAAI,EAAEsC,YAAY;IAClBc,MAAM;IACNE,MAAM;IACNC,UAAU,EAAEb,kBAAkB,KAAKxC;GACtC;AACL;;;;"}
1
+ {"version":3,"file":"useRowCreation.js","sources":["../../../../../../../../src/components/Table/hooks/useRowCreation.tsx"],"sourcesContent":["import React from 'react';\nimport { v4 as uuid } from 'uuid';\nimport set from 'lodash/set';\nimport unset from 'lodash/unset';\nimport get from 'lodash/get';\nimport compact from 'lodash/compact';\nimport pullAt from 'lodash/pullAt';\n\nimport { convertRowIndexPathToNumberArray, getByRowIndexPath, getParentRowIndexPath } from '../util/rowIndexPath';\nimport { Row, RowIndexPath, LegacyTableRef } from '../types';\n\nexport const insertChildTableRow = <TRow extends {}>(\n data: Row<TRow>[],\n rowIndexPath: RowIndexPath = undefined,\n values: any = {}\n): [Row<TRow>[], RowIndexPath] => {\n const nexTRow: Row<TRow>[] = JSON.parse(JSON.stringify(data));\n\n let childRowIndexPath;\n\n if (rowIndexPath) {\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const currentRow = getByRowIndexPath(nexTRow, rowIndexes.join('.'));\n const nextSubRows = currentRow?.subRows ?? [];\n\n const path = rowIndexes.map(i => `[${i}]`).join('.subRows') + '.subRows';\n nextSubRows.unshift(values);\n set(nexTRow, path, nextSubRows);\n\n // rebuild the new id\n rowIndexes.push(0);\n childRowIndexPath = rowIndexes.join('.');\n } else {\n nexTRow.unshift(values);\n childRowIndexPath = '0';\n }\n\n return [nexTRow, childRowIndexPath];\n};\n\nexport const removeChildTableRow = <TRow extends {}>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow>[] => {\n const nexTRow = JSON.parse(JSON.stringify(data));\n\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const rootIndex = Number(rowIndexes.shift());\n\n if (rowIndexes.length) {\n // unset\n const unsetPath = rowIndexes.map(index => `subRows[${index}]`).join('.');\n unset(nexTRow[rootIndex], unsetPath);\n\n // remove empty value from subRows\n rowIndexes.pop();\n const setPath = rowIndexes.length ? rowIndexes.map(index => `subRows[${index}]`).join('.') + '.subRows' : 'subRows';\n set(nexTRow[rootIndex], setPath, compact(get(nexTRow[rootIndex], setPath)));\n } else {\n pullAt(nexTRow, rootIndex);\n }\n\n return nexTRow;\n};\n\nexport type useTableRowCreation<TRow extends {}> = {\n data: Row<TRow>[];\n create: (rowIndexPath: RowIndexPath, values?: object | undefined) => RowIndexPath;\n remove: (rowIndexPath: RowIndexPath) => void;\n isCreating: boolean;\n};\n\nexport const useTableRowCreation = <TRow extends {}>(\n data: Row<TRow>[],\n tableRef: React.RefObject<LegacyTableRef>\n): useTableRowCreation<TRow> => {\n const [internalData, setInternalData] = React.useState(JSON.parse(JSON.stringify(data)));\n const [activeRowIndexPath, setActiveRowIndexPath] = React.useState<string | undefined>(undefined);\n\n React.useEffect(() => {\n if (activeRowIndexPath !== undefined) {\n // keep the same edit key, so that we don't remount the row/form\n const currentRow: any = getByRowIndexPath(internalData, activeRowIndexPath);\n\n // get the active creation rows parent\n const parentId = getParentRowIndexPath(activeRowIndexPath);\n\n // insert a new empty row in the external data (with the same key)\n const [nexTRow, newRowIndexPath] = insertChildTableRow(JSON.parse(JSON.stringify(data)), parentId, currentRow);\n\n // update and set that row as active, we basically just changed it's position in our internal data\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(currentRow?._createKey);\n }\n } else {\n setInternalData(data);\n }\n }, [JSON.stringify(data)]);\n\n const create = (rowIndexPath: RowIndexPath = undefined, values: object | undefined = {}): RowIndexPath => {\n const _createKey = uuid();\n const [nexTRow, newRowIndexPath] = insertChildTableRow(internalData, rowIndexPath, { ...values, _createKey });\n setActiveRowIndexPath(newRowIndexPath);\n setInternalData(nexTRow);\n\n if (tableRef?.current) {\n tableRef.current.instance.toggleRowEditing(_createKey);\n }\n\n return newRowIndexPath;\n };\n\n const remove = (rowIndexPath: any): void => {\n const nexTRow = removeChildTableRow(internalData, rowIndexPath);\n setInternalData(nexTRow);\n setActiveRowIndexPath(undefined);\n };\n\n return {\n data: internalData,\n create,\n remove,\n isCreating: activeRowIndexPath !== undefined,\n };\n};\n"],"names":["insertChildTableRow","data","rowIndexPath","undefined","values","nexTRow","JSON","parse","stringify","childRowIndexPath","_currentRow$subRows","rowIndexes","convertRowIndexPathToNumberArray","currentRow","getByRowIndexPath","join","nextSubRows","subRows","path","map","i","unshift","set","push","removeChildTableRow","rootIndex","Number","shift","length","unsetPath","index","unset","pop","setPath","compact","get","pullAt","useTableRowCreation","tableRef","internalData","setInternalData","React","useState","activeRowIndexPath","setActiveRowIndexPath","useEffect","parentId","getParentRowIndexPath","newRowIndexPath","current","instance","toggleRowEditing","_createKey","create","uuid","remove","isCreating"],"mappings":";;;;;;;;;MAWaA,mBAAmB,GAAGA,CAC/BC,IAAiB,EACjBC,eAA6BC,SAAS,EACtCC,SAAc,EAAE;EAE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;;;"}
@@ -30,7 +30,7 @@ const Column = ({
30
30
  "data-taco": "table-column"
31
31
  }), /*#__PURE__*/React__default.createElement("span", {
32
32
  className: "truncate"
33
- }, cell.render('Header')), cell.isSorted ? ( /*#__PURE__*/React__default.createElement(Icon, {
33
+ }, cell.render('Header')), cell.isSorted ? (/*#__PURE__*/React__default.createElement(Icon, {
34
34
  name: cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid',
35
35
  className: "-mt-0.5"
36
36
  })) : null);
@@ -1 +1 @@
1
- {"version":3,"file":"renderColumn.js","sources":["../../../../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-700 hover:text-black', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'cursor-pointer': !cell.disableSorting,\n 'justify-start text-left': cell.align === 'left',\n 'justify-end text-right': cell.align === 'right',\n 'justify-center text-center': cell.align === 'center' || !cell.align,\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id} data-taco=\"table-column\">\n <span className=\"truncate\">{cell.render('Header')}</span>\n {cell.isSorted ? (\n <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} className=\"-mt-0.5\" />\n ) : null}\n </div>\n );\n};\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;MAIaA,MAAM,GAAGA,CAAC;EAAEC;CAAW;EAChC,MAAMC,KAAK,GAAG;IACV,GAAGD,IAAI,CAACE,cAAc,EAAE;IACxB,IAAIF,IAAI,CAACG,oBAAoB,IAAIH,IAAI,CAACG,oBAAoB,CAAC;MAAEC,KAAK,EAAEC;KAAW,CAAC,CAAC;IACjFC,SAAS,EAAEC,EAAE,CAAC,qFAAqF,EAAEP,IAAI,CAACM,SAAS,EAAE;MACjH,uBAAuB,EAAE,CAAC,CAACN,IAAI,CAACQ,OAAO;MACvC,gBAAgB,EAAE,CAACR,IAAI,CAACS,cAAc;MACtC,yBAAyB,EAAET,IAAI,CAACU,KAAK,KAAK,MAAM;MAChD,wBAAwB,EAAEV,IAAI,CAACU,KAAK,KAAK,OAAO;MAChD,4BAA4B,EAAEV,IAAI,CAACU,KAAK,KAAK,QAAQ,IAAI,CAACV,IAAI,CAACU;KAClE,CAAC;IACFC,KAAK,EAAE;MAAE,GAAGX,IAAI,CAACW,KAAK;MAAEC,IAAI,EAAEZ,IAAI,CAACY;;GACtC;EAED,IAAIZ,IAAI,CAACa,QAAQ,EAAE;IACfZ,KAAK,CAAC,WAAW,CAAC,GAAGD,IAAI,CAACc,YAAY,GAAG,YAAY,GAAG,WAAW;;EAGvE,oBACIC,sDAASd,KAAK;IAAEe,GAAG,EAAEhB,IAAI,CAACiB,EAAE;iBAAY;mBACpCF;IAAMT,SAAS,EAAC;KAAYN,IAAI,CAACkB,MAAM,CAAC,QAAQ,CAAC,CAAQ,EACxDlB,IAAI,CAACa,QAAQ,kBACVE,6BAACI,IAAI;IAACC,IAAI,EAAEpB,IAAI,CAACc,YAAY,GAAG,oBAAoB,GAAG,kBAAkB;IAAER,SAAS,EAAC;IAAY,IACjG,IAAI,CACN;AAEd;;;;"}
1
+ {"version":3,"file":"renderColumn.js","sources":["../../../../../../../../src/components/Table/util/renderColumn.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { Icon } from '../../Icon/Icon';\n\nexport const Column = ({ cell }: any): any => {\n const props = {\n ...cell.getHeaderProps(),\n ...(cell.getSortByToggleProps && cell.getSortByToggleProps({ title: undefined })),\n className: cn('yt-table__cell flex flex-1 truncate p-2 align-middle text-grey-700 hover:text-black', cell.className, {\n 'yt-table__cell__group': !!cell.columns,\n 'cursor-pointer': !cell.disableSorting,\n 'justify-start text-left': cell.align === 'left',\n 'justify-end text-right': cell.align === 'right',\n 'justify-center text-center': cell.align === 'center' || !cell.align,\n }),\n style: { ...cell.style, flex: cell.flex },\n };\n\n if (cell.isSorted) {\n props['aria-sort'] = cell.isSortedDesc ? 'descending' : 'ascending';\n }\n\n return (\n <div {...props} key={cell.id} data-taco=\"table-column\">\n <span className=\"truncate\">{cell.render('Header')}</span>\n {cell.isSorted ? (\n <Icon name={cell.isSortedDesc ? 'chevron-down-solid' : 'chevron-up-solid'} className=\"-mt-0.5\" />\n ) : null}\n </div>\n );\n};\n"],"names":["Column","cell","props","getHeaderProps","getSortByToggleProps","title","undefined","className","cn","columns","disableSorting","align","style","flex","isSorted","isSortedDesc","React","key","id","render","Icon","name"],"mappings":";;;;MAIaA,MAAM,GAAGA,CAAC;EAAEC;CAAW;EAChC,MAAMC,KAAK,GAAG;IACV,GAAGD,IAAI,CAACE,cAAc,EAAE;IACxB,IAAIF,IAAI,CAACG,oBAAoB,IAAIH,IAAI,CAACG,oBAAoB,CAAC;MAAEC,KAAK,EAAEC;KAAW,CAAC,CAAC;IACjFC,SAAS,EAAEC,EAAE,CAAC,qFAAqF,EAAEP,IAAI,CAACM,SAAS,EAAE;MACjH,uBAAuB,EAAE,CAAC,CAACN,IAAI,CAACQ,OAAO;MACvC,gBAAgB,EAAE,CAACR,IAAI,CAACS,cAAc;MACtC,yBAAyB,EAAET,IAAI,CAACU,KAAK,KAAK,MAAM;MAChD,wBAAwB,EAAEV,IAAI,CAACU,KAAK,KAAK,OAAO;MAChD,4BAA4B,EAAEV,IAAI,CAACU,KAAK,KAAK,QAAQ,IAAI,CAACV,IAAI,CAACU;KAClE,CAAC;IACFC,KAAK,EAAE;MAAE,GAAGX,IAAI,CAACW,KAAK;MAAEC,IAAI,EAAEZ,IAAI,CAACY;;GACtC;EAED,IAAIZ,IAAI,CAACa,QAAQ,EAAE;IACfZ,KAAK,CAAC,WAAW,CAAC,GAAGD,IAAI,CAACc,YAAY,GAAG,YAAY,GAAG,WAAW;;EAGvE,oBACIC,sDAASd,KAAK;IAAEe,GAAG,EAAEhB,IAAI,CAACiB,EAAE;iBAAY;mBACpCF;IAAMT,SAAS,EAAC;KAAYN,IAAI,CAACkB,MAAM,CAAC,QAAQ,CAAC,CAAQ,EACxDlB,IAAI,CAACa,QAAQ,iBACVE,6BAACI,IAAI;IAACC,IAAI,EAAEpB,IAAI,CAACc,YAAY,GAAG,oBAAoB,GAAG,kBAAkB;IAAER,SAAS,EAAC;IAAY,IACjG,IAAI,CACN;AAEd;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"renderRow.js","sources":["../../../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, LegacyTableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: LegacyTableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\n 'justify-start text-left': cell.column.align === 'left',\n 'justify-end text-right': cell.column.align === 'right',\n 'text-center': !cell.column.align,\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row border-grey-300 flex border-b min-h-[2.5rem] hover:bg-grey-100',\n {\n 'yt-table__row--active bg-grey-200 hover:bg-grey-200': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAGA,CAACC,IAAuB,EAAEC,GAAwB;EACjE,MAAMC,KAAK,GAAG;IACV,GAAGF,IAAI,CAACG,YAAY,EAAE;IACtBC,SAAS,EAAEC,EAAE,CAAC,iDAAiD,EAAEL,IAAI,CAACM,MAAM,CAACF,SAAS,EAAE;MACpF,yBAAyB,EAAEJ,IAAI,CAACM,MAAM,CAACC,KAAK,KAAK,MAAM;MACvD,wBAAwB,EAAEP,IAAI,CAACM,MAAM,CAACC,KAAK,KAAK,OAAO;MACvD,aAAa,EAAE,CAACP,IAAI,CAACM,MAAM,CAACC;KAC/B,CAAC;IACFC,KAAK,EAAE;MACH,GAAGR,IAAI,CAACM,MAAM,CAACE,KAAK;MACpBC,IAAI,EAAE,OAAOT,IAAI,CAACM,MAAM,CAACG,IAAI,KAAK,UAAU,GAAGT,IAAI,CAACM,MAAM,CAACG,IAAI,CAACR,GAAG,CAAC,GAAGD,IAAI,CAACM,MAAM,CAACG;;GAE1F;EACD,oBACIC,sDAASR,KAAK;IAAES,IAAI,EAAC,UAAU;iBAAW;MACrCX,IAAI,CAACY,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAC1B;AAEd,CAAC;MAEYC,GAAG,gBAAGH,cAAK,CAACI,UAAU,CAAC,SAASC,QAAQA,CAAC;EAAEd,GAAG;EAAEe,KAAK;EAAEC,QAAQ;EAAEC,YAAY;EAAE,GAAGC;CAAe,EAAEC,GAAQ;EACpH,MAAM;IACFC,WAAW;IACXC,UAAU;IACVC,YAA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AS,IAAK,CAACA,IAAI,CAACM,MAAM,CAACyC,eAAe,CAAC;;EAGzE,MAAMC,WAAW,GAAGxB,oBAAoB,IAAIvB,GAAG,CAACgD,UAAU,iBAAIvC,0CAAMc,oBAAoB,CAACI,YAAY,EAAEX,QAAQ,CAAC,CAAO;EACvH,MAAMiC,UAAU,GAAGxC,cAAK,CAACyC,OAAO,CAAC;IAC7B,oBACIzC,yEACIA,6BAAC0C,UAAU;MAACC,GAAG,EAAEpD,GAAG,CAACqD,QAAQ,CAACC,UAAU;MAAEC,OAAO;MAACC,YAAY;MAACC,SAAS;oBACpEhD,sDAASR,KAAK;MAAES,IAAI,EAAC,KAAK;MAACS,GAAG,EAAEA;qBAC5BV;MAAOiD,IAAI,EAAC,QAAQ;MAACC,IAAI,EAAC,eAAe;MAACC,KAAK,EAAE5D,GAAG,CAAC6D;MAAM,eAC3DpD;MAAOiD,IAAI,EAAC,QAAQ;MAACC,IAAI,EAAC,wBAAwB;MAACC,KAAK,EAAE5D,GAAG,CAACqD,QAAQ,CAAC3B,qBAAqB;MAAK,EAChGkB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,CACG,EACZoB,WAAW,CACb;GAEV,EAAE,CAAC/C,GAAG,CAACqD,QAAQ,CAACC,UAAU,CAAC,CAAC;EAE7B,IAAItD,GAAG,CAACmC,SAAS,EAAE;IACf,OAAOc,UAAU;;EAGrB,oBACIxC,yEACIA,sDAASR,KAAK;IAAES,IAAI,EAAC,KAAK;IAACS,GAAG,EAAEA;MAC3ByB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,EACLoB,WAAW,CACb;AAEX,CAAC;;;;"}
1
+ {"version":3,"file":"renderRow.js","sources":["../../../../../../../../src/components/Table/util/renderRow.tsx"],"sourcesContent":["import React from 'react';\nimport cn from 'clsx';\nimport { FocusScope } from '@react-aria/focus';\nimport { InternalTableCell, LegacyTableRow } from '../types';\nimport { sanitizeRowProps } from '../util';\n\nconst renderCell = (cell: InternalTableCell, row: LegacyTableRow<any>): JSX.Element => {\n const props = {\n ...cell.getCellProps(),\n className: cn('yt-table__cell flex-1 truncate p-2 align-middle', cell.column.className, {\n 'justify-start text-left': cell.column.align === 'left',\n 'justify-end text-right': cell.column.align === 'right',\n 'text-center': !cell.column.align,\n }),\n style: {\n ...cell.column.style,\n flex: typeof cell.column.flex === 'function' ? cell.column.flex(row) : cell.column.flex,\n },\n };\n return (\n <div {...props} role=\"gridcell\" data-taco=\"table-cell\">\n {cell.render('Cell') || null}\n </div>\n );\n};\n\nexport const Row = React.forwardRef(function TableRow({ row, index, instance, headerGroups, ...rowProps }: any, ref: any) {\n const {\n activeIndex,\n onRowClick,\n rowClassName,\n rowExpansionRenderer,\n rowHeight,\n setActiveIndex,\n style,\n inlineEditingUniqueId,\n } = rowProps;\n const sanitizedRow = sanitizeRowProps(row, rowExpansionRenderer);\n\n const props = {\n ...row.getRowProps(),\n style: {\n ...style,\n minHeight: rowHeight ? `${rowHeight}px` : undefined,\n paddingLeft: row.depth ? `${row.depth * 2}rem` : undefined,\n },\n className: cn(\n 'yt-table__row border-grey-300 flex border-b min-h-[2.5rem] hover:bg-grey-100',\n {\n 'yt-table__row--active bg-grey-200 hover:bg-grey-200': activeIndex === index,\n 'yt-table__row--clickable': !!onRowClick,\n 'yt-table__row--dragging': !!row.isDragging,\n 'yt-table__row--editing': !!row.isEditing,\n },\n typeof rowClassName === 'function' ? rowClassName(sanitizedRow) : rowClassName\n ),\n onClick: onRowClick\n ? (event: React.MouseEvent<HTMLElement>) => {\n if (\n event.target === event.currentTarget ||\n (event.target as HTMLElement).classList.contains('yt-table__cell')\n ) {\n event.preventDefault();\n event.persist();\n setActiveIndex(index);\n onRowClick(sanitizedRow);\n }\n }\n : () => {\n setActiveIndex(index);\n },\n };\n\n let cells = row.cells;\n\n if (row.depth > 0) {\n cells = row.cells.filter((cell: any) => !cell.column.hiddenOnSubRows);\n }\n\n const expandedRow = rowExpansionRenderer && row.isExpanded && <div>{rowExpansionRenderer(sanitizedRow, instance)}</div>;\n const rowContent = React.useMemo(() => {\n return (\n <>\n <FocusScope key={row.original._createKey} contain restoreFocus autoFocus>\n <div {...props} role=\"row\" ref={ref}>\n <input type=\"hidden\" name=\"_rowIndexPath\" value={row.id} />\n <input type=\"hidden\" name=\"_inlineEditingUniqueId\" value={row.original[inlineEditingUniqueId]} />\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n </FocusScope>\n {expandedRow}\n </>\n );\n }, [row.original._createKey]);\n\n if (row.isEditing) {\n return rowContent;\n }\n\n return (\n <>\n <div {...props} role=\"row\" ref={ref}>\n {cells.map((cell: InternalTableCell) => renderCell(cell, sanitizedRow))}\n </div>\n {expandedRow}\n </>\n );\n});\n"],"names":["renderCell","cell","row","props","getCellProps","className","cn","column","align","style","flex","React","role","render","Row","forwardRef","TableRow","index","instance","headerGroups","rowProps","ref","activeIndex","onRowClick","rowClassName","rowExpansionRenderer","rowHeight","setActiveIndex","inlineEditingUniqueId","sanitizedRow","sanitizeRowProps","getRowProps","minHeight","undefined","paddingLeft","depth","isDragging","isEditing","onClick","event","target","currentTarget","classList","contains","preventDefault","persist","cells","filter","hiddenOnSubRows","expandedRow","isExpanded","rowContent","useMemo","FocusScope","key","original","_createKey","contain","restoreFocus","autoFocus","type","name","value","id","map"],"mappings":";;;;;AAMA,MAAMA,UAAU,GAAGA,CAACC,IAAuB,EAAEC,GAAwB;EACjE,MAAMC,KAAK,GAAG;IACV,GAAGF,IAAI,CAACG,YAAY,EAAE;IACtBC,SAAS,EAAEC,EAAE,CAAC,iDAAiD,EAAEL,IAAI,CAACM,MAAM,CAACF,SAAS,EAAE;MACpF,yBAAyB,EAAEJ,IAAI,CAACM,MAAM,CAACC,KAAK,KAAK,MAAM;MACvD,wBAAwB,EAAEP,IAAI,CAACM,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C,QAAQ;MAACC,IAAI,EAAC,wBAAwB;MAACC,KAAK,EAAE5D,GAAG,CAACqD,QAAQ,CAAC3B,qBAAqB;MAAK,EAChGkB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,CACG,EACZoB,WAAW,CACb;GAEV,EAAE,CAAC/C,GAAG,CAACqD,QAAQ,CAACC,UAAU,CAAC,CAAC;EAE7B,IAAItD,GAAG,CAACmC,SAAS,EAAE;IACf,OAAOc,UAAU;;EAGrB,oBACIxC,yEACIA,sDAASR,KAAK;IAAES,IAAI,EAAC,KAAK;IAACS,GAAG,EAAEA;MAC3ByB,KAAK,CAACkB,GAAG,CAAE/D,IAAuB,IAAKD,UAAU,CAACC,IAAI,EAAE4B,YAAY,CAAC,CAAC,CACrE,EACLoB,WAAW,CACb;AAEX,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"rowIndexPath.js","sources":["../../../../../../../../src/components/Table/util/rowIndexPath.ts"],"sourcesContent":["import set from 'lodash/set';\nimport { Row, RowIndexPath } from '../types';\n\nexport const convertRowIndexPathToNumberArray = (rowIndexPath: RowIndexPath): number[] =>\n rowIndexPath?.split('.').map(Number) ?? [];\n\nexport const getByRowIndexPath = <TRow extends {}>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow> | undefined => {\n if (!rowIndexPath) {\n return undefined;\n }\n\n const currenTRow = [...data];\n const indexes = convertRowIndexPathToNumberArray(String(rowIndexPath));\n\n if (indexes.length) {\n const startIndex = indexes.shift() as number;\n return indexes.reduce((value, index) => value?.subRows?.[index] as Row<TRow>, currenTRow[startIndex]);\n }\n\n return undefined;\n};\n\nexport const setByRowIndexPath = <TRow extends {}>(data: Row<TRow>[], rowIndexPath: RowIndexPath, values: any): Row<TRow>[] => {\n const nexTRow = [...data];\n\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const rootIndex = rowIndexes.shift() as number;\n\n if (rowIndexes.length) {\n const path = rowIndexes.map(index => `subRows[${index}]`).join('.');\n set(nexTRow[rootIndex], path, values);\n } else {\n nexTRow[rootIndex] = values;\n }\n\n return nexTRow;\n};\n\nexport const getParentRowIndexPath = (rowIndexPath: RowIndexPath): RowIndexPath => {\n let parentIndexPath;\n\n if (rowIndexPath) {\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n rowIndexes.pop();\n\n if (rowIndexes.length) {\n parentIndexPath = rowIndexes.join('.');\n }\n }\n\n return parentIndexPath;\n};\n"],"names":["convertRowIndexPathToNumberArray","rowIndexPath","_rowIndexPath$split$m","split","map","Number","getByRowIndexPath","data","undefined","currenTRow","indexes","String","length","startIndex","shift","reduce","value","index","_value$subRows","subRows","setByRowIndexPath","values","nexTRow","rowIndexes","rootIndex","path","join","set","getParentRowIndexPath","parentIndexPath","pop"],"mappings":";;MAGaA,gCAAgC,GAAIC,YAA0B;EAAA,IAAAC,qBAAA;EAAA,QAAAA,qBAAA,GACvED,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAAA;MAEjCI,iBAAiB,GAAGA,CAAkBC,IAAiB,EAAEN,YAA0B;EAC5F,IAAI,CAACA,YAAY,EAAE;IACf,OAAOO,SAAS;;EAGpB,MAAMC,UAAU,GAAG,CAAC,GAAGF,IAAI,CAAC;EAC5B,MAAMG,OAAO,GAAGV,gCAAgC,CAACW,MAAM,CAACV,YAAY,CAAC,CAAC;EAEtE,IAAIS,OAAO,CAACE,MAAM,EAAE;IAChB,MAAMC,UAAU,GAAGH,OAAO,CAACI,KAAK,EAAY;IAC5C,OAAOJ,OAAO,CAACK,MAAM,CAAC,CAACC,KAAK,EAAEC,KAAK;MAAA,IAAAC,cAAA;MAAA,OAAKF,KAAK,aAALA,KAAK,wBAAAE,cAAA,GAALF,KAAK,CAAEG,OAAO,cAAAD,cAAA,uBAAdA,cAAA,CAAiBD,KAAK,CAAc;OAAER,UAAU,CAACI,UAAU,CAAC,CAAC;;EAGzG,OAAOL,SAAS;AACpB;MAEaY,iBAAiB,GAAGA,CAAkBb,IAAiB,EAAEN,YAA0B,EAAEoB,MAAW;EACzG,MAAMC,OAAO,GAAG,CAAC,GAAGf,IAAI,CAAC;EAEzB,MAAMgB,UAAU,GAAGvB,gCAAgC,CAACC,YAAY,CAAC;EACjE,MAAMuB,SAAS,GAAGD,UAAU,CAACT,KAAK,EAAY;EAE9C,IAAIS,UAAU,CAACX,MAAM,EAAE;IACnB,MAAMa,IAAI,GAAGF,UAAU,CAACnB,GAAG,CAACa,KAAK,eAAeA,QAAQ,CAAC,CAACS,IAAI,CAAC,GAAG,CAAC;IACnEC,GAAG,CAACL,OAAO,CAACE,SAAS,CAAC,EAAEC,IAAI,EAAEJ,MAAM,CAAC;GACxC,MAAM;IACHC,OAAO,CAACE,SAAS,CAAC,GAAGH,MAAM;;EAG/B,OAAOC,OAAO;AAClB;MAEaM,qBAAqB,GAAI3B,YAA0B;EAC5D,IAAI4B,eAAe;EAEnB,IAAI5B,YAAY,EAAE;IACd,MAAMsB,UAAU,GAAGvB,gCAAgC,CAACC,YAAY,CAAC;IACjEsB,UAAU,CAACO,GAAG,EAAE;IAEhB,IAAIP,UAAU,CAACX,MAAM,EAAE;MACnBiB,eAAe,GAAGN,UAAU,CAACG,IAAI,CAAC,GAAG,CAAC;;;EAI9C,OAAOG,eAAe;AAC1B;;;;"}
1
+ {"version":3,"file":"rowIndexPath.js","sources":["../../../../../../../../src/components/Table/util/rowIndexPath.ts"],"sourcesContent":["import set from 'lodash/set';\nimport { Row, RowIndexPath } from '../types';\n\nexport const convertRowIndexPathToNumberArray = (rowIndexPath: RowIndexPath): number[] =>\n rowIndexPath?.split('.').map(Number) ?? [];\n\nexport const getByRowIndexPath = <TRow extends {}>(data: Row<TRow>[], rowIndexPath: RowIndexPath): Row<TRow> | undefined => {\n if (!rowIndexPath) {\n return undefined;\n }\n\n const currenTRow = [...data];\n const indexes = convertRowIndexPathToNumberArray(String(rowIndexPath));\n\n if (indexes.length) {\n const startIndex = indexes.shift() as number;\n return indexes.reduce((value, index) => value?.subRows?.[index] as Row<TRow>, currenTRow[startIndex]);\n }\n\n return undefined;\n};\n\nexport const setByRowIndexPath = <TRow extends {}>(data: Row<TRow>[], rowIndexPath: RowIndexPath, values: any): Row<TRow>[] => {\n const nexTRow = [...data];\n\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n const rootIndex = rowIndexes.shift() as number;\n\n if (rowIndexes.length) {\n const path = rowIndexes.map(index => `subRows[${index}]`).join('.');\n set(nexTRow[rootIndex], path, values);\n } else {\n nexTRow[rootIndex] = values;\n }\n\n return nexTRow;\n};\n\nexport const getParentRowIndexPath = (rowIndexPath: RowIndexPath): RowIndexPath => {\n let parentIndexPath;\n\n if (rowIndexPath) {\n const rowIndexes = convertRowIndexPathToNumberArray(rowIndexPath);\n rowIndexes.pop();\n\n if (rowIndexes.length) {\n parentIndexPath = rowIndexes.join('.');\n }\n }\n\n return parentIndexPath;\n};\n"],"names":["convertRowIndexPathToNumberArray","rowIndexPath","_rowIndexPath$split$m","split","map","Number","getByRowIndexPath","data","undefined","currenTRow","indexes","String","length","startIndex","shift","reduce","value","index","_value$subRows","subRows","setByRowIndexPath","values","nexTRow","rowIndexes","rootIndex","path","join","set","getParentRowIndexPath","parentIndexPath","pop"],"mappings":";;MAGaA,gCAAgC,GAAIC,YAA0B;EAAA,IAAAC,qBAAA;EAAA,QAAAA,qBAAA,GACvED,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,KAAK,CAAC,GAAG,CAAC,CAACC,GAAG,CAACC,MAAM,CAAC,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,EAAE;AAAA;MAEjCI,iBAAiB,GAAGA,CAAkBC,IAAiB,EAAEN,YAA0B;EAC5F,IAAI,CAACA,YAAY,EAAE;IACf,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MAAM,EAAE;MACnBiB,eAAe,GAAGN,UAAU,CAACG,IAAI,CAAC,GAAG,CAAC;;;EAI9C,OAAOG,eAAe;AAC1B;;;;"}
@@ -25,10 +25,10 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
25
25
  const showCreateRowButton = table3.meta.editing.isEnabled && props.onEditingCreate;
26
26
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
27
27
  table: table3
28
- }, table3.meta.editing.isEnabled ? ( /*#__PURE__*/React__default.createElement(Editing, {
28
+ }, table3.meta.editing.isEnabled ? (/*#__PURE__*/React__default.createElement(Editing, {
29
29
  scrollToIndex: table3.renderer.scrollToIndex,
30
30
  table: table3.instance
31
- })) : null), hasValidationErrors ? ( /*#__PURE__*/React__default.createElement(Alert, {
31
+ })) : null), hasValidationErrors ? (/*#__PURE__*/React__default.createElement(Alert, {
32
32
  className: "mb-4",
33
33
  scrollToIndex: table3.renderer.scrollToIndex,
34
34
  table: table3.instance,
@@ -36,7 +36,7 @@ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref)
36
36
  })) : null, /*#__PURE__*/React__default.createElement(Table.Grid, Object.assign({}, gridAttributes, {
37
37
  "data-taco": "table3",
38
38
  table: table3
39
- }), showCreateRowButton && ( /*#__PURE__*/React__default.createElement(CreateNewRowButton, {
39
+ }), showCreateRowButton && (/*#__PURE__*/React__default.createElement(CreateNewRowButton, {
40
40
  table: table3.instance,
41
41
  tableMeta: table3.meta,
42
42
  onEditingCreate: props.onEditingCreate,
@@ -1 +1 @@
1
- {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport CreateNewRowButton from './components/Row/Editing/CreateRowButton';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport './style.css';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const hasValidationErrors = table3.meta.editing.hasErrors(table3.instance, table3.ref);\n const showCreateRowButton = table3.meta.editing.isEnabled && props.onEditingCreate;\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasValidationErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType> {...gridAttributes} data-taco=\"table3\" table={table3}>\n {showCreateRowButton && (\n <CreateNewRowButton\n table={table3.instance}\n tableMeta={table3.meta}\n onEditingCreate={props.onEditingCreate}\n scrollToIndex={table3.renderer.scrollToIndex}\n />\n )}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Props,\n Table3Ref,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3FeatureProps,\n Table3Texts,\n} from './types';\n"],"names":["Column","_","displayName","Group","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","hasValidationErrors","hasErrors","instance","showCreateRowButton","isEnabled","onEditingCreate","React","Table","Toolbar","table","Editing","scrollToIndex","renderer","Alert","className","tableRef","Grid","CreateNewRowButton","tableMeta","Table3","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;;;;AAUA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEnC,SAASC,KAAKA,CAACF,CAAmB;EAC9B,OAAO,IAAI;AACf;AACAE,KAAK,CAACD,WAAW,GAAG,aAAa;AAEjC,MAAME,UAAU,gBAAGC,eAAe,CAAC,SAASD,UAAUA,CAAkBE,KAAyB,EAAEC,GAAyB;;EACxH,MAAMC,MAAM,GAAGC,SAAS,CAAQH,KAAK,EAAEC,GAAG,CAAC;EAE3C,MAAMG,cAAc,GAAG;IACnB,yBAAyB,EAAE,CAAAC,oBAAA,GAAAH,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAF,oBAAA,eAAnBA,oBAAA,CAAqBG,SAAS,GACnD,CAAAC,qBAAA,GAAAP,MAAM,CAACI,IAAI,CAACC,OAAO,cAAAE,qBAAA,eAAnBA,qBAAA,CAAqBC,cAAc,GAC/B,UAAU,GACV,QAAQ,GACZC,SAAS;IACfC,kCAAkC,EAAEV,MAAM,CAAC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C,GAAG,GAAGjB,cAAK,CAACkB,OAAO,CAAC,MAAMH,MAAM,CAAC,WAAW,GAAGD,mBAAmB,CAAC,EAAE,CAACA,mBAAmB,CAAC,CAAC;EACjG,oBAAOd,6BAACrB,UAAU,oBAAYE,KAAK;IAAEoC,GAAG,EAAEA,GAAG;IAAEnC,GAAG,EAAEA;KAAO;AAC/D,CAAC;AAID+B,MAAM,CAACtC,MAAM,GAAGA,MAAM;AACtBsC,MAAM,CAACnC,KAAK,GAAGA,KAAK;;;;"}
1
+ {"version":3,"file":"Table3.js","sources":["../../../../../../../src/components/Table3/Table3.tsx"],"sourcesContent":["import React from 'react';\nimport { fixedForwardRef } from '../../types';\nimport { useTable3 } from './useTable3';\nimport { Table } from '../../primitives/Table/Core/Table';\nimport { Alert } from './components/Editing/Alert';\nimport CreateNewRowButton from './components/Row/Editing/CreateRowButton';\nimport { Table3Props, Table3Ref, Table3ColumnProps, Table3GroupProps } from './types';\nimport { Editing } from './components/Toolbar/Editing/Editing';\nimport './style.css';\n\nfunction Column<TType = unknown>(_: Table3ColumnProps<TType>) {\n return null;\n}\nColumn.displayName = 'Table3Column';\n\nfunction Group(_: Table3GroupProps) {\n return null;\n}\nGroup.displayName = 'Table3Group';\n\nconst BaseTable3 = fixedForwardRef(function BaseTable3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const table3 = useTable3<TType>(props, ref);\n\n const gridAttributes = {\n 'data-table-editing-mode': table3.meta.editing?.isEditing\n ? table3.meta.editing?.isDetailedMode\n ? 'detailed'\n : 'normal'\n : undefined,\n enableHorizontalArrowKeyNavigation: table3.meta.editing.isEditing,\n };\n\n const hasValidationErrors = table3.meta.editing.hasErrors(table3.instance, table3.ref);\n const showCreateRowButton = table3.meta.editing.isEnabled && props.onEditingCreate;\n\n return (\n <Table>\n <Table.Toolbar<TType> table={table3}>\n {table3.meta.editing.isEnabled ? (\n <Editing scrollToIndex={table3.renderer.scrollToIndex} table={table3.instance} />\n ) : null}\n </Table.Toolbar>\n {hasValidationErrors ? (\n <Alert\n className=\"mb-4\"\n scrollToIndex={table3.renderer.scrollToIndex}\n table={table3.instance}\n tableRef={table3.ref}\n />\n ) : null}\n <Table.Grid<TType> {...gridAttributes} data-taco=\"table3\" table={table3}>\n {showCreateRowButton && (\n <CreateNewRowButton\n table={table3.instance}\n tableMeta={table3.meta}\n onEditingCreate={props.onEditingCreate}\n scrollToIndex={table3.renderer.scrollToIndex}\n />\n )}\n </Table.Grid>\n </Table>\n );\n});\n\nexport const Table3 = fixedForwardRef(function Table3<TType = unknown>(props: Table3Props<TType>, ref: React.Ref<Table3Ref>) {\n const stringifiedChildren = String(props.children);\n // we force a remount (using key) when the child columns change because there are too many places to add children as an effect\n // this is cheaper from a complexity perspective, and probably performance wise as well\n const key = React.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);\n return <BaseTable3<TType> {...props} key={key} ref={ref} />;\n}) as (<TType = unknown>(props: Table3Props<TType> & React.RefAttributes<Table3Ref>) => JSX.Element) & {\n Column: typeof Column;\n Group: typeof Group;\n};\nTable3.Column = Column;\nTable3.Group = Group;\n\nexport type {\n Table3Props,\n Table3Ref,\n Table3ColumnProps,\n Table3GroupProps,\n Table3EditingSaveHandler,\n Table3EditingValidatorFn,\n Table3FeatureProps,\n Table3Texts,\n} from './types';\n"],"names":["Column","_","displayName","Group","BaseTable3","fixedForwardRef","props","ref","table3","useTable3","gridAttributes","_table3$meta$editing","meta","editing","isEditing","_table3$meta$editing2","isDetailedMode","undefined","enableHorizontalArrowKeyNavigation","hasValidationErrors","hasErrors","instance","showCreateRowButton","isEnabled","onEditingCreate","React","Table","Toolbar","table","Editing","scrollToIndex","renderer","Alert","className","tableRef","Grid","CreateNewRowButton","tableMeta","Table3","stringifiedChildren","String","children","key","useMemo"],"mappings":";;;;;;;;AAUA,SAASA,MAAMA,CAAkBC,CAA2B;EACxD,OAAO,IAAI;AACf;AACAD,MAAM,CAACE,WAAW,GAAG,cAAc;AAEn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