@coveord/plasma-mantine 52.8.0 → 52.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +30 -30
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/components/blank-slate/BlankSlate.js.map +1 -1
  5. package/dist/cjs/components/button/Button.js +2 -2
  6. package/dist/cjs/components/button/Button.js.map +1 -1
  7. package/dist/cjs/components/button/ButtonWithDisabledTooltip.js.map +1 -1
  8. package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
  9. package/dist/cjs/components/code-editor/languages/xml.js.map +1 -1
  10. package/dist/cjs/components/code-editor/search/Search.js.map +1 -1
  11. package/dist/cjs/components/collection/Collection.js +13 -9
  12. package/dist/cjs/components/collection/Collection.js.map +1 -1
  13. package/dist/cjs/components/collection/Collection.styles.js.map +1 -1
  14. package/dist/cjs/components/collection/CollectionItem.js.map +1 -1
  15. package/dist/cjs/components/copyToClipboard/CopyToClipboard.js +4 -3
  16. package/dist/cjs/components/copyToClipboard/CopyToClipboard.js.map +1 -1
  17. package/dist/cjs/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
  18. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.js +2 -1
  19. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  20. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js +2 -1
  21. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  22. package/dist/cjs/components/date-range-picker/EditableDateRangePicker.js +9 -6
  23. package/dist/cjs/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  24. package/dist/cjs/components/header/Header.js.map +1 -1
  25. package/dist/cjs/components/inline-confirm/InlineConfirm.js.map +1 -1
  26. package/dist/cjs/components/inline-confirm/InlineConfirmButton.js +2 -1
  27. package/dist/cjs/components/inline-confirm/InlineConfirmButton.js.map +1 -1
  28. package/dist/cjs/components/inline-confirm/InlineConfirmContext.js.map +1 -1
  29. package/dist/cjs/components/inline-confirm/InlineConfirmMenuItem.js +2 -1
  30. package/dist/cjs/components/inline-confirm/InlineConfirmMenuItem.js.map +1 -1
  31. package/dist/cjs/components/inline-confirm/InlineConfirmPrompt.js.map +1 -1
  32. package/dist/cjs/components/inline-confirm/useInlineConfirm.js.map +1 -1
  33. package/dist/cjs/components/menu/Menu.js.map +1 -1
  34. package/dist/cjs/components/modal-wizard/ModalWizard.js +16 -10
  35. package/dist/cjs/components/modal-wizard/ModalWizard.js.map +1 -1
  36. package/dist/cjs/components/modal-wizard/ModalWizardStep.js.map +1 -1
  37. package/dist/cjs/components/prompt/Prompt.js.map +1 -1
  38. package/dist/cjs/components/prompt/PromptFooter.js.map +1 -1
  39. package/dist/cjs/components/sticky-footer/StickyFooter.js.map +1 -1
  40. package/dist/cjs/components/table/Table.js +10 -8
  41. package/dist/cjs/components/table/Table.js.map +1 -1
  42. package/dist/cjs/components/table/Table.styles.js.map +1 -1
  43. package/dist/cjs/components/table/TableActions.js.map +1 -1
  44. package/dist/cjs/components/table/TableCollapsibleColumn.js +2 -1
  45. package/dist/cjs/components/table/TableCollapsibleColumn.js.map +1 -1
  46. package/dist/cjs/components/table/TableContext.js.map +1 -1
  47. package/dist/cjs/components/table/TableDateRangePicker.js.map +1 -1
  48. package/dist/cjs/components/table/TableFilter.js.map +1 -1
  49. package/dist/cjs/components/table/TableFooter.js.map +1 -1
  50. package/dist/cjs/components/table/TableHeader.js.map +1 -1
  51. package/dist/cjs/components/table/TableLayoutControl.js.map +1 -1
  52. package/dist/cjs/components/table/TableLoading.js.map +1 -1
  53. package/dist/cjs/components/table/TablePagination.js.map +1 -1
  54. package/dist/cjs/components/table/TablePerPage.js +2 -1
  55. package/dist/cjs/components/table/TablePerPage.js.map +1 -1
  56. package/dist/cjs/components/table/TablePredicate.d.ts.map +1 -1
  57. package/dist/cjs/components/table/TablePredicate.js +1 -2
  58. package/dist/cjs/components/table/TablePredicate.js.map +1 -1
  59. package/dist/cjs/components/table/TableSelectableColumn.js.map +1 -1
  60. package/dist/cjs/components/table/Th.js.map +1 -1
  61. package/dist/cjs/components/table/index.js.map +1 -1
  62. package/dist/cjs/components/table/layouts/RowLayout.js +4 -2
  63. package/dist/cjs/components/table/layouts/RowLayout.js.map +1 -1
  64. package/dist/cjs/components/table/layouts/TableLayouts.js.map +1 -1
  65. package/dist/cjs/components/table/useRowSelection.js +2 -1
  66. package/dist/cjs/components/table/useRowSelection.js.map +1 -1
  67. package/dist/cjs/form/FormProvider.js.map +1 -1
  68. package/dist/cjs/form/useForm.js.map +1 -1
  69. package/dist/cjs/hooks/useControlledList.js +6 -3
  70. package/dist/cjs/hooks/useControlledList.js.map +1 -1
  71. package/dist/cjs/hooks/useParentHeight.js.map +1 -1
  72. package/dist/cjs/index.js.map +1 -1
  73. package/dist/cjs/theme/PlasmaColors.js.map +1 -1
  74. package/dist/cjs/theme/Plasmantine.js.map +1 -1
  75. package/dist/cjs/theme/Theme.d.ts.map +1 -1
  76. package/dist/cjs/theme/Theme.js +28 -1
  77. package/dist/cjs/theme/Theme.js.map +1 -1
  78. package/dist/cjs/utils/createPolymorphicComponent.js.map +1 -1
  79. package/dist/cjs/utils/overrideComponent.js.map +1 -1
  80. package/dist/esm/components/button/Button.js +2 -2
  81. package/dist/esm/components/button/Button.js.map +1 -1
  82. package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
  83. package/dist/esm/components/code-editor/languages/xml.js.map +1 -1
  84. package/dist/esm/components/collection/Collection.js +13 -9
  85. package/dist/esm/components/collection/Collection.js.map +1 -1
  86. package/dist/esm/components/collection/Collection.styles.js.map +1 -1
  87. package/dist/esm/components/collection/CollectionItem.js.map +1 -1
  88. package/dist/esm/components/copyToClipboard/CopyToClipboard.js +4 -3
  89. package/dist/esm/components/copyToClipboard/CopyToClipboard.js.map +1 -1
  90. package/dist/esm/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
  91. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.js +2 -1
  92. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  93. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js +2 -1
  94. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  95. package/dist/esm/components/date-range-picker/EditableDateRangePicker.js +9 -6
  96. package/dist/esm/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  97. package/dist/esm/components/header/Header.js.map +1 -1
  98. package/dist/esm/components/inline-confirm/InlineConfirm.js.map +1 -1
  99. package/dist/esm/components/inline-confirm/InlineConfirmButton.js +2 -1
  100. package/dist/esm/components/inline-confirm/InlineConfirmButton.js.map +1 -1
  101. package/dist/esm/components/inline-confirm/InlineConfirmMenuItem.js +2 -1
  102. package/dist/esm/components/inline-confirm/InlineConfirmMenuItem.js.map +1 -1
  103. package/dist/esm/components/menu/Menu.js.map +1 -1
  104. package/dist/esm/components/modal-wizard/ModalWizard.js +16 -10
  105. package/dist/esm/components/modal-wizard/ModalWizard.js.map +1 -1
  106. package/dist/esm/components/modal-wizard/ModalWizardStep.js.map +1 -1
  107. package/dist/esm/components/prompt/Prompt.js.map +1 -1
  108. package/dist/esm/components/sticky-footer/StickyFooter.js.map +1 -1
  109. package/dist/esm/components/table/Table.js +10 -8
  110. package/dist/esm/components/table/Table.js.map +1 -1
  111. package/dist/esm/components/table/Table.styles.js.map +1 -1
  112. package/dist/esm/components/table/TableActions.js.map +1 -1
  113. package/dist/esm/components/table/TableCollapsibleColumn.js +2 -1
  114. package/dist/esm/components/table/TableCollapsibleColumn.js.map +1 -1
  115. package/dist/esm/components/table/TableDateRangePicker.js.map +1 -1
  116. package/dist/esm/components/table/TableFilter.js.map +1 -1
  117. package/dist/esm/components/table/TableHeader.js.map +1 -1
  118. package/dist/esm/components/table/TableLayoutControl.js.map +1 -1
  119. package/dist/esm/components/table/TableLoading.js.map +1 -1
  120. package/dist/esm/components/table/TablePagination.js.map +1 -1
  121. package/dist/esm/components/table/TablePerPage.js +2 -1
  122. package/dist/esm/components/table/TablePerPage.js.map +1 -1
  123. package/dist/esm/components/table/TablePredicate.d.ts.map +1 -1
  124. package/dist/esm/components/table/TablePredicate.js +1 -2
  125. package/dist/esm/components/table/TablePredicate.js.map +1 -1
  126. package/dist/esm/components/table/TableSelectableColumn.js.map +1 -1
  127. package/dist/esm/components/table/Th.js.map +1 -1
  128. package/dist/esm/components/table/layouts/RowLayout.js +4 -2
  129. package/dist/esm/components/table/layouts/RowLayout.js.map +1 -1
  130. package/dist/esm/components/table/useRowSelection.js +2 -1
  131. package/dist/esm/components/table/useRowSelection.js.map +1 -1
  132. package/dist/esm/form/FormProvider.js.map +1 -1
  133. package/dist/esm/form/useForm.js.map +1 -1
  134. package/dist/esm/hooks/useControlledList.js +6 -3
  135. package/dist/esm/hooks/useControlledList.js.map +1 -1
  136. package/dist/esm/hooks/useParentHeight.js.map +1 -1
  137. package/dist/esm/theme/PlasmaColors.js.map +1 -1
  138. package/dist/esm/theme/Theme.d.ts.map +1 -1
  139. package/dist/esm/theme/Theme.js +28 -1
  140. package/dist/esm/theme/Theme.js.map +1 -1
  141. package/dist/esm/utils/overrideComponent.js.map +1 -1
  142. package/package.json +19 -19
  143. package/src/components/table/TablePredicate.tsx +1 -2
  144. package/src/components/table/__tests__/TablePredicate.spec.tsx +10 -25
  145. package/src/theme/Theme.tsx +20 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/header/Header.tsx"],"sourcesContent":["import {QuestionSize16Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {Children, FunctionComponent, ReactElement, ReactNode} from 'react';\n\nexport interface HeaderProps extends DefaultProps {\n /**\n * The description text displayed inside the header underneath the title\n */\n description?: ReactNode;\n /**\n * Whether the header should have a border on the bottom\n */\n borderBottom?: boolean;\n /**\n * Use the modal variant when displaying the header inside a modal\n *\n * @default 'page'\n */\n variant?: 'page' | 'modal';\n /**\n * The title of the header.\n */\n children: ReactNode;\n}\n\ninterface HeaderType {\n (props: HeaderProps): ReactElement;\n Breadcrumbs: typeof HeaderBreadcrumbs;\n Actions: typeof HeaderActions;\n DocAnchor: typeof HeaderDocAnchor;\n}\n\nexport const Header: HeaderType = ({description, borderBottom, children, variant = 'page', ...others}) => {\n const convertedChildren = Children.toArray(children) as ReactElement[];\n const breadcrumbs = convertedChildren.find((child) => child.type === HeaderBreadcrumbs);\n const actions = convertedChildren.find((child) => child.type === HeaderActions);\n const docAnchor = convertedChildren.find((child) => child.type === HeaderDocAnchor);\n const otherChildren = convertedChildren.filter(\n (child) => child.type !== HeaderBreadcrumbs && child.type !== HeaderActions && child.type !== HeaderDocAnchor\n );\n return (\n <>\n <Group\n position=\"apart\"\n p={variant === 'page' ? 'xl' : undefined}\n pb={variant === 'page' ? 'lg' : undefined}\n {...others}\n >\n <Stack spacing={0}>\n {breadcrumbs}\n <Title\n order={variant === 'page' ? 1 : 3}\n color={variant === 'page' ? 'gray.5' : undefined}\n sx={{wordBreak: 'break-word'}}\n >\n {otherChildren}\n {docAnchor}\n </Title>\n <Text size={variant === 'page' ? 'md' : 'sm'} color=\"gray.6\">\n {description}\n </Text>\n </Stack>\n {actions}\n </Group>\n {borderBottom ? <Divider size=\"xs\" /> : null}\n </>\n );\n};\n\nconst HeaderBreadcrumbs: FunctionComponent<{children: ReactNode}> = ({children}) => (\n <Breadcrumbs\n styles={(theme) => ({\n breadcrumb: {fontSize: theme.fontSizes.sm, fontWeight: 300},\n separator: {color: theme.colors.gray[5]},\n })}\n >\n {children}\n </Breadcrumbs>\n);\n\nconst HeaderActions: FunctionComponent<{children: ReactNode}> = ({children}) => <Group spacing=\"sm\">{children}</Group>;\n\nexport interface HeaderDocAnchorProps {\n /**\n * A href pointing to documentation related to the current panel.\n * When provided, an info icon is rendered next to the title as link to this documentation\n */\n href: string;\n /**\n * The tooltip text shown when hovering over the doc link icon\n */\n label?: string;\n}\n\nconst HeaderDocAnchor: FunctionComponent<HeaderDocAnchorProps> = ({href: docLink, label: docLinkTooltipLabel}) => (\n <Tooltip label={docLinkTooltipLabel} disabled={!docLinkTooltipLabel} position=\"right\">\n <Anchor inline href={docLink} target=\"_blank\" ml=\"xs\" style={{verticalAlign: 'middle'}}>\n <QuestionSize16Px height={16} />\n </Anchor>\n </Tooltip>\n);\n\nHeader.Breadcrumbs = HeaderBreadcrumbs;\nHeader.Actions = HeaderActions;\nHeader.DocAnchor = HeaderDocAnchor;\n"],"names":["Header","description","borderBottom","children","variant","others","convertedChildren","Children","toArray","breadcrumbs","find","child","type","HeaderBreadcrumbs","actions","HeaderActions","docAnchor","HeaderDocAnchor","otherChildren","filter","Group","position","p","undefined","pb","Stack","spacing","Title","order","color","sx","wordBreak","Text","size","Divider","Breadcrumbs","styles","theme","breadcrumb","fontSize","fontSizes","sm","fontWeight","separator","colors","gray","href","docLink","label","docLinkTooltipLabel","Tooltip","disabled","Anchor","inline","target","ml","style","verticalAlign","QuestionSize16Px","height","Actions","DocAnchor"],"mappings":";;;;+BAgCaA;;;eAAAA;;;;;;;gCAhCkB;oBAC8D;qBAC1B;AA8B5D,IAAMA,SAAqB;QAAEC,qBAAAA,aAAaC,sBAAAA,cAAcC,kBAAAA,kCAAUC,SAAAA,sCAAU,yBAAWC;QAA1DJ;QAAaC;QAAcC;QAAUC;;IACrE,IAAME,oBAAoBC,gBAASC,QAAQL;IAC3C,IAAMM,cAAcH,kBAAkBI,KAAK,SAACC;eAAUA,MAAMC,SAASC;;IACrE,IAAMC,UAAUR,kBAAkBI,KAAK,SAACC;eAAUA,MAAMC,SAASG;;IACjE,IAAMC,YAAYV,kBAAkBI,KAAK,SAACC;eAAUA,MAAMC,SAASK;;IACnE,IAAMC,gBAAgBZ,kBAAkBa,OACpC,SAACR;eAAUA,MAAMC,SAASC,qBAAqBF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ize16Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {Children, FunctionComponent, ReactElement, ReactNode} from 'react';\n\nexport interface HeaderProps extends DefaultProps {\n /**\n * The description text displayed inside the header underneath the title\n */\n description?: ReactNode;\n /**\n * Whether the header should have a border on the bottom\n */\n borderBottom?: boolean;\n /**\n * Use the modal variant when displaying the header inside a modal\n *\n * @default 'page'\n */\n variant?: 'page' | 'modal';\n /**\n * The title of the header.\n */\n children: ReactNode;\n}\n\ninterface HeaderType {\n (props: HeaderProps): ReactElement;\n Breadcrumbs: typeof HeaderBreadcrumbs;\n Actions: typeof HeaderActions;\n DocAnchor: typeof HeaderDocAnchor;\n}\n\nexport const Header: HeaderType = ({description, borderBottom, children, variant = 'page', ...others}) => {\n const convertedChildren = Children.toArray(children) as ReactElement[];\n const breadcrumbs = convertedChildren.find((child) => child.type === HeaderBreadcrumbs);\n const actions = convertedChildren.find((child) => child.type === HeaderActions);\n const docAnchor = convertedChildren.find((child) => child.type === HeaderDocAnchor);\n const otherChildren = convertedChildren.filter(\n (child) => child.type !== HeaderBreadcrumbs && child.type !== HeaderActions && child.type !== HeaderDocAnchor\n );\n return (\n <>\n <Group\n position=\"apart\"\n p={variant === 'page' ? 'xl' : undefined}\n pb={variant === 'page' ? 'lg' : undefined}\n {...others}\n >\n <Stack spacing={0}>\n {breadcrumbs}\n <Title\n order={variant === 'page' ? 1 : 3}\n color={variant === 'page' ? 'gray.5' : undefined}\n sx={{wordBreak: 'break-word'}}\n >\n {otherChildren}\n {docAnchor}\n </Title>\n <Text size={variant === 'page' ? 'md' : 'sm'} color=\"gray.6\">\n {description}\n </Text>\n </Stack>\n {actions}\n </Group>\n {borderBottom ? <Divider size=\"xs\" /> : null}\n </>\n );\n};\n\nconst HeaderBreadcrumbs: FunctionComponent<{children: ReactNode}> = ({children}) => (\n <Breadcrumbs\n styles={(theme) => ({\n breadcrumb: {fontSize: theme.fontSizes.sm, fontWeight: 300},\n separator: {color: theme.colors.gray[5]},\n })}\n >\n {children}\n </Breadcrumbs>\n);\n\nconst HeaderActions: FunctionComponent<{children: ReactNode}> = ({children}) => <Group spacing=\"sm\">{children}</Group>;\n\nexport interface HeaderDocAnchorProps {\n /**\n * A href pointing to documentation related to the current panel.\n * When provided, an info icon is rendered next to the title as link to this documentation\n */\n href: string;\n /**\n * The tooltip text shown when hovering over the doc link icon\n */\n label?: string;\n}\n\nconst HeaderDocAnchor: FunctionComponent<HeaderDocAnchorProps> = ({href: docLink, label: docLinkTooltipLabel}) => (\n <Tooltip label={docLinkTooltipLabel} disabled={!docLinkTooltipLabel} position=\"right\">\n <Anchor inline href={docLink} target=\"_blank\" ml=\"xs\" style={{verticalAlign: 'middle'}}>\n <QuestionSize16Px height={16} />\n </Anchor>\n </Tooltip>\n);\n\nHeader.Breadcrumbs = HeaderBreadcrumbs;\nHeader.Actions = HeaderActions;\nHeader.DocAnchor = HeaderDocAnchor;\n"],"names":["Header","description","borderBottom","children","variant","others","convertedChildren","Children","toArray","breadcrumbs","find","child","type","HeaderBreadcrumbs","actions","HeaderActions","docAnchor","HeaderDocAnchor","otherChildren","filter","Group","position","p","undefined","pb","Stack","spacing","Title","order","color","sx","wordBreak","Text","size","Divider","Breadcrumbs","styles","theme","breadcrumb","fontSize","fontSizes","sm","fontWeight","separator","colors","gray","href","docLink","label","docLinkTooltipLabel","Tooltip","disabled","Anchor","inline","target","ml","style","verticalAlign","QuestionSize16Px","height","Actions","DocAnchor"],"mappings":";;;;+BAgCaA;;;eAAAA;;;;;;;gCAhCkB;oBAC8D;qBAC1B;AA8B5D,IAAMA,SAAqB;QAAEC,qBAAAA,aAAaC,sBAAAA,cAAcC,kBAAAA,kCAAUC,SAAAA,sCAAU,yBAAWC;QAA1DJ;QAAaC;QAAcC;QAAUC;;IACrE,IAAME,oBAAoBC,eAAQ,CAACC,OAAO,CAACL;IAC3C,IAAMM,cAAcH,kBAAkBI,I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BAAPD;yBAC9E,qBAACE,aAAO;QAACF,OAAOC;QAAqBE,UAAU,CAACF;QAAqB5B,UAAS;kBAC1E,cAAA,qBAAC+B,YAAM;YAACC,MAAM;YAACP,MAAMC;YAASO,QAAO;YAASC,IAAG;YAAKC,OAAO;gBAACC,eAAe;YAAQ;sBACjF,cAAA,qBAACC,kCAAgB;gBAACC,QAAQ;;;;;AAKtC3D,OAAOmC,WAAW,GAAGtB;AACrBb,OAAO4D,OAAO,GAAG7C;AACjBf,OAAO6D,SAAS,GAAG5C"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirm.tsx"],"sourcesContent":["import {Children, FunctionComponent, PropsWithChildren, ReactElement, useState} from 'react';\n\nimport {InlineConfirmButton} from './InlineConfirmButton';\nimport {InlineConfirmContext} from './InlineConfirmContext';\nimport {InlineConfirmMenuItem} from './InlineConfirmMenuItem';\nimport {InlineConfirmPrompt} from './InlineConfirmPrompt';\n\ntype InlineConfirmType = FunctionComponent<PropsWithChildren> & {\n Prompt: typeof InlineConfirmPrompt;\n Button: typeof InlineConfirmButton;\n MenuItem: typeof InlineConfirmMenuItem;\n};\n\nexport const InlineConfirm: InlineConfirmType = ({children}) => {\n const [confirmingId, setConfirmingId] = useState<string | null>(null);\n\n const convertedChildren = Children.toArray(children) as ReactElement[];\n const prompt = convertedChildren.find(\n (child) => child.type === InlineConfirmPrompt && child.props.id === confirmingId\n );\n const clearConfirm = () => setConfirmingId(null);\n\n return (\n <InlineConfirmContext.Provider value={{confirmingId, setConfirmingId, clearConfirm}}>\n {prompt ?? children}\n </InlineConfirmContext.Provider>\n );\n};\n\nInlineConfirm.Prompt = InlineConfirmPrompt;\nInlineConfirm.Button = InlineConfirmButton;\nInlineConfirm.MenuItem = InlineConfirmMenuItem;\n"],"names":["InlineConfirm","children","useState","confirmingId","setConfirmingId","convertedChildren","Children","toArray","prompt","find","child","type","InlineConfirmPrompt","props","id","clearConfirm","InlineConfirmContext","Provider","value","Prompt","Button","InlineConfirmButton","MenuItem","InlineConfirmMenuItem"],"mappings":";;;;+BAaaA;;;eAAAA;;;;;qBAbwE;mCAEnD;oCACC;qCACC;mCACF;AAQ3B,IAAMA,gBAAmC;QAAEC,iBAAAA;IAC9C,IAAwCC,+BAAAA,IAAAA,iBAAwB,WAAzDC,eAAiCD,cAAnBE,kBAAmBF;IAExC,IAAMG,oBAAoBC,gBAASC,QAAQN;IAC3C,IAAMO,SAASH,kBAAkBI,KAC7B,SAACC;eAAUA,MAAMC,SAASC,4CAAuBF,MAAMG,MAAMC,OAAOX;;IAExE,IAAMY,eAAe;eAAMX,gBAAgB;;IAE3C,qBACI,qBAACY,2CAAqBC;QAASC,OAAO;YAACf,cAAAA;YAAcC,iBAAAA;YAAiBW,cAAAA;QAAY;kBAC7EP,mBAAAA,oBAAAA,SAAUP;;AAGvB;AAEAD,cAAcmB,SAASP;AACvBZ,cAAcoB,SAASC;AACvBrB,cAAcsB,WAAWC"}
1
+ {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirm.tsx"],"sourcesContent":["import {Children, FunctionComponent, PropsWithChildren, ReactElement, useState} from 'react';\n\nimport {InlineConfirmButton} from './InlineConfirmButton';\nimport {InlineConfirmContext} from './InlineConfirmContext';\nimport {InlineConfirmMenuItem} from './InlineConfirmMenuItem';\nimport {InlineConfirmPrompt} from './InlineConfirmPrompt';\n\ntype InlineConfirmType = FunctionComponent<PropsWithChildren> & {\n Prompt: typeof InlineConfirmPrompt;\n Button: typeof InlineConfirmButton;\n MenuItem: typeof InlineConfirmMenuItem;\n};\n\nexport const InlineConfirm: InlineConfirmType = ({children}) => {\n const [confirmingId, setConfirmingId] = useState<string | null>(null);\n\n const convertedChildren = Children.toArray(children) as ReactElement[];\n const prompt = convertedChildren.find(\n (child) => child.type === InlineConfirmPrompt && child.props.id === confirmingId\n );\n const clearConfirm = () => setConfirmingId(null);\n\n return (\n <InlineConfirmContext.Provider value={{confirmingId, setConfirmingId, clearConfirm}}>\n {prompt ?? children}\n </InlineConfirmContext.Provider>\n );\n};\n\nInlineConfirm.Prompt = InlineConfirmPrompt;\nInlineConfirm.Button = InlineConfirmButton;\nInlineConfirm.MenuItem = InlineConfirmMenuItem;\n"],"names":["InlineConfirm","children","useState","confirmingId","setConfirmingId","convertedChildren","Children","toArray","prompt","find","child","type","InlineConfirmPrompt","props","id","clearConfirm","InlineConfirmContext","Provider","value","Prompt","Button","InlineConfirmButton","MenuItem","InlineConfirmMenuItem"],"mappings":";;;;+BAaaA;;;eAAAA;;;;;qBAbwE;mCAEnD;oCACC;qCACC;mCACF;AAQ3B,IAAMA,gBAAmC;QAAEC,iBAAAA;IAC9C,IAAwCC,+BAAAA,IAAAA,eAAQ,EAAgB,WAAzDC,eAAiCD,cAAnBE,kBAAmBF;IAExC,IAAMG,oBAAoBC,eAAQ,CAACC,OAAO,CAACN;IAC3C,IAAMO,SAASH,kBAAkBI,IAAI,CACjC,SAACC;eAAUA,MAAMC,IAAI,KAAKC,wCAAmB,IAAIF,MAAMG,KAAK,CAACC,EAAE,KAAKX;;IAExE,IAAMY,eAAe;eAAMX,gBAAgB;;IAE3C,qBACI,qBAACY,0CAAoB,CAACC,QAAQ;QAACC,OAAO;YAACf,cAAAA;YAAcC,iBAAAA;YAAiBW,cAAAA;QAAY;kBAC7EP,mBAAAA,oBAAAA,SAAUP;;AAGvB;AAEAD,cAAcmB,MAAM,GAAGP,wCAAmB;AAC1CZ,cAAcoB,MAAM,GAAGC,wCAAmB;AAC1CrB,cAAcsB,QAAQ,GAAGC,4CAAqB"}
@@ -21,8 +21,9 @@ var InlineConfirmButton = /*#__PURE__*/ (0, _react.forwardRef)(function(_param,
21
21
  ]);
22
22
  var setConfirmingId = (0, _useInlineConfirm.useInlineConfirm)().setConfirmingId;
23
23
  var handleOnClick = function(e) {
24
+ var _onClick;
24
25
  setConfirmingId(id);
25
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
26
+ (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(e);
26
27
  };
27
28
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.Button, _object_spread._({
28
29
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmButton.tsx"],"sourcesContent":["import {Button} from '@mantine/core';\nimport {forwardRef, MouseEventHandler} from 'react';\n\nimport {ButtonProps} from '../button';\nimport {useInlineConfirm} from './useInlineConfirm';\n\nexport interface InlineConfirmButtonProps extends ButtonProps {\n id: string;\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const InlineConfirmButton = forwardRef<HTMLButtonElement, InlineConfirmButtonProps>(\n ({onClick, id, ...others}, ref) => {\n const {setConfirmingId} = useInlineConfirm();\n const handleOnClick: MouseEventHandler<HTMLButtonElement> = (e) => {\n setConfirmingId(id);\n onClick?.(e);\n };\n\n return <Button ref={ref} onClick={handleOnClick} {...others} />;\n }\n);\n"],"names":["InlineConfirmButton","forwardRef","ref","onClick","id","others","setConfirmingId","useInlineConfirm","handleOnClick","e","Button"],"mappings":";;;;+BAWaA;;;eAAAA;;;;;;oBAXQ;qBACuB;gCAGb;AAOxB,IAAMA,oCAAsBC,IAAAA,mBAC/B,iBAA2BC;QAAzBC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBC,IAAAA,sCAAnBD;IACP,IAAME,gBAAsD,SAACC;QACzDH,gBAAgBF;QAChBD,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUM;IACd;IAEA,qBAAO,qBAACC;QAAOR,KAAKA;QAAKC,SAASK;OAAmBH;AACzD"}
1
+ {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmButton.tsx"],"sourcesContent":["import {Button} from '@mantine/core';\nimport {forwardRef, MouseEventHandler} from 'react';\n\nimport {ButtonProps} from '../button';\nimport {useInlineConfirm} from './useInlineConfirm';\n\nexport interface InlineConfirmButtonProps extends ButtonProps {\n id: string;\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const InlineConfirmButton = forwardRef<HTMLButtonElement, InlineConfirmButtonProps>(\n ({onClick, id, ...others}, ref) => {\n const {setConfirmingId} = useInlineConfirm();\n const handleOnClick: MouseEventHandler<HTMLButtonElement> = (e) => {\n setConfirmingId(id);\n onClick?.(e);\n };\n\n return <Button ref={ref} onClick={handleOnClick} {...others} />;\n }\n);\n"],"names":["InlineConfirmButton","forwardRef","ref","onClick","id","others","setConfirmingId","useInlineConfirm","handleOnClick","e","Button"],"mappings":";;;;+BAWaA;;;eAAAA;;;;;;oBAXQ;qBACuB;gCAGb;AAOxB,IAAMA,oCAAsBC,IAAAA,iBAAU,EACzC,iBAA2BC;QAAzBC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBC,IAAAA,kCAAgB,IAAnCD;IACP,IAAME,gBAAsD,SAACC;YAEzDN;QADAG,gBAAgBF;SAChBD,WAAAA,qBAAAA,+BAAAA,SAAUM;IACd;IAEA,qBAAO,qBAACC,YAAM;QAACR,KAAKA;QAAKC,SAASK;OAAmBH;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmContext.ts"],"sourcesContent":["import {createContext} from 'react';\n\ntype InlineConfirmContextType = {\n confirmingId: string;\n setConfirmingId: (id: string) => void;\n clearConfirm: () => void;\n};\n\nexport const InlineConfirmContext = createContext<InlineConfirmContextType | null>(null);\n"],"names":["InlineConfirmContext","createContext"],"mappings":";;;;+BAQaA;;;eAAAA;;;qBARe;AAQrB,IAAMA,uBAAuBC,IAAAA,sBAA+C"}
1
+ {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmContext.ts"],"sourcesContent":["import {createContext} from 'react';\n\ntype InlineConfirmContextType = {\n confirmingId: string;\n setConfirmingId: (id: string) => void;\n clearConfirm: () => void;\n};\n\nexport const InlineConfirmContext = createContext<InlineConfirmContextType | null>(null);\n"],"names":["InlineConfirmContext","createContext"],"mappings":";;;;+BAQaA;;;eAAAA;;;qBARe;AAQrB,IAAMA,uBAAuBC,IAAAA,oBAAa,EAAkC"}
@@ -21,8 +21,9 @@ var InlineConfirmMenuItem = /*#__PURE__*/ (0, _react.forwardRef)(function(_param
21
21
  ]);
22
22
  var setConfirmingId = (0, _useInlineConfirm.useInlineConfirm)().setConfirmingId;
23
23
  var handleOnClick = function(e) {
24
+ var _onClick;
24
25
  setConfirmingId(id);
25
- onClick === null || onClick === void 0 ? void 0 : onClick(e);
26
+ (_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(e);
26
27
  };
27
28
  return /*#__PURE__*/ (0, _jsxruntime.jsx)(_menu.Menu.Item, _object_spread._({
28
29
  ref: ref,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmMenuItem.tsx"],"sourcesContent":["import {forwardRef, MouseEventHandler} from 'react';\n\nimport {Menu, MenuItemProps} from '../menu';\nimport {useInlineConfirm} from './useInlineConfirm';\n\nexport interface InlineConfirmMenuItemProps extends MenuItemProps {\n id: string;\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const InlineConfirmMenuItem = forwardRef<HTMLButtonElement, InlineConfirmMenuItemProps>(\n ({onClick, id, ...others}, ref) => {\n const {setConfirmingId} = useInlineConfirm();\n const handleOnClick: MouseEventHandler<HTMLButtonElement> = (e) => {\n setConfirmingId(id);\n onClick?.(e);\n };\n\n return <Menu.Item ref={ref} onClick={handleOnClick} {...others} />;\n }\n);\n"],"names":["InlineConfirmMenuItem","forwardRef","ref","onClick","id","others","setConfirmingId","useInlineConfirm","handleOnClick","e","Menu","Item"],"mappings":";;;;+BAUaA;;;eAAAA;;;;;;qBAV+B;oBAEV;gCACH;AAOxB,IAAMA,sCAAwBC,IAAAA,mBACjC,iBAA2BC;QAAzBC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBC,IAAAA,sCAAnBD;IACP,IAAME,gBAAsD,SAACC;QACzDH,gBAAgBF;QAChBD,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUM;IACd;IAEA,qBAAO,qBAACC,WAAKC;QAAKT,KAAKA;QAAKC,SAASK;OAAmBH;AAC5D"}
1
+ {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmMenuItem.tsx"],"sourcesContent":["import {forwardRef, MouseEventHandler} from 'react';\n\nimport {Menu, MenuItemProps} from '../menu';\nimport {useInlineConfirm} from './useInlineConfirm';\n\nexport interface InlineConfirmMenuItemProps extends MenuItemProps {\n id: string;\n onClick?: MouseEventHandler<HTMLButtonElement>;\n}\n\nexport const InlineConfirmMenuItem = forwardRef<HTMLButtonElement, InlineConfirmMenuItemProps>(\n ({onClick, id, ...others}, ref) => {\n const {setConfirmingId} = useInlineConfirm();\n const handleOnClick: MouseEventHandler<HTMLButtonElement> = (e) => {\n setConfirmingId(id);\n onClick?.(e);\n };\n\n return <Menu.Item ref={ref} onClick={handleOnClick} {...others} />;\n }\n);\n"],"names":["InlineConfirmMenuItem","forwardRef","ref","onClick","id","others","setConfirmingId","useInlineConfirm","handleOnClick","e","Menu","Item"],"mappings":";;;;+BAUaA;;;eAAAA;;;;;;qBAV+B;oBAEV;gCACH;AAOxB,IAAMA,sCAAwBC,IAAAA,iBAAU,EAC3C,iBAA2BC;QAAzBC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBC,IAAAA,kCAAgB,IAAnCD;IACP,IAAME,gBAAsD,SAACC;YAEzDN;QADAG,gBAAgBF;SAChBD,WAAAA,qBAAAA,+BAAAA,SAAUM;IACd;IAEA,qBAAO,qBAACC,UAAI,CAACC,IAAI;QAACT,KAAKA;QAAKC,SAASK;OAAmBH;AAC5D"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmPrompt.tsx"],"sourcesContent":["import {Group} from '@mantine/core';\nimport {FunctionComponent, ReactNode, useEffect} from 'react';\n\nimport {Button} from '../button';\nimport {useInlineConfirm} from './useInlineConfirm';\n\ninterface InlineConfirmPromptProps {\n id: string;\n label: ReactNode;\n onConfirm: () => void;\n confirmLabel?: ReactNode;\n cancelLabel?: ReactNode;\n}\n\nexport const InlineConfirmPrompt: FunctionComponent<InlineConfirmPromptProps> = ({\n id,\n label,\n confirmLabel = 'Delete',\n cancelLabel = 'Cancel',\n onConfirm,\n}) => {\n const {confirmingId, clearConfirm} = useInlineConfirm();\n\n const onClickConfirm = () => {\n onConfirm();\n clearConfirm();\n };\n\n useEffect(() => {\n if (confirmingId !== id) {\n clearConfirm();\n }\n }, []);\n\n if (confirmingId === id) {\n return (\n <Group spacing=\"xs\">\n {label}\n <Button onClick={onClickConfirm} color=\"red\">\n {confirmLabel}\n </Button>\n <Button onClick={clearConfirm} variant=\"outline\">\n {cancelLabel}\n </Button>\n </Group>\n );\n }\n return null;\n};\n"],"names":["InlineConfirmPrompt","id","label","confirmLabel","cancelLabel","onConfirm","useInlineConfirm","confirmingId","clearConfirm","onClickConfirm","useEffect","Group","spacing","Button","onClick","color","variant"],"mappings":";;;;+BAcaA;;;eAAAA;;;;oBAdO;qBACkC;sBAEjC;gCACU;AAUxB,IAAMA,sBAAmE;QAC5EC,WAAAA,IACAC,cAAAA,mCACAC,cAAAA,gDAAe,2DACfC,aAAAA,8CAAc,+BACdC,kBAAAA;IAEA,IAAqCC,qBAAAA,IAAAA,uCAA9BC,eAA8BD,mBAA9BC,cAAcC,eAAgBF,mBAAhBE;IAErB,IAAMC,iBAAiB;QACnBJ;QACAG;IACJ;IAEAE,IAAAA,kBAAU;QACN,IAAIH,iBAAiBN,IAAI;YACrBO;QACJ;IACJ,GAAG,EAAE;IAEL,IAAID,iBAAiBN,IAAI;QACrB,qBACI,sBAACU;YAAMC,SAAQ;;gBACVV;8BACD,qBAACW;oBAAOC,SAASL;oBAAgBM,OAAM;8BAClCZ;;8BAEL,qBAACU;oBAAOC,SAASN;oBAAcQ,SAAQ;8BAClCZ;;;;IAIjB;IACA,OAAO;AACX"}
1
+ {"version":3,"sources":["../../../../src/components/inline-confirm/InlineConfirmPrompt.tsx"],"sourcesContent":["import {Group} from '@mantine/core';\nimport {FunctionComponent, ReactNode, useEffect} from 'react';\n\nimport {Button} from '../button';\nimport {useInlineConfirm} from './useInlineConfirm';\n\ninterface InlineConfirmPromptProps {\n id: string;\n label: ReactNode;\n onConfirm: () => void;\n confirmLabel?: ReactNode;\n cancelLabel?: ReactNode;\n}\n\nexport const InlineConfirmPrompt: FunctionComponent<InlineConfirmPromptProps> = ({\n id,\n label,\n confirmLabel = 'Delete',\n cancelLabel = 'Cancel',\n onConfirm,\n}) => {\n const {confirmingId, clearConfirm} = useInlineConfirm();\n\n const onClickConfirm = () => {\n onConfirm();\n clearConfirm();\n };\n\n useEffect(() => {\n if (confirmingId !== id) {\n clearConfirm();\n }\n }, []);\n\n if (confirmingId === id) {\n return (\n <Group spacing=\"xs\">\n {label}\n <Button onClick={onClickConfirm} color=\"red\">\n {confirmLabel}\n </Button>\n <Button onClick={clearConfirm} variant=\"outline\">\n {cancelLabel}\n </Button>\n </Group>\n );\n }\n return null;\n};\n"],"names":["InlineConfirmPrompt","id","label","confirmLabel","cancelLabel","onConfirm","useInlineConfirm","confirmingId","clearConfirm","onClickConfirm","useEffect","Group","spacing","Button","onClick","color","variant"],"mappings":";;;;+BAcaA;;;eAAAA;;;;oBAdO;qBACkC;sBAEjC;gCACU;AAUxB,IAAMA,sBAAmE;QAC5EC,WAAAA,IACAC,cAAAA,mCACAC,cAAAA,gDAAe,2DACfC,aAAAA,8CAAc,+BACdC,kBAAAA;IAEA,IAAqCC,qBAAAA,IAAAA,kCAAgB,KAA9CC,eAA8BD,mBAA9BC,cAAcC,eAAgBF,mBAAhBE;IAErB,IAAMC,iBAAiB;QACnBJ;QACAG;IACJ;IAEAE,IAAAA,gBAAS,EAAC;QACN,IAAIH,iBAAiBN,IAAI;YACrBO;QACJ;IACJ,GAAG,EAAE;IAEL,IAAID,iBAAiBN,IAAI;QACrB,qBACI,sBAACU,WAAK;YAACC,SAAQ;;gBACVV;8BACD,qBAACW,cAAM;oBAACC,SAASL;oBAAgBM,OAAM;8BAClCZ;;8BAEL,qBAACU,cAAM;oBAACC,SAASN;oBAAcQ,SAAQ;8BAClCZ;;;;IAIjB;IACA,OAAO;AACX"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/inline-confirm/useInlineConfirm.ts"],"sourcesContent":["import {useContext} from 'react';\nimport {InlineConfirmContext} from './InlineConfirmContext';\n\nexport const useInlineConfirm = () => {\n const ctx = useContext(InlineConfirmContext);\n\n if (ctx === null) {\n throw new Error('useConfirm must be used inside of a InlineConfirmContext.Provider');\n }\n\n return ctx;\n};\n"],"names":["useInlineConfirm","ctx","useContext","InlineConfirmContext","Error"],"mappings":";;;;+BAGaA;;;eAAAA;;;qBAHY;oCACU;AAE5B,IAAMA,mBAAmB;IAC5B,IAAMC,MAAMC,IAAAA,mBAAWC;IAEvB,IAAIF,QAAQ,MAAM;QACd,MAAM,IAAIG,MAAM;IACpB;IAEA,OAAOH;AACX"}
1
+ {"version":3,"sources":["../../../../src/components/inline-confirm/useInlineConfirm.ts"],"sourcesContent":["import {useContext} from 'react';\nimport {InlineConfirmContext} from './InlineConfirmContext';\n\nexport const useInlineConfirm = () => {\n const ctx = useContext(InlineConfirmContext);\n\n if (ctx === null) {\n throw new Error('useConfirm must be used inside of a InlineConfirmContext.Provider');\n }\n\n return ctx;\n};\n"],"names":["useInlineConfirm","ctx","useContext","InlineConfirmContext","Error"],"mappings":";;;;+BAGaA;;;eAAAA;;;qBAHY;oCACU;AAE5B,IAAMA,mBAAmB;IAC5B,IAAMC,MAAMC,IAAAA,iBAAU,EAACC,0CAAoB;IAE3C,IAAIF,QAAQ,MAAM;QACd,MAAM,IAAIG,MAAM;IACpB;IAEA,OAAOH;AACX"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/menu/Menu.tsx"],"sourcesContent":["import {Menu as MantineMenu, MenuItemProps as MantineMenuItemProps} from '@mantine/core';\nimport {forwardRef} from 'react';\n\nimport {createPolymorphicComponent, overrideComponent} from '../../utils';\nimport {ButtonWithDisabledTooltipProps} from '../button';\nimport {ButtonWithDisabledTooltip} from '../button/ButtonWithDisabledTooltip';\n\nexport interface MenuItemProps extends MantineMenuItemProps, ButtonWithDisabledTooltipProps {}\n\nconst _MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(\n ({disabledTooltip, disabled, disabledTooltipProps, ...others}, ref) => (\n <ButtonWithDisabledTooltip\n disabled={disabled}\n disabledTooltip={disabledTooltip}\n disabledTooltipProps={disabledTooltipProps}\n >\n <MantineMenu.Item ref={ref} disabled={disabled} {...others} />\n </ButtonWithDisabledTooltip>\n )\n);\n\nconst MenuItem = createPolymorphicComponent<'button', MenuItemProps>(_MenuItem);\n\nexport const Menu = overrideComponent(MantineMenu, {\n displayName: '@coveord/plasma-mantine/Menu',\n Item: MenuItem,\n});\n"],"names":["Menu","_MenuItem","forwardRef","ref","disabledTooltip","disabled","disabledTooltipProps","others","ButtonWithDisabledTooltip","MantineMenu","Item","MenuItem","createPolymorphicComponent","overrideComponent","displayName"],"mappings":";;;;+BAuBaA;;;eAAAA;;;;;;oBAvB4D;qBAChD;qBAEmC;yCAEpB;AAIxC,IAAMC,0BAAYC,IAAAA,mBACd,iBAA+DC;QAA7DC,yBAAAA,iBAAiBC,kBAAAA,UAAUC,8BAAAA,sBAAyBC;QAApDH;QAAiBC;QAAUC;;WACzB,qBAACE;QACGH,UAAUA;QACVD,iBAAiBA;QACjBE,sBAAsBA;kBAEtB,cAAA,qBAACG,WAAYC;YAAKP,KAAKA;YAAKE,UAAUA;WAAcE;;AAC7B;AAInC,IAAMI,WAAWC,IAAAA,mCAAoDX;AAE9D,IAAMD,OAAOa,IAAAA,0BAAkBJ,YAAa;IAC/CK,aAAa;IACbJ,MAAMC;AACV"}
1
+ {"version":3,"sources":["../../../../src/components/menu/Menu.tsx"],"sourcesContent":["import {Menu as MantineMenu, MenuItemProps as MantineMenuItemProps} from '@mantine/core';\nimport {forwardRef} from 'react';\n\nimport {createPolymorphicComponent, overrideComponent} from '../../utils';\nimport {ButtonWithDisabledTooltipProps} from '../button';\nimport {ButtonWithDisabledTooltip} from '../button/ButtonWithDisabledTooltip';\n\nexport interface MenuItemProps extends MantineMenuItemProps, ButtonWithDisabledTooltipProps {}\n\nconst _MenuItem = forwardRef<HTMLButtonElement, MenuItemProps>(\n ({disabledTooltip, disabled, disabledTooltipProps, ...others}, ref) => (\n <ButtonWithDisabledTooltip\n disabled={disabled}\n disabledTooltip={disabledTooltip}\n disabledTooltipProps={disabledTooltipProps}\n >\n <MantineMenu.Item ref={ref} disabled={disabled} {...others} />\n </ButtonWithDisabledTooltip>\n )\n);\n\nconst MenuItem = createPolymorphicComponent<'button', MenuItemProps>(_MenuItem);\n\nexport const Menu = overrideComponent(MantineMenu, {\n displayName: '@coveord/plasma-mantine/Menu',\n Item: MenuItem,\n});\n"],"names":["Menu","_MenuItem","forwardRef","ref","disabledTooltip","disabled","disabledTooltipProps","others","ButtonWithDisabledTooltip","MantineMenu","Item","MenuItem","createPolymorphicComponent","overrideComponent","displayName"],"mappings":";;;;+BAuBaA;;;eAAAA;;;;;;oBAvB4D;qBAChD;qBAEmC;yCAEpB;AAIxC,IAAMC,0BAAYC,IAAAA,iBAAU,EACxB,iBAA+DC;QAA7DC,yBAAAA,iBAAiBC,kBAAAA,UAAUC,8BAAAA,sBAAyBC;QAApDH;QAAiBC;QAAUC;;WACzB,qBAACE,oDAAyB;QACtBH,UAAUA;QACVD,iBAAiBA;QACjBE,sBAAsBA;kBAEtB,cAAA,qBAACG,UAAW,CAACC,IAAI;YAACP,KAAKA;YAAKE,UAAUA;WAAcE;;AAC7B;AAInC,IAAMI,WAAWC,IAAAA,iCAA0B,EAA0BX;AAE9D,IAAMD,OAAOa,IAAAA,wBAAiB,EAACJ,UAAW,EAAE;IAC/CK,aAAa;IACbJ,MAAMC;AACV"}
@@ -51,7 +51,7 @@ var ModalWizard = function(_param) {
51
51
  "children",
52
52
  "isStepValidatedOnNext"
53
53
  ]);
54
- var _currentStep_props, _currentStep_props_validateStep;
54
+ var _currentStep_props_validateStep, _object, _currentStep, _classNames, _classNames1;
55
55
  var _useStyles = useStyles(null, {
56
56
  name: "ModalWizard",
57
57
  classNames: classNames,
@@ -71,7 +71,7 @@ var ModalWizard = function(_param) {
71
71
  var _currentStep_props_validateStep1;
72
72
  var isValid = (isStepValidatedOnNext ? {
73
73
  isValid: true
74
- } : (_currentStep_props_validateStep1 = currentStep === null || currentStep === void 0 ? void 0 : (_currentStep_props = currentStep.props) === null || _currentStep_props === void 0 ? void 0 : (_currentStep_props_validateStep = _currentStep_props.validateStep) === null || _currentStep_props_validateStep === void 0 ? void 0 : _currentStep_props_validateStep.call(_currentStep_props, currentStepIndex, numberOfSteps)) !== null && _currentStep_props_validateStep1 !== void 0 ? _currentStep_props_validateStep1 : {
74
+ } : (_currentStep_props_validateStep1 = (_object = (_currentStep = currentStep) === null || _currentStep === void 0 ? void 0 : _currentStep.props) === null || _object === void 0 ? void 0 : (_currentStep_props_validateStep = _object.validateStep) === null || _currentStep_props_validateStep === void 0 ? void 0 : _currentStep_props_validateStep.call(_object, currentStepIndex, numberOfSteps)) !== null && _currentStep_props_validateStep1 !== void 0 ? _currentStep_props_validateStep1 : {
75
75
  isValid: true
76
76
  }).isValid;
77
77
  (0, _react.useEffect)(function() {
@@ -82,18 +82,21 @@ var ModalWizard = function(_param) {
82
82
  opened
83
83
  ]);
84
84
  var handleClose = function(confirmDirty) {
85
+ var _onClose;
85
86
  if (confirmDirty) {
86
87
  var _isDirty;
87
- var isModalDirty = (_isDirty = isDirty === null || isDirty === void 0 ? void 0 : isDirty()) !== null && _isDirty !== void 0 ? _isDirty : false;
88
+ var _isDirty1;
89
+ var isModalDirty = (_isDirty1 = (_isDirty = isDirty) === null || _isDirty === void 0 ? void 0 : _isDirty()) !== null && _isDirty1 !== void 0 ? _isDirty1 : false;
88
90
  if (isModalDirty) {
89
91
  var _handleDirtyState;
90
- var discardChanges = (_handleDirtyState = handleDirtyState === null || handleDirtyState === void 0 ? void 0 : handleDirtyState()) !== null && _handleDirtyState !== void 0 ? _handleDirtyState : true;
92
+ var _handleDirtyState1;
93
+ var discardChanges = (_handleDirtyState1 = (_handleDirtyState = handleDirtyState) === null || _handleDirtyState === void 0 ? void 0 : _handleDirtyState()) !== null && _handleDirtyState1 !== void 0 ? _handleDirtyState1 : true;
91
94
  if (!discardChanges) {
92
95
  return;
93
96
  }
94
97
  }
95
98
  }
96
- onClose === null || onClose === void 0 ? void 0 : onClose();
99
+ (_onClose = onClose) === null || _onClose === void 0 ? void 0 : _onClose();
97
100
  };
98
101
  var resolveStepDependentProp = function(prop) {
99
102
  return typeof currentStep.props[prop] === "function" ? currentStep.props[prop](currentStepIndex + 1, numberOfSteps) : currentStep.props[prop];
@@ -112,8 +115,8 @@ var ModalWizard = function(_param) {
112
115
  return /*#__PURE__*/ (0, _jsxruntime.jsxs)(_core.Modal, _object_spread_props._(_object_spread._({
113
116
  opened: opened,
114
117
  classNames: {
115
- content: cx(content, classNames === null || classNames === void 0 ? void 0 : classNames.content),
116
- body: cx(body, classNames === null || classNames === void 0 ? void 0 : classNames.body)
118
+ content: cx(content, (_classNames = classNames) === null || _classNames === void 0 ? void 0 : _classNames.content),
119
+ body: cx(body, (_classNames1 = classNames) === null || _classNames1 === void 0 ? void 0 : _classNames1.body)
117
120
  },
118
121
  centered: true,
119
122
  onClose: function() {
@@ -169,7 +172,8 @@ var ModalWizard = function(_param) {
169
172
  if (isFirstStep) {
170
173
  handleClose(true);
171
174
  } else {
172
- onPrevious === null || onPrevious === void 0 ? void 0 : onPrevious(currentStepIndex - 1);
175
+ var _onPrevious;
176
+ (_onPrevious = onPrevious) === null || _onPrevious === void 0 ? void 0 : _onPrevious(currentStepIndex - 1);
173
177
  setCurrentStepIndex(currentStepIndex - 1);
174
178
  }
175
179
  },
@@ -180,9 +184,11 @@ var ModalWizard = function(_param) {
180
184
  onClick: function() {
181
185
  if (isLastStep) {
182
186
  var _onFinish;
183
- (_onFinish = onFinish === null || onFinish === void 0 ? void 0 : onFinish()) !== null && _onFinish !== void 0 ? _onFinish : handleClose(false);
187
+ var _onFinish1;
188
+ (_onFinish1 = (_onFinish = onFinish) === null || _onFinish === void 0 ? void 0 : _onFinish()) !== null && _onFinish1 !== void 0 ? _onFinish1 : handleClose(false);
184
189
  } else {
185
- onNext === null || onNext === void 0 ? void 0 : onNext(currentStepIndex + 1, setCurrentStepIndex);
190
+ var _onNext;
191
+ (_onNext = onNext) === null || _onNext === void 0 ? void 0 : _onNext(currentStepIndex + 1, setCurrentStepIndex);
186
192
  if (!isStepValidatedOnNext) {
187
193
  setCurrentStepIndex(currentStepIndex + 1);
188
194
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizard.tsx"],"sourcesContent":["import {Box, CloseButton, createStyles, DefaultProps, Modal, ModalProps, Progress, Selectors} from '@mantine/core';\nimport {Children, ReactElement, useEffect, useMemo, useState} from 'react';\n\nimport {Button} from '../button';\nimport {Header} from '../header';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep, ModalWizardStepProps, ResolveStep} from './ModalWizardStep';\n\nconst useStyles = createStyles(() => ({\n content: {\n display: 'flex',\n flexDirection: 'column',\n },\n body: {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\ntype ModalWizardStylesNames = Selectors<typeof useStyles>;\n\nexport interface ModalWizardProps\n extends Omit<DefaultProps<ModalWizardStylesNames>, 'classNames' | 'styles'>,\n Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: (newStep: number, setCurrentStep?: React.Dispatch<number>) => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: (newStep: number) => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n\n /**\n * Indicates if step validation should be performed when clicking on to the next step\n * If true, the next step will always be enabled\n *\n * @default false\n */\n isStepValidatedOnNext?: boolean;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n styles,\n unstyled,\n children,\n isStepValidatedOnNext,\n ...modalProps\n}) => {\n const {\n classes: {content, body},\n cx,\n } = useStyles(null, {\n name: 'ModalWizard',\n classNames,\n styles,\n unstyled,\n });\n\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = isStepValidatedOnNext\n ? {isValid: true}\n : currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n\n useEffect(() => {\n if (opened) {\n setCurrentStepIndex(0);\n }\n }, [opened]);\n\n const handleClose = (confirmDirty: boolean) => {\n if (confirmDirty) {\n const isModalDirty = isDirty?.() ?? false;\n if (isModalDirty) {\n const discardChanges = handleDirtyState?.() ?? true;\n if (!discardChanges) {\n return;\n }\n }\n }\n onClose?.();\n };\n\n const resolveStepDependentProp = <P extends keyof ModalWizardStepProps>(\n prop: P\n ): ResolveStep<ModalWizardStepProps[P]> =>\n typeof currentStep.props[prop] === 'function'\n ? currentStep.props[prop](currentStepIndex + 1, numberOfSteps)\n : currentStep.props[prop];\n\n const getProgress = useMemo(\n () => (currStepIndex: number) => {\n const totalNumberOfSteps = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const numberOfCompletedSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (numberOfCompletedSteps / totalNumberOfSteps) * 100;\n },\n []\n );\n\n return (\n <Modal\n opened={opened}\n classNames={{content: cx(content, classNames?.content), body: cx(body, classNames?.body)}}\n centered\n onClose={() => handleClose(true)}\n withCloseButton={false}\n padding={0}\n {...modalProps}\n >\n <Header\n p=\"lg\"\n pr=\"md\"\n variant=\"modal\"\n description={resolveStepDependentProp('description')}\n borderBottom={!currentStep.props.showProgressBar}\n >\n {resolveStepDependentProp('title')}\n {resolveStepDependentProp('docLink') ? (\n <Header.DocAnchor\n href={resolveStepDependentProp('docLink')}\n label={resolveStepDependentProp('docLinkTooltipLabel')}\n />\n ) : null}\n <Header.Actions>\n <CloseButton aria-label={'close-modal'} onClick={() => handleClose(true)} />\n </Header.Actions>\n </Header>\n {currentStep.props.showProgressBar && (\n <Progress color=\"navy.5\" size=\"sm\" radius={0} value={getProgress(currentStepIndex)} />\n )}\n <Box p=\"lg\">{currentStep}</Box>\n <Box\n sx={{\n marginTop: 'auto',\n }}\n >\n <StickyFooter borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n handleClose(true);\n } else {\n onPrevious?.(currentStepIndex - 1);\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n onClick={() => {\n if (isLastStep) {\n onFinish?.() ?? handleClose(false);\n } else {\n onNext?.(currentStepIndex + 1, setCurrentStepIndex);\n\n if (!isStepValidatedOnNext) {\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Box>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["ModalWizard","useStyles","createStyles","content","display","flexDirection","body","flex","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","styles","unstyled","children","isStepValidatedOnNext","modalProps","currentStep","name","classes","cx","useState","currentStepIndex","setCurrentStepIndex","modalSteps","Children","toArray","filter","child","type","ModalWizardStep","numberOfSteps","length","isFirstStep","isLastStep","step","index","isValid","props","validateStep","useEffect","handleClose","confirmDirty","isModalDirty","discardChanges","resolveStepDependentProp","prop","getProgress","useMemo","currStepIndex","totalNumberOfSteps","countsAsProgress","numberOfCompletedSteps","Modal","centered","withCloseButton","padding","Header","p","pr","variant","description","borderBottom","showProgressBar","DocAnchor","href","label","Actions","CloseButton","aria-label","onClick","Progress","color","size","radius","value","Box","sx","marginTop","StickyFooter","borderTop","Button","disabled","Step"],"mappings":";;;;+BAoGaA;;;eAAAA;;;;;;;;oBApGsF;qBAChC;sBAE9C;sBACA;4BACM;+BACsC;AAEjE,IAAMC,YAAYC,IAAAA,oBAAa;WAAO;QAClCC,SAAS;YACLC,SAAS;YACTC,eAAe;QACnB;QACAC,MAAM;YACFC,MAAM;YACNH,SAAS;YACTC,eAAe;QACnB;IACJ;;AAkFO,IAAML,cAA+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CloseButton, createStyles, DefaultProps, Modal, ModalProps, Progress, Selectors} from '@mantine/core';\nimport {Children, ReactElement, useEffect, useMemo, useState} from 'react';\n\nimport {Button} from '../button';\nimport {Header} from '../header';\nimport {StickyFooter} from '../sticky-footer';\nimport {ModalWizardStep, ModalWizardStepProps, ResolveStep} from './ModalWizardStep';\n\nconst useStyles = createStyles(() => ({\n content: {\n display: 'flex',\n flexDirection: 'column',\n },\n body: {\n flex: 1,\n display: 'flex',\n flexDirection: 'column',\n },\n}));\n\ntype ModalWizardStylesNames = Selectors<typeof useStyles>;\n\nexport interface ModalWizardProps\n extends Omit<DefaultProps<ModalWizardStylesNames>, 'classNames' | 'styles'>,\n Omit<ModalProps, 'centered' | 'title'> {\n /**\n * The label of the cancel button\n *\n * @default \"Cancel\"\n */\n cancelButtonLabel?: string;\n\n /**\n * The label of the next button\n *\n * @default \"Next\"\n */\n nextButtonLabel?: string;\n\n /**\n * The label of the previous button\n *\n * @default \"Previous\"\n */\n previousButtonLabel?: string;\n\n /**\n * The label of the finish button\n *\n * @default \"Finish\"\n */\n finishButtonLabel?: string;\n\n /**\n * A callback function that is executed when the user clicks on the next button\n */\n onNext?: (newStep: number, setCurrentStep?: React.Dispatch<number>) => unknown;\n\n /**\n * A callback function that is executed when the user clicks on the previous button\n */\n onPrevious?: (newStep: number) => unknown;\n\n /**\n * A function that is executed when user completes all the steps.\n *\n * @param close A function that closes the modal when called.\n */\n onFinish?: () => unknown;\n\n /**\n * Determine if user interacted with any steps in the modal wizard\n */\n isDirty?: () => boolean;\n\n /**\n * A function to confirm close if the state is dirty before closing\n */\n handleDirtyState?: () => boolean;\n\n /**\n * Children to display in modal wizard\n * */\n children?: Array<ReturnType<typeof ModalWizardStep>>;\n\n /**\n * Indicates if step validation should be performed when clicking on to the next step\n * If true, the next step will always be enabled\n *\n * @default false\n */\n isStepValidatedOnNext?: boolean;\n}\n\ninterface ModalWizardType {\n (props: ModalWizardProps): ReactElement;\n\n Step: typeof ModalWizardStep;\n}\n\nexport const ModalWizard: ModalWizardType = ({\n cancelButtonLabel = 'Cancel',\n nextButtonLabel = 'Next',\n previousButtonLabel = 'Previous',\n finishButtonLabel = 'Finish',\n opened,\n onNext,\n onPrevious,\n onClose,\n onFinish,\n isDirty,\n handleDirtyState,\n classNames,\n styles,\n unstyled,\n children,\n isStepValidatedOnNext,\n ...modalProps\n}) => {\n const {\n classes: {content, body},\n cx,\n } = useStyles(null, {\n name: 'ModalWizard',\n classNames,\n styles,\n unstyled,\n });\n\n const [currentStepIndex, setCurrentStepIndex] = useState(0);\n const modalSteps = (Children.toArray(children) as ReactElement[]).filter((child) => child.type === ModalWizardStep);\n\n const numberOfSteps = modalSteps.length;\n const isFirstStep = currentStepIndex === 0;\n const isLastStep = currentStepIndex === numberOfSteps - 1;\n const currentStep = modalSteps.filter((step: ReactElement, index: number) => index === currentStepIndex)[0];\n\n const {isValid} = isStepValidatedOnNext\n ? {isValid: true}\n : currentStep?.props?.validateStep?.(currentStepIndex, numberOfSteps) ?? {isValid: true};\n\n useEffect(() => {\n if (opened) {\n setCurrentStepIndex(0);\n }\n }, [opened]);\n\n const handleClose = (confirmDirty: boolean) => {\n if (confirmDirty) {\n const isModalDirty = isDirty?.() ?? false;\n if (isModalDirty) {\n const discardChanges = handleDirtyState?.() ?? true;\n if (!discardChanges) {\n return;\n }\n }\n }\n onClose?.();\n };\n\n const resolveStepDependentProp = <P extends keyof ModalWizardStepProps>(\n prop: P\n ): ResolveStep<ModalWizardStepProps[P]> =>\n typeof currentStep.props[prop] === 'function'\n ? currentStep.props[prop](currentStepIndex + 1, numberOfSteps)\n : currentStep.props[prop];\n\n const getProgress = useMemo(\n () => (currStepIndex: number) => {\n const totalNumberOfSteps = modalSteps.filter((step) => step.props.countsAsProgress).length;\n const numberOfCompletedSteps = modalSteps.filter(\n (step, index) => step.props.countsAsProgress && index <= currStepIndex\n ).length;\n return (numberOfCompletedSteps / totalNumberOfSteps) * 100;\n },\n []\n );\n\n return (\n <Modal\n opened={opened}\n classNames={{content: cx(content, classNames?.content), body: cx(body, classNames?.body)}}\n centered\n onClose={() => handleClose(true)}\n withCloseButton={false}\n padding={0}\n {...modalProps}\n >\n <Header\n p=\"lg\"\n pr=\"md\"\n variant=\"modal\"\n description={resolveStepDependentProp('description')}\n borderBottom={!currentStep.props.showProgressBar}\n >\n {resolveStepDependentProp('title')}\n {resolveStepDependentProp('docLink') ? (\n <Header.DocAnchor\n href={resolveStepDependentProp('docLink')}\n label={resolveStepDependentProp('docLinkTooltipLabel')}\n />\n ) : null}\n <Header.Actions>\n <CloseButton aria-label={'close-modal'} onClick={() => handleClose(true)} />\n </Header.Actions>\n </Header>\n {currentStep.props.showProgressBar && (\n <Progress color=\"navy.5\" size=\"sm\" radius={0} value={getProgress(currentStepIndex)} />\n )}\n <Box p=\"lg\">{currentStep}</Box>\n <Box\n sx={{\n marginTop: 'auto',\n }}\n >\n <StickyFooter borderTop>\n <Button\n name={isFirstStep ? cancelButtonLabel : previousButtonLabel}\n variant=\"outline\"\n onClick={() => {\n if (isFirstStep) {\n handleClose(true);\n } else {\n onPrevious?.(currentStepIndex - 1);\n setCurrentStepIndex(currentStepIndex - 1);\n }\n }}\n >\n {isFirstStep ? cancelButtonLabel : previousButtonLabel}\n </Button>\n\n <Button\n disabled={!isValid}\n onClick={() => {\n if (isLastStep) {\n onFinish?.() ?? handleClose(false);\n } else {\n onNext?.(currentStepIndex + 1, setCurrentStepIndex);\n\n if (!isStepValidatedOnNext) {\n setCurrentStepIndex(currentStepIndex + 1);\n }\n }\n }}\n >\n {isLastStep ? finishButtonLabel : nextButtonLabel}\n </Button>\n </StickyFooter>\n </Box>\n </Modal>\n );\n};\n\nModalWizard.Step = ModalWizardStep;\n"],"names":["ModalWizard","useStyles","createStyles","content","display","flexDirection","body","flex","cancelButtonLabel","nextButtonLabel","previousButtonLabel","finishButtonLabel","opened","onNext","onPrevious","onClose","onFinish","isDirty","handleDirtyState","classNames","styles","unstyled","children","isStepValidatedOnNext","modalProps","currentStep","name","classes","cx","useState","currentStepIndex","setCurrentStepIndex","modalSteps","Children","toArray","filter","child","type","ModalWizardStep","numberOfSteps","length","isFirstStep","isLastStep","step","index","isValid","props","validateStep","useEffect","handleClose","confirmDirty","isModalDirty","discardChanges","resolveStepDependentProp","prop","getProgress","useMemo","currStepIndex","totalNumberOfSteps","countsAsProgress","numberOfCompletedSteps","Modal","centered","withCloseButton","padding","Header","p","pr","variant","description","borderBottom","showProgressBar","DocAnchor","href","label","Actions","CloseButton","aria-label","onClick","Progress","color","size","radius","value","Box","sx","marginTop","StickyFooter","borderTop","Button","disabled","Step"],"mappings":";;;;+BAoGaA;;;eAAAA;;;;;;;;oBApGsF;qBAChC;sBAE9C;sBACA;4BACM;+BACsC;AAEjE,IAAMC,YAAYC,IAAAA,kBAAY,EAAC;WAAO;QAClCC,SAAS;YACLC,SAAS;YACTC,eAAe;QACnB;QACAC,MAAM;YACFC,MAAM;YACNH,SAAS;YACTC,eAAe;QACnB;IACJ;;AAkFO,IAAML,cAA+B;0CACxCQ,mBAAAA,0DAAoB,qEACpBC,iBAAAA,sDAAkB,qEAClBC,qBAAAA,8DAAsB,2EACtBC,mBAAAA,0DAAoB,qCACpBC,gBAAAA,QACAC,gBAAAA,QACAC,oBAAAA,YACAC,iBAAAA,SACAC,kBAAAA,UACAC,iBAAAA,SACAC,0BAAAA,kBACAC,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACAC,kBAAAA,UACAC,+BAAAA,uBACGC;QAhBHhB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;;QAuBME,0CAAAA,cA0CoCN,aAAqCA;IA9D/E,IAGIlB,aAAAA,UAAU,MAAM;QAChByB,MAAM;QACNP,YAAAA;QACAC,QAAAA;QACAC,UAAAA;IACJ,yBALIpB,WAFA0B,SAAUxB,6BAAAA,SAASG,0BAAAA,MACnBsB,KACA3B,WADA2B;IAQJ,IA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BACb,qBAAC2D,SAAG;gBACAC,IAAI;oBACAC,WAAW;gBACf;0BAEA,cAAA,sBAACC,0BAAY;oBAACC,SAAS;;sCACnB,qBAACC,cAAM;4BACH/D,MAAMe,cAAcjC,oBAAoBE;4BACxC0D,SAAQ;4BACRU,SAAS;gCACL,IAAIrC,aAAa;oCACbQ,YAAY;gCAChB,OAAO;wCACHnC;qCAAAA,cAAAA,wBAAAA,kCAAAA,YAAagB,mBAAmB;oCAChCC,oBAAoBD,mBAAmB;gCAC3C;4BACJ;sCAECW,cAAcjC,oBAAoBE;;sCAGvC,qBAAC+E,cAAM;4BACHC,UAAU,CAAC7C;4BACXiC,SAAS;gCACL,IAAIpC,YAAY;wCACZ1B;wCAAAA;oCAAAA,CAAAA,cAAAA,YAAAA,sBAAAA,gCAAAA,yBAAAA,wBAAAA,aAAgBiC,YAAY;gCAChC,OAAO;wCACHpC;qCAAAA,UAAAA,oBAAAA,8BAAAA,QAASiB,mBAAmB,GAAGC;oCAE/B,IAAI,CAACR,uBAAuB;wCACxBQ,oBAAoBD,mBAAmB;oCAC3C;gCACJ;4BACJ;sCAECY,aAAa/B,oBAAoBF;;;;;;;AAM1D;AAEAT,YAAY2F,IAAI,GAAGrD,gCAAe"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizardStep.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren, ReactNode} from 'react';\n\ntype DependsOnStep<T> = (currentStep: number, numberOfSteps: number) => T;\nexport type ResolveStep<P> = P extends infer T | DependsOnStep<infer T> ? T : never;\n\nexport interface ModalWizardStepProps {\n /**\n * The title of the current step. The title can be dependent on the current step if needed\n */\n title?: ReactNode | DependsOnStep<ReactNode>;\n\n /**\n * The description of the current step. The description can be dependent on the current step if needed\n */\n description?: string | DependsOnStep<string>;\n\n /**\n * A link to the documentation for the current step\n */\n docLink?: string | DependsOnStep<string>;\n\n /**\n * A tooltip label for the docLink\n */\n docLinkTooltipLabel?: string | DependsOnStep<string>;\n\n /**\n * A function to validate the current step, it determines if the next step should be enabled or not.\n */\n validateStep?: (currentStep: any, numberOfSteps: any) => {isValid: boolean; messsage?: unknown};\n\n /**\n * Show progress bar at this step\n *\n * @default true\n */\n showProgressBar?: boolean;\n\n /**\n * Does completion of current step count moves the progress bar\n *\n * @default true\n */\n countsAsProgress?: boolean;\n}\n\nconst ModalWizardStep: FunctionComponent<PropsWithChildren<ModalWizardStepProps>> = ({children}) => <>{children}</>;\n\nModalWizardStep.defaultProps = {\n showProgressBar: true,\n countsAsProgress: true,\n};\n\nexport {ModalWizardStep};\n"],"names":["ModalWizardStep","children","defaultProps","showProgressBar","countsAsProgress"],"mappings":";;;;+BAqDQA;;;eAAAA;;;;AAPR,IAAMA,kBAA8E;QAAEC,iBAAAA;yBAAc;kBAAGA;;;AAEvGD,gBAAgBE,eAAe;IAC3BC,iBAAiB;IACjBC,kBAAkB;AACtB"}
1
+ {"version":3,"sources":["../../../../src/components/modal-wizard/ModalWizardStep.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren, ReactNode} from 'react';\n\ntype DependsOnStep<T> = (currentStep: number, numberOfSteps: number) => T;\nexport type ResolveStep<P> = P extends infer T | DependsOnStep<infer T> ? T : never;\n\nexport interface ModalWizardStepProps {\n /**\n * The title of the current step. The title can be dependent on the current step if needed\n */\n title?: ReactNode | DependsOnStep<ReactNode>;\n\n /**\n * The description of the current step. The description can be dependent on the current step if needed\n */\n description?: string | DependsOnStep<string>;\n\n /**\n * A link to the documentation for the current step\n */\n docLink?: string | DependsOnStep<string>;\n\n /**\n * A tooltip label for the docLink\n */\n docLinkTooltipLabel?: string | DependsOnStep<string>;\n\n /**\n * A function to validate the current step, it determines if the next step should be enabled or not.\n */\n validateStep?: (currentStep: any, numberOfSteps: any) => {isValid: boolean; messsage?: unknown};\n\n /**\n * Show progress bar at this step\n *\n * @default true\n */\n showProgressBar?: boolean;\n\n /**\n * Does completion of current step count moves the progress bar\n *\n * @default true\n */\n countsAsProgress?: boolean;\n}\n\nconst ModalWizardStep: FunctionComponent<PropsWithChildren<ModalWizardStepProps>> = ({children}) => <>{children}</>;\n\nModalWizardStep.defaultProps = {\n showProgressBar: true,\n countsAsProgress: true,\n};\n\nexport {ModalWizardStep};\n"],"names":["ModalWizardStep","children","defaultProps","showProgressBar","countsAsProgress"],"mappings":";;;;+BAqDQA;;;eAAAA;;;;AAPR,IAAMA,kBAA8E;QAAEC,iBAAAA;yBAAc;kBAAGA;;;AAEvGD,gBAAgBE,YAAY,GAAG;IAC3BC,iBAAiB;IACjBC,kBAAkB;AACtB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal variant=\"prompt\" padding={0} classNames={classNames} size={'sm'} {...otherProps}>\n <div className={classes.innerBody}>{otherChildren}</div>\n {footer}\n </Modal>\n );\n};\n\nPrompt.Footer = PromptFooter;\n"],"names":["Prompt","useStyles","createStyles","theme","body","padding","modalType","overflow","width","innerBody","spacing","md","xl","lg","header","borderBottom","colors","gray","fontSize","headings","sizes","h3","lineHeight","success","backgroundColor","lime","color","primary","pureWhite","warning","yellow","critical","red","info","navy","whiteClose","title","children","variant","otherProps","classes","cx","convertedChildren","Children","toArray","otherChildren","filter","child","type","PromptFooter","footer","find","classNames","close","modal","Modal","size","div","className","Footer"],"mappings":";;;;+BA+CaA;;;eAAAA;;;;;;;4BA/CO;oBAC0B;qBACE;4BACrB;AAE3B,IAAMC,YAAYC,IAAAA,oBAAa,SAACC;WAAW;QACvCC,MAAM;YACFC,SAAS;QACb;QACAC,WAAW;YAACC,UAAU;YAAUC,OAAO;QAAG;QAC1CC,WAAW;YACPJ,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,QAAQC,IAAG,KAAuBR,OAApBA,MAAMO,QAAQE,IAAG,KAAoB,OAAjBT,MAAMO,QAAQG;QACtE;QACAC,QAAQ;YACJT,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,QAAQC,IAAG,KAAoB,OAAjBR,MAAMO,QAAQE;YAC9CJ,OAAO;YACPO,cAAc,AAAC,aAAiC,OAArBZ,MAAMa,OAAOC,IAAI,CAAC,EAAE;YAC/CC,UAA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BAAIC,WAAWlB,QAAQ/B;0BAAYoC;;YACnCK;;;AAGb;AAEAlD,OAAO2D,SAASV"}
1
+ {"version":3,"sources":["../../../../src/components/prompt/Prompt.tsx"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {createStyles, Modal, ModalProps} from '@mantine/core';\nimport {Children, ReactElement, ReactNode} from 'react';\nimport {PromptFooter} from './PromptFooter';\n\nconst useStyles = createStyles((theme) => ({\n body: {\n padding: 0,\n },\n modalType: {overflow: 'hidden', width: 550},\n innerBody: {\n padding: `${theme.spacing.md} ${theme.spacing.xl} ${theme.spacing.lg}`,\n },\n header: {\n padding: `${theme.spacing.md} ${theme.spacing.xl}`,\n width: '100%',\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n fontSize: theme.headings.sizes.h3.fontSize,\n lineHeight: theme.headings.sizes.h3.lineHeight,\n },\n success: {backgroundColor: theme.colors.lime[6], color: color.primary.pureWhite},\n warning: {backgroundColor: theme.colors.yellow[5], color: color.primary.pureWhite},\n critical: {\n backgroundColor: theme.colors.red[6],\n color: color.primary.pureWhite,\n },\n info: {backgroundColor: theme.colors.navy[5], color: color.primary.pureWhite},\n whiteClose: {color: color.primary.pureWhite, '&:hover': {backgroundColor: 'transparent'}},\n title: {\n color: color.primary.pureWhite,\n },\n}));\n\nexport interface PromptProps extends ModalProps {\n /**\n * Controls prompt appearance\n *\n * @default \"info\"\n */\n variant?: 'success' | 'warning' | 'critical' | 'info';\n children: ReactNode;\n}\ninterface PromptType {\n (props: PromptProps): ReactElement;\n Footer: typeof PromptFooter;\n}\n\nexport const Prompt: PromptType = ({children, variant = 'info', ...otherProps}) => {\n const {classes, cx} = useStyles();\n const convertedChildren = Children.toArray(children) as ReactElement[];\n\n const otherChildren = convertedChildren.filter((child) => child.type !== PromptFooter);\n const footer = convertedChildren.find((child) => child.type === PromptFooter);\n\n const classNames = {\n header: cx(classes.header, classes[variant]),\n close: classes.whiteClose,\n body: classes.body,\n modal: classes.modalType,\n title: classes.title,\n };\n\n return (\n <Modal variant=\"prompt\" padding={0} classNames={classNames} size={'sm'} {...otherProps}>\n <div className={classes.innerBody}>{otherChildren}</div>\n {footer}\n </Modal>\n );\n};\n\nPrompt.Footer = PromptFooter;\n"],"names":["Prompt","useStyles","createStyles","theme","body","padding","modalType","overflow","width","innerBody","spacing","md","xl","lg","header","borderBottom","colors","gray","fontSize","headings","sizes","h3","lineHeight","success","backgroundColor","lime","color","primary","pureWhite","warning","yellow","critical","red","info","navy","whiteClose","title","children","variant","otherProps","classes","cx","convertedChildren","Children","toArray","otherChildren","filter","child","type","PromptFooter","footer","find","classNames","close","modal","Modal","size","div","className","Footer"],"mappings":";;;;+BA+CaA;;;eAAAA;;;;;;;4BA/CO;oBAC0B;qBACE;4BACrB;AAE3B,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,MAAM;YACFC,SAAS;QACb;QACAC,WAAW;YAACC,UAAU;YAAUC,OAAO;QAAG;QAC1CC,WAAW;YACPJ,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAuBR,OAApBA,MAAMO,OAAO,CAACE,EAAE,EAAC,KAAoB,OAAjBT,MAAMO,OAAO,CAACG,EAAE;QACxE;QACAC,QAAQ;YACJT,SAAS,AAAC,GAAsBF,OAApBA,MAAMO,OAAO,CAACC,EAAE,EAAC,KAAoB,OAAjBR,MAAMO,OAAO,CAACE,EAAE;YAChDJ,OAAO;YACPO,cAAc,AAAC,aAAiC,OAArBZ,MAAMa,MAAM,CAACC,IAAI,CAAC,EAAE;YAC/CC,UAAUf,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACH,QAAQ;YAC1CI,YAAYnB,MAAMgB,QAAQ,CAACC,KAAK,CAACC,EAAE,CAACC,UAAU;QAClD;QACAC,SAAS;YAACC,iBAAiBrB,MAAMa,MAAM,CAACS,IAAI,CAAC,EAAE;YAAEC,OAAOA,mBAAK,CAACC,OAAO,CAACC,SA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,qBAACkB;gBAAIC,WAAWlB,QAAQ/B,SAAS;0BAAGoC;;YACnCK;;;AAGb;AAEAlD,OAAO2D,MAAM,GAAGV,0BAAY"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/prompt/PromptFooter.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren} from 'react';\nimport {StickyFooter, StickyFooterProps} from '../sticky-footer';\n\nexport interface PromptFooterProps extends StickyFooterProps {}\n\nexport const PromptFooter: FunctionComponent<PropsWithChildren<PromptFooterProps>> = ({children, ...otherProps}) => (\n <StickyFooter {...otherProps}>{children}</StickyFooter>\n);\n"],"names":["PromptFooter","children","otherProps","StickyFooter"],"mappings":";;;;+BAKaA;;;eAAAA;;;;;;;4BAJiC;AAIvC,IAAMA,eAAwE;QAAEC,kBAAAA,UAAaC;QAAbD;;WACnF,qBAACE,wEAAiBD;kBAAaD;;AAAuB"}
1
+ {"version":3,"sources":["../../../../src/components/prompt/PromptFooter.tsx"],"sourcesContent":["import {FunctionComponent, PropsWithChildren} from 'react';\nimport {StickyFooter, StickyFooterProps} from '../sticky-footer';\n\nexport interface PromptFooterProps extends StickyFooterProps {}\n\nexport const PromptFooter: FunctionComponent<PropsWithChildren<PromptFooterProps>> = ({children, ...otherProps}) => (\n <StickyFooter {...otherProps}>{children}</StickyFooter>\n);\n"],"names":["PromptFooter","children","otherProps","StickyFooter"],"mappings":";;;;+BAKaA;;;eAAAA;;;;;;;4BAJiC;AAIvC,IAAMA,eAAwE;QAAEC,kBAAAA,UAAaC;QAAbD;;WACnF,qBAACE,0BAAY,8CAAKD;kBAAaD;;AAAuB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {Box, createStyles, DefaultProps, Divider, Group} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nexport interface StickyFooterProps extends DefaultProps {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n}\n\nconst useStyles = createStyles(() => ({\n footer: {\n position: 'sticky',\n bottom: 0,\n zIndex: 1,\n backgroundColor: 'white',\n },\n}));\n\nexport const StickyFooter: FunctionComponent<PropsWithChildren<StickyFooterProps>> = ({\n borderTop,\n children,\n ...others\n}) => {\n const {classes} = useStyles();\n\n return (\n <Box className={classes.footer}>\n {borderTop ? <Divider size=\"xs\" /> : null}\n <Group position=\"right\" spacing=\"sm\" p=\"lg\" {...others}>\n {children}\n </Group>\n </Box>\n );\n};\n"],"names":["StickyFooter","useStyles","createStyles","footer","position","bottom","zIndex","backgroundColor","borderTop","children","others","classes","Box","className","Divider","size","Group","spacing","p"],"mappings":";;;;+BAmBaA;;;eAAAA;;;;;;;oBAnBiD;AAU9D,IAAMC,YAAYC,IAAAA,oBAAa;WAAO;QAClCC,QAAQ;YACJC,UAAU;YACVC,QAAQ;YACRC,QAAQ;YACRC,iBAAiB;QACrB;IACJ;;AAEO,IAAMP,eAAwE;QACjFQ,mBAAAA,WACAC,kBAAAA,UACGC;QAFHF;QACAC;;IAGA,IAAM,AAACE,UAAWV,YAAXU;IAEP,qBACI,sBAACC;QAAIC,WAAWF,QAAQR;;YACnBK,0BAAY,qBAACM;gBAAQC,MAAK;iBAAU;0BACrC,qBAACC;gBAAMZ,UAAS;gBAAQa,SAAQ;gBAAKC,GAAE;eAASR;0BAC3CD;;;;AAIjB"}
1
+ {"version":3,"sources":["../../../../src/components/sticky-footer/StickyFooter.tsx"],"sourcesContent":["import {Box, createStyles, DefaultProps, Divider, Group} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nexport interface StickyFooterProps extends DefaultProps {\n /**\n * Whether a border is render on top of the footer\n */\n borderTop?: boolean;\n}\n\nconst useStyles = createStyles(() => ({\n footer: {\n position: 'sticky',\n bottom: 0,\n zIndex: 1,\n backgroundColor: 'white',\n },\n}));\n\nexport const StickyFooter: FunctionComponent<PropsWithChildren<StickyFooterProps>> = ({\n borderTop,\n children,\n ...others\n}) => {\n const {classes} = useStyles();\n\n return (\n <Box className={classes.footer}>\n {borderTop ? <Divider size=\"xs\" /> : null}\n <Group position=\"right\" spacing=\"sm\" p=\"lg\" {...others}>\n {children}\n </Group>\n </Box>\n );\n};\n"],"names":["StickyFooter","useStyles","createStyles","footer","position","bottom","zIndex","backgroundColor","borderTop","children","others","classes","Box","className","Divider","size","Group","spacing","p"],"mappings":";;;;+BAmBaA;;;eAAAA;;;;;;;oBAnBiD;AAU9D,IAAMC,YAAYC,IAAAA,kBAAY,EAAC;WAAO;QAClCC,QAAQ;YACJC,UAAU;YACVC,QAAQ;YACRC,QAAQ;YACRC,iBAAiB;QACrB;IACJ;;AAEO,IAAMP,eAAwE;QACjFQ,mBAAAA,WACAC,kBAAAA,UACGC;QAFHF;QACAC;;IAGA,IAAM,AAACE,UAAWV,YAAXU;IAEP,qBACI,sBAACC,SAAG;QAACC,WAAWF,QAAQR,MAAM;;YACzBK,0BAAY,qBAACM,aAAO;gBAACC,MAAK;iBAAU;0BACrC,qBAACC,WAAK;gBAACZ,UAAS;gBAAQa,SAAQ;gBAAKC,GAAE;eAASR;0BAC3CD;;;;AAIjB"}
@@ -41,7 +41,7 @@ var Table = function(param) {
41
41
  var data = param.data, getRowId = param.getRowId, noDataChildren = param.noDataChildren, getExpandChildren = param.getExpandChildren, _param_initialState = param.initialState, initialState = _param_initialState === void 0 ? {} : _param_initialState, columns = param.columns, _param_layouts = param.layouts, layouts = _param_layouts === void 0 ? [
42
42
  _TableLayouts.TableLayouts.Rows
43
43
  ] : _param_layouts, onMount = param.onMount, onChange = param.onChange, children = param.children, _param_loading = param.loading, loading = _param_loading === void 0 ? false : _param_loading, doubleClickAction = param.doubleClickAction, multiRowSelectionEnabled = param.multiRowSelectionEnabled, disableRowSelection = param.disableRowSelection, onRowSelectionChange = param.onRowSelectionChange, _param_options = param.options, options = _param_options === void 0 ? {} : _param_options;
44
- var _form_values, _form_values_dateRange, _form_values_dateRange1;
44
+ var _initialState, _initialState1, _initialState2, _options, _getExpandChildren, _form_values, _form_values_dateRange, _form_values_dateRange1;
45
45
  var convertedChildren = _react.Children.toArray(children);
46
46
  var header = convertedChildren.find(function(child) {
47
47
  return child.type === _TableHeader.TableHeader;
@@ -59,12 +59,12 @@ var Table = function(param) {
59
59
  var _initialState_predicates, _initialState_dateRange, _initialState_layout;
60
60
  var form = (0, _form.useForm)({
61
61
  initialValues: {
62
- predicates: (_initialState_predicates = initialState === null || initialState === void 0 ? void 0 : initialState.predicates) !== null && _initialState_predicates !== void 0 ? _initialState_predicates : {},
63
- dateRange: (_initialState_dateRange = initialState === null || initialState === void 0 ? void 0 : initialState.dateRange) !== null && _initialState_dateRange !== void 0 ? _initialState_dateRange : [
62
+ predicates: (_initialState_predicates = (_initialState = initialState) === null || _initialState === void 0 ? void 0 : _initialState.predicates) !== null && _initialState_predicates !== void 0 ? _initialState_predicates : {},
63
+ dateRange: (_initialState_dateRange = (_initialState1 = initialState) === null || _initialState1 === void 0 ? void 0 : _initialState1.dateRange) !== null && _initialState_dateRange !== void 0 ? _initialState_dateRange : [
64
64
  null,
65
65
  null
66
66
  ],
67
- layout: (_initialState_layout = initialState === null || initialState === void 0 ? void 0 : initialState.layout) !== null && _initialState_layout !== void 0 ? _initialState_layout : layouts[0].name
67
+ layout: (_initialState_layout = (_initialState2 = initialState) === null || _initialState2 === void 0 ? void 0 : _initialState2.layout) !== null && _initialState_layout !== void 0 ? _initialState_layout : layouts[0].name
68
68
  }
69
69
  });
70
70
  var classes = (0, _Tablestyles.default)().classes;
@@ -80,11 +80,11 @@ var Table = function(param) {
80
80
  _TableSelectableColumn.TableSelectableColumn
81
81
  ].concat(columns) : columns,
82
82
  getCoreRowModel: (0, _reacttable.getCoreRowModel)(),
83
- manualPagination: (options === null || options === void 0 ? void 0 : options.getPaginationRowModel) === undefined,
83
+ manualPagination: ((_options = options) === null || _options === void 0 ? void 0 : _options.getPaginationRowModel) === undefined,
84
84
  enableMultiRowSelection: !!multiRowSelectionEnabled,
85
85
  getRowId: getRowId,
86
86
  getRowCanExpand: function(row) {
87
- return (_ref = !!(getExpandChildren === null || getExpandChildren === void 0 ? void 0 : getExpandChildren(row.original))) !== null && _ref !== void 0 ? _ref : false;
87
+ return (_ref = !!((_getExpandChildren = getExpandChildren) === null || _getExpandChildren === void 0 ? void 0 : _getExpandChildren(row.original))) !== null && _ref !== void 0 ? _ref : false;
88
88
  },
89
89
  enableRowSelection: !loading
90
90
  }, options));
@@ -104,10 +104,12 @@ var Table = function(param) {
104
104
  return !!form.values.predicates[predicate];
105
105
  }) || !!((_form_values_dateRange = form.values.dateRange) === null || _form_values_dateRange === void 0 ? void 0 : _form_values_dateRange[0]) || !!((_form_values_dateRange1 = form.values.dateRange) === null || _form_values_dateRange1 === void 0 ? void 0 : _form_values_dateRange1[1]);
106
106
  var triggerChange = (0, _lodashdebounce.default)(function() {
107
- return onChange === null || onChange === void 0 ? void 0 : onChange(_object_spread._({}, state, form.values));
107
+ var _onChange;
108
+ return (_onChange = onChange) === null || _onChange === void 0 ? void 0 : _onChange(_object_spread._({}, state, form.values));
108
109
  }, 500);
109
110
  (0, _react.useEffect)(function() {
110
- onMount === null || onMount === void 0 ? void 0 : onMount(_object_spread._({}, state, form.values));
111
+ var _onMount;
112
+ (_onMount = onMount) === null || _onMount === void 0 ? void 0 : _onMount(_object_spread._({}, state, form.values));
111
113
  return function() {
112
114
  triggerChange.cancel();
113
115
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/Table.tsx"],"sourcesContent":["import {Box, Center, Loader, Table as MantineTable} from '@mantine/core';\nimport {useForm} from '@mantine/form';\nimport {useDidUpdate} from '@mantine/hooks';\nimport {ColumnDef, Row, TableState as TanstackTableState, getCoreRowModel, useReactTable} from '@tanstack/react-table';\nimport debounce from 'lodash.debounce';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport {Children, Dispatch, ReactElement, useCallback, useEffect, useState} from 'react';\n\nimport useStyles from './Table.styles';\nimport {TableFormType, TableProps, TableState, TableType} from './Table.types';\nimport {TableActions} from './TableActions';\nimport {TableAccordionColumn, TableCollapsibleColumn} from './TableCollapsibleColumn';\nimport {TableConsumer} from './TableConsumer';\nimport {TableContext} from './TableContext';\nimport {TableDateRangePicker} from './TableDateRangePicker';\nimport {TableFilter} from './TableFilter';\nimport {TableFooter} from './TableFooter';\nimport {TableHeader} from './TableHeader';\nimport {TablePagination} from './TablePagination';\nimport {TablePerPage} from './TablePerPage';\nimport {TablePredicate} from './TablePredicate';\nimport {TableSelectableColumn} from './TableSelectableColumn';\nimport {useRowSelection} from './useRowSelection';\nimport {TableLoading} from './TableLoading';\nimport {TableLayouts} from './layouts/TableLayouts';\n\nexport const Table: TableType = <T,>({\n data,\n getRowId,\n noDataChildren,\n getExpandChildren,\n initialState = {},\n columns,\n layouts = [TableLayouts.Rows],\n onMount,\n onChange,\n children,\n loading = false,\n doubleClickAction,\n multiRowSelectionEnabled,\n disableRowSelection,\n onRowSelectionChange,\n options = {},\n}: TableProps<T>) => {\n const convertedChildren = Children.toArray(children) as ReactElement[];\n const header = convertedChildren.find((child) => child.type === TableHeader);\n const footer = convertedChildren.find((child) => child.type === TableFooter);\n const consumer = convertedChildren.find((child) => child.type === TableConsumer);\n\n const {predicates, dateRange, ...initialStateWithoutForm} = initialState;\n const form = useForm<TableFormType>({\n initialValues: {\n predicates: initialState?.predicates ?? {},\n dateRange: initialState?.dateRange ?? [null, null],\n layout: initialState?.layout ?? layouts[0].name,\n },\n });\n const {classes} = useStyles();\n\n const table = useReactTable({\n initialState: defaultsDeep(initialStateWithoutForm, {pagination: {pageSize: TablePerPage.DEFAULT_SIZE}}),\n data,\n columns: multiRowSelectionEnabled ? [TableSelectableColumn as ColumnDef<T>].concat(columns) : columns,\n getCoreRowModel: getCoreRowModel(),\n manualPagination: options?.getPaginationRowModel === undefined,\n enableMultiRowSelection: !!multiRowSelectionEnabled,\n getRowId,\n getRowCanExpand: (row: Row<T>) => !!getExpandChildren?.(row.original) ?? false,\n enableRowSelection: !loading,\n ...options,\n });\n\n const [state, setState] = useState<TableState<T>>(table.initialState as TableState<T>);\n table.setOptions((prev) => ({\n ...prev,\n state: state as TanstackTableState,\n onStateChange: setState as Dispatch<React.SetStateAction<TanstackTableState>>,\n }));\n const {clearSelection, getSelectedRow, getSelectedRows, outsideClickRef} = useRowSelection(table, {\n multiRowSelectionEnabled,\n onRowSelectionChange,\n });\n const isFiltered =\n !!state.globalFilter ||\n Object.keys(form.values?.predicates ?? {}).some((predicate) => !!form.values.predicates[predicate]) ||\n !!form.values.dateRange?.[0] ||\n !!form.values.dateRange?.[1];\n\n const triggerChange = debounce(() => onChange?.({...state, ...form.values}), 500);\n\n useEffect(() => {\n onMount?.({...state, ...form.values});\n return () => {\n triggerChange.cancel();\n };\n }, []);\n\n useDidUpdate(() => {\n triggerChange();\n if (!multiRowSelectionEnabled) {\n clearSelection();\n }\n }, [\n state.globalFilter,\n state.pagination,\n state.sorting,\n JSON.stringify(form.values.dateRange),\n JSON.stringify(form.values.predicates),\n ]);\n\n const clearFilters = useCallback(() => {\n form.setFieldValue('predicates', initialState.predicates ?? {});\n setState((prevState) => ({...prevState, globalFilter: ''}));\n }, []);\n\n if (!data) {\n return (\n <Center sx={{flexGrow: 1}}>\n <Loader />\n </Center>\n );\n }\n\n const Layout = layouts.find(({name}) => name === form.values.layout);\n const hasRows = table.getRowModel().rows.length > 0;\n\n return (\n <Box ref={outsideClickRef}>\n <TableContext.Provider\n value={{\n onChange: triggerChange,\n state,\n isFiltered,\n setState,\n clearFilters,\n getSelectedRow,\n getSelectedRows,\n clearSelection,\n form,\n containerRef: outsideClickRef,\n multiRowSelectionEnabled,\n getPageCount: table.getPageCount,\n disableRowSelection,\n layouts,\n }}\n >\n {consumer}\n {!hasRows && !isFiltered && !loading ? (\n noDataChildren\n ) : (\n <>\n <MantineTable className={classes.table} horizontalSpacing=\"sm\" verticalSpacing=\"xs\" pb=\"sm\">\n <thead className={classes.header}>\n {!!header ? (\n <tr>\n <th\n // need to use inline style because Mantine define style on `.mantine-{id} thead tr th`\n style={{padding: 0, fontWeight: 'unset'}}\n colSpan={table.getAllColumns().length}\n >\n {header}\n </th>\n </tr>\n ) : null}\n <Layout.Header\n table={table}\n doubleClickAction={doubleClickAction}\n getExpandChildren={getExpandChildren}\n loading={loading}\n />\n </thead>\n <tbody>\n {hasRows ? (\n <Layout.Body\n table={table}\n doubleClickAction={doubleClickAction}\n getExpandChildren={getExpandChildren}\n loading={loading}\n />\n ) : (\n <tr>\n <td colSpan={table.getAllColumns().length}>\n <TableLoading visible={loading}>{noDataChildren}</TableLoading>\n </td>\n </tr>\n )}\n </tbody>\n </MantineTable>\n {footer}\n </>\n )}\n </TableContext.Provider>\n </Box>\n );\n};\n\nTable.Actions = TableActions;\nTable.Filter = TableFilter;\nTable.Footer = TableFooter;\nTable.Header = TableHeader;\nTable.Pagination = TablePagination;\nTable.Predicate = TablePredicate;\nTable.PerPage = TablePerPage;\nTable.Predicate = TablePredicate;\nTable.CollapsibleColumn = TableCollapsibleColumn;\nTable.AccordionColumn = TableAccordionColumn;\nTable.DateRangePicker = TableDateRangePicker;\nTable.Consumer = TableConsumer;\nTable.Loading = TableLoading;\nTable.Layouts = TableLayouts;\n"],"names":["Table","data","getRowId","noDataChildren","getExpandChildren","initialState","columns","layouts","TableLayouts","Rows","onMount","onChange","children","loading","doubleClickAction","multiRowSelectionEnabled","disableRowSelection","onRowSelectionChange","options","form","convertedChildren","Children","toArray","header","find","child","type","TableHeader","footer","TableFooter","consumer","TableConsumer","predicates","dateRange","initialStateWithoutForm","useForm","initialValues","layout","name","classes","useStyles","table","useReactTable","defaultsDeep","pagination","pageSize","TablePerPage","DEFAULT_SIZE","TableSelectableColumn","concat","getCoreRowModel","manualPagination","getPaginationRowModel","undefined","enableMultiRowSelection","getRowCanExpand","row","original","enableRowSelection","useState","state","setState","setOptions","prev","onStateChange","useRowSelection","clearSelection","getSelectedRow","getSelectedRows","outsideClickRef","isFiltered","globalFilter","Object","keys","values","some","predicate","triggerChange","debounce","useEffect","cancel","useDidUpdate","sorting","JSON","stringify","clearFilters","useCallback","setFieldValue","prevState","Center","sx","flexGrow","Loader","Layout","hasRows","getRowModel","rows","length","Box","ref","TableContext","Provider","value","containerRef","getPageCount","MantineTable","className","horizontalSpacing","verticalSpacing","pb","thead","tr","th","style","padding","fontWeight","colSpan","getAllColumns","Header","tbody","Body","td","TableLoading","visible","Actions","TableActions","Filter","TableFilter","Footer","Pagination","TablePagination","Predicate","TablePredicate","PerPage","CollapsibleColumn","TableCollapsibleColumn","AccordionColumn","TableAccordionColumn","DateRangePicker","TableDateRangePicker","Consumer","Loading","Layouts"],"mappings":";;;;+BA0BaA;;;eAAAA;;;;;;;;;oBA1B4C;oBACnC;qBACK;0BACoE;uEAC1E;2EACI;qBACwD;oEAE3D;4BAEK;sCACgC;6BAC/B;4BACD;oCACQ;2BACT;2BACA;2BACA;+BACI;4BACH;8BACE;qCACO;+BACN;4BACH;4BACA;AAEpB,IAAMA,QAAmB;QAC5BC,aAAAA,MACAC,iBAAAA,UACAC,uBAAAA,gBACAC,0BAAAA,+CACAC,cAAAA,gDAAe,CAAC,yBAChBC,gBAAAA,gCACAC,SAAAA,sCAAU;QAACC,2BAAaC;KAAK,mBAC7BC,gBAAAA,SACAC,iBAAAA,UACAC,iBAAAA,iCACAC,SAAAA,sCAAU,wBACVC,0BAAAA,mBACAC,iCAAAA,0BACAC,4BAAAA,qBACAC,6BAAAA,6CACAC,SAAAA,sCAAU,CAAC;QA0CKC,cACVA,wBACAA;IA1CN,IAAMC,oBAAoBC,gBAASC,QAAQV;IAC3C,IAAMW,SAASH,kBAAkBI,KAAK,SAACC;eAAUA,MAAMC,SAASC;;IAChE,IAAMC,SAASR,kBAAkBI,KAAK,SAACC;eAAUA,MAAMC,SAASG;;IAChE,IAAMC,WAAWV,kBAAkBI,KAAK,SAACC;eAAUA,MAAMC,SAASK;;IAElE,IAAOC,aAAqD3B,aAArD2B,YAAYC,YAAyC5B,aAAzC4B,WAAcC,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AACkG;kDACG,cAAA,qBAACU;4CAAGL,SAAS3E,MAAM4E,gBAAgBpB;sDAC/B,cAAA,qBAACyB;gDAAaC,SAAS9G;0DAAUV;;;;;;;wBAMpDyB;;;;;;AAMzB;AAEA5B,MAAM4H,UAAUC;AAChB7H,MAAM8H,SAASC;AACf/H,MAAMgI,SAASnG;AACf7B,MAAMsH,SAAS3F;AACf3B,MAAMiI,aAAaC;AACnBlI,MAAMmI,YAAYC;AAClBpI,MAAMqI,UAAUvF;AAChB9C,MAAMmI,YAAYC;AAClBpI,MAAMsI,oBAAoBC;AAC1BvI,MAAMwI,kBAAkBC;AACxBzI,MAAM0I,kBAAkBC;AACxB3I,MAAM4I,WAAW7G;AACjB/B,MAAM6I,UAAUnB;AAChB1H,MAAM8I,UAAUtI"}
1
+ {"version":3,"sources":["../../../../src/components/table/Table.tsx"],"sourcesContent":["import {Box, Center, Loader, Table as MantineTable} from '@mantine/core';\nimport {useForm} from '@mantine/form';\nimport {useDidUpdate} from '@mantine/hooks';\nimport {ColumnDef, Row, TableState as TanstackTableState, getCoreRowModel, useReactTable} from '@tanstack/react-table';\nimport debounce from 'lodash.debounce';\nimport defaultsDeep from 'lodash.defaultsdeep';\nimport {Children, Dispatch, ReactElement, useCallback, useEffect, useState} from 'react';\n\nimport useStyles from './Table.styles';\nimport {TableFormType, TableProps, TableState, TableType} from './Table.types';\nimport {TableActions} from './TableActions';\nimport {TableAccordionColumn, TableCollapsibleColumn} from './TableCollapsibleColumn';\nimport {TableConsumer} from './TableConsumer';\nimport {TableContext} from './TableContext';\nimport {TableDateRangePicker} from './TableDateRangePicker';\nimport {TableFilter} from './TableFilter';\nimport {TableFooter} from './TableFooter';\nimport {TableHeader} from './TableHeader';\nimport {TablePagination} from './TablePagination';\nimport {TablePerPage} from './TablePerPage';\nimport {TablePredicate} from './TablePredicate';\nimport {TableSelectableColumn} from './TableSelectableColumn';\nimport {useRowSelection} from './useRowSelection';\nimport {TableLoading} from './TableLoading';\nimport {TableLayouts} from './layouts/TableLayouts';\n\nexport const Table: TableType = <T,>({\n data,\n getRowId,\n noDataChildren,\n getExpandChildren,\n initialState = {},\n columns,\n layouts = [TableLayouts.Rows],\n onMount,\n onChange,\n children,\n loading = false,\n doubleClickAction,\n multiRowSelectionEnabled,\n disableRowSelection,\n onRowSelectionChange,\n options = {},\n}: TableProps<T>) => {\n const convertedChildren = Children.toArray(children) as ReactElement[];\n const header = convertedChildren.find((child) => child.type === TableHeader);\n const footer = convertedChildren.find((child) => child.type === TableFooter);\n const consumer = convertedChildren.find((child) => child.type === TableConsumer);\n\n const {predicates, dateRange, ...initialStateWithoutForm} = initialState;\n const form = useForm<TableFormType>({\n initialValues: {\n predicates: initialState?.predicates ?? {},\n dateRange: initialState?.dateRange ?? [null, null],\n layout: initialState?.layout ?? layouts[0].name,\n },\n });\n const {classes} = useStyles();\n\n const table = useReactTable({\n initialState: defaultsDeep(initialStateWithoutForm, {pagination: {pageSize: TablePerPage.DEFAULT_SIZE}}),\n data,\n columns: multiRowSelectionEnabled ? [TableSelectableColumn as ColumnDef<T>].concat(columns) : columns,\n getCoreRowModel: getCoreRowModel(),\n manualPagination: options?.getPaginationRowModel === undefined,\n enableMultiRowSelection: !!multiRowSelectionEnabled,\n getRowId,\n getRowCanExpand: (row: Row<T>) => !!getExpandChildren?.(row.original) ?? false,\n enableRowSelection: !loading,\n ...options,\n });\n\n const [state, setState] = useState<TableState<T>>(table.initialState as TableState<T>);\n table.setOptions((prev) => ({\n ...prev,\n state: state as TanstackTableState,\n onStateChange: setState as Dispatch<React.SetStateAction<TanstackTableState>>,\n }));\n const {clearSelection, getSelectedRow, getSelectedRows, outsideClickRef} = useRowSelection(table, {\n multiRowSelectionEnabled,\n onRowSelectionChange,\n });\n const isFiltered =\n !!state.globalFilter ||\n Object.keys(form.values?.predicates ?? {}).some((predicate) => !!form.values.predicates[predicate]) ||\n !!form.values.dateRange?.[0] ||\n !!form.values.dateRange?.[1];\n\n const triggerChange = debounce(() => onChange?.({...state, ...form.values}), 500);\n\n useEffect(() => {\n onMount?.({...state, ...form.values});\n return () => {\n triggerChange.cancel();\n };\n }, []);\n\n useDidUpdate(() => {\n triggerChange();\n if (!multiRowSelectionEnabled) {\n clearSelection();\n }\n }, [\n state.globalFilter,\n state.pagination,\n state.sorting,\n JSON.stringify(form.values.dateRange),\n JSON.stringify(form.values.predicates),\n ]);\n\n const clearFilters = useCallback(() => {\n form.setFieldValue('predicates', initialState.predicates ?? {});\n setState((prevState) => ({...prevState, globalFilter: ''}));\n }, []);\n\n if (!data) {\n return (\n <Center sx={{flexGrow: 1}}>\n <Loader />\n </Center>\n );\n }\n\n const Layout = layouts.find(({name}) => name === form.values.layout);\n const hasRows = table.getRowModel().rows.length > 0;\n\n return (\n <Box ref={outsideClickRef}>\n <TableContext.Provider\n value={{\n onChange: triggerChange,\n state,\n isFiltered,\n setState,\n clearFilters,\n getSelectedRow,\n getSelectedRows,\n clearSelection,\n form,\n containerRef: outsideClickRef,\n multiRowSelectionEnabled,\n getPageCount: table.getPageCount,\n disableRowSelection,\n layouts,\n }}\n >\n {consumer}\n {!hasRows && !isFiltered && !loading ? (\n noDataChildren\n ) : (\n <>\n <MantineTable className={classes.table} horizontalSpacing=\"sm\" verticalSpacing=\"xs\" pb=\"sm\">\n <thead className={classes.header}>\n {!!header ? (\n <tr>\n <th\n // need to use inline style because Mantine define style on `.mantine-{id} thead tr th`\n style={{padding: 0, fontWeight: 'unset'}}\n colSpan={table.getAllColumns().length}\n >\n {header}\n </th>\n </tr>\n ) : null}\n <Layout.Header\n table={table}\n doubleClickAction={doubleClickAction}\n getExpandChildren={getExpandChildren}\n loading={loading}\n />\n </thead>\n <tbody>\n {hasRows ? (\n <Layout.Body\n table={table}\n doubleClickAction={doubleClickAction}\n getExpandChildren={getExpandChildren}\n loading={loading}\n />\n ) : (\n <tr>\n <td colSpan={table.getAllColumns().length}>\n <TableLoading visible={loading}>{noDataChildren}</TableLoading>\n </td>\n </tr>\n )}\n </tbody>\n </MantineTable>\n {footer}\n </>\n )}\n </TableContext.Provider>\n </Box>\n );\n};\n\nTable.Actions = TableActions;\nTable.Filter = TableFilter;\nTable.Footer = TableFooter;\nTable.Header = TableHeader;\nTable.Pagination = TablePagination;\nTable.Predicate = TablePredicate;\nTable.PerPage = TablePerPage;\nTable.Predicate = TablePredicate;\nTable.CollapsibleColumn = TableCollapsibleColumn;\nTable.AccordionColumn = TableAccordionColumn;\nTable.DateRangePicker = TableDateRangePicker;\nTable.Consumer = TableConsumer;\nTable.Loading = TableLoading;\nTable.Layouts = TableLayouts;\n"],"names":["Table","data","getRowId","noDataChildren","getExpandChildren","initialState","columns","layouts","TableLayouts","Rows","onMount","onChange","children","loading","doubleClickAction","multiRowSelectionEnabled","disableRowSelection","onRowSelectionChange","options","form","convertedChildren","Children","toArray","header","find","child","type","TableHeader","footer","TableFooter","consumer","TableConsumer","predicates","dateRange","initialStateWithoutForm","useForm","initialValues","layout","name","classes","useStyles","table","useReactTable","defaultsDeep","pagination","pageSize","TablePerPage","DEFAULT_SIZE","TableSelectableColumn","concat","getCoreRowModel","manualPagination","getPaginationRowModel","undefined","enableMultiRowSelection","getRowCanExpand","row","original","enableRowSelection","useState","state","setState","setOptions","prev","onStateChange","useRowSelection","clearSelection","getSelectedRow","getSelectedRows","outsideClickRef","isFiltered","globalFilter","Object","keys","values","some","predicate","triggerChange","debounce","useEffect","cancel","useDidUpdate","sorting","JSON","stringify","clearFilters","useCallback","setFieldValue","prevState","Center","sx","flexGrow","Loader","Layout","hasRows","getRowModel","rows","length","Box","ref","TableContext","Provider","value","containerRef","getPageCount","MantineTable","className","horizontalSpacing","verticalSpacing","pb","thead","tr","th","style","padding","fontWeight","colSpan","getAllColumns","Header","tbody","Body","td","TableLoading","visible","Actions","TableActions","Filter","TableFilter","Footer","Pagination","TablePagination","Predicate","TablePredicate","PerPage","CollapsibleColumn","TableCollapsibleColumn","AccordionColumn","TableAccordionColumn","DateRangePicker","TableDateRangePicker","Consumer","Loading","Layouts"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;4CAAGL,SAAS3E,MAAM4E,aAAa,GAAGpB,MAAM;sDACrC,cAAA,qBAACyB,0BAAY;gDAACC,SAAS9G;0DAAUV;;;;;;;wBAMpDyB;;;;;;AAMzB;AAEA5B,MAAM4H,OAAO,GAAGC,0BAAY;AAC5B7H,MAAM8H,MAAM,GAAGC,wBAAW;AAC1B/H,MAAMgI,MAAM,GAAGnG,wBAAW;AAC1B7B,MAAMsH,MAAM,GAAG3F,wBAAW;AAC1B3B,MAAMiI,UAAU,GAAGC,gCAAe;AAClClI,MAAMmI,SAAS,GAAGC,8BAAc;AAChCpI,MAAMqI,OAAO,GAAGvF,0BAAY;AAC5B9C,MAAMmI,SAAS,GAAGC,8BAAc;AAChCpI,MAAMsI,iBAAiB,GAAGC,8CAAsB;AAChDvI,MAAMwI,eAAe,GAAGC,4CAAoB;AAC5CzI,MAAM0I,eAAe,GAAGC,0CAAoB;AAC5C3I,MAAM4I,QAAQ,GAAG7G,4BAAa;AAC9B/B,MAAM6I,OAAO,GAAGnB,0BAAY;AAC5B1H,MAAM8I,OAAO,GAAGtI,0BAAY"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/Table.styles.ts"],"sourcesContent":["import {createStyles} from '@mantine/core';\n\nconst useStyles = createStyles<string>((theme) => ({\n table: {\n width: '100%',\n '& thead tr th': {\n borderBottom: 'none',\n },\n '& td:first-of-type': {\n paddingLeft: theme.spacing.xl,\n },\n '& tbody td': {\n verticalAlign: 'top',\n },\n },\n\n header: {\n position: 'sticky',\n top: 0,\n backgroundColor: theme.colorScheme === 'dark' ? theme.black : theme.white,\n transition: 'box-shadow 150ms ease',\n zIndex: 1,\n\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n },\n },\n}));\n\nexport const TableComponentsOrder = {\n MultiSelectInfo: 6,\n Actions: 5,\n Predicate: 4,\n Filter: 3,\n DateRangePicker: 2,\n LayoutControl: 1,\n};\n\nexport default useStyles;\n"],"names":["TableComponentsOrder","useStyles","createStyles","theme","table","width","borderBottom","paddingLeft","spacing","xl","verticalAlign","header","position","top","backgroundColor","colorScheme","black","white","transition","zIndex","content","left","right","bottom","colors","gray","MultiSelectInfo","Actions","Predicate","Filter","DateRangePicker","LayoutControl"],"mappings":";;;;;;;;;;;IAkCaA,oBAAoB;eAApBA;;IASb,OAAyB;eAAzB;;;oBA3C2B;AAE3B,IAAMC,YAAYC,IAAAA,oBAAqB,SAACC;WAAW;QAC/CC,OAAO;YACHC,OAAO;YACP,iBAAiB;gBACbC,cAAc;YAClB;YACA,sBAAsB;gBAClBC,aAAaJ,MAAMK,QAAQC;YAC/B;YACA,cAAc;gBACVC,eAAe;YACnB;QACJ;QAEAC,QAAQ;YACJC,UAAU;YACVC,KAAK;YACLC,iBAAiBX,MAAMY,gBAAgB,SAASZ,MAAMa,QAAQb,MAAMc;YACpEC,YAAY;YACZC,QAAQ;YAER,YAAY;gBACRC,SAAS;gBACTR,UAAU;gBACVS,MAAM;gBACNC,OAAO;gBACPC,QAAQ;gBACRjB,cAAc,AAAC,aAAiC,OAArBH,MAAMqB,OAAOC,IAAI,CAAC,EAAE;YACnD;QACJ;IACJ;;AAEO,IAAMzB,uBAAuB;IAChC0B,iBAAiB;IACjBC,SAAS;IACTC,WAAW;IACXC,QAAQ;IACRC,iBAAiB;IACjBC,eAAe;AACnB;IAEA,WAAe9B"}
1
+ {"version":3,"sources":["../../../../src/components/table/Table.styles.ts"],"sourcesContent":["import {createStyles} from '@mantine/core';\n\nconst useStyles = createStyles<string>((theme) => ({\n table: {\n width: '100%',\n '& thead tr th': {\n borderBottom: 'none',\n },\n '& td:first-of-type': {\n paddingLeft: theme.spacing.xl,\n },\n '& tbody td': {\n verticalAlign: 'top',\n },\n },\n\n header: {\n position: 'sticky',\n top: 0,\n backgroundColor: theme.colorScheme === 'dark' ? theme.black : theme.white,\n transition: 'box-shadow 150ms ease',\n zIndex: 1,\n\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderBottom: `1px solid ${theme.colors.gray[3]}`,\n },\n },\n}));\n\nexport const TableComponentsOrder = {\n MultiSelectInfo: 6,\n Actions: 5,\n Predicate: 4,\n Filter: 3,\n DateRangePicker: 2,\n LayoutControl: 1,\n};\n\nexport default useStyles;\n"],"names":["TableComponentsOrder","useStyles","createStyles","theme","table","width","borderBottom","paddingLeft","spacing","xl","verticalAlign","header","position","top","backgroundColor","colorScheme","black","white","transition","zIndex","content","left","right","bottom","colors","gray","MultiSelectInfo","Actions","Predicate","Filter","DateRangePicker","LayoutControl"],"mappings":";;;;;;;;;;;IAkCaA,oBAAoB;eAApBA;;IASb,OAAyB;eAAzB;;;oBA3C2B;AAE3B,IAAMC,YAAYC,IAAAA,kBAAY,EAAS,SAACC;WAAW;QAC/CC,OAAO;YACHC,OAAO;YACP,iBAAiB;gBACbC,cAAc;YAClB;YACA,sBAAsB;gBAClBC,aAAaJ,MAAMK,OAAO,CAACC,EAAE;YACjC;YACA,cAAc;gBACVC,eAAe;YACnB;QACJ;QAEAC,QAAQ;YACJC,UAAU;YACVC,KAAK;YACLC,iBAAiBX,MAAMY,WAAW,KAAK,SAASZ,MAAMa,KAAK,GAAGb,MAAMc,KAAK;YACzEC,YAAY;YACZC,QAAQ;YAER,YAAY;gBACRC,SAAS;gBACTR,UAAU;gBACVS,MAAM;gBACNC,OAAO;gBACPC,QAAQ;gBACRjB,cAAc,AAAC,aAAiC,OAArBH,MAAMqB,MAAM,CAACC,IAAI,CAAC,EAAE;YACnD;QACJ;IACJ;;AAEO,IAAMzB,uBAAuB;IAChC0B,iBAAiB;IACjBC,SAAS;IACTC,WAAW;IACXC,QAAQ;IACRC,iBAAiB;IACjBC,eAAe;AACnB;IAEA,WAAe9B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/TableActions.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Grid, Group, Selectors} from '@mantine/core';\nimport {ReactElement, ReactNode} from 'react';\n\nimport {TableComponentsOrder} from './Table.styles';\nimport {useTable} from './TableContext';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n wrapper: {\n display: 'inline-flex',\n },\n}));\n\ntype TableActionsStylesNames = Selectors<typeof useStyles>;\n\ninterface TableActionsProps<T> extends DefaultProps<TableActionsStylesNames> {\n /**\n * Function that return components for the selected row or selected rows when multi row selection is enabled\n *\n * @param datum the data of the selected row(s)\n * @example\n * <Table.Actions<MyType>>\n * {(datum: MyType) => (\n * <Button\n * component={Link}\n * to={`edit/${datum.id}`}\n * leftIcon={<EditSize24Px />}\n * variant=\"subtle\"\n * color=\"navyBlue.8\"\n * >\n * Edit\n * </Button>\n * )}\n * </Table.Actions>\n */\n children: ((datum: T) => ReactNode) | ((data: T[]) => ReactNode);\n}\n\nexport const TableActions = <T,>({\n children,\n classNames,\n styles,\n unstyled,\n ...others\n}: TableActionsProps<T>): ReactElement => {\n const {classes} = useStyles(null, {name: 'TableActions', classNames, styles, unstyled});\n const {getSelectedRows, multiRowSelectionEnabled} = useTable<T>();\n const selectedRows = getSelectedRows();\n\n if (selectedRows.length <= 0) {\n return null;\n }\n\n return (\n <Grid.Col span=\"content\" order={TableComponentsOrder.Actions} py=\"sm\" className={classes.root} {...others}>\n <Group spacing=\"xs\" className={classes.wrapper}>\n {multiRowSelectionEnabled\n ? (children as (data: T[]) => ReactNode)(selectedRows)\n : (children as (datum: T) => ReactNode)(selectedRows[0])}\n </Group>\n </Grid.Col>\n );\n};\n"],"names":["TableActions","useStyles","createStyles","theme","root","wrapper","display","children","classNames","styles","unstyled","others","classes","name","useTable","getSelectedRows","multiRowSelectionEnabled","selectedRows","length","Grid","Col","span","order","TableComponentsOrder","Actions","py","className","Group","spacing"],"mappings":";;;;+BAsCaA;;;eAAAA;;;;;;;oBAtCoD;2BAG9B;4BACZ;AAEvB,IAAMC,YAAYC,IAAAA,oBAAa,SAACC;WAAW;QACvCC,MAAM,CAAC;QACPC,SAAS;YACLC,SAAS;QACb;IACJ;;AA2BO,IAAMN,eAAe;QACxBO,kBAAAA,UACAC,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACGC;QAJHJ;QACAC;QACAC;QACAC;;IAGA,IAAM,AAACE,UAAWX,UAAU,MAAM;QAACY,MAAM;QAAgBL,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAA9EE;IACP,IAAoDE,YAAAA,IAAAA,2BAA7CC,kBAA6CD,UAA7CC,iBAAiBC,2BAA4BF,UAA5BE;IACxB,IAAMC,eAAeF;IAErB,IAAIE,aAAaC,UAAU,GAAG;QAC1B,OAAO;IACX;IAEA,qBACI,qBAACC,WAAKC;QAAIC,MAAK;QAAUC,OAAOC,kCAAqBC;QAASC,IAAG;QAAKC,WAAWd,QAAQR;OAAUO;kBAC/F,cAAA,qBAACgB;YAAMC,SAAQ;YAAKF,WAAWd,QAAQP;sBAClCW,2BACK,AAACT,SAAsCU,gBACvC,AAACV,SAAqCU,YAAY,CAAC,EAAE;;;AAI3E"}
1
+ {"version":3,"sources":["../../../../src/components/table/TableActions.tsx"],"sourcesContent":["import {createStyles, DefaultProps, Grid, Group, Selectors} from '@mantine/core';\nimport {ReactElement, ReactNode} from 'react';\n\nimport {TableComponentsOrder} from './Table.styles';\nimport {useTable} from './TableContext';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n wrapper: {\n display: 'inline-flex',\n },\n}));\n\ntype TableActionsStylesNames = Selectors<typeof useStyles>;\n\ninterface TableActionsProps<T> extends DefaultProps<TableActionsStylesNames> {\n /**\n * Function that return components for the selected row or selected rows when multi row selection is enabled\n *\n * @param datum the data of the selected row(s)\n * @example\n * <Table.Actions<MyType>>\n * {(datum: MyType) => (\n * <Button\n * component={Link}\n * to={`edit/${datum.id}`}\n * leftIcon={<EditSize24Px />}\n * variant=\"subtle\"\n * color=\"navyBlue.8\"\n * >\n * Edit\n * </Button>\n * )}\n * </Table.Actions>\n */\n children: ((datum: T) => ReactNode) | ((data: T[]) => ReactNode);\n}\n\nexport const TableActions = <T,>({\n children,\n classNames,\n styles,\n unstyled,\n ...others\n}: TableActionsProps<T>): ReactElement => {\n const {classes} = useStyles(null, {name: 'TableActions', classNames, styles, unstyled});\n const {getSelectedRows, multiRowSelectionEnabled} = useTable<T>();\n const selectedRows = getSelectedRows();\n\n if (selectedRows.length <= 0) {\n return null;\n }\n\n return (\n <Grid.Col span=\"content\" order={TableComponentsOrder.Actions} py=\"sm\" className={classes.root} {...others}>\n <Group spacing=\"xs\" className={classes.wrapper}>\n {multiRowSelectionEnabled\n ? (children as (data: T[]) => ReactNode)(selectedRows)\n : (children as (datum: T) => ReactNode)(selectedRows[0])}\n </Group>\n </Grid.Col>\n );\n};\n"],"names":["TableActions","useStyles","createStyles","theme","root","wrapper","display","children","classNames","styles","unstyled","others","classes","name","useTable","getSelectedRows","multiRowSelectionEnabled","selectedRows","length","Grid","Col","span","order","TableComponentsOrder","Actions","py","className","Group","spacing"],"mappings":";;;;+BAsCaA;;;eAAAA;;;;;;;oBAtCoD;2BAG9B;4BACZ;AAEvB,IAAMC,YAAYC,IAAAA,kBAAY,EAAC,SAACC;WAAW;QACvCC,MAAM,CAAC;QACPC,SAAS;YACLC,SAAS;QACb;IACJ;;AA2BO,IAAMN,eAAe;QACxBO,kBAAAA,UACAC,oBAAAA,YACAC,gBAAAA,QACAC,kBAAAA,UACGC;QAJHJ;QACAC;QACAC;QACAC;;IAGA,IAAM,AAACE,UAAWX,UAAU,MAAM;QAACY,MAAM;QAAgBL,YAAAA;QAAYC,QAAAA;QAAQC,UAAAA;IAAQ,GAA9EE;IACP,IAAoDE,YAAAA,IAAAA,sBAAQ,KAArDC,kBAA6CD,UAA7CC,iBAAiBC,2BAA4BF,UAA5BE;IACxB,IAAMC,eAAeF;IAErB,IAAIE,aAAaC,MAAM,IAAI,GAAG;QAC1B,OAAO;IACX;IAEA,qBACI,qBAACC,UAAI,CAACC,GAAG;QAACC,MAAK;QAAUC,OAAOC,iCAAoB,CAACC,OAAO;QAAEC,IAAG;QAAKC,WAAWd,QAAQR,IAAI;OAAMO;kBAC/F,cAAA,qBAACgB,WAAK;YAACC,SAAQ;YAAKF,WAAWd,QAAQP,OAAO;sBACzCW,2BACK,AAACT,SAAsCU,gBACvC,AAACV,SAAqCU,YAAY,CAAC,EAAE;;;AAI3E"}
@@ -52,8 +52,9 @@ var CollapsibleIcon = function(param) {
52
52
  var info = param.info, onToggle = param.onToggle;
53
53
  var handler = info.row.getToggleExpandedHandler();
54
54
  var onClick = function(e) {
55
+ var _onToggle;
55
56
  e.stopPropagation();
56
- onToggle === null || onToggle === void 0 ? void 0 : onToggle(e);
57
+ (_onToggle = onToggle) === null || _onToggle === void 0 ? void 0 : _onToggle(e);
57
58
  handler();
58
59
  };
59
60
  return info.row.getCanExpand() ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_core.ActionIcon, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/TableCollapsibleColumn.tsx"],"sourcesContent":["import {ArrowHeadDownSize24Px, ArrowHeadUpSize24Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon} from '@mantine/core';\nimport {CellContext, ColumnDef} from '@tanstack/table-core';\nimport {FunctionComponent, MouseEvent as ReactMouseEvent} from 'react';\n\nconst defaultProps: ColumnDef<unknown> = {\n id: 'collapsible',\n enableSorting: false,\n header: '',\n size: 62,\n};\n\n/**\n * Generic column to use when your table needs collapsible rows\n */\nexport const TableCollapsibleColumn: ColumnDef<unknown> = {\n ...defaultProps,\n cell: (info) => <CollapsibleIcon info={info} />,\n};\n\n/**\n * Generic column to use when your table needs an accordion (collapsible rows, but only one open at the time)\n */\nexport const TableAccordionColumn: ColumnDef<unknown> = {\n ...defaultProps,\n cell: (info) => {\n const onToggle = () => {\n // close all other rows when the current row not is expanded\n if (!info.row.getIsExpanded()) {\n info.table.toggleAllRowsExpanded(false);\n }\n };\n\n return <CollapsibleIcon onToggle={onToggle} info={info} />;\n },\n};\n\nconst CollapsibleIcon: FunctionComponent<{\n info: CellContext<unknown, unknown>;\n onToggle?: (e: ReactMouseEvent<HTMLButtonElement>) => void;\n}> = ({info, onToggle}) => {\n const handler = info.row.getToggleExpandedHandler();\n const onClick = (e: ReactMouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n onToggle?.(e);\n handler();\n };\n return info.row.getCanExpand() ? (\n <ActionIcon onClick={onClick} variant=\"subtle\" radius=\"sm\">\n {info.row.getIsExpanded() ? <ArrowHeadUpSize24Px /> : <ArrowHeadDownSize24Px />}\n </ActionIcon>\n ) : null;\n};\n"],"names":["TableCollapsibleColumn","TableAccordionColumn","defaultProps","id","enableSorting","header","size","cell","info","CollapsibleIcon","onToggle","row","getIsExpanded","table","toggleAllRowsExpanded","handler","getToggleExpandedHandler","onClick","e","stopPropagation","getCanExpand","ActionIcon","variant","radius","ArrowHeadUpSize24Px","ArrowHeadDownSize24Px"],"mappings":";;;;;;;;;;;IAeaA,sBAAsB;eAAtBA;;IAQAC,oBAAoB;eAApBA;;;;;;gCAvB4C;oBAChC;AAIzB,IAAMC,eAAmC;IACrCC,IAAI;IACJC,eAAe;IACfC,QAAQ;IACRC,MAAM;AACV;AAKO,IAAMN,yBAA6C,4CACnDE;IACHK,MAAM,SAACC;6BAAS,qBAACC;YAAgBD,MAAMA;;;;AAMpC,IAAMP,uBAA2C,4CACjDC;IACHK,MAAM,SAACC;QACH,IAAME,WAAW;YACb,4DAA4D;YAC5D,IAAI,CAACF,KAAKG,IAAIC,iBAAiB;gBAC3BJ,KAAKK,MAAMC,sBAAsB;YACrC;QACJ;QAEA,qBAAO,qBAACL;YAAgBC,UAAUA;YAAUF,MAAMA;;IACtD;;AAGJ,IAAMC,kBAGD;QAAED,aAAAA,MAAME,iBAAAA;IACT,IAAMK,UAAUP,KAAKG,IAAIK;IACzB,IAAMC,UAAU,SAACC;QACbA,EAAEC;QACFT,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAWQ;QACXH;IACJ;IACA,OAAOP,KAAKG,IAAIS,+BACZ,qBAACC;QAAWJ,SAASA;QAASK,SAAQ;QAASC,QAAO;kBACjDf,KAAKG,IAAIC,gCAAkB,qBAACY,2DAAyB,qBAACC;SAE3D;AACR"}
1
+ {"version":3,"sources":["../../../../src/components/table/TableCollapsibleColumn.tsx"],"sourcesContent":["import {ArrowHeadDownSize24Px, ArrowHeadUpSize24Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon} from '@mantine/core';\nimport {CellContext, ColumnDef} from '@tanstack/table-core';\nimport {FunctionComponent, MouseEvent as ReactMouseEvent} from 'react';\n\nconst defaultProps: ColumnDef<unknown> = {\n id: 'collapsible',\n enableSorting: false,\n header: '',\n size: 62,\n};\n\n/**\n * Generic column to use when your table needs collapsible rows\n */\nexport const TableCollapsibleColumn: ColumnDef<unknown> = {\n ...defaultProps,\n cell: (info) => <CollapsibleIcon info={info} />,\n};\n\n/**\n * Generic column to use when your table needs an accordion (collapsible rows, but only one open at the time)\n */\nexport const TableAccordionColumn: ColumnDef<unknown> = {\n ...defaultProps,\n cell: (info) => {\n const onToggle = () => {\n // close all other rows when the current row not is expanded\n if (!info.row.getIsExpanded()) {\n info.table.toggleAllRowsExpanded(false);\n }\n };\n\n return <CollapsibleIcon onToggle={onToggle} info={info} />;\n },\n};\n\nconst CollapsibleIcon: FunctionComponent<{\n info: CellContext<unknown, unknown>;\n onToggle?: (e: ReactMouseEvent<HTMLButtonElement>) => void;\n}> = ({info, onToggle}) => {\n const handler = info.row.getToggleExpandedHandler();\n const onClick = (e: ReactMouseEvent<HTMLButtonElement>) => {\n e.stopPropagation();\n onToggle?.(e);\n handler();\n };\n return info.row.getCanExpand() ? (\n <ActionIcon onClick={onClick} variant=\"subtle\" radius=\"sm\">\n {info.row.getIsExpanded() ? <ArrowHeadUpSize24Px /> : <ArrowHeadDownSize24Px />}\n </ActionIcon>\n ) : null;\n};\n"],"names":["TableCollapsibleColumn","TableAccordionColumn","defaultProps","id","enableSorting","header","size","cell","info","CollapsibleIcon","onToggle","row","getIsExpanded","table","toggleAllRowsExpanded","handler","getToggleExpandedHandler","onClick","e","stopPropagation","getCanExpand","ActionIcon","variant","radius","ArrowHeadUpSize24Px","ArrowHeadDownSize24Px"],"mappings":";;;;;;;;;;;IAeaA,sBAAsB;eAAtBA;;IAQAC,oBAAoB;eAApBA;;;;;;gCAvB4C;oBAChC;AAIzB,IAAMC,eAAmC;IACrCC,IAAI;IACJC,eAAe;IACfC,QAAQ;IACRC,MAAM;AACV;AAKO,IAAMN,yBAA6C,4CACnDE;IACHK,MAAM,SAACC;6BAAS,qBAACC;YAAgBD,MAAMA;;;;AAMpC,IAAMP,uBAA2C,4CACjDC;IACHK,MAAM,SAACC;QACH,IAAME,WAAW;YACb,4DAA4D;YAC5D,IAAI,CAACF,KAAKG,GAAG,CAACC,aAAa,IAAI;gBAC3BJ,KAAKK,KAAK,CAACC,qBAAqB,CAAC;YACrC;QACJ;QAEA,qBAAO,qBAACL;YAAgBC,UAAUA;YAAUF,MAAMA;;IACtD;;AAGJ,IAAMC,kBAGD;QAAED,aAAAA,MAAME,iBAAAA;IACT,IAAMK,UAAUP,KAAKG,GAAG,CAACK,wBAAwB;IACjD,IAAMC,UAAU,SAACC;YAEbR;QADAQ,EAAEC,eAAe;SACjBT,YAAAA,sBAAAA,gCAAAA,UAAWQ;QACXH;IACJ;IACA,OAAOP,KAAKG,GAAG,CAACS,YAAY,mBACxB,qBAACC,gBAAU;QAACJ,SAASA;QAASK,SAAQ;QAASC,QAAO;kBACjDf,KAAKG,GAAG,CAACC,aAAa,mBAAK,qBAACY,qCAAmB,sBAAM,qBAACC,uCAAqB;SAEhF;AACR"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/table/TableContext.tsx"],"sourcesContent":["import {createContext, useContext} from 'react';\n\nimport {TableContextType} from './Table.types';\n\nexport const TableContext = createContext<TableContextType<any> | null>(null);\n\nexport const useTable = <T,>(): TableContextType<T> => {\n const ctx = useContext(TableContext);\n if (ctx === null) {\n throw new Error('useTable must be used inside of a TableContext.Provider');\n }\n\n return ctx;\n};\n"],"names":["TableContext","useTable","createContext","ctx","useContext","Error"],"mappings":";;;;;;;;;;;IAIaA,YAAY;eAAZA;;IAEAC,QAAQ;eAARA;;;qBAN2B;AAIjC,IAAMD,6BAAeE,IAAAA,sBAA4C;AAEjE,IAAMD,WAAW;IACpB,IAAME,MAAMC,IAAAA,mBAAWJ;IACvB,IAAIG,QAAQ,MAAM;QACd,MAAM,IAAIE,MAAM;IACpB;IAEA,OAAOF;AACX"}
1
+ {"version":3,"sources":["../../../../src/components/table/TableContext.tsx"],"sourcesContent":["import {createContext, useContext} from 'react';\n\nimport {TableContextType} from './Table.types';\n\nexport const TableContext = createContext<TableContextType<any> | null>(null);\n\nexport const useTable = <T,>(): TableContextType<T> => {\n const ctx = useContext(TableContext);\n if (ctx === null) {\n throw new Error('useTable must be used inside of a TableContext.Provider');\n }\n\n return ctx;\n};\n"],"names":["TableContext","useTable","createContext","ctx","useContext","Error"],"mappings":";;;;;;;;;;;IAIaA,YAAY;eAAZA;;IAEAC,QAAQ;eAARA;;;qBAN2B;AAIjC,IAAMD,6BAAeE,IAAAA,oBAAa,EAA+B;AAEjE,IAAMD,WAAW;IACpB,IAAME,MAAMC,IAAAA,iBAAU,EAACJ;IACvB,IAAIG,QAAQ,MAAM;QACd,MAAM,IAAIE,MAAM;IACpB;IAEA,OAAOF;AACX"}