@openedx/paragon 21.8.0 → 21.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/dist/DataTable/CollapsibleButtonGroup.js +1 -1
  2. package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
  3. package/dist/DataTable/TableFilters.js +1 -1
  4. package/dist/DataTable/TableFilters.js.map +1 -1
  5. package/dist/DataTable/TableFooter.js +1 -1
  6. package/dist/DataTable/TableFooter.js.map +1 -1
  7. package/dist/DataTable/filters/CheckboxFilter.js +1 -1
  8. package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
  9. package/dist/DataTable/filters/DropdownFilter.js +1 -1
  10. package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
  11. package/dist/DataTable/filters/MultiSelectDropdownFilter.js +1 -1
  12. package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
  13. package/dist/DataTable/filters/TextFilter.js +1 -1
  14. package/dist/DataTable/filters/TextFilter.js.map +1 -1
  15. package/dist/DataTable/index.js +13 -13
  16. package/dist/DataTable/index.js.map +1 -1
  17. package/dist/Form/FormControl.js +12 -6
  18. package/dist/Form/FormControl.js.map +1 -1
  19. package/package.json +6 -2
  20. package/src/ActionRow/README.md +4 -2
  21. package/src/DataTable/CollapsibleButtonGroup.jsx +1 -1
  22. package/src/DataTable/TableFilters.jsx +1 -1
  23. package/src/DataTable/TableFooter.jsx +1 -5
  24. package/src/DataTable/filters/CheckboxFilter.jsx +1 -1
  25. package/src/DataTable/filters/DropdownFilter.jsx +1 -1
  26. package/src/DataTable/filters/MultiSelectDropdownFilter.jsx +1 -1
  27. package/src/DataTable/filters/TextFilter.jsx +1 -1
  28. package/src/DataTable/index.jsx +13 -13
  29. package/src/DataTable/tests/TableActions.test.jsx +5 -4
  30. package/src/Form/FormControl.jsx +7 -1
  31. package/src/Form/form-control.mdx +142 -1
  32. package/src/Form/tests/FormControl.test.jsx +40 -3
@@ -92,7 +92,7 @@ CollapsibleButtonGroup.propTypes = {
92
92
  className: PropTypes.string,
93
93
  /** Array of action objects, containing a component and their callback args */
94
94
  actions: PropTypes.arrayOf(PropTypes.shape({
95
- component: PropTypes.oneOfType([PropTypes.func, PropTypes.element]).isRequired,
95
+ component: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]).isRequired,
96
96
  args: PropTypes.shape({})
97
97
  })).isRequired
