@pautena/react-design-system 0.14.2 → 0.14.4

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 (129) hide show
  1. package/action/cjs/index.js.map +1 -1
  2. package/action/index.js.map +1 -1
  3. package/board/cjs/index.js.map +1 -1
  4. package/board/index.js.map +1 -1
  5. package/bootstrap-dialog/bootstrap-dialog.d.ts +1 -1
  6. package/bootstrap-dialog/cjs/index.js.map +1 -1
  7. package/bootstrap-dialog/index.js.map +1 -1
  8. package/cjs/index.js +2 -2
  9. package/cjs/index.js.map +1 -1
  10. package/confirm-dialog/cjs/index.js.map +1 -1
  11. package/confirm-dialog/confirm-dialog.d.ts +1 -1
  12. package/confirm-dialog/index.js.map +1 -1
  13. package/content-placeholder/cjs/index.js.map +1 -1
  14. package/content-placeholder/index.js.map +1 -1
  15. package/date-range-picker/cjs/index.js.map +1 -1
  16. package/date-range-picker/index.js.map +1 -1
  17. package/drawer/cjs/index.js.map +1 -1
  18. package/drawer/drawer.types.d.ts +3 -3
  19. package/drawer/index.js.map +1 -1
  20. package/drawer-app-bar/cjs/index.js.map +1 -1
  21. package/drawer-app-bar/index.js.map +1 -1
  22. package/drawer-content/cjs/index.js.map +1 -1
  23. package/drawer-content/drawer-content.d.ts +1 -1
  24. package/drawer-content/index.js.map +1 -1
  25. package/drawer-item/cjs/index.js.map +1 -1
  26. package/drawer-item/drawer-item-link.d.ts +1 -1
  27. package/drawer-item/drawer-item.d.ts +1 -1
  28. package/drawer-item/drawer-menu-item.d.ts +1 -1
  29. package/drawer-item/index.js.map +1 -1
  30. package/drawer-layout/cjs/index.js.map +1 -1
  31. package/drawer-layout/drawer-layout.d.ts +2 -2
  32. package/drawer-layout/index.js.map +1 -1
  33. package/drawer-main/cjs/index.js.map +1 -1
  34. package/drawer-main/index.js.map +1 -1
  35. package/drawer-provider/cjs/index.js.map +1 -1
  36. package/drawer-provider/drawer-context.d.ts +1 -1
  37. package/drawer-provider/drawer.provider.d.ts +1 -1
  38. package/drawer-provider/index.js.map +1 -1
  39. package/drawer-section/cjs/index.js.map +1 -1
  40. package/drawer-section/drawer-section.d.ts +1 -1
  41. package/drawer-section/index.js.map +1 -1
  42. package/drawer-subheader/cjs/index.js.map +1 -1
  43. package/drawer-subheader/drawer-subheader.d.ts +1 -1
  44. package/drawer-subheader/index.js.map +1 -1
  45. package/enhanced-remote-table/cjs/index.js.map +1 -1
  46. package/enhanced-remote-table/enhanced-remote-table.d.ts +1 -1
  47. package/enhanced-remote-table/enhanced-remote-table.mock.d.ts +2 -2
  48. package/enhanced-remote-table/index.js.map +1 -1
  49. package/expandable-alert/cjs/index.js.map +1 -1
  50. package/expandable-alert/index.js.map +1 -1
  51. package/form-dialog/cjs/index.js.map +1 -1
  52. package/form-dialog/form-dialog.d.ts +1 -1
  53. package/form-dialog/index.js.map +1 -1
  54. package/group-value-card/cjs/index.js.map +1 -1
  55. package/group-value-card/group-value-card.d.ts +1 -1
  56. package/group-value-card/index.js.map +1 -1
  57. package/header/cjs/index.js.map +1 -1
  58. package/header/index.js.map +1 -1
  59. package/header-layout/cjs/index.js.map +1 -1
  60. package/header-layout/header-layout.d.ts +3 -3
  61. package/header-layout/index.js.map +1 -1
  62. package/index.js +4 -4
  63. package/index.js.map +1 -1
  64. package/link-card/cjs/index.js.map +1 -1
  65. package/link-card/index.js.map +1 -1
  66. package/list-panel/cjs/index.js +1 -1
  67. package/list-panel/cjs/index.js.map +1 -1
  68. package/list-panel/cjs/package.json +2 -1
  69. package/list-panel/index.js +1 -1
  70. package/list-panel/index.js.map +1 -1
  71. package/list-panel/list-panel.d.ts +1 -0
  72. package/list-panel/list-panel.mocks.d.ts +1 -0
  73. package/list-panel/package.json +2 -1
  74. package/model-form/cjs/index.js.map +1 -1
  75. package/model-form/index.js.map +1 -1
  76. package/model-form/model-form-field.d.ts +1 -1
  77. package/model-form/model-form.d.ts +1 -1
  78. package/model-router/cjs/index.js +1 -1
  79. package/model-router/cjs/index.js.map +1 -1
  80. package/model-router/index.js +1 -1
  81. package/model-router/index.js.map +1 -1
  82. package/model-router/model-router.d.ts +1 -1
  83. package/model-router/screens/add-screen.d.ts +2 -2
  84. package/model-router/screens/details-screen.d.ts +2 -2
  85. package/model-router/screens/list-screen.d.ts +2 -2
  86. package/model-router/screens/screens.types.d.ts +1 -1
  87. package/model-router/screens/update-screen.d.ts +2 -2
  88. package/model-router/stories/templates.d.ts +7 -7
  89. package/object-details/cjs/index.js +1 -1
  90. package/object-details/cjs/index.js.map +1 -1
  91. package/object-details/index.js +1 -1
  92. package/object-details/index.js.map +1 -1
  93. package/object-details/object-details.d.ts +1 -1
  94. package/package.json +1 -1
  95. package/query-container/cjs/index.js.map +1 -1
  96. package/query-container/index.js.map +1 -1
  97. package/select/cjs/index.js.map +1 -1
  98. package/select/index.js.map +1 -1
  99. package/skeleton-grid/cjs/index.js.map +1 -1
  100. package/skeleton-grid/index.js.map +1 -1
  101. package/tab-card/cjs/index.js.map +1 -1
  102. package/tab-card/index.js.map +1 -1
  103. package/tab-panel/cjs/index.js.map +1 -1
  104. package/tab-panel/index.js.map +1 -1
  105. package/table-list/cjs/index.js.map +1 -1
  106. package/table-list/index.js.map +1 -1
  107. package/table-list/table-list.d.ts +2 -2
  108. package/value-boolean/cjs/index.js.map +1 -1
  109. package/value-boolean/index.js.map +1 -1
  110. package/value-boolean/value-boolean.d.ts +1 -1
  111. package/value-datetime/cjs/index.js.map +1 -1
  112. package/value-datetime/index.js.map +1 -1
  113. package/value-datetime/value-datetime.d.ts +1 -1
  114. package/value-image/cjs/index.js.map +1 -1
  115. package/value-image/index.js.map +1 -1
  116. package/value-image/value-image.d.ts +1 -1
  117. package/value-item/cjs/index.js.map +1 -1
  118. package/value-item/index.js.map +1 -1
  119. package/value-label/cjs/index.js.map +1 -1
  120. package/value-label/index.js.map +1 -1
  121. package/value-label/value-label.d.ts +2 -2
  122. package/value-rating/cjs/index.js.map +1 -1
  123. package/value-rating/index.js.map +1 -1
  124. package/value-rating/value-rating.d.ts +1 -1
  125. package/value-text/cjs/index.js +1 -1
  126. package/value-text/cjs/index.js.map +1 -1
  127. package/value-text/index.js +1 -1
  128. package/value-text/index.js.map +1 -1
  129. package/value-text/value-text.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/bootstrap-dialog/bootstrap-dialog.tsx","../../../src/confirm-dialog/confirm-dialog.tsx"],"sourcesContent":["import Dialog from \"@mui/material/Dialog\";\nimport DialogTitle from \"@mui/material/DialogTitle\";\nimport DialogActions from \"@mui/material/DialogActions\";\nimport IconButton from \"@mui/material/IconButton\";\nimport DialogContent from \"@mui/material/DialogContent\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport Box from \"@mui/material/Box\";\nimport Button from \"@mui/material/Button\";\nimport LoadingButton from \"@mui/lab/LoadingButton\";\nimport CloseIcon from \"@mui/icons-material/Close\";\nimport { BootstrapDialogDialogProps } from \"~/dialog/dialog.types\";\n\nexport const BootstrapDialog = ({\n open,\n title,\n component,\n componentProps = {},\n disabled,\n disableAccept,\n disableCancel,\n actions = [],\n children,\n loading,\n cancelable,\n callCloseWhenCancel = true,\n acceptable,\n acceptText = \"Accept\",\n cancelText = \"Cancel\",\n onAccept,\n onCancel = () => null,\n onClose,\n acceptType = \"button\",\n}: BootstrapDialogDialogProps) => {\n const hasActions = actions.length > 0 || acceptable || cancelable;\n\n return (\n <Dialog open={open} onClose={onClose}>\n <DialogTitle sx={{ display: \"flex\", alignItems: \"center\" }}>\n {title}\n {loading && !acceptable && (\n <CircularProgress size={20} sx={{ ml: 2, color: (theme) => theme.palette.grey[500] }} />\n )}\n <IconButton\n disabled={disabled}\n aria-label=\"close\"\n onClick={onClose}\n sx={{\n position: \"absolute\",\n right: 8,\n top: 8,\n color: (theme) => theme.palette.grey[500],\n }}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <Box component={component} {...componentProps}>\n <DialogContent dividers>{children}</DialogContent>\n {hasActions && (\n <DialogActions>\n {actions.map(({ id, text, type = \"button\", onClick, color = \"primary\" }) => (\n <Button key={id} type={type} disabled={disabled} onClick={onClick} color={color}>\n {text}\n </Button>\n ))}\n {cancelable && (\n <Button\n color=\"error\"\n disabled={disabled || disableCancel}\n onClick={() => {\n onCancel();\n callCloseWhenCancel && onClose();\n }}\n >\n {cancelText}\n </Button>\n )}\n\n {acceptable && (\n <LoadingButton\n type={acceptType}\n loading={loading}\n disabled={disabled || disableAccept}\n onClick={onAccept}\n >\n {acceptText}\n </LoadingButton>\n )}\n </DialogActions>\n )}\n </Box>\n </Dialog>\n );\n};\n","import { useState } from \"react\";\nimport { BootstrapDialog } from \"~/bootstrap-dialog\";\nimport { BootstrapDialogDialogProps } from \"~/dialog/dialog.types\";\nimport TextField from \"@mui/material/TextField\";\n\ntype OmitBaseDialogProps =\n | \"cancelable\"\n | \"acceptable\"\n | \"onAccept\"\n | \"onCancel\"\n | \"onClose\"\n | \"actions\"\n | \"callCloseWhenCancel\"\n | \"component\"\n | \"acceptType\";\nexport interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {\n confirmText?: string;\n canceText?: string;\n passphrase?: string;\n onCancel: () => void;\n onConfirm: () => void;\n}\n\nexport const ConfirmDialog = ({\n open,\n title,\n loading,\n disabled,\n confirmText = \"Confirm\",\n cancelText = \"Cancel\",\n passphrase,\n children,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) => {\n const [inputPassphrase, setInputPassphrase] = useState(\"\");\n const validPassphrase = !passphrase || inputPassphrase === passphrase;\n\n return (\n <BootstrapDialog\n title={title}\n loading={loading}\n disabled={loading || disabled}\n disableAccept={!validPassphrase}\n open={open}\n onClose={onCancel}\n acceptable\n cancelable\n callCloseWhenCancel={false}\n acceptText={confirmText}\n cancelText={cancelText}\n onCancel={onCancel}\n onAccept={onConfirm}\n >\n {children}\n {passphrase && (\n <TextField\n size=\"small\"\n fullWidth\n value={inputPassphrase}\n onChange={(e) => setInputPassphrase(e.target.value)}\n placeholder={passphrase}\n />\n )}\n </BootstrapDialog>\n );\n};\n"],"names":["BootstrapDialog","open","title","component","componentProps","disabled","disableAccept","disableCancel","actions","children","loading","cancelable","callCloseWhenCancel","acceptable","acceptText","cancelText","onAccept","onCancel","onClose","acceptType","hasActions","length","_jsxs","Dialog","jsxs","DialogTitle","sx","display","alignItems","_jsx","CircularProgress","size","ml","color","theme","palette","grey","IconButton","onClick","position","right","top","CloseIcon","Box","jsx","DialogContent","dividers","DialogActions","map","id","text","type","Button","LoadingButton","confirmText","passphrase","onConfirm","inputPassphrase","setInputPassphrase","useState","validPassphrase","TextField","fullWidth","value","onChange","e","target","placeholder"],"mappings":"irBAYO,MAAMA,EAAkB,EAC7BC,OACAC,QACAC,YACAC,iBAAiB,CAAA,EACjBC,WACAC,gBACAC,gBACAC,UAAU,GACVC,WACAC,UACAC,aACAC,uBAAsB,EACtBC,aACAC,aAAa,SACbC,aAAa,SACbC,WACAC,WAAW,KAAM,MACjBC,UACAC,aAAa,aAEb,MAAMC,EAAaZ,EAAQa,OAAS,GAAKR,GAAcF,EAEvD,OACEW,OAACC,EAAAA,QAAO,CAAAtB,KAAMA,EAAMiB,QAASA,EAC3BT,SAAA,CAAAa,EAAAE,KAACC,EAAW,QAAC,CAAAC,GAAI,CAAEC,QAAS,OAAQC,WAAY,UAAUnB,SAAA,CACvDP,EACAQ,IAAYG,GACXgB,MAACC,EAAgB,QAAA,CAACC,KAAM,GAAIL,GAAI,CAAEM,GAAI,EAAGC,MAAQC,GAAUA,EAAMC,QAAQC,KAAK,QAEhFP,EAAAA,IAACQ,EAAU,SACThC,SAAUA,EAAQ,aACP,QACXiC,QAASpB,EACTQ,GAAI,CACFa,SAAU,WACVC,MAAO,EACPC,IAAK,EACLR,MAAQC,GAAUA,EAAMC,QAAQC,KAAK,MAGvC3B,SAAAoB,EAAAA,IAACa,EAAAA,QAAY,CAAA,QAGjBpB,EAAAA,KAACqB,EAAAA,QAAI,CAAAxC,UAAWA,KAAeC,EAC7BK,SAAA,CAAAoB,EAAAe,IAACC,EAAa,QAAC,CAAAC,UAAU,EAAArC,SAAAA,IACxBW,GACCE,EAAAA,KAACyB,EAAAA,QAAa,CAAAtC,SAAA,CACXD,EAAQwC,KAAI,EAAGC,KAAIC,OAAMC,OAAO,SAAUb,UAASL,QAAQ,aAC1DJ,EAAAA,IAACuB,EAAAA,SAAgBD,KAAMA,EAAM9C,SAAUA,EAAUiC,QAASA,EAASL,MAAOA,EAAKxB,SAC5EyC,GADUD,KAIdtC,GACCkB,EAAAe,IAACQ,EAAM,QAAA,CACLnB,MAAM,QACN5B,SAAUA,GAAYE,EACtB+B,QAAS,KACPrB,IACAL,GAAuBM,GAAS,WAGjCH,IAIJF,GACCgB,EAAAA,IAACwB,EAAa,SACZF,KAAMhC,EACNT,QAASA,EACTL,SAAUA,GAAYC,EACtBgC,QAAStB,EAERP,SAAAK,YAOb,wBCrEyB,EAC3Bb,OACAC,QACAQ,UACAL,WACAiD,cAAc,UACdvC,aAAa,SACbwC,aACA9C,WACA+C,YACAvC,eAEA,MAAOwC,EAAiBC,GAAsBC,EAAQA,SAAC,IACjDC,GAAmBL,GAAcE,IAAoBF,EAE3D,OACEjC,OAACtB,EAAe,CACdE,MAAOA,EACPQ,QAASA,EACTL,SAAUK,GAAWL,EACrBC,eAAgBsD,EAChB3D,KAAMA,EACNiB,QAASD,EACTJ,cACAF,YAAU,EACVC,qBAAqB,EACrBE,WAAYwC,EACZvC,WAAYA,EACZE,SAAUA,EACVD,SAAUwC,YAET/C,EACA8C,GACC1B,MAACgC,EAAAA,QAAS,CACR9B,KAAK,QACL+B,WAAS,EACTC,MAAON,EACPO,SAAWC,GAAMP,EAAmBO,EAAEC,OAAOH,OAC7CI,YAAaZ,MAInB"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/bootstrap-dialog/bootstrap-dialog.tsx","../../../src/confirm-dialog/confirm-dialog.tsx"],"sourcesContent":["import Dialog from \"@mui/material/Dialog\";\nimport DialogTitle from \"@mui/material/DialogTitle\";\nimport DialogActions from \"@mui/material/DialogActions\";\nimport IconButton from \"@mui/material/IconButton\";\nimport DialogContent from \"@mui/material/DialogContent\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport Box from \"@mui/material/Box\";\nimport Button from \"@mui/material/Button\";\nimport LoadingButton from \"@mui/lab/LoadingButton\";\nimport CloseIcon from \"@mui/icons-material/Close\";\nimport { BootstrapDialogDialogProps } from \"../dialog/dialog.types\";\n\nexport const BootstrapDialog = ({\n open,\n title,\n component,\n componentProps = {},\n disabled,\n disableAccept,\n disableCancel,\n actions = [],\n children,\n loading,\n cancelable,\n callCloseWhenCancel = true,\n acceptable,\n acceptText = \"Accept\",\n cancelText = \"Cancel\",\n onAccept,\n onCancel = () => null,\n onClose,\n acceptType = \"button\",\n}: BootstrapDialogDialogProps) => {\n const hasActions = actions.length > 0 || acceptable || cancelable;\n\n return (\n <Dialog open={open} onClose={onClose}>\n <DialogTitle sx={{ display: \"flex\", alignItems: \"center\" }}>\n {title}\n {loading && !acceptable && (\n <CircularProgress size={20} sx={{ ml: 2, color: (theme) => theme.palette.grey[500] }} />\n )}\n <IconButton\n disabled={disabled}\n aria-label=\"close\"\n onClick={onClose}\n sx={{\n position: \"absolute\",\n right: 8,\n top: 8,\n color: (theme) => theme.palette.grey[500],\n }}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <Box component={component} {...componentProps}>\n <DialogContent dividers>{children}</DialogContent>\n {hasActions && (\n <DialogActions>\n {actions.map(({ id, text, type = \"button\", onClick, color = \"primary\" }) => (\n <Button key={id} type={type} disabled={disabled} onClick={onClick} color={color}>\n {text}\n </Button>\n ))}\n {cancelable && (\n <Button\n color=\"error\"\n disabled={disabled || disableCancel}\n onClick={() => {\n onCancel();\n callCloseWhenCancel && onClose();\n }}\n >\n {cancelText}\n </Button>\n )}\n\n {acceptable && (\n <LoadingButton\n type={acceptType}\n loading={loading}\n disabled={disabled || disableAccept}\n onClick={onAccept}\n >\n {acceptText}\n </LoadingButton>\n )}\n </DialogActions>\n )}\n </Box>\n </Dialog>\n );\n};\n","import { useState } from \"react\";\nimport { BootstrapDialog } from \"../bootstrap-dialog\";\nimport { BootstrapDialogDialogProps } from \"../dialog/dialog.types\";\nimport TextField from \"@mui/material/TextField\";\n\ntype OmitBaseDialogProps =\n | \"cancelable\"\n | \"acceptable\"\n | \"onAccept\"\n | \"onCancel\"\n | \"onClose\"\n | \"actions\"\n | \"callCloseWhenCancel\"\n | \"component\"\n | \"acceptType\";\nexport interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {\n confirmText?: string;\n canceText?: string;\n passphrase?: string;\n onCancel: () => void;\n onConfirm: () => void;\n}\n\nexport const ConfirmDialog = ({\n open,\n title,\n loading,\n disabled,\n confirmText = \"Confirm\",\n cancelText = \"Cancel\",\n passphrase,\n children,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) => {\n const [inputPassphrase, setInputPassphrase] = useState(\"\");\n const validPassphrase = !passphrase || inputPassphrase === passphrase;\n\n return (\n <BootstrapDialog\n title={title}\n loading={loading}\n disabled={loading || disabled}\n disableAccept={!validPassphrase}\n open={open}\n onClose={onCancel}\n acceptable\n cancelable\n callCloseWhenCancel={false}\n acceptText={confirmText}\n cancelText={cancelText}\n onCancel={onCancel}\n onAccept={onConfirm}\n >\n {children}\n {passphrase && (\n <TextField\n size=\"small\"\n fullWidth\n value={inputPassphrase}\n onChange={(e) => setInputPassphrase(e.target.value)}\n placeholder={passphrase}\n />\n )}\n </BootstrapDialog>\n );\n};\n"],"names":["BootstrapDialog","open","title","component","componentProps","disabled","disableAccept","disableCancel","actions","children","loading","cancelable","callCloseWhenCancel","acceptable","acceptText","cancelText","onAccept","onCancel","onClose","acceptType","hasActions","length","_jsxs","Dialog","jsxs","DialogTitle","sx","display","alignItems","_jsx","CircularProgress","size","ml","color","theme","palette","grey","IconButton","onClick","position","right","top","CloseIcon","Box","jsx","DialogContent","dividers","DialogActions","map","id","text","type","Button","LoadingButton","confirmText","passphrase","onConfirm","inputPassphrase","setInputPassphrase","useState","validPassphrase","TextField","fullWidth","value","onChange","e","target","placeholder"],"mappings":"irBAYO,MAAMA,EAAkB,EAC7BC,OACAC,QACAC,YACAC,iBAAiB,CAAA,EACjBC,WACAC,gBACAC,gBACAC,UAAU,GACVC,WACAC,UACAC,aACAC,uBAAsB,EACtBC,aACAC,aAAa,SACbC,aAAa,SACbC,WACAC,WAAW,KAAM,MACjBC,UACAC,aAAa,aAEb,MAAMC,EAAaZ,EAAQa,OAAS,GAAKR,GAAcF,EAEvD,OACEW,OAACC,EAAAA,QAAO,CAAAtB,KAAMA,EAAMiB,QAASA,EAC3BT,SAAA,CAAAa,EAAAE,KAACC,EAAW,QAAC,CAAAC,GAAI,CAAEC,QAAS,OAAQC,WAAY,UAAUnB,SAAA,CACvDP,EACAQ,IAAYG,GACXgB,MAACC,EAAgB,QAAA,CAACC,KAAM,GAAIL,GAAI,CAAEM,GAAI,EAAGC,MAAQC,GAAUA,EAAMC,QAAQC,KAAK,QAEhFP,EAAAA,IAACQ,EAAU,SACThC,SAAUA,EAAQ,aACP,QACXiC,QAASpB,EACTQ,GAAI,CACFa,SAAU,WACVC,MAAO,EACPC,IAAK,EACLR,MAAQC,GAAUA,EAAMC,QAAQC,KAAK,MAGvC3B,SAAAoB,EAAAA,IAACa,EAAAA,QAAY,CAAA,QAGjBpB,EAAAA,KAACqB,EAAAA,QAAI,CAAAxC,UAAWA,KAAeC,EAC7BK,SAAA,CAAAoB,EAAAe,IAACC,EAAa,QAAC,CAAAC,UAAU,EAAArC,SAAAA,IACxBW,GACCE,EAAAA,KAACyB,EAAAA,QAAa,CAAAtC,SAAA,CACXD,EAAQwC,KAAI,EAAGC,KAAIC,OAAMC,OAAO,SAAUb,UAASL,QAAQ,aAC1DJ,EAAAA,IAACuB,EAAAA,SAAgBD,KAAMA,EAAM9C,SAAUA,EAAUiC,QAASA,EAASL,MAAOA,EAAKxB,SAC5EyC,GADUD,KAIdtC,GACCkB,EAAAe,IAACQ,EAAM,QAAA,CACLnB,MAAM,QACN5B,SAAUA,GAAYE,EACtB+B,QAAS,KACPrB,IACAL,GAAuBM,GAAS,WAGjCH,IAIJF,GACCgB,EAAAA,IAACwB,EAAa,SACZF,KAAMhC,EACNT,QAASA,EACTL,SAAUA,GAAYC,EACtBgC,QAAStB,EAERP,SAAAK,YAOb,wBCrEyB,EAC3Bb,OACAC,QACAQ,UACAL,WACAiD,cAAc,UACdvC,aAAa,SACbwC,aACA9C,WACA+C,YACAvC,eAEA,MAAOwC,EAAiBC,GAAsBC,EAAQA,SAAC,IACjDC,GAAmBL,GAAcE,IAAoBF,EAE3D,OACEjC,OAACtB,EAAe,CACdE,MAAOA,EACPQ,QAASA,EACTL,SAAUK,GAAWL,EACrBC,eAAgBsD,EAChB3D,KAAMA,EACNiB,QAASD,EACTJ,cACAF,YAAU,EACVC,qBAAqB,EACrBE,WAAYwC,EACZvC,WAAYA,EACZE,SAAUA,EACVD,SAAUwC,YAET/C,EACA8C,GACC1B,MAACgC,EAAAA,QAAS,CACR9B,KAAK,QACL+B,WAAS,EACTC,MAAON,EACPO,SAAWC,GAAMP,EAAmBO,EAAEC,OAAOH,OAC7CI,YAAaZ,MAInB"}
