@coveord/plasma-mantine 49.2.0 → 49.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/.turbo/turbo-build.log +3 -3
  2. package/.turbo/turbo-test.log +7 -7
  3. package/dist/.tsbuildinfo +1 -1
  4. package/dist/cjs/__tests__/GlobalSetup.js.map +1 -1
  5. package/dist/cjs/__tests__/Setup.js.map +1 -1
  6. package/dist/cjs/__tests__/SetupAfterEnv.js.map +1 -1
  7. package/dist/cjs/__tests__/Utils.js.map +1 -1
  8. package/dist/cjs/components/blank-slate/BlankSlate.js.map +1 -1
  9. package/dist/cjs/components/blank-slate/index.js.map +1 -1
  10. package/dist/cjs/components/button/Button.js.map +1 -1
  11. package/dist/cjs/components/button/ButtonWithDisabledTooltip.js.map +1 -1
  12. package/dist/cjs/components/button/index.js.map +1 -1
  13. package/dist/cjs/components/code-editor/CodeEditor.js.map +1 -1
  14. package/dist/cjs/components/code-editor/__mocks__/@monaco-editor/react.js.map +1 -1
  15. package/dist/cjs/components/code-editor/__mocks__/monaco-editor.js.map +1 -1
  16. package/dist/cjs/components/code-editor/index.js.map +1 -1
  17. package/dist/cjs/components/code-editor/languages/xml.js.map +1 -1
  18. package/dist/cjs/components/collection/Collection.js.map +1 -1
  19. package/dist/cjs/components/collection/Collection.styles.js.map +1 -1
  20. package/dist/cjs/components/collection/CollectionItem.js.map +1 -1
  21. package/dist/cjs/components/collection/index.js.map +1 -1
  22. package/dist/cjs/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
  23. package/dist/cjs/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  24. package/dist/cjs/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  25. package/dist/cjs/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  26. package/dist/cjs/components/date-range-picker/index.js.map +1 -1
  27. package/dist/cjs/components/header/Header.js.map +1 -1
  28. package/dist/cjs/components/header/index.js.map +1 -1
  29. package/dist/cjs/components/index.js.map +1 -1
  30. package/dist/cjs/components/inline-confirm/InlineConfirm.js.map +1 -1
  31. package/dist/cjs/components/inline-confirm/InlineConfirmButton.js.map +1 -1
  32. package/dist/cjs/components/inline-confirm/InlineConfirmContext.js.map +1 -1
  33. package/dist/cjs/components/inline-confirm/InlineConfirmMenuItem.js.map +1 -1
  34. package/dist/cjs/components/inline-confirm/InlineConfirmPrompt.js.map +1 -1
  35. package/dist/cjs/components/inline-confirm/index.js.map +1 -1
  36. package/dist/cjs/components/inline-confirm/useInlineConfirm.js.map +1 -1
  37. package/dist/cjs/components/menu/Menu.js.map +1 -1
  38. package/dist/cjs/components/menu/index.js.map +1 -1
  39. package/dist/cjs/components/modal/Modal.js.map +1 -1
  40. package/dist/cjs/components/modal/index.js.map +1 -1
  41. package/dist/cjs/components/modal-wizard/ModalWizard.js.map +1 -1
  42. package/dist/cjs/components/modal-wizard/ModalWizardStep.js.map +1 -1
  43. package/dist/cjs/components/modal-wizard/index.js.map +1 -1
  44. package/dist/cjs/components/prompt/Prompt.js.map +1 -1
  45. package/dist/cjs/components/prompt/PromptFooter.js.map +1 -1
  46. package/dist/cjs/components/prompt/index.js.map +1 -1
  47. package/dist/cjs/components/sticky-footer/StickyFooter.js.map +1 -1
  48. package/dist/cjs/components/sticky-footer/index.js.map +1 -1
  49. package/dist/cjs/components/table/Table.js.map +1 -1
  50. package/dist/cjs/components/table/TableActions.js.map +1 -1
  51. package/dist/cjs/components/table/TableCollapsibleColumn.js.map +1 -1
  52. package/dist/cjs/components/table/TableContext.js.map +1 -1
  53. package/dist/cjs/components/table/TableDateRangePicker.js.map +1 -1
  54. package/dist/cjs/components/table/TableFilter.js.map +1 -1
  55. package/dist/cjs/components/table/TableFooter.js.map +1 -1
  56. package/dist/cjs/components/table/TableHeader.js.map +1 -1
  57. package/dist/cjs/components/table/TablePagination.js.map +1 -1
  58. package/dist/cjs/components/table/TablePerPage.js.map +1 -1
  59. package/dist/cjs/components/table/TablePredicate.js.map +1 -1
  60. package/dist/cjs/components/table/TableSelectableColumn.js.map +1 -1
  61. package/dist/cjs/components/table/Th.js.map +1 -1
  62. package/dist/cjs/components/table/index.js.map +1 -1
  63. package/dist/cjs/components/table/useRowSelection.js.map +1 -1
  64. package/dist/cjs/components/table/useTable.js.map +1 -1
  65. package/dist/cjs/form/FormProvider.js.map +1 -1
  66. package/dist/cjs/form/index.js.map +1 -1
  67. package/dist/cjs/form/useForm.js.map +1 -1
  68. package/dist/cjs/hooks/index.js.map +1 -1
  69. package/dist/cjs/hooks/useControlledList.js.map +1 -1
  70. package/dist/cjs/hooks/useParentHeight.js.map +1 -1
  71. package/dist/cjs/index.js.map +1 -1
  72. package/dist/cjs/theme/PlasmaColors.js.map +1 -1
  73. package/dist/cjs/theme/Plasmantine.js.map +1 -1
  74. package/dist/cjs/theme/Theme.js.map +1 -1
  75. package/dist/cjs/theme/index.js.map +1 -1
  76. package/dist/cjs/utils/createPolymorphicComponent.js.map +1 -1
  77. package/dist/cjs/utils/index.js.map +1 -1
  78. package/dist/cjs/utils/overrideComponent.js.map +1 -1
  79. package/dist/esm/__tests__/Utils.js.map +1 -1
  80. package/dist/esm/components/blank-slate/BlankSlate.js.map +1 -1
  81. package/dist/esm/components/button/Button.js.map +1 -1
  82. package/dist/esm/components/button/ButtonWithDisabledTooltip.js.map +1 -1
  83. package/dist/esm/components/code-editor/CodeEditor.js.map +1 -1
  84. package/dist/esm/components/code-editor/__mocks__/@monaco-editor/react.js.map +1 -1
  85. package/dist/esm/components/code-editor/languages/xml.js.map +1 -1
  86. package/dist/esm/components/collection/Collection.js.map +1 -1
  87. package/dist/esm/components/collection/CollectionItem.js.map +1 -1
  88. package/dist/esm/components/date-range-picker/DateRangePickerInlineCalendar.js.map +1 -1
  89. package/dist/esm/components/date-range-picker/DateRangePickerPopoverCalendar.js.map +1 -1
  90. package/dist/esm/components/date-range-picker/DateRangePickerPresetSelect.js.map +1 -1
  91. package/dist/esm/components/date-range-picker/EditableDateRangePicker.js.map +1 -1
  92. package/dist/esm/components/header/Header.js.map +1 -1
  93. package/dist/esm/components/inline-confirm/InlineConfirm.js.map +1 -1
  94. package/dist/esm/components/inline-confirm/InlineConfirmButton.js.map +1 -1
  95. package/dist/esm/components/inline-confirm/InlineConfirmMenuItem.js.map +1 -1
  96. package/dist/esm/components/inline-confirm/InlineConfirmPrompt.js.map +1 -1
  97. package/dist/esm/components/menu/Menu.js.map +1 -1
  98. package/dist/esm/components/modal/Modal.js.map +1 -1
  99. package/dist/esm/components/modal-wizard/ModalWizard.js.map +1 -1
  100. package/dist/esm/components/prompt/Prompt.js.map +1 -1
  101. package/dist/esm/components/prompt/PromptFooter.js.map +1 -1
  102. package/dist/esm/components/sticky-footer/StickyFooter.js.map +1 -1
  103. package/dist/esm/components/table/Table.js.map +1 -1
  104. package/dist/esm/components/table/TableActions.js.map +1 -1
  105. package/dist/esm/components/table/TableCollapsibleColumn.js.map +1 -1
  106. package/dist/esm/components/table/TableDateRangePicker.js.map +1 -1
  107. package/dist/esm/components/table/TableFilter.js.map +1 -1
  108. package/dist/esm/components/table/TableFooter.js.map +1 -1
  109. package/dist/esm/components/table/TableHeader.js.map +1 -1
  110. package/dist/esm/components/table/TablePagination.js.map +1 -1
  111. package/dist/esm/components/table/TablePerPage.js.map +1 -1
  112. package/dist/esm/components/table/TablePredicate.js.map +1 -1
  113. package/dist/esm/components/table/TableSelectableColumn.js.map +1 -1
  114. package/dist/esm/components/table/Th.js.map +1 -1
  115. package/dist/esm/components/table/useRowSelection.js.map +1 -1
  116. package/dist/esm/form/FormProvider.js.map +1 -1
  117. package/dist/esm/form/useForm.js.map +1 -1
  118. package/dist/esm/hooks/useControlledList.js.map +1 -1
  119. package/dist/esm/hooks/useParentHeight.js.map +1 -1
  120. package/dist/esm/theme/Plasmantine.js.map +1 -1
  121. package/dist/esm/theme/Theme.js.map +1 -1
  122. package/dist/esm/utils/overrideComponent.js.map +1 -1
  123. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/useParentHeight.ts"],"sourcesContent":["import {useEffect, useRef, useState} from 'react';\n\nconst getElementInnerHeight = (el: HTMLElement): number => {\n const fullHeight = el.getBoundingClientRect().height;\n const cs = getComputedStyle(el);\n const padding = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);\n const border = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);\n return fullHeight - padding - border;\n};\n\n/**\n * Computes the available height of the parent element on mount\n */\nexport const useParentHeight = (): [number, React.MutableRefObject<HTMLDivElement>] => {\n const [height, setHeight] = useState(-1);\n const ref = useRef<HTMLDivElement>();\n\n useEffect(() => {\n if (ref.current) {\n setHeight(getElementInnerHeight(ref.current.parentElement));\n }\n }, [ref.current]);\n\n return [height, ref];\n};\n"],"names":["useParentHeight","getElementInnerHeight","el","fullHeight","getBoundingClientRect","height","cs","getComputedStyle","padding","parseFloat","paddingTop","paddingBottom","border","borderTopWidth","borderBottomWidth","useState","setHeight","ref","useRef","useEffect","current","parentElement"],"mappings":"AAAA;;;;+BAaaA;;;eAAAA;;;;qBAb6B;AAE1C,IAAMC,wBAAwB,SAACC,IAA4B;IACvD,IAAMC,aAAaD,GAAGE,qBAAqB,GAAGC,MAAM;IACpD,IAAMC,KAAKC,iBAAiBL;IAC5B,IAAMM,UAAUC,WAAWH,GAAGI,UAAU,IAAID,WAAWH,GAAGK,aAAa;IACvE,IAAMC,SAASH,WAAWH,GAAGO,cAAc,IAAIJ,WAAWH,GAAGQ,iBAAiB;IAC9E,OAAOX,aAAaK,UAAUI;AAClC;AAKO,IAAMZ,kBAAkB,WAAwD;IACnF,IAA4Be,2BAAAA,IAAAA,eAAQ,EAAC,CAAC,QAA/BV,SAAqBU,cAAbC,YAAaD;IAC5B,IAAME,MAAMC,IAAAA,aAAM;IAElBC,IAAAA,gBAAS,EAAC,WAAM;QACZ,IAAIF,IAAIG,OAAO,EAAE;YACbJ,UAAUf,sBAAsBgB,IAAIG,OAAO,CAACC,aAAa;QAC7D,CAAC;IACL,GAAG;QAACJ,IAAIG,OAAO;KAAC;IAEhB,OAAO;QAACf;QAAQY;KAAI;AACxB"}