98
98
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CollapsibleButtonGroup.js","names":["React","useContext","useMemo","useState","PropTypes","MoreVert","useToggle","useWindowSize","DataTableContext","Icon","IconButton","breakpoints","ModalPopup","Stack","Button","ACTION_OVERFLOW_BUTTON_TEXT","SMALL_SCREEN_ACTION_OVERFLOW_BUTTON_TEXT","CollapsibleButtonGroup","_ref","className","actions","rest","_objectWithoutProperties","_excluded","isOverflowMenuOpen","openOverflowMenu","closeOverflowMenu","overflowMenuTarget","setOverflowMenuTarget","controlledTableSelections","isEntireTableSelected","selectedFlatRows","rows","width","selectedRows","visibleActions","dropdownActions","small","minWidth","firstTwoActions","splice","extraActions","slice","reverse","cloneAction","action","index","cloneElement","component","_objectSpread","key","as","args","createElement","_extends","length","Fragment","variant","iconAs","src","alt","id","ref","onClick","positionRef","onClose","placement","isOpen","gap","map","defaultProps","propTypes","string","arrayOf","shape","oneOfType","func","element","isRequired"],"sources":["../../src/DataTable/CollapsibleButtonGroup.jsx"],"sourcesContent":["import React, { useContext, useMemo, useState } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { MoreVert } from '../../icons';\nimport useToggle from '../hooks/useToggle';\nimport useWindowSize from '../hooks/useWindowSize';\nimport DataTableContext from './DataTableContext';\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport breakpoints from '../utils/breakpoints';\nimport ModalPopup from '../Modal/ModalPopup';\nimport Stack from '../Stack';\nimport Button from '../Button';\n\nexport const ACTION_OVERFLOW_BUTTON_TEXT = 'More actions';\nexport const SMALL_SCREEN_ACTION_OVERFLOW_BUTTON_TEXT = 'Actions';\n\nfunction CollapsibleButtonGroup({\n className,\n actions,\n ...rest\n}) {\n const [isOverflowMenuOpen, openOverflowMenu, closeOverflowMenu] = useToggle(false);\n const [overflowMenuTarget, setOverflowMenuTarget] = useState(null);\n const {\n controlledTableSelections: [{ isEntireTableSelected }],\n selectedFlatRows,\n rows,\n } = useContext(DataTableContext);\n const { width } = useWindowSize();\n const selectedRows = selectedFlatRows || rows;\n\n const [visibleActions, dropdownActions] = useMemo(() => {\n if (width < breakpoints.small.minWidth) {\n // On a small screen, all actions will be in the overflow menu\n return [[], [...actions]];\n }\n // The first two actions will be displayed as buttons, the rest will go in an overflow menu\n const firstTwoActions = [...actions].splice(0, 2);\n const extraActions = [...actions].slice(2);\n\n /* Reversing the array because to the user it makes sense to put the primary button first,\n but we want it on the right */\n return [firstTwoActions.reverse(), extraActions];\n }, [actions, width]);\n\n if (!isEntireTableSelected && !selectedRows) {\n return null;\n }\n\n const cloneAction = (action, index) => React.cloneElement(\n action.component,\n {\n // eslint-disable-next-line react/no-array-index-key\n key: `${action}${index}`,\n as: Button, // for backwards compatibility this is needed\n ...action.args,\n },\n );\n\n return (\n <div className={className} {...rest}>\n {dropdownActions.length > 0 && (\n <>\n <IconButton\n variant=\"secondary\"\n iconAs={Icon}\n src={MoreVert}\n alt={width > breakpoints.small.minWidth\n ? ACTION_OVERFLOW_BUTTON_TEXT : SMALL_SCREEN_ACTION_OVERFLOW_BUTTON_TEXT}\n id=\"actions-dropdown\"\n ref={setOverflowMenuTarget}\n onClick={openOverflowMenu}\n />\n <ModalPopup\n positionRef={overflowMenuTarget}\n onClose={closeOverflowMenu}\n placement=\"bottom-end\"\n isOpen={isOverflowMenuOpen}\n >\n <div className=\"pgn__datatable__overflow-actions-menu\">\n <Stack gap={2}>\n {dropdownActions.map(cloneAction)}\n </Stack>\n </div>\n </ModalPopup>\n </>\n )}\n <div className=\"pgn__datatable__visible-actions\">\n {visibleActions.map(cloneAction)}\n </div>\n </div>\n );\n}\n\nCollapsibleButtonGroup.defaultProps = {\n className: null,\n};\n\nCollapsibleButtonGroup.propTypes = {\n /** Class names for the div wrapping the button components */\n className: PropTypes.string,\n /** Array of action objects, containing a component and their callback args */\n actions: PropTypes.arrayOf(PropTypes.shape({\n component: PropTypes.oneOfType([PropTypes.func, PropTypes.element]).isRequired,\n args: PropTypes.shape({}),\n })).isRequired,\n};\n\nexport default CollapsibleButtonGroup;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,QAAQ,QAAQ,aAAa;AACtC,OAAOC,SAAS,MAAM,oBAAoB;AAC1C,OAAOC,aAAa,MAAM,wBAAwB;AAClD,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,IAAI,MAAM,SAAS;AAC1B,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,WAAW,MAAM,sBAAsB;AAC9C,OAAOC,UAAU,MAAM,qBAAqB;AAC5C,OAAOC,KAAK,MAAM,UAAU;AAC5B,OAAOC,MAAM,MAAM,WAAW;AAE9B,OAAO,MAAMC,2BAA2B,GAAG,cAAc;AACzD,OAAO,MAAMC,wCAAwC,GAAG,SAAS;AAEjE,SAASC,sBAAsBA,CAAAC,IAAA,EAI5B;EAAA,IAJ6B;MAC9BC,SAAS;MACTC;IAEF,CAAC,GAAAF,IAAA;IADIG,IAAI,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EAEP,MAAM,CAACC,kBAAkB,EAAEC,gBAAgB,EAAEC,iBAAiB,CAAC,GAAGpB,SAAS,CAAC,KAAK,CAAC;EAClF,MAAM,CAACqB,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGzB,QAAQ,CAAC,IAAI,CAAC;EAClE,MAAM;IACJ0B,yBAAyB,EAAE,CAAC;MAAEC;IAAsB,CAAC,CAAC;IAC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;AAED,eAAe7D,sBAAsB"}
1
+ {"version":3,"file":"CollapsibleButtonGroup.js","names":["React","useContext","useMemo","useState","PropTypes","MoreVert","useToggle","useWindowSize","DataTableContext","Icon","IconButton","breakpoints","ModalPopup","Stack","Button","ACTION_OVERFLOW_BUTTON_TEXT","SMALL_SCREEN_ACTION_OVERFLOW_BUTTON_TEXT","CollapsibleButtonGroup","_ref","className","actions","rest","_objectWithoutProperties","_excluded","isOverflowMenuOpen","openOverflowMenu","closeOverflowMenu","overflowMenuTarget","setOverflowMenuTarget","controlledTableSelections","isEntireTableSelected","selectedFlatRows","rows","width","selectedRows","visibleActions","dropdownActions","small","minWidth","firstTwoActions","splice","extraActions","slice","reverse","cloneAction","action","index","cloneElement","component","_objectSpread","key","as","args","createElement","_extends","length","Fragment","variant","iconAs","src","alt","id","ref","onClick","positionRef","onClose","placement","isOpen","gap","map","defaultProps","propTypes","string","arrayOf","shape","oneOfType","element","elementType","isRequired"],"sources":["../../src/DataTable/CollapsibleButtonGroup.jsx"],"sourcesContent":["import React, { useContext, useMemo, useState } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { MoreVert } from '../../icons';\nimport useToggle from '../hooks/useToggle';\nimport useWindowSize from '../hooks/useWindowSize';\nimport DataTableContext from './DataTableContext';\nimport Icon from '../Icon';\nimport IconButton from '../IconButton';\nimport breakpoints from '../utils/breakpoints';\nimport ModalPopup from '../Modal/ModalPopup';\nimport Stack from '../Stack';\nimport Button from '../Button';\n\nexport const ACTION_OVERFLOW_BUTTON_TEXT = 'More actions';\nexport const SMALL_SCREEN_ACTION_OVERFLOW_BUTTON_TEXT = 'Actions';\n\nfunction CollapsibleButtonGroup({\n className,\n actions,\n ...rest\n}) {\n const [isOverflowMenuOpen, openOverflowMenu, closeOverflowMenu] = useToggle(false);\n const [overflowMenuTarget, setOverflowMenuTarget] = useState(null);\n const {\n controlledTableSelections: [{ isEntireTableSelected }],\n selectedFlatRows,\n rows,\n } = useContext(DataTableContext);\n const { width } = useWindowSize();\n const selectedRows = selectedFlatRows || rows;\n\n const [visibleActions, dropdownActions] = useMemo(() => {\n if (width < breakpoints.small.minWidth) {\n // On a small screen, all actions will be in the overflow menu\n return [[], [...actions]];\n }\n // The first two actions will be displayed as buttons, the rest will go in an overflow menu\n const firstTwoActions = [...actions].splice(0, 2);\n const extraActions = [...actions].slice(2);\n\n /* Reversing the array because to the user it makes sense to put the primary button first,\n but we want it on the right */\n return [firstTwoActions.reverse(), extraActions];\n }, [actions, width]);\n\n if (!isEntireTableSelected && !selectedRows) {\n return null;\n }\n\n const cloneAction = (action, index) => React.cloneElement(\n action.component,\n {\n // eslint-disable-next-line react/no-array-index-key\n key: `${action}${index}`,\n as: Button, // for backwards compatibility this is needed\n ...action.args,\n },\n );\n\n return (\n <div className={className} {...rest}>\n {dropdownActions.length > 0 && (\n <>\n <IconButton\n variant=\"secondary\"\n iconAs={Icon}\n src={MoreVert}\n alt={width > breakpoints.small.minWidth\n ? ACTION_OVERFLOW_BUTTON_TEXT : SMALL_SCREEN_ACTION_OVERFLOW_BUTTON_TEXT}\n id=\"actions-dropdown\"\n ref={setOverflowMenuTarget}\n onClick={openOverflowMenu}\n />\n <ModalPopup\n positionRef={overflowMenuTarget}\n onClose={closeOverflowMenu}\n placement=\"bottom-end\"\n isOpen={isOverflowMenuOpen}\n >\n <div className=\"pgn__datatable__overflow-actions-menu\">\n <Stack gap={2}>\n {dropdownActions.map(cloneAction)}\n </Stack>\n </div>\n </ModalPopup>\n </>\n )}\n <div className=\"pgn__datatable__visible-actions\">\n {visibleActions.map(cloneAction)}\n </div>\n </div>\n );\n}\n\nCollapsibleButtonGroup.defaultProps = {\n className: null,\n};\n\nCollapsibleButtonGroup.propTypes = {\n /** Class names for the div wrapping the button components */\n className: PropTypes.string,\n /** Array of action objects, containing a component and their callback args */\n actions: PropTypes.arrayOf(PropTypes.shape({\n component: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]).isRequired,\n args: PropTypes.shape({}),\n })).isRequired,\n};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;IAC3BmC,OAAO,EAAEtC;EAAiB,CAC3B,CAAC,eACFzB,KAAA,CAAAqD,aAAA,CAACzC,UAAU;IACToD,WAAW,EAAErC,kBAAmB;IAChCsC,OAAO,EAAEvC,iBAAkB;IAC3BwC,SAAS,EAAC,YAAY;IACtBC,MAAM,EAAE3C;EAAmB,gBAE3BxB,KAAA,CAAAqD,aAAA;IAAKlC,SAAS,EAAC;EAAuC,gBACpDnB,KAAA,CAAAqD,aAAA,CAACxC,KAAK;IAACuD,GAAG,EAAE;EAAE,GACXhC,eAAe,CAACiC,GAAG,CAACzB,WAAW,CAC3B,CACJ,CACK,CACZ,CACH,eACD5C,KAAA,CAAAqD,aAAA;IAAKlC,SAAS,EAAC;EAAiC,GAC7CgB,cAAc,CAACkC,GAAG,CAACzB,WAAW,CAC5B,CACF,CAAC;AAEV;AAEA3B,sBAAsB,CAACqD,YAAY,GAAG;EACpCnD,SAAS,EAAE;AACb,CAAC;AAEDF,sBAAsB,CAACsD,SAAS,GAAG;EACjC;EACApD,SAAS,EAAEf,SAAS,CAACoE,MAAM;EAC3B;EACApD,OAAO,EAAEhB,SAAS,CAACqE,OAAO,CAACrE,SAAS,CAACsE,KAAK,CAAC;IACzC1B,SAAS,EAAE5C,SAAS,CAACuE,SAAS,CAAC,CAACvE,SAAS,CAACwE,OAAO,EAAExE,SAAS,CAACyE,WAAW,CAAC,CAAC,CAACC,UAAU;IACrF1B,IAAI,EAAEhD,SAAS,CAACsE,KAAK,CAAC,CAAC,CAAC;EAC1B,CAAC,CAAC,CAAC,CAACI;AACN,CAAC;AAED,eAAe7D,sBAAsB"}
@@ -22,7 +22,7 @@ TableFilters.defaultProps = {
22
22
  };
23
23
  TableFilters.propTypes = {
24
24
  columns: PropTypes.arrayOf(PropTypes.shape({
25
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
25
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
26
26
  canFilter: PropTypes.bool,
27
27
  render: PropTypes.func.isRequired
28
28
  })).isRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"TableFilters.js","names":["React","PropTypes","Button","TABLE_FILTERS_BUTTON_TEXT","TableFilters","_ref","columns","manualFilters","onFilter","currentFilters","createElement","map","column","key","Header","canFilter","render","type","onClick","defaultProps","propTypes","arrayOf","shape","oneOfType","func","node","isRequired","bool"],"sources":["../../src/DataTable/TableFilters.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '../Button';\n\nexport const TABLE_FILTERS_BUTTON_TEXT = 'Filter';\n\nfunction TableFilters({\n columns, manualFilters, onFilter, currentFilters,\n}) {\n return (\n <div>\n <h4>Filters</h4>\n {columns.map(column => <div key={column.Header}>{column.canFilter ? column.render('Filter') : null}</div>)}\n {manualFilters && (\n <Button\n type=\"primary\"\n onClick={() => onFilter(currentFilters)}\n >\n {TABLE_FILTERS_BUTTON_TEXT}\n </Button>\n )}\n </div>\n );\n}\n\nTableFilters.defaultProps = {\n manualFilters: false,\n onFilter: () => {},\n};\n\nTableFilters.propTypes = {\n columns: PropTypes.arrayOf(PropTypes.shape({\n Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,\n canFilter: PropTypes.bool,\n render: PropTypes.func.isRequired,\n })).isRequired,\n manualFilters: PropTypes.bool,\n onFilter: PropTypes.func,\n currentFilters: PropTypes.arrayOf(PropTypes.shape()).isRequired,\n};\n\nexport default TableFilters;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,WAAW;AAE9B,OAAO,MAAMC,yBAAyB,GAAG,QAAQ;AAEjD,SAASC,YAAYA,CAAAC,IAAA,EAElB;EAAA,IAFmB;IACpBC,OAAO;IAAEC,aAAa;IAAEC,QAAQ;IAAEC;EACpC,CAAC,GAAAJ,IAAA;EACC,oBACEL,KAAA,CAAAU,aAAA,2BACEV,KAAA,CAAAU,aAAA,aAAI,SAAW,CAAC,EACfJ,OAAO,CAACK,GAAG,CAACC,MAAM,iBAAIZ,KAAA,CAAAU,aAAA;IAAKG,GAAG,EAAED,MAAM,CAACE;EAAO,GAAEF,MAAM,CAACG,SAAS,GAAGH,MAAM,CAACI,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAU,CAAC,CAAC,EACzGT,aAAa,iBACdP,KAAA,CAAAU,aAAA,CAACR,MAAM;IACLe,IAAI,EAAC,SAAS;IACdC,OAAO,EAAEA,CAAA,KAAMV,QAAQ,CAACC,cAAc;EAAE,GAEvCN,yBACK,CAEL,CAAC;AAEV;AAEAC,YAAY,CAACe,YAAY,GAAG;EAC1BZ,aAAa,EAAE,KAAK;EACpBC,QAAQ,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC;AAEDJ,YAAY,CAACgB,SAAS,GAAG;EACvBd,OAAO,EAAEL,SAAS,CAACoB,OAAO,CAACpB,SAAS,CAACqB,KAAK,CAAC;IACzCR,MAAM,EAAEb,SAAS,CAACsB,SAAS,CAAC,CAACtB,SAAS,CAACuB,IAAI,EAAEvB,SAAS,CAACwB,IAAI,CAAC,CAAC,CAACC,UAAU;IACxEX,SAAS,EAAEd,SAAS,CAAC0B,IAAI;IACzBX,MAAM,EAAEf,SAAS,CAACuB,IAAI,CAACE;EACzB,CAAC,CAAC,CAAC,CAACA,UAAU;EACdnB,aAAa,EAAEN,SAAS,CAAC0B,IAAI;EAC7BnB,QAAQ,EAAEP,SAAS,CAACuB,IAAI;EACxBf,cAAc,EAAER,SAAS,CAACoB,OAAO,CAACpB,SAAS,CAACqB,KAAK,CAAC,CAAC,CAAC,CAACI;AACvD,CAAC;AAED,eAAetB,YAAY"}
1
+ {"version":3,"file":"TableFilters.js","names":["React","PropTypes","Button","TABLE_FILTERS_BUTTON_TEXT","TableFilters","_ref","columns","manualFilters","onFilter","currentFilters","createElement","map","column","key","Header","canFilter","render","type","onClick","defaultProps","propTypes","arrayOf","shape","oneOfType","elementType","node","isRequired","bool","func"],"sources":["../../src/DataTable/TableFilters.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport Button from '../Button';\n\nexport const TABLE_FILTERS_BUTTON_TEXT = 'Filter';\n\nfunction TableFilters({\n columns, manualFilters, onFilter, currentFilters,\n}) {\n return (\n <div>\n <h4>Filters</h4>\n {columns.map(column => <div key={column.Header}>{column.canFilter ? column.render('Filter') : null}</div>)}\n {manualFilters && (\n <Button\n type=\"primary\"\n onClick={() => onFilter(currentFilters)}\n >\n {TABLE_FILTERS_BUTTON_TEXT}\n </Button>\n )}\n </div>\n );\n}\n\nTableFilters.defaultProps = {\n manualFilters: false,\n onFilter: () => {},\n};\n\nTableFilters.propTypes = {\n columns: PropTypes.arrayOf(PropTypes.shape({\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,\n canFilter: PropTypes.bool,\n render: PropTypes.func.isRequired,\n })).isRequired,\n manualFilters: PropTypes.bool,\n onFilter: PropTypes.func,\n currentFilters: PropTypes.arrayOf(PropTypes.shape()).isRequired,\n};\n\nexport default TableFilters;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,MAAM,MAAM,WAAW;AAE9B,OAAO,MAAMC,yBAAyB,GAAG,QAAQ;AAEjD,SAASC,YAAYA,CAAAC,IAAA,EAElB;EAAA,IAFmB;IACpBC,OAAO;IAAEC,aAAa;IAAEC,QAAQ;IAAEC;EACpC,CAAC,GAAAJ,IAAA;EACC,oBACEL,KAAA,CAAAU,aAAA,2BACEV,KAAA,CAAAU,aAAA,aAAI,SAAW,CAAC,EACfJ,OAAO,CAACK,GAAG,CAACC,MAAM,iBAAIZ,KAAA,CAAAU,aAAA;IAAKG,GAAG,EAAED,MAAM,CAACE;EAAO,GAAEF,MAAM,CAACG,SAAS,GAAGH,MAAM,CAACI,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAU,CAAC,CAAC,EACzGT,aAAa,iBACdP,KAAA,CAAAU,aAAA,CAACR,MAAM;IACLe,IAAI,EAAC,SAAS;IACdC,OAAO,EAAEA,CAAA,KAAMV,QAAQ,CAACC,cAAc;EAAE,GAEvCN,yBACK,CAEL,CAAC;AAEV;AAEAC,YAAY,CAACe,YAAY,GAAG;EAC1BZ,aAAa,EAAE,KAAK;EACpBC,QAAQ,EAAEA,CAAA,KAAM,CAAC;AACnB,CAAC;AAEDJ,YAAY,CAACgB,SAAS,GAAG;EACvBd,OAAO,EAAEL,SAAS,CAACoB,OAAO,CAACpB,SAAS,CAACqB,KAAK,CAAC;IACzCR,MAAM,EAAEb,SAAS,CAACsB,SAAS,CAAC,CAACtB,SAAS,CAACuB,WAAW,EAAEvB,SAAS,CAACwB,IAAI,CAAC,CAAC,CAACC,UAAU;IAC/EX,SAAS,EAAEd,SAAS,CAAC0B,IAAI;IACzBX,MAAM,EAAEf,SAAS,CAAC2B,IAAI,CAACF;EACzB,CAAC,CAAC,CAAC,CAACA,UAAU;EACdnB,aAAa,EAAEN,SAAS,CAAC0B,IAAI;EAC7BnB,QAAQ,EAAEP,SAAS,CAAC2B,IAAI;EACxBnB,cAAc,EAAER,SAAS,CAACoB,OAAO,CAACpB,SAAS,CAACqB,KAAK,CAAC,CAAC,CAAC,CAACI;AACvD,CAAC;AAED,eAAetB,YAAY"}
@@ -21,7 +21,7 @@ function TableFooter(_ref) {
21
21
  }
22
22
  TableFooter.propTypes = {
23
23
  /** Specifies the content of the `TableFooter` */
24
- children: PropTypes.oneOfType([PropTypes.func, PropTypes.node, PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.node]))]),
24
+ children: PropTypes.node,
25
25
  /** Specifies class name to append to the base element. */
26
26
  className: PropTypes.string
27
27
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TableFooter.js","names":["React","useContext","classNames","PropTypes","DataTableContext","RowStatusDefault","TablePagination","TablePaginationMinimal","TableFooter","_ref","className","children","RowStatusComponent","RowStatus","createElement","Fragment","propTypes","oneOfType","func","node","arrayOf","string","defaultProps","undefined"],"sources":["../../src/DataTable/TableFooter.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport DataTableContext from './DataTableContext';\nimport RowStatusDefault from './RowStatus';\nimport TablePagination from './TablePagination';\nimport TablePaginationMinimal from './TablePaginationMinimal';\n\nfunction TableFooter({ className, children }) {\n const { RowStatusComponent } = useContext(DataTableContext);\n const RowStatus = RowStatusComponent || RowStatusDefault;\n\n return (\n <div className={classNames(className, 'pgn__data-table-footer')} data-testid=\"table-footer\">\n {children || (\n <>\n <RowStatus />\n <TablePagination />\n <TablePaginationMinimal />\n </>\n )}\n </div>\n );\n}\n\nTableFooter.propTypes = {\n /** Specifies the content of the `TableFooter` */\n children: PropTypes.oneOfType([\n PropTypes.func,\n PropTypes.node,\n PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.node])),\n ]),\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n};\n\nTableFooter.defaultProps = {\n children: null,\n className: undefined,\n};\n\nexport default TableFooter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,aAAa;AAC1C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,WAAWA,CAAAC,IAAA,EAA0B;EAAA,IAAzB;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAAF,IAAA;EAC1C,MAAM;IAAEG;EAAmB,CAAC,GAAGX,UAAU,CAACG,gBAAgB,CAAC;EAC3D,MAAMS,SAAS,GAAGD,kBAAkB,IAAIP,gBAAgB;EAExD,oBACEL,KAAA,CAAAc,aAAA;IAAKJ,SAAS,EAAER,UAAU,CAACQ,SAAS,EAAE,wBAAwB,CAAE;IAAC,eAAY;EAAc,GACxFC,QAAQ,iBACPX,KAAA,CAAAc,aAAA,CAAAd,KAAA,CAAAe,QAAA,qBACEf,KAAA,CAAAc,aAAA,CAACD,SAAS,MAAE,CAAC,eACbb,KAAA,CAAAc,aAAA,CAACR,eAAe,MAAE,CAAC,eACnBN,KAAA,CAAAc,aAAA,CAACP,sBAAsB,MAAE,CACzB,CAED,CAAC;AAEV;AAEAC,WAAW,CAACQ,SAAS,GAAG;EACtB;EACAL,QAAQ,EAAER,SAAS,CAACc,SAAS,CAAC,CAC5Bd,SAAS,CAACe,IAAI,EACdf,SAAS,CAACgB,IAAI,EACdhB,SAAS,CAACiB,OAAO,CAACjB,SAAS,CAACc,SAAS,CAAC,CAACd,SAAS,CAACe,IAAI,EAAEf,SAAS,CAACgB,IAAI,CAAC,CAAC,CAAC,CACzE,CAAC;EACF;EACAT,SAAS,EAAEP,SAAS,CAACkB;AACvB,CAAC;AAEDb,WAAW,CAACc,YAAY,GAAG;EACzBX,QAAQ,EAAE,IAAI;EACdD,SAAS,EAAEa;AACb,CAAC;AAED,eAAef,WAAW"}
1
+ {"version":3,"file":"TableFooter.js","names":["React","useContext","classNames","PropTypes","DataTableContext","RowStatusDefault","TablePagination","TablePaginationMinimal","TableFooter","_ref","className","children","RowStatusComponent","RowStatus","createElement","Fragment","propTypes","node","string","defaultProps","undefined"],"sources":["../../src/DataTable/TableFooter.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport classNames from 'classnames';\nimport PropTypes from 'prop-types';\nimport DataTableContext from './DataTableContext';\nimport RowStatusDefault from './RowStatus';\nimport TablePagination from './TablePagination';\nimport TablePaginationMinimal from './TablePaginationMinimal';\n\nfunction TableFooter({ className, children }) {\n const { RowStatusComponent } = useContext(DataTableContext);\n const RowStatus = RowStatusComponent || RowStatusDefault;\n\n return (\n <div className={classNames(className, 'pgn__data-table-footer')} data-testid=\"table-footer\">\n {children || (\n <>\n <RowStatus />\n <TablePagination />\n <TablePaginationMinimal />\n </>\n )}\n </div>\n );\n}\n\nTableFooter.propTypes = {\n /** Specifies the content of the `TableFooter` */\n children: PropTypes.node,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n};\n\nTableFooter.defaultProps = {\n children: null,\n className: undefined,\n};\n\nexport default TableFooter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,gBAAgB,MAAM,aAAa;AAC1C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,sBAAsB,MAAM,0BAA0B;AAE7D,SAASC,WAAWA,CAAAC,IAAA,EAA0B;EAAA,IAAzB;IAAEC,SAAS;IAAEC;EAAS,CAAC,GAAAF,IAAA;EAC1C,MAAM;IAAEG;EAAmB,CAAC,GAAGX,UAAU,CAACG,gBAAgB,CAAC;EAC3D,MAAMS,SAAS,GAAGD,kBAAkB,IAAIP,gBAAgB;EAExD,oBACEL,KAAA,CAAAc,aAAA;IAAKJ,SAAS,EAAER,UAAU,CAACQ,SAAS,EAAE,wBAAwB,CAAE;IAAC,eAAY;EAAc,GACxFC,QAAQ,iBACPX,KAAA,CAAAc,aAAA,CAAAd,KAAA,CAAAe,QAAA,qBACEf,KAAA,CAAAc,aAAA,CAACD,SAAS,MAAE,CAAC,eACbb,KAAA,CAAAc,aAAA,CAACR,eAAe,MAAE,CAAC,eACnBN,KAAA,CAAAc,aAAA,CAACP,sBAAsB,MAAE,CACzB,CAED,CAAC;AAEV;AAEAC,WAAW,CAACQ,SAAS,GAAG;EACtB;EACAL,QAAQ,EAAER,SAAS,CAACc,IAAI;EACxB;EACAP,SAAS,EAAEP,SAAS,CAACe;AACvB,CAAC;AAEDV,WAAW,CAACW,YAAY,GAAG;EACzBR,QAAQ,EAAE,IAAI;EACdD,SAAS,EAAEU;AACb,CAAC;AAED,eAAeZ,WAAW"}
@@ -70,7 +70,7 @@ CheckboxFilter.propTypes = {
70
70
  */
71
71
  column: PropTypes.shape({
72
72
  setFilter: PropTypes.func.isRequired,
73
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
73
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
74
74
  filterChoices: PropTypes.arrayOf(PropTypes.shape({
75
75
  name: PropTypes.string.isRequired,
76
76
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxFilter.js","names":["React","useRef","useMemo","PropTypes","Form","FormLabel","Badge","Stack","newId","CheckboxFilter","_ref","column","filterValue","setFilter","Header","filterChoices","getHeaderProps","ariaLabel","key","checkedBoxes","changeCheckbox","value","includes","newCheckedBoxes","filter","val","push","headerBasedId","createElement","Group","role","current","id","className","CheckboxSet","name","map","_ref2","number","Checkbox","checked","onChange","direction","gap","undefined","variant","propTypes","shape","func","isRequired","oneOfType","node","arrayOf","string"],"sources":["../../../src/DataTable/filters/CheckboxFilter.jsx"],"sourcesContent":["import React, { useRef, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport Form, { FormLabel } from '../../Form';\nimport Badge from '../../Badge';\nimport Stack from '../../Stack';\nimport { newId } from '../../utils';\n\nfunction CheckboxFilter({\n column: {\n filterValue, setFilter, Header, filterChoices, getHeaderProps,\n },\n}) {\n // creates a unique label that does not change on re-render in case there are multiple checkbox filters in the dom\n const ariaLabel = useRef(newId(`checkbox-filter-label-${getHeaderProps().key}-`));\n\n const checkedBoxes = filterValue || [];\n const changeCheckbox = (value) => {\n if (checkedBoxes.includes(value)) {\n const newCheckedBoxes = checkedBoxes.filter((val) => val !== value);\n return setFilter(newCheckedBoxes);\n }\n checkedBoxes.push(value);\n return setFilter(checkedBoxes);\n };\n const headerBasedId = useMemo(() => `checkbox-filter-check-${getHeaderProps().key}-`, [getHeaderProps]);\n\n return (\n <Form.Group role=\"group\" aria-labelledby={ariaLabel.current}>\n <FormLabel id={ariaLabel.current} className=\"pgn__checkbox-filter-label\">{Header}</FormLabel>\n <Form.CheckboxSet name={Header}>\n {filterChoices.map(({ name, number, value }) => (\n <Form.Checkbox\n key={`${headerBasedId}${name}`}\n value={name}\n checked={checkedBoxes.includes(value)}\n onChange={() => changeCheckbox(value)}\n aria-label={name}\n >\n <Stack direction=\"horizontal\" gap={2}>\n {name} {number !== undefined && <Badge variant=\"light\">{number}</Badge>}\n </Stack>\n </Form.Checkbox>\n ))}\n </Form.CheckboxSet>\n </Form.Group>\n );\n}\n\nCheckboxFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `filterChoices`: Specifies array of choices.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n *\n * `filterValue`: Value for the filter input.\n */\n column: PropTypes.shape({\n setFilter: PropTypes.func.isRequired,\n Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n number: PropTypes.number,\n })).isRequired,\n getHeaderProps: PropTypes.func.isRequired,\n filterValue: PropTypes.arrayOf(PropTypes.string),\n }).isRequired,\n};\n\nexport default CheckboxFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAC9C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,IAAIC,SAAS,QAAQ,YAAY;AAC5C,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,KAAK,MAAM,aAAa;AAC/B,SAASC,KAAK,QAAQ,aAAa;AAEnC,SAASC,cAAcA,CAAAC,IAAA,EAIpB;EAAA,IAJqB;IACtBC,MAAM,EAAE;MACNC,WAAW;MAAEC,SAAS;MAAEC,MA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C;AAED,eAAexC,cAAc"}
1
+ {"version":3,"file":"CheckboxFilter.js","names":["React","useRef","useMemo","PropTypes","Form","FormLabel","Badge","Stack","newId","CheckboxFilter","_ref","column","filterValue","setFilter","Header","filterChoices","getHeaderProps","ariaLabel","key","checkedBoxes","changeCheckbox","value","includes","newCheckedBoxes","filter","val","push","headerBasedId","createElement","Group","role","current","id","className","CheckboxSet","name","map","_ref2","number","Checkbox","checked","onChange","direction","gap","undefined","variant","propTypes","shape","func","isRequired","oneOfType","elementType","node","arrayOf","string"],"sources":["../../../src/DataTable/filters/CheckboxFilter.jsx"],"sourcesContent":["import React, { useRef, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport Form, { FormLabel } from '../../Form';\nimport Badge from '../../Badge';\nimport Stack from '../../Stack';\nimport { newId } from '../../utils';\n\nfunction CheckboxFilter({\n column: {\n filterValue, setFilter, Header, filterChoices, getHeaderProps,\n },\n}) {\n // creates a unique label that does not change on re-render in case there are multiple checkbox filters in the dom\n const ariaLabel = useRef(newId(`checkbox-filter-label-${getHeaderProps().key}-`));\n\n const checkedBoxes = filterValue || [];\n const changeCheckbox = (value) => {\n if (checkedBoxes.includes(value)) {\n const newCheckedBoxes = checkedBoxes.filter((val) => val !== value);\n return setFilter(newCheckedBoxes);\n }\n checkedBoxes.push(value);\n return setFilter(checkedBoxes);\n };\n const headerBasedId = useMemo(() => `checkbox-filter-check-${getHeaderProps().key}-`, [getHeaderProps]);\n\n return (\n <Form.Group role=\"group\" aria-labelledby={ariaLabel.current}>\n <FormLabel id={ariaLabel.current} className=\"pgn__checkbox-filter-label\">{Header}</FormLabel>\n <Form.CheckboxSet name={Header}>\n {filterChoices.map(({ name, number, value }) => (\n <Form.Checkbox\n key={`${headerBasedId}${name}`}\n value={name}\n checked={checkedBoxes.includes(value)}\n onChange={() => changeCheckbox(value)}\n aria-label={name}\n >\n <Stack direction=\"horizontal\" gap={2}>\n {name} {number !== undefined && <Badge variant=\"light\">{number}</Badge>}\n </Stack>\n </Form.Checkbox>\n ))}\n </Form.CheckboxSet>\n </Form.Group>\n );\n}\n\nCheckboxFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `filterChoices`: Specifies array of choices.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n *\n * `filterValue`: Value for the filter input.\n */\n column: PropTypes.shape({\n setFilter: PropTypes.func.isRequired,\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string.isRequired,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n number: PropTypes.number,\n })).isRequired,\n getHeaderProps: PropTypes.func.isRequired,\n filterValue: PropTypes.arrayOf(PropTypes.string),\n }).isRequired,\n};\n\nexport default CheckboxFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,OAAO,QAAQ,OAAO;AAC9C,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,IAAIC,SAAS,QAAQ,YAAY;AAC5C,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,KAAK,MAAM,aAAa;AAC/B,SAASC,KAAK,QAAQ,aAAa;AAEnC,SAASC,cAAcA,CAAAC,IAAA,EAIpB;EAAA,IAJqB;IACtBC,MAAM,EAAE;MACNC,WAAW;MAAEC,SAAS;MAAEC,MAAM;MAAEC,aAAa;MAAEC;IACjD;EACF,CAAC,GAAAN,IAAA;EACC;EACA,MAAMO,SAAS,GAAGhB,MAAM,CAACO,KAAK,CAAE,yBAAwBQ,cAAc,CAAC,CAAC,CAACE,GAAI,GAAE,CAAC,CAAC;EAEjF,MAAMC,YAAY,GAAGP,WAAW,IAAI,EAAE;EACtC,MAAMQ,cAAc,GAAIC,KAAK,IAAK;IAChC,IAAIF,YAAY,CAACG,QAAQ,CAACD,KAAK,CAAC,EAAE;MAChC,MAAME,eAAe,G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AA,CAACtB,KAAK;MAACuC,OAAO,EAAC;IAAO,GAAEP,MAAc,CACjE,CACM,CAAC;EAAA,CACjB,CACe,CACR,CAAC;AAEjB;AAEA7B,cAAc,CAACqC,SAAS,GAAG;EACzB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEnC,MAAM,EAAER,SAAS,CAAC4C,KAAK,CAAC;IACtBlC,SAAS,EAAEV,SAAS,CAAC6C,IAAI,CAACC,UAAU;IACpCnC,MAAM,EAAEX,SAAS,CAAC+C,SAAS,CAAC,CAAC/C,SAAS,CAACgD,WAAW,EAAEhD,SAAS,CAACiD,IAAI,CAAC,CAAC,CAACH,UAAU;IAC/ElC,aAAa,EAAEZ,SAAS,CAACkD,OAAO,CAAClD,SAAS,CAAC4C,KAAK,CAAC;MAC/CZ,IAAI,EAAEhC,SAAS,CAACmD,MAAM,CAACL,UAAU;MACjC5B,KAAK,EAAElB,SAAS,CAAC+C,SAAS,CAAC,CAAC/C,SAAS,CAACmD,MAAM,EAAEnD,SAAS,CAACmC,MAAM,CAAC,CAAC;MAChEA,MAAM,EAAEnC,SAAS,CAACmC;IACpB,CAAC,CAAC,CAAC,CAACW,UAAU;IACdjC,cAAc,EAAEb,SAAS,CAAC6C,IAAI,CAACC,UAAU;IACzCrC,WAAW,EAAET,SAAS,CAACkD,OAAO,CAAClD,SAAS,CAACmD,MAAM;EACjD,CAAC,CAAC,CAACL;AACL,CAAC;AAED,eAAexC,cAAc"}
@@ -57,7 +57,7 @@ DropdownFilter.propTypes = {
57
57
  */
58
58
  column: PropTypes.shape({
59
59
  setFilter: PropTypes.func.isRequired,
60
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
60
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
61
61
  filterChoices: PropTypes.arrayOf(PropTypes.shape({
62
62
  name: PropTypes.string.isRequired,
63
63
  number: PropTypes.number,
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownFilter.js","names":["React","useRef","PropTypes","Form","newId","DEFAULT_VALUE","DropdownFilter","_ref","column","setFilter","Header","filterChoices","getHeaderProps","ariaLabel","key","onChange","e","target","value","undefined","createElement","Group","Label","id","current","className","Control","as","default","map","_ref2","name","number","propTypes","shape","func","isRequired","oneOfType","node","arrayOf","string"],"sources":["../../../src/DataTable/filters/DropdownFilter.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport Form from '../../Form';\nimport { newId } from '../../utils';\n\nconst DEFAULT_VALUE = '';\n\nfunction DropdownFilter({\n column: {\n setFilter, Header, filterChoices, getHeaderProps,\n },\n}) {\n // creates a unique label that does not change on re-render in case there are multiple checkbox filters in the dom\n const ariaLabel = useRef(newId(`dropdown-filter-label-${getHeaderProps().key}-`));\n const onChange = (e) => {\n if (e.target.value === DEFAULT_VALUE) {\n // setting undefined resets the filter\n return setFilter(undefined);\n }\n return setFilter(e.target.value);\n };\n\n return (\n <Form.Group>\n <Form.Label id={ariaLabel.current} className=\"sr-only\">{Header}</Form.Label>\n <Form.Control\n as=\"select\"\n default={DEFAULT_VALUE}\n onChange={onChange}\n aria-labelledby={ariaLabel.current}\n >\n <option value={DEFAULT_VALUE}>{Header}</option>\n {filterChoices.map(({ name, number, value }) => (<option key={value} value={value}>{name} {number && `(${number})`}</option>))}\n </Form.Control>\n </Form.Group>\n );\n}\n\nDropdownFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `filterChoices`: Specifies array of choices.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n */\n column: PropTypes.shape({\n setFilter: PropTypes.func.isRequired,\n Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string.isRequired,\n number: PropTypes.number,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\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AAC;MAAEC,IAAI;MAAEC,MAAM;MAAEd;IAAM,CAAC,GAAAY,KAAA;IAAA,oBAAM9B,KAAA,CAAAoB,aAAA;MAAQN,GAAG,EAAEI,KAAM;MAACA,KAAK,EAAEA;IAAM,GAAEa,IAAI,EAAC,GAAC,EAACC,MAAM,IAAK,IAAGA,MAAO,GAAW,CAAC;EAAA,CAAC,CACjH,CACJ,CAAC;AAEjB;AAEA1B,cAAc,CAAC2B,SAAS,GAAG;EACzB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEzB,MAAM,EAAEN,SAAS,CAACgC,KAAK,CAAC;IACtBzB,SAAS,EAAEP,SAAS,CAACiC,IAAI,CAACC,UAAU;IACpC1B,MAAM,EAAER,SAAS,CAACmC,SAAS,CAAC,CAACnC,SAAS,CAACiC,IAAI,EAAEjC,SAAS,CAACoC,IAAI,CAAC,CAAC,CAACF,UAAU;IACxEzB,aAAa,EAAET,SAAS,CAACqC,OAAO,CAACrC,SAAS,CAACgC,KAAK,CAAC;MAC/CH,IAAI,EAAE7B,SAAS,CAACsC,MAAM,CAACJ,UAAU;MACjCJ,MAAM,EAAE9B,SAAS,CAAC8B,MAAM;MACxBd,KAAK,EAAEhB,SAAS,CAACmC,SAAS,CAAC,CAACnC,SAAS,CAACsC,MAAM,EAAEtC,SAAS,CAAC8B,MAAM,CAAC,CAAC,CAACI;IACnE,CAAC,CAAC,CAAC,CAACA,UAAU;IACdxB,cAAc,EAAEV,SAAS,CAACiC,IAAI,CAACC;EACjC,CAAC,CAAC,CAACA;AACL,CAAC;AAED,eAAe9B,cAAc"}
1
+ {"version":3,"file":"DropdownFilter.js","names":["React","useRef","PropTypes","Form","newId","DEFAULT_VALUE","DropdownFilter","_ref","column","setFilter","Header","filterChoices","getHeaderProps","ariaLabel","key","onChange","e","target","value","undefined","createElement","Group","Label","id","current","className","Control","as","default","map","_ref2","name","number","propTypes","shape","func","isRequired","oneOfType","elementType","node","arrayOf","string"],"sources":["../../../src/DataTable/filters/DropdownFilter.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport Form from '../../Form';\nimport { newId } from '../../utils';\n\nconst DEFAULT_VALUE = '';\n\nfunction DropdownFilter({\n column: {\n setFilter, Header, filterChoices, getHeaderProps,\n },\n}) {\n // creates a unique label that does not change on re-render in case there are multiple checkbox filters in the dom\n const ariaLabel = useRef(newId(`dropdown-filter-label-${getHeaderProps().key}-`));\n const onChange = (e) => {\n if (e.target.value === DEFAULT_VALUE) {\n // setting undefined resets the filter\n return setFilter(undefined);\n }\n return setFilter(e.target.value);\n };\n\n return (\n <Form.Group>\n <Form.Label id={ariaLabel.current} className=\"sr-only\">{Header}</Form.Label>\n <Form.Control\n as=\"select\"\n default={DEFAULT_VALUE}\n onChange={onChange}\n aria-labelledby={ariaLabel.current}\n >\n <option value={DEFAULT_VALUE}>{Header}</option>\n {filterChoices.map(({ name, number, value }) => (<option key={value} value={value}>{name} {number && `(${number})`}</option>))}\n </Form.Control>\n </Form.Group>\n );\n}\n\nDropdownFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `filterChoices`: Specifies array of choices.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n */\n column: PropTypes.shape({\n setFilter: PropTypes.func.isRequired,\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string.isRequired,\n number: PropTypes.number,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n })).isRequired,\n getHeaderProps: PropTypes.func.isRequired,\n }).isRequired,\n};\n\nexport default DropdownFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,YAAY;AAC7B,SAASC,KAAK,QAAQ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CAAC;EAAA,CAAC,CACjH,CACJ,CAAC;AAEjB;AAEA1B,cAAc,CAAC2B,SAAS,GAAG;EACzB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEzB,MAAM,EAAEN,SAAS,CAACgC,KAAK,CAAC;IACtBzB,SAAS,EAAEP,SAAS,CAACiC,IAAI,CAACC,UAAU;IACpC1B,MAAM,EAAER,SAAS,CAACmC,SAAS,CAAC,CAACnC,SAAS,CAACoC,WAAW,EAAEpC,SAAS,CAACqC,IAAI,CAAC,CAAC,CAACH,UAAU;IAC/EzB,aAAa,EAAET,SAAS,CAACsC,OAAO,CAACtC,SAAS,CAACgC,KAAK,CAAC;MAC/CH,IAAI,EAAE7B,SAAS,CAACuC,MAAM,CAACL,UAAU;MACjCJ,MAAM,EAAE9B,SAAS,CAAC8B,MAAM;MACxBd,KAAK,EAAEhB,SAAS,CAACmC,SAAS,CAAC,CAACnC,SAAS,CAACuC,MAAM,EAAEvC,SAAS,CAAC8B,MAAM,CAAC,CAAC,CAACI;IACnE,CAAC,CAAC,CAAC,CAACA,UAAU;IACdxB,cAAc,EAAEV,SAAS,CAACiC,IAAI,CAACC;EACjC,CAAC,CAAC,CAACA;AACL,CAAC;AAED,eAAe9B,cAAc"}
@@ -72,7 +72,7 @@ MultiSelectDropdownFilter.propTypes = {
72
72
  /** Function to set the filter value */
73
73
  setFilter: PropTypes.func.isRequired,
74
74
  /** Column header used for labels and placeholders */
75
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
75
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
76
76
  /** Names and values for the select options */
77
77
  filterChoices: PropTypes.arrayOf(PropTypes.shape({
78
78
  name: PropTypes.string.isRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelectDropdownFilter.js","names":["React","useRef","PropTypes","Badge","Stack","DropdownButton","newId","Form","MultiSelectDropdownFilter","_ref","column","setFilter","Header","filterChoices","getHeaderProps","filterValue","ariaLabel","key","checkedBoxes","changeCheckbox","value","includes","newCheckedBoxes","filter","val","push","createElement","variant","id","current","title","CheckboxSet","className","name","map","_ref2","number","Checkbox","checked","onChange","direction","gap","propTypes","shape","func","isRequired","oneOfType","node","arrayOf","string"],"sources":["../../../src/DataTable/filters/MultiSelectDropdownFilter.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport Badge from '../../Badge';\nimport Stack from '../../Stack';\nimport { DropdownButton } from '../../Dropdown';\nimport { newId } from '../../utils';\nimport Form from '../../Form';\n\nfunction MultiSelectDropdownFilter({\n column: {\n setFilter, Header, filterChoices, getHeaderProps, filterValue,\n },\n}) {\n // creates a unique label that does not change on re-render in case there are multiple checkbox filters in the dom\n const ariaLabel = useRef(newId(`multi-dropdown-filter-label-${getHeaderProps().key}-`));\n const checkedBoxes = filterValue || [];\n const changeCheckbox = (value) => {\n if (checkedBoxes.includes(value)) {\n const newCheckedBoxes = checkedBoxes.filter((val) => val !== value);\n return setFilter(newCheckedBoxes);\n }\n checkedBoxes.push(value);\n return setFilter(checkedBoxes);\n };\n\n return (\n <DropdownButton variant=\"outline-primary\" id={ariaLabel.current} title={Header}>\n <Form.CheckboxSet\n className=\"pgn__dropdown-filter-checkbox-group\"\n name={Header}\n aria-label={Header}\n >\n {filterChoices.map(({ name, number, value }) => (\n <Form.Checkbox\n key={name}\n value={name}\n checked={checkedBoxes.includes(value)}\n onChange={() => changeCheckbox(value)}\n aria-label={name}\n >\n <Stack direction=\"horizontal\" gap={2}>\n {name} {number && <Badge variant=\"light\">{number}</Badge>}\n </Stack>\n </Form.Checkbox>\n ))}\n </Form.CheckboxSet>\n </DropdownButton>\n );\n}\n\nMultiSelectDropdownFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `filterChoices`: Specifies array of choices.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n *\n * `filterValue`: Value for the filter input.\n */\n column: PropTypes.shape({\n /** Function to set the filter value */\n setFilter: PropTypes.func.isRequired,\n /** Column header used for labels and placeholders */\n Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,\n /** Names and values for the select options */\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string.isRequired,\n number: PropTypes.number,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n })).isRequired,\n /** Generates a key unique to the column being filtered */\n getHeaderProps: PropTypes.func.isRequired,\n filterValue: PropTypes.arrayOf(PropTypes.string),\n }).isRequired,\n};\n\nexport default MultiSelectDropdownFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,aAAa;AAC/B,OAAOC,KAAK,MAAM,aAAa;AAC/B,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,KAAK,QAAQ,aAAa;AACnC,OAAOC,IAAI,MAAM,YAAY;AAE7B,SAASC,yBAAyBA,CAAAC,IAAA,EAI/B;EAAA,IAJgC;IACjCC,MAAM,EAAE;MACNC,SAAS;MAAEC,MAAM;MAAEC,aAAa;MAAEC,cAAc;MAAEC;IACpD;EACF,CAAC,GAAAN,IAAA;EACC;EACA,MAAMO,SAAS,GAAGf,MAAM,CAACK,KAAK,CAAE,+BAA8BQ,cAAc,CAAC,CAAC,CAACG,GAAI,GAAE,CAAC,CAAC;EACvF,MAAMC,YAAY,GAAGH,WAAW,IAAI,EAAE;EACtC,MAAMI,cAAc,GAAIC,KAAK,IAAK;IAChC,IAAIF,YAAY,CAACG,QAAQ,CAACD,KAAK,CAAC,EAAE;MAChC,MAAME,eAAe,GAAGJ,YAAY,CAACK,MAAM,CAAEC,GAAG,IAAKA,GAAG,KAAKJ,KAAK,CAAC;MACnE,OAAOT,SAAS,CAACW,eAAe,CAAC;IACnC;IACAJ,YAAY,CAACO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C5C,SAAS,CAAC0C,IAAI,EAAE1C,SAAS,CAAC6C,IAAI,CAAC,CAAC,CAACF,UAAU;IACxE;IACAhC,aAAa,EAAEX,SAAS,CAAC8C,OAAO,CAAC9C,SAAS,CAACyC,KAAK,CAAC;MAC/CV,IAAI,EAAE/B,SAAS,CAAC+C,MAAM,CAACJ,UAAU;MACjCT,MAAM,EAAElC,SAAS,CAACkC,MAAM;MACxBhB,KAAK,EAAElB,SAAS,CAAC4C,SAAS,CAAC,CAAC5C,SAAS,CAAC+C,MAAM,EAAE/C,SAAS,CAACkC,MAAM,CAAC,CAAC,CAACS;IACnE,CAAC,CAAC,CAAC,CAACA,UAAU;IACd;IACA/B,cAAc,EAAEZ,SAAS,CAAC0C,IAAI,CAACC,UAAU;IACzC9B,WAAW,EAAEb,SAAS,CAAC8C,OAAO,CAAC9C,SAAS,CAAC+C,MAAM;EACjD,CAAC,CAAC,CAACJ;AACL,CAAC;AAED,eAAerC,yBAAyB"}
1
+ {"version":3,"file":"MultiSelectDropdownFilter.js","names":["React","useRef","PropTypes","Badge","Stack","DropdownButton","newId","Form","MultiSelectDropdownFilter","_ref","column","setFilter","Header","filterChoices","getHeaderProps","filterValue","ariaLabel","key","checkedBoxes","changeCheckbox","value","includes","newCheckedBoxes","filter","val","push","createElement","variant","id","current","title","CheckboxSet","className","name","map","_ref2","number","Checkbox","checked","onChange","direction","gap","propTypes","shape","func","isRequired","oneOfType","elementType","node","arrayOf","string"],"sources":["../../../src/DataTable/filters/MultiSelectDropdownFilter.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport Badge from '../../Badge';\nimport Stack from '../../Stack';\nimport { DropdownButton } from '../../Dropdown';\nimport { newId } from '../../utils';\nimport Form from '../../Form';\n\nfunction MultiSelectDropdownFilter({\n column: {\n setFilter, Header, filterChoices, getHeaderProps, filterValue,\n },\n}) {\n // creates a unique label that does not change on re-render in case there are multiple checkbox filters in the dom\n const ariaLabel = useRef(newId(`multi-dropdown-filter-label-${getHeaderProps().key}-`));\n const checkedBoxes = filterValue || [];\n const changeCheckbox = (value) => {\n if (checkedBoxes.includes(value)) {\n const newCheckedBoxes = checkedBoxes.filter((val) => val !== value);\n return setFilter(newCheckedBoxes);\n }\n checkedBoxes.push(value);\n return setFilter(checkedBoxes);\n };\n\n return (\n <DropdownButton variant=\"outline-primary\" id={ariaLabel.current} title={Header}>\n <Form.CheckboxSet\n className=\"pgn__dropdown-filter-checkbox-group\"\n name={Header}\n aria-label={Header}\n >\n {filterChoices.map(({ name, number, value }) => (\n <Form.Checkbox\n key={name}\n value={name}\n checked={checkedBoxes.includes(value)}\n onChange={() => changeCheckbox(value)}\n aria-label={name}\n >\n <Stack direction=\"horizontal\" gap={2}>\n {name} {number && <Badge variant=\"light\">{number}</Badge>}\n </Stack>\n </Form.Checkbox>\n ))}\n </Form.CheckboxSet>\n </DropdownButton>\n );\n}\n\nMultiSelectDropdownFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `filterChoices`: Specifies array of choices.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n *\n * `filterValue`: Value for the filter input.\n */\n column: PropTypes.shape({\n /** Function to set the filter value */\n setFilter: PropTypes.func.isRequired,\n /** Column header used for labels and placeholders */\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,\n /** Names and values for the select options */\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string.isRequired,\n number: PropTypes.number,\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,\n })).isRequired,\n /** Generates a key unique to the column being filtered */\n getHeaderProps: PropTypes.func.isRequired,\n filterValue: PropTypes.arrayOf(PropTypes.string),\n }).isRequired,\n};\n\nexport default MultiSelectDropdownFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,SAAS,MAAM,Y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AS,CAAC+C,OAAO,CAAC/C,SAAS,CAACgD,MAAM;EACjD,CAAC,CAAC,CAACL;AACL,CAAC;AAED,eAAerC,yBAAyB"}
@@ -52,7 +52,7 @@ TextFilter.propTypes = {
52
52
  */
53
53
  column: PropTypes.shape({
54
54
  setFilter: PropTypes.func.isRequired,
55
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
55
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
56
56
  getHeaderProps: PropTypes.func.isRequired,
57
57
  filterValue: PropTypes.string
58
58
  }).isRequired
@@ -1 +1 @@
1
- {"version":3,"file":"TextFilter.js","names":["React","useRef","PropTypes","Form","FormLabel","Input","newId","formatHeaderForLabel","header","toLowerCase","TextFilter","_ref","column","filterValue","setFilter","Header","getHeaderProps","ariaLabel","key","formattedHeader","inputText","isValidElement","createElement","Group","id","current","className","value","type","onChange","e","target","undefined","placeholder","propTypes","shape","func","isRequired","oneOfType","node","string"],"sources":["../../../src/DataTable/filters/TextFilter.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport Form, { FormLabel } from '../../Form';\nimport Input from '../../Input';\nimport { newId } from '../../utils';\n\nconst formatHeaderForLabel = (header) => {\n if (typeof header === 'function') {\n return header();\n }\n if (typeof header === 'string') {\n return header.toLowerCase();\n }\n return header;\n};\n\nfunction TextFilter({\n column: {\n filterValue, setFilter, Header, getHeaderProps,\n },\n}) {\n const ariaLabel = useRef(newId(`text-filter-label-${getHeaderProps().key}-`));\n const formattedHeader = formatHeaderForLabel(Header);\n const inputText = React.isValidElement(formattedHeader) ? formattedHeader : `Search ${formattedHeader}`;\n return (\n <Form.Group>\n <FormLabel id={ariaLabel.current} className=\"sr-only\">{inputText}</FormLabel>\n <Input\n aria-labelledby={ariaLabel.current}\n value={filterValue || ''}\n type=\"text\"\n onChange={e => {\n setFilter(e.target.value || undefined); // Set undefined to remove the filter entirely\n }}\n placeholder={inputText}\n />\n </Form.Group>\n );\n}\n\nTextFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n *\n * `filterValue`: Value for the filter input.\n */\n column: PropTypes.shape({\n setFilter: PropTypes.func.isRequired,\n Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,\n getHeaderProps: PropTypes.func.isRequired,\n filterValue: PropTypes.string,\n }).isRequired,\n};\n\nexport default TextFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,IAAIC,SAAS,QAAQ,YAAY;AAC5C,OAAOC,KAAK,MAAM,aAAa;AAC/B,SAASC,KAAK,QAAQ,aAAa;AAEnC,MAAMC,oBAAoB,GAAIC,MAAM,IAAK;EACvC,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;IAChC,OAAOA,MAAM,CAAC,CAAC;EACjB;EACA,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IAC9B,OAAOA,MAAM,CAACC,WAAW,CAAC,CAAC;EAC7B;EACA,OAAOD,MAAM;AACf,CAAC;AAED,SAASE,UAAUA,CAAAC,IAAA,EAIhB;EAAA,IAJiB;IAClBC,MAAM,EAAE;MACNC,WAAW;MAAEC,SAAS;MAAEC,MAAM;MAAEC;IAClC;EACF,CAAC,GAAAL,IAAA;EACC,MAAMM,SAAS,GAAGhB,MAAM,CAACK,KAAK,CAAE,qBAAoBU,cAAc,CAAC,CAAC,CAACE,GAAI,GAAE,CAAC,CAAC;EAC7E,MAAMC,eAAe,GAAGZ,oBAAoB,CAACQ,MAAM,CAAC;EACpD,MAAMK,SAAS,GAAG,aAAApB,KAAK,CAACqB,cAAc,CAACF,eAAe,CAAC,GAAGA,eAAe,GAAI,UAASA,eAAgB,EAAC;EACvG,oBACEnB,KAAA,CAAAsB,aAAA,CAACnB,IAAI,CAACoB,KAAK,qBACTvB,KAAA,CAAAsB,aAAA,CAAClB,SAAS;IAACoB,EAAE,EAAEP,SAAS,CAACQ,OAAQ;IAACC,SAAS,EAAC;EAAS,GAAEN,SAAqB,CAAC,eAC7EpB,KAAA,CAAAsB,aAAA,CAACjB,KAAK;IACJ,mBAAiBY,SAAS,CAACQ,OAAQ;IACnCE,KAAK,EAAEd,WAAW,IAAI,EAAG;IACzBe,IAAI,EAAC,MAAM;IACXC,QAAQ,EAAEC,CAAC,IAAI;MACbhB,SAAS,CAACgB,CAAC,CAACC,MAAM,CAACJ,KAAK,IAAIK,SAAS,CAAC,CAAC,CAAC;IAC1C,CAAE;;IACFC,WAAW,EAAEb;EAAU,CACxB,CACS,CAAC;AAEjB;AAEAV,UAAU,CAACwB,SAAS,GAAG;EACrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEtB,MAAM,EAAEV,SAAS,CAACiC,KAAK,CAAC;IACtBrB,SAAS,EAAEZ,SAAS,CAACkC,IAAI,CAACC,UAAU;IACpCtB,MAAM,EAAEb,SAAS,CAACoC,SAAS,CAAC,CAACpC,SAAS,CAACkC,IAAI,EAAElC,SAAS,CAACqC,IAAI,CAAC,CAAC,CAACF,UAAU;IACxErB,cAAc,EAAEd,SAAS,CAACkC,IAAI,CAACC,UAAU;IACzCxB,WAAW,EAAEX,SAAS,CAACsC;EACzB,CAAC,CAAC,CAACH;AACL,CAAC;AAED,eAAe3B,UAAU"}
1
+ {"version":3,"file":"TextFilter.js","names":["React","useRef","PropTypes","Form","FormLabel","Input","newId","formatHeaderForLabel","header","toLowerCase","TextFilter","_ref","column","filterValue","setFilter","Header","getHeaderProps","ariaLabel","key","formattedHeader","inputText","isValidElement","createElement","Group","id","current","className","value","type","onChange","e","target","undefined","placeholder","propTypes","shape","func","isRequired","oneOfType","elementType","node","string"],"sources":["../../../src/DataTable/filters/TextFilter.jsx"],"sourcesContent":["import React, { useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport Form, { FormLabel } from '../../Form';\nimport Input from '../../Input';\nimport { newId } from '../../utils';\n\nconst formatHeaderForLabel = (header) => {\n if (typeof header === 'function') {\n return header();\n }\n if (typeof header === 'string') {\n return header.toLowerCase();\n }\n return header;\n};\n\nfunction TextFilter({\n column: {\n filterValue, setFilter, Header, getHeaderProps,\n },\n}) {\n const ariaLabel = useRef(newId(`text-filter-label-${getHeaderProps().key}-`));\n const formattedHeader = formatHeaderForLabel(Header);\n const inputText = React.isValidElement(formattedHeader) ? formattedHeader : `Search ${formattedHeader}`;\n return (\n <Form.Group>\n <FormLabel id={ariaLabel.current} className=\"sr-only\">{inputText}</FormLabel>\n <Input\n aria-labelledby={ariaLabel.current}\n value={filterValue || ''}\n type=\"text\"\n onChange={e => {\n setFilter(e.target.value || undefined); // Set undefined to remove the filter entirely\n }}\n placeholder={inputText}\n />\n </Form.Group>\n );\n}\n\nTextFilter.propTypes = {\n /**\n * Specifies a column object.\n *\n * `setFilter`: Function to set the filter value.\n *\n * `Header`: Column header used for labels and placeholders.\n *\n * `getHeaderProps`: Generates a key unique to the column being filtered.\n *\n * `filterValue`: Value for the filter input.\n */\n column: PropTypes.shape({\n setFilter: PropTypes.func.isRequired,\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,\n getHeaderProps: PropTypes.func.isRequired,\n filterValue: PropTypes.string,\n }).isRequired,\n};\n\nexport default TextFilter;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,QAAQ,OAAO;AACrC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,IAAIC,SAAS,QAAQ,YAAY;AAC5C,OAAOC,KAAK,MAAM,aAAa;AAC/B,SAASC,KAAK,QAAQ,aAAa;AAEnC,MAAMC,oBAAoB,GAAIC,MAAM,IAAK;EACvC,IAAI,OAAOA,MAAM,KAAK,UAAU,EAAE;IAChC,OAAOA,MAAM,CAAC,CAAC;EACjB;EACA,IAAI,OAA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tB,MAAM,EAAEb,SAAS,CAACoC,SAAS,CAAC,CAACpC,SAAS,CAACqC,WAAW,EAAErC,SAAS,CAACsC,IAAI,CAAC,CAAC,CAACH,UAAU;IAC/ErB,cAAc,EAAEd,SAAS,CAACkC,IAAI,CAACC,UAAU;IACzCxB,WAAW,EAAEX,SAAS,CAACuC;EACzB,CAAC,CAAC,CAACJ;AACL,CAAC;AAED,eAAe3B,UAAU"}
@@ -264,13 +264,13 @@ DataTable.propTypes = {
264
264
  /** Definition of table columns */
265
265
  columns: PropTypes.arrayOf(PropTypes.shape({
266
266
  /** User visible column name */
267
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
267
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
268
268
  /** String used to access the correct cell data for this column */
269
269
  accessor: requiredWhenNot(PropTypes.string, 'Cell'),
270
270
  /** Specifies a function that receives `row` as argument and returns cell content */
271
- Cell: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
271
+ Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
272
272
  /** Specifies filter component */
273
- Filter: PropTypes.func,
273
+ Filter: PropTypes.elementType,
274
274
  /** Specifies filter type */
275
275
  filter: PropTypes.string,
276
276
  /** Specifies filter choices */
@@ -287,8 +287,8 @@ DataTable.propTypes = {
287
287
  /** Alternate column for selecting rows. See react table useSort docs for more information */
288
288
  manualSelectColumn: PropTypes.shape({
289
289
  id: PropTypes.string.isRequired,
290
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
291
- Cell: PropTypes.func.isRequired,
290
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
291
+ Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
292
292
  disableSortBy: PropTypes.bool.isRequired
293
293
  }),
294
294
  /** Table columns can be sorted */
@@ -308,16 +308,16 @@ DataTable.propTypes = {
308
308
  /** defaults that will be set on each column. Will be overridden by individual column values */
309
309
  defaultColumnValues: PropTypes.shape({
310
310
  /** A default filter component for the column */
311
- Filter: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
311
+ Filter: PropTypes.elementType
312
312
  }),
313
313
  /** Actions or other additional non-data columns can be added here */
314
314
  additionalColumns: PropTypes.arrayOf(PropTypes.shape({
315
315
  /** id must be unique from other columns ids */
316
316
  id: PropTypes.string.isRequired,
317
317
  /** column header that will be displayed to the user */
318
- Header: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
318
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
319
319
  /** Component that renders in the added column. It will receive the row as a prop */
320
- Cell: PropTypes.oneOfType([PropTypes.func, PropTypes.node])
320
+ Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node])
321
321
  })),
322
322
  /** Function that will fetch table data. Called when page size, page index or filters change.
323
323
  * Meant to be used with manual filters and pagination */
@@ -374,15 +374,15 @@ DataTable.propTypes = {
374
374
  /** Number between one and four filters that can be shown on the top row. */
375
375
  numBreakoutFilters: PropTypes.oneOf([1, 2, 3, 4]),
376
376
  /** Component to be displayed when the table is empty */
377
- EmptyTableComponent: PropTypes.func,
377
+ EmptyTableComponent: PropTypes.elementType,
378
378
  /** Component to be displayed for row status, ie, 10 of 20 rows. Displayed by default in the TableControlBar */
379
- RowStatusComponent: PropTypes.func,
379
+ RowStatusComponent: PropTypes.elementType,
380
380
  /** Component to be displayed for selection status. Displayed when there are selected rows and no active filters */
381
- SelectionStatusComponent: PropTypes.func,
381
+ SelectionStatusComponent: PropTypes.elementType,
382
382
  /** Component to be displayed for filter status. Displayed when there are active filters. */
383
- FilterStatusComponent: PropTypes.func,
383
+ FilterStatusComponent: PropTypes.elementType,
384
384
  /** If children are not provided a table with control bar and footer will be rendered */
385
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
385
+ children: PropTypes.node,
386
386
  /** If true filters will be shown on sidebar instead */
387
387
  showFiltersInSidebar: PropTypes.bool,
388
388
  /** options for data view toggle */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useEffect","useMemo","useReducer","PropTypes","useTable","useMountedLayoutEffect","classNames","Table","getVisibleColumns","requiredWhen","requiredWhenNot","getTableArgs","TableControlBar","EmptyTableContent","TableFooter","BulkActions","DropdownFilters","FilterStatus","RowStatus","SelectionStatus","ControlledSelectionStatus","SmartStatus","TableFilters","TableHeaderCell","TableCell","TableHeaderRow","TablePagination","TablePaginationMinimal","DataTableContext","TableActions","ControlledSelect","ControlledSelectHeader","DataTableLayout","ExpandAll","ExpandRow","useSelectionActions","selectionsReducer","initialState","initialSelectionsState","DataTable","_ref","columns","data","defaultColumnValues","additionalColumns","isSelectable","isPaginated","manualPagination","pageCount","itemCount","isFilterable","manualFilters","fetchData","isSortable","manualSortBy","isExpandable","renderRowSubComponent","bulkActions","tableActions","numBreakoutFilters","initialTableOptions","EmptyTableComponent","manualSelectColumn","showFiltersInSidebar","dataViewToggleOptions","disableElevation","isLoading","children","onSelectedRowsChanged","maxSelectedRows","onMaxSelectedRows","props","_objectWithoutProperties","_excluded","defaultColumn","tableOptions","updatedTableOptions","_objectSpread","stateReducer","newState","action","previousState","type","value","selectedRowIds","rowIndex","parseInt","id","selectedRowsOrdered","newSelectedRowsOrdered","filter","item","selections","selectionsDispatch","tableArgs","push","hooks","visibleColumns","selectionProps","selectedRows","length","selectedRowsById","forEach","row","useControlledState","state","selectedFlatRows","controlledTableSelections","instance","pageSize","tableStatePageSize","pageIndex","tableStatePageIndex","sortBy","tableStateSortBy","filters","tableStateFilters","tableStateSelectedRowIds","selectionActions","enhancedInstance","createElement","Provider","className","Fragment","content","defaultProps","undefined","SelectionStatusComponent","FilterStatusComponent","RowStatusComponent","isDataViewToggleEnabled","onDataViewToggle","defaultActiveStateValue","togglePlacement","propTypes","arrayOf","shape","Header","oneOfType","func","node","isRequired","accessor","string","Cell","element","Filter","filterChoices","name","number","bool","disableSortBy","buttonText","handleClick","variant","disabled","oneOf","EmptyTable"],"sources":["../../src/DataTable/index.jsx"],"sourcesContent":["import React, {\n useEffect, useMemo, useReducer,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport { useTable, useMountedLayoutEffect } from 'react-table';\n\nimport classNames from 'classnames';\nimport Table from './Table';\nimport getVisibleColumns from './utils/getVisibleColumns';\nimport { requiredWhen, requiredWhenNot } from '../utils/propTypes';\nimport getTableArgs from './utils/getTableArgs';\nimport TableControlBar from './TableControlBar';\nimport EmptyTableContent from './EmptyTable';\nimport TableFooter from './TableFooter';\nimport BulkActions from './BulkActions';\nimport DropdownFilters from './DropdownFilters';\nimport FilterStatus from './FilterStatus';\nimport RowStatus from './RowStatus';\nimport SelectionStatus from './selection/SelectionStatus';\nimport ControlledSelectionStatus from './selection/ControlledSelectionStatus';\nimport SmartStatus from './SmartStatus';\nimport TableFilters from './TableFilters';\nimport TableHeaderCell from './TableHeaderCell';\nimport TableCell from './TableCell';\nimport TableHeaderRow from './TableHeaderRow';\nimport TablePagination from './TablePagination';\nimport TablePaginationMinimal from './TablePaginationMinimal';\nimport DataTableContext from './DataTableContext';\nimport TableActions from './TableActions';\nimport ControlledSelect from './selection/ControlledSelect';\nimport ControlledSelectHeader from './selection/ControlledSelectHeader';\nimport DataTableLayout from './DataTableLayout';\nimport ExpandAll from './ExpandAll';\nimport ExpandRow from './ExpandRow';\n\nimport { useSelectionActions } from './hooks';\nimport selectionsReducer, { initialState as initialSelectionsState } from './selection/data/reducer';\n\nfunction DataTable({\n columns, data, defaultColumnValues, additionalColumns, isSelectable,\n isPaginated, manualPagination, pageCount, itemCount,\n isFilterable, manualFilters, fetchData, initialState,\n isSortable, manualSortBy,\n isExpandable, renderRowSubComponent,\n bulkActions, tableActions, numBreakoutFilters,\n initialTableOptions,\n EmptyTableComponent,\n manualSelectColumn,\n showFiltersInSidebar,\n dataViewToggleOptions,\n disableElevation,\n isLoading,\n children,\n onSelectedRowsChanged,\n maxSelectedRows,\n onMaxSelectedRows,\n ...props\n}) {\n const defaultColumn = useMemo(\n () => (defaultColumnValues),\n [defaultColumnValues],\n );\n const tableOptions = useMemo(() => {\n const updatedTableOptions = {\n stateReducer: (newState, action, previousState) => {\n switch (action.type) {\n // Note: we override the `toggleAllRowsSelected` action\n // from react-table because it only clears the selections on the\n // currently visible page; it does not clear the `selectedRowIds`\n // as we would expect for selections on different pages. Instead, we\n // force `selectedRowIds` to be cleared when `toggleAllRowsSelected(false)`\n // is called.\n case 'toggleAllRowsSelected': {\n if (action.value) {\n return newState;\n }\n return {\n ...newState,\n selectedRowIds: {},\n };\n }\n /* Note: We override the `toggleRowSelected` action from react-table\n because we need to preserve the order of the selected rows.\n While `selectedRowIds` is an object that contains the selected rows as key-value pairs,\n it does not maintain the order of selection. Therefore, we have added the `selectedRowsOrdered` property\n to keep track of the order in which the rows were selected.\n */\n case 'toggleRowSelected': {\n const rowIndex = parseInt(action.id, 10);\n const { selectedRowsOrdered = [] } = previousState;\n\n let newSelectedRowsOrdered;\n if (action.value) {\n newSelectedRowsOrdered = [...selectedRowsOrdered, rowIndex];\n } else {\n newSelectedRowsOrdered = selectedRowsOrdered.filter((item) => item !== rowIndex);\n }\n\n return {\n ...newState,\n selectedRowsOrdered: newSelectedRowsOrdered,\n };\n }\n default:\n return newState;\n }\n },\n ...initialTableOptions,\n };\n return {\n columns,\n data,\n defaultColumn,\n manualFilters,\n manualPagination,\n manualSortBy,\n initialState,\n ...updatedTableOptions,\n };\n }, [initialTableOptions, columns, data, defaultColumn, manualFilters, manualPagination, manualSortBy, initialState]);\n\n const [selections, selectionsDispatch] = useReducer(selectionsReducer, initialSelectionsState);\n\n if (isPaginated && manualPagination) {\n // pageCount is required when pagination is manual, if it's not there passing -1 as per react-table docs\n tableOptions.pageCount = pageCount || -1;\n }\n\n // NB: Table args *must* be in a particular order\n const tableArgs = getTableArgs({\n tableOptions, isFilterable, isSelectable, isPaginated, isSortable, isExpandable,\n });\n // adds selection column and action columns as necessary\n tableArgs.push(hooks => {\n hooks.visibleColumns.push(\n visibleColumns => getVisibleColumns(isSelectable, visibleColumns, additionalColumns, manualSelectColumn),\n );\n });\n\n // Pass any controlled selections from context to the appropriate ``useTable`` arguments to maintain\n // correct selection states on rows, both from a data perspective and in the UI.\n const selectionProps = {};\n const { selectedRows } = selections;\n if (selectedRows.length > 0) {\n const selectedRowsById = {};\n selectedRows.forEach((row) => {\n selectedRowsById[row.id] = true;\n });\n tableArgs.push(hooks => {\n hooks.useControlledState.push(\n (state) => ({ ...state, selectedRowIds: selectedRowsById }),\n );\n });\n selectionProps.selectedFlatRows = selectedRows;\n }\n const controlledTableSelections = [selections, selectionsDispatch];\n\n // Use the state and functions returned from useTable to build your UI\n const instance = useTable(...tableArgs);\n\n const {\n pageSize: tableStatePageSize,\n pageIndex: tableStatePageIndex,\n sortBy: tableStateSortBy,\n filters: tableStateFilters,\n selectedRowIds: tableStateSelectedRowIds,\n } = instance.state;\n\n useEffect(() => {\n if (fetchData) {\n fetchData({\n pageSize: tableStatePageSize,\n pageIndex: tableStatePageIndex,\n sortBy: tableStateSortBy,\n filters: tableStateFilters,\n });\n }\n }, [fetchData, tableStatePageSize, tableStatePageIndex, tableStateSortBy, tableStateFilters]);\n\n useMountedLayoutEffect(() => {\n if (onSelectedRowsChanged) {\n onSelectedRowsChanged(tableStateSelectedRowIds);\n }\n }, [tableStateSelectedRowIds, onSelectedRowsChanged]);\n\n const selectionActions = useSelectionActions(instance, controlledTableSelections);\n\n const enhancedInstance = {\n ...instance,\n itemCount,\n numBreakoutFilters,\n bulkActions,\n tableActions,\n controlledTableSelections,\n showFiltersInSidebar,\n dataViewToggleOptions,\n renderRowSubComponent,\n disableElevation,\n isLoading,\n isSelectable,\n isPaginated,\n manualSelectColumn,\n maxSelectedRows,\n onMaxSelectedRows,\n ...selectionProps,\n ...selectionActions,\n ...props,\n };\n\n return (\n <DataTableContext.Provider value={enhancedInstance}>\n <DataTableLayout>\n <div className={classNames('pgn__data-table-wrapper', {\n 'hide-shadow': !!disableElevation,\n })}\n >\n {children || (\n <>\n <TableControlBar />\n <Table />\n <EmptyTableComponent content=\"No results found\" />\n <TableFooter />\n </>\n )}\n </div>\n </DataTableLayout>\n </DataTableContext.Provider>\n );\n}\n\nDataTable.defaultProps = {\n additionalColumns: [],\n defaultColumnValues: {},\n isFilterable: false,\n isPaginated: false,\n isSelectable: false,\n isSortable: false,\n manualFilters: false,\n manualPagination: false,\n manualSortBy: false,\n fetchData: null,\n initialState: {},\n initialTableOptions: {},\n EmptyTableComponent: EmptyTableContent,\n children: null,\n bulkActions: [],\n tableActions: [],\n numBreakoutFilters: 1,\n manualSelectColumn: undefined,\n SelectionStatusComponent: SelectionStatus,\n FilterStatusComponent: FilterStatus,\n RowStatusComponent: RowStatus,\n showFiltersInSidebar: false,\n dataViewToggleOptions: {\n isDataViewToggleEnabled: false,\n onDataViewToggle: () => {},\n defaultActiveStateValue: 'card',\n togglePlacement: 'left',\n },\n disableElevation: false,\n renderRowSubComponent: undefined,\n isExpandable: false,\n isLoading: false,\n onSelectedRowsChanged: undefined,\n maxSelectedRows: undefined,\n onMaxSelectedRows: undefined,\n};\n\nDataTable.propTypes = {\n /** Definition of table columns */\n columns: PropTypes.arrayOf(PropTypes.shape({\n /** User visible column name */\n Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,\n /** String used to access the correct cell data for this column */\n accessor: requiredWhenNot(PropTypes.string, 'Cell'),\n /** Specifies a function that receives `row` as argument and returns cell content */\n Cell: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),\n /** Specifies filter component */\n Filter: PropTypes.func,\n /** Specifies filter type */\n filter: PropTypes.string,\n /** Specifies filter choices */\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string,\n number: PropTypes.number,\n value: PropTypes.string,\n })),\n })).isRequired,\n /** Data to be displayed in the table */\n data: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n /** table rows can be selected */\n isSelectable: PropTypes.bool,\n /** Alternate column for selecting rows. See react table useSort docs for more information */\n manualSelectColumn: PropTypes.shape({\n id: PropTypes.string.isRequired,\n Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,\n Cell: PropTypes.func.isRequired,\n disableSortBy: PropTypes.bool.isRequired,\n }),\n /** Table columns can be sorted */\n isSortable: PropTypes.bool,\n /** Indicates that sorting will be done via backend API. A fetchData function must be provided */\n manualSortBy: PropTypes.bool,\n /** Paginate the table */\n isPaginated: PropTypes.bool,\n /** Indicates that pagination will be done manually. A fetchData function must be provided */\n manualPagination: PropTypes.bool,\n // eslint-disable-next-line react/require-default-props\n pageCount: requiredWhen(PropTypes.number, 'manualPagination'),\n /** Table rows can be filtered, using a default filter in the default column values, or in the column definition */\n isFilterable: PropTypes.bool,\n /** Indicates that filtering will be done via a backend API. A fetchData function must be provided */\n manualFilters: PropTypes.bool,\n\n /** defaults that will be set on each column. Will be overridden by individual column values */\n defaultColumnValues: PropTypes.shape({\n /** A default filter component for the column */\n Filter: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),\n }),\n /** Actions or other additional non-data columns can be added here */\n additionalColumns: PropTypes.arrayOf(PropTypes.shape({\n /** id must be unique from other columns ids */\n id: PropTypes.string.isRequired,\n /** column header that will be displayed to the user */\n Header: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n /** Component that renders in the added column. It will receive the row as a prop */\n Cell: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),\n })),\n /** Function that will fetch table data. Called when page size, page index or filters change.\n * Meant to be used with manual filters and pagination */\n fetchData: PropTypes.func,\n /** Initial state passed to react-table's documentation https://react-table.tanstack.com/docs/api/useTable */\n initialState: PropTypes.shape({\n pageSize: requiredWhen(PropTypes.number, 'isPaginated'),\n pageIndex: requiredWhen(PropTypes.number, 'isPaginated'),\n filters: requiredWhen(PropTypes.arrayOf(PropTypes.shape()), 'manualFilters'),\n sortBy: requiredWhen(PropTypes.arrayOf(PropTypes.shape()), 'manualSortBy'),\n selectedRowIds: PropTypes.shape(),\n selectedRowsOrdered: PropTypes.arrayOf(PropTypes.number),\n }),\n /** Table options passed to react-table's useTable hook. Will override some options passed in to DataTable, such\n as: data, columns, defaultColumn, manualFilters, manualPagination, manualSortBy, and initialState */\n initialTableOptions: PropTypes.shape({}),\n /** Actions to be performed on the table. Called with the table instance. Not displayed if rows are selected. */\n itemCount: PropTypes.number.isRequired,\n /** Actions to be performed on selected rows of the table. Called with the selected rows.\n * Only displayed if rows are selected. */\n bulkActions: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape({\n /** Bulk action button text */\n buttonText: PropTypes.string.isRequired,\n /** handleClick will be passed the selected rows */\n handleClick: PropTypes.func.isRequired,\n /** classnames for button class */\n className: PropTypes.string,\n /** optional button variant; only relevant for the first two buttons */\n variant: PropTypes.string,\n /** disables button */\n disabled: PropTypes.bool,\n }),\n /** function passed selected items, should return action object */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n ),\n /** Function for rendering custom components */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n /** Function for rendering custom components, called with the table instance */\n tableActions: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape({\n /** Bulk action button text */\n buttonText: PropTypes.string.isRequired,\n /** handleClick will be passed the selected rows */\n handleClick: PropTypes.func.isRequired,\n /** classnames for button class */\n className: PropTypes.string,\n /** optional button variant; only relevant for the first two buttons */\n variant: PropTypes.string,\n /** disables button */\n disabled: PropTypes.bool,\n }),\n /** function passed table instance, should return action object */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n ),\n /** Function for rendering custom components */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n /** Number between one and four filters that can be shown on the top row. */\n numBreakoutFilters: PropTypes.oneOf([1, 2, 3, 4]),\n /** Component to be displayed when the table is empty */\n EmptyTableComponent: PropTypes.func,\n /** Component to be displayed for row status, ie, 10 of 20 rows. Displayed by default in the TableControlBar */\n RowStatusComponent: PropTypes.func,\n /** Component to be displayed for selection status. Displayed when there are selected rows and no active filters */\n SelectionStatusComponent: PropTypes.func,\n /** Component to be displayed for filter status. Displayed when there are active filters. */\n FilterStatusComponent: PropTypes.func,\n /** If children are not provided a table with control bar and footer will be rendered */\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n /** If true filters will be shown on sidebar instead */\n showFiltersInSidebar: PropTypes.bool,\n /** options for data view toggle */\n dataViewToggleOptions: PropTypes.shape({\n /** Whether to show a toggle button group which allows view switching between card and table views */\n isDataViewToggleEnabled: PropTypes.bool,\n /** Callback invoked when the toggle buttons are clicked, with value of selected button passed in */\n onDataViewToggle: PropTypes.func,\n /** default value for toggle active state */\n defaultActiveStateValue: PropTypes.string,\n /** placement of toggle 'bottom' will push it to the bottom row in\n * actions section. Only 'left' and 'bottom' are supported */\n togglePlacement: PropTypes.string,\n }),\n /** Remove the default box shadow on the component */\n disableElevation: PropTypes.bool,\n /** A function that will render contents of expanded row, accepts `row` as a prop. */\n renderRowSubComponent: PropTypes.func,\n /** Indicates whether table supports expandable rows. */\n isExpandable: PropTypes.bool,\n /** Indicates whether the table should show loading states. */\n isLoading: PropTypes.bool,\n /** Callback function called when row selections change. */\n onSelectedRowsChanged: PropTypes.func,\n /** Indicates the max of rows selectable in the table. Requires isSelectable prop */\n maxSelectedRows: PropTypes.number,\n /** Callback after selected max rows. Requires isSelectable and maxSelectedRows props */\n onMaxSelectedRows: PropTypes.func,\n};\n\nDataTable.BulkActions = BulkActions;\nDataTable.EmptyTable = EmptyTableContent;\nDataTable.DropdownFilters = DropdownFilters;\nDataTable.FilterStatus = FilterStatus;\nDataTable.RowStatus = RowStatus;\nDataTable.SelectionStatus = SelectionStatus;\nDataTable.SmartStatus = SmartStatus;\nDataTable.Table = Table;\nDataTable.TableCell = TableCell;\nDataTable.TableControlBar = TableControlBar;\nDataTable.TableFilters = TableFilters;\nDataTable.TableFooter = TableFooter;\nDataTable.TableHeaderCell = TableHeaderCell;\nDataTable.TableHeaderRow = TableHeaderRow;\nDataTable.TablePagination = TablePagination;\nDataTable.TablePaginationMinimal = TablePaginationMinimal;\nDataTable.TableActions = TableActions;\nDataTable.ControlledSelectionStatus = ControlledSelectionStatus;\nDataTable.ControlledSelect = ControlledSelect;\nDataTable.ControlledSelectHeader = ControlledSelectHeader;\nDataTable.ExpandAll = ExpandAll;\nDataTable.ExpandRow = ExpandRow;\n\nexport default DataTable;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,IACVC,SAAS,EAAEC,OAAO,EAAEC,UAAU,QACzB,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,EAAEC,sBAAsB,QAAQ,aAAa;AAE9D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,iBAAiB,MAAM,2BAA2B;AACzD,SAASC,YAAY,EAAEC,eAAe,QAAQ,oBAAoB;AAClE,OAAOC,YAAY,MAAM,sBAAsB;AAC/C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,iBAAiB,MAAM,cAAc;AAC5C,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,eAAe,MAAM,6BAA6B;AACzD,OAAOC,yBAAyB,MAAM,uCAAuC;AAC7E,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,sBAAsB,MAAM,0BAA0B;AAC7D,OAAOC,gBAAgB,MAAM,oBAAoB;AACjD,OAAOC,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BAAsB,GAAGA,sBAAsB;AACzDQ,SAAS,CAACN,SAAS,GAAGA,SAAS;AAC/BM,SAAS,CAACL,SAAS,GAAGA,SAAS;AAE/B,eAAeK,SAAS"}
1
+ {"version":3,"file":"index.js","names":["React","useEffect","useMemo","useReducer","PropTypes","useTable","useMountedLayoutEffect","classNames","Table","getVisibleColumns","requiredWhen","requiredWhenNot","getTableArgs","TableControlBar","EmptyTableContent","TableFooter","BulkActions","DropdownFilters","FilterStatus","RowStatus","SelectionStatus","ControlledSelectionStatus","SmartStatus","TableFilters","TableHeaderCell","TableCell","TableHeaderRow","TablePagination","TablePaginationMinimal","DataTableContext","TableActions","ControlledSelect","ControlledSelectHeader","DataTableLayout","ExpandAll","ExpandRow","useSelectionActions","selectionsReducer","initialState","initialSelectionsState","DataTable","_ref","columns","data","defaultColumnValues","additionalColumns","isSelectable","isPaginated","manualPagination","pageCount","itemCount","isFilterable","manualFilters","fetchData","isSortable","manualSortBy","isExpandable","renderRowSubComponent","bulkActions","tableActions","numBreakoutFilters","initialTableOptions","EmptyTableComponent","manualSelectColumn","showFiltersInSidebar","dataViewToggleOptions","disableElevation","isLoading","children","onSelectedRowsChanged","maxSelectedRows","onMaxSelectedRows","props","_objectWithoutProperties","_excluded","defaultColumn","tableOptions","updatedTableOptions","_objectSpread","stateReducer","newState","action","previousState","type","value","selectedRowIds","rowIndex","parseInt","id","selectedRowsOrdered","newSelectedRowsOrdered","filter","item","selections","selectionsDispatch","tableArgs","push","hooks","visibleColumns","selectionProps","selectedRows","length","selectedRowsById","forEach","row","useControlledState","state","selectedFlatRows","controlledTableSelections","instance","pageSize","tableStatePageSize","pageIndex","tableStatePageIndex","sortBy","tableStateSortBy","filters","tableStateFilters","tableStateSelectedRowIds","selectionActions","enhancedInstance","createElement","Provider","className","Fragment","content","defaultProps","undefined","SelectionStatusComponent","FilterStatusComponent","RowStatusComponent","isDataViewToggleEnabled","onDataViewToggle","defaultActiveStateValue","togglePlacement","propTypes","arrayOf","shape","Header","oneOfType","elementType","node","isRequired","accessor","string","Cell","Filter","filterChoices","name","number","bool","disableSortBy","func","buttonText","handleClick","variant","disabled","element","oneOf","EmptyTable"],"sources":["../../src/DataTable/index.jsx"],"sourcesContent":["import React, {\n useEffect, useMemo, useReducer,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport { useTable, useMountedLayoutEffect } from 'react-table';\n\nimport classNames from 'classnames';\nimport Table from './Table';\nimport getVisibleColumns from './utils/getVisibleColumns';\nimport { requiredWhen, requiredWhenNot } from '../utils/propTypes';\nimport getTableArgs from './utils/getTableArgs';\nimport TableControlBar from './TableControlBar';\nimport EmptyTableContent from './EmptyTable';\nimport TableFooter from './TableFooter';\nimport BulkActions from './BulkActions';\nimport DropdownFilters from './DropdownFilters';\nimport FilterStatus from './FilterStatus';\nimport RowStatus from './RowStatus';\nimport SelectionStatus from './selection/SelectionStatus';\nimport ControlledSelectionStatus from './selection/ControlledSelectionStatus';\nimport SmartStatus from './SmartStatus';\nimport TableFilters from './TableFilters';\nimport TableHeaderCell from './TableHeaderCell';\nimport TableCell from './TableCell';\nimport TableHeaderRow from './TableHeaderRow';\nimport TablePagination from './TablePagination';\nimport TablePaginationMinimal from './TablePaginationMinimal';\nimport DataTableContext from './DataTableContext';\nimport TableActions from './TableActions';\nimport ControlledSelect from './selection/ControlledSelect';\nimport ControlledSelectHeader from './selection/ControlledSelectHeader';\nimport DataTableLayout from './DataTableLayout';\nimport ExpandAll from './ExpandAll';\nimport ExpandRow from './ExpandRow';\n\nimport { useSelectionActions } from './hooks';\nimport selectionsReducer, { initialState as initialSelectionsState } from './selection/data/reducer';\n\nfunction DataTable({\n columns, data, defaultColumnValues, additionalColumns, isSelectable,\n isPaginated, manualPagination, pageCount, itemCount,\n isFilterable, manualFilters, fetchData, initialState,\n isSortable, manualSortBy,\n isExpandable, renderRowSubComponent,\n bulkActions, tableActions, numBreakoutFilters,\n initialTableOptions,\n EmptyTableComponent,\n manualSelectColumn,\n showFiltersInSidebar,\n dataViewToggleOptions,\n disableElevation,\n isLoading,\n children,\n onSelectedRowsChanged,\n maxSelectedRows,\n onMaxSelectedRows,\n ...props\n}) {\n const defaultColumn = useMemo(\n () => (defaultColumnValues),\n [defaultColumnValues],\n );\n const tableOptions = useMemo(() => {\n const updatedTableOptions = {\n stateReducer: (newState, action, previousState) => {\n switch (action.type) {\n // Note: we override the `toggleAllRowsSelected` action\n // from react-table because it only clears the selections on the\n // currently visible page; it does not clear the `selectedRowIds`\n // as we would expect for selections on different pages. Instead, we\n // force `selectedRowIds` to be cleared when `toggleAllRowsSelected(false)`\n // is called.\n case 'toggleAllRowsSelected': {\n if (action.value) {\n return newState;\n }\n return {\n ...newState,\n selectedRowIds: {},\n };\n }\n /* Note: We override the `toggleRowSelected` action from react-table\n because we need to preserve the order of the selected rows.\n While `selectedRowIds` is an object that contains the selected rows as key-value pairs,\n it does not maintain the order of selection. Therefore, we have added the `selectedRowsOrdered` property\n to keep track of the order in which the rows were selected.\n */\n case 'toggleRowSelected': {\n const rowIndex = parseInt(action.id, 10);\n const { selectedRowsOrdered = [] } = previousState;\n\n let newSelectedRowsOrdered;\n if (action.value) {\n newSelectedRowsOrdered = [...selectedRowsOrdered, rowIndex];\n } else {\n newSelectedRowsOrdered = selectedRowsOrdered.filter((item) => item !== rowIndex);\n }\n\n return {\n ...newState,\n selectedRowsOrdered: newSelectedRowsOrdered,\n };\n }\n default:\n return newState;\n }\n },\n ...initialTableOptions,\n };\n return {\n columns,\n data,\n defaultColumn,\n manualFilters,\n manualPagination,\n manualSortBy,\n initialState,\n ...updatedTableOptions,\n };\n }, [initialTableOptions, columns, data, defaultColumn, manualFilters, manualPagination, manualSortBy, initialState]);\n\n const [selections, selectionsDispatch] = useReducer(selectionsReducer, initialSelectionsState);\n\n if (isPaginated && manualPagination) {\n // pageCount is required when pagination is manual, if it's not there passing -1 as per react-table docs\n tableOptions.pageCount = pageCount || -1;\n }\n\n // NB: Table args *must* be in a particular order\n const tableArgs = getTableArgs({\n tableOptions, isFilterable, isSelectable, isPaginated, isSortable, isExpandable,\n });\n // adds selection column and action columns as necessary\n tableArgs.push(hooks => {\n hooks.visibleColumns.push(\n visibleColumns => getVisibleColumns(isSelectable, visibleColumns, additionalColumns, manualSelectColumn),\n );\n });\n\n // Pass any controlled selections from context to the appropriate ``useTable`` arguments to maintain\n // correct selection states on rows, both from a data perspective and in the UI.\n const selectionProps = {};\n const { selectedRows } = selections;\n if (selectedRows.length > 0) {\n const selectedRowsById = {};\n selectedRows.forEach((row) => {\n selectedRowsById[row.id] = true;\n });\n tableArgs.push(hooks => {\n hooks.useControlledState.push(\n (state) => ({ ...state, selectedRowIds: selectedRowsById }),\n );\n });\n selectionProps.selectedFlatRows = selectedRows;\n }\n const controlledTableSelections = [selections, selectionsDispatch];\n\n // Use the state and functions returned from useTable to build your UI\n const instance = useTable(...tableArgs);\n\n const {\n pageSize: tableStatePageSize,\n pageIndex: tableStatePageIndex,\n sortBy: tableStateSortBy,\n filters: tableStateFilters,\n selectedRowIds: tableStateSelectedRowIds,\n } = instance.state;\n\n useEffect(() => {\n if (fetchData) {\n fetchData({\n pageSize: tableStatePageSize,\n pageIndex: tableStatePageIndex,\n sortBy: tableStateSortBy,\n filters: tableStateFilters,\n });\n }\n }, [fetchData, tableStatePageSize, tableStatePageIndex, tableStateSortBy, tableStateFilters]);\n\n useMountedLayoutEffect(() => {\n if (onSelectedRowsChanged) {\n onSelectedRowsChanged(tableStateSelectedRowIds);\n }\n }, [tableStateSelectedRowIds, onSelectedRowsChanged]);\n\n const selectionActions = useSelectionActions(instance, controlledTableSelections);\n\n const enhancedInstance = {\n ...instance,\n itemCount,\n numBreakoutFilters,\n bulkActions,\n tableActions,\n controlledTableSelections,\n showFiltersInSidebar,\n dataViewToggleOptions,\n renderRowSubComponent,\n disableElevation,\n isLoading,\n isSelectable,\n isPaginated,\n manualSelectColumn,\n maxSelectedRows,\n onMaxSelectedRows,\n ...selectionProps,\n ...selectionActions,\n ...props,\n };\n\n return (\n <DataTableContext.Provider value={enhancedInstance}>\n <DataTableLayout>\n <div className={classNames('pgn__data-table-wrapper', {\n 'hide-shadow': !!disableElevation,\n })}\n >\n {children || (\n <>\n <TableControlBar />\n <Table />\n <EmptyTableComponent content=\"No results found\" />\n <TableFooter />\n </>\n )}\n </div>\n </DataTableLayout>\n </DataTableContext.Provider>\n );\n}\n\nDataTable.defaultProps = {\n additionalColumns: [],\n defaultColumnValues: {},\n isFilterable: false,\n isPaginated: false,\n isSelectable: false,\n isSortable: false,\n manualFilters: false,\n manualPagination: false,\n manualSortBy: false,\n fetchData: null,\n initialState: {},\n initialTableOptions: {},\n EmptyTableComponent: EmptyTableContent,\n children: null,\n bulkActions: [],\n tableActions: [],\n numBreakoutFilters: 1,\n manualSelectColumn: undefined,\n SelectionStatusComponent: SelectionStatus,\n FilterStatusComponent: FilterStatus,\n RowStatusComponent: RowStatus,\n showFiltersInSidebar: false,\n dataViewToggleOptions: {\n isDataViewToggleEnabled: false,\n onDataViewToggle: () => {},\n defaultActiveStateValue: 'card',\n togglePlacement: 'left',\n },\n disableElevation: false,\n renderRowSubComponent: undefined,\n isExpandable: false,\n isLoading: false,\n onSelectedRowsChanged: undefined,\n maxSelectedRows: undefined,\n onMaxSelectedRows: undefined,\n};\n\nDataTable.propTypes = {\n /** Definition of table columns */\n columns: PropTypes.arrayOf(PropTypes.shape({\n /** User visible column name */\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,\n /** String used to access the correct cell data for this column */\n accessor: requiredWhenNot(PropTypes.string, 'Cell'),\n /** Specifies a function that receives `row` as argument and returns cell content */\n Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),\n /** Specifies filter component */\n Filter: PropTypes.elementType,\n /** Specifies filter type */\n filter: PropTypes.string,\n /** Specifies filter choices */\n filterChoices: PropTypes.arrayOf(PropTypes.shape({\n name: PropTypes.string,\n number: PropTypes.number,\n value: PropTypes.string,\n })),\n })).isRequired,\n /** Data to be displayed in the table */\n data: PropTypes.arrayOf(PropTypes.shape({})).isRequired,\n /** table rows can be selected */\n isSelectable: PropTypes.bool,\n /** Alternate column for selecting rows. See react table useSort docs for more information */\n manualSelectColumn: PropTypes.shape({\n id: PropTypes.string.isRequired,\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,\n Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),\n disableSortBy: PropTypes.bool.isRequired,\n }),\n /** Table columns can be sorted */\n isSortable: PropTypes.bool,\n /** Indicates that sorting will be done via backend API. A fetchData function must be provided */\n manualSortBy: PropTypes.bool,\n /** Paginate the table */\n isPaginated: PropTypes.bool,\n /** Indicates that pagination will be done manually. A fetchData function must be provided */\n manualPagination: PropTypes.bool,\n // eslint-disable-next-line react/require-default-props\n pageCount: requiredWhen(PropTypes.number, 'manualPagination'),\n /** Table rows can be filtered, using a default filter in the default column values, or in the column definition */\n isFilterable: PropTypes.bool,\n /** Indicates that filtering will be done via a backend API. A fetchData function must be provided */\n manualFilters: PropTypes.bool,\n\n /** defaults that will be set on each column. Will be overridden by individual column values */\n defaultColumnValues: PropTypes.shape({\n /** A default filter component for the column */\n Filter: PropTypes.elementType,\n }),\n /** Actions or other additional non-data columns can be added here */\n additionalColumns: PropTypes.arrayOf(PropTypes.shape({\n /** id must be unique from other columns ids */\n id: PropTypes.string.isRequired,\n /** column header that will be displayed to the user */\n Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),\n /** Component that renders in the added column. It will receive the row as a prop */\n Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),\n })),\n /** Function that will fetch table data. Called when page size, page index or filters change.\n * Meant to be used with manual filters and pagination */\n fetchData: PropTypes.func,\n /** Initial state passed to react-table's documentation https://react-table.tanstack.com/docs/api/useTable */\n initialState: PropTypes.shape({\n pageSize: requiredWhen(PropTypes.number, 'isPaginated'),\n pageIndex: requiredWhen(PropTypes.number, 'isPaginated'),\n filters: requiredWhen(PropTypes.arrayOf(PropTypes.shape()), 'manualFilters'),\n sortBy: requiredWhen(PropTypes.arrayOf(PropTypes.shape()), 'manualSortBy'),\n selectedRowIds: PropTypes.shape(),\n selectedRowsOrdered: PropTypes.arrayOf(PropTypes.number),\n }),\n /** Table options passed to react-table's useTable hook. Will override some options passed in to DataTable, such\n as: data, columns, defaultColumn, manualFilters, manualPagination, manualSortBy, and initialState */\n initialTableOptions: PropTypes.shape({}),\n /** Actions to be performed on the table. Called with the table instance. Not displayed if rows are selected. */\n itemCount: PropTypes.number.isRequired,\n /** Actions to be performed on selected rows of the table. Called with the selected rows.\n * Only displayed if rows are selected. */\n bulkActions: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape({\n /** Bulk action button text */\n buttonText: PropTypes.string.isRequired,\n /** handleClick will be passed the selected rows */\n handleClick: PropTypes.func.isRequired,\n /** classnames for button class */\n className: PropTypes.string,\n /** optional button variant; only relevant for the first two buttons */\n variant: PropTypes.string,\n /** disables button */\n disabled: PropTypes.bool,\n }),\n /** function passed selected items, should return action object */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n ),\n /** Function for rendering custom components */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n /** Function for rendering custom components, called with the table instance */\n tableActions: PropTypes.oneOfType([\n PropTypes.arrayOf(\n PropTypes.oneOfType([\n PropTypes.shape({\n /** Bulk action button text */\n buttonText: PropTypes.string.isRequired,\n /** handleClick will be passed the selected rows */\n handleClick: PropTypes.func.isRequired,\n /** classnames for button class */\n className: PropTypes.string,\n /** optional button variant; only relevant for the first two buttons */\n variant: PropTypes.string,\n /** disables button */\n disabled: PropTypes.bool,\n }),\n /** function passed table instance, should return action object */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n ),\n /** Function for rendering custom components */\n PropTypes.func,\n /** A custom component representing an action */\n PropTypes.element,\n ]),\n /** Number between one and four filters that can be shown on the top row. */\n numBreakoutFilters: PropTypes.oneOf([1, 2, 3, 4]),\n /** Component to be displayed when the table is empty */\n EmptyTableComponent: PropTypes.elementType,\n /** Component to be displayed for row status, ie, 10 of 20 rows. Displayed by default in the TableControlBar */\n RowStatusComponent: PropTypes.elementType,\n /** Component to be displayed for selection status. Displayed when there are selected rows and no active filters */\n SelectionStatusComponent: PropTypes.elementType,\n /** Component to be displayed for filter status. Displayed when there are active filters. */\n FilterStatusComponent: PropTypes.elementType,\n /** If children are not provided a table with control bar and footer will be rendered */\n children: PropTypes.node,\n /** If true filters will be shown on sidebar instead */\n showFiltersInSidebar: PropTypes.bool,\n /** options for data view toggle */\n dataViewToggleOptions: PropTypes.shape({\n /** Whether to show a toggle button group which allows view switching between card and table views */\n isDataViewToggleEnabled: PropTypes.bool,\n /** Callback invoked when the toggle buttons are clicked, with value of selected button passed in */\n onDataViewToggle: PropTypes.func,\n /** default value for toggle active state */\n defaultActiveStateValue: PropTypes.string,\n /** placement of toggle 'bottom' will push it to the bottom row in\n * actions section. Only 'left' and 'bottom' are supported */\n togglePlacement: PropTypes.string,\n }),\n /** Remove the default box shadow on the component */\n disableElevation: PropTypes.bool,\n /** A function that will render contents of expanded row, accepts `row` as a prop. */\n renderRowSubComponent: PropTypes.func,\n /** Indicates whether table supports expandable rows. */\n isExpandable: PropTypes.bool,\n /** Indicates whether the table should show loading states. */\n isLoading: PropTypes.bool,\n /** Callback function called when row selections change. */\n onSelectedRowsChanged: PropTypes.func,\n /** Indicates the max of rows selectable in the table. Requires isSelectable prop */\n maxSelectedRows: PropTypes.number,\n /** Callback after selected max rows. Requires isSelectable and maxSelectedRows props */\n onMaxSelectedRows: PropTypes.func,\n};\n\nDataTable.BulkActions = BulkActions;\nDataTable.EmptyTable = EmptyTableContent;\nDataTable.DropdownFilters = DropdownFilters;\nDataTable.FilterStatus = FilterStatus;\nDataTable.RowStatus = RowStatus;\nDataTable.SelectionStatus = SelectionStatus;\nDataTable.SmartStatus = SmartStatus;\nDataTable.Table = Table;\nDataTable.TableCell = TableCell;\nDataTable.TableControlBar = TableControlBar;\nDataTable.TableFilters = TableFilters;\nDataTable.TableFooter = TableFooter;\nDataTable.TableHeaderCell = TableHeaderCell;\nDataTable.TableHeaderRow = TableHeaderRow;\nDataTable.TablePagination = TablePagination;\nDataTable.TablePaginationMinimal = TablePaginationMinimal;\nDataTable.TableActions = TableActions;\nDataTable.ControlledSelectionStatus = ControlledSelectionStatus;\nDataTable.ControlledSelect = ControlledSelect;\nDataTable.ControlledSelectHeader = ControlledSelectHeader;\nDataTable.ExpandAll = ExpandAll;\nDataTable.ExpandRow = ExpandRow;\n\nexport default DataTable;\n"],"mappings":";;;;;;;;AAAA,OAAOA,KAAK,IACVC,SAAS,EAAEC,OAAO,EAAEC,UAAU,QACzB,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,QAAQ,EAAEC,sBAAsB,QAAQ,aAAa;AAE9D,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,iBAAiB,MAAM,2BAA2B;AACzD,SAASC,YAAY,EAAEC,eAAe,QAAQ,oBAAoB;AAClE,OAAOC,YAAY,MAAM,sBAAsB;AAC/C,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,iBAAiB,MAAM,cAAc;AAC5C,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,eAAe,MAAM,6BAA6B;AACzD,OAAOC,yBAAyB,MAAM,uCAAuC;AAC7E,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,eAAe,MAAM,mBAAmB;AAC/C,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,cAAc,MAAM,kBAAkB;AAC7C,OAAOC,eAAe,MAAM,mBAAmB;AAC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sB;AACzDQ,SAAS,CAACN,SAAS,GAAGA,SAAS;AAC/BM,SAAS,CAACL,SAAS,GAAGA,SAAS;AAE/B,eAAeK,SAAS"}
@@ -1,4 +1,4 @@
1
- const _excluded = ["as", "className", "controlClassName", "leadingElement", "trailingElement", "floatingLabel", "autoResize", "onChange"],
1
+ const _excluded = ["as", "className", "controlClassName", "leadingElement", "trailingElement", "floatingLabel", "autoResize", "onChange", "inputMask"],
2
2
  _excluded2 = ["isInvalid", "isValid", "getControlProps"];
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -12,6 +12,7 @@ import React, { useCallback, useEffect } from 'react';
12
12
  import PropTypes from 'prop-types';
13
13
  import classNames from 'classnames';
14
14
  import RBFormControl from 'react-bootstrap/FormControl';
15
+ import { IMaskInput } from 'react-imask';
15
16
  import { useFormGroupContext } from './FormGroupContext';
16
17
  import FormControlFeedback from './FormControlFeedback';
17
18
  import FormControlDecoratorGroup from './FormControlDecoratorGroup';
@@ -25,7 +26,8 @@ const FormControl = /*#__PURE__*/React.forwardRef((_ref, ref) => {
25
26
  trailingElement,
26
27
  floatingLabel,
27
28
  autoResize,
28
- onChange
29
+ onChange,
30
+ inputMask
29
31
  } = _ref,
30
32
  props = _objectWithoutProperties(_ref, _excluded);
31
33
  const _useFormGroupContext = useFormGroupContext(),
@@ -72,7 +74,7 @@ const FormControl = /*#__PURE__*/React.forwardRef((_ref, ref) => {
72
74
  floatingLabel: floatingLabel,
73
75
  className: className
74
76
  }, /*#__PURE__*/React.createElement(RBFormControl, _extends({
75
- as: as,
77
+ as: inputMask ? IMaskInput : as,
76
78
  ref: resolvedRef,
77
79
  size: size,
78
80
  isInvalid: isInvalid,
@@ -80,7 +82,8 @@ const FormControl = /*#__PURE__*/React.forwardRef((_ref, ref) => {
80
82
  className: classNames(controlClassName, {
81
83
  'has-value': hasValue
82
84
  }),
83
- onChange: handleOnChange
85
+ onChange: handleOnChange,
86
+ mask: inputMask
84
87
  }, controlProps)));
85
88
  });
86
89
  const SIZE_CHOICES = ['sm', 'lg'];
@@ -116,7 +119,9 @@ FormControl.propTypes = {
116
119
  /** Specifies whether to display control in invalid state, this affects styling. */
117
120
  isInvalid: PropTypes.bool,
118
121
  /** Only for `as="textarea"`. Specifies whether the input can be resized according to the height of content. */
119
- autoResize: PropTypes.bool
122
+ autoResize: PropTypes.bool,
123
+ /** Specifies what format to use for the input mask. */
124
+ inputMask: PropTypes.string
120
125
  };
121
126
  FormControl.defaultProps = {
122
127
  as: 'input',
@@ -133,7 +138,8 @@ FormControl.defaultProps = {
133
138
  plaintext: false,
134
139
  isValid: undefined,
135
140
  isInvalid: undefined,
136
- autoResize: false
141
+ autoResize: false,
142
+ inputMask: undefined
137
143
  };
138
144
  export default FormControl;
139
145
  //# sourceMappingURL=FormControl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormControl.js","names":["React","useCallback","useEffect","PropTypes","classNames","RBFormControl","useFormGroupContext","FormControlFeedback","FormControlDecoratorGroup","callAllHandlers","useHasValue","FormControl","forwardRef","_ref","ref","as","className","controlClassName","leadingElement","trailingElement","floatingLabel","autoResize","onChange","props","_objectWithoutProperties","_excluded","_useFormGroupContext","isInvalid","isValid","getControlProps","formGroupContext","_excluded2","inputRef","useRef","resolvedRef","size","hasValue","checkInputEventValue","defaultValue","value","handleResize","current","initialHeight","offsets","offsetHeight","clientHeight","style","height","scrollHeight","controlProps","_objectSpread","onBlur","handleOnChange","e","createElement","_extends","SIZE_CHOICES","Feedback","Description","propTypes","string","elementType","func","oneOfType","number","id","oneOf","node","plaintext","bool","defaultProps","undefined"],"sources":["../../src/Form/FormControl.jsx"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport RBFormControl from 'react-bootstrap/FormControl';\nimport { useFormGroupContext } from './FormGroupContext';\nimport FormControlFeedback from './FormControlFeedback';\nimport FormControlDecoratorGroup from './FormControlDecoratorGroup';\n\nimport { callAllHandlers, useHasValue } from './fieldUtils';\n\nconst FormControl = React.forwardRef(({\n as,\n className,\n controlClassName,\n leadingElement,\n trailingElement,\n floatingLabel,\n autoResize,\n onChange,\n ...props\n}, ref) => {\n const {\n isInvalid,\n isValid,\n getControlProps,\n ...formGroupContext\n } = useFormGroupContext();\n const inputRef = React.useRef();\n const resolvedRef = ref || inputRef;\n const size = props.size || formGroupContext.size;\n\n const [hasValue, checkInputEventValue] = useHasValue({\n defaultValue: props.defaultValue,\n value: props.value,\n });\n\n const handleResize = useCallback(() => {\n if (as === 'textarea' && autoResize) {\n if (!resolvedRef.current.initialHeight && !resolvedRef.current.offsets) {\n resolvedRef.current.initialHeight = resolvedRef.current.offsetHeight;\n resolvedRef.current.offsets = resolvedRef.current.offsetHeight - resolvedRef.current.clientHeight;\n }\n resolvedRef.current.style.height = `${resolvedRef.current.initialHeight}px`;\n resolvedRef.current.style.height = `${resolvedRef.current.scrollHeight + resolvedRef.current.offsets}px`;\n }\n }, [as, autoResize, resolvedRef]);\n\n useEffect(() => {\n handleResize();\n }, [handleResize]);\n\n const controlProps = getControlProps({\n ...props,\n // eslint-disable-next-line react/prop-types\n onBlur: callAllHandlers(checkInputEventValue, props.onBlur),\n });\n\n const handleOnChange = (e) => {\n handleResize();\n if (onChange) {\n onChange(e);\n }\n };\n\n return (\n <FormControlDecoratorGroup\n size={size}\n leadingElement={leadingElement}\n trailingElement={trailingElement}\n floatingLabel={floatingLabel}\n className={className}\n >\n <RBFormControl\n as={as}\n ref={resolvedRef}\n size={size}\n isInvalid={isInvalid}\n isValid={isValid}\n className={classNames(controlClassName, {\n 'has-value': hasValue,\n })}\n onChange={handleOnChange}\n {...controlProps}\n />\n </FormControlDecoratorGroup>\n );\n});\n\nconst SIZE_CHOICES = ['sm', 'lg'];\n\nFormControl.Feedback = FormControlFeedback;\nFormControl.Description = FormControlFeedback;\n\nFormControl.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies base element for the control component. */\n as: PropTypes.elementType,\n /** Specifies function that is triggered on input value change. */\n onChange: PropTypes.func,\n /** Specifies default value of the input component. */\n defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Specifies current value of the input component. */\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Specifies id of the control component. */\n id: PropTypes.string,\n /** Specifies class name for the control component. */\n controlClassName: PropTypes.string,\n /** Specifies size for the control component. */\n size: PropTypes.oneOf(SIZE_CHOICES),\n /** Specifies leading element to display for the input component. */\n leadingElement: PropTypes.node,\n /** Specifies trailing element to display for the input component. */\n trailingElement: PropTypes.node,\n /** Specifies floating label to display for the input component. */\n floatingLabel: PropTypes.node,\n /** Specifies whether to render input as plain text. */\n plaintext: PropTypes.bool,\n /** Specifies whether to display control in valid state, this affects styling. */\n isValid: PropTypes.bool,\n /** Specifies whether to display control in invalid state, this affects styling. */\n isInvalid: PropTypes.bool,\n /** Only for `as=\"textarea\"`. Specifies whether the input can be resized according to the height of content. */\n autoResize: PropTypes.bool,\n};\n\nFormControl.defaultProps = {\n as: 'input',\n className: undefined,\n id: undefined,\n controlClassName: undefined,\n onChange: undefined,\n defaultValue: undefined,\n value: undefined,\n size: undefined,\n leadingElement: undefined,\n trailingElement: undefined,\n floatingLabel: undefined,\n plaintext: false,\n isValid: undefined,\n isInvalid: undefined,\n autoResize: false,\n};\n\nexport default FormControl;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,QAAQ,OAAO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I;EACzB;EACAhD,UAAU,EAAElB,SAAS,CAACkE;AACxB,CAAC;AAED1D,WAAW,CAAC2D,YAAY,GAAG;EACzBvD,EAAE,EAAE,OAAO;EACXC,SAAS,EAAEuD,SAAS;EACpBN,EAAE,EAAEM,SAAS;EACbtD,gBAAgB,EAAEsD,SAAS;EAC3BjD,QAAQ,EAAEiD,SAAS;EACnBjC,YAAY,EAAEiC,SAAS;EACvBhC,KAAK,EAAEgC,SAAS;EAChBpC,IAAI,EAAEoC,SAAS;EACfrD,cAAc,EAAEqD,SAAS;EACzBpD,eAAe,EAAEoD,SAAS;EAC1BnD,aAAa,EAAEmD,SAAS;EACxBH,SAAS,EAAE,KAAK;EAChBxC,OAAO,EAAE2C,SAAS;EAClB5C,SAAS,EAAE4C,SAAS;EACpBlD,UAAU,EAAE;AACd,CAAC;AAED,eAAeV,WAAW"}
1
+ {"version":3,"file":"FormControl.js","names":["React","useCallback","useEffect","PropTypes","classNames","RBFormControl","IMaskInput","useFormGroupContext","FormControlFeedback","FormControlDecoratorGroup","callAllHandlers","useHasValue","FormControl","forwardRef","_ref","ref","as","className","controlClassName","leadingElement","trailingElement","floatingLabel","autoResize","onChange","inputMask","props","_objectWithoutProperties","_excluded","_useFormGroupContext","isInvalid","isValid","getControlProps","formGroupContext","_excluded2","inputRef","useRef","resolvedRef","size","hasValue","checkInputEventValue","defaultValue","value","handleResize","current","initialHeight","offsets","offsetHeight","clientHeight","style","height","scrollHeight","controlProps","_objectSpread","onBlur","handleOnChange","e","createElement","_extends","mask","SIZE_CHOICES","Feedback","Description","propTypes","string","elementType","func","oneOfType","number","id","oneOf","node","plaintext","bool","defaultProps","undefined"],"sources":["../../src/Form/FormControl.jsx"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport RBFormControl from 'react-bootstrap/FormControl';\nimport { IMaskInput } from 'react-imask';\nimport { useFormGroupContext } from './FormGroupContext';\nimport FormControlFeedback from './FormControlFeedback';\nimport FormControlDecoratorGroup from './FormControlDecoratorGroup';\n\nimport { callAllHandlers, useHasValue } from './fieldUtils';\n\nconst FormControl = React.forwardRef(({\n as,\n className,\n controlClassName,\n leadingElement,\n trailingElement,\n floatingLabel,\n autoResize,\n onChange,\n inputMask,\n ...props\n}, ref) => {\n const {\n isInvalid,\n isValid,\n getControlProps,\n ...formGroupContext\n } = useFormGroupContext();\n const inputRef = React.useRef();\n const resolvedRef = ref || inputRef;\n const size = props.size || formGroupContext.size;\n\n const [hasValue, checkInputEventValue] = useHasValue({\n defaultValue: props.defaultValue,\n value: props.value,\n });\n\n const handleResize = useCallback(() => {\n if (as === 'textarea' && autoResize) {\n if (!resolvedRef.current.initialHeight && !resolvedRef.current.offsets) {\n resolvedRef.current.initialHeight = resolvedRef.current.offsetHeight;\n resolvedRef.current.offsets = resolvedRef.current.offsetHeight - resolvedRef.current.clientHeight;\n }\n resolvedRef.current.style.height = `${resolvedRef.current.initialHeight}px`;\n resolvedRef.current.style.height = `${resolvedRef.current.scrollHeight + resolvedRef.current.offsets}px`;\n }\n }, [as, autoResize, resolvedRef]);\n\n useEffect(() => {\n handleResize();\n }, [handleResize]);\n\n const controlProps = getControlProps({\n ...props,\n // eslint-disable-next-line react/prop-types\n onBlur: callAllHandlers(checkInputEventValue, props.onBlur),\n });\n\n const handleOnChange = (e) => {\n handleResize();\n if (onChange) {\n onChange(e);\n }\n };\n\n return (\n <FormControlDecoratorGroup\n size={size}\n leadingElement={leadingElement}\n trailingElement={trailingElement}\n floatingLabel={floatingLabel}\n className={className}\n >\n <RBFormControl\n as={inputMask ? IMaskInput : as}\n ref={resolvedRef}\n size={size}\n isInvalid={isInvalid}\n isValid={isValid}\n className={classNames(controlClassName, {\n 'has-value': hasValue,\n })}\n onChange={handleOnChange}\n mask={inputMask}\n {...controlProps}\n />\n </FormControlDecoratorGroup>\n );\n});\n\nconst SIZE_CHOICES = ['sm', 'lg'];\n\nFormControl.Feedback = FormControlFeedback;\nFormControl.Description = FormControlFeedback;\n\nFormControl.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies base element for the control component. */\n as: PropTypes.elementType,\n /** Specifies function that is triggered on input value change. */\n onChange: PropTypes.func,\n /** Specifies default value of the input component. */\n defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Specifies current value of the input component. */\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Specifies id of the control component. */\n id: PropTypes.string,\n /** Specifies class name for the control component. */\n controlClassName: PropTypes.string,\n /** Specifies size for the control component. */\n size: PropTypes.oneOf(SIZE_CHOICES),\n /** Specifies leading element to display for the input component. */\n leadingElement: PropTypes.node,\n /** Specifies trailing element to display for the input component. */\n trailingElement: PropTypes.node,\n /** Specifies floating label to display for the input component. */\n floatingLabel: PropTypes.node,\n /** Specifies whether to render input as plain text. */\n plaintext: PropTypes.bool,\n /** Specifies whether to display control in valid state, this affects styling. */\n isValid: PropTypes.bool,\n /** Specifies whether to display control in invalid state, this affects styling. */\n isInvalid: PropTypes.bool,\n /** Only for `as=\"textarea\"`. Specifies whether the input can be resized according to the height of content. */\n autoResize: PropTypes.bool,\n /** Specifies what format to use for the input mask. */\n inputMask: PropTypes.string,\n};\n\nFormControl.defaultProps = {\n as: 'input',\n className: undefined,\n id: undefined,\n controlClassName: undefined,\n onChange: undefined,\n defaultValue: undefined,\n value: undefined,\n size: undefined,\n leadingElement: undefined,\n trailingElement: undefined,\n floatingLabel: undefined,\n plaintext: false,\n isValid: undefined,\n isInvalid: undefined,\n autoResize: false,\n inputMask: undefined,\n};\n\nexport default FormControl;\n"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,QAAQ,OAAO;AACrD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,aAAa,MAAM,6BAA6B;AACvD,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,mBAAmB,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AC1B;EACAhD,SAAS,EAAErB,SAAS,CAAC4D;AACvB,CAAC;AAEDnD,WAAW,CAAC6D,YAAY,GAAG;EACzBzD,EAAE,EAAE,OAAO;EACXC,SAAS,EAAEyD,SAAS;EACpBN,EAAE,EAAEM,SAAS;EACbxD,gBAAgB,EAAEwD,SAAS;EAC3BnD,QAAQ,EAAEmD,SAAS;EACnBlC,YAAY,EAAEkC,SAAS;EACvBjC,KAAK,EAAEiC,SAAS;EAChBrC,IAAI,EAAEqC,SAAS;EACfvD,cAAc,EAAEuD,SAAS;EACzBtD,eAAe,EAAEsD,SAAS;EAC1BrD,aAAa,EAAEqD,SAAS;EACxBH,SAAS,EAAE,KAAK;EAChBzC,OAAO,EAAE4C,SAAS;EAClB7C,SAAS,EAAE6C,SAAS;EACpBpD,UAAU,EAAE,KAAK;EACjBE,SAAS,EAAEkD;AACb,CAAC;AAED,eAAe9D,WAAW"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openedx/paragon",
3
- "version": "21.8.0",
3
+ "version": "21.9.0",
4
4
  "description": "Accessible, responsive UI component library based on Bootstrap.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -68,6 +68,7 @@
68
68
  "react-colorful": "^5.6.1",
69
69
  "react-dropzone": "^14.2.1",
70
70
  "react-focus-on": "^3.5.4",
71
+ "react-imask": "^7.1.3",
71
72
  "react-loading-skeleton": "^3.1.0",
72
73
  "react-popper": "^2.2.5",
73
74
  "react-proptype-conditional-require": "^1.0.4",
@@ -190,5 +191,8 @@
190
191
  "www",
191
192
  "icons",
192
193
  "dependent-usage-analyzer"
193
- ]
194
+ ],
195
+ "overrides": {
196
+ "@testing-library/dom": "9.3.3"
197
+ }
194
198
  }
@@ -17,6 +17,7 @@ A layout utility for the common use case of aligning buttons, links or text
17
17
  in a row in a control bar or nav.
18
18
 
19
19
  ActionRow assumes that its last child is the primary action and lays out actions so that the last item is in a primary location. If horizontal, the primary action sits on the right. If stacked, the primary action sits at the top of the stack (this is done via `flex-direction: column-reverse;`).
20
+
20
21
  ## Basic Usage
21
22
 
22
23
  ```jsx live
@@ -36,7 +37,9 @@ ActionRow can also be used with a helper component ``ActionRow.Spacer`` to inser
36
37
 
37
38
  ```jsx live
38
39
  <ActionRow>
39
- <Form.Checkbox className="flex-column flex-sm-row">Don't ask me again.</Form.Checkbox>
40
+ <Form.Checkbox className="flex-column flex-sm-row">
41
+ Don't ask me again.
42
+ </Form.Checkbox>
40
43
  <ActionRow.Spacer />
41
44
  <Button variant="tertiary">
42
45
  Cancel
@@ -49,7 +52,6 @@ ActionRow can also be used with a helper component ``ActionRow.Spacer`` to inser
49
52
 
50
53
  ## Stacked Usage
51
54
 
52
-
53
55
  ```jsx live
54
56
  <ActionRow isStacked>
55
57
  <p className="x-small">
@@ -102,7 +102,7 @@ CollapsibleButtonGroup.propTypes = {
102
102
  className: PropTypes.string,
103
103
  /** Array of action objects, containing a component and their callback args */
104
104
  actions: PropTypes.arrayOf(PropTypes.shape({
105
- component: PropTypes.oneOfType([PropTypes.func, PropTypes.element]).isRequired,
105
+ component: PropTypes.oneOfType([PropTypes.element, PropTypes.elementType]).isRequired,
106
106
  args: PropTypes.shape({}),
107
107
  })).isRequired,
108
108
  };
@@ -30,7 +30,7 @@ TableFilters.defaultProps = {
30
30
 
31
31
  TableFilters.propTypes = {
32
32
  columns: PropTypes.arrayOf(PropTypes.shape({
33
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
33
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
34
34
  canFilter: PropTypes.bool,
35
35
  render: PropTypes.func.isRequired,
36
36
  })).isRequired,
@@ -25,11 +25,7 @@ function TableFooter({ className, children }) {
25
25
 
26
26
  TableFooter.propTypes = {
27
27
  /** Specifies the content of the `TableFooter` */
28
- children: PropTypes.oneOfType([
29
- PropTypes.func,
30
- PropTypes.node,
31
- PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.node])),
32
- ]),
28
+ children: PropTypes.node,
33
29
  /** Specifies class name to append to the base element. */
34
30
  className: PropTypes.string,
35
31
  };
@@ -62,7 +62,7 @@ CheckboxFilter.propTypes = {
62
62
  */
63
63
  column: PropTypes.shape({
64
64
  setFilter: PropTypes.func.isRequired,
65
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
65
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
66
66
  filterChoices: PropTypes.arrayOf(PropTypes.shape({
67
67
  name: PropTypes.string.isRequired,
68
68
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
@@ -50,7 +50,7 @@ DropdownFilter.propTypes = {
50
50
  */
51
51
  column: PropTypes.shape({
52
52
  setFilter: PropTypes.func.isRequired,
53
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
53
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
54
54
  filterChoices: PropTypes.arrayOf(PropTypes.shape({
55
55
  name: PropTypes.string.isRequired,
56
56
  number: PropTypes.number,
@@ -66,7 +66,7 @@ MultiSelectDropdownFilter.propTypes = {
66
66
  /** Function to set the filter value */
67
67
  setFilter: PropTypes.func.isRequired,
68
68
  /** Column header used for labels and placeholders */
69
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
69
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
70
70
  /** Names and values for the select options */
71
71
  filterChoices: PropTypes.arrayOf(PropTypes.shape({
72
72
  name: PropTypes.string.isRequired,
@@ -52,7 +52,7 @@ TextFilter.propTypes = {
52
52
  */
53
53
  column: PropTypes.shape({
54
54
  setFilter: PropTypes.func.isRequired,
55
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
55
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
56
56
  getHeaderProps: PropTypes.func.isRequired,
57
57
  filterValue: PropTypes.string,
58
58
  }).isRequired,
@@ -270,13 +270,13 @@ DataTable.propTypes = {
270
270
  /** Definition of table columns */
271
271
  columns: PropTypes.arrayOf(PropTypes.shape({
272
272
  /** User visible column name */
273
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
273
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
274
274
  /** String used to access the correct cell data for this column */
275
275
  accessor: requiredWhenNot(PropTypes.string, 'Cell'),
276
276
  /** Specifies a function that receives `row` as argument and returns cell content */
277
- Cell: PropTypes.oneOfType([PropTypes.func, PropTypes.element]),
277
+ Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
278
278
  /** Specifies filter component */
279
- Filter: PropTypes.func,
279
+ Filter: PropTypes.elementType,
280
280
  /** Specifies filter type */
281
281
  filter: PropTypes.string,
282
282
  /** Specifies filter choices */
@@ -293,8 +293,8 @@ DataTable.propTypes = {
293
293
  /** Alternate column for selecting rows. See react table useSort docs for more information */
294
294
  manualSelectColumn: PropTypes.shape({
295
295
  id: PropTypes.string.isRequired,
296
- Header: PropTypes.oneOfType([PropTypes.func, PropTypes.node]).isRequired,
297
- Cell: PropTypes.func.isRequired,
296
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]).isRequired,
297
+ Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
298
298
  disableSortBy: PropTypes.bool.isRequired,
299
299
  }),
300
300
  /** Table columns can be sorted */
@@ -315,16 +315,16 @@ DataTable.propTypes = {
315
315
  /** defaults that will be set on each column. Will be overridden by individual column values */
316
316
  defaultColumnValues: PropTypes.shape({
317
317
  /** A default filter component for the column */
318
- Filter: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
318
+ Filter: PropTypes.elementType,
319
319
  }),
320
320
  /** Actions or other additional non-data columns can be added here */
321
321
  additionalColumns: PropTypes.arrayOf(PropTypes.shape({
322
322
  /** id must be unique from other columns ids */
323
323
  id: PropTypes.string.isRequired,
324
324
  /** column header that will be displayed to the user */
325
- Header: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
325
+ Header: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
326
326
  /** Component that renders in the added column. It will receive the row as a prop */
327
- Cell: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
327
+ Cell: PropTypes.oneOfType([PropTypes.elementType, PropTypes.node]),
328
328
  })),
329
329
  /** Function that will fetch table data. Called when page size, page index or filters change.
330
330
  * Meant to be used with manual filters and pagination */
@@ -401,15 +401,15 @@ DataTable.propTypes = {
401
401
  /** Number between one and four filters that can be shown on the top row. */
402
402
  numBreakoutFilters: PropTypes.oneOf([1, 2, 3, 4]),
403
403
  /** Component to be displayed when the table is empty */
404
- EmptyTableComponent: PropTypes.func,
404
+ EmptyTableComponent: PropTypes.elementType,
405
405
  /** Component to be displayed for row status, ie, 10 of 20 rows. Displayed by default in the TableControlBar */
406
- RowStatusComponent: PropTypes.func,
406
+ RowStatusComponent: PropTypes.elementType,
407
407
  /** Component to be displayed for selection status. Displayed when there are selected rows and no active filters */
408
- SelectionStatusComponent: PropTypes.func,
408
+ SelectionStatusComponent: PropTypes.elementType,
409
409
  /** Component to be displayed for filter status. Displayed when there are active filters. */
410
- FilterStatusComponent: PropTypes.func,
410
+ FilterStatusComponent: PropTypes.elementType,
411
411
  /** If children are not provided a table with control bar and footer will be rendered */
412
- children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),
412
+ children: PropTypes.node,
413
413
  /** If true filters will be shown on sidebar instead */
414
414
  showFiltersInSidebar: PropTypes.bool,
415
415
  /** options for data view toggle */
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { render, screen } from '@testing-library/react';
2
+ import { render, screen, waitFor } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
  import classNames from 'classnames';
5
5
  import TableActions from '../TableActions';
@@ -216,9 +216,10 @@ describe('<TableActions />', () => {
216
216
  expect(overflowToggle).toBeInTheDocument();
217
217
 
218
218
  userEvent.click(overflowToggle);
219
-
220
- const buttons = screen.getAllByRole('button');
221
- expect(buttons.length).toBeGreaterThan(1);
219
+ waitFor(() => {
220
+ const buttons = screen.getAllByRole('button');
221
+ expect(buttons.length).toBeGreaterThan(1);
222
+ });
222
223
  });
223
224
 
224
225
  it('renders the correct alt text for the dropdown', () => {
@@ -2,6 +2,7 @@ import React, { useCallback, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
  import RBFormControl from 'react-bootstrap/FormControl';
5
+ import { IMaskInput } from 'react-imask';
5
6
  import { useFormGroupContext } from './FormGroupContext';
6
7
  import FormControlFeedback from './FormControlFeedback';
7
8
  import FormControlDecoratorGroup from './FormControlDecoratorGroup';
@@ -17,6 +18,7 @@ const FormControl = React.forwardRef(({
17
18
  floatingLabel,
18
19
  autoResize,
19
20
  onChange,
21
+ inputMask,
20
22
  ...props
21
23
  }, ref) => {
22
24
  const {
@@ -71,7 +73,7 @@ const FormControl = React.forwardRef(({
71
73
  className={className}
72
74
  >
73
75
  <RBFormControl
74
- as={as}
76
+ as={inputMask ? IMaskInput : as}
75
77
  ref={resolvedRef}
76
78
  size={size}
77
79
  isInvalid={isInvalid}
@@ -80,6 +82,7 @@ const FormControl = React.forwardRef(({
80
82
  'has-value': hasValue,
81
83
  })}
82
84
  onChange={handleOnChange}
85
+ mask={inputMask}
83
86
  {...controlProps}
84
87
  />
85
88
  </FormControlDecoratorGroup>
@@ -122,6 +125,8 @@ FormControl.propTypes = {
122
125
  isInvalid: PropTypes.bool,
123
126
  /** Only for `as="textarea"`. Specifies whether the input can be resized according to the height of content. */
124
127
  autoResize: PropTypes.bool,
128
+ /** Specifies what format to use for the input mask. */
129
+ inputMask: PropTypes.string,
125
130
  };
126
131
 
127
132
  FormControl.defaultProps = {
@@ -140,6 +145,7 @@ FormControl.defaultProps = {
140
145
  isValid: undefined,
141
146
  isInvalid: undefined,
142
147
  autoResize: false,
148
+ inputMask: undefined,
143
149
  };
144
150
 
145
151
  export default FormControl;
@@ -43,7 +43,6 @@ or [select attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element
43
43
  }
44
44
  ```
45
45
 
46
-
47
46
  ## Input types
48
47
 
49
48
  ```jsx live
@@ -163,6 +162,148 @@ or [select attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element
163
162
  }
164
163
  ```
165
164
 
165
+ ## Input masks
166
+ Paragon uses the [react-imask](https://www.npmjs.com/package/react-imask) library,
167
+ which allows you to add masks of different types for inputs.
168
+ To create your own mask, you need to pass the required mask pattern (`+{1} (000) 000-0000`) to the `inputMask` property. <br />
169
+ See [react-imask](https://imask.js.org) for documentation on available props.
170
+
171
+ ```jsx live
172
+ () => {
173
+ {/* start example state */}
174
+ const [maskType, setMaskType] = useState('phone');
175
+ {/* end example state */}
176
+
177
+ const inputsWithMask = {
178
+ phone: (
179
+ <>
180
+ <h3>Phone</h3>
181
+ <Form.Group>
182
+ <Form.Control
183
+ inputMask="+{1} (000) 000-0000"
184
+ value={value}
185
+ onChange={handleChange}
186
+ leadingElement={<Icon src={FavoriteBorder} />}
187
+ floatingLabel="What is your phone number?"
188
+ />
189
+ </Form.Group>
190
+ </>
191
+ ),
192
+ creditCard: (<>
193
+ <h3>Credit card</h3>
194
+ <Form.Group>
195
+ <Form.Control
196
+ inputMask="0000 0000 0000 0000"
197
+ value={value}
198
+ onChange={handleChange}
199
+ leadingElement={<Icon src={FavoriteBorder} />}
200
+ floatingLabel="What is your credit card number?"
201
+ />
202
+ </Form.Group>
203
+ </>),
204
+ securePassword: (<>
205
+ <h3>Secure password</h3>
206
+ <Form.Group>
207
+ <Form.Control
208
+ inputMask="XXX-XX-0000"
209
+ value={value}
210
+ definitions={{
211
+ X: {
212
+ mask: '0',
213
+ displayChar: 'X',
214
+ placeholderChar: '#',
215
+ },
216
+ }}
217
+ onChange={handleChange}
218
+ leadingElement={<Icon src={FavoriteBorder} />}
219
+ floatingLabel="What is your password?"
220
+ />
221
+ </Form.Group>
222
+ </>),
223
+ OTPpassword: (<>
224
+ <h3>OTP password</h3>
225
+ <Form.Group>
226
+ <Form.Control
227
+ inputMask="G-00000"
228
+ value={value}
229
+ onChange={handleChange}
230
+ leadingElement={<Icon src={FavoriteBorder} />}
231
+ floatingLabel="What is your OPT password?"
232
+ />
233
+ </Form.Group>
234
+ </>),
235
+ price: (
236
+ <>
237
+ <h3>Course priсe</h3>
238
+ <Form.Group>
239
+ <Form.Control
240
+ inputMask="$num"
241
+ blocks={{
242
+ num: {
243
+ // nested masks are available!
244
+ mask: Number,
245
+ thousandsSeparator: ' '
246
+ }
247
+ }}
248
+ value={value}
249
+ onChange={handleChange}
250
+ leadingElement={<Icon src={FavoriteBorder} />}
251
+ floatingLabel="What is the price of this course?"
252
+ />
253
+ </Form.Group>
254
+ </>
255
+ ),
256
+ };
257
+
258
+ const [value, setValue] = useState('');
259
+
260
+ const handleChange = (e) => setValue(e.target.value);
261
+
262
+ return (
263
+ <>
264
+ {/* start example form block */}
265
+ <ExamplePropsForm
266
+ inputs={[
267
+ { value: maskType, setValue: setMaskType, options: Object.keys(inputsWithMask), name: 'Mask variants' },
268
+ ]}
269
+ />
270
+ {/* end example form block */}
271
+
272
+ {inputsWithMask[maskType]}
273
+ </>
274
+ );
275
+ }
276
+ ```
277
+
278
+ ## Input masks with clear value
279
+ To get a value without a mask, you need to use `onChange` instead of `onAccept` to handle changes.
280
+
281
+ ```jsx live
282
+ () => {
283
+ const [value, setValue] = useState('');
284
+
285
+ return (
286
+ <>
287
+ <Form.Group>
288
+ <Form.Control
289
+ inputMask="+{1} (000) 000-0000"
290
+ leadingElement={<Icon src={FavoriteBorder} />}
291
+ trailingElement={<Icon src={Verified} />}
292
+ floatingLabel="What is your phone number?"
293
+ value={value}
294
+ // depending on prop above first argument is
295
+ // `value` if `unmask=false`,
296
+ // `unmaskedValue` if `unmask=true`,
297
+ // `typedValue` if `unmask='typed'`
298
+ onAccept={(_, mask) => setValue(mask._unmaskedValue)}
299
+ />
300
+ </Form.Group>
301
+ Unmasked value: {JSON.stringify(value)}
302
+ </>
303
+ );
304
+ }
305
+ ```
306
+
166
307
  ## Textarea autoResize
167
308
 
168
309
  `autoResize` prop allows input to be resized according to the content height.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useState } from 'react';
2
2
  import { render, screen } from '@testing-library/react';
3
3
  import userEvent from '@testing-library/user-event';
4
4
 
@@ -8,8 +8,27 @@ const ref = {
8
8
  current: null,
9
9
  };
10
10
 
11
+ let unmaskedInputValue;
12
+
13
+ // eslint-disable-next-line react/prop-types
14
+ function Component({ isClearValue }) {
15
+ const [inputValue, setInputValue] = useState('');
16
+ unmaskedInputValue = inputValue;
17
+
18
+ return (
19
+ <FormControl
20
+ inputMask="+{1} (000) 000-0000"
21
+ value={inputValue}
22
+ onChange={(e) => (!isClearValue ? setInputValue(e.target.value) : null)}
23
+ /* eslint-disable-next-line no-underscore-dangle */
24
+ onAccept={(_, mask) => (isClearValue ? setInputValue(mask._unmaskedValue) : null)}
25
+ data-testid="form-control-with-mask"
26
+ />
27
+ );
28
+ }
29
+
11
30
  describe('FormControl', () => {
12
- it('textarea changes its height with autoResize prop', async () => {
31
+ it('textarea changes its height with autoResize prop', () => {
13
32
  const useReferenceSpy = jest.spyOn(React, 'useRef').mockReturnValue(ref);
14
33
  const onChangeFunc = jest.fn();
15
34
  const inputText = 'new text';
@@ -26,9 +45,27 @@ describe('FormControl', () => {
26
45
  expect(useReferenceSpy).toHaveBeenCalledTimes(1);
27
46
  expect(ref.current.style.height).toBe('0px');
28
47
 
29
- await userEvent.type(textarea, inputText);
48
+ userEvent.type(textarea, inputText);
30
49
 
31
50
  expect(onChangeFunc).toHaveBeenCalledTimes(inputText.length);
32
51
  expect(ref.current.style.height).toEqual(`${ref.current.scrollHeight + ref.current.offsetHeight}px`);
33
52
  });
53
+
54
+ it('should apply and accept input mask for phone numbers', () => {
55
+ render(<Component />);
56
+
57
+ const input = screen.getByTestId('form-control-with-mask');
58
+ userEvent.type(input, '5555555555');
59
+ expect(input.value).toBe('+1 (555) 555-5555');
60
+ });
61
+
62
+ it('should be cleared from the mask elements value', () => {
63
+ render(<Component isClearValue />);
64
+
65
+ const input = screen.getByTestId('form-control-with-mask');
66
+ userEvent.type(input, '5555555555');
67
+
68
+ expect(input.value).toBe('+1 (555) 555-5555');
69
+ expect(unmaskedInputValue).toBe('15555555555');
70
+ });
34
71
  });