@@ -1,4 +1,4 @@
1
- import { BootstrapDialogDialogProps } from "~/dialog/dialog.types";
1
+ import { BootstrapDialogDialogProps } from "../dialog/dialog.types";
2
2
  type OmitBaseDialogProps = "cancelable" | "acceptable" | "onAccept" | "onCancel" | "onClose" | "actions" | "callCloseWhenCancel" | "component" | "acceptType";
3
3
  export interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {
4
4
  confirmText?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/bootstrap-dialog/bootstrap-dialog.tsx","../../src/confirm-dialog/confirm-dialog.tsx"],"sourcesContent":["import Dialog from \"@mui/material/Dialog\";\nimport DialogTitle from \"@mui/material/DialogTitle\";\nimport DialogActions from \"@mui/material/DialogActions\";\nimport IconButton from \"@mui/material/IconButton\";\nimport DialogContent from \"@mui/material/DialogContent\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport Box from \"@mui/material/Box\";\nimport Button from \"@mui/material/Button\";\nimport LoadingButton from \"@mui/lab/LoadingButton\";\nimport CloseIcon from \"@mui/icons-material/Close\";\nimport { BootstrapDialogDialogProps } from \"~/dialog/dialog.types\";\n\nexport const BootstrapDialog = ({\n open,\n title,\n component,\n componentProps = {},\n disabled,\n disableAccept,\n disableCancel,\n actions = [],\n children,\n loading,\n cancelable,\n callCloseWhenCancel = true,\n acceptable,\n acceptText = \"Accept\",\n cancelText = \"Cancel\",\n onAccept,\n onCancel = () => null,\n onClose,\n acceptType = \"button\",\n}: BootstrapDialogDialogProps) => {\n const hasActions = actions.length > 0 || acceptable || cancelable;\n\n return (\n <Dialog open={open} onClose={onClose}>\n <DialogTitle sx={{ display: \"flex\", alignItems: \"center\" }}>\n {title}\n {loading && !acceptable && (\n <CircularProgress size={20} sx={{ ml: 2, color: (theme) => theme.palette.grey[500] }} />\n )}\n <IconButton\n disabled={disabled}\n aria-label=\"close\"\n onClick={onClose}\n sx={{\n position: \"absolute\",\n right: 8,\n top: 8,\n color: (theme) => theme.palette.grey[500],\n }}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <Box component={component} {...componentProps}>\n <DialogContent dividers>{children}</DialogContent>\n {hasActions && (\n <DialogActions>\n {actions.map(({ id, text, type = \"button\", onClick, color = \"primary\" }) => (\n <Button key={id} type={type} disabled={disabled} onClick={onClick} color={color}>\n {text}\n </Button>\n ))}\n {cancelable && (\n <Button\n color=\"error\"\n disabled={disabled || disableCancel}\n onClick={() => {\n onCancel();\n callCloseWhenCancel && onClose();\n }}\n >\n {cancelText}\n </Button>\n )}\n\n {acceptable && (\n <LoadingButton\n type={acceptType}\n loading={loading}\n disabled={disabled || disableAccept}\n onClick={onAccept}\n >\n {acceptText}\n </LoadingButton>\n )}\n </DialogActions>\n )}\n </Box>\n </Dialog>\n );\n};\n","import { useState } from \"react\";\nimport { BootstrapDialog } from \"~/bootstrap-dialog\";\nimport { BootstrapDialogDialogProps } from \"~/dialog/dialog.types\";\nimport TextField from \"@mui/material/TextField\";\n\ntype OmitBaseDialogProps =\n | \"cancelable\"\n | \"acceptable\"\n | \"onAccept\"\n | \"onCancel\"\n | \"onClose\"\n | \"actions\"\n | \"callCloseWhenCancel\"\n | \"component\"\n | \"acceptType\";\nexport interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {\n confirmText?: string;\n canceText?: string;\n passphrase?: string;\n onCancel: () => void;\n onConfirm: () => void;\n}\n\nexport const ConfirmDialog = ({\n open,\n title,\n loading,\n disabled,\n confirmText = \"Confirm\",\n cancelText = \"Cancel\",\n passphrase,\n children,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) => {\n const [inputPassphrase, setInputPassphrase] = useState(\"\");\n const validPassphrase = !passphrase || inputPassphrase === passphrase;\n\n return (\n <BootstrapDialog\n title={title}\n loading={loading}\n disabled={loading || disabled}\n disableAccept={!validPassphrase}\n open={open}\n onClose={onCancel}\n acceptable\n cancelable\n callCloseWhenCancel={false}\n acceptText={confirmText}\n cancelText={cancelText}\n onCancel={onCancel}\n onAccept={onConfirm}\n >\n {children}\n {passphrase && (\n <TextField\n size=\"small\"\n fullWidth\n value={inputPassphrase}\n onChange={(e) => setInputPassphrase(e.target.value)}\n placeholder={passphrase}\n />\n )}\n </BootstrapDialog>\n );\n};\n"],"names":["BootstrapDialog","open","title","component","componentProps","disabled","disableAccept","disableCancel","actions","children","loading","cancelable","callCloseWhenCancel","acceptable","acceptText","cancelText","onAccept","onCancel","onClose","acceptType","hasActions","length","_jsxs","Dialog","DialogTitle","sx","display","alignItems","_jsx","CircularProgress","size","ml","color","theme","palette","grey","IconButton","onClick","position","right","top","CloseIcon","Box","DialogContent","dividers","DialogActions","map","id","text","type","Button","LoadingButton","ConfirmDialog","confirmText","passphrase","onConfirm","inputPassphrase","setInputPassphrase","useState","TextField","fullWidth","value","onChange","e","target","placeholder"],"mappings":"ugBAYO,MAAMA,EAAkB,EAC7BC,OACAC,QACAC,YACAC,iBAAiB,CAAA,EACjBC,WACAC,gBACAC,gBACAC,UAAU,GACVC,WACAC,UACAC,aACAC,uBAAsB,EACtBC,aACAC,aAAa,SACbC,aAAa,SACbC,WACAC,WAAW,KAAM,MACjBC,UACAC,aAAa,aAEb,MAAMC,EAAaZ,EAAQa,OAAS,GAAKR,GAAcF,EAEvD,OACEW,EAACC,EAAO,CAAAtB,KAAMA,EAAMiB,QAASA,EAC3BT,SAAA,CAAAa,EAACE,EAAY,CAAAC,GAAI,CAAEC,QAAS,OAAQC,WAAY,UAAUlB,SAAA,CACvDP,EACAQ,IAAYG,GACXe,EAACC,EAAgB,CAACC,KAAM,GAAIL,GAAI,CAAEM,GAAI,EAAGC,MAAQC,GAAUA,EAAMC,QAAQC,KAAK,QAEhFP,EAACQ,GACC/B,SAAUA,EAAQ,aACP,QACXgC,QAASnB,EACTO,GAAI,CACFa,SAAU,WACVC,MAAO,EACPC,IAAK,EACLR,MAAQC,GAAUA,EAAMC,QAAQC,KAAK,MAGvC1B,SAAAmB,EAACa,EAAY,CAAA,QAGjBnB,EAACoB,EAAI,CAAAvC,UAAWA,KAAeC,EAC7BK,SAAA,CAAAmB,EAACe,EAAc,CAAAC,UAAU,EAAAnC,SAAAA,IACxBW,GACCE,EAACuB,EAAa,CAAApC,SAAA,CACXD,EAAQsC,KAAI,EAAGC,KAAIC,OAAMC,OAAO,SAAUZ,UAASL,QAAQ,aAC1DJ,EAACsB,GAAgBD,KAAMA,EAAM5C,SAAUA,EAAUgC,QAASA,EAASL,MAAOA,EAAKvB,SAC5EuC,GADUD,KAIdpC,GACCiB,EAACsB,EAAM,CACLlB,MAAM,QACN3B,SAAUA,GAAYE,EACtB8B,QAAS,KACPpB,IACAL,GAAuBM,GAAS,WAGjCH,IAIJF,GACCe,EAACuB,GACCF,KAAM9B,EACNT,QAASA,EACTL,SAAUA,GAAYC,EACtB+B,QAASrB,EAERP,SAAAK,YAOb,ECrESsC,EAAgB,EAC3BnD,OACAC,QACAQ,UACAL,WACAgD,cAAc,UACdtC,aAAa,SACbuC,aACA7C,WACA8C,YACAtC,eAEA,MAAOuC,EAAiBC,GAAsBC,EAAS,IAGvD,OACEpC,EAACtB,EAAe,CACdE,MAAOA,EACPQ,QAASA,EACTL,SAAUK,GAAWL,EACrBC,iBAPqBgD,GAAcE,IAAoBF,GAQvDrD,KAAMA,EACNiB,QAASD,EACTJ,cACAF,YAAU,EACVC,qBAAqB,EACrBE,WAAYuC,EACZtC,WAAYA,EACZE,SAAUA,EACVD,SAAUuC,YAET9C,EACA6C,GACC1B,EAAC+B,EAAS,CACR7B,KAAK,QACL8B,WAAS,EACTC,MAAOL,EACPM,SAAWC,GAAMN,EAAmBM,EAAEC,OAAOH,OAC7CI,YAAaX,MAInB"}