1
+ {"version":3,"sources":["../../../src/hooks/useParentHeight.ts"],"sourcesContent":["import {useEffect, useRef, useState} from 'react';\n\nconst getElementInnerHeight = (el: HTMLElement): number => {\n const fullHeight = el.getBoundingClientRect().height;\n const cs = getComputedStyle(el);\n const padding = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);\n const border = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);\n return fullHeight - padding - border;\n};\n\n/**\n * Computes the available height of the parent element on mount\n */\nexport const useParentHeight = (): [number, React.MutableRefObject<HTMLDivElement>] => {\n const [height, setHeight] = useState(-1);\n const ref = useRef<HTMLDivElement>();\n\n useEffect(() => {\n if (ref.current) {\n setHeight(getElementInnerHeight(ref.current.parentElement));\n }\n }, [ref.current]);\n\n return [height, ref];\n};\n"],"names":["useParentHeight","getElementInnerHeight","el","fullHeight","getBoundingClientRect","height","cs","getComputedStyle","padding","parseFloat","paddingTop","paddingBottom","border","borderTopWidth","borderBottomWidth","useState","setHeight","ref","useRef","useEffect","current","parentElement"],"mappings":";;;;+BAaaA;;;eAAAA;;;;qBAb6B;AAE1C,IAAMC,wBAAwB,SAACC,IAA4B;IACvD,IAAMC,aAAaD,GAAGE,qBAAqB,GAAGC,MAAM;IACpD,IAAMC,KAAKC,iBAAiBL;IAC5B,IAAMM,UAAUC,WAAWH,GAAGI,UAAU,IAAID,WAAWH,GAAGK,aAAa;IACvE,IAAMC,SAASH,WAAWH,GAAGO,cAAc,IAAIJ,WAAWH,GAAGQ,iBAAiB;IAC9E,OAAOX,aAAaK,UAAUI;AAClC;AAKO,IAAMZ,kBAAkB,WAAwD;IACnF,IAA4Be,2BAAAA,IAAAA,eAAQ,EAAC,CAAC,QAA/BV,SAAqBU,cAAbC,YAAaD;IAC5B,IAAME,MAAMC,IAAAA,aAAM;IAElBC,IAAAA,gBAAS,EAAC,WAAM;QACZ,IAAIF,IAAIG,OAAO,EAAE;YACbJ,UAAUf,sBAAsBgB,IAAIG,OAAO,CAACC,aAAa;QAC7D,CAAC;IACL,GAAG;QAACJ,IAAIG,OAAO;KAAC;IAEhB,OAAO;QAACf;QAAQY;KAAI;AACxB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport * from '@mantine/form';\nexport {Pagination} from '@mantine/core';\n// explicitly overriding mantine components\nexport {\n Header,\n Table,\n type TableProps,\n type HeaderProps,\n Modal,\n Button,\n type ButtonProps,\n Menu,\n type MenuItemProps,\n} from './components';\nexport {useForm, createFormContext} from './form';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["Pagination","Header","Table","Modal","Button","Menu","useForm","createFormContext"],"mappings":"AAAA;;;;;;;;;;;IAWQA,UAAU;eAAVA,gBAAU;;IAGdC,MAAM;eAANA,kBAAM;;IACNC,KAAK;eAALA,iBAAK;;IAGLC,KAAK;eAALA,iBAAK;;IACLC,MAAM;eAANA,kBAAM;;IAENC,IAAI;eAAJA,gBAAI;;IAGAC,OAAO;eAAPA,aAAO;;IAAEC,iBAAiB;eAAjBA,uBAAiB;;;;oBApBpB;gCACA;oBAEA;oBACA;sCACA;oBACA;oBAc2B;oBAE3B"}
1
+ {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import {Tuple} from '@mantine/core';\n\nimport {PlasmaColors} from './theme/PlasmaColors';\n\nexport * from '@mantine/carousel';\nexport * from '@mantine/core';\nexport type {FormValidateInput} from '@mantine/form/lib/types';\nexport * from '@mantine/hooks';\nexport * from '@tanstack/table-core';\nexport * from './components';\nexport * from '@mantine/form';\nexport {Pagination} from '@mantine/core';\n// explicitly overriding mantine components\nexport {\n Header,\n Table,\n type TableProps,\n type HeaderProps,\n Modal,\n Button,\n type ButtonProps,\n Menu,\n type MenuItemProps,\n} from './components';\nexport {useForm, createFormContext} from './form';\n\nexport * from './theme';\n\ndeclare module '@mantine/core' {\n export interface MantineThemeColorsOverride {\n // eslint-disable-next-line @typescript-eslint/ban-types\n colors: Record<keyof typeof PlasmaColors | (string & {}), Tuple<string, 10>>;\n }\n}\n"],"names":["Pagination","Header","Table","Modal","Button","Menu","useForm","createFormContext"],"mappings":";;;;;;;;;;;IAWQA,UAAU;eAAVA,gBAAU;;IAGdC,MAAM;eAANA,kBAAM;;IACNC,KAAK;eAALA,iBAAK;;IAGLC,KAAK;eAALA,iBAAK;;IACLC,MAAM;eAANA,kBAAM;;IAENC,IAAI;eAAJA,gBAAI;;IAGAC,OAAO;eAAPA,aAAO;;IAAEC,iBAAiB;eAAjBA,uBAAiB;;;;oBApBpB;gCACA;oBAEA;oBACA;sCACA;oBACA;oBAc2B;oBAE3B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/theme/PlasmaColors.ts"],"sourcesContent":["import {color} from '@coveord/plasma-tokens';\nimport {Tuple} from '@mantine/core';\n\nconst toMantineColor = (plasmaColor: Record<string, string>): Tuple<string, 10> =>\n Object.values(plasmaColor) as Tuple<string, 10>;\n\nconst navy = toMantineColor(color.primary.navy);\nconst red = toMantineColor(color.accent.red);\nconst yellow = toMantineColor(color.accent.yellow);\nconst teal = toMantineColor(color.accent.teal);\nconst lime = [\n color.secondary.lime[0],\n color.secondary.lime[0],\n color.secondary.lime[0],\n color.secondary.lime[0],\n color.secondary.lime[6],\n color.secondary.lime[6],\n color.secondary.lime[6],\n color.secondary.lime[9],\n color.secondary.lime[9],\n color.secondary.lime[9],\n] as Tuple<string, 10>;\n\nexport const PlasmaColors = {\n // Primary\n gray: toMantineColor(color.primary.gray),\n action: [\n color.primary.action[1],\n color.primary.action[1],\n color.primary.action[2],\n color.primary.action[3],\n color.primary.action[4],\n color.primary.action[6],\n color.primary.action[6],\n color.primary.action[8],\n color.primary.action[8],\n color.primary.action[9],\n ] as Tuple<string, 10>,\n navy,\n info: navy,\n // Accent\n blue: toMantineColor(color.accent.blue),\n red,\n critical: red,\n teal,\n new: teal,\n yellow,\n warning: yellow,\n // Secondary\n green: toMantineColor(color.secondary.green),\n indigo: toMantineColor(color.secondary.indigo),\n lime,\n success: lime,\n purple: toMantineColor(color.secondary.purple),\n};\n"],"names":["PlasmaColors","toMantineColor","plasmaColor","Object","values","navy","color","primary","red","accent","yellow","teal","lime","secondary","gray","action","info","blue","critical","new","warning","green","indigo","success","purple"],"mappings":"AAAA;;;;+BAuBaA;;;eAAAA;;;4BAvBO;AAGpB,IAAMC,iBAAiB,SAACC;WACpBC,OAAOC,MAAM,CAACF;;AAElB,IAAMG,OAAOJ,eAAeK,mBAAK,CAACC,OAAO,CAACF,IAAI;AAC9C,IAAMG,MAAMP,eAAeK,mBAAK,CAACG,MAAM,CAACD,GAAG;AAC3C,IAAME,SAAST,eAAeK,mBAAK,CAACG,MAAM,CAACC,MAAM;AACjD,IAAMC,OAAOV,eAAeK,mBAAK,CAACG,MAAM,CAACE,IAAI;AAC7C,IAAMC,OAAO;IACTN,mBAAK,CAACO,SAAS,CAACD,IAAI,CAAC,EAAE;IACvBN,mBAAK,CAACO,SAAS,CAACD,IAAI,CAAC,EAAE;IACvBN,mBAAK,CAACO,SAAS,CAACD,IAAI,CAAC,EAAE;IACvBN,mBAAK,CAACO,SAAS,CAACD,IAAI,CAAC,EAAE;IACvBN,mBAAK,CAACO,SAAS,CAACD,IAAI,CAAC,EAAE;IACvBN,mBAAK,CAACO,SAAS,CAACD,IAAI,CAAC,EAAE;IACvBN,mBAAK,CAACO,SAAS,CAAC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ent":["import {color} from '@coveord/plasma-tokens';\nimport {Tuple} from '@mantine/core';\n\nconst toMantineColor = (plasmaColor: Record<string, string>): Tuple<string, 10> =>\n Object.values(plasmaColor) as Tuple<string, 10>;\n\nconst navy = toMantineColor(color.primary.navy);\nconst red = toMantineColor(color.accent.red);\nconst yellow = toMantineColor(color.accent.yellow);\nconst teal = toMantineColor(color.accent.teal);\nconst lime = [\n color.secondary.lime[0],\n color.secondary.lime[0],\n color.secondary.lime[0],\n color.secondary.lime[0],\n color.secondary.lime[6],\n color.secondary.lime[6],\n color.secondary.lime[6],\n color.secondary.lime[9],\n color.secondary.lime[9],\n color.secondary.lime[9],\n] as Tuple<string, 10>;\n\nexport const PlasmaColors = {\n // Primary\n gray: toMantineColor(color.primary.gray),\n action: [\n color.primary.action[1],\n color.primary.action[1],\n color.primary.action[2],\n color.primary.action[3],\n color.primary.action[4],\n color.primary.action[6],\n color.primary.action[6],\n color.primary.action[8],\n color.primary.action[8],\n color.primary.action[9],\n ] as Tuple<string, 10>,\n navy,\n info: navy,\n // Accent\n blue: toMantineColor(color.accent.blue),\n red,\n critical: red,\n teal,\n new: teal,\n yellow,\n warning: yellow,\n // Secondary\n green: toMantineColor(color.secondary.green),\n indigo: toMantineColor(color.secondary.indigo),\n lime,\n success: lime,\n purple: toMantineColor(color.secondary.purple),\n};\n"],"names":["PlasmaColors","toMantineColor","plasmaColor","Object","values","navy","color","primary","red","accent","yellow","teal","lime","secondary","gray","action","info","blue","critical","new","warning","green","indigo","success","purple"],"mappings":";;;;+BAuBaA;;;eAAAA;;;4BAvBO;AAGpB,IAAMC,iBAAiB,SAACC;WACpBC,OAAOC,MAAM,CAACF;;AAElB,IAAMG,OAAOJ,eAAeK,mBAAK,CAACC,OAAO,CAACF,IAAI;AAC9C,IAAMG,MAAMP,eAAeK,mBAAK,CAACG,MAAM,CAACD,GAAG;AAC3C,IAAME,SAAST,eAAeK,mBAAK,CAACG,MAAM,CAACC,MAAM;AACjD,IAAMC,OAAOV,e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Y,MAAMhB,eAAeK,mBAAK,CAACG,MAAM,CAACQ,IAAI;IACtCT,KAAAA;IACAU,UAAUV;IACVG,MAAAA;IACAQ,KAAKR;IACLD,QAAAA;IACAU,SAASV;IACT,YAAY;IACZW,OAAOpB,eAAeK,mBAAK,CAACO,SAAS,CAACQ,KAAK;IAC3CC,QAAQrB,eAAeK,mBAAK,CAACO,SAAS,CAACS,MAAM;IAC7CV,MAAAA;IACAW,SAASX;IACTY,QAAQvB,eAAeK,mBAAK,CAACO,SAAS,CAACW,MAAM;AACjD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/theme/Plasmantine.tsx"],"sourcesContent":["import {MantineProvider} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nimport {plasmaTheme} from './Theme';\n\nexport const Plasmantine: FunctionComponent<PropsWithChildren> = ({children}) => (\n <MantineProvider withGlobalStyles withNormalizeCSS theme={plasmaTheme}>\n {children}\n </MantineProvider>\n);\n"],"names":["Plasmantine","children","MantineProvider","withGlobalStyles","withNormalizeCSS","theme","plasmaTheme"],"mappings":"AAAA;;;;+BAKaA;;;eAAAA;;;;oBALiB;qBAGJ;AAEnB,IAAMA,cAAoD;QAAEC,iBAAAA;yBAC/D,qBAACC,qBAAe;QAACC,gBAAgB;QAACC,gBAAgB;QAACC,OAAOC,kBAAW;kBAChEL"}
1
+ {"version":3,"sources":["../../../src/theme/Plasmantine.tsx"],"sourcesContent":["import {MantineProvider} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\nimport {plasmaTheme} from './Theme';\n\nexport const Plasmantine: FunctionComponent<PropsWithChildren> = ({children}) => (\n <MantineProvider withGlobalStyles withNormalizeCSS theme={plasmaTheme}>\n {children}\n </MantineProvider>\n);\n"],"names":["Plasmantine","children","MantineProvider","withGlobalStyles","withNormalizeCSS","theme","plasmaTheme"],"mappings":";;;;+BAKaA;;;eAAAA;;;;oBALiB;qBAGJ;AAEnB,IAAMA,cAAoD;QAAEC,iBAAAA;yBAC/D,qBAACC,qBAAe;QAACC,gBAAgB;QAACC,gBAAgB;QAACC,OAAOC,kBAAW;kBAChEL"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {ArrowHeadRightSize24Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {ButtonStylesParams, MantineThemeOverride, ModalStylesParams} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n // These are overrides over https://github.com/mantinedev/mantine/blob/master/src/mantine-styles/src/theme/default-theme.ts\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n spacing: {\n xs: 8,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 40,\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: 48, lineHeight: '56px', fontWeight: undefined},\n h2: {fontSize: 32, lineHeight: '40px', fontWeight: undefined},\n h3: {fontSize: 28, lineHeight: '40px', fontWeight: undefined},\n h4: {fontSize: 24, lineHeight: '32px', fontWeight: undefined},\n h5: {fontSize: 18, lineHeight: '28px', fontWeight: undefined},\n h6: {fontSize: 16, lineHeight: '24px', fontWeight: undefined},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: (theme) => ({\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em', color: theme.colors.gray[9]},\n },\n }),\n },\n Button: {\n styles: (theme, params: ButtonStylesParams) => ({\n root: {\n fontWeight: 400,\n backgroundColor: params.variant === 'outline' ? 'white' : undefined,\n },\n }),\n },\n Modal: {\n styles: (theme, {size, fullScreen}: ModalStylesParams) => ({\n modal: {\n width: fullScreen\n ? undefined\n : theme.fn.size({size, sizes: {xs: 440, sm: 550, md: 800, lg: 1334, xl: '85%'}}),\n },\n }),\n defaultProps: {\n overlayColor: color.primary.navy[9],\n overlayOpacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n styles: (theme) => ({\n label: {\n marginBottom: theme.spacing.xs,\n lineHeight: '20px',\n },\n description: {\n lineHeight: '20px',\n fontSize: theme.fontSizes.sm,\n color: theme.colors.gray[7],\n marginBottom: theme.spacing.xs,\n },\n invalid: {\n color: theme.colors.red[9],\n borderColor: theme.colors.red[6],\n },\n error: {\n color: theme.colors.red[9],\n },\n }),\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n multiline: true,\n },\n },\n Breadcrumbs: {\n defaultProps: {\n separator: <ArrowHeadRightSize24Px height={24} />,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n Popover: {\n defaultProps: {\n shadow: 'md',\n withArrow: true,\n },\n },\n Badge: {\n styles: {\n root: {\n textTransform: 'none',\n padding: '4px 8px',\n fontWeight: 500,\n },\n },\n },\n ColorSwatch: {\n defaultProps: {\n size: 8,\n withShadow: false,\n },\n },\n MenuItem: {\n defaultProps: {\n fw: 300,\n },\n },\n },\n};\n"],"names":["plasmaTheme","colorScheme","fontFamily","black","color","primary","gray","defaultRadius","spacing","xs","sm","md","lg","xl","primaryColor","headings","fontWeight","sizes","h1","fontSize","lineHeight","undefined","h2","h3","h4","h5","h6","shadows","colors","PlasmaColors","components","Alert","defaultProps","icon","InfoSize24Px","height","styles","title","Title","theme","root","letterSpacing","Button","params","backgroundColor","variant","Modal","size","fullScreen","modal","width","fn","overlayColor","navy","overlayOpacity","InputWrapper","withAsterisk","label","marginBottom","description","fontSizes","invalid","red","borderColor","error","TextInput","radius","Tooltip","withArrow","withinPortal","multiline","Breadcrumbs","separator","ArrowHeadRightSize24Px","Loader","DateRangePicker","cell","textAlign","Anchor","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems","Popover","shadow","Badge","textTransform","padding","ColorSwatch","withShadow","MenuItem","fw"],"mappings":"AAAA;;;;+BAMaA;;;eAAAA;;;;;gCANsC;4BAC/B;4BAGO;AAEpB,IAAMA,cAAoC;IAC7C,2HAA2H;IAC3HC,aAAa;IACbC,YAAY;IACZC,OAAOC,mBAAK,CAACC,OAAO,CAACC,IAAI,CAAC,EAAE;IAC5BC,eAAe;IACfC,SAAS;QACLC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;QACJC,IAAI;IACR;IACAC,cAAc;IACdC,UAAU;QACNb,YAAY;QACZc,YAAY;QACZC,OAAO;YACHC,IAAI;gBAACC,UAAU;gBAAIC,YAAY;gBAAQJ,YAAYK;YAAS;YAC5DC,IAAI;gBAACH,UAAU;gBAAIC,YAAY;gBAAQJ,YAAYK;YAAS;YAC5DE,IAAI;gBAACJ,UAAU;gBAAIC,YAAY;gBAAQJ,YAAYK;YAAS;YAC5DG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BACF4C,eAAe;oBACnB;gBACJ;;QACJ;QACAC,OAAO;YACHjD,QAAQ;gBACJkD,cAAc;oBACVC,SAAS;oBACTC,YAAY;gBAChB;YACJ;QACJ;QACAC,SAAS;YACLzD,cAAc;gBACV0D,QAAQ;gBACRtB,WAAW,IAAI;YACnB;QACJ;QACAuB,OAAO;YACHvD,QAAQ;gBACJI,MAAM;oBACFoD,eAAe;oBACfC,SAAS;oBACT7E,YAAY;gBAChB;YACJ;QACJ;QACA8E,aAAa;YACT9D,cAAc;gBACVe,MAAM;gBACNgD,YAAY,KAAK;YACrB;QACJ;QACAC,UAAU;YACNhE,cAAc;gBACViE,IAAI;YACR;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["../../../src/theme/Theme.tsx"],"sourcesContent":["import {ArrowHeadRightSize24Px, InfoSize24Px} from '@coveord/plasma-react-icons';\nimport {color} from '@coveord/plasma-tokens';\nimport {ButtonStylesParams, MantineThemeOverride, ModalStylesParams} from '@mantine/core';\n\nimport {PlasmaColors} from './PlasmaColors';\n\nexport const plasmaTheme: MantineThemeOverride = {\n // These are overrides over https://github.com/mantinedev/mantine/blob/master/src/mantine-styles/src/theme/default-theme.ts\n colorScheme: 'light',\n fontFamily: 'canada-type-gibson, sans-serif',\n black: color.primary.gray[9],\n defaultRadius: 8,\n spacing: {\n xs: 8,\n sm: 16,\n md: 24,\n lg: 32,\n xl: 40,\n },\n primaryColor: 'action',\n headings: {\n fontFamily: 'canada-type-gibson, sans-serif',\n fontWeight: 500,\n sizes: {\n h1: {fontSize: 48, lineHeight: '56px', fontWeight: undefined},\n h2: {fontSize: 32, lineHeight: '40px', fontWeight: undefined},\n h3: {fontSize: 28, lineHeight: '40px', fontWeight: undefined},\n h4: {fontSize: 24, lineHeight: '32px', fontWeight: undefined},\n h5: {fontSize: 18, lineHeight: '28px', fontWeight: undefined},\n h6: {fontSize: 16, lineHeight: '24px', fontWeight: undefined},\n },\n },\n shadows: {\n xs: '0px 1px 0px rgba(4, 8, 31, 0.08)',\n sm: '0px 2px 4px rgba(4, 8, 31, 0.12)',\n md: '0px 4px 8px rgba(4, 8, 31, 0.08)',\n lg: '0px 8px 16px rgba(7, 12, 41, 0.06)',\n xl: '0px 16px 24px rgba(4, 8, 31, 0.06)',\n },\n colors: PlasmaColors,\n components: {\n Alert: {\n defaultProps: {\n icon: <InfoSize24Px height={24} />,\n color: 'navy',\n },\n styles: {\n title: {\n fontWeight: 500,\n },\n },\n },\n Title: {\n styles: (theme) => ({\n root: {\n '&:is(h1,h2,h3,h4,h5,h6)': {letterSpacing: '0.011em', color: theme.colors.gray[9]},\n },\n }),\n },\n Button: {\n styles: (theme, params: ButtonStylesParams) => ({\n root: {\n fontWeight: 400,\n backgroundColor: params.variant === 'outline' ? 'white' : undefined,\n },\n }),\n },\n Modal: {\n styles: (theme, {size, fullScreen}: ModalStylesParams) => ({\n modal: {\n width: fullScreen\n ? undefined\n : theme.fn.size({size, sizes: {xs: 440, sm: 550, md: 800, lg: 1334, xl: '85%'}}),\n },\n }),\n defaultProps: {\n overlayColor: color.primary.navy[9],\n overlayOpacity: 0.9,\n },\n },\n InputWrapper: {\n defaultProps: {\n withAsterisk: false,\n },\n styles: (theme) => ({\n label: {\n marginBottom: theme.spacing.xs,\n lineHeight: '20px',\n },\n description: {\n lineHeight: '20px',\n fontSize: theme.fontSizes.sm,\n color: theme.colors.gray[7],\n marginBottom: theme.spacing.xs,\n },\n invalid: {\n color: theme.colors.red[9],\n borderColor: theme.colors.red[6],\n },\n error: {\n color: theme.colors.red[9],\n },\n }),\n },\n TextInput: {\n defaultProps: {\n radius: 8,\n },\n },\n Tooltip: {\n defaultProps: {\n color: 'navy',\n withArrow: true,\n withinPortal: true,\n multiline: true,\n },\n },\n Breadcrumbs: {\n defaultProps: {\n separator: <ArrowHeadRightSize24Px height={24} />,\n },\n },\n Loader: {\n defaultProps: {\n variant: 'dots',\n color: 'action',\n },\n },\n DateRangePicker: {\n styles: {\n cell: {\n textAlign: 'center',\n },\n },\n },\n Anchor: {\n defaultProps: {\n color: 'action',\n },\n styles: (theme) => ({\n root: {\n ...theme.fn.hover({\n textDecoration: 'underline',\n color: theme.colors.action[8],\n }),\n },\n }),\n },\n Checkbox: {\n defaultProps: {\n radius: 'sm',\n },\n },\n List: {\n styles: () => ({\n root: {\n listStyleType: 'disc',\n },\n }),\n },\n Radio: {\n styles: {\n labelWrapper: {\n display: 'flex',\n alignItems: 'flex-start',\n },\n },\n },\n Popover: {\n defaultProps: {\n shadow: 'md',\n withArrow: true,\n },\n },\n Badge: {\n styles: {\n root: {\n textTransform: 'none',\n padding: '4px 8px',\n fontWeight: 500,\n },\n },\n },\n ColorSwatch: {\n defaultProps: {\n size: 8,\n withShadow: false,\n },\n },\n MenuItem: {\n defaultProps: {\n fw: 300,\n },\n },\n },\n};\n"],"names":["plasmaTheme","colorScheme","fontFamily","black","color","primary","gray","defaultRadius","spacing","xs","sm","md","lg","xl","primaryColor","headings","fontWeight","sizes","h1","fontSize","lineHeight","undefined","h2","h3","h4","h5","h6","shadows","colors","PlasmaColors","components","Alert","defaultProps","icon","InfoSize24Px","height","styles","title","Title","theme","root","letterSpacing","Button","params","backgroundColor","variant","Modal","size","fullScreen","modal","width","fn","overlayColor","navy","overlayOpacity","InputWrapper","withAsterisk","label","marginBottom","description","fontSizes","invalid","red","borderColor","error","TextInput","radius","Tooltip","withArrow","withinPortal","multiline","Breadcrumbs","separator","ArrowHeadRightSize24Px","Loader","DateRangePicker","cell","textAlign","Anchor","hover","textDecoration","action","Checkbox","List","listStyleType","Radio","labelWrapper","display","alignItems","Popover","shadow","Badge","textTransform","padding","ColorSwatch","withShadow","MenuItem","fw"],"mappings":";;;;+BAMaA;;;eAAAA;;;;;gCANsC;4BAC/B;4BAGO;AAEpB,IAAMA,cAAoC;IAC7C,2HAA2H;IAC3HC,aAAa;IACbC,YAAY;IACZC,OAAOC,mBAAK,CAACC,OAAO,CAACC,IAAI,CAAC,EAAE;IAC5BC,eAAe;IACfC,SAAS;QAC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ACAC,QAAQ;YACJ9C,cAAc;gBACV5B,OAAO;YACX;YACAgC,QAAQ,SAACG;uBAAW;oBAChBC,MAAM,kBACCD,MAAMY,EAAE,CAAC4B,KAAK,CAAC;wBACdC,gBAAgB;wBAChB5E,OAAOmC,MAAMX,MAAM,CAACqD,MAAM,CAAC,EAAE;oBACjC;gBAER;;QACJ;QACAC,UAAU;YACNlD,cAAc;gBACVkC,QAAQ;YACZ;QACJ;QACAiB,MAAM;YACF/C,QAAQ;uBAAO;oBACXI,MAAM;wBACF4C,eAAe;oBACnB;gBACJ;;QACJ;QACAC,OAAO;YACHjD,QAAQ;gBACJkD,cAAc;oBACVC,SAAS;oBACTC,YAAY;gBAChB;YACJ;QACJ;QACAC,SAAS;YACLzD,cAAc;gBACV0D,QAAQ;gBACRtB,WAAW,IAAI;YACnB;QACJ;QACAuB,OAAO;YACHvD,QAAQ;gBACJI,MAAM;oBACFoD,eAAe;oBACfC,SAAS;oBACT7E,YAAY;gBAChB;YACJ;QACJ;QACA8E,aAAa;YACT9D,cAAc;gBACVe,MAAM;gBACNgD,YAAY,KAAK;YACrB;QACJ;QACAC,UAAU;YACNhE,cAAc;gBACViE,IAAI;YACR;QACJ;IACJ;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/theme/index.ts"],"sourcesContent":["export * from './Plasmantine';\n"],"names":[],"mappings":"AAAA;;;;;oBAAc"}
1
+ {"version":3,"sources":["../../../src/theme/index.ts"],"sourcesContent":["export * from './Plasmantine';\n"],"names":[],"mappings":";;;;;oBAAc"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/createPolymorphicComponent.ts"],"sourcesContent":["import {createPolymorphicComponent as mantineCreatePolymorphicComponent} from '@mantine/utils';\n\n/*\n * createPolymorphicComponent is already exported from @mantine/core, but there is an issue when using pnpm + typescript\n * that forces us to use it directly from @mantine/utils (see https://github.com/microsoft/TypeScript/issues/47663)\n * We are simply rexporting it here to avoid having to deal with this issue everywhere\n */\nexport const createPolymorphicComponent = mantineCreatePolymorphicComponent;\n"],"names":["createPolymorphicComponent","mantineCreatePolymorphicComponent"],"mappings":"AAAA;;;;+BAOaA;;;eAAAA;;;qBAPiE;AAOvE,IAAMA,6BAA6BC,iCAAiC"}
1
+ {"version":3,"sources":["../../../src/utils/createPolymorphicComponent.ts"],"sourcesContent":["import {createPolymorphicComponent as mantineCreatePolymorphicComponent} from '@mantine/utils';\n\n/*\n * createPolymorphicComponent is already exported from @mantine/core, but there is an issue when using pnpm + typescript\n * that forces us to use it directly from @mantine/utils (see https://github.com/microsoft/TypeScript/issues/47663)\n * We are simply rexporting it here to avoid having to deal with this issue everywhere\n */\nexport const createPolymorphicComponent = mantineCreatePolymorphicComponent;\n"],"names":["createPolymorphicComponent","mantineCreatePolymorphicComponent"],"mappings":";;;;+BAOaA;;;eAAAA;;;qBAPiE;AAOvE,IAAMA,6BAA6BC,iCAAiC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from './createPolymorphicComponent';\nexport * from './overrideComponent';\n"],"names":[],"mappings":"AAAA;;;;;oBAAc;oBACA"}
1
+ {"version":3,"sources":["../../../src/utils/index.ts"],"sourcesContent":["export * from './createPolymorphicComponent';\nexport * from './overrideComponent';\n"],"names":[],"mappings":";;;;;oBAAc;oBACA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/overrideComponent.ts"],"sourcesContent":["/**\n * Allows to override static properties from a component function\n *\n * @param component The component which holds the static properties\n * @param properties The new static properties to assign on the component\n * @returns A new component with the specified properties. It doesn't change the original component\n * @example const Menu = overrideComponent(MantineMenu, {Item: MyMenuItem}); // Menu.Item will equal MyMenuItem\n */\nexport const overrideComponent = <\n Component extends (...args: Parameters<Component>) => ReturnType<Component>,\n StaticProperties = Record<keyof Component, never>\n>(\n component: Component,\n properties: StaticProperties\n): ((...args: Parameters<Component>) => ReturnType<Component>) & Component & StaticProperties => {\n const componentClone = (...args: Parameters<Component>) => component(...args);\n return Object.assign(componentClone, component, properties);\n};\n"],"names":["overrideComponent","component","properties","componentClone","args","Object","assign"],"mappings":"AAAA;;;;;;;CAOC,GACD;;;;+BAAaA;;;eAAAA;;;;AAAN,IAAMA,oBAAoB,SAI7BC,WACAC,YAC6F;IAC7F,IAAMC,iBAAiB;yCAAIC;YAAAA;;eAAgCH,UAAAA,MAAAA,KAAAA,GAAU,mBAAGG;;IACxE,OAAOC,OAAOC,MAAM,CAACH,gBAAgBF,WAAWC;AACpD"}
1
+ {"version":3,"sources":["../../../src/utils/overrideComponent.ts"],"sourcesContent":["/**\n * Allows to override static properties from a component function\n *\n * @param component The component which holds the static properties\n * @param properties The new static properties to assign on the component\n * @returns A new component with the specified properties. It doesn't change the original component\n * @example const Menu = overrideComponent(MantineMenu, {Item: MyMenuItem}); // Menu.Item will equal MyMenuItem\n */\nexport const overrideComponent = <\n Component extends (...args: Parameters<Component>) => ReturnType<Component>,\n StaticProperties = Record<keyof Component, never>\n>(\n component: Component,\n properties: StaticProperties\n): ((...args: Parameters<Component>) => ReturnType<Component>) & Component & StaticProperties => {\n const componentClone = (...args: Parameters<Component>) => component(...args);\n return Object.assign(componentClone, component, properties);\n};\n"],"names":["overrideComponent","component","properties","componentClone","args","Object","assign"],"mappings":"AAAA;;;;;;;CAOC;;;;+BACYA;;;eAAAA;;;;AAAN,IAAMA,oBAAoB,SAI7BC,WACAC,YAC6F;IAC7F,IAAMC,iBAAiB;yCAAIC;YAAAA;;eAAgCH,UAAAA,MAAAA,KAAAA,GAAU,mBAAGG;;IACxE,OAAOC,OAAOC,MAAM,CAACH,gBAAgBF,WAAWC;AACpD"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport {userEvent};\nexport * from '@testing-library/react';\nexport {customRender as render};\n"],"names":["render","userEvent","Plasmantine","customRender","ui","options","TestWrapper","children","wrapper"],"mappings":"AAAA;;AAAA,SAAQA,MAAM,QAAoC,yBAAyB;AAC3E,OAAOC,eAAe,8BAA8B;AAGpD,SAAQC,WAAW,QAAO,WAAW;AAErC,IAAMC,eAAe,SAACC,IAAkBC,SAA2D;IAC/F,IAAMC,cAAoD;YAAEC,iBAAAA;6BAAc,KAACL;sBAAaK;;;IAExF,OAAOP,OAAOI,IAAI;QAACI,SAASF;OAAgBD;AAChD;AAEA,SAAQJ,SAAS,GAAE;AACnB,cAAc,yBAAyB;AACvC,SAAQE,gBAAgBH,MAAM,GAAE"}
1
+ {"version":3,"sources":["../../../src/__tests__/Utils.tsx"],"sourcesContent":["import {render, RenderOptions, RenderResult} from '@testing-library/react';\nimport userEvent from '@testing-library/user-event';\nimport {FunctionComponent, PropsWithChildren, ReactElement} from 'react';\n\nimport {Plasmantine} from '../theme';\n\nconst customRender = (ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult => {\n const TestWrapper: FunctionComponent<PropsWithChildren> = ({children}) => <Plasmantine>{children}</Plasmantine>;\n\n return render(ui, {wrapper: TestWrapper, ...options});\n};\n\nexport {userEvent};\nexport * from '@testing-library/react';\nexport {customRender as render};\n"],"names":["render","userEvent","Plasmantine","customRender","ui","options","TestWrapper","children","wrapper"],"mappings":";;AAAA,SAAQA,MAAM,QAAoC,yBAAyB;AAC3E,OAAOC,eAAe,8BAA8B;AAGpD,SAAQC,WAAW,QAAO,WAAW;AAErC,IAAMC,eAAe,SAACC,IAAkBC,SAA2D;IAC/F,IAAMC,cAAoD;YAAEC,iBAAAA;6BAAc,KAACL;sBAAaK;;;IAExF,OAAOP,OAAOI,IAAI;QAACI,SAASF;OAAgBD;AAChD;AAEA,SAAQJ,SAAS,GAAE;AACnB,cAAc,yBAAyB;AACvC,SAAQE,gBAAgBH,MAAM,GAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/blank-slate/BlankSlate.tsx"],"sourcesContent":["import {Paper, Stack} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\ninterface BlankSlateProps {\n /**\n * Whether the Blankslate render with a border\n *\n * @default true\n */\n withBorder?: boolean;\n}\n\nexport const BlankSlate: FunctionComponent<PropsWithChildren<BlankSlateProps>> = ({children, withBorder = true}) => (\n <Paper shadow={withBorder && 'xs'} p=\"xl\" withBorder={withBorder}>\n <Stack align=\"center\">{children}</Stack>\n </Paper>\n);\n"],"names":["Paper","Stack","BlankSlate","children","withBorder","shadow","p","align"],"mappings":"AAAA;AAAA,SAAQA,KAAK,EAAEC,KAAK,QAAO,gBAAgB;AAY3C,OAAO,IAAMC,aAAoE;QAAEC,iBAAAA,oCAAUC,YAAAA,4CAAa,IAAI;yBAC1G,KAACJ;QAAMK,QAAQD,cAAc;QAAME,GAAE;QAAKF,YAAYA;kBAClD,cAAA,KAACH;YAAMM,OAAM;sBAAUJ;;;EAE7B"}
1
+ {"version":3,"sources":["../../../../src/components/blank-slate/BlankSlate.tsx"],"sourcesContent":["import {Paper, Stack} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\n\ninterface BlankSlateProps {\n /**\n * Whether the Blankslate render with a border\n *\n * @default true\n */\n withBorder?: boolean;\n}\n\nexport const BlankSlate: FunctionComponent<PropsWithChildren<BlankSlateProps>> = ({children, withBorder = true}) => (\n <Paper shadow={withBorder && 'xs'} p=\"xl\" withBorder={withBorder}>\n <Stack align=\"center\">{children}</Stack>\n </Paper>\n);\n"],"names":["Paper","Stack","BlankSlate","children","withBorder","shadow","p","align"],"mappings":";AAAA,SAAQA,KAAK,EAAEC,KAAK,QAAO,gBAAgB;AAY3C,OAAO,IAAMC,aAAoE;QAAEC,iBAAAA,oCAAUC,YAAAA,4CAAa,IAAI;yBAC1G,KAACJ;QAAMK,QAAQD,cAAc;QAAME,GAAE;QAAKF,YAAYA;kBAClD,cAAA,KAACH;YAAMM,OAAM;sBAAUJ;;;EAE7B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import {Button as MantineButton, ButtonProps as MantineButtonProps} from '@mantine/core';\nimport {forwardRef} from 'react';\n\nimport {createPolymorphicComponent} from '../../utils';\nimport {ButtonWithDisabledTooltip, ButtonWithDisabledTooltipProps} from './ButtonWithDisabledTooltip';\n\nexport interface ButtonProps extends MantineButtonProps, ButtonWithDisabledTooltipProps {}\n\nconst _Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({disabledTooltip, disabled, disabledTooltipProps, ...others}, ref) => (\n <ButtonWithDisabledTooltip\n disabled={disabled}\n disabledTooltip={disabledTooltip}\n disabledTooltipProps={disabledTooltipProps}\n >\n <MantineButton ref={ref} disabled={disabled} {...others} />\n </ButtonWithDisabledTooltip>\n )\n);\n\nexport const Button = createPolymorphicComponent<'button', ButtonProps, {Group: typeof MantineButton.Group}>(_Button);\nButton.Group = MantineButton.Group;\n"],"names":["Button","MantineButton","forwardRef","createPolymorphicComponent","ButtonWithDisabledTooltip","_Button","ref","disabledTooltip","disabled","disabledTooltipProps","others","Group"],"mappings":"AAAA;;;AAAA,SAAQA,UAAUC,aAAa,QAA0C,gBAAgB;AACzF,SAAQC,UAAU,QAAO,QAAQ;AAEjC,SAAQC,0BAA0B,QAAO,cAAc;AACvD,SAAQC,yBAAyB,QAAuC,8BAA8B;AAItG,IAAMC,wBAAUH,WACZ,iBAA+DI,mBAC3D;QADFC,yBAAAA,iBAAiBC,kBAAAA,UAAUC,8BAAAA,sBAAyBC;QAApDH;QAAiBC;QAAUC;;WACzB,KAACL;QACGI,UAAUA;QACVD,iBAAiBA;QACjBE,sBAAsBA;kBAEtB,cAAA,KAACR;YAAcK,KAAKA;YAAKE,UAAUA;WAAcE;;AAC1B;AAInC,OAAO,IAAMV,SAASG,2BAAuFE,SAAS;AACtHL,OAAOW,KAAK,GAAGV,cAAcU,KAAK"}
1
+ {"version":3,"sources":["../../../../src/components/button/Button.tsx"],"sourcesContent":["import {Button as MantineButton, ButtonProps as MantineButtonProps} from '@mantine/core';\nimport {forwardRef} from 'react';\n\nimport {createPolymorphicComponent} from '../../utils';\nimport {ButtonWithDisabledTooltip, ButtonWithDisabledTooltipProps} from './ButtonWithDisabledTooltip';\n\nexport interface ButtonProps extends MantineButtonProps, ButtonWithDisabledTooltipProps {}\n\nconst _Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({disabledTooltip, disabled, disabledTooltipProps, ...others}, ref) => (\n <ButtonWithDisabledTooltip\n disabled={disabled}\n disabledTooltip={disabledTooltip}\n disabledTooltipProps={disabledTooltipProps}\n >\n <MantineButton ref={ref} disabled={disabled} {...others} />\n </ButtonWithDisabledTooltip>\n )\n);\n\nexport const Button = createPolymorphicComponent<'button', ButtonProps, {Group: typeof MantineButton.Group}>(_Button);\nButton.Group = MantineButton.Group;\n"],"names":["Button","MantineButton","forwardRef","createPolymorphicComponent","ButtonWithDisabledTooltip","_Button","ref","disabledTooltip","disabled","disabledTooltipProps","others","Group"],"mappings":";;;AAAA,SAAQA,UAAUC,aAAa,QAA0C,gBAAgB;AACzF,SAAQC,UAAU,QAAO,QAAQ;AAEjC,SAAQC,0BAA0B,QAAO,cAAc;AACvD,SAAQC,yBAAyB,QAAuC,8BAA8B;AAItG,IAAMC,wBAAUH,WACZ,iBAA+DI,mBAC3D;QADFC,yBAAAA,iBAAiBC,kBAAAA,UAAUC,8BAAAA,sBAAyBC;QAApDH;QAAiBC;QAAUC;;WACzB,KAACL;QACGI,UAAUA;QACVD,iBAAiBA;QACjBE,sBAAsBA;kBAEtB,cAAA,KAACR;YAAcK,KAAKA;YAAKE,UAAUA;WAAcE;;AAC1B;AAInC,OAAO,IAAMV,SAASG,2BAAuFE,SAAS;AACtHL,OAAOW,KAAK,GAAGV,cAAcU,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/button/ButtonWithDisabledTooltip.tsx"],"sourcesContent":["import {Box, Tooltip, TooltipProps} from '@mantine/core';\nimport {forwardRef, ReactNode} from 'react';\n\nimport {createPolymorphicComponent} from '../../utils';\n\nexport interface ButtonWithDisabledTooltipProps {\n /**\n * The tooltip message to display when disabled\n */\n disabledTooltip?: string;\n /**\n * Whether the button underneath the tooltip is disabled\n */\n disabled?: boolean;\n children?: ReactNode;\n /**\n * Additional tooltip props to set on the disabled button tooltip\n */\n disabledTooltipProps?: Omit<TooltipProps, 'disabled' | 'label' | 'children'>;\n}\n\nconst _ButtonWithDisabledTooltip = forwardRef<HTMLDivElement, ButtonWithDisabledTooltipProps>(\n ({disabledTooltip, disabled, children, disabledTooltipProps, ...others}, ref) =>\n disabledTooltip ? (\n <Tooltip label={disabledTooltip} disabled={!disabled} {...disabledTooltipProps}>\n <Box ref={ref} sx={{'&:hover': {cursor: 'not-allowed'}}} {...others}>\n {children}\n </Box>\n </Tooltip>\n ) : (\n <>{children}</>\n )\n);\n\nexport const ButtonWithDisabledTooltip = createPolymorphicComponent<'div', ButtonWithDisabledTooltipProps>(\n _ButtonWithDisabledTooltip\n);\n"],"names":["Box","Tooltip","forwardRef","createPolymorphicComponent","_ButtonWithDisabledTooltip","ref","disabledTooltip","disabled","children","disabledTooltipProps","others","label","sx","cursor","ButtonWithDisabledTooltip"],"mappings":"AAAA;;;;AAAA,SAAQA,GAAG,EAAEC,OAAO,QAAqB,gBAAgB;AACzD,SAAQC,UAAU,QAAkB,QAAQ;AAE5C,SAAQC,0BAA0B,QAAO,cAAc;AAkBvD,IAAMC,2CAA6BF,WAC/B,iBAAyEG,KACrEC;QADFA,yBAAAA,iBAAiBC,kBAAAA,UAAUC,kBAAAA,UAAUC,8BAAAA,sBAAyBC;QAA9DJ;QAAiBC;QAAUC;QAAUC;;WACnCH,gCACI,KAACL;QAAQU,OAAOL;QAAiBC,UAAU,CAACA;OAAcE;kBACtD,cAAA,KAACT;YAAIK,KAAKA;YAAKO,IAAI;gBAAC,WAAW;oBAACC,QAAQ;gBAAa;YAAC;WAAOH;sBACxDF;;wBAIT;kBAAGA;MACN;AAAD;AAGR,OAAO,IAAMM,4BAA4BX,2BACrCC,4BACF"}
1
+ {"version":3,"sources":["../../../../src/components/button/ButtonWithDisabledTooltip.tsx"],"sourcesContent":["import {Box, Tooltip, TooltipProps} from '@mantine/core';\nimport {forwardRef, ReactNode} from 'react';\n\nimport {createPolymorphicComponent} from '../../utils';\n\nexport interface ButtonWithDisabledTooltipProps {\n /**\n * The tooltip message to display when disabled\n */\n disabledTooltip?: string;\n /**\n * Whether the button underneath the tooltip is disabled\n */\n disabled?: boolean;\n children?: ReactNode;\n /**\n * Additional tooltip props to set on the disabled button tooltip\n */\n disabledTooltipProps?: Omit<TooltipProps, 'disabled' | 'label' | 'children'>;\n}\n\nconst _ButtonWithDisabledTooltip = forwardRef<HTMLDivElement, ButtonWithDisabledTooltipProps>(\n ({disabledTooltip, disabled, children, disabledTooltipProps, ...others}, ref) =>\n disabledTooltip ? (\n <Tooltip label={disabledTooltip} disabled={!disabled} {...disabledTooltipProps}>\n <Box ref={ref} sx={{'&:hover': {cursor: 'not-allowed'}}} {...others}>\n {children}\n </Box>\n </Tooltip>\n ) : (\n <>{children}</>\n )\n);\n\nexport const ButtonWithDisabledTooltip = createPolymorphicComponent<'div', ButtonWithDisabledTooltipProps>(\n _ButtonWithDisabledTooltip\n);\n"],"names":["Box","Tooltip","forwardRef","createPolymorphicComponent","_ButtonWithDisabledTooltip","ref","disabledTooltip","disabled","children","disabledTooltipProps","others","label","sx","cursor","ButtonWithDisabledTooltip"],"mappings":";;;;AAAA,SAAQA,GAAG,EAAEC,OAAO,QAAqB,gBAAgB;AACzD,SAAQC,UAAU,QAAkB,QAAQ;AAE5C,SAAQC,0BAA0B,QAAO,cAAc;AAkBvD,IAAMC,2CAA6BF,WAC/B,iBAAyEG,KACrEC;QADFA,yBAAAA,iBAAiBC,kBAAAA,UAAUC,kBAAAA,UAAUC,8BAAAA,sBAAyBC;QAA9DJ;QAAiBC;QAAUC;QAAUC;;WACnCH,gCACI,KAACL;QAAQU,OAAOL;QAAiBC,UAAU,CAACA;OAAcE;kBACtD,cAAA,KAACT;YAAIK,KAAKA;YAAKO,IAAI;gBAAC,WAAW;oBAACC,QAAQ;gBAAa;YAAC;WAAOH;sBACxDF;;wBAIT;kBAAGA;MACN;AAAD;AAGR,OAAO,IAAMM,4BAA4BX,2BACrCC,4BACF"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n Center,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n Selectors,\n Space,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader, Monaco} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\nimport {XML} from './languages/xml';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n /**\n * Defines how the monaco editor files will be loaded.\n * Note that using `'local'` requires [some additional configuration](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package).\n *\n * @default 'local'\n */\n monacoLoader?: 'cdn' | 'local';\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n monacoLoader: 'local',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n monacoLoader,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const [loaded, setLoaded] = useState(false);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const loadLocalMonaco = async () => {\n const monacoInstance = await import('monaco-editor');\n loader.config({monaco: monacoInstance});\n setLoaded(true);\n };\n\n const registerLanguages = (monaco: Monaco) => {\n if (monaco && language === 'xml') {\n XML.register(monaco);\n }\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description {...descriptionProps}>{description}</Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : (\n <Space h=\"xs\" />\n );\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor, monaco) => {\n registerLanguages(monaco);\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n ) : (\n <Center className={classes.editor}>\n <Loader />\n </Center>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CheckSize16Px","CopySize16Px","ActionIcon","Box","Center","CopyButton","createStyles","Group","Input","Loader","Space","Stack","Tooltip","useComponentDefaultProps","useUncontrolled","Editor","loader","useEffect","useState","useParentHeight","XML","useStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","monacoLoader","defaultValue","minHeight","CodeEditor","props","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","loaded","setLoaded","classes","finalValue","_value","handleChange","parentHeight","ref","loadLocalMonaco","monacoInstance","config","monaco","registerLanguages","register","_label","Label","_description","Description","_error","Error","mt","h","_header","_copyButton","position","timeout","copied","copy","withArrow","color","onClick","_editor","p","pl","className","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","spacing","sx","Math","max"],"mappings":"AAAA;;;;;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EAENC,KAAK,EACLC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,gBAAgB;AACvB,SAAQC,eAAe,QAAO,iBAAiB;AAC/C,OAAOC,UAASC,MAAM,QAAe,uBAAuB;AAC5D,SAA2BC,SAAS,EAAEC,QAAQ,QAAO,QAAQ;AAE7D,SAAQC,eAAe,QAAO,cAAc;AAC5C,SAAQC,GAAG,QAAO,kBAAkB;AAEpC,IAAMC,YAAYf,aAAa,SAACgB;WAAW;QACvCC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBH,MAAMI,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcN,MAAMO,aAAa;YACjCC,iBAAiBR,MAAMS,WAAW,KAAK,UAAUT,MAAMU,KAAK,GAAGV,MAAMW,KAAK;YAC1EC,QAAQ;QACZ;IACJ;;AA6CA,IAAMC,eAAyC;IAC3CC,UAAU;IACVC,cAAc;IACdC,cAAc;IACdC,WAAW;AACf;AAEA,OAAO,IAAMC,aAAiD,SAACC,OAAU;IACrE,IAkBI5B,4BAAAA,yBAAyB,cAA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W;gBACzBC,kBAAkBD;gBAClB1C,OAAOgF,oBAAoB,CAAC7D;gBAC5BnB,OAAOiF,mBAAmB,eAAC,oBAAA,WAAY;;;;gCACnC;;oCAAMjF,OAAOkF,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,KAACvG;QAAOqF,WAAWhC,QAAQjC,MAAM;kBAC7B,cAAA,KAACf;MAER;IAED,qBACI,MAACE;QACGiG,SAAQ;QACRnB,WAAWhC,QAAQlC,IAAI;QACvBsF,SAAS;QACTC,IAAI;YAAC5E,QAAQ6E,KAAKC,GAAG,CAACnD,cAActB;YAAYa,WAAAA;QAAS;QACzDU,KAAKA;OACDR;;YAEHuB;YACAC;YACAQ;YACAb;;;AAGb,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/code-editor/CodeEditor.tsx"],"sourcesContent":["import {CheckSize16Px, CopySize16Px} from '@coveord/plasma-react-icons';\nimport {\n ActionIcon,\n Box,\n Center,\n CopyButton,\n createStyles,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n Loader,\n Selectors,\n Space,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {useUncontrolled} from '@mantine/hooks';\nimport Editor, {loader, Monaco} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect, useState} from 'react';\n\nimport {useParentHeight} from '../../hooks';\nimport {XML} from './languages/xml';\n\nconst useStyles = createStyles((theme) => ({\n root: {},\n editor: {\n border: `1px solid ${theme.colors.gray[2]}`,\n borderRadius: theme.defaultRadius,\n backgroundColor: theme.colorScheme === 'light' ? theme.white : theme.black,\n height: '100%',\n },\n}));\n\ninterface CodeEditorProps\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The language syntax of the editor\n *\n * @default 'plaintext'\n */\n language?: 'plaintext' | 'json' | 'markdown' | 'python' | 'xml';\n /** Default value for uncontrolled input */\n defaultValue?: string;\n /** Value for controlled input */\n value?: string;\n /** onChange value for controlled input */\n onChange?(value: string): void;\n /** Called whenever the code editor gets the focus */\n onFocus?(): void;\n /**\n * The minimal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height is too short, it will use this value as minimum.\n *\n * @default 300\n */\n minHeight?: number;\n /**\n * The maximal height of the CodeEditor (label and description included)\n *\n * By default the CodeEditor is adjusted to fill its parent height.\n * In the case where the parent height would be too high for your liking, you can use this prop to set a maximum.\n */\n maxHeight?: number;\n disabled?: boolean;\n /**\n * Defines how the monaco editor files will be loaded.\n * Note that using `'local'` requires [some additional configuration](https://github.com/suren-atoyan/monaco-react#use-monaco-editor-as-an-npm-package).\n *\n * @default 'local'\n */\n monacoLoader?: 'cdn' | 'local';\n}\n\nconst defaultProps: Partial<CodeEditorProps> = {\n language: 'plaintext',\n monacoLoader: 'local',\n defaultValue: '',\n minHeight: 300,\n};\n\nexport const CodeEditor: FunctionComponent<CodeEditorProps> = (props) => {\n const {\n language,\n defaultValue,\n onChange,\n onFocus,\n value,\n label,\n required,\n labelProps,\n error,\n errorProps,\n description,\n descriptionProps,\n minHeight,\n maxHeight,\n disabled,\n monacoLoader,\n ...others\n } = useComponentDefaultProps('CodeEditor', defaultProps, props);\n const [loaded, setLoaded] = useState(false);\n const {classes, theme} = useStyles();\n const [_value, handleChange] = useUncontrolled<string>({\n value,\n defaultValue,\n onChange,\n finalValue: '',\n });\n const [parentHeight, ref] = useParentHeight();\n\n const loadLocalMonaco = async () => {\n const monacoInstance = await import('monaco-editor');\n loader.config({monaco: monacoInstance});\n setLoaded(true);\n };\n\n const registerLanguages = (monaco: Monaco) => {\n if (monaco && language === 'xml') {\n XML.register(monaco);\n }\n };\n\n useEffect(() => {\n if (monacoLoader === 'local') {\n loadLocalMonaco();\n } else {\n setLoaded(true);\n }\n }, []);\n\n const _label = label ? (\n <Input.Label required={required} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description {...descriptionProps}>{description}</Input.Description>\n ) : null;\n\n const _error = error ? (\n <Input.Error mt=\"xs\" {...errorProps}>\n {error}\n </Input.Error>\n ) : (\n <Space h=\"xs\" />\n );\n\n const _header =\n _label || _description ? (\n <Box>\n {_label}\n {_description}\n </Box>\n ) : null;\n\n const _copyButton = (\n <Group position=\"right\">\n <CopyButton value={_value} timeout={2000}>\n {({copied, copy}) => (\n <Tooltip label={copied ? 'Copied' : 'Copy'} withArrow position=\"right\">\n <ActionIcon color={copied ? 'lime' : 'gray'} onClick={copy}>\n {copied ? <CheckSize16Px height={16} /> : <CopySize16Px height={16} />}\n </ActionIcon>\n </Tooltip>\n )}\n </CopyButton>\n </Group>\n );\n\n const _editor = loaded ? (\n <Box p=\"md\" pl=\"xs\" className={classes.editor}>\n <Editor\n defaultLanguage={language}\n theme={theme.colorScheme === 'light' ? 'light' : 'vs-dark'}\n options={{\n minimap: {enabled: false},\n wordWrap: 'on',\n wrappingStrategy: 'advanced',\n scrollBeyondLastLine: false,\n formatOnPaste: true,\n fontSize: theme.fontSizes.xs,\n readOnly: disabled,\n tabSize: 2,\n }}\n value={_value}\n onChange={handleChange}\n onMount={(editor, monaco) => {\n registerLanguages(monaco);\n editor.onDidFocusEditorText(onFocus);\n editor.onDidBlurEditorText(async () => {\n await editor.getAction('editor.action.formatDocument').run();\n });\n }}\n />\n </Box>\n ) : (\n <Center className={classes.editor}>\n <Loader />\n </Center>\n );\n\n return (\n <Stack\n justify=\"flex-start\"\n className={classes.root}\n spacing={0}\n sx={{height: Math.max(parentHeight, minHeight), maxHeight}}\n ref={ref}\n {...others}\n >\n {_header}\n {_copyButton}\n {_editor}\n {_error}\n </Stack>\n );\n};\n"],"names":["CheckSize16Px","CopySize16Px","ActionIcon","Box","Center","CopyButton","createStyles","Group","Input","Loader","Space","Stack","Tooltip","useComponentDefaultProps","useUncontrolled","Editor","loader","useEffect","useState","useParentHeight","XML","useStyles","theme","root","editor","border","colors","gray","borderRadius","defaultRadius","backgroundColor","colorScheme","white","black","height","defaultProps","language","monacoLoader","defaultValue","minHeight","CodeEditor","props","onChange","onFocus","value","label","required","labelProps","error","errorProps","description","descriptionProps","maxHeight","disabled","others","loaded","setLoaded","classes","finalValue","_value","handleChange","parentHeight","ref","loadLocalMonaco","monacoInstance","config","monaco","registerLanguages","register","_label","Label","_description","Description","_error","Error","mt","h","_header","_copyButton","position","timeout","copied","copy","withArrow","color","onClick","_editor","p","pl","className","defaultLanguage","options","minimap","enabled","wordWrap","wrappingStrategy","scrollBeyondLastLine","formatOnPaste","fontSize","fontSizes","xs","readOnly","tabSize","onMount","onDidFocusEditorText","onDidBlurEditorText","getAction","run","justify","spacing","sx","Math","max"],"mappings":";;;;;;;AAAA,SAAQA,aAAa,EAAEC,YAAY,QAAO,8BAA8B;AACxE,SACIC,UAAU,EACVC,GAAG,EACHC,MAAM,EACNC,UAAU,EACVC,YAAY,EAEZC,KAAK,EACLC,KAAK,EAELC,MAAM,EAENC,KAAK,EACLC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,gBAAgB;AACvB,SAAQC,eAAe,QAAO,iBAAiB;AAC/C,OAAOC,UAASC,MAAM,QAAe,uBAAuB;AAC5D,SAA2BC,SAAS,EAAEC,QAAQ,QAAO,QAAQ;AAE7D,SAAQC,eAAe,QAAO,cAAc;AAC5C,SAAQC,GAAG,QAAO,kBAAkB;AAEpC,IAAMC,YAAYf,aAAa,SAACgB;WAAW;QACvCC,MAAM,CAAC;QACPC,QAAQ;YACJC,QAAQ,AAAC,aAAiC,OAArBH,MAAMI,MAAM,CAACC,IAAI,CAAC,EAAE;YACzCC,cAAcN,MAAMO,aAAa;YACjCC,iBAAiBR,MAAMS,WAAW,KAAK,UAAUT,MAAMU,KAAK,GAAGV,MAAMW,KAAK;YAC1EC,QAAQ;QACZ;IACJ;;AA6CA,IAAMC,eAAyC;IAC3CC,UAAU;IACVC,cAAc;IACdC,cAAc;IACdC,WAAW;AACf;A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AS;YACb;YACA1D,OAAOe;YACPjB,UAAUkB;YACV2C,SAAS,SAAC/E,QAAQ0C,QAAW;gBACzBC,kBAAkBD;gBAClB1C,OAAOgF,oBAAoB,CAAC7D;gBAC5BnB,OAAOiF,mBAAmB,eAAC,oBAAA,WAAY;;;;gCACnC;;oCAAMjF,OAAOkF,SAAS,CAAC,gCAAgCC,GAAG;;;gCAA1D;;;;;;gBACJ;YACJ;;uBAIR,KAACvG;QAAOqF,WAAWhC,QAAQjC,MAAM;kBAC7B,cAAA,KAACf;MAER;IAED,qBACI,MAACE;QACGiG,SAAQ;QACRnB,WAAWhC,QAAQlC,IAAI;QACvBsF,SAAS;QACTC,IAAI;YAAC5E,QAAQ6E,KAAKC,GAAG,CAACnD,cAActB;YAAYa,WAAAA;QAAS;QACzDU,KAAKA;OACDR;;YAEHuB;YACAC;YACAQ;YACAb;;;AAGb,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/components/code-editor/__mocks__/@monaco-editor/react.tsx"],"sourcesContent":["import {EditorProps} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect} from 'react';\n\nconst editor: any = {\n onDidFocusEditorText: jest.fn(),\n onDidBlurEditorText: jest.fn(),\n};\n\nconst monaco: any = jest.fn();\n\nconst MockedEditor: FunctionComponent<EditorProps> = (props) => {\n useEffect(() => {\n props.onMount(editor, monaco);\n }, []);\n return <div data-testid=\"monaco-editor\" />;\n};\n\nexport default MockedEditor;\n\nexport const loader = {\n config: jest.fn(),\n};\n\nexport const useMonaco = () => jest.fn();\n"],"names":["useEffect","editor","onDidFocusEditorText","jest","fn","onDidBlurEditorText","monaco","MockedEditor","props","onMount","div","data-testid","loader","config","useMonaco"],"mappings":"AAAA;AACA,SAA2BA,SAAS,QAAO,QAAQ;AAEnD,IAAMC,SAAc;IAChBC,sBAAsBC,KAAKC,EAAE;IAC7BC,qBAAqBF,KAAKC,EAAE;AAChC;AAEA,IAAME,SAAcH,KAAKC,EAAE;AAE3B,IAAMG,eAA+C,SAACC,OAAU;IAC5DR,UAAU,WAAM;QACZQ,MAAMC,OAAO,CAACR,QAAQK;IAC1B,GAAG,EAAE;IACL,qBAAO,KAACI;QAAIC,eAAY;;AAC5B;AAEA,eAAeJ,aAAa;AAE5B,OAAO,IAAMK,SAAS;IAClBC,QAAQV,KAAKC,EAAE;AACnB,EAAE;AAEF,OAAO,IAAMU,YAAY;WAAMX,KAAKC,EAAE;EAAG"}
1
+ {"version":3,"sources":["../../../../../../src/components/code-editor/__mocks__/@monaco-editor/react.tsx"],"sourcesContent":["import {EditorProps} from '@monaco-editor/react';\nimport {FunctionComponent, useEffect} from 'react';\n\nconst editor: any = {\n onDidFocusEditorText: jest.fn(),\n onDidBlurEditorText: jest.fn(),\n};\n\nconst monaco: any = jest.fn();\n\nconst MockedEditor: FunctionComponent<EditorProps> = (props) => {\n useEffect(() => {\n props.onMount(editor, monaco);\n }, []);\n return <div data-testid=\"monaco-editor\" />;\n};\n\nexport default MockedEditor;\n\nexport const loader = {\n config: jest.fn(),\n};\n\nexport const useMonaco = () => jest.fn();\n"],"names":["useEffect","editor","onDidFocusEditorText","jest","fn","onDidBlurEditorText","monaco","MockedEditor","props","onMount","div","data-testid","loader","config","useMonaco"],"mappings":";AACA,SAA2BA,SAAS,QAAO,QAAQ;AAEnD,IAAMC,SAAc;IAChBC,sBAAsBC,KAAKC,EAAE;IAC7BC,qBAAqBF,KAAKC,EAAE;AAChC;AAEA,IAAME,SAAcH,KAAKC,EAAE;AAE3B,IAAMG,eAA+C,SAACC,OAAU;IAC5DR,UAAU,WAAM;QACZQ,MAAMC,OAAO,CAACR,QAAQK;IAC1B,GAAG,EAAE;IACL,qBAAO,KAACI;QAAIC,eAAY;;AAC5B;AAEA,eAAeJ,aAAa;AAE5B,OAAO,IAAMK,SAAS;IAClBC,QAAQV,KAAKC,EAAE;AACnB,EAAE;AAEF,OAAO,IAAMU,YAAY;WAAMX,KAAKC,EAAE;EAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/components/code-editor/languages/xml.ts"],"sourcesContent":["import {Monaco} from '@monaco-editor/react';\n\nconst format = (xml: string): string => {\n // https://stackoverflow.com/questions/57039218/doesnt-monaco-editor-support-xml-language-by-default\n const PADDING = ' '.repeat(2);\n const reg = /(>)(<)(\\/*)/g;\n let pad = 0;\n\n xml = xml.replace(reg, '$1\\r\\n$2$3');\n\n return xml\n .split('\\r\\n')\n .map((node) => {\n let indent = 0;\n if (node.match(/.+<\\/\\w[^>]*>$/)) {\n indent = 0;\n } else if (node.match(/^<\\/\\w/) && pad > 0) {\n pad -= 1;\n } else if (node.match(/^<\\w[^>]*[^/]>.*$/)) {\n indent = 1;\n } else {\n indent = 0;\n }\n\n pad += indent;\n\n return PADDING.repeat(pad - indent) + node;\n })\n .join('\\r\\n');\n};\n\nconst register = (monaco: Monaco): void => {\n monaco.languages.registerDocumentFormattingEditProvider('xml', {\n provideDocumentFormattingEdits: async (model) => [\n {\n range: model.getFullModelRange(),\n text: format(model.getValue()),\n },\n ],\n });\n};\n\nexport const XML = {register};\n"],"names":["format","xml","PADDING","repeat","reg","pad","replace","split","map","node","indent","match","join","register","monaco","languages","registerDocumentFormattingEditProvider","provideDocumentFormattingEdits","model","range","getFullModelRange","text","getValue","XML"],"mappings":"AAAA;;AAEA,IAAMA,SAAS,SAACC,KAAwB;IACpC,oGAAoG;IACpG,IAAMC,UAAU,IAAIC,MAAM,CAAC;IAC3B,IAAMC,MAAM;IACZ,IAAIC,MAAM;IAEVJ,MAAMA,IAAIK,OAAO,CAACF,KAAK;IAEvB,OAAOH,IACFM,KAAK,CAAC,QACNC,GAAG,CAAC,SAACC,MAAS;QACX,IAAIC,SAAS;QACb,IAAID,KAAKE,KAAK,CAAC,mBAAmB;YAC9BD,SAAS;QACb,OAAO,IAAID,KAAKE,KAAK,CAAC,aAAaN,MAAM,GAAG;YACxCA,OAAO;QACX,OAAO,IAAII,KAAKE,KAAK,CAAC,sBAAsB;YACxCD,SAAS;QACb,OAAO;YACHA,SAAS;QACb,CAAC;QAEDL,OAAOK;QAEP,OAAOR,QAAQC,MAAM,CAACE,MAAMK,UAAUD;IAC1C,GACCG,IAAI,CAAC;AACd;AAEA,IAAMC,WAAW,SAACC,QAAyB;IACvCA,OAAOC,SAAS,CAACC,sCAAsC,CAAC,OAAO;QAC3DC,8BAA8B;uBAAE,oBAAA,SAAOC;;oBAAU;;;4BAC7C;gCACIC,OAAOD,MAAME,iBAAiB;gCAC9BC,MAAMrB,OAAOkB,MAAMI,QAAQ;4BAC/B;;;;;4BAJmCJ;;;;IAM3C;AACJ;AAEA,OAAO,IAAMK,MAAM;IAACV,UAAAA;AAAQ,EAAE"}
1
+ {"version":3,"sources":["../../../../../src/components/code-editor/languages/xml.ts"],"sourcesContent":["import {Monaco} from '@monaco-editor/react';\n\nconst format = (xml: string): string => {\n // https://stackoverflow.com/questions/57039218/doesnt-monaco-editor-support-xml-language-by-default\n const PADDING = ' '.repeat(2);\n const reg = /(>)(<)(\\/*)/g;\n let pad = 0;\n\n xml = xml.replace(reg, '$1\\r\\n$2$3');\n\n return xml\n .split('\\r\\n')\n .map((node) => {\n let indent = 0;\n if (node.match(/.+<\\/\\w[^>]*>$/)) {\n indent = 0;\n } else if (node.match(/^<\\/\\w/) && pad > 0) {\n pad -= 1;\n } else if (node.match(/^<\\w[^>]*[^/]>.*$/)) {\n indent = 1;\n } else {\n indent = 0;\n }\n\n pad += indent;\n\n return PADDING.repeat(pad - indent) + node;\n })\n .join('\\r\\n');\n};\n\nconst register = (monaco: Monaco): void => {\n monaco.languages.registerDocumentFormattingEditProvider('xml', {\n provideDocumentFormattingEdits: async (model) => [\n {\n range: model.getFullModelRange(),\n text: format(model.getValue()),\n },\n ],\n });\n};\n\nexport const XML = {register};\n"],"names":["format","xml","PADDING","repeat","reg","pad","replace","split","map","node","indent","match","join","register","monaco","languages","registerDocumentFormattingEditProvider","provideDocumentFormattingEdits","model","range","getFullModelRange","text","getValue","XML"],"mappings":";;AAEA,IAAMA,SAAS,SAACC,KAAwB;IACpC,oGAAoG;IACpG,IAAMC,UAAU,IAAIC,MAAM,CAAC;IAC3B,IAAMC,MAAM;IACZ,IAAIC,MAAM;IAEVJ,MAAMA,IAAIK,OAAO,CAACF,KAAK;IAEvB,OAAOH,IACFM,KAAK,CAAC,QACNC,GAAG,CAAC,SAACC,MAAS;QACX,IAAIC,SAAS;QACb,IAAID,KAAKE,KAAK,CAAC,mBAAmB;YAC9BD,SAAS;QACb,OAAO,IAAID,KAAKE,KAAK,CAAC,aAAaN,MAAM,GAAG;YACxCA,OAAO;QACX,OAAO,IAAII,KAAKE,KAAK,CAAC,sBAAsB;YACxCD,SAAS;QACb,OAAO;YACHA,SAAS;QACb,CAAC;QAEDL,OAAOK;QAEP,OAAOR,QAAQC,MAAM,CAACE,MAAMK,UAAUD;IAC1C,GACCG,IAAI,CAAC;AACd;AAEA,IAAMC,WAAW,SAACC,QAAyB;IACvCA,OAAOC,SAAS,CAACC,sCAAsC,CAAC,OAAO;QAC3DC,8BAA8B;uBAAE,oBAAA,SAAOC;;oBAAU;;;4BAC7C;gCACIC,OAAOD,MAAME,iBAAiB;gCAC9BC,MAAMrB,OAAOkB,MAAMI,QAAQ;4BAC/B;;;;;4BAJmCJ;;;;IAM3C;AACJ;AAEA,OAAO,IAAMK,MAAM;IAACV,UAAAA;AAAQ,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {\n Box,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n MantineNumberSize,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {ReorderPayload} from '@mantine/form/lib/types';\nimport {useDidUpdate, useId} from '@mantine/hooks';\nimport {ReactNode} from 'react';\nimport {DragDropContext, Droppable} from 'react-beautiful-dnd';\n\nimport {Button} from '../button';\nimport useStyles from './Collection.styles';\nimport {CollectionItem} from './CollectionItem';\n\ninterface CollectionProps<T>\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The default value each new item should have\n */\n newItem: T;\n /**\n * A render function called for each item passed in the `value` prop.\n *\n * @param item The current item's value\n * @param index The current item's index\n */\n children: (item: T, index: number) => ReactNode;\n /**\n * The list of items to display inside the collection\n *\n * @default []\n */\n value?: T[];\n /**\n * Unused, has no effect\n */\n onFocus?: () => void;\n /**\n * Function called whenever the value needs to be updated\n *\n * @param value The whole list of items after the change\n */\n onChange?: (value: T[]) => void;\n /**\n * Function called after an item is removed from the collection using the remove button\n *\n * @param itemIndex The index of the item that was removed\n */\n onRemoveItem?: (itemIndex: number) => void;\n /**\n * Function that gets called whenever a collection item needs to be reordered\n *\n * @param payload The origin and destination index of the item to reorder\n */\n onReorderItem?: (payload: ReorderPayload) => void;\n /**\n * Function that gets called when a new item needs to be added to the collection\n *\n * @param value The the value of the item to insert\n * @param index The index of the new item to insert\n */\n onInsertItem?: (value: T, index: number) => void;\n /**\n * Whether the collection should have drag and drop behavior enabled\n *\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether the collection is disabled, or in other words in read only mode\n *\n * @default false\n */\n disabled?: boolean;\n /**\n * Function that determines if the add item button should be enabled given the current items of the collection.\n * The button is always enabled if this props remains undefined\n *\n * @param values The current items of the collection\n */\n allowAdd?: (values: T[]) => boolean;\n /**\n * The label of the add item button\n *\n * @default \"Add item\"\n */\n addLabel?: string;\n /**\n * The tooltip text displayed when hovering over the disabled add item button\n *\n * @default 'There is already an empty item'\n */\n addDisabledTooltip?: string;\n /**\n * The spacing between the colleciton items\n *\n * @default 'xs'\n */\n spacing?: MantineNumberSize;\n /**\n * Whether the collection is required. When required is true, the collection will hide the remove button if there is only one item\n *\n * @default false\n */\n required?: boolean;\n}\n\nconst defaultProps: Partial<CollectionProps<unknown>> = {\n draggable: false,\n addLabel: 'Add item',\n addDisabledTooltip: 'There is already an empty item',\n disabled: false,\n spacing: 'xs',\n required: false,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T>) => {\n const {\n value,\n onChange,\n onRemoveItem,\n onReorderItem,\n onInsertItem,\n disabled,\n draggable,\n children,\n spacing,\n required,\n newItem,\n addLabel,\n addDisabledTooltip,\n allowAdd,\n label,\n labelProps,\n withAsterisk,\n description,\n descriptionProps,\n error,\n errorProps,\n\n // Style props\n classNames,\n className,\n styles,\n unstyled,\n\n ...others\n } = useComponentDefaultProps('Collection', defaultProps as CollectionProps<T>, props);\n const {classes, cx} = useStyles(null, {classNames, name: 'Collection', styles, unstyled});\n const collectionID = useId('dnd-droppable');\n\n const hasOnlyOneItem = value.length === 1;\n\n /**\n * Enforcing onChange when the value is modified will make sure the errors are carried through.\n */\n useDidUpdate(() => {\n onChange?.(value);\n }, [JSON.stringify(value)]);\n\n const isRequired = typeof withAsterisk === 'boolean' ? withAsterisk : required;\n const _label = label ? (\n <Input.Label required={isRequired} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description {...descriptionProps}>{description}</Input.Description>\n ) : null;\n const _error = error ? <Input.Error {...errorProps}>{error}</Input.Error> : null;\n const _header =\n _label || _description ? (\n <>\n {_label}\n {_description}\n </>\n ) : null;\n\n const items = value.map((item, index) => (\n <CollectionItem\n key={index}\n disabled={disabled}\n draggable={draggable}\n index={index}\n onRemove={() => onRemoveItem?.(index)}\n styles={styles}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item, index)}\n </CollectionItem>\n ));\n\n const addAllowed = allowAdd?.(value) ?? true;\n\n const _addButton = disabled ? null : (\n <Group>\n <Tooltip label={addDisabledTooltip} disabled={addAllowed}>\n <Box>\n <Button\n variant=\"subtle\"\n leftIcon={<AddSize16Px height={16} />}\n onClick={() => onInsertItem(newItem, value?.length ?? 0)}\n disabled={!addAllowed}\n >\n {addLabel}\n </Button>\n </Box>\n </Tooltip>\n </Group>\n );\n\n return (\n <DragDropContext\n onDragEnd={({destination, source}) => onReorderItem({from: source.index, to: destination?.index || 0})}\n >\n <Droppable direction=\"vertical\" droppableId={collectionID}>\n {(provided) => (\n <Box\n {...provided.droppableProps}\n ref={provided.innerRef}\n className={cx(classes.root, className)}\n {...others}\n >\n {_header}\n <Stack spacing={spacing}>\n {items}\n {provided.placeholder}\n {_addButton}\n {_error}\n </Stack>\n </Box>\n )}\n </Droppable>\n </DragDropContext>\n );\n};\n"],"names":["AddSize16Px","Box","Group","Input","Stack","Tooltip","useComponentDefaultProps","useDidUpdate","useId","DragDropContext","Droppable","Button","useStyles","CollectionItem","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","spacing","required","Collection","props","value","onChange","onRemoveItem","onReorderItem","onInsertItem","children","newItem","allowAdd","label","labelProps","withAsterisk","description","descriptionProps","error","errorProps","classNames","className","styles","unstyled","others","name","classes","cx","collectionID","hasOnlyOneItem","length","JSON","stringify","isRequired","_label","Label","_description","Description","_error","Error","_header","items","map","item","index","onRemove","removable","addAllowed","_addButton","variant","leftIcon","height","onClick","onDragEnd","destination","source","from","to","direction","droppableId","provided","droppableProps","ref","innerRef","root","placeholder"],"mappings":"AAAA;;;;AAAA,SAAQA,WAAW,QAAO,8BAA8B;AACxD,SACIC,GAAG,EAEHC,KAAK,EACLC,KAAK,EAILC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,gBAAgB;AAEvB,SAAQC,YAAY,EAAEC,KAAK,QAAO,iBAAiB;AAEnD,SAAQC,eAAe,EAAEC,SAAS,QAAO,sBAAsB;AAE/D,SAAQC,MAAM,QAAO,YAAY;AACjC,OAAOC,eAAe,sBAAsB;AAC5C,SAAQC,cAAc,QAAO,mBAAmB;AAgGhD,IAAMC,eAAkD;IACpDC,WAAW,KAAK;IAChBC,UAAU;IACVC,oBAAoB;IACpBC,UAAU,KAAK;IACfC,SAAS;IACTC,UAAU,KAAK;AACnB;AAEA,OAAO,IAAMC,aAAa,SAAKC,OAA8B;IACzD,IA8BIhB,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AAK;gBAAEa,IAAIH,CAAAA,wBAAAA,yBAAAA,KAAAA,IAAAA,YAAaV,KAAK,AAAD,KAAK;YAAC;;kBAEpG,cAAA,KAACpD;YAAUkE,WAAU;YAAWC,aAAa/B;sBACxC,SAACgC;qCACE,MAAC7E,iFACO6E,SAASC,cAAc;oBAC3BC,KAAKF,SAASG,QAAQ;oBACtB1C,WAAWM,GAAGD,QAAQsC,IAAI,EAAE3C;oBACxBG;;wBAEHgB;sCACD,MAACtD;4BAAMe,SAASA;;gCACXwC;gCACAmB,SAASK,WAAW;gCACpBjB;gCACAV;;;;;;;;AAO7B,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/collection/Collection.tsx"],"sourcesContent":["import {AddSize16Px} from '@coveord/plasma-react-icons';\nimport {\n Box,\n DefaultProps,\n Group,\n Input,\n InputWrapperBaseProps,\n MantineNumberSize,\n Selectors,\n Stack,\n Tooltip,\n useComponentDefaultProps,\n} from '@mantine/core';\nimport {ReorderPayload} from '@mantine/form/lib/types';\nimport {useDidUpdate, useId} from '@mantine/hooks';\nimport {ReactNode} from 'react';\nimport {DragDropContext, Droppable} from 'react-beautiful-dnd';\n\nimport {Button} from '../button';\nimport useStyles from './Collection.styles';\nimport {CollectionItem} from './CollectionItem';\n\ninterface CollectionProps<T>\n extends Omit<InputWrapperBaseProps, 'inputContainer' | 'inputWrapperOrder'>,\n DefaultProps<Selectors<typeof useStyles>> {\n /**\n * The default value each new item should have\n */\n newItem: T;\n /**\n * A render function called for each item passed in the `value` prop.\n *\n * @param item The current item's value\n * @param index The current item's index\n */\n children: (item: T, index: number) => ReactNode;\n /**\n * The list of items to display inside the collection\n *\n * @default []\n */\n value?: T[];\n /**\n * Unused, has no effect\n */\n onFocus?: () => void;\n /**\n * Function called whenever the value needs to be updated\n *\n * @param value The whole list of items after the change\n */\n onChange?: (value: T[]) => void;\n /**\n * Function called after an item is removed from the collection using the remove button\n *\n * @param itemIndex The index of the item that was removed\n */\n onRemoveItem?: (itemIndex: number) => void;\n /**\n * Function that gets called whenever a collection item needs to be reordered\n *\n * @param payload The origin and destination index of the item to reorder\n */\n onReorderItem?: (payload: ReorderPayload) => void;\n /**\n * Function that gets called when a new item needs to be added to the collection\n *\n * @param value The the value of the item to insert\n * @param index The index of the new item to insert\n */\n onInsertItem?: (value: T, index: number) => void;\n /**\n * Whether the collection should have drag and drop behavior enabled\n *\n * @default false\n */\n draggable?: boolean;\n /**\n * Whether the collection is disabled, or in other words in read only mode\n *\n * @default false\n */\n disabled?: boolean;\n /**\n * Function that determines if the add item button should be enabled given the current items of the collection.\n * The button is always enabled if this props remains undefined\n *\n * @param values The current items of the collection\n */\n allowAdd?: (values: T[]) => boolean;\n /**\n * The label of the add item button\n *\n * @default \"Add item\"\n */\n addLabel?: string;\n /**\n * The tooltip text displayed when hovering over the disabled add item button\n *\n * @default 'There is already an empty item'\n */\n addDisabledTooltip?: string;\n /**\n * The spacing between the colleciton items\n *\n * @default 'xs'\n */\n spacing?: MantineNumberSize;\n /**\n * Whether the collection is required. When required is true, the collection will hide the remove button if there is only one item\n *\n * @default false\n */\n required?: boolean;\n}\n\nconst defaultProps: Partial<CollectionProps<unknown>> = {\n draggable: false,\n addLabel: 'Add item',\n addDisabledTooltip: 'There is already an empty item',\n disabled: false,\n spacing: 'xs',\n required: false,\n};\n\nexport const Collection = <T,>(props: CollectionProps<T>) => {\n const {\n value,\n onChange,\n onRemoveItem,\n onReorderItem,\n onInsertItem,\n disabled,\n draggable,\n children,\n spacing,\n required,\n newItem,\n addLabel,\n addDisabledTooltip,\n allowAdd,\n label,\n labelProps,\n withAsterisk,\n description,\n descriptionProps,\n error,\n errorProps,\n\n // Style props\n classNames,\n className,\n styles,\n unstyled,\n\n ...others\n } = useComponentDefaultProps('Collection', defaultProps as CollectionProps<T>, props);\n const {classes, cx} = useStyles(null, {classNames, name: 'Collection', styles, unstyled});\n const collectionID = useId('dnd-droppable');\n\n const hasOnlyOneItem = value.length === 1;\n\n /**\n * Enforcing onChange when the value is modified will make sure the errors are carried through.\n */\n useDidUpdate(() => {\n onChange?.(value);\n }, [JSON.stringify(value)]);\n\n const isRequired = typeof withAsterisk === 'boolean' ? withAsterisk : required;\n const _label = label ? (\n <Input.Label required={isRequired} {...labelProps}>\n {label}\n </Input.Label>\n ) : null;\n\n const _description = description ? (\n <Input.Description {...descriptionProps}>{description}</Input.Description>\n ) : null;\n const _error = error ? <Input.Error {...errorProps}>{error}</Input.Error> : null;\n const _header =\n _label || _description ? (\n <>\n {_label}\n {_description}\n </>\n ) : null;\n\n const items = value.map((item, index) => (\n <CollectionItem\n key={index}\n disabled={disabled}\n draggable={draggable}\n index={index}\n onRemove={() => onRemoveItem?.(index)}\n styles={styles}\n removable={!(required && hasOnlyOneItem)}\n >\n {children(item, index)}\n </CollectionItem>\n ));\n\n const addAllowed = allowAdd?.(value) ?? true;\n\n const _addButton = disabled ? null : (\n <Group>\n <Tooltip label={addDisabledTooltip} disabled={addAllowed}>\n <Box>\n <Button\n variant=\"subtle\"\n leftIcon={<AddSize16Px height={16} />}\n onClick={() => onInsertItem(newItem, value?.length ?? 0)}\n disabled={!addAllowed}\n >\n {addLabel}\n </Button>\n </Box>\n </Tooltip>\n </Group>\n );\n\n return (\n <DragDropContext\n onDragEnd={({destination, source}) => onReorderItem({from: source.index, to: destination?.index || 0})}\n >\n <Droppable direction=\"vertical\" droppableId={collectionID}>\n {(provided) => (\n <Box\n {...provided.droppableProps}\n ref={provided.innerRef}\n className={cx(classes.root, className)}\n {...others}\n >\n {_header}\n <Stack spacing={spacing}>\n {items}\n {provided.placeholder}\n {_addButton}\n {_error}\n </Stack>\n </Box>\n )}\n </Droppable>\n </DragDropContext>\n );\n};\n"],"names":["AddSize16Px","Box","Group","Input","Stack","Tooltip","useComponentDefaultProps","useDidUpdate","useId","DragDropContext","Droppable","Button","useStyles","CollectionItem","defaultProps","draggable","addLabel","addDisabledTooltip","disabled","spacing","required","Collection","props","value","onChange","onRemoveItem","onReorderItem","onInsertItem","children","newItem","allowAdd","label","labelProps","withAsterisk","description","descriptionProps","error","errorProps","classNames","className","styles","unstyled","others","name","classes","cx","collectionID","hasOnlyOneItem","length","JSON","stringify","isRequired","_label","Label","_description","Description","_error","Error","_header","items","map","item","index","onRemove","removable","addAllowed","_addButton","variant","leftIcon","height","onClick","onDragEnd","destination","source","from","to","direction","droppableId","provided","droppableProps","ref","innerRef","root","placeholder"],"mappings":";;;;AAAA,SAAQA,WAAW,QAAO,8BAA8B;AACxD,SACIC,GAAG,EAEHC,KAAK,EACLC,KAAK,EAILC,KAAK,EACLC,OAAO,EACPC,wBAAwB,QACrB,gBAAgB;AAEvB,SAAQC,YAAY,EAAEC,KAAK,QAAO,iBAAiB;AAEnD,SAAQC,eAAe,EAAEC,SAAS,QAAO,sBAAsB;AAE/D,SAAQC,MAAM,QAAO,YAAY;AACjC,OAAOC,eAAe,sBAAsB;AAC5C,SAAQC,cAAc,QAAO,mBAAmB;AAgGhD,IAAMC,eAAkD;IACpDC,WAAW,KAAK;IAChBC,UAAU;IACVC,oBAAoB;IACpBC,UAAU,KAAK;IACfC,SAAS;IACTC,UAAU,KAAK;AACnB;AAEA,OAAO,IAAMC,aAAa,SAAKC,OAA8B;IACzD,IA8BIhB,4BAAAA,yBAAyB,cAAcQ,cAAoCQ,QA7B3EC,QA6BAjB,0BA7BAiB,OACAC,WA4BAlB,0BA5BAkB,UACAC,eA2BAnB,0BA3BAmB,cACAC,gBA0BApB,0BA1BAoB,eACAC,eAyBArB,0BAzBAqB,cACAT,WAwBAZ,0BAxBAY,UACAH,YAuBAT,0BAvBAS,WACAa,WAsBAtB,0BAtBAsB,UACAT,UAqBAb,0BArBAa,SACAC,WAoBAd,0BApBAc,UACAS,UAmBAvB,0BAnBAuB,SACAb,WAkBAV,0BAlBAU,UACAC,qBAiBAX,0BAjBAW,oBACAa,WAgBAxB,0BAhBAwB,UACAC,QAeAzB,0BAfAyB,OACAC,aAcA1B,0BAdA0B,YACAC,eAaA3B,0BAbA2B,cACAC,cAYA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AAMtC,OAAAA,yBAAAA,0BAAAA,KAAAA,IAAAA,aAAeqC;;YAC/BtB,QAAQA;YACRwB,WAAW,CAAE5C,CAAAA,YAAY2B,cAAa;sBAErCnB,SAASiC,MAAMC;WARXA;;QAYMhC;IAAnB,IAAMmC,aAAanC,CAAAA,YAAAA,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAWP,oBAAXO,uBAAAA,YAAqB,IAAI;QASaP;IAPzD,IAAM2C,aAAahD,WAAW,IAAI,iBAC9B,KAAChB;kBACG,cAAA,KAACG;YAAQ0B,OAAOd;YAAoBC,UAAU+C;sBAC1C,cAAA,KAAChE;0BACG,cAAA,KAACU;oBACGwD,SAAQ;oBACRC,wBAAU,KAACpE;wBAAYqE,QAAQ;;oBAC/BC,SAAS;wBAAM3C,OAAAA,aAAaE,SAASN,CAAAA,gBAAAA,kBAAAA,mBAAAA,KAAAA,IAAAA,MAAOyB,MAAM,cAAbzB,2BAAAA,gBAAiB,CAAC;;oBACvDL,UAAU,CAAC+C;8BAEVjD;;;;MAKpB;IAED,qBACI,KAACP;QACG8D,WAAW;gBAAEC,oBAAAA,aAAaC,eAAAA;YAAY/C,OAAAA,cAAc;gBAACgD,MAAMD,OAAOX,KAAK;gBAAEa,IAAIH,CAAAA,wBAAAA,yBAAAA,KAAAA,IAAAA,YAAaV,KAAK,AAAD,KAAK;YAAC;;kBAEpG,cAAA,KAACpD;YAAUkE,WAAU;YAAWC,aAAa/B;sBACxC,SAACgC;qCACE,MAAC7E,iFACO6E,SAASC,cAAc;oBAC3BC,KAAKF,SAASG,QAAQ;oBACtB1C,WAAWM,GAAGD,QAAQsC,IAAI,EAAE3C;oBACxBG;;wBAEHgB;sCACD,MAACtD;4BAAMe,SAASA;;gCACXwC;gCACAmB,SAASK,WAAW;gCACpBjB;gCACAV;;;;;;;;AAO7B,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/collection/CollectionItem.tsx"],"sourcesContent":["import {DragAndDropSize16Px, RemoveSize16Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon, DefaultProps, Group, Selectors} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\nimport {Draggable} from 'react-beautiful-dnd';\n\nimport useStyles from './Collection.styles';\n\ninterface CollectionItemProps extends CollectionItemSharedProps {\n draggable?: boolean;\n disabled: boolean;\n}\n\ninterface CollectionItemSharedProps extends DefaultProps<Selectors<typeof useStyles>> {\n index: number;\n onRemove?: React.MouseEventHandler<HTMLButtonElement>;\n removable?: boolean;\n}\n\nconst RemoveButton: FunctionComponent<{\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n}> = ({onClick}) => (\n <ActionIcon variant=\"subtle\" onClick={onClick} color=\"action\">\n <RemoveSize16Px height={16} />\n </ActionIcon>\n);\n\nconst RemoveButtonPlaceholder = () => <div style={{width: 28}} />;\n\nconst StaticCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : <RemoveButtonPlaceholder />;\n\n return (\n <Group className={cx(classes.item)}>\n {children}\n {removeButton}\n </Group>\n );\n};\n\nconst DisabledCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n children,\n styles,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n return <Group className={cx(classes.item)}>{children}</Group>;\n};\n\nconst DraggableCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n index,\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : null;\n\n return (\n <Draggable index={index} draggableId={index.toString()}>\n {(provided, {isDragging}) => (\n <Group\n ref={provided.innerRef}\n {...provided.draggableProps}\n className={cx(classes.item, {[classes.itemDragging]: isDragging})}\n >\n <div {...provided.dragHandleProps}>\n <DragAndDropSize16Px height={16} />\n </div>\n {children}\n {removeButton}\n </Group>\n )}\n </Draggable>\n );\n};\n\nexport const CollectionItem: FunctionComponent<PropsWithChildren<CollectionItemProps>> = ({\n draggable,\n disabled,\n ...otherProps\n}) => {\n if (disabled) {\n return <DisabledCollectionItem {...otherProps} />;\n }\n if (draggable) {\n return <DraggableCollectionItem {...otherProps} />;\n }\n return <StaticCollectionItem {...otherProps} />;\n};\n"],"names":["DragAndDropSize16Px","RemoveSize16Px","ActionIcon","Group","Draggable","useStyles","RemoveButton","onClick","variant","color","height","RemoveButtonPlaceholder","div","style","width","StaticCollectionItem","onRemove","removable","styles","children","name","classes","cx","removeButton","className","item","DisabledCollectionItem","DraggableCollectionItem","index","draggableId","toString","provided","isDragging","ref","innerRef","draggableProps","itemDragging","dragHandleProps","CollectionItem","draggable","disabled","otherProps"],"mappings":"AAAA;;;;;AAAA,SAAQA,mBAAmB,EAAEC,cAAc,QAAO,8BAA8B;AAChF,SAAQC,UAAU,EAAgBC,KAAK,QAAkB,gBAAgB;AAEzE,SAAQC,SAAS,QAAO,sBAAsB;AAE9C,OAAOC,eAAe,sBAAsB;AAa5C,IAAMC,eAED;QAAEC,gBAAAA;yBACH,KAACL;QAAWM,SAAQ;QAASD,SAASA;QAASE,OAAM;kBACjD,cAAA,KAACR;YAAeS,QAAQ;;;;AAIhC,IAAMC,0BAA0B;yBAAM,KAACC;QAAIC,OAAO;YAACC,OAAO;QAAE;;;AAE5D,IAAMC,uBAAwF,gBAKxF;QAJFC,iBAAAA,mCACAC,WAAAA,0CAAY,IAAI,qBAChBC,eAAAA,QACAC,iBAAAA;IAEA,IAAsBd,aAAAA,UAAU,IAAI,EAAE;QAACe,MAAM;QAAcF,QAAAA;IAAM,IAA1DG,UAAehB,WAAfgB,SAASC,KAAMjB,WAANiB;IAChB,IAAMC,eAAeN,aAAaD,yBAAW,KAACV;QAAaC,SAASS;uBAAe,KAACL,4BAA0B;I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ources":["../../../../src/components/collection/CollectionItem.tsx"],"sourcesContent":["import {DragAndDropSize16Px, RemoveSize16Px} from '@coveord/plasma-react-icons';\nimport {ActionIcon, DefaultProps, Group, Selectors} from '@mantine/core';\nimport {FunctionComponent, PropsWithChildren} from 'react';\nimport {Draggable} from 'react-beautiful-dnd';\n\nimport useStyles from './Collection.styles';\n\ninterface CollectionItemProps extends CollectionItemSharedProps {\n draggable?: boolean;\n disabled: boolean;\n}\n\ninterface CollectionItemSharedProps extends DefaultProps<Selectors<typeof useStyles>> {\n index: number;\n onRemove?: React.MouseEventHandler<HTMLButtonElement>;\n removable?: boolean;\n}\n\nconst RemoveButton: FunctionComponent<{\n onClick: React.MouseEventHandler<HTMLButtonElement>;\n}> = ({onClick}) => (\n <ActionIcon variant=\"subtle\" onClick={onClick} color=\"action\">\n <RemoveSize16Px height={16} />\n </ActionIcon>\n);\n\nconst RemoveButtonPlaceholder = () => <div style={{width: 28}} />;\n\nconst StaticCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : <RemoveButtonPlaceholder />;\n\n return (\n <Group className={cx(classes.item)}>\n {children}\n {removeButton}\n </Group>\n );\n};\n\nconst DisabledCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n children,\n styles,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n return <Group className={cx(classes.item)}>{children}</Group>;\n};\n\nconst DraggableCollectionItem: FunctionComponent<PropsWithChildren<CollectionItemSharedProps>> = ({\n index,\n onRemove,\n removable = true,\n styles,\n children,\n}) => {\n const {classes, cx} = useStyles(null, {name: 'Collection', styles});\n const removeButton = removable && onRemove ? <RemoveButton onClick={onRemove} /> : null;\n\n return (\n <Draggable index={index} draggableId={index.toString()}>\n {(provided, {isDragging}) => (\n <Group\n ref={provided.innerRef}\n {...provided.draggableProps}\n className={cx(classes.item, {[classes.itemDragging]: isDragging})}\n >\n <div {...provided.dragHandleProps}>\n <DragAndDropSize16Px height={16} />\n </div>\n {children}\n {removeButton}\n </Group>\n )}\n </Draggable>\n );\n};\n\nexport const CollectionItem: FunctionComponent<PropsWithChildren<CollectionItemProps>> = ({\n draggable,\n disabled,\n ...otherProps\n}) => {\n if (disabled) {\n return <DisabledCollectionItem {...otherProps} />;\n }\n if (draggable) {\n return <DraggableCollectionItem {...otherProps} />;\n }\n return <StaticCollectionItem {...otherProps} />;\n};\n"],"names":["DragAndDropSize16Px","RemoveSize16Px","ActionIcon","Group","Draggable","useStyles","RemoveButton","onClick","variant","color","height","RemoveButtonPlaceholder","div","style","width","StaticCollectionItem","onRemove","removable","styles","children","name","classes","cx","removeButton","className","item","DisabledCollectionItem","DraggableCollectionItem","index","draggableId","toString","provided","isDragging","ref","innerRef","draggableProps","itemDragging","dragHandleProps","CollectionItem","draggable","disabled","otherProps"],"mappings":";;;;;AAAA,SAAQA,mBAAmB,EAAEC,cAAc,QAAO,8BAA8B;AAChF,SAAQC,UAAU,EAAgBC,KAAK,QAAkB,gBAAgB;AAEzE,SAAQC,SAAS,QAAO,sBAAsB;AAE9C,OAAOC,eAAe,sBAAsB;AAa5C,IAAMC,eAED;QAAEC,gBAAAA;yBACH,KAACL;QAAWM,SAAQ;QAASD,SAASA;QAASE,OAAM;kBACjD,cAAA,KAACR;YAAeS,QAAQ;;;;AAIhC,IAAMC,0BAA0B;yBAAM,KAACC;QAAIC,OAAO;YAACC,OAAO;QAAE;;;AAE5D,IAAMC,uBAAwF,gBAKxF;QAJFC,iBAAAA,mCACAC,WAAAA,0CAAY,IAAI,qBAChBC,eAAAA,QACAC,iBAAAA;IAEA,IAAsBd,aAAAA,UAAU,IAAI,EAAE;QAACe,MAAM;QAAcF,QAAAA;IAAM,IAA1DG,UAAehB,WAAfgB,SAASC,KAAMjB,WAANiB;IAChB,IAAMC,eAAeN,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,qBAAO,KAAC1B,yCAAyB0B;AACrC,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/date-range-picker/DateRangePickerInlineCalendar.tsx"],"sourcesContent":["import {Center, Group, Space} from '@mantine/core';\nimport {DateRangePickerValue, RangeCalendar, RangeCalendarProps} from '@mantine/dates';\nimport {useForm} from '@mantine/form';\n\nimport {Button} from '../button';\nimport {DateRangePickerPreset, DateRangePickerPresetSelect} from './DateRangePickerPresetSelect';\nimport {EditableDateRangePicker, EditableDateRangePickerProps} from './EditableDateRangePicker';\n\nexport interface DateRangePickerInlineCalendarProps\n extends Pick<EditableDateRangePickerProps, 'startProps' | 'endProps'> {\n /**\n * Initial selected range\n */\n initialRange: DateRangePickerValue;\n /**\n * Function called when the user applies the new date range\n *\n * @param range the newly selected dates\n */\n onApply: (range: DateRangePickerValue) => void;\n /**\n * Function called when the user click on the cancel button\n */\n onCancel: () => void;\n /**\n * The presets to display\n *\n * @default {}\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n */\n presets?: Record<string, DateRangePickerPreset>;\n /**\n * Props for RangeCalendar displayed in the popover\n */\n rangeCalendarProps?: Omit<RangeCalendarProps, 'value' | 'onChange'>;\n}\n\nexport const DateRangePickerInlineCalendar = ({\n initialRange,\n onApply,\n onCancel,\n presets,\n startProps,\n endProps,\n rangeCalendarProps,\n}: DateRangePickerInlineCalendarProps) => {\n const form = useForm({\n initialValues: {\n dates: initialRange,\n },\n });\n const calendarInputProps = form.getInputProps('dates');\n\n const onCalendarApply = () => {\n if (!form.values.dates[1]) {\n form.values.dates[1] = form.values.dates[0]; // when date range is the same day\n }\n onApply(form.values.dates);\n };\n\n return (\n <>\n <Group\n align=\"center\"\n spacing=\"xs\"\n grow\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderBottom: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <EditableDateRangePicker {...calendarInputProps} startProps={startProps} endProps={endProps} />\n {presets ? (\n <>\n <Space w=\"sm\" />\n <DateRangePickerPresetSelect presets={presets} {...calendarInputProps} />\n </>\n ) : null}\n </Group>\n\n <Center py=\"sm\" px=\"md\">\n <RangeCalendar\n amountOfMonths={2}\n styles={{cell: {textAlign: 'center'}}}\n firstDayOfWeek=\"sunday\"\n allowSingleDateInRange\n {...rangeCalendarProps}\n {...calendarInputProps}\n />\n </Center>\n\n <Group\n position=\"right\"\n spacing=\"xs\"\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderTop: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <Button size=\"xs\" onClick={onCalendarApply}>\n Apply\n </Button>\n <Button variant=\"outline\" size=\"xs\" onClick={onCancel}>\n Cancel\n </Button>\n </Group>\n </>\n );\n};\n"],"names":["Center","Group","Space","RangeCalendar","useForm","Button","DateRangePickerPresetSelect","EditableDateRangePicker","DateRangePickerInlineCalendar","initialRange","onApply","onCancel","presets","startProps","endProps","rangeCalendarProps","form","initialValues","dates","calendarInputProps","getInputProps","onCalendarApply","values","align","spacing","grow","px","py","sx","theme","borderBottom","colors","gray","w","amountOfMonths","styles","cell","textAlign","firstDayOfWeek","allowSingleDateInRange","position","borderTop","size","onClick","variant"],"mappings":"AAAA;;;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,KAAK,QAAO,gBAAgB;AACnD,SAA8BC,aAAa,QAA2B,iBAAiB;AACvF,SAAQC,OAAO,QAAO,gBAAgB;AAEtC,SAAQC,MAAM,QAAO,YAAY;AACjC,SAA+BC,2BAA2B,QAAO,gCAAgC;AACjG,SAAQC,uBAAuB,QAAqC,4BAA4B;AAmChG,OAAO,IAAMC,gCAAgC,gBAQH;QAPtCC,qBAAAA,cACAC,gBAAAA,SACAC,iBAAAA,UACAC,gBAAAA,SACAC,mBAAAA,YACAC,iBAAAA,UACAC,2BAAAA;IAEA,IAAMC,OAAOZ,QA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["../../../../src/components/date-range-picker/DateRangePickerInlineCalendar.tsx"],"sourcesContent":["import {Center, Group, Space} from '@mantine/core';\nimport {DateRangePickerValue, RangeCalendar, RangeCalendarProps} from '@mantine/dates';\nimport {useForm} from '@mantine/form';\n\nimport {Button} from '../button';\nimport {DateRangePickerPreset, DateRangePickerPresetSelect} from './DateRangePickerPresetSelect';\nimport {EditableDateRangePicker, EditableDateRangePickerProps} from './EditableDateRangePicker';\n\nexport interface DateRangePickerInlineCalendarProps\n extends Pick<EditableDateRangePickerProps, 'startProps' | 'endProps'> {\n /**\n * Initial selected range\n */\n initialRange: DateRangePickerValue;\n /**\n * Function called when the user applies the new date range\n *\n * @param range the newly selected dates\n */\n onApply: (range: DateRangePickerValue) => void;\n /**\n * Function called when the user click on the cancel button\n */\n onCancel: () => void;\n /**\n * The presets to display\n *\n * @default {}\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n */\n presets?: Record<string, DateRangePickerPreset>;\n /**\n * Props for RangeCalendar displayed in the popover\n */\n rangeCalendarProps?: Omit<RangeCalendarProps, 'value' | 'onChange'>;\n}\n\nexport const DateRangePickerInlineCalendar = ({\n initialRange,\n onApply,\n onCancel,\n presets,\n startProps,\n endProps,\n rangeCalendarProps,\n}: DateRangePickerInlineCalendarProps) => {\n const form = useForm({\n initialValues: {\n dates: initialRange,\n },\n });\n const calendarInputProps = form.getInputProps('dates');\n\n const onCalendarApply = () => {\n if (!form.values.dates[1]) {\n form.values.dates[1] = form.values.dates[0]; // when date range is the same day\n }\n onApply(form.values.dates);\n };\n\n return (\n <>\n <Group\n align=\"center\"\n spacing=\"xs\"\n grow\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderBottom: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <EditableDateRangePicker {...calendarInputProps} startProps={startProps} endProps={endProps} />\n {presets ? (\n <>\n <Space w=\"sm\" />\n <DateRangePickerPresetSelect presets={presets} {...calendarInputProps} />\n </>\n ) : null}\n </Group>\n\n <Center py=\"sm\" px=\"md\">\n <RangeCalendar\n amountOfMonths={2}\n styles={{cell: {textAlign: 'center'}}}\n firstDayOfWeek=\"sunday\"\n allowSingleDateInRange\n {...rangeCalendarProps}\n {...calendarInputProps}\n />\n </Center>\n\n <Group\n position=\"right\"\n spacing=\"xs\"\n px=\"md\"\n py=\"sm\"\n sx={(theme) => ({\n borderTop: `1px solid ${theme.colors.gray[2]}`,\n })}\n >\n <Button size=\"xs\" onClick={onCalendarApply}>\n Apply\n </Button>\n <Button variant=\"outline\" size=\"xs\" onClick={onCancel}>\n Cancel\n </Button>\n </Group>\n </>\n );\n};\n"],"names":["Center","Group","Space","RangeCalendar","useForm","Button","DateRangePickerPresetSelect","EditableDateRangePicker","DateRangePickerInlineCalendar","initialRange","onApply","onCancel","presets","startProps","endProps","rangeCalendarProps","form","initialValues","dates","calendarInputProps","getInputProps","onCalendarApply","values","align","spacing","grow","px","py","sx","theme","borderBottom","colors","gray","w","amountOfMonths","styles","cell","textAlign","firstDayOfWeek","allowSingleDateInRange","position","borderTop","size","onClick","variant"],"mappings":";;;AAAA,SAAQA,MAAM,EAAEC,KAAK,EAAEC,KAAK,QAAO,gBAAgB;AACnD,SAA8BC,aAAa,QAA2B,iBAAiB;AACvF,SAAQC,OAAO,QAAO,gBAAgB;AAEtC,SAAQC,MAAM,QAAO,YAAY;AACjC,SAA+BC,2BAA2B,QAAO,gCAAgC;AACjG,SAAQC,uBAAuB,QAAqC,4BAA4B;AAmChG,OAAO,IAAMC,gCAAgC,gBAQH;QAPtCC,qBAAAA,cACAC,gBAAAA,SACAC,iBAAAA,UACAC,gBAAAA,SACAC,mBAAAA,YACAC,iBAAAA,UACAC,2BAAAA;IAEA,IAAMC,OAAOZ,QAAQ;QACjBa,eAAe;YACXC,OAAOT;QACX;IACJ;IACA,IAAMU,qBAAqBH,KAAKI,aAAa,CAAC;IAE9C,IAAMC,kBAAkB,WAAM;QAC1B,IAAI,CAACL,KAAKM,MAAM,CAACJ,KAAK,CAAC,EAAE,EAAE;YACvBF,KAAKM,MAAM,CAACJ,KAAK,CAAC,EAAE,GAAGF,KAAKM,MAAM,CAACJ,KAAK,CAAC,EAAE,EAAE,kCAAkC;QACnF,CAAC;QACDR,QAAQM,KAAKM,MAAM,CAACJ,KAAK;IAC7B;IAEA,qBACI;;0BACI,MAACjB;gBACGsB,OAAM;gBACNC,SAAQ;gBACRC,IAAI;gBACJC,IAAG;gBACHC,IAAG;gBACHC,IAAI,SAACC;2BAAW;wBACZC,cAAc,AAAC,aAAiC,OAArBD,MAAME,MAAM,CAACC,IAAI,CAAC,EAAE;oBACnD;;;kCAEA,KAACzB,iEAA4BY;wBAAoBN,YAAYA;wBAAYC,UAAUA;;oBAClFF,wBACG;;0CACI,KAACV;gCAAM+B,GAAE;;0CACT,KAAC3B;gCAA4BM,SAASA;+BAAaO;;yBAEvD,IAAI;;;0BAGZ,KAACnB;gBAAO2B,IAAG;gBAAKD,IAAG;0BACf,cAAA,KAACvB;oBACG+B,gBAAgB;oBAChBC,QAAQ;wBAACC,MAAM;4BAACC,WAAW;wBAAQ;oBAAC;oBACpCC,gBAAe;oBACfC,sBAAsB;mBAClBxB,oBACAI;;0BAIZ,MAAClB;gBACGuC,UAAS;gBACThB,SAAQ;gBACRE,IAAG;gBACHC,IAAG;gBACHC,IAAI,SAACC;2BAAW;wBACZY,WAAW,AAAC,aAAiC,OAArBZ,MAAME,MAAM,CAACC,IAAI,CAAC,EAAE;oBAChD;;;kCAEA,KAAC3B;wBAAOqC,MAAK;wBAAKC,SAAStB;kCAAiB;;kCAG5C,KAAChB;wBAAOuC,SAAQ;wBAAUF,MAAK;wBAAKC,SAAShC;kCAAU;;;;;;AAMvE,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/date-range-picker/DateRangePickerPopoverCalendar.tsx"],"sourcesContent":["import {DateRangePickerValue, RangeCalendar, RangeCalendarProps} from '@mantine/dates';\nimport {Group, Popover, Space} from '@mantine/core';\nimport {useClickOutside, useUncontrolled} from '@mantine/hooks';\nimport {useState} from 'react';\n\nimport {EditableDateRangePicker, EditableDateRangePickerProps} from './EditableDateRangePicker';\nimport {DateRangePickerPresetSelect, DateRangePickerPreset} from './DateRangePickerPresetSelect';\n\ninterface DateRangePickerPopoverCalendarProps<T> extends Pick<EditableDateRangePickerProps, 'startProps' | 'endProps'> {\n /** Default value for uncontrolled input */\n defaultValue?: DateRangePickerValue;\n /** Value for controlled input */\n value?: DateRangePickerValue;\n /** onChange value for controlled input */\n onChange?(value: DateRangePickerValue): void;\n /**\n * The presets to display\n *\n * @default {}\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n */\n presets?: Record<string, DateRangePickerPreset>;\n\n /**\n * Props for RangeCalendar\n */\n rangeCalendarProps?: Omit<RangeCalendarProps, 'value' | 'onChange'>;\n}\n\nexport const DateRangePickerPopoverCalendar = <T extends unknown>({\n presets,\n value,\n defaultValue,\n onChange,\n startProps,\n endProps,\n rangeCalendarProps,\n}: DateRangePickerPopoverCalendarProps<T>) => {\n const [opened, setOpened] = useState(false);\n const ref = useClickOutside(() => setOpened(false));\n\n const [_value, handleChange] = useUncontrolled<DateRangePickerValue>({\n value,\n defaultValue,\n onChange,\n finalValue: [null, null],\n });\n\n const onCalendarChange = (dates: DateRangePickerValue) => {\n handleChange?.(dates);\n if (dates[1] !== null) {\n setOpened(false);\n }\n };\n\n return (\n <>\n <Group align=\"center\">\n <EditableDateRangePicker\n value={_value}\n onChange={handleChange}\n onFocus={() => setOpened(true)}\n startProps={startProps}\n endProps={endProps}\n />\n {presets ? (\n <>\n <Space w=\"sm\" />\n <DateRangePickerPresetSelect presets={presets} value={_value} onChange={handleChange} />\n </>\n ) : null}\n </Group>\n\n <Popover opened={opened} onChange={setOpened} trapFocus>\n <Popover.Dropdown>\n <RangeCalendar\n ref={ref}\n styles={{cell: {textAlign: 'center'}}}\n amountOfMonths={2}\n firstDayOfWeek=\"sunday\"\n allowSingleDateInRange\n value={_value}\n onChange={onCalendarChange}\n {...rangeCalendarProps}\n />\n </Popover.Dropdown>\n </Popover>\n </>\n );\n};\n"],"names":["RangeCalendar","Group","Popover","Space","useClickOutside","useUncontrolled","useState","EditableDateRangePicker","DateRangePickerPresetSelect","DateRangePickerPopoverCalendar","presets","value","defaultValue","onChange","startProps","endProps","rangeCalendarProps","opened","setOpened","ref","finalValue","_value","handleChange","onCalendarChange","dates","align","onFocus","w","trapFocus","Dropdown","styles","cell","textAlign","amountOfMonths","firstDayOfWeek","allowSingleDateInRange"],"mappings":"AAAA;;;AAAA,SAA8BA,aAAa,QAA2B,iBAAiB;AACvF,SAAQC,KAAK,EAAEC,OAAO,EAAEC,KAAK,QAAO,gBAAgB;AACpD,SAAQC,eAAe,EAAEC,eAAe,QAAO,iBAAiB;AAChE,SAAQC,QAAQ,QAAO,QAAQ;AAE/B,SAAQC,uBAAuB,QAAqC,4BAA4B;AAChG,SAAQC,2BAA2B,QAA8B,gCAAgC;AA2BjG,OAAO,IAAMC,iCAAiC,gBAQA;QAP1CC,gBAAAA,SACAC,cAAAA,OACAC,qBAAAA,cACAC,iBAAAA,UACAC,mBAAAA,YACAC,iBAAAA,UACAC,2BAAAA;IAEA,IAA4BV,6BAAAA,SAAS,KAAK,OAAnCW,SAAqBX,cAAbY,YAAaZ;IAC5B,IAAMa,MAAMf,gBAAgB;eAAMc,UAAU,KAAK;;IAEjD,IAA+Bb,oCAAAA,gBAAsC;QACjEM,OAAAA;QACAC,cAAAA;QACAC,UAAAA;QACAO,YAAY;YAAC,IAAI;YAAE,IAAI;SAAC;IAC5B,QALOC,SAAwBhB,qBAAhBiB,eAAgBjB;IAO/B,IAAMkB,mBAAmB,SAACC,OAAgC;QACtDF,yBAAAA,0BAAAA,KAAAA,IAAAA,aAAeE;QACf,IAAIA,KAAK,CAAC,EAAE,KAAK,IAAI,EAAE;YACnBN,UAAU,KAAK;QACnB,CAAC;IACL;IAEA,qBACI;;0BACI,MAACjB;gBAAMwB,OAAM;;kCACT,KAAClB;wBACGI,OAAOU;wBACPR,UAAUS;wBACVI,SAAS;mCAAMR,UAAU,IAAI;;wBAC7BJ,YAAYA;wBACZC,UAAUA;;oBAEbL,wBACG;;0CACI,KAACP;gCAAMwB,GAAE;;0CACT,KAACnB;gCAA4BE,SAASA;gCAASC,OAAOU;gCAAQR,UAAUS;;;yBAE5E,IAAI;;;0BAGZ,KAACpB;gBAAQe,QAAQA;gBAAQJ,UAAUK;gBAAWU,SAAS;0BACnD,cAAA,KAAC1B,QAAQ2B,QAAQ;8BACb,cAAA,KAAC7B;wBACGmB,KAAKA;wBACLW,QAAQ;4BAACC,MAAM;gCAACC,WAAW;4BAAQ;wBAAC;wBACpCC,gBAAgB;wBAChBC,gBAAe;wBACfC,sBAAsB;wBACtBxB,OAAOU;wBACPR,UAAUU;uBACNP;;;;;AAM5B,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/date-range-picker/DateRangePickerPopoverCalendar.tsx"],"sourcesContent":["import {DateRangePickerValue, RangeCalendar, RangeCalendarProps} from '@mantine/dates';\nimport {Group, Popover, Space} from '@mantine/core';\nimport {useClickOutside, useUncontrolled} from '@mantine/hooks';\nimport {useState} from 'react';\n\nimport {EditableDateRangePicker, EditableDateRangePickerProps} from './EditableDateRangePicker';\nimport {DateRangePickerPresetSelect, DateRangePickerPreset} from './DateRangePickerPresetSelect';\n\ninterface DateRangePickerPopoverCalendarProps<T> extends Pick<EditableDateRangePickerProps, 'startProps' | 'endProps'> {\n /** Default value for uncontrolled input */\n defaultValue?: DateRangePickerValue;\n /** Value for controlled input */\n value?: DateRangePickerValue;\n /** onChange value for controlled input */\n onChange?(value: DateRangePickerValue): void;\n /**\n * The presets to display\n *\n * @default {}\n * @example\n * {\n * january: {label: 'January', range: [new Date(2022, 0, 1), new Date(2022, 0, 31)]},\n * february: {label: 'February', range: [new Date(2022, 1, 1), new Date(2022, 1, 28)]}\n * }\n */\n presets?: Record<string, DateRangePickerPreset>;\n\n /**\n * Props for RangeCalendar\n */\n rangeCalendarProps?: Omit<RangeCalendarProps, 'value' | 'onChange'>;\n}\n\nexport const DateRangePickerPopoverCalendar = <T extends unknown>({\n presets,\n value,\n defaultValue,\n onChange,\n startProps,\n endProps,\n rangeCalendarProps,\n}: DateRangePickerPopoverCalendarProps<T>) => {\n const [opened, setOpened] = useState(false);\n const ref = useClickOutside(() => setOpened(false));\n\n const [_value, handleChange] = useUncontrolled<DateRangePickerValue>({\n value,\n defaultValue,\n onChange,\n finalValue: [null, null],\n });\n\n const onCalendarChange = (dates: DateRangePickerValue) => {\n handleChange?.(dates);\n if (dates[1] !== null) {\n setOpened(false);\n }\n };\n\n return (\n <>\n <Group align=\"center\">\n <EditableDateRangePicker\n value={_value}\n onChange={handleChange}\n onFocus={() => setOpened(true)}\n startProps={startProps}\n endProps={endProps}\n />\n {presets ? (\n <>\n <Space w=\"sm\" />\n <DateRangePickerPresetSelect presets={presets} value={_value} onChange={handleChange} />\n </>\n ) : null}\n </Group>\n\n <Popover opened={opened} onChange={setOpened} trapFocus>\n <Popover.Dropdown>\n <RangeCalendar\n ref={ref}\n styles={{cell: {textAlign: 'center'}}}\n amountOfMonths={2}\n firstDayOfWeek=\"sunday\"\n allowSingleDateInRange\n value={_value}\n onChange={onCalendarChange}\n {...rangeCalendarProps}\n />\n </Popover.Dropdown>\n </Popover>\n </>\n );\n};\n"],"names":["RangeCalendar","Group","Popover","Space","useClickOutside","useUncontrolled","useState","EditableDateRangePicker","DateRangePickerPresetSelect","DateRangePickerPopoverCalendar","presets","value","defaultValue","onChange","startProps","endProps","rangeCalendarProps","opened","setOpened","ref","finalValue","_value","handleChange","onCalendarChange","dates","align","onFocus","w","trapFocus","Dropdown","styles","cell","textAlign","amountOfMonths","firstDayOfWeek","allowS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Q;8BACb,cAAA,KAAC7B;wBACGmB,KAAKA;wBACLW,QAAQ;4BAACC,MAAM;gCAACC,WAAW;4BAAQ;wBAAC;wBACpCC,gBAAgB;wBAChBC,gBAAe;wBACfC,sBAAsB;wBACtBxB,OAAOU;wBACPR,UAAUU;uBACNP;;;;;AAM5B,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/date-range-picker/DateRangePickerPresetSelect.tsx"],"sourcesContent":["import {DateRangePickerValue, isSameDate} from '@mantine/dates';\nimport {Select, SelectItem, SelectProps} from '@mantine/core';\nimport {useState, useEffect} from 'react';\nimport dayjs from 'dayjs';\n\nexport interface DateRangePickerPreset {\n label: string;\n range: DateRangePickerValue;\n}\n\ninterface DateRangePickerPresetsSelectProps<T> {\n presets: Record<string, DateRangePickerPreset>;\n value: DateRangePickerValue;\n onChange?(value: DateRangePickerValue): void;\n selectProps?: Partial<Omit<SelectProps, 'data' | 'value' | 'onChange'>>;\n}\n\nexport const DateRangePickerPresetSelect = <T extends unknown>({\n presets,\n value,\n onChange,\n selectProps = {},\n}: DateRangePickerPresetsSelectProps<T>) => {\n const selectData: SelectItem[] = Object.entries(presets).map(([val, {label}]) => ({value: val, label}));\n\n const getSelectedPreset = () => {\n if (value[0] !== null && value[1] !== null && dayjs(value[0]).unix() !== dayjs(value[1]).unix()) {\n const selected = Object.entries(presets).find(\n ([id, {range}]) => dayjs(range[0]!).isSame(value[0]) && isSameDate(range[1]!, value[1]!)\n );\n if (selected) {\n return selected[0];\n }\n }\n return null;\n };\n\n const [selectedPreset, setSelectedPreset] = useState<string | null>(getSelectedPreset());\n\n useEffect(() => {\n const newPreset = getSelectedPreset();\n if (newPreset !== selectedPreset) {\n setSelectedPreset(newPreset);\n }\n }, [value]);\n\n const onChangePreset = (presetId: keyof typeof presets) => {\n const range = presets[presetId].range as any;\n onChange?.(range);\n };\n\n return (\n <Select\n label=\"Date range\"\n placeholder=\"Select a date range\"\n {...selectProps}\n value={selectedPreset}\n onChange={onChangePreset}\n data={selectData}\n />\n );\n};\n"],"names":["isSameDate","Select","useState","useEffect","dayjs","DateRangePickerPresetSelect","presets","value","onChange","selectProps","selectData","Object","entries","map","val","label","getSelectedPreset","unix","selected","find","id","range","isSame","selectedPreset","setSelectedPreset","newPreset","onChangePreset","presetId","placeholder","data"],"mappings":"AAAA;;;;AAAA,SAA8BA,UAAU,QAAO,iBAAiB;AAChE,SAAQC,MAAM,QAAgC,gBAAgB;AAC9D,SAAQC,QAAQ,EAAEC,SAAS,QAAO,QAAQ;AAC1C,OAAOC,WAAW,QAAQ;AAc1B,OAAO,IAAMC,8BAA8B,gBAKC;QAJxCC,gBAAAA,SACAC,cAAAA,OACAC,iBAAAA,qCACAC,aAAAA,8CAAc,CAAC;IAEf,IAAMC,aAA2BC,OAAOC,OAAO,CAACN,SAASO,GAAG,CAAC;iDAAEC,iBAAK,AAACC,kBAAAA;eAAa;YAACR,OAAOO;YAAKC,OAAAA;QAAK;;IAEpG,IAAMC,oBAAoB,WAAM;QAC5B,IAAIT,KAAK,CAAC,EAAE,KAAK,IAAI,IAAIA,KAAK,CAAC,EAAE,KAAK,IAAI,IAAIH,MAAMG,KAAK,CAAC,EAAE,EAAEU,IAAI,OAAOb,MAAMG,KAAK,CAAC,EAAE,EAAEU,IAAI,IAAI;YAC7F,IAAMC,WAAWP,OAAOC,OAAO,CAACN,SAASa,IAAI,CACzC;yDAAEC,gBAAI,AAACC,kBAAAA;uBAAYjB,MAAMiB,KAAK,CAAC,EAAE,EAAGC,MAAM,CAACf,KAAK,CAAC,EAAE,KAAKP,WAAWqB,KAAK,CAAC,EAAE,EAAGd,KAAK,CAAC,EAAE;;YAE1F,IAAIW,UAAU;gBACV,OAAOA,QAAQ,CAAC,EAAE;YACtB,CAAC;QACL,CAAC;QACD,OAAO,IAAI;IACf;IAEA,IAA4ChB,6BAAAA,SAAwBc,0BAA7DO,iBAAqCrB,cAArBsB,oBAAqBtB;IAE5CC,UAAU,WAAM;QACZ,IAAMsB,YAAYT;QAClB,IAAIS,cAAcF,gBAAgB;YAC9BC,kBAAkBC;QACtB,CAAC;IACL,GAAG;QAAClB;KAAM;IAEV,IAAMmB,iBAAiB,SAACC,UAAmC;QACvD,IAAMN,QAAQf,OAAO,CAACqB,SAAS,CAACN,KAAK;QACrCb,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAWa;IACf;IAEA,qBACI,KAACpB;QACGc,OAAM;QACNa,aAAY;OACRnB;QACJF,OAAOgB;QACPf,UAAUkB;QACVG,MAAMnB;;AAGlB,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/date-range-picker/DateRangePickerPresetSelect.tsx"],"sourcesContent":["import {DateRangePickerValue, isSameDate} from '@mantine/dates';\nimport {Select, SelectItem, SelectProps} from '@mantine/core';\nimport {useState, useEffect} from 'react';\nimport dayjs from 'dayjs';\n\nexport interface DateRangePickerPreset {\n label: string;\n range: DateRangePickerValue;\n}\n\ninterface DateRangePickerPresetsSelectProps<T> {\n presets: Record<string, DateRangePickerPreset>;\n value: DateRangePickerValue;\n onChange?(value: DateRangePickerValue): void;\n selectProps?: Partial<Omit<SelectProps, 'data' | 'value' | 'onChange'>>;\n}\n\nexport const DateRangePickerPresetSelect = <T extends unknown>({\n presets,\n value,\n onChange,\n selectProps = {},\n}: DateRangePickerPresetsSelectProps<T>) => {\n const selectData: SelectItem[] = Object.entries(presets).map(([val, {label}]) => ({value: val, label}));\n\n const getSelectedPreset = () => {\n if (value[0] !== null && value[1] !== null && dayjs(value[0]).unix() !== dayjs(value[1]).unix()) {\n const selected = Object.entries(presets).find(\n ([id, {range}]) => dayjs(range[0]!).isSame(value[0]) && isSameDate(range[1]!, value[1]!)\n );\n if (selected) {\n return selected[0];\n }\n }\n return null;\n };\n\n const [selectedPreset, setSelectedPreset] = useState<string | null>(getSelectedPreset());\n\n useEffect(() => {\n const newPreset = getSelectedPreset();\n if (newPreset !== selectedPreset) {\n setSelectedPreset(newPreset);\n }\n }, [value]);\n\n const onChangePreset = (presetId: keyof typeof presets) => {\n const range = presets[presetId].range as any;\n onChange?.(range);\n };\n\n return (\n <Select\n label=\"Date range\"\n placeholder=\"Select a date range\"\n {...selectProps}\n value={selectedPreset}\n onChange={onChangePreset}\n data={selectData}\n />\n );\n};\n"],"names":["isSameDate","Select","useState","useEffect","dayjs","DateRangePickerPresetSelect","presets","value","onChange","selectProps","selectData","Object","entries","map","val","label","getSelectedPreset","unix","selected","find","id","range","isSame","selectedPreset","setSelectedPreset","newPreset","onChangePreset","presetId","placeholder","data"],"mappings":";;;;AAAA,SAA8BA,UAAU,QAAO,iBAAiB;AAChE,SAAQC,MAAM,QAAgC,gBAAgB;AAC9D,SAAQC,QAAQ,EAAEC,SAAS,QAAO,QAAQ;AAC1C,OAAOC,WAAW,QAAQ;AAc1B,OAAO,IAAMC,8BAA8B,gBAKC;QAJxCC,gBAAAA,SACAC,cAAAA,OACAC,iBAAAA,qCACAC,aAAAA,8CAAc,CAAC;IAEf,IAAMC,aAA2BC,OAAOC,OAAO,CAACN,SAASO,GAAG,CAAC;iDAAEC,iBAAK,AAACC,kBAAAA;eAAa;YAACR,OAAOO;YAAKC,OAAAA;QAAK;;IAEpG,IAAMC,oBAAoB,WAAM;QAC5B,IAAIT,KAAK,CAAC,EAAE,KAAK,IAAI,IAAIA,KAAK,CAAC,EAAE,KAAK,IAAI,IAAIH,MAAMG,KAAK,CAAC,EAAE,EAAEU,IAAI,OAAOb,MAAMG,KAAK,CAAC,EAAE,EAAEU,IAAI,IAAI;YAC7F,IAAMC,WAAWP,OAAOC,OAAO,CAACN,SAASa,IAAI,CACzC;yDAAEC,gBAAI,AAACC,kBAAAA;uBAAYjB,MAAMiB,KAAK,CAAC,EAAE,EAAGC,MAAM,CAACf,KAAK,CAAC,EAAE,KAAKP,WAAWqB,KAAK,CAAC,EAAE,EAAGd,KAAK,CAAC,EAAE;;YAE1F,IAAIW,UAAU;gBACV,OAAOA,QAAQ,CAAC,EAAE;YACtB,CAAC;QACL,CAAC;QACD,OAAO,IAAI;IACf;IAEA,IAA4ChB,6BAAAA,SAAwBc,0BAA7DO,iBAAqCrB,cAArBsB,oBAAqBtB;IAE5CC,UAAU,WAAM;QACZ,IAAMsB,YAAYT;QAClB,IAAIS,cAAcF,gBAAgB;YAC9BC,kBAAkBC;QACtB,CAAC;IACL,GAAG;QAAClB;KAAM;IAEV,IAAMmB,iBAAiB,SAACC,UAAmC;QACvD,IAAMN,QAAQf,OAAO,CAACqB,SAAS,CAACN,KAAK;QACrCb,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAWa;IACf;IAEA,qBACI,KAACpB;QACGc,OAAM;QACNa,aAAY;OACRnB;QACJF,OAAOgB;QACPf,UAAUkB;QACVG,MAAMnB;;AAGlB,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/date-range-picker/EditableDateRangePicker.tsx"],"sourcesContent":["import {DatePicker, DatePickerProps, DateRangePickerValue} from '@mantine/dates';\nimport dayjs from 'dayjs';\nimport {ReactNode} from 'react';\n\nexport interface EditableDateRangePickerProps {\n value: DateRangePickerValue;\n onChange?(value: DateRangePickerValue): void;\n onFocus?: () => void;\n separator?: ReactNode;\n /**\n * Props for the start input\n */\n startProps?: Omit<Partial<DatePickerProps>, 'value' | 'onChange' | 'onFocus'>;\n /**\n * Props for the end input\n */\n endProps?: Omit<Partial<DatePickerProps>, 'value' | 'onChange' | 'onFocus'>;\n}\n\nexport const EditableDateRangePicker = ({\n value,\n onChange,\n onFocus,\n separator = 'to',\n startProps = {},\n endProps = {},\n}: EditableDateRangePickerProps) => {\n const onChangeStart = (date: Date) => {\n onChange?.([dayjs(date).startOf('day').toDate(), value?.[1]]);\n };\n const onChangeEnd = (date: Date) => {\n onChange?.([value?.[0], dayjs(date).endOf('day').toDate()]);\n };\n\n return (\n <>\n <DatePicker\n allowFreeInput\n clearable={false}\n label=\"Start\"\n {...startProps}\n value={value?.[0]}\n onChange={onChangeStart}\n onFocus={onFocus}\n styles={{...startProps.styles, dropdown: {display: 'none'}}}\n />\n {separator}\n <DatePicker\n allowFreeInput\n clearable={false}\n label=\"End\"\n {...endProps}\n value={value?.[1]}\n onChange={onChangeEnd}\n onFocus={onFocus}\n styles={{...endProps.styles, dropdown: {display: 'none'}}}\n />\n </>\n );\n};\n"],"names":["DatePicker","dayjs","EditableDateRangePicker","value","onChange","onFocus","separator","startProps","endProps","onChangeStart","date","startOf","toDate","onChangeEnd","endOf","allowFreeInput","clearable","label","styles","dropdown","display"],"mappings":"AAAA;;;AAAA,SAAQA,UAAU,QAA8C,iBAAiB;AACjF,OAAOC,WAAW,QAAQ;AAkB1B,OAAO,IAAMC,0BAA0B,gBAOH;QANhCC,cAAAA,OACAC,iBAAAA,UACAC,gBAAAA,kCACAC,WAAAA,0CAAY,mDACZC,YAAAA,4CAAa,CAAC,+CACdC,UAAAA,wCAAW,CAAC;IAEZ,IAAMC,gBAAgB,SAACC,MAAe;QAClCN,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAW;YAACH,MAAMS,MAAMC,OAAO,CAAC,OAAOC,MAAM;YAAIT,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;SAAC;IAChE;IACA,IAAMU,cAAc,SAACH,MAAe;QAChCN,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAW;YAACD,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;YAAEF,MAAMS,MAAMI,KAAK,CAAC,OAAOF,MAAM;SAAG;IAC9D;IAEA,qBACI;;0BACI,KAACZ;gBACGe,cAAc;gBACdC,WAAW,KAAK;gBAChBC,OAAM;eACFV;gBACJJ,OAAOA,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;gBACjBC,UAAUK;gBACVJ,SAASA;gBACTa,QAAQ,wCAAIX,WAAWW,MAAM;oBAAEC,UAAU;wBAACC,SAAS;oBAAM;;;YAE5Dd;0BACD,KAACN;gBACGe,cAAc;gBACdC,WAAW,KAAK;gBAChBC,OAAM;eACFT;gBACJL,OAAOA,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;gBACjBC,UAAUS;gBACVR,SAASA;gBACTa,QAAQ,wCAAIV,SAASU,MAAM;oBAAEC,UAAU;wBAACC,SAAS;oBAAM;;;;;AAIvE,EAAE"}
1
+ {"version":3,"sources":["../../../../src/components/date-range-picker/EditableDateRangePicker.tsx"],"sourcesContent":["import {DatePicker, DatePickerProps, DateRangePickerValue} from '@mantine/dates';\nimport dayjs from 'dayjs';\nimport {ReactNode} from 'react';\n\nexport interface EditableDateRangePickerProps {\n value: DateRangePickerValue;\n onChange?(value: DateRangePickerValue): void;\n onFocus?: () => void;\n separator?: ReactNode;\n /**\n * Props for the start input\n */\n startProps?: Omit<Partial<DatePickerProps>, 'value' | 'onChange' | 'onFocus'>;\n /**\n * Props for the end input\n */\n endProps?: Omit<Partial<DatePickerProps>, 'value' | 'onChange' | 'onFocus'>;\n}\n\nexport const EditableDateRangePicker = ({\n value,\n onChange,\n onFocus,\n separator = 'to',\n startProps = {},\n endProps = {},\n}: EditableDateRangePickerProps) => {\n const onChangeStart = (date: Date) => {\n onChange?.([dayjs(date).startOf('day').toDate(), value?.[1]]);\n };\n const onChangeEnd = (date: Date) => {\n onChange?.([value?.[0], dayjs(date).endOf('day').toDate()]);\n };\n\n return (\n <>\n <DatePicker\n allowFreeInput\n clearable={false}\n label=\"Start\"\n {...startProps}\n value={value?.[0]}\n onChange={onChangeStart}\n onFocus={onFocus}\n styles={{...startProps.styles, dropdown: {display: 'none'}}}\n />\n {separator}\n <DatePicker\n allowFreeInput\n clearable={false}\n label=\"End\"\n {...endProps}\n value={value?.[1]}\n onChange={onChangeEnd}\n onFocus={onFocus}\n styles={{...endProps.styles, dropdown: {display: 'none'}}}\n />\n </>\n );\n};\n"],"names":["DatePicker","dayjs","EditableDateRangePicker","value","onChange","onFocus","separator","startProps","endProps","onChangeStart","date","startOf","toDate","onChangeEnd","endOf","allowFreeInput","clearable","label","styles","dropdown","display"],"mappings":";;;AAAA,SAAQA,UAAU,QAA8C,iBAAiB;AACjF,OAAOC,WAAW,QAAQ;AAkB1B,OAAO,IAAMC,0BAA0B,gBAOH;QANhCC,cAAAA,OACAC,iBAAAA,UACAC,gBAAAA,kCACAC,WAAAA,0CAAY,mDACZC,YAAAA,4CAAa,CAAC,+CACdC,UAAAA,wCAAW,CAAC;IAEZ,IAAMC,gBAAgB,SAACC,MAAe;QAClCN,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAW;YAACH,MAAMS,MAAMC,OAAO,CAAC,OAAOC,MAAM;YAAIT,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;SAAC;IAChE;IACA,IAAMU,cAAc,SAACH,MAAe;QAChCN,qBAAAA,sBAAAA,KAAAA,IAAAA,SAAW;YAACD,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;YAAEF,MAAMS,MAAMI,KAAK,CAAC,OAAOF,MAAM;SAAG;IAC9D;IAEA,qBACI;;0BACI,KAACZ;gBACGe,cAAc;gBACdC,WAAW,KAAK;gBAChBC,OAAM;eACFV;gBACJJ,OAAOA,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;gBACjBC,UAAUK;gBACVJ,SAASA;gBACTa,QAAQ,wCAAIX,WAAWW,MAAM;oBAAEC,UAAU;wBAACC,SAAS;oBAAM;;;YAE5Dd;0BACD,KAACN;gBACGe,cAAc;gBACdC,WAAW,KAAK;gBAChBC,OAAM;eACFT;gBACJL,OAAOA,kBAAAA,mBAAAA,KAAAA,IAAAA,KAAO,CAAC,EAAE;gBACjBC,UAAUS;gBACVR,SAASA;gBACTa,QAAQ,wCAAIV,SAASU,MAAM;oBAAEC,UAAU;wBAACC,SAAS;oBAAM;;;;;AAIvE,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/components/header/Header.tsx"],"sourcesContent":["import {QuestionSize24Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {FunctionComponent, 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 * Action buttons that can be displayed on the right of the header\n */\n actions?: ReactNode;\n /**\n * Whether the header should have a border on the bottom\n */\n borderBottom?: boolean;\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 docLink?: string;\n /**\n * The tooltip text shown when hovering over the doc link icon\n */\n docLinkTooltipLabel?: string;\n /**\n * The title of the header.\n * If more than one children are provided, each of them act as parts of a breadcrumb\n */\n children: ReactNode;\n}\n\nexport const Header: FunctionComponent<HeaderProps> = ({\n description,\n actions,\n borderBottom,\n docLink,\n docLinkTooltipLabel,\n children,\n ...others\n}) => (\n <>\n <Group position=\"apart\" py=\"md\" px=\"xl\" {...others}>\n <Stack spacing=\"xs\">\n <Title order={4}>\n <Group spacing={0}>\n <Breadcrumbs>{children}</Breadcrumbs>\n {docLink ? (\n <Tooltip label={docLinkTooltipLabel} disabled={!docLinkTooltipLabel} position=\"bottom\">\n <Anchor inline href={docLink} target=\"_blank\" ml=\"xs\">\n <QuestionSize24Px height={24} />\n </Anchor>\n </Tooltip>\n ) : null}\n </Group>\n </Title>\n <Text size=\"sm\">{description}</Text>\n </Stack>\n <Group spacing=\"xs\">{actions}</Group>\n </Group>\n {borderBottom ? <Divider size=\"xs\" /> : null}\n </>\n);\n"],"names":["QuestionSize24Px","Anchor","Breadcrumbs","Divider","Group","Stack","Text","Title","Tooltip","Header","description","actions","borderBottom","docLink","docLinkTooltipLabel","children","others","position","py","px","spacing","order","label","disabled","inline","href","target","ml","height","size"],"mappings":"AAAA;;;;AAAA,SAAQA,gBAAgB,QAAO,8BAA8B;AAC7D,SAAQC,MAAM,EAAEC,WAAW,EAAgBC,OAAO,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,OAAO,QAAO,gBAAgB;AAgC7G,OAAO,IAAMC,SAAyC,+BASlD;QARAC,qBAAAA,aACAC,iBAAAA,SACAC,sBAAAA,cACAC,iBAAAA,SACAC,6BAAAA,qBACAC,kBAAAA,UACGC;QANHN;QACAC;QACAC;QACAC;QACAC;QACAC;;WAGA;;0BACI,MAACX;gBAAMa,UAAS;gBAAQC,IAAG;gBAAKC,IAAG;eAASH;;kCACxC,MAACX;wBAAMe,SAAQ;;0CACX,KAACb;gCAAMc,OAAO;0CACV,cAAA,MAACjB;oCAAMgB,SAAS;;sDACZ,KAAClB;sDAAaa;;wCACbF,wBACG,KAACL;4CAAQc,OAAOR;4CAAqBS,UAAU,CAACT;4CAAqBG,UAAS;sDAC1E,cAAA,KAAChB;gDAAOuB,MAAM;gDAACC,MAAMZ;gDAASa,QAAO;gDAASC,IAAG;0DAC7C,cAAA,KAAC3B;oDAAiB4B,QAAQ;;;6CAGlC,IAAI;;;;0CAGhB,KAACtB;gCAAKuB,MAAK;0CAAMnB;;;;kCAErB,KAACN;wBAAMgB,SAAQ;kCAAMT;;;;YAExBC,6BAAe,KAACT;gBAAQ0B,MAAK;iBAAU,IAAI;;;AAC9C,EACJ"}
1
+ {"version":3,"sources":["../../../../src/components/header/Header.tsx"],"sourcesContent":["import {QuestionSize24Px} from '@coveord/plasma-react-icons';\nimport {Anchor, Breadcrumbs, DefaultProps, Divider, Group, Stack, Text, Title, Tooltip} from '@mantine/core';\nimport {FunctionComponent, 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 * Action buttons that can be displayed on the right of the header\n */\n actions?: ReactNode;\n /**\n * Whether the header should have a border on the bottom\n */\n borderBottom?: boolean;\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 docLink?: string;\n /**\n * The tooltip text shown when hovering over the doc link icon\n */\n docLinkTooltipLabel?: string;\n /**\n * The title of the header.\n * If more than one children are provided, each of them act as parts of a breadcrumb\n */\n children: ReactNode;\n}\n\nexport const Header: FunctionComponent<HeaderProps> = ({\n description,\n actions,\n borderBottom,\n docLink,\n docLinkTooltipLabel,\n children,\n ...others\n}) => (\n <>\n <Group position=\"apart\" py=\"md\" px=\"xl\" {...others}>\n <Stack spacing=\"xs\">\n <Title order={4}>\n <Group spacing={0}>\n <Breadcrumbs>{children}</Breadcrumbs>\n {docLink ? (\n <Tooltip label={docLinkTooltipLabel} disabled={!docLinkTooltipLabel} position=\"bottom\">\n <Anchor inline href={docLink} target=\"_blank\" ml=\"xs\">\n <QuestionSize24Px height={24} />\n </Anchor>\n </Tooltip>\n ) : null}\n </Group>\n </Title>\n <Text size=\"sm\">{description}</Text>\n </Stack>\n <Group spacing=\"xs\">{actions}</Group>\n </Group>\n {borderBottom ? <Divider size=\"xs\" /> : null}\n </>\n);\n"],"names":["QuestionSize24Px","Anchor","Breadcrumbs","Divider","Group","Stack","Text","Title","Tooltip","Header","description","actions","borderBottom","docLink","docLinkTooltipLabel","children","others","position","py","px","spacing","order","label","disabled","inline","href","target","ml","height","size"],"mappings":";;;;AAAA,SAAQA,gBAAgB,QAAO,8BAA8B;AAC7D,SAAQC,MAAM,EAAEC,WAAW,EAAgBC,OAAO,EAAEC,KAAK,EAAEC,KAAK,EAAEC,IAAI,EAAEC,KAAK,EAAEC,OAAO,QAAO,gBAAgB;AAgC7G,OAAO,IAAMC,SAAyC,+BASlD;QARAC,qBAAAA,aACAC,iBAAAA,SACAC,sBAAAA,cACAC,iBAAAA,SACAC,6BAAAA,qBACAC,kBAAAA,UACGC;QANHN;QACAC;QACAC;QACAC;QACAC;QACAC;;WAGA;;0BACI,MAACX;gBAAMa,UAAS;gBAAQC,IAAG;gBAAKC,IAAG;eAASH;;kCACxC,MAACX;wBAAMe,SAAQ;;0CACX,KAACb;gCAAMc,OAAO;0CACV,cAAA,MAACjB;oCAAMgB,SAAS;;sDACZ,KAAClB;sDAAaa;;wCACbF,wBACG,KAACL;4CAAQc,OAAOR;4CAAqBS,UAAU,CAACT;4CAAqBG,UAAS;sDAC1E,cAAA,KAAChB;gDAAOuB,MAAM;gDAACC,MAAMZ;gDAASa,QAAO;gDAASC,IAAG;0DAC7C,cAAA,KAAC3B;oDAAiB4B,QAAQ;;;6CAGlC,IAAI;;;;0CAGhB,KAACtB;gCAAKuB,MAAK;0CAAMnB;;;;kCAErB,KAACN;wBAAMgB,SAAQ;kCAAMT;;;;YAExBC,6BAAe,KAACT;gBAAQ0B,MAAK;iBAAU,IAAI;;;AAC9C,EACJ"}
@@ -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":["Children","useState","InlineConfirmButton","InlineConfirmContext","InlineConfirmMenuItem","InlineConfirmPrompt","InlineConfirm","children","confirmingId","setConfirmingId","convertedChildren","toArray","prompt","find","child","type","props","id","clearConfirm","Provider","value","Prompt","Button","MenuItem"],"mappings":"AAAA;;AAAA,SAAQA,QAAQ,EAAsDC,QAAQ,QAAO,QAAQ;AAE7F,SAAQC,mBAAmB,QAAO,wBAAwB;AAC1D,SAAQC,oBAAoB,QAAO,yBAAyB;AAC5D,SAAQC,qBAAqB,QAAO,0BAA0B;AAC9D,SAAQC,mBAAmB,QAAO,wBAAwB;AAQ1D,OAAO,IAAMC,gBAAmC,gBAAgB;QAAdC,iBAAAA;IAC9C,IAAwCN,6BAAAA,SAAwB,IAAI,OAA7DO,eAAiCP,cAAnBQ,kBAAmBR;IAExC,IAAMS,oBAAoBV,SAASW,OAAO,CAACJ;IAC3C,IAAMK,SAASF,kBAAkBG,IAAI,CACjC,SAACC;eAAUA,MAAMC,IAAI,KAAKV,uBAAuBS,MAAME,KAAK,CAACC,EAAE,KAAKT;;IAExE,IAAMU,eAAe;eAAMT,gBAAgB,IAAI;;IAE/C,qBACI,KAACN,qBAAqBgB,QAAQ;QAACC,OAAO;YAACZ,cAAAA;YAAcC,iBAAAA;YAAiBS,cAAAA;QAAY;kBAC7EN,mBAAAA,oBAAAA,SAAUL,QAAQ;;AAG/B,EAAE;AAEFD,cAAce,MAAM,GAAGhB;AACvBC,cAAcgB,MAAM,GAAGpB;AACvBI,cAAciB,QAAQ,GAAGnB"}
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":["Children","useState","InlineConfirmButton","InlineConfirmContext","InlineConfirmMenuItem","InlineConfirmPrompt","InlineConfirm","children","confirmingId","setConfirmingId","convertedChildren","toArray","prompt","find","child","type","props","id","clearConfirm","Provider","value","Prompt","Button","MenuItem"],"mappings":";;AAAA,SAAQA,QAAQ,EAAsDC,QAAQ,QAAO,QAAQ;AAE7F,SAAQC,mBAAmB,QAAO,wBAAwB;AAC1D,SAAQC,oBAAoB,QAAO,yBAAyB;AAC5D,SAAQC,qBAAqB,QAAO,0BAA0B;AAC9D,SAAQC,mBAAmB,QAAO,wBAAwB;AAQ1D,OAAO,IAAMC,gBAAmC,gBAAgB;QAAdC,iBAAAA;IAC9C,IAAwCN,6BAAAA,SAAwB,IAAI,OAA7DO,eAAiCP,cAAnBQ,kBAAmBR;IAExC,IAAMS,oBAAoBV,SAASW,OAAO,CAACJ;IAC3C,IAAMK,SAASF,kBAAkBG,IAAI,CACjC,SAACC;eAAUA,MAAMC,IAAI,KAAKV,uBAAuBS,MAAME,KAAK,CAACC,EAAE,KAAKT;;IAExE,IAAMU,eAAe;eAAMT,gBAAgB,IAAI;;IAE/C,qBACI,KAACN,qBAAqBgB,QAAQ;QAACC,OAAO;YAACZ,cAAAA;YAAcC,iBAAAA;YAAiBS,cAAAA;QAAY;kBAC7EN,mBAAAA,oBAAAA,SAAUL,QAAQ;;AAG/B,EAAE;AAEFD,cAAce,MAAM,GAAGhB;AACvBC,cAAcgB,MAAM,GAAGpB;AACvBI,cAAciB,QAAQ,GAAGnB"}
@@ -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":["Button","forwardRef","useInlineConfirm","InlineConfirmButton","ref","onClick","id","others","setConfirmingId","handleOnClick","e"],"mappings":"AAAA;;;AAAA,SAAQA,MAAM,QAAO,gBAAgB;AACrC,SAAQC,UAAU,QAA0B,QAAQ;AAGpD,SAAQC,gBAAgB,QAAO,qBAAqB;AAOpD,OAAO,IAAMC,oCAAsBF,WAC/B,iBAA2BG,KAAQ;QAAjCC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBN,mBAAnBM;IACP,IAAMC,gBAAsD,SAACC,GAAM;QAC/DF,gBAAgBF;QAChBD,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUK;IACd;IAEA,qBAAO,KAACV;QAAOI,KAAKA;QAAKC,SAASI;OAAmBF;AACzD,GACF"}
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":["Button","forwardRef","useInlineConfirm","InlineConfirmButton","ref","onClick","id","others","setConfirmingId","handleOnClick","e"],"mappings":";;;AAAA,SAAQA,MAAM,QAAO,gBAAgB;AACrC,SAAQC,UAAU,QAA0B,QAAQ;AAGpD,SAAQC,gBAAgB,QAAO,qBAAqB;AAOpD,OAAO,IAAMC,oCAAsBF,WAC/B,iBAA2BG,KAAQ;QAAjCC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBN,mBAAnBM;IACP,IAAMC,gBAAsD,SAACC,GAAM;QAC/DF,gBAAgBF;QAChBD,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUK;IACd;IAEA,qBAAO,KAACV;QAAOI,KAAKA;QAAKC,SAASI;OAAmBF;AACzD,GACF"}
@@ -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":["forwardRef","Menu","useInlineConfirm","InlineConfirmMenuItem","ref","onClick","id","others","setConfirmingId","handleOnClick","e","Item"],"mappings":"AAAA;;;AAAA,SAAQA,UAAU,QAA0B,QAAQ;AAEpD,SAAQC,IAAI,QAAsB,UAAU;AAC5C,SAAQC,gBAAgB,QAAO,qBAAqB;AAOpD,OAAO,IAAMC,sCAAwBH,WACjC,iBAA2BI,KAAQ;QAAjCC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBN,mBAAnBM;IACP,IAAMC,gBAAsD,SAACC,GAAM;QAC/DF,gBAAgBF;QAChBD,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUK;IACd;IAEA,qBAAO,KAACT,KAAKU,IAAI;QAACP,KAAKA;QAAKC,SAASI;OAAmBF;AAC5D,GACF"}
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":["forwardRef","Menu","useInlineConfirm","InlineConfirmMenuItem","ref","onClick","id","others","setConfirmingId","handleOnClick","e","Item"],"mappings":";;;AAAA,SAAQA,UAAU,QAA0B,QAAQ;AAEpD,SAAQC,IAAI,QAAsB,UAAU;AAC5C,SAAQC,gBAAgB,QAAO,qBAAqB;AAOpD,OAAO,IAAMC,sCAAwBH,WACjC,iBAA2BI,KAAQ;QAAjCC,iBAAAA,SAASC,YAAAA,IAAOC;QAAhBF;QAASC;;IACP,IAAM,AAACE,kBAAmBN,mBAAnBM;IACP,IAAMC,gBAAsD,SAACC,GAAM;QAC/DF,gBAAgBF;QAChBD,oBAAAA,qBAAAA,KAAAA,IAAAA,QAAUK;IACd;IAEA,qBAAO,KAACT,KAAKU,IAAI;QAACP,KAAKA;QAAKC,SAASI;OAAmBF;AAC5D,GACF"}
@@ -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":["Group","useEffect","Button","useInlineConfirm","InlineConfirmPrompt","id","label","confirmLabel","cancelLabel","onConfirm","confirmingId","clearConfirm","onClickConfirm","spacing","onClick","color","variant"],"mappings":"AAAA;AAAA,SAAQA,KAAK,QAAO,gBAAgB;AACpC,SAAsCC,SAAS,QAAO,QAAQ;AAE9D,SAAQC,MAAM,QAAO,YAAY;AACjC,SAAQC,gBAAgB,QAAO,qBAAqB;AAUpD,OAAO,IAAMC,sBAAmE,gBAM1E;QALFC,WAAAA,IACAC,cAAAA,mCACAC,cAAAA,gDAAe,2DACfC,aAAAA,8CAAc,+BACdC,kBAAAA;IAEA,IAAqCN,oBAAAA,oBAA9BO,eAA8BP,kBAA9BO,cAAcC,eAAgBR,kBAAhBQ;IAErB,IAAMC,iBAAiB,WAAM;QACzBH;QACAE;IACJ;IAEAV,UAAU,WAAM;QACZ,IAAIS,iBAAiBL,IAAI;YACrBM;QACJ,CAAC;IACL,GAAG,EAAE;IAEL,IAAID,iBAAiBL,IAAI;QACrB,qBACI,MAACL;YAAMa,SAAQ;;gBACVP;8BACD,KAACJ;oBAAOY,SAASF;oBAAgBG,OAAM;8BAClCR;;8BAEL,KAACL;oBAAOY,SAASH;oBAAcK,SAAQ;8BAClCR;;;;IAIjB,CAAC;IACD,OAAO,IAAI;AACf,EAAE"}
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":["Group","useEffect","Button","useInlineConfirm","InlineConfirmPrompt","id","label","confirmLabel","cancelLabel","onConfirm","confirmingId","clearConfirm","onClickConfirm","spacing","onClick","color","variant"],"mappings":";AAAA,SAAQA,KAAK,QAAO,gBAAgB;AACpC,SAAsCC,SAAS,QAAO,QAAQ;AAE9D,SAAQC,MAAM,QAAO,YAAY;AACjC,SAAQC,gBAAgB,QAAO,qBAAqB;AAUpD,OAAO,IAAMC,sBAAmE,gBAM1E;QALFC,WAAAA,IACAC,cAAAA,mCACAC,cAAAA,gDAAe,2DACfC,aAAAA,8CAAc,+BACdC,kBAAAA;IAEA,IAAqCN,oBAAAA,oBAA9BO,eAA8BP,kBAA9BO,cAAcC,eAAgBR,kBAAhBQ;IAErB,IAAMC,iBAAiB,WAAM;QACzBH;QACAE;IACJ;IAEAV,UAAU,WAAM;QACZ,IAAIS,iBAAiBL,IAAI;YACrBM;QACJ,CAAC;IACL,GAAG,EAAE;IAEL,IAAID,iBAAiBL,IAAI;QACrB,qBACI,MAACL;YAAMa,SAAQ;;gBACVP;8BACD,KAACJ;oBAAOY,SAASF;oBAAgBG,OAAM;8BAClCR;;8BAEL,KAACL;oBAAOY,SAASH;oBAAcK,SAAQ;8BAClCR;;;;IAIjB,CAAC;IACD,OAAO,IAAI;AACf,EAAE"}