@openedx/paragon 21.13.0 → 21.13.1
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.
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import Form
|
|
4
|
-
import Input from '../../Input';
|
|
3
|
+
import Form from '../../Form';
|
|
5
4
|
import { newId } from '../../utils';
|
|
6
5
|
var formatHeaderForLabel = function formatHeaderForLabel(header) {
|
|
7
6
|
if (typeof header === 'function') {
|
|
@@ -21,11 +20,11 @@ function TextFilter(_ref) {
|
|
|
21
20
|
var ariaLabel = useRef(newId("text-filter-label-".concat(getHeaderProps().key, "-")));
|
|
22
21
|
var formattedHeader = formatHeaderForLabel(Header);
|
|
23
22
|
var inputText = /*#__PURE__*/React.isValidElement(formattedHeader) ? formattedHeader : "Search ".concat(formattedHeader);
|
|
24
|
-
return /*#__PURE__*/React.createElement(Form.Group,
|
|
25
|
-
|
|
23
|
+
return /*#__PURE__*/React.createElement(Form.Group, {
|
|
24
|
+
controlId: ariaLabel.current
|
|
25
|
+
}, /*#__PURE__*/React.createElement(Form.Label, {
|
|
26
26
|
className: "sr-only"
|
|
27
|
-
}, inputText), /*#__PURE__*/React.createElement(
|
|
28
|
-
"aria-labelledby": ariaLabel.current,
|
|
27
|
+
}, inputText), /*#__PURE__*/React.createElement(Form.Control, {
|
|
29
28
|
value: filterValue || '',
|
|
30
29
|
type: "text",
|
|
31
30
|
onChange: function onChange(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextFilter.js","names":["React","useRef","PropTypes","Form","
|
|
1
|
+
{"version":3,"file":"TextFilter.js","names":["React","useRef","PropTypes","Form","newId","formatHeaderForLabel","header","toLowerCase","TextFilter","_ref","_ref$column","column","filterValue","setFilter","Header","getHeaderProps","ariaLabel","concat","key","formattedHeader","inputText","isValidElement","createElement","Group","controlId","current","Label","className","Control","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 from '../../Form';\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 controlId={ariaLabel.current}>\n <Form.Label className=\"sr-only\">{inputText}</Form.Label>\n <Form.Control\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,MAAM,YAAY;AAC7B,SAASC,KAAK,QAAQ,aAAa;AAEnC,IAAMC,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAIC,MAAM,EAAK;EACvC,IAAI,OAAOA,MAAM,KAAK,U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B,SAAS,GAAG;EACrB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEzB,MAAM,EAAET,SAAS,CAACmC,KAAK,CAAC;IACtBxB,SAAS,EAAEX,SAAS,CAACoC,IAAI,CAACC,UAAU;IACpCzB,MAAM,EAAEZ,SAAS,CAACsC,SAAS,CAAC,CAACtC,SAAS,CAACuC,WAAW,EAAEvC,SAAS,CAACwC,IAAI,CAAC,CAAC,CAACH,UAAU;IAC/ExB,cAAc,EAAEb,SAAS,CAACoC,IAAI,CAACC,UAAU;IACzC3B,WAAW,EAAEV,SAAS,CAACyC;EACzB,CAAC,CAAC,CAACJ;AACL,CAAC;AAED,eAAe/B,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import Form
|
|
4
|
-
import Input from '../../Input';
|
|
3
|
+
import Form from '../../Form';
|
|
5
4
|
import { newId } from '../../utils';
|
|
6
5
|
|
|
7
6
|
const formatHeaderForLabel = (header) => {
|
|
@@ -23,10 +22,9 @@ function TextFilter({
|
|
|
23
22
|
const formattedHeader = formatHeaderForLabel(Header);
|
|
24
23
|
const inputText = React.isValidElement(formattedHeader) ? formattedHeader : `Search ${formattedHeader}`;
|
|
25
24
|
return (
|
|
26
|
-
<Form.Group>
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
aria-labelledby={ariaLabel.current}
|
|
25
|
+
<Form.Group controlId={ariaLabel.current}>
|
|
26
|
+
<Form.Label className="sr-only">{inputText}</Form.Label>
|
|
27
|
+
<Form.Control
|
|
30
28
|
value={filterValue || ''}
|
|
31
29
|
type="text"
|
|
32
30
|
onChange={e => {
|