1
+ {"version":3,"file":"index.js","sources":["../../src/bootstrap-dialog/bootstrap-dialog.tsx","../../src/confirm-dialog/confirm-dialog.tsx"],"sourcesContent":["import Dialog from \"@mui/material/Dialog\";\nimport DialogTitle from \"@mui/material/DialogTitle\";\nimport DialogActions from \"@mui/material/DialogActions\";\nimport IconButton from \"@mui/material/IconButton\";\nimport DialogContent from \"@mui/material/DialogContent\";\nimport CircularProgress from \"@mui/material/CircularProgress\";\nimport Box from \"@mui/material/Box\";\nimport Button from \"@mui/material/Button\";\nimport LoadingButton from \"@mui/lab/LoadingButton\";\nimport CloseIcon from \"@mui/icons-material/Close\";\nimport { BootstrapDialogDialogProps } from \"../dialog/dialog.types\";\n\nexport const BootstrapDialog = ({\n open,\n title,\n component,\n componentProps = {},\n disabled,\n disableAccept,\n disableCancel,\n actions = [],\n children,\n loading,\n cancelable,\n callCloseWhenCancel = true,\n acceptable,\n acceptText = \"Accept\",\n cancelText = \"Cancel\",\n onAccept,\n onCancel = () => null,\n onClose,\n acceptType = \"button\",\n}: BootstrapDialogDialogProps) => {\n const hasActions = actions.length > 0 || acceptable || cancelable;\n\n return (\n <Dialog open={open} onClose={onClose}>\n <DialogTitle sx={{ display: \"flex\", alignItems: \"center\" }}>\n {title}\n {loading && !acceptable && (\n <CircularProgress size={20} sx={{ ml: 2, color: (theme) => theme.palette.grey[500] }} />\n )}\n <IconButton\n disabled={disabled}\n aria-label=\"close\"\n onClick={onClose}\n sx={{\n position: \"absolute\",\n right: 8,\n top: 8,\n color: (theme) => theme.palette.grey[500],\n }}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <Box component={component} {...componentProps}>\n <DialogContent dividers>{children}</DialogContent>\n {hasActions && (\n <DialogActions>\n {actions.map(({ id, text, type = \"button\", onClick, color = \"primary\" }) => (\n <Button key={id} type={type} disabled={disabled} onClick={onClick} color={color}>\n {text}\n </Button>\n ))}\n {cancelable && (\n <Button\n color=\"error\"\n disabled={disabled || disableCancel}\n onClick={() => {\n onCancel();\n callCloseWhenCancel && onClose();\n }}\n >\n {cancelText}\n </Button>\n )}\n\n {acceptable && (\n <LoadingButton\n type={acceptType}\n loading={loading}\n disabled={disabled || disableAccept}\n onClick={onAccept}\n >\n {acceptText}\n </LoadingButton>\n )}\n </DialogActions>\n )}\n </Box>\n </Dialog>\n );\n};\n","import { useState } from \"react\";\nimport { BootstrapDialog } from \"../bootstrap-dialog\";\nimport { BootstrapDialogDialogProps } from \"../dialog/dialog.types\";\nimport TextField from \"@mui/material/TextField\";\n\ntype OmitBaseDialogProps =\n | \"cancelable\"\n | \"acceptable\"\n | \"onAccept\"\n | \"onCancel\"\n | \"onClose\"\n | \"actions\"\n | \"callCloseWhenCancel\"\n | \"component\"\n | \"acceptType\";\nexport interface ConfirmDialogProps extends Omit<BootstrapDialogDialogProps, OmitBaseDialogProps> {\n confirmText?: string;\n canceText?: string;\n passphrase?: string;\n onCancel: () => void;\n onConfirm: () => void;\n}\n\nexport const ConfirmDialog = ({\n open,\n title,\n loading,\n disabled,\n confirmText = \"Confirm\",\n cancelText = \"Cancel\",\n passphrase,\n children,\n onConfirm,\n onCancel,\n}: ConfirmDialogProps) => {\n const [inputPassphrase, setInputPassphrase] = useState(\"\");\n const validPassphrase = !passphrase || inputPassphrase === passphrase;\n\n return (\n <BootstrapDialog\n title={title}\n loading={loading}\n disabled={loading || disabled}\n disableAccept={!validPassphrase}\n open={open}\n onClose={onCancel}\n acceptable\n cancelable\n callCloseWhenCancel={false}\n acceptText={confirmText}\n cancelText={cancelText}\n onCancel={onCancel}\n onAccept={onConfirm}\n >\n {children}\n {passphrase && (\n <TextField\n size=\"small\"\n fullWidth\n value={inputPassphrase}\n onChange={(e) => setInputPassphrase(e.target.value)}\n placeholder={passphrase}\n />\n )}\n </BootstrapDialog>\n );\n};\n"],"names":["BootstrapDialog","open","title","component","componentProps","disabled","disableAccept","disableCancel","actions","children","loading","cancelable","callCloseWhenCancel","acceptable","acceptText","cancelText","onAccept","onCancel","onClose","acceptType","hasActions","length","_jsxs","Dialog","DialogTitle","sx","display","alignItems","_jsx","CircularProgress","size","ml","color","theme","palette","grey","IconButton","onClick","position","right","top","CloseIcon","Box","DialogContent","dividers","DialogActions","map","id","text","type","Button","LoadingButton","ConfirmDialog","confirmText","passphrase","onConfirm","inputPassphrase","setInputPassphrase","useState","TextField","fullWidth","value","onChange","e","target","placeholder"],"mappings":"ugBAYO,MAAMA,EAAkB,EAC7BC,OACAC,QACAC,YACAC,iBAAiB,CAAA,EACjBC,WACAC,gBACAC,gBACAC,UAAU,GACVC,WACAC,UACAC,aACAC,uBAAsB,EACtBC,aACAC,aAAa,SACbC,aAAa,SACbC,WACAC,WAAW,KAAM,MACjBC,UACAC,aAAa,aAEb,MAAMC,EAAaZ,EAAQa,OAAS,GAAKR,GAAcF,EAEvD,OACEW,EAACC,EAAO,CAAAtB,KAAMA,EAAMiB,QAASA,EAC3BT,SAAA,CAAAa,EAACE,EAAY,CAAAC,GAAI,CAAEC,QAAS,OAAQC,WAAY,UAAUlB,SAAA,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+B,EAAS,CACR7B,KAAK,QACL8B,WAAS,EACTC,MAAOL,EACPM,SAAWC,GAAMN,EAAmBM,EAAEC,OAAOH,OAC7CI,YAAaX,MAInB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/utils/arrays.ts","../../../src/skeleton-card/skeleton-card.tsx","../../../src/skeleton-grid/skeleton-grid.tsx","../../../src/content-placeholder/content-placeholder.tsx"],"sourcesContent":["export const newArrayWithSize = <T>(size: number, fillValue: T) => new Array(size).fill(fillValue);\n\nexport const getRandomItem = <T>(items: T[]): { index: number; item: T } => {\n const index = Math.floor(Math.random() * items.length);\n const item = items[index];\n return { index, item };\n};\n","import Box from \"@mui/material/Box\";\nimport Skeleton from \"@mui/material/Skeleton\";\n\nexport interface SkeletonCardProps {\n width?: number | string;\n animation?: \"pulse\" | \"wave\" | false;\n}\n\nexport const SkeletonCard = ({ width = \"100%\", animation = false }: SkeletonCardProps) => {\n return (\n <Box width={width}>\n <Skeleton animation={animation} variant=\"rectangular\" height={118} />\n <Skeleton animation={animation} variant=\"rectangular\" height={16} sx={{ my: 1 }} />\n <Skeleton animation={animation} variant=\"rectangular\" width=\"80%\" height={16} />\n </Box>\n );\n};\n","import Grid from \"@mui/material/Grid\";\nimport { newArrayWithSize } from \"~/utils\";\nimport { SkeletonCard } from \"~/skeleton-card\";\n\nexport interface SkeletonGridProps {\n size?: number;\n}\n\nexport const SkeletonGrid = ({ size = 20 }: SkeletonGridProps) => {\n return (\n <Grid container spacing={2}>\n {newArrayWithSize(size, 0).map((_, i) => (\n <Grid item key={i} xs={4}>\n <SkeletonCard width={1} />\n </Grid>\n ))}\n </Grid>\n );\n};\n","import Container from \"@mui/material/Container\";\nimport { PropsWithChildren } from \"react\";\nimport { SkeletonGrid } from \"~/skeleton-grid\";\n\nexport type ContentPlaceholderProps = PropsWithChildren<{\n size?: number;\n p?: number;\n}>;\n\nexport const ContentPlaceholder = ({ size = 20, children, p }: ContentPlaceholderProps) => {\n return (\n <Container component=\"main\" sx={{ p }} data-testid=\"content-placeholder-test\">\n {children}\n <SkeletonGrid size={size} />\n </Container>\n );\n};\n"],"names":["newArrayWithSize","size","fillValue","Array","fill","SkeletonCard","width","animation","_jsxs","jsxs","Box","children","_jsx","Skeleton","variant","height","sx","my","jsx","SkeletonGrid","Grid","container","spacing","map","_","i","item","xs","p","Container","component"],"mappings":"oXAAO,MAAMA,EAAmB,CAAIC,EAAcC,IAAiB,IAAIC,MAAMF,GAAMG,KAAKF,GCQ3EG,EAAe,EAAGC,QAAQ,OAAQC,aAAY,KAEvDC,EAAAC,KAACC,UAAG,CAACJ,MAAOA,EACVK,SAAA,CAAAC,EAAAA,IAACC,EAAQ,QAAA,CAACN,UAAWA,EAAWO,QAAQ,cAAcC,OAAQ,MAC9DH,EAAAA,IAACC,EAAQ,QAAA,CAACN,UAAWA,EAAWO,QAAQ,cAAcC,OAAQ,GAAIC,GAAI,CAAEC,GAAI,KAC5EL,EAAAM,IAACL,UAAS,CAAAN,UAAWA,EAAWO,QAAQ,cAAcR,MAAM,MAAMS,OAAQ,QCLnEI,EAAe,EAAGlB,OAAO,MAElCW,EAAAA,IAACQ,EAAAA,QAAI,CAACC,WAAU,EAAAC,QAAS,EACtBX,SAAAX,EAAiBC,EAAM,GAAGsB,KAAI,CAACC,EAAGC,IACjCb,EAAAA,IAACQ,EAAAA,QAAK,CAAAM,QAAaC,GAAI,EAAChB,SACtBC,MAACP,GAAaC,MAAO,KADPmB,kCCHU,EAAGxB,OAAO,GAAIU,WAAUiB,OAEtDpB,EAACC,KAAAoB,EAAS,QAAC,CAAAC,UAAU,OAAOd,GAAI,CAAEY,KAAiB,cAAA,2BAChDjB,SAAA,CAAAA,EACDC,EAAAA,IAACO,EAAY,CAAClB,KAAMA"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/utils/arrays.ts","../../../src/skeleton-card/skeleton-card.tsx","../../../src/skeleton-grid/skeleton-grid.tsx","../../../src/content-placeholder/content-placeholder.tsx"],"sourcesContent":["export const newArrayWithSize = <T>(size: number, fillValue: T) => new Array(size).fill(fillValue);\n\nexport const getRandomItem = <T>(items: T[]): { index: number; item: T } => {\n const index = Math.floor(Math.random() * items.length);\n const item = items[index];\n return { index, item };\n};\n","import Box from \"@mui/material/Box\";\nimport Skeleton from \"@mui/material/Skeleton\";\n\nexport interface SkeletonCardProps {\n width?: number | string;\n animation?: \"pulse\" | \"wave\" | false;\n}\n\nexport const SkeletonCard = ({ width = \"100%\", animation = false }: SkeletonCardProps) => {\n return (\n <Box width={width}>\n <Skeleton animation={animation} variant=\"rectangular\" height={118} />\n <Skeleton animation={animation} variant=\"rectangular\" height={16} sx={{ my: 1 }} />\n <Skeleton animation={animation} variant=\"rectangular\" width=\"80%\" height={16} />\n </Box>\n );\n};\n","import Grid from \"@mui/material/Grid\";\nimport { newArrayWithSize } from \"../utils\";\nimport { SkeletonCard } from \"../skeleton-card\";\n\nexport interface SkeletonGridProps {\n size?: number;\n}\n\nexport const SkeletonGrid = ({ size = 20 }: SkeletonGridProps) => {\n return (\n <Grid container spacing={2}>\n {newArrayWithSize(size, 0).map((_, i) => (\n <Grid item key={i} xs={4}>\n <SkeletonCard width={1} />\n </Grid>\n ))}\n </Grid>\n );\n};\n","import Container from \"@mui/material/Container\";\nimport { PropsWithChildren } from \"react\";\nimport { SkeletonGrid } from \"../skeleton-grid\";\n\nexport type ContentPlaceholderProps = PropsWithChildren<{\n size?: number;\n p?: number;\n}>;\n\nexport const ContentPlaceholder = ({ size = 20, children, p }: ContentPlaceholderProps) => {\n return (\n <Container component=\"main\" sx={{ p }} data-testid=\"content-placeholder-test\">\n {children}\n <SkeletonGrid size={size} />\n </Container>\n );\n};\n"],"names":["newArrayWithSize","size","fillValue","Array","fill","SkeletonCard","width","animation","_jsxs","jsxs","Box","children","_jsx","Skeleton","variant","height","sx","my","jsx","SkeletonGrid","Grid","container","spacing","map","_","i","item","xs","p","Container","component"],"mappings":"oXAAO,MAAMA,EAAmB,CAAIC,EAAcC,IAAiB,IAAIC,MAAMF,GAAMG,KAAKF,GCQ3EG,EAAe,EAAGC,QAAQ,OAAQC,aAAY,KAEvDC,EAAAC,KAACC,UAAG,CAACJ,MAAOA,EACVK,SAAA,CAAAC,EAAAA,IAACC,EAAQ,QAAA,CAACN,UAAWA,EAAWO,QAAQ,cAAcC,OAAQ,MAC9DH,EAAAA,IAACC,EAAQ,QAAA,CAACN,UAAWA,EAAWO,QAAQ,cAAcC,OAAQ,GAAIC,GAAI,CAAEC,GAAI,KAC5EL,EAAAM,IAACL,UAAS,CAAAN,UAAWA,EAAWO,QAAQ,cAAcR,MAAM,MAAMS,OAAQ,QCLnEI,EAAe,EAAGlB,OAAO,MAElCW,EAAAA,IAACQ,EAAAA,QAAI,CAACC,WAAU,EAAAC,QAAS,EACtBX,SAAAX,EAAiBC,EAAM,GAAGsB,KAAI,CAACC,EAAGC,IACjCb,EAAAA,IAACQ,EAAAA,QAAK,CAAAM,QAAaC,GAAI,EAAChB,SACtBC,MAACP,GAAaC,MAAO,KADPmB,kCCHU,EAAGxB,OAAO,GAAIU,WAAUiB,OAEtDpB,EAACC,KAAAoB,EAAS,QAAC,CAAAC,UAAU,OAAOd,GAAI,CAAEY,KAAiB,cAAA,2BAChDjB,SAAA,CAAAA,EACDC,EAAAA,IAACO,EAAY,CAAClB,KAAMA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/utils/arrays.ts","../../src/skeleton-card/skeleton-card.tsx","../../src/skeleton-grid/skeleton-grid.tsx","../../src/content-placeholder/content-placeholder.tsx"],"sourcesContent":["export const newArrayWithSize = <T>(size: number, fillValue: T) => new Array(size).fill(fillValue);\n\nexport const getRandomItem = <T>(items: T[]): { index: number; item: T } => {\n const index = Math.floor(Math.random() * items.length);\n const item = items[index];\n return { index, item };\n};\n","import Box from \"@mui/material/Box\";\nimport Skeleton from \"@mui/material/Skeleton\";\n\nexport interface SkeletonCardProps {\n width?: number | string;\n animation?: \"pulse\" | \"wave\" | false;\n}\n\nexport const SkeletonCard = ({ width = \"100%\", animation = false }: SkeletonCardProps) => {\n return (\n <Box width={width}>\n <Skeleton animation={animation} variant=\"rectangular\" height={118} />\n <Skeleton animation={animation} variant=\"rectangular\" height={16} sx={{ my: 1 }} />\n <Skeleton animation={animation} variant=\"rectangular\" width=\"80%\" height={16} />\n </Box>\n );\n};\n","import Grid from \"@mui/material/Grid\";\nimport { newArrayWithSize } from \"~/utils\";\nimport { SkeletonCard } from \"~/skeleton-card\";\n\nexport interface SkeletonGridProps {\n size?: number;\n}\n\nexport const SkeletonGrid = ({ size = 20 }: SkeletonGridProps) => {\n return (\n <Grid container spacing={2}>\n {newArrayWithSize(size, 0).map((_, i) => (\n <Grid item key={i} xs={4}>\n <SkeletonCard width={1} />\n </Grid>\n ))}\n </Grid>\n );\n};\n","import Container from \"@mui/material/Container\";\nimport { PropsWithChildren } from \"react\";\nimport { SkeletonGrid } from \"~/skeleton-grid\";\n\nexport type ContentPlaceholderProps = PropsWithChildren<{\n size?: number;\n p?: number;\n}>;\n\nexport const ContentPlaceholder = ({ size = 20, children, p }: ContentPlaceholderProps) => {\n return (\n <Container component=\"main\" sx={{ p }} data-testid=\"content-placeholder-test\">\n {children}\n <SkeletonGrid size={size} />\n </Container>\n );\n};\n"],"names":["newArrayWithSize","size","fillValue","Array","fill","SkeletonCard","width","animation","_jsxs","Box","children","_jsx","Skeleton","variant","height","sx","my","SkeletonGrid","Grid","container","spacing","map","_","i","item","xs","ContentPlaceholder","p","Container","component"],"mappings":"wNAAO,MAAMA,EAAmB,CAAIC,EAAcC,IAAiB,IAAIC,MAAMF,GAAMG,KAAKF,GCQ3EG,EAAe,EAAGC,QAAQ,OAAQC,aAAY,KAEvDC,EAACC,EAAG,CAACH,MAAOA,EACVI,SAAA,CAAAC,EAACC,EAAQ,CAACL,UAAWA,EAAWM,QAAQ,cAAcC,OAAQ,MAC9DH,EAACC,EAAQ,CAACL,UAAWA,EAAWM,QAAQ,cAAcC,OAAQ,GAAIC,GAAI,CAAEC,GAAI,KAC5EL,EAACC,EAAS,CAAAL,UAAWA,EAAWM,QAAQ,cAAcP,MAAM,MAAMQ,OAAQ,QCLnEG,EAAe,EAAGhB,OAAO,MAElCU,EAACO,EAAI,CAACC,WAAU,EAAAC,QAAS,EACtBV,SAAAV,EAAiBC,EAAM,GAAGoB,KAAI,CAACC,EAAGC,IACjCZ,EAACO,EAAK,CAAAM,QAAaC,GAAI,EAACf,SACtBC,EAACN,GAAaC,MAAO,KADPiB,OCHXG,EAAqB,EAAGzB,OAAO,GAAIS,WAAUiB,OAEtDnB,EAACoB,EAAU,CAAAC,UAAU,OAAOd,GAAI,CAAEY,KAAiB,cAAA,2BAChDjB,SAAA,CAAAA,EACDC,EAACM,EAAY,CAAChB,KAAMA"}
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/arrays.ts","../../src/skeleton-card/skeleton-card.tsx","../../src/skeleton-grid/skeleton-grid.tsx","../../src/content-placeholder/content-placeholder.tsx"],"sourcesContent":["export const newArrayWithSize = <T>(size: number, fillValue: T) => new Array(size).fill(fillValue);\n\nexport const getRandomItem = <T>(items: T[]): { index: number; item: T } => {\n const index = Math.floor(Math.random() * items.length);\n const item = items[index];\n return { index, item };\n};\n","import Box from \"@mui/material/Box\";\nimport Skeleton from \"@mui/material/Skeleton\";\n\nexport interface SkeletonCardProps {\n width?: number | string;\n animation?: \"pulse\" | \"wave\" | false;\n}\n\nexport const SkeletonCard = ({ width = \"100%\", animation = false }: SkeletonCardProps) => {\n return (\n <Box width={width}>\n <Skeleton animation={animation} variant=\"rectangular\" height={118} />\n <Skeleton animation={animation} variant=\"rectangular\" height={16} sx={{ my: 1 }} />\n <Skeleton animation={animation} variant=\"rectangular\" width=\"80%\" height={16} />\n </Box>\n );\n};\n","import Grid from \"@mui/material/Grid\";\nimport { newArrayWithSize } from \"../utils\";\nimport { SkeletonCard } from \"../skeleton-card\";\n\nexport interface SkeletonGridProps {\n size?: number;\n}\n\nexport const SkeletonGrid = ({ size = 20 }: SkeletonGridProps) => {\n return (\n <Grid container spacing={2}>\n {newArrayWithSize(size, 0).map((_, i) => (\n <Grid item key={i} xs={4}>\n <SkeletonCard width={1} />\n </Grid>\n ))}\n </Grid>\n );\n};\n","import Container from \"@mui/material/Container\";\nimport { PropsWithChildren } from \"react\";\nimport { SkeletonGrid } from \"../skeleton-grid\";\n\nexport type ContentPlaceholderProps = PropsWithChildren<{\n size?: number;\n p?: number;\n}>;\n\nexport const ContentPlaceholder = ({ size = 20, children, p }: ContentPlaceholderProps) => {\n return (\n <Container component=\"main\" sx={{ p }} data-testid=\"content-placeholder-test\">\n {children}\n <SkeletonGrid size={size} />\n </Container>\n );\n};\n"],"names":["newArrayWithSize","size","fillValue","Array","fill","SkeletonCard","width","animation","_jsxs","Box","children","_jsx","Skeleton","variant","height","sx","my","SkeletonGrid","Grid","container","spacing","map","_","i","item","xs","ContentPlaceholder","p","Container","component"],"mappings":"wNAAO,MAAMA,EAAmB,CAAIC,EAAcC,IAAiB,IAAIC,MAAMF,GAAMG,KAAKF,GCQ3EG,EAAe,EAAGC,QAAQ,OAAQC,aAAY,KAEvDC,EAACC,EAAG,CAACH,MAAOA,EACVI,SAAA,CAAAC,EAACC,EAAQ,CAACL,UAAWA,EAAWM,QAAQ,cAAcC,OAAQ,MAC9DH,EAACC,EAAQ,CAACL,UAAWA,EAAWM,QAAQ,cAAcC,OAAQ,GAAIC,GAAI,CAAEC,GAAI,KAC5EL,EAACC,EAAS,CAAAL,UAAWA,EAAWM,QAAQ,cAAcP,MAAM,MAAMQ,OAAQ,QCLnEG,EAAe,EAAGhB,OAAO,MAElCU,EAACO,EAAI,CAACC,WAAU,EAAAC,QAAS,EACtBV,SAAAV,EAAiBC,EAAM,GAAGoB,KAAI,CAACC,EAAGC,IACjCZ,EAACO,EAAK,CAAAM,QAAaC,GAAI,EAACf,SACtBC,EAACN,GAAaC,MAAO,KADPiB,OCHXG,EAAqB,EAAGzB,OAAO,GAAIS,WAAUiB,OAEtDnB,EAACoB,EAAU,CAAAC,UAAU,OAAOd,GAAI,CAAEY,KAAiB,cAAA,2BAChDjB,SAAA,CAAAA,EACDC,EAACM,EAAY,CAAChB,KAAMA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/date-range-calendar/date-range-calendar.tsx","../../../src/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import Box, { BoxProps } from \"@mui/material/Box\";\nimport { styled } from \"@mui/material/styles\";\nimport { DateCalendar, PickersDay, PickersDayProps } from \"@mui/x-date-pickers\";\nimport { endOfWeek, format, isAfter, isSameDay, startOfWeek } from \"date-fns\";\nimport { isBefore } from \"date-fns/esm\";\nimport { useState } from \"react\";\n\ntype DateRange = [Date, Date | undefined];\n\ninterface CustomPickerDayProps extends BoxProps {\n dayIsBetween: boolean;\n isFirstDay: boolean;\n isLastDay: boolean;\n}\n\nconst CustomPickersDayBackground = styled(Box, {\n shouldForwardProp: (prop) =>\n prop !== \"dayIsBetween\" &&\n prop !== \"isFirstDay\" &&\n prop !== \"isLastDay\" &&\n prop !== \"isStartOfWeek\" &&\n prop !== \"isEndOfWeek\",\n})<CustomPickerDayProps>(({ theme, dayIsBetween, isFirstDay, isLastDay }) => {\n return {\n ...((isFirstDay || isLastDay || dayIsBetween) && {\n borderRadius: 0,\n backgroundColor: `${theme.palette.primary.light}40`,\n margin: 0,\n }),\n ...(isFirstDay && {\n borderTopLeftRadius: \"50%\",\n borderBottomLeftRadius: \"50%\",\n }),\n ...(isLastDay && {\n borderTopRightRadius: \"50%\",\n borderBottomRightRadius: \"50%\",\n }),\n };\n}) as React.ComponentType<CustomPickerDayProps>;\n\nconst Day = (props: PickersDayProps<Date> & { dateRange?: DateRange | null }) => {\n const { day, dateRange, ...other } = props;\n\n if (dateRange == null) {\n return <PickersDay day={day} {...other} />;\n }\n\n const [start, end] = dateRange;\n\n const dayIsBetween = !!end && isAfter(day, start) && isBefore(day, end);\n const isFirstDay = isSameDay(day, start);\n const isLastDay = !!end && isSameDay(day, end);\n const isStartOfWeek = isSameDay(day, startOfWeek(day));\n const isEndOfWeek = isSameDay(day, endOfWeek(day));\n\n return (\n <CustomPickersDayBackground\n dayIsBetween={dayIsBetween}\n isFirstDay={isFirstDay || (dayIsBetween && isStartOfWeek)}\n isLastDay={isLastDay || (dayIsBetween && isEndOfWeek)}\n aria-label={format(day, \"yyyy-MM-dd\")}\n aria-selected={dayIsBetween || isFirstDay || isLastDay}\n role=\"gridcell\"\n >\n <PickersDay {...other} day={day} selected={isFirstDay || isLastDay} />\n </CustomPickersDayBackground>\n );\n};\n\nexport interface DateRangeCalendarProps {\n defaultValue: DateRange;\n onValueChange: (value: DateRange, updatedIndex: number) => void;\n}\nexport const DateRangeCalendar = ({ defaultValue, onValueChange }: DateRangeCalendarProps) => {\n const [value, setValue] = useState(defaultValue);\n const [index, setIndex] = useState(0);\n\n const setValueRange = (newRange: DateRange, index: number, newIndex: number) => {\n setValue(newRange);\n onValueChange(newRange, index);\n setIndex(newIndex);\n };\n\n const handleChange = (newValue: Date | null) => {\n if (!newValue) {\n return;\n }\n\n // If is the end date and is minor than the start date\n if (index === 1 && newValue < value[0]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // If is the start date and is bigger than the end date\n if (index === 0 && value[1] && newValue > value[1]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // Default case\n setValueRange(\n [index === 0 ? newValue : value[0], index === 1 ? newValue : value[1]],\n index,\n index === 0 ? 1 : 0,\n );\n };\n return (\n <DateCalendar\n value={null}\n onChange={handleChange}\n slots={{ day: Day }}\n slotProps={{\n day: {\n dateRange: value,\n } as any,\n }}\n aria-label=\"calendar range picker\"\n />\n );\n};\n","import { useState } from \"react\";\nimport { format } from \"date-fns\";\nimport Collapse from \"@mui/material/Collapse\";\nimport IconButton from \"@mui/material/IconButton\";\nimport InputAdornment from \"@mui/material/InputAdornment\";\nimport TextField from \"@mui/material/TextField\";\nimport Paper from \"@mui/material/Paper\";\nimport EventIcon from \"@mui/icons-material/Event\";\nimport { DateRangeCalendar } from \"~/date-range-calendar\";\n\ntype DateRange = [Date, Date | undefined];\nexport interface DateRangePickerProps {\n label: string;\n defaultValue: DateRange;\n format: string;\n fullWidth?: boolean;\n size?: \"small\" | \"medium\";\n onValueChange: (value: DateRange, index: number) => void;\n}\n\nexport const DateRangePicker = ({\n defaultValue,\n format: fmt,\n label,\n fullWidth,\n onValueChange,\n size = \"medium\",\n}: DateRangePickerProps) => {\n const [isPopoverOpened, setIsPopoverOpened] = useState(false);\n const [value, setValue] = useState(defaultValue);\n\n const handleValueChange = (newValue: DateRange, index: number) => {\n setValue(newValue);\n onValueChange(newValue, index);\n setIsPopoverOpened(index < 1);\n };\n\n return (\n <>\n <TextField\n label={label}\n fullWidth={fullWidth}\n size={size}\n value={`${format(value[0], fmt)} - ${value[1] ? format(value[1], fmt) : fmt.toUpperCase()}`}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => setIsPopoverOpened((o) => !o)} aria-label=\"open calendar\">\n <EventIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n <Paper>\n <Collapse in={isPopoverOpened} aria-label=\"calendar collapse\">\n <DateRangeCalendar defaultValue={defaultValue} onValueChange={handleValueChange} />\n </Collapse>\n </Paper>\n </>\n );\n};\n"],"names":["CustomPickersDayBackground","styled","Box","shouldForwardProp","prop","theme","dayIsBetween","isFirstDay","isLastDay","borderRadius","backgroundColor","palette","primary","light","margin","borderTopLeftRadius","borderBottomLeftRadius","borderTopRightRadius","borderBottomRightRadius","Day","props","day","dateRange","other","_jsx","PickersDay","start","end","isAfter","isBefore","isSameDay","isStartOfWeek","startOfWeek","isEndOfWeek","endOfWeek","format","role","children","selected","DateRangeCalendar","defaultValue","onValueChange","value","setValue","useState","index","setIndex","setValueRange","newRange","newIndex","DateCalendar","onChange","newValue","undefined","slots","slotProps","fmt","label","fullWidth","size","isPopoverOpened","setIsPopoverOpened","_jsxs","_Fragment","TextField","toUpperCase","InputProps","endAd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,EAAcC,cAzB7B,CAACW,EAAqBP,KAC9CF,EAASS,GACTX,EAAcW,EAAUP,GACxBgB,EAAmBhB,EAAQ,EAAE,UA0B7B"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/date-range-calendar/date-range-calendar.tsx","../../../src/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import Box, { BoxProps } from \"@mui/material/Box\";\nimport { styled } from \"@mui/material/styles\";\nimport { DateCalendar, PickersDay, PickersDayProps } from \"@mui/x-date-pickers\";\nimport { endOfWeek, format, isAfter, isSameDay, startOfWeek } from \"date-fns\";\nimport { isBefore } from \"date-fns/esm\";\nimport { useState } from \"react\";\n\ntype DateRange = [Date, Date | undefined];\n\ninterface CustomPickerDayProps extends BoxProps {\n dayIsBetween: boolean;\n isFirstDay: boolean;\n isLastDay: boolean;\n}\n\nconst CustomPickersDayBackground = styled(Box, {\n shouldForwardProp: (prop) =>\n prop !== \"dayIsBetween\" &&\n prop !== \"isFirstDay\" &&\n prop !== \"isLastDay\" &&\n prop !== \"isStartOfWeek\" &&\n prop !== \"isEndOfWeek\",\n})<CustomPickerDayProps>(({ theme, dayIsBetween, isFirstDay, isLastDay }) => {\n return {\n ...((isFirstDay || isLastDay || dayIsBetween) && {\n borderRadius: 0,\n backgroundColor: `${theme.palette.primary.light}40`,\n margin: 0,\n }),\n ...(isFirstDay && {\n borderTopLeftRadius: \"50%\",\n borderBottomLeftRadius: \"50%\",\n }),\n ...(isLastDay && {\n borderTopRightRadius: \"50%\",\n borderBottomRightRadius: \"50%\",\n }),\n };\n}) as React.ComponentType<CustomPickerDayProps>;\n\nconst Day = (props: PickersDayProps<Date> & { dateRange?: DateRange | null }) => {\n const { day, dateRange, ...other } = props;\n\n if (dateRange == null) {\n return <PickersDay day={day} {...other} />;\n }\n\n const [start, end] = dateRange;\n\n const dayIsBetween = !!end && isAfter(day, start) && isBefore(day, end);\n const isFirstDay = isSameDay(day, start);\n const isLastDay = !!end && isSameDay(day, end);\n const isStartOfWeek = isSameDay(day, startOfWeek(day));\n const isEndOfWeek = isSameDay(day, endOfWeek(day));\n\n return (\n <CustomPickersDayBackground\n dayIsBetween={dayIsBetween}\n isFirstDay={isFirstDay || (dayIsBetween && isStartOfWeek)}\n isLastDay={isLastDay || (dayIsBetween && isEndOfWeek)}\n aria-label={format(day, \"yyyy-MM-dd\")}\n aria-selected={dayIsBetween || isFirstDay || isLastDay}\n role=\"gridcell\"\n >\n <PickersDay {...other} day={day} selected={isFirstDay || isLastDay} />\n </CustomPickersDayBackground>\n );\n};\n\nexport interface DateRangeCalendarProps {\n defaultValue: DateRange;\n onValueChange: (value: DateRange, updatedIndex: number) => void;\n}\nexport const DateRangeCalendar = ({ defaultValue, onValueChange }: DateRangeCalendarProps) => {\n const [value, setValue] = useState(defaultValue);\n const [index, setIndex] = useState(0);\n\n const setValueRange = (newRange: DateRange, index: number, newIndex: number) => {\n setValue(newRange);\n onValueChange(newRange, index);\n setIndex(newIndex);\n };\n\n const handleChange = (newValue: Date | null) => {\n if (!newValue) {\n return;\n }\n\n // If is the end date and is minor than the start date\n if (index === 1 && newValue < value[0]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // If is the start date and is bigger than the end date\n if (index === 0 && value[1] && newValue > value[1]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // Default case\n setValueRange(\n [index === 0 ? newValue : value[0], index === 1 ? newValue : value[1]],\n index,\n index === 0 ? 1 : 0,\n );\n };\n return (\n <DateCalendar\n value={null}\n onChange={handleChange}\n slots={{ day: Day }}\n slotProps={{\n day: {\n dateRange: value,\n } as any,\n }}\n aria-label=\"calendar range picker\"\n />\n );\n};\n","import { useState } from \"react\";\nimport { format } from \"date-fns\";\nimport Collapse from \"@mui/material/Collapse\";\nimport IconButton from \"@mui/material/IconButton\";\nimport InputAdornment from \"@mui/material/InputAdornment\";\nimport TextField from \"@mui/material/TextField\";\nimport Paper from \"@mui/material/Paper\";\nimport EventIcon from \"@mui/icons-material/Event\";\nimport { DateRangeCalendar } from \"../date-range-calendar\";\n\ntype DateRange = [Date, Date | undefined];\nexport interface DateRangePickerProps {\n label: string;\n defaultValue: DateRange;\n format: string;\n fullWidth?: boolean;\n size?: \"small\" | \"medium\";\n onValueChange: (value: DateRange, index: number) => void;\n}\n\nexport const DateRangePicker = ({\n defaultValue,\n format: fmt,\n label,\n fullWidth,\n onValueChange,\n size = \"medium\",\n}: DateRangePickerProps) => {\n const [isPopoverOpened, setIsPopoverOpened] = useState(false);\n const [value, setValue] = useState(defaultValue);\n\n const handleValueChange = (newValue: DateRange, index: number) => {\n setValue(newValue);\n onValueChange(newValue, index);\n setIsPopoverOpened(index < 1);\n };\n\n return (\n <>\n <TextField\n label={label}\n fullWidth={fullWidth}\n size={size}\n value={`${format(value[0], fmt)} - ${value[1] ? format(value[1], fmt) : fmt.toUpperCase()}`}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => setIsPopoverOpened((o) => !o)} aria-label=\"open calendar\">\n <EventIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n <Paper>\n <Collapse in={isPopoverOpened} aria-label=\"calendar collapse\">\n <DateRangeCalendar defaultValue={defaultValue} onValueChange={handleValueChange} />\n </Collapse>\n </Paper>\n </>\n );\n};\n"],"names":["CustomPickersDayBackground","styled","Box","shouldForwardProp","prop","theme","dayIsBetween","isFirstDay","isLastDay","borderRadius","backgroundColor","palette","primary","light","margin","borderTopLeftRadius","borderBottomLeftRadius","borderTopRightRadius","borderBottomRightRadius","Day","props","day","dateRange","other","_jsx","PickersDay","start","end","isAfter","isBefore","isSameDay","isStartOfWeek","startOfWeek","isEndOfWeek","endOfWeek","format","role","children","selected","DateRangeCalendar","defaultValue","onValueChange","value","setValue","useState","index","setIndex","setValueRange","newRange","newIndex","DateCalendar","onChange","newValue","undefined","slots","slotProps","fmt","label","fullWidth","size","isPopoverOpened","setIsPopoverOpened","_jsxs","_Fragment","TextField","toUpperCase","InputProps","endAdornment","jsx","InputAdornment","position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AACW,EAAqBP,KAC9CF,EAASS,GACTX,EAAcW,EAAUP,GACxBgB,EAAmBhB,EAAQ,EAAE,UA0B7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/date-range-calendar/date-range-calendar.tsx","../../src/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import Box, { BoxProps } from \"@mui/material/Box\";\nimport { styled } from \"@mui/material/styles\";\nimport { DateCalendar, PickersDay, PickersDayProps } from \"@mui/x-date-pickers\";\nimport { endOfWeek, format, isAfter, isSameDay, startOfWeek } from \"date-fns\";\nimport { isBefore } from \"date-fns/esm\";\nimport { useState } from \"react\";\n\ntype DateRange = [Date, Date | undefined];\n\ninterface CustomPickerDayProps extends BoxProps {\n dayIsBetween: boolean;\n isFirstDay: boolean;\n isLastDay: boolean;\n}\n\nconst CustomPickersDayBackground = styled(Box, {\n shouldForwardProp: (prop) =>\n prop !== \"dayIsBetween\" &&\n prop !== \"isFirstDay\" &&\n prop !== \"isLastDay\" &&\n prop !== \"isStartOfWeek\" &&\n prop !== \"isEndOfWeek\",\n})<CustomPickerDayProps>(({ theme, dayIsBetween, isFirstDay, isLastDay }) => {\n return {\n ...((isFirstDay || isLastDay || dayIsBetween) && {\n borderRadius: 0,\n backgroundColor: `${theme.palette.primary.light}40`,\n margin: 0,\n }),\n ...(isFirstDay && {\n borderTopLeftRadius: \"50%\",\n borderBottomLeftRadius: \"50%\",\n }),\n ...(isLastDay && {\n borderTopRightRadius: \"50%\",\n borderBottomRightRadius: \"50%\",\n }),\n };\n}) as React.ComponentType<CustomPickerDayProps>;\n\nconst Day = (props: PickersDayProps<Date> & { dateRange?: DateRange | null }) => {\n const { day, dateRange, ...other } = props;\n\n if (dateRange == null) {\n return <PickersDay day={day} {...other} />;\n }\n\n const [start, end] = dateRange;\n\n const dayIsBetween = !!end && isAfter(day, start) && isBefore(day, end);\n const isFirstDay = isSameDay(day, start);\n const isLastDay = !!end && isSameDay(day, end);\n const isStartOfWeek = isSameDay(day, startOfWeek(day));\n const isEndOfWeek = isSameDay(day, endOfWeek(day));\n\n return (\n <CustomPickersDayBackground\n dayIsBetween={dayIsBetween}\n isFirstDay={isFirstDay || (dayIsBetween && isStartOfWeek)}\n isLastDay={isLastDay || (dayIsBetween && isEndOfWeek)}\n aria-label={format(day, \"yyyy-MM-dd\")}\n aria-selected={dayIsBetween || isFirstDay || isLastDay}\n role=\"gridcell\"\n >\n <PickersDay {...other} day={day} selected={isFirstDay || isLastDay} />\n </CustomPickersDayBackground>\n );\n};\n\nexport interface DateRangeCalendarProps {\n defaultValue: DateRange;\n onValueChange: (value: DateRange, updatedIndex: number) => void;\n}\nexport const DateRangeCalendar = ({ defaultValue, onValueChange }: DateRangeCalendarProps) => {\n const [value, setValue] = useState(defaultValue);\n const [index, setIndex] = useState(0);\n\n const setValueRange = (newRange: DateRange, index: number, newIndex: number) => {\n setValue(newRange);\n onValueChange(newRange, index);\n setIndex(newIndex);\n };\n\n const handleChange = (newValue: Date | null) => {\n if (!newValue) {\n return;\n }\n\n // If is the end date and is minor than the start date\n if (index === 1 && newValue < value[0]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // If is the start date and is bigger than the end date\n if (index === 0 && value[1] && newValue > value[1]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // Default case\n setValueRange(\n [index === 0 ? newValue : value[0], index === 1 ? newValue : value[1]],\n index,\n index === 0 ? 1 : 0,\n );\n };\n return (\n <DateCalendar\n value={null}\n onChange={handleChange}\n slots={{ day: Day }}\n slotProps={{\n day: {\n dateRange: value,\n } as any,\n }}\n aria-label=\"calendar range picker\"\n />\n );\n};\n","import { useState } from \"react\";\nimport { format } from \"date-fns\";\nimport Collapse from \"@mui/material/Collapse\";\nimport IconButton from \"@mui/material/IconButton\";\nimport InputAdornment from \"@mui/material/InputAdornment\";\nimport TextField from \"@mui/material/TextField\";\nimport Paper from \"@mui/material/Paper\";\nimport EventIcon from \"@mui/icons-material/Event\";\nimport { DateRangeCalendar } from \"~/date-range-calendar\";\n\ntype DateRange = [Date, Date | undefined];\nexport interface DateRangePickerProps {\n label: string;\n defaultValue: DateRange;\n format: string;\n fullWidth?: boolean;\n size?: \"small\" | \"medium\";\n onValueChange: (value: DateRange, index: number) => void;\n}\n\nexport const DateRangePicker = ({\n defaultValue,\n format: fmt,\n label,\n fullWidth,\n onValueChange,\n size = \"medium\",\n}: DateRangePickerProps) => {\n const [isPopoverOpened, setIsPopoverOpened] = useState(false);\n const [value, setValue] = useState(defaultValue);\n\n const handleValueChange = (newValue: DateRange, index: number) => {\n setValue(newValue);\n onValueChange(newValue, index);\n setIsPopoverOpened(index < 1);\n };\n\n return (\n <>\n <TextField\n label={label}\n fullWidth={fullWidth}\n size={size}\n value={`${format(value[0], fmt)} - ${value[1] ? format(value[1], fmt) : fmt.toUpperCase()}`}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => setIsPopoverOpened((o) => !o)} aria-label=\"open calendar\">\n <EventIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n <Paper>\n <Collapse in={isPopoverOpened} aria-label=\"calendar collapse\">\n <DateRangeCalendar defaultValue={defaultValue} onValueChange={handleValueChange} />\n </Collapse>\n </Paper>\n </>\n );\n};\n"],"names":["CustomPickersDayBackground","styled","Box","shouldForwardProp","prop","theme","dayIsBetween","isFirstDay","isLastDay","borderRadius","backgroundColor","palette","primary","light","margin","borderTopLeftRadius","borderBottomLeftRadius","borderTopRightRadius","borderBottomRightRadius","Day","props","day","dateRange","other","_jsx","PickersDay","start","end","isAfter","isBefore","isSameDay","isStartOfWeek","startOfWeek","isEndOfWeek","endOfWeek","format","role","children","selected","DateRangeCalendar","defaultValue","onValueChange","value","setValue","useState","index","setIndex","setValueRange","newRange","newIndex","DateCalendar","onChange","newValue","undefined","slots","slotProps","DateRangePicker","fmt","label","fullWidth","size","isPopoverOpened","setIsPopoverOpened","_jsxs","_Fragment","TextField","toUpperCase","InputProps","endAdornment","InputAdornment","position","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ACXR,MAAO,KACPS,SAzBkBC,IACpB,GAAKA,EAKL,OAAc,IAAVP,GAAeO,EAAWV,EAAM,IAKtB,IAAVG,GAAeH,EAAM,IAAMU,EAAWV,EAAM,GAJvCK,EAAc,CAACK,OAAUC,GAAY,EAAG,QASjDN,EACE,CAAW,IAAVF,EAAcO,EAAWV,EAAM,GAAc,IAAVG,EAAcO,EAAWV,EAAM,IACnEG,EACU,IAAVA,EAAc,EAAI,EACnB,EAMCS,MAAO,CAAEjC,IAAKF,GACdoC,UAAW,CACTlC,IAAK,CACHC,UAAWoB,IAGJ,aAAA,yBAEb,ECjGSc,EAAkB,EAC7BhB,eACAL,OAAQsB,EACRC,QACAC,YACAlB,gBACAmB,OAAO,aAEP,MAAOC,EAAiBC,GAAsBlB,GAAS,IAChDF,EAAOC,GAAYC,EAASJ,GAQnC,OACEuB,EACEC,EAAA,CAAA3B,SAAA,CAAAb,EAACyC,EAAS,CACRP,MAAOA,EACPC,UAAWA,EACXC,KAAMA,EACNlB,MAAO,GAAGP,EAAOO,EAAM,GAAIe,QAAUf,EAAM,GAAKP,EAAOO,EAAM,GAAIe,GAAOA,EAAIS,gBAC5EC,WAAY,CACVC,aACE5C,EAAC6C,GAAeC,SAAS,MAAKjC,SAC5Bb,EAAC+C,EAAU,CAACC,QAAS,IAAMV,GAAoBW,IAAOA,IAAe,aAAA,yBACnEjD,EAACkD,EAAY,CAAA,UAMvBlD,EAACmD,EAAK,CAAAtC,SACJb,EAACoD,EAAS,CAAAC,GAAIhB,EAA4B,aAAA,oBACxCxB,SAAAb,EAACe,EAAiB,CAACC,aAAcA,EAAcC,cAzB7B,CAACW,EAAqBP,KAC9CF,EAASS,GACTX,EAAcW,EAAUP,GACxBiB,EAAmBjB,EAAQ,EAAE,UA0B7B"}
1
+ {"version":3,"file":"index.js","sources":["../../src/date-range-calendar/date-range-calendar.tsx","../../src/date-range-picker/date-range-picker.tsx"],"sourcesContent":["import Box, { BoxProps } from \"@mui/material/Box\";\nimport { styled } from \"@mui/material/styles\";\nimport { DateCalendar, PickersDay, PickersDayProps } from \"@mui/x-date-pickers\";\nimport { endOfWeek, format, isAfter, isSameDay, startOfWeek } from \"date-fns\";\nimport { isBefore } from \"date-fns/esm\";\nimport { useState } from \"react\";\n\ntype DateRange = [Date, Date | undefined];\n\ninterface CustomPickerDayProps extends BoxProps {\n dayIsBetween: boolean;\n isFirstDay: boolean;\n isLastDay: boolean;\n}\n\nconst CustomPickersDayBackground = styled(Box, {\n shouldForwardProp: (prop) =>\n prop !== \"dayIsBetween\" &&\n prop !== \"isFirstDay\" &&\n prop !== \"isLastDay\" &&\n prop !== \"isStartOfWeek\" &&\n prop !== \"isEndOfWeek\",\n})<CustomPickerDayProps>(({ theme, dayIsBetween, isFirstDay, isLastDay }) => {\n return {\n ...((isFirstDay || isLastDay || dayIsBetween) && {\n borderRadius: 0,\n backgroundColor: `${theme.palette.primary.light}40`,\n margin: 0,\n }),\n ...(isFirstDay && {\n borderTopLeftRadius: \"50%\",\n borderBottomLeftRadius: \"50%\",\n }),\n ...(isLastDay && {\n borderTopRightRadius: \"50%\",\n borderBottomRightRadius: \"50%\",\n }),\n };\n}) as React.ComponentType<CustomPickerDayProps>;\n\nconst Day = (props: PickersDayProps<Date> & { dateRange?: DateRange | null }) => {\n const { day, dateRange, ...other } = props;\n\n if (dateRange == null) {\n return <PickersDay day={day} {...other} />;\n }\n\n const [start, end] = dateRange;\n\n const dayIsBetween = !!end && isAfter(day, start) && isBefore(day, end);\n const isFirstDay = isSameDay(day, start);\n const isLastDay = !!end && isSameDay(day, end);\n const isStartOfWeek = isSameDay(day, startOfWeek(day));\n const isEndOfWeek = isSameDay(day, endOfWeek(day));\n\n return (\n <CustomPickersDayBackground\n dayIsBetween={dayIsBetween}\n isFirstDay={isFirstDay || (dayIsBetween && isStartOfWeek)}\n isLastDay={isLastDay || (dayIsBetween && isEndOfWeek)}\n aria-label={format(day, \"yyyy-MM-dd\")}\n aria-selected={dayIsBetween || isFirstDay || isLastDay}\n role=\"gridcell\"\n >\n <PickersDay {...other} day={day} selected={isFirstDay || isLastDay} />\n </CustomPickersDayBackground>\n );\n};\n\nexport interface DateRangeCalendarProps {\n defaultValue: DateRange;\n onValueChange: (value: DateRange, updatedIndex: number) => void;\n}\nexport const DateRangeCalendar = ({ defaultValue, onValueChange }: DateRangeCalendarProps) => {\n const [value, setValue] = useState(defaultValue);\n const [index, setIndex] = useState(0);\n\n const setValueRange = (newRange: DateRange, index: number, newIndex: number) => {\n setValue(newRange);\n onValueChange(newRange, index);\n setIndex(newIndex);\n };\n\n const handleChange = (newValue: Date | null) => {\n if (!newValue) {\n return;\n }\n\n // If is the end date and is minor than the start date\n if (index === 1 && newValue < value[0]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // If is the start date and is bigger than the end date\n if (index === 0 && value[1] && newValue > value[1]) {\n return setValueRange([newValue, undefined], 0, 1);\n }\n\n // Default case\n setValueRange(\n [index === 0 ? newValue : value[0], index === 1 ? newValue : value[1]],\n index,\n index === 0 ? 1 : 0,\n );\n };\n return (\n <DateCalendar\n value={null}\n onChange={handleChange}\n slots={{ day: Day }}\n slotProps={{\n day: {\n dateRange: value,\n } as any,\n }}\n aria-label=\"calendar range picker\"\n />\n );\n};\n","import { useState } from \"react\";\nimport { format } from \"date-fns\";\nimport Collapse from \"@mui/material/Collapse\";\nimport IconButton from \"@mui/material/IconButton\";\nimport InputAdornment from \"@mui/material/InputAdornment\";\nimport TextField from \"@mui/material/TextField\";\nimport Paper from \"@mui/material/Paper\";\nimport EventIcon from \"@mui/icons-material/Event\";\nimport { DateRangeCalendar } from \"../date-range-calendar\";\n\ntype DateRange = [Date, Date | undefined];\nexport interface DateRangePickerProps {\n label: string;\n defaultValue: DateRange;\n format: string;\n fullWidth?: boolean;\n size?: \"small\" | \"medium\";\n onValueChange: (value: DateRange, index: number) => void;\n}\n\nexport const DateRangePicker = ({\n defaultValue,\n format: fmt,\n label,\n fullWidth,\n onValueChange,\n size = \"medium\",\n}: DateRangePickerProps) => {\n const [isPopoverOpened, setIsPopoverOpened] = useState(false);\n const [value, setValue] = useState(defaultValue);\n\n const handleValueChange = (newValue: DateRange, index: number) => {\n setValue(newValue);\n onValueChange(newValue, index);\n setIsPopoverOpened(index < 1);\n };\n\n return (\n <>\n <TextField\n label={label}\n fullWidth={fullWidth}\n size={size}\n value={`${format(value[0], fmt)} - ${value[1] ? format(value[1], fmt) : fmt.toUpperCase()}`}\n InputProps={{\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton onClick={() => setIsPopoverOpened((o) => !o)} aria-label=\"open calendar\">\n <EventIcon />\n </IconButton>\n </InputAdornment>\n ),\n }}\n />\n <Paper>\n <Collapse in={isPopoverOpened} aria-label=\"calendar collapse\">\n <DateRangeCalendar defaultValue={defaultValue} onValueChange={handleValueChange} />\n </Collapse>\n </Paper>\n </>\n );\n};\n"],"names":["CustomPickersDayBackground","styled","Box","shouldForwardProp","prop","theme","dayIsBetween","isFirstDay","isLastDay","borderRadius","backgroundColor","palette","primary","light","margin","borderTopLeftRadius","borderBottomLeftRadius","borderTopRightRadius","borderBottomRightRadius","Day","props","day","dateRange","other","_jsx","PickersDay","start","end","isAfter","isBefore","isSameDay","isStartOfWeek","startOfWeek","isEndOfWeek","endOfWeek","format","role","children","selected","DateRangeCalendar","defaultValue","onValueChange","value","setValue","useState","index","setIndex","setValueRange","newRange","newIndex","DateCalendar","onChange","newValue","undefined","slots","slotProps","DateRangePicker","fmt","label","fullWidth","size","isPopoverOpened","setIsPopoverOpened","_jsxs","_Fragment","TextField","toUpperCase","InputProps","endAdornment","InputAdornment","position","IconButton","onClick","o","EventIcon","Paper","Collapse","in"],"mappings":"smBAeA,MAAMA,EAA6BC,EAAOC,EAAK,CAC7CC,kBAAoBC,GACT,iBAATA,GACS,eAATA,GACS,cAATA,GACS,kBAATA,GACS,gBAATA,GAN+BH,EAOV,EAAGI,QAAOC,eAAcC,aAAYC,gBACpD,KACAD,GAAcC,GAAaF,IAAiB,CAC/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WV,EAAM,IACnEG,EACU,IAAVA,EAAc,EAAI,EACnB,EAMCS,MAAO,CAAEjC,IAAKF,GACdoC,UAAW,CACTlC,IAAK,CACHC,UAAWoB,IAGJ,aAAA,yBAEb,ECjGSc,EAAkB,EAC7BhB,eACAL,OAAQsB,EACRC,QACAC,YACAlB,gBACAmB,OAAO,aAEP,MAAOC,EAAiBC,GAAsBlB,GAAS,IAChDF,EAAOC,GAAYC,EAASJ,GAQnC,OACEuB,EACEC,EAAA,CAAA3B,SAAA,CAAAb,EAACyC,EAAS,CACRP,MAAOA,EACPC,UAAWA,EACXC,KAAMA,EACNlB,MAAO,GAAGP,EAAOO,EAAM,GAAIe,QAAUf,EAAM,GAAKP,EAAOO,EAAM,GAAIe,GAAOA,EAAIS,gBAC5EC,WAAY,CACVC,aACE5C,EAAC6C,GAAeC,SAAS,MAAKjC,SAC5Bb,EAAC+C,EAAU,CAACC,QAAS,IAAMV,GAAoBW,IAAOA,IAAe,aAAA,yBACnEjD,EAACkD,EAAY,CAAA,UAMvBlD,EAACmD,EAAK,CAAAtC,SACJb,EAACoD,EAAS,CAAAC,GAAIhB,EAA4B,aAAA,oBACxCxB,SAAAb,EAACe,EAAiB,CAACC,aAAcA,EAAcC,cAzB7B,CAACW,EAAqBP,KAC9CF,EAASS,GACTX,EAAcW,EAAUP,GACxBiB,EAAmBjB,EAAQ,EAAE,UA0B7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/drawer-provider/drawer-context.ts","../../../src/drawer-provider/drawer-mixins.ts","../../../src/drawer/drawer.tsx","../../../src/drawer/drawer.types.ts"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"~/drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { Theme, CSSObject } from \"@mui/material/styles\";\n\nexport const drawerWidth = 240;\n\nexport const openedMixin = (theme: Theme): CSSObject => ({\n width: drawerWidth,\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n overflowX: \"hidden\",\n});\n\nexport const closedMixin = (theme: Theme): CSSObject => ({\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n overflowX: \"hidden\",\n width: `calc(${theme.spacing(7)} + 1px)`,\n [theme.breakpoints.up(\"sm\")]: {\n width: `calc(${theme.spacing(8)} + 1px)`,\n },\n});\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"~/drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"~/drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import { FunctionComponent, ReactElement } from \"react\";\nimport { BulletVariant } from \"~/bullet\";\nimport { LabelVariant } from \"~/label\";\nimport { DrawerProps as MuiDrawerProps } from \"@mui/material/Drawer\";\nimport { Theme } from \"@mui/material/styles\";\nimport { DrawerAppBarProps } from \"~/drawer-app-bar\";\n\nexport type DrawerVariant = \"temporary\" | \"mini\" | \"persistent\" | \"clipped\";\nexport type DrawerState = \"open\" | \"collapse\" | \"close\";\nexport type DrawerSize = \"small\" | \"medium\";\n\nexport interface DrawerItemAvatar {\n src: string;\n alt: string;\n}\n\nexport interface DrawerItemLabel {\n text: string;\n variant: LabelVariant;\n}\n\nexport interface DrawerItemBullet {\n variant: BulletVariant;\n}\n\nexport interface DrawerNavigationItemLink {\n id: string;\n text: string;\n href: string;\n icon?: ReactElement;\n avatar?: DrawerItemAvatar;\n label?: DrawerItemLabel;\n bullet?: DrawerItemBullet;\n}\n\nexport type DrawerNavigationItemCollapsable = Pick<\n DrawerNavigationItemLink,\n \"id\" | \"text\" | \"icon\"\n> & {\n items: DrawerNavigationItem[];\n};\n\nexport type DrawerNavigationItem = DrawerNavigationItemLink | DrawerNavigationItemCollapsable;\n\nexport interface DrawerNavigationSection {\n title?: string;\n items: DrawerNavigationItem[];\n}\n\nexport interface DrawerNavigation {\n items: DrawerNavigationSection[];\n}\n\nexport interface DrawerContentProps {\n /**\n * Object with the content that has to be rendered\n */\n nav: DrawerNavigation;\n /**\n * Item size. default to medium\n */\n size?: DrawerSize;\n}\n\nexport type DrawerContentComponent = FunctionComponent<DrawerContentProps>;\nexport type DrawerContentElement = ReactElement<DrawerContentProps, DrawerContentComponent>;\n\nexport interface DrawerProps extends MuiDrawerProps {\n children: DrawerContentElement;\n}\n\nexport type DrawerComponent = FunctionComponent<DrawerProps>;\nexport type DrawerElement = ReactElement<DrawerProps, DrawerComponent>;\n\nexport const getDrawerItemColors = (theme: Theme, selected: boolean | undefined) => ({\n color: selected ? theme.palette.primary.main : undefined,\n fontWeight: selected ? theme.typography.fontWeightBold : theme.typography.fontWeightMedium,\n});\n\nexport type DrawerAppBarComponent = FunctionComponent<DrawerAppBarProps>;\nexport type DrawerAppBarElement = ReactElement<DrawerAppBarProps, DrawerAppBarComponent>;\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","openedMixin","theme","width","transition","transitions","create","easing","sharp","duration","enteringScreen","overflowX","closedMixin","leavingScreen","spacing","breakpoints","up","DrawerHeader","styled","display","alignItems","justifyContent","padding","mixins","toolbar","showCloseButton","temporary","mini","persistent","clipped","muiDrawerVariant","NoopSxGenerator","variantsSx","state","boxSizing","paperClasses","root","zIndex","drawer","children","rest","useTheme","switchState","underAppBar","close","drawerWidth","variant","context","useContext","useDrawer","sx","flexShrink","whiteSpace","drawerClasses","paper","_jsxs","MuiDrawer","open","role","onClose","_jsx","IconButton","onClick","ChevronLeftIcon","Divider","selected","color","palette","primary","main","fontWeight","typography","fontWeightBold","fontWeightMedium"],"mappings":"6bAgBO,MAAMA,EAAgBC,EAAAA,mBAA8CC,GAC9DC,EAAoB,IAAIC,MAAM,wDCb9BC,EAAeC,IAA6B,CACvDC,MAHyB,IAIzBC,WAAYF,EAAMG,YAAYC,OAAO,QAAS,CAC5CC,OAAQL,EAAMG,YAAYE,OAAOC,MACjCC,SAAUP,EAAMG,YAAYI,SAASC,iBAEvCC,UAAW,WAGAC,EAAeV,IAA6B,CACvDE,WAAYF,EAAMG,YAAYC,OAAO,QAAS,CAC5CC,OAAQL,EAAMG,YAAYE,OAAOC,MACjCC,SAAUP,EAAMG,YAAYI,SAASI,gBAEvCF,UAAW,SACXR,MAAO,QAAQD,EAAMY,QAAQ,YAC7B,CAACZ,EAAMa,YAAYC,GAAG,OAAQ,CAC5Bb,MAAO,QAAQD,EAAMY,QAAQ,eCXpBG,EAAeC,EAAAA,OAAO,MAAPA,EAAc,EAAGhB,YAAa,CACxDiB,QAAS,OACTC,WAAY,SACZC,eAAgB,WAChBC,QAASpB,EAAMY,QAAQ,EAAG,MACvBZ,EAAMqB,OAAOC,YAGZC,EAAkD,CACtDC,WAAW,EACXC,MAAM,EACNC,YAAY,EACZC,SAAS,GAGLC,EAAoF,CACxFJ,UAAW,YACXC,KAAM,YACNE,QAAS,YACTD,WAAY,cAIRG,EAAkB,KAAO,CAAE,GAC3BC,EAA2D,CAC/DL,KAAM,CAACM,EAAoB/B,KAAkB,CAC3CgC,UAAW,aACX,CAAC,MAAMC,eAAaC,QAAS,CAC3BC,OAAQnC,EAAMmC,OAAOC,OAAS,KAGlCZ,UAAWK,EACXF,QAASE,EACTH,WAAYG,kBAGyB,EAAGQ,cAAaC,MACrD,MAAMtC,EAAQuC,EAAAA,YACRR,MAAEA,EAAKS,YAAEA,EAAWC,YAAEA,EAAWC,MAAEA,EAAKC,YAAEA,EAAWC,QAAEA,GF7BtC,MACvB,MAAMC,EAAUC,aAAWpD,GAE3B,QAAgBE,IAAZiD,EACF,MAAMhD,EAGR,OAAOgD,CAAO,EEsB2DE,GAEnEC,EAAU,CACd/C,MAAO0C,EACPM,WAAY,EACZC,WAAY,YACE,SAAVnB,GAAoB,IACnBhC,EAAYC,GACf,CAAC,MAAMmD,EAAaA,cAACC,SAAUrD,EAAYC,OAE/B,SAAV+B,GAAoB,IACnBrB,EAAYV,GACf,CAAC,MAAMmD,EAAaA,cAACC,SAAU1C,EAAYV,OAE1C8B,EAAWc,GAASb,EAAO/B,IAGhC,OACEqD,OAACC,EAAAA,QAAS,CACRC,KAAgB,SAAVxB,EACNa,QAAShB,EAAiBgB,GAC1BY,KAAK,OACQ,cAAU,UAAVzB,EACb0B,QAASf,EACTM,GAAIA,KACAV,EAEJD,SAAA,CAAAqB,MAAC3C,EAAY,CAAAsB,UACTI,GAAelB,EAAgBqB,IAC/Bc,MAACC,EAAAA,SAAWC,QAASpB,EAAWH,SAC9BqB,EAAAA,IAACG,EAAe,QAAG,QAIzBH,EAAAA,IAACI,EAAO,QAAG,IACVzB,IAEH,qDCX+B,CAACrC,EAAc+D,KAAmC,CACnFC,MAAOD,EAAW/D,EAAMiE,QAAQC,QAAQC,UAAOvE,EAC/CwE,WAAYL,EAAW/D,EAAMqE,WAAWC,eAAiBtE,EAAMqE,WAAWE"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/drawer-provider/drawer-context.ts","../../../src/drawer-provider/drawer-mixins.ts","../../../src/drawer/drawer.tsx","../../../src/drawer/drawer.types.ts"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"../drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { Theme, CSSObject } from \"@mui/material/styles\";\n\nexport const drawerWidth = 240;\n\nexport const openedMixin = (theme: Theme): CSSObject => ({\n width: drawerWidth,\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n overflowX: \"hidden\",\n});\n\nexport const closedMixin = (theme: Theme): CSSObject => ({\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n overflowX: \"hidden\",\n width: `calc(${theme.spacing(7)} + 1px)`,\n [theme.breakpoints.up(\"sm\")]: {\n width: `calc(${theme.spacing(8)} + 1px)`,\n },\n});\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"../drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"../drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import { FunctionComponent, ReactElement } from \"react\";\nimport { BulletVariant } from \"../bullet\";\nimport { LabelVariant } from \"../label\";\nimport { DrawerProps as MuiDrawerProps } from \"@mui/material/Drawer\";\nimport { Theme } from \"@mui/material/styles\";\nimport { DrawerAppBarProps } from \"../drawer-app-bar\";\n\nexport type DrawerVariant = \"temporary\" | \"mini\" | \"persistent\" | \"clipped\";\nexport type DrawerState = \"open\" | \"collapse\" | \"close\";\nexport type DrawerSize = \"small\" | \"medium\";\n\nexport interface DrawerItemAvatar {\n src: string;\n alt: string;\n}\n\nexport interface DrawerItemLabel {\n text: string;\n variant: LabelVariant;\n}\n\nexport interface DrawerItemBullet {\n variant: BulletVariant;\n}\n\nexport interface DrawerNavigationItemLink {\n id: string;\n text: string;\n href: string;\n icon?: ReactElement;\n avatar?: DrawerItemAvatar;\n label?: DrawerItemLabel;\n bullet?: DrawerItemBullet;\n}\n\nexport type DrawerNavigationItemCollapsable = Pick<\n DrawerNavigationItemLink,\n \"id\" | \"text\" | \"icon\"\n> & {\n items: DrawerNavigationItem[];\n};\n\nexport type DrawerNavigationItem = DrawerNavigationItemLink | DrawerNavigationItemCollapsable;\n\nexport interface DrawerNavigationSection {\n title?: string;\n items: DrawerNavigationItem[];\n}\n\nexport interface DrawerNavigation {\n items: DrawerNavigationSection[];\n}\n\nexport interface DrawerContentProps {\n /**\n * Object with the content that has to be rendered\n */\n nav: DrawerNavigation;\n /**\n * Item size. default to medium\n */\n size?: DrawerSize;\n}\n\nexport type DrawerContentComponent = FunctionComponent<DrawerContentProps>;\nexport type DrawerContentElement = ReactElement<DrawerContentProps, DrawerContentComponent>;\n\nexport interface DrawerProps extends MuiDrawerProps {\n children: DrawerContentElement;\n}\n\nexport type DrawerComponent = FunctionComponent<DrawerProps>;\nexport type DrawerElement = ReactElement<DrawerProps, DrawerComponent>;\n\nexport const getDrawerItemColors = (theme: Theme, selected: boolean | undefined) => ({\n color: selected ? theme.palette.primary.main : undefined,\n fontWeight: selected ? theme.typography.fontWeightBold : theme.typography.fontWeightMedium,\n});\n\nexport type DrawerAppBarComponent = FunctionComponent<DrawerAppBarProps>;\nexport type DrawerAppBarElement = ReactElement<DrawerAppBarProps, DrawerAppBarComponent>;\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","openedMixin","theme","width","transition","transitions","create","easing","sharp","duration","enteringScreen","overflowX","closedMixin","leavingScreen","spacing","breakpoints","up","DrawerHeader","styled","display","alignItems","justifyContent","padding","mixins","toolbar","showCloseButton","temporary","mini","persistent","clipped","muiDrawerVariant","NoopSxGenerator","variantsSx","state","boxSizing","paperClasses","root","zIndex","drawer","children","rest","useTheme","switchState","underAppBar","close","drawerWidth","variant","context","useContext","useDrawer","sx","flexShrink","whiteSpace","drawerClasses","paper","_jsxs","MuiDrawer","open","role","onClose","_jsx","IconButton","onClick","ChevronLeftIcon","Divider","selected","color","palette","primary","main","fontWeight","typography","fontWeightBold","fontWeightMedium"],"mappings":"6bAgBO,MAAMA,EAAgBC,EAAAA,mBAA8CC,GAC9DC,EAAoB,IAAIC,MAAM,wDCb9BC,EAAeC,IAA6B,CACvDC,MAHyB,IAIzBC,WAAYF,EAAMG,YAAYC,OAAO,QAAS,CAC5CC,OAAQL,EAAMG,YAAYE,OAAOC,MACjCC,SAAUP,EAAMG,YAAYI,SAASC,iBAEvCC,UAAW,WAGAC,EAAeV,IAA6B,CACvDE,WAAYF,EAAMG,YAAYC,OAAO,QAAS,CAC5CC,OAAQL,EAAMG,YAAYE,OAAOC,MACjCC,SAAUP,EAAMG,YAAYI,SAASI,gBAEvCF,UAAW,SACXR,MAAO,QAAQD,EAAMY,QAAQ,YAC7B,CAACZ,EAAMa,YAAYC,GAAG,OAAQ,CAC5Bb,MAAO,QAAQD,EAAMY,QAAQ,eCXpBG,EAAeC,EAAAA,OAAO,MAAPA,EAAc,EAAGhB,YAAa,CACxDiB,QAAS,OACTC,WAAY,SACZC,eAAgB,WAChBC,QAASpB,EAAMY,QAAQ,EAAG,MACvBZ,EAAMqB,OAAOC,YAGZC,EAAkD,CACtDC,WAAW,EACXC,MAAM,EACNC,YAAY,EACZC,SAAS,GAGLC,EAAoF,CACxFJ,UAAW,YACXC,KAAM,YACNE,QAAS,YACTD,WAAY,cAIRG,EAAkB,KAAO,CAAE,GA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Variant } from "~/bullet";
3
- import { LabelVariant } from "~/label";
2
+ import { BulletVariant } from "../bullet";
3
+ import { LabelVariant } from "../label";
4
4
  import { DrawerProps as MuiDrawerProps } from "@mui/material/Drawer";
5
5
  import { Theme } from "@mui/material/styles";
6
- import { DrawerAppBarProps } from "~/drawer-app-bar";
6
+ import { DrawerAppBarProps } from "../drawer-app-bar";
7
7
  export type DrawerVariant = "temporary" | "mini" | "persistent" | "clipped";
8
8
  export type DrawerState = "open" | "collapse" | "close";
9
9
  export type DrawerSize = "small" | "medium";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/drawer-provider/drawer-context.ts","../../src/drawer-provider/drawer-mixins.ts","../../src/drawer/drawer.tsx","../../src/drawer/drawer.types.ts"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"~/drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { Theme, CSSObject } from \"@mui/material/styles\";\n\nexport const drawerWidth = 240;\n\nexport const openedMixin = (theme: Theme): CSSObject => ({\n width: drawerWidth,\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n overflowX: \"hidden\",\n});\n\nexport const closedMixin = (theme: Theme): CSSObject => ({\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n overflowX: \"hidden\",\n width: `calc(${theme.spacing(7)} + 1px)`,\n [theme.breakpoints.up(\"sm\")]: {\n width: `calc(${theme.spacing(8)} + 1px)`,\n },\n});\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"~/drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"~/drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import { FunctionComponent, ReactElement } from \"react\";\nimport { BulletVariant } from \"~/bullet\";\nimport { LabelVariant } from \"~/label\";\nimport { DrawerProps as MuiDrawerProps } from \"@mui/material/Drawer\";\nimport { Theme } from \"@mui/material/styles\";\nimport { DrawerAppBarProps } from \"~/drawer-app-bar\";\n\nexport type DrawerVariant = \"temporary\" | \"mini\" | \"persistent\" | \"clipped\";\nexport type DrawerState = \"open\" | \"collapse\" | \"close\";\nexport type DrawerSize = \"small\" | \"medium\";\n\nexport interface DrawerItemAvatar {\n src: string;\n alt: string;\n}\n\nexport interface DrawerItemLabel {\n text: string;\n variant: LabelVariant;\n}\n\nexport interface DrawerItemBullet {\n variant: BulletVariant;\n}\n\nexport interface DrawerNavigationItemLink {\n id: string;\n text: string;\n href: string;\n icon?: ReactElement;\n avatar?: DrawerItemAvatar;\n label?: DrawerItemLabel;\n bullet?: DrawerItemBullet;\n}\n\nexport type DrawerNavigationItemCollapsable = Pick<\n DrawerNavigationItemLink,\n \"id\" | \"text\" | \"icon\"\n> & {\n items: DrawerNavigationItem[];\n};\n\nexport type DrawerNavigationItem = DrawerNavigationItemLink | DrawerNavigationItemCollapsable;\n\nexport interface DrawerNavigationSection {\n title?: string;\n items: DrawerNavigationItem[];\n}\n\nexport interface DrawerNavigation {\n items: DrawerNavigationSection[];\n}\n\nexport interface DrawerContentProps {\n /**\n * Object with the content that has to be rendered\n */\n nav: DrawerNavigation;\n /**\n * Item size. default to medium\n */\n size?: DrawerSize;\n}\n\nexport type DrawerContentComponent = FunctionComponent<DrawerContentProps>;\nexport type DrawerContentElement = ReactElement<DrawerContentProps, DrawerContentComponent>;\n\nexport interface DrawerProps extends MuiDrawerProps {\n children: DrawerContentElement;\n}\n\nexport type DrawerComponent = FunctionComponent<DrawerProps>;\nexport type DrawerElement = ReactElement<DrawerProps, DrawerComponent>;\n\nexport const getDrawerItemColors = (theme: Theme, selected: boolean | undefined) => ({\n color: selected ? theme.palette.primary.main : undefined,\n fontWeight: selected ? theme.typography.fontWeightBold : theme.typography.fontWeightMedium,\n});\n\nexport type DrawerAppBarComponent = FunctionComponent<DrawerAppBarProps>;\nexport type DrawerAppBarElement = ReactElement<DrawerAppBarProps, DrawerAppBarComponent>;\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","openedMixin","theme","width","transition","transitions","create","easing","sharp","duration","enteringScreen","overflowX","closedMixin","leavingScreen","spacing","breakpoints","up","DrawerHeader","styled","display","alignItems","justifyContent","padding","mixins","toolbar","showCloseButton","temporary","mini","persistent","clipped","muiDrawerVariant","NoopSxGenerator","variantsSx","state","boxSizing","paperClasses","root","zIndex","drawer","Drawer","children","rest","useTheme","switchState","underAppBar","close","drawerWidth","variant","context","useContext","useDrawer","sx","flexShrink","whiteSpace","drawerClasses","paper","_jsxs","MuiDrawer","open","role","onClose","_jsx","IconButton","onClick","ChevronLeftIcon","Divider","getDrawerItemColors","selected","color","palette","primary","main","fontWeight","typography","fontWeightBold","fontWeightMedium"],"mappings":"2YAgBO,MAAMA,EAAgBC,OAA8CC,GAC9DC,EAAoB,IAAIC,MAAM,wDCb9BC,EAAeC,IAA6B,CACvDC,MAHyB,IAIzBC,WAAYF,EAAMG,YAAYC,OAAO,QAAS,CAC5CC,OAAQL,EAAMG,YAAYE,OAAOC,MACjCC,SAAUP,EAAMG,YAAYI,SAASC,iBAEvCC,UAAW,WAGAC,E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,OACEsD,EAACC,EAAS,CACRC,KAAgB,SAAVzB,EACNc,QAASjB,EAAiBiB,GAC1BY,KAAK,OACQ,cAAU,UAAV1B,EACb2B,QAASf,EACTM,GAAIA,KACAV,EAEJD,SAAA,CAAAqB,EAAC5C,EAAY,CAAAuB,UACTI,GAAenB,EAAgBsB,IAC/Bc,EAACC,GAAWC,QAASpB,EAAWH,SAC9BqB,EAACG,EAAkB,QAIzBH,EAACI,EAAU,IACVzB,IAEH,ECXS0B,EAAsB,CAAChE,EAAciE,KAAmC,CACnFC,MAAOD,EAAWjE,EAAMmE,QAAQC,QAAQC,UAAOzE,EAC/C0E,WAAYL,EAAWjE,EAAMuE,WAAWC,eAAiBxE,EAAMuE,WAAWE"}
1
+ {"version":3,"file":"index.js","sources":["../../src/drawer-provider/drawer-context.ts","../../src/drawer-provider/drawer-mixins.ts","../../src/drawer/drawer.tsx","../../src/drawer/drawer.types.ts"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"../drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { Theme, CSSObject } from \"@mui/material/styles\";\n\nexport const drawerWidth = 240;\n\nexport const openedMixin = (theme: Theme): CSSObject => ({\n width: drawerWidth,\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n overflowX: \"hidden\",\n});\n\nexport const closedMixin = (theme: Theme): CSSObject => ({\n transition: theme.transitions.create(\"width\", {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n overflowX: \"hidden\",\n width: `calc(${theme.spacing(7)} + 1px)`,\n [theme.breakpoints.up(\"sm\")]: {\n width: `calc(${theme.spacing(8)} + 1px)`,\n },\n});\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"../drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"../drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import { FunctionComponent, ReactElement } from \"react\";\nimport { BulletVariant } from \"../bullet\";\nimport { LabelVariant } from \"../label\";\nimport { DrawerProps as MuiDrawerProps } from \"@mui/material/Drawer\";\nimport { Theme } from \"@mui/material/styles\";\nimport { DrawerAppBarProps } from \"../drawer-app-bar\";\n\nexport type DrawerVariant = \"temporary\" | \"mini\" | \"persistent\" | \"clipped\";\nexport type DrawerState = \"open\" | \"collapse\" | \"close\";\nexport type DrawerSize = \"small\" | \"medium\";\n\nexport interface DrawerItemAvatar {\n src: string;\n alt: string;\n}\n\nexport interface DrawerItemLabel {\n text: string;\n variant: LabelVariant;\n}\n\nexport interface DrawerItemBullet {\n variant: BulletVariant;\n}\n\nexport interface DrawerNavigationItemLink {\n id: string;\n text: string;\n href: string;\n icon?: ReactElement;\n avatar?: DrawerItemAvatar;\n label?: DrawerItemLabel;\n bullet?: DrawerItemBullet;\n}\n\nexport type DrawerNavigationItemCollapsable = Pick<\n DrawerNavigationItemLink,\n \"id\" | \"text\" | \"icon\"\n> & {\n items: DrawerNavigationItem[];\n};\n\nexport type DrawerNavigationItem = DrawerNavigationItemLink | DrawerNavigationItemCollapsable;\n\nexport interface DrawerNavigationSection {\n title?: string;\n items: DrawerNavigationItem[];\n}\n\nexport interface DrawerNavigation {\n items: DrawerNavigationSection[];\n}\n\nexport interface DrawerContentProps {\n /**\n * Object with the content that has to be rendered\n */\n nav: DrawerNavigation;\n /**\n * Item size. default to medium\n */\n size?: DrawerSize;\n}\n\nexport type DrawerContentComponent = FunctionComponent<DrawerContentProps>;\nexport type DrawerContentElement = ReactElement<DrawerContentProps, DrawerContentComponent>;\n\nexport interface DrawerProps extends MuiDrawerProps {\n children: DrawerContentElement;\n}\n\nexport type DrawerComponent = FunctionComponent<DrawerProps>;\nexport type DrawerElement = ReactElement<DrawerProps, DrawerComponent>;\n\nexport const getDrawerItemColors = (theme: Theme, selected: boolean | undefined) => ({\n color: selected ? theme.palette.primary.main : undefined,\n fontWeight: selected ? theme.typography.fontWeightBold : theme.typography.fontWeightMedium,\n});\n\nexport type DrawerAppBarComponent = FunctionComponent<DrawerAppBarProps>;\nexport type DrawerAppBarElement = ReactElement<DrawerAppBarProps, DrawerAppBarComponent>;\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","openedMixin","theme","width","transition","transitions","create","easing","sharp","duration","enteringScreen","overflowX","closedMixin","leavingScreen","spacing","breakpoints","up","DrawerHeader","styled","display","alignItems","justifyContent","padding","mixins","toolbar","showCloseButton","temporary","mini","persistent","clipped","muiDrawerVariant","NoopSxGenerator","variantsSx","state","boxSizing","paperClasses","root","zIndex","drawer","Drawer","children","rest","useTheme","switchState","underAppBar","close","drawerWidth","variant","context","useContext","useDrawer","sx","flexShrink","whiteSpace","drawerClasses","paper","_jsxs","MuiDrawer","open","role","onClose","_jsx","IconButton","onClick","ChevronLeftIcon","Divider","getDrawerItemColors","selected","color","palette","primary","main","fontWeight","typography","fontWeightBold","fontWeightMedium"],"mappings":"2YAgBO,MAAMA,EAAgBC,OAA8CC,GAC9DC,EAAoB,IAAIC,MAAM,wDCb9BC,EAAeC,IAA6B,CACvDC,MAHyB,IAIzBC,WAAYF,EAAMG,YAAYC,OAAO,QAAS,C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IACnBrB,EAAYV,GACf,CAAC,MAAMoD,EAAcC,SAAU3C,EAAYV,OAE1C8B,EAAWe,GAASd,EAAO/B,IAGhC,OACEsD,EAACC,EAAS,CACRC,KAAgB,SAAVzB,EACNc,QAASjB,EAAiBiB,GAC1BY,KAAK,OACQ,cAAU,UAAV1B,EACb2B,QAASf,EACTM,GAAIA,KACAV,EAEJD,SAAA,CAAAqB,EAAC5C,EAAY,CAAAuB,UACTI,GAAenB,EAAgBsB,IAC/Bc,EAACC,GAAWC,QAASpB,EAAWH,SAC9BqB,EAACG,EAAkB,QAIzBH,EAACI,EAAU,IACVzB,IAEH,ECXS0B,EAAsB,CAAChE,EAAciE,KAAmC,CACnFC,MAAOD,EAAWjE,EAAMmE,QAAQC,QAAQC,UAAOzE,EAC/C0E,WAAYL,EAAWjE,EAAMuE,WAAWC,eAAiBxE,EAAMuE,WAAWE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/drawer-provider/drawer-context.ts","../../../src/drawer/drawer.tsx","../../../src/drawer-app-bar/drawer-app-bar.tsx"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"~/drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"~/drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"~/drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import MuiAppBar from \"@mui/material/AppBar\";\nimport Toolbar from \"@mui/material/Toolbar\";\nimport IconButton from \"@mui/material/IconButton\";\nimport Typography from \"@mui/material/Typography\";\nimport { useTheme, Theme } from \"@mui/material/styles\";\nimport MenuIcon from \"@mui/icons-material/Menu\";\nimport { useDrawer } from \"~/drawer-provider\";\nimport { AppBarProps as MuiAppBarProps } from \"@mui/material\";\nimport { DrawerState, DrawerVariant } from \"~/drawer\";\n\nconst moveWithDrawer: Record<DrawerVariant, boolean> = {\n temporary: false,\n mini: true,\n persistent: true,\n clipped: true,\n};\n\nconst showMenuButton: Record<DrawerVariant, (state: DrawerState) => boolean> = {\n temporary: () => true,\n mini: (state) => state !== \"open\",\n persistent: () => true,\n clipped: () => false,\n};\n\nexport interface DrawerAppBarProps extends MuiAppBarProps {\n title?: string;\n}\n\nexport const DrawerAppBar = ({ title, sx, children, ...rest }: DrawerAppBarProps) => {\n const theme = useTheme();\n const { state, variant, switchState, drawerWidth, underAppBar } = useDrawer();\n\n const rootSx =\n (moveWithDrawer[variant] &&\n !underAppBar && {\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n ...(state === \"open\" && {\n marginLeft: drawerWidth,\n width: `calc(100% - ${drawerWidth}px)`,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n }),\n }) ||\n {};\n\n return (\n <MuiAppBar\n position={underAppBar ? \"fixed\" : undefined}\n {...rest}\n sx={{\n ...sx,\n ...rootSx,\n zIndex: (theme: Theme) => theme.zIndex.drawer + (underAppBar ? 1 : 0),\n }}\n >\n <Toolbar>\n <IconButton\n color=\"inherit\"\n aria-label=\"open drawer\"\n onClick={switchState}\n edge=\"start\"\n sx={{\n marginRight: 5,\n display: showMenuButton[variant](state) ? undefined : \"none\",\n }}\n >\n <MenuIcon />\n </IconButton>\n {title && (\n <Typography variant=\"h6\" component=\"h1\" role=\"heading\" aria-level={1} noWrap>\n {title}\n </Typography>\n )}\n {children}\n </Toolbar>\n </MuiAppBar>\n );\n};\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","styled","theme","display","alignItems","justifyContent","padding","spacing","mixins","toolbar","moveWithDrawer","temporary","mini","persistent","clipped","showMenuButton","state","title","sx","children","rest","useTheme","variant","switchState","drawerWidth","underAppBar","context","useContext","useDrawer","rootSx","transition","transitions","create","easing","sharp","duration","leavingScreen","marginLeft","width","enteringScreen","_jsx","jsx","MuiAppBar","position","zIndex","drawer","_jsxs","Toolbar","IconButton","color","onClick","edge","marginRight","MenuIcon","Typography","component","role","noWrap"],"mappings":"ilBAgBO,MAAMA,EAAgBC,EAAAA,mBAA8CC,GAC9DC,EAAoB,IAAIC,MAAM,wDCPfC,EAAMA,OAAC,MAAPA,EAAc,EAAGC,YAAa,CACxDC,QAAS,OACTC,WAAY,SACZC,eAAgB,WAChBC,QAASJ,EAAMK,QAAQ,EAAG,MACvBL,EAAMM,OAAOC,YCLlB,MAAMC,EAAiD,CACrDC,WAAW,EACXC,MAAM,EACNC,YAAY,EACZC,SAAS,GAGLC,EAAyE,CAC7EJ,UAAW,KAAM,EACjBC,KAAOI,GAAoB,SAAVA,EACjBH,WAAY,KAAM,EAClBC,QAAS,KAAM,wBAOW,EAAGG,QAAOC,KAAIC,cAAaC,MACrD,MAAMlB,EAAQmB,EAAAA,YACRL,MAAEA,EAAKM,QAAEA,EAAOC,YAAEA,EAAWC,YAAEA,EAAWC,YAAEA,GFX3B,MACvB,MAAMC,EAAUC,aAAW/B,GAE3B,QAAgBE,IAAZ4B,EACF,MAAM3B,EAGR,OAAO2B,CAAO,EEIoDE,GAE5DC,EACHnB,EAAeY,KACbG,GAAe,CACdK,WAAY5B,EAAM6B,YAAYC,OAAO,CAAC,QAAS,UAAW,CACxDC,OAAQ/B,EAAM6B,YAAYE,OAAOC,MACjCC,SAAUjC,EAAM6B,YAAYI,SAASC,mBAEzB,SAAVpB,GAAoB,CACtBqB,WAAYb,EACZc,MAAO,eAAed,OACtBM,WAAY5B,EAAM6B,YAAYC,OAAO,CAAC,QAAS,UAAW,CACxDC,OAAQ/B,EAAM6B,YAAYE,OAAOC,MACjCC,SAAUjC,EAAM6B,YAAYI,SAASI,oBAI7C,GAEF,OACEC,EAACC,IAAAC,WACCC,SAAUlB,EAAc,aAAU3B,KAC9BsB,EACJF,GAAI,IACCA,KACAW,EACHe,OAAS1C,GAAiBA,EAAM0C,OAAOC,QAAUpB,EAAc,EAAI,IAGrEN,SAAA2B,EAAAA,KAACC,EAAO,QACN,CAAA5B,SAAA,CAAAqB,EAAAC,IAACO,UACC,CAAAC,MAAM,UAAS,aACJ,cACXC,QAAS3B,EACT4B,KAAK,QACLjC,GAAI,CACFkC,YAAa,EACbjD,QAASY,EAAeO,GAASN,QAASlB,EAAY,QACvDqB,SAEDqB,EAACC,IAAAY,UAAW,CAAA,KAEbpC,GACCuB,EAAAA,IAACc,EAAAA,QAAW,CAAAhC,QAAQ,KAAKiC,UAAU,KAAKC,KAAK,UAAsB,aAAA,EAAGC,QAAM,EAAAtC,SACzEF,IAGJE,MAGL"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/drawer-provider/drawer-context.ts","../../../src/drawer/drawer.tsx","../../../src/drawer-app-bar/drawer-app-bar.tsx"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"../drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"../drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"../drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import MuiAppBar from \"@mui/material/AppBar\";\nimport Toolbar from \"@mui/material/Toolbar\";\nimport IconButton from \"@mui/material/IconButton\";\nimport Typography from \"@mui/material/Typography\";\nimport { useTheme, Theme } from \"@mui/material/styles\";\nimport MenuIcon from \"@mui/icons-material/Menu\";\nimport { useDrawer } from \"../drawer-provider\";\nimport { AppBarProps as MuiAppBarProps } from \"@mui/material\";\nimport { DrawerState, DrawerVariant } from \"../drawer\";\n\nconst moveWithDrawer: Record<DrawerVariant, boolean> = {\n temporary: false,\n mini: true,\n persistent: true,\n clipped: true,\n};\n\nconst showMenuButton: Record<DrawerVariant, (state: DrawerState) => boolean> = {\n temporary: () => true,\n mini: (state) => state !== \"open\",\n persistent: () => true,\n clipped: () => false,\n};\n\nexport interface DrawerAppBarProps extends MuiAppBarProps {\n title?: string;\n}\n\nexport const DrawerAppBar = ({ title, sx, children, ...rest }: DrawerAppBarProps) => {\n const theme = useTheme();\n const { state, variant, switchState, drawerWidth, underAppBar } = useDrawer();\n\n const rootSx =\n (moveWithDrawer[variant] &&\n !underAppBar && {\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n ...(state === \"open\" && {\n marginLeft: drawerWidth,\n width: `calc(100% - ${drawerWidth}px)`,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n }),\n }) ||\n {};\n\n return (\n <MuiAppBar\n position={underAppBar ? \"fixed\" : undefined}\n {...rest}\n sx={{\n ...sx,\n ...rootSx,\n zIndex: (theme: Theme) => theme.zIndex.drawer + (underAppBar ? 1 : 0),\n }}\n >\n <Toolbar>\n <IconButton\n color=\"inherit\"\n aria-label=\"open drawer\"\n onClick={switchState}\n edge=\"start\"\n sx={{\n marginRight: 5,\n display: showMenuButton[variant](state) ? undefined : \"none\",\n }}\n >\n <MenuIcon />\n </IconButton>\n {title && (\n <Typography variant=\"h6\" component=\"h1\" role=\"heading\" aria-level={1} noWrap>\n {title}\n </Typography>\n )}\n {children}\n </Toolbar>\n </MuiAppBar>\n );\n};\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","styled","theme","display","alignItems","justifyContent","padding","spacing","mixins","toolbar","moveWithDrawer","temporary","mini","persistent","clipped","showMenuButton","state","title","sx","children","rest","useTheme","variant","switchState","drawerWidth","underAppBar","context","useContext","useDrawer","rootSx","transition","transitions","create","easing","sharp","duration","leavingScreen","marginLeft","width","enteringScreen","_jsx","jsx","MuiAppBar","position","zIndex","drawer","_jsxs","Toolbar","IconButton","color","onClick","edge","marginRight","MenuIcon","Typography","component","role","noWrap"],"mappings":"ilBAgBO,MAAMA,EAAgBC,EAAAA,mBAA8CC,GAC9DC,EAAoB,IAAIC,MAAM,wDCPfC,EAAMA,OAAC,MAAPA,EAAc,EAAGC,YAAa,CACxDC,QAAS,OACTC,WAAY,SACZC,eAAgB,WAChBC,QAASJ,EAAMK,QAAQ,EAAG,MACvBL,EAAMM,OAAOC,YCLlB,MAAMC,EAAiD,CACrDC,WAAW,EACXC,MAAM,EACNC,YAAY,EACZC,SAAS,GAGLC,EAAyE,CAC7EJ,UAAW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"version":3,"file":"index.js","sources":["../../src/drawer-provider/drawer-context.ts","../../src/drawer/drawer.tsx","../../src/drawer-app-bar/drawer-app-bar.tsx"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"~/drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"~/drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"~/drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import MuiAppBar from \"@mui/material/AppBar\";\nimport Toolbar from \"@mui/material/Toolbar\";\nimport IconButton from \"@mui/material/IconButton\";\nimport Typography from \"@mui/material/Typography\";\nimport { useTheme, Theme } from \"@mui/material/styles\";\nimport MenuIcon from \"@mui/icons-material/Menu\";\nimport { useDrawer } from \"~/drawer-provider\";\nimport { AppBarProps as MuiAppBarProps } from \"@mui/material\";\nimport { DrawerState, DrawerVariant } from \"~/drawer\";\n\nconst moveWithDrawer: Record<DrawerVariant, boolean> = {\n temporary: false,\n mini: true,\n persistent: true,\n clipped: true,\n};\n\nconst showMenuButton: Record<DrawerVariant, (state: DrawerState) => boolean> = {\n temporary: () => true,\n mini: (state) => state !== \"open\",\n persistent: () => true,\n clipped: () => false,\n};\n\nexport interface DrawerAppBarProps extends MuiAppBarProps {\n title?: string;\n}\n\nexport const DrawerAppBar = ({ title, sx, children, ...rest }: DrawerAppBarProps) => {\n const theme = useTheme();\n const { state, variant, switchState, drawerWidth, underAppBar } = useDrawer();\n\n const rootSx =\n (moveWithDrawer[variant] &&\n !underAppBar && {\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n ...(state === \"open\" && {\n marginLeft: drawerWidth,\n width: `calc(100% - ${drawerWidth}px)`,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n }),\n }) ||\n {};\n\n return (\n <MuiAppBar\n position={underAppBar ? \"fixed\" : undefined}\n {...rest}\n sx={{\n ...sx,\n ...rootSx,\n zIndex: (theme: Theme) => theme.zIndex.drawer + (underAppBar ? 1 : 0),\n }}\n >\n <Toolbar>\n <IconButton\n color=\"inherit\"\n aria-label=\"open drawer\"\n onClick={switchState}\n edge=\"start\"\n sx={{\n marginRight: 5,\n display: showMenuButton[variant](state) ? undefined : \"none\",\n }}\n >\n <MenuIcon />\n </IconButton>\n {title && (\n <Typography variant=\"h6\" component=\"h1\" role=\"heading\" aria-level={1} noWrap>\n {title}\n </Typography>\n )}\n {children}\n </Toolbar>\n </MuiAppBar>\n );\n};\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","styled","theme","display","alignItems","justifyContent","padding","spacing","mixins","toolbar","moveWithDrawer","temporary","mini","persistent","clipped","showMenuButton","state","DrawerAppBar","title","sx","children","rest","useTheme","variant","switchState","drawerWidth","underAppBar","context","useContext","useDrawer","rootSx","transition","transitions","create","easing","sharp","duration","leavingScreen","marginLeft","width","enteringScreen","_jsx","MuiAppBar","position","zIndex","drawer","_jsxs","Toolbar","IconButton","color","onClick","edge","marginRight","Men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C,QAAS1B,EACT2B,KAAK,QACLhC,GAAI,CACFiC,YAAa,EACbjD,QAASY,EAAeQ,GAASP,QAASlB,EAAY,QACvDsB,SAEDqB,EAACY,EAAW,CAAA,KAEbnC,GACCuB,EAACa,EAAW,CAAA/B,QAAQ,KAAKgC,UAAU,KAAKC,KAAK,UAAsB,aAAA,EAAGC,QAAM,EAAArC,SACzEF,IAGJE,MAGL"}
1
+ {"version":3,"file":"index.js","sources":["../../src/drawer-provider/drawer-context.ts","../../src/drawer/drawer.tsx","../../src/drawer-app-bar/drawer-app-bar.tsx"],"sourcesContent":["import { useContext, createContext } from \"react\";\nimport { DrawerState, DrawerVariant } from \"../drawer\";\n\nexport interface DrawerContextProps {\n selectedItemId?: string;\n state: DrawerState;\n variant: DrawerVariant;\n drawerWidth: number;\n underAppBar: boolean;\n switchState(): void;\n close(): void;\n collapse(): void;\n open(): void;\n setState: (state: DrawerState) => void;\n}\n\nexport const DrawerContext = createContext<DrawerContextProps | undefined>(undefined);\nexport const UndefinedProvider = new Error(\"DrawerContext.Provider is required and was undefined\");\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext);\n\n if (context === undefined) {\n throw UndefinedProvider;\n }\n\n return context;\n};\n","import { SxProps, Theme, styled, useTheme } from \"@mui/material/styles\";\nimport MuiDrawer, { drawerClasses } from \"@mui/material/Drawer\";\nimport { paperClasses } from \"@mui/material/Paper\";\nimport Divider from \"@mui/material/Divider\";\nimport IconButton from \"@mui/material/IconButton\";\nimport ChevronLeftIcon from \"@mui/icons-material/ChevronLeft\";\nimport { DrawerComponent, DrawerProps, DrawerState, DrawerVariant } from \"./drawer.types\";\nimport { useDrawer } from \"../drawer-provider/drawer-context\";\nimport { closedMixin, openedMixin } from \"../drawer-provider/drawer-mixins\";\n\nexport const DrawerHeader = styled(\"div\")(({ theme }) => ({\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"flex-end\",\n padding: theme.spacing(0, 1),\n ...theme.mixins.toolbar,\n}));\n\nconst showCloseButton: Record<DrawerVariant, boolean> = {\n temporary: true,\n mini: true,\n persistent: true,\n clipped: false,\n};\n\nconst muiDrawerVariant: Record<DrawerVariant, \"permanent\" | \"persistent\" | \"temporary\"> = {\n temporary: \"temporary\",\n mini: \"permanent\",\n clipped: \"permanent\",\n persistent: \"persistent\",\n};\n\ntype SxGenerator = (state: DrawerState, theme: Theme) => SxProps<Theme>;\nconst NoopSxGenerator = () => ({});\nconst variantsSx: Readonly<Record<DrawerVariant, SxGenerator>> = {\n mini: (state: DrawerState, theme: Theme) => ({\n boxSizing: \"border-box\",\n [`& .${paperClasses.root}`]: {\n zIndex: theme.zIndex.drawer - 1,\n },\n }),\n temporary: NoopSxGenerator,\n clipped: NoopSxGenerator,\n persistent: NoopSxGenerator,\n};\n\nexport const Drawer: DrawerComponent = ({ children, ...rest }: DrawerProps) => {\n const theme = useTheme();\n const { state, switchState, underAppBar, close, drawerWidth, variant } = useDrawer();\n\n const sx: any = {\n width: drawerWidth,\n flexShrink: 0,\n whiteSpace: \"nowrap\",\n ...(state === \"open\" && {\n ...openedMixin(theme),\n [`& .${drawerClasses.paper}`]: openedMixin(theme),\n }),\n ...(state !== \"open\" && {\n ...closedMixin(theme),\n [`& .${drawerClasses.paper}`]: closedMixin(theme),\n }),\n ...variantsSx[variant](state, theme),\n };\n\n return (\n <MuiDrawer\n open={state === \"open\"}\n variant={muiDrawerVariant[variant]}\n role=\"menu\"\n aria-hidden={state === \"close\"}\n onClose={close}\n sx={sx}\n {...rest}\n >\n <DrawerHeader>\n {!underAppBar && showCloseButton[variant] && (\n <IconButton onClick={switchState}>\n <ChevronLeftIcon />\n </IconButton>\n )}\n </DrawerHeader>\n <Divider />\n {children}\n </MuiDrawer>\n );\n};\n","import MuiAppBar from \"@mui/material/AppBar\";\nimport Toolbar from \"@mui/material/Toolbar\";\nimport IconButton from \"@mui/material/IconButton\";\nimport Typography from \"@mui/material/Typography\";\nimport { useTheme, Theme } from \"@mui/material/styles\";\nimport MenuIcon from \"@mui/icons-material/Menu\";\nimport { useDrawer } from \"../drawer-provider\";\nimport { AppBarProps as MuiAppBarProps } from \"@mui/material\";\nimport { DrawerState, DrawerVariant } from \"../drawer\";\n\nconst moveWithDrawer: Record<DrawerVariant, boolean> = {\n temporary: false,\n mini: true,\n persistent: true,\n clipped: true,\n};\n\nconst showMenuButton: Record<DrawerVariant, (state: DrawerState) => boolean> = {\n temporary: () => true,\n mini: (state) => state !== \"open\",\n persistent: () => true,\n clipped: () => false,\n};\n\nexport interface DrawerAppBarProps extends MuiAppBarProps {\n title?: string;\n}\n\nexport const DrawerAppBar = ({ title, sx, children, ...rest }: DrawerAppBarProps) => {\n const theme = useTheme();\n const { state, variant, switchState, drawerWidth, underAppBar } = useDrawer();\n\n const rootSx =\n (moveWithDrawer[variant] &&\n !underAppBar && {\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.leavingScreen,\n }),\n ...(state === \"open\" && {\n marginLeft: drawerWidth,\n width: `calc(100% - ${drawerWidth}px)`,\n transition: theme.transitions.create([\"width\", \"margin\"], {\n easing: theme.transitions.easing.sharp,\n duration: theme.transitions.duration.enteringScreen,\n }),\n }),\n }) ||\n {};\n\n return (\n <MuiAppBar\n position={underAppBar ? \"fixed\" : undefined}\n {...rest}\n sx={{\n ...sx,\n ...rootSx,\n zIndex: (theme: Theme) => theme.zIndex.drawer + (underAppBar ? 1 : 0),\n }}\n >\n <Toolbar>\n <IconButton\n color=\"inherit\"\n aria-label=\"open drawer\"\n onClick={switchState}\n edge=\"start\"\n sx={{\n marginRight: 5,\n display: showMenuButton[variant](state) ? undefined : \"none\",\n }}\n >\n <MenuIcon />\n </IconButton>\n {title && (\n <Typography variant=\"h6\" component=\"h1\" role=\"heading\" aria-level={1} noWrap>\n {title}\n </Typography>\n )}\n {children}\n </Toolbar>\n </MuiAppBar>\n );\n};\n"],"names":["DrawerContext","createContext","undefined","UndefinedProvider","Error","styled","theme","display","alignItems","justifyContent","padding","spacing","mixins","toolbar","moveWithDrawer","temporary","mini","persistent","clipped","showMenuButton","state","DrawerAppBar","title","sx","children","rest","useTheme","variant","switchState","drawerWidth","underAppBar","context","useContext","useDrawer","rootSx","transition","transitions","create","easing","sharp","duration","leavingScreen","marginLeft","width","enteringScreen","_jsx","MuiAppBar","position","zIndex","drawer","_jsxs","Toolbar","IconButton","color","onClick","edge","marginRight","MenuIcon","Typography","component","role","noWrap"],"mappings":"oeAgBO,MAAMA,EAAgBC,OAA8CC,GAC9DC,EAAoB,IAAIC,MAAM,wDCPfC,EAAO,MAAPA,EAAc,EAAGC,YAAa,CACxDC,QAAS,OACTC,WAAY,SACZC,eAAgB,WAChBC,QAASJ,EAAMK,QAAQ,EAAG,MACvBL,EAAMM,OAAOC,YCLlB,MAAMC,EAAiD,CACrDC,WAAW,EACXC,MAAM,EACNC,YAAY,EACZC,SAAS,GAGLC,EAAyE,CAC7EJ,UAAW,KAAM,EACjBC,KAAOI,GAAoB,SAAVA,EACjBH,WAAY,KAAM,EAClBC,QAAS,KAAM,GAOJG,EAAe,EAAGC,QAAOC,KAAIC,cAAaC,MACrD,MAAMnB,EAAQoB,KACRN,MAAEA,EAAKO,QAAEA,EAAOC,YAAEA,EAAWC,YAAEA,EAAWC,YAAEA,GFX3B,MACvB,MAAMC,EAAUC,EAAWhC,GAE3B,QAAgBE,IAAZ6B,EACF,MAAM5B,EAGR,OAAO4B,CAAO,EEIoDE,GAE5DC,EACHpB,EAAea,KACbG,GAAe,CACdK,WAAY7B,EAAM8B,YAAYC,OAAO,CAAC,QAAS,UAAW,CACxDC,OAAQhC,EAAM8B,YAAYE,OAAOC,MACjCC,SAAUlC,EAAM8B,YAAYI,SAASC,mBAEzB,SAAVrB,GAAoB,CACtBsB,WAAYb,EACZc,MAAO,eAAed,OACtBM,WAAY7B,EAAM8B,YAAYC,OAAO,CAAC,QAAS,UAAW,CACxDC,OAAQhC,EAAM8B,YAAYE,OAAOC,MACjCC,SAAUlC,EAAM8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