@transferwise/components 46.54.1 → 46.56.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.
- package/README.md +0 -8
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs.map +1 -1
- package/build/common/panel/Panel.js +1 -2
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +1 -2
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/select/Select.js +39 -123
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +39 -119
- package/build/select/Select.mjs.map +1 -1
- package/build/snackbar/Snackbar.js +2 -1
- package/build/snackbar/Snackbar.js.map +1 -1
- package/build/snackbar/Snackbar.mjs +2 -1
- package/build/snackbar/Snackbar.mjs.map +1 -1
- package/build/types/button/Button.d.ts +2 -2
- package/build/types/button/Button.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/select/Select.d.ts +64 -94
- package/build/types/select/Select.d.ts.map +1 -1
- package/build/types/select/index.d.ts +2 -2
- package/build/types/select/index.d.ts.map +1 -1
- package/build/types/select/option/index.d.ts +1 -1
- package/build/types/select/option/index.d.ts.map +1 -1
- package/build/types/select/searchBox/index.d.ts +1 -1
- package/build/types/select/searchBox/index.d.ts.map +1 -1
- package/build/types/snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +2 -0
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +2 -0
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/package.json +3 -5
- package/src/button/Button.tsx +2 -2
- package/src/index.ts +6 -0
- package/src/select/{Select.spec.js → Select.spec.tsx} +8 -6
- package/src/select/{Select.js → Select.tsx} +135 -153
- package/src/select/index.ts +7 -0
- package/src/snackbar/Snackbar.tsx +7 -1
- package/src/upload/Upload.story.tsx +1 -0
- package/src/upload/steps/uploadImageStep/uploadImageStep.tsx +5 -1
- package/build/select/index.js +0 -8
- package/build/select/index.js.map +0 -1
- package/build/select/index.mjs +0 -6
- package/build/select/index.mjs.map +0 -1
- package/src/select/index.js +0 -3
- /package/src/select/option/{index.js → index.ts} +0 -0
- /package/src/select/searchBox/{SearchBox.spec.js → SearchBox.spec.tsx} +0 -0
- /package/src/select/searchBox/{index.js → index.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadImageStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/uploadImageStep/uploadImageStep.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,aAAa,EAAE,MAAM,OAAO,CAAC;AAKjD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC9E,cAAc,8CAAiC;IAE/C,cAAc,aAMZ;IAEF,QAAQ,0FAyBN;IAEF,MAAM;
|
|
1
|
+
{"version":3,"file":"uploadImageStep.d.ts","sourceRoot":"","sources":["../../../../../src/upload/steps/uploadImageStep/uploadImageStep.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,aAAa,EAAE,MAAM,OAAO,CAAC;AAKjD,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,aAAa,CAAC,oBAAoB,CAAC;IAC9E,cAAc,8CAAiC;IAE/C,cAAc,aAMZ;IAEF,QAAQ,0FAyBN;IAEF,MAAM;CAyCP"}
|
|
@@ -79,6 +79,8 @@ class UploadImageStep extends React.PureComponent {
|
|
|
79
79
|
children: String(usPlaceholder)
|
|
80
80
|
}), /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
81
81
|
className: `btn btn-primary btn-md ${usDisabled ? 'disabled' : ''}`,
|
|
82
|
+
role: "button",
|
|
83
|
+
"aria-disabled": usDisabled,
|
|
82
84
|
children: [usButtonText ? /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
83
85
|
children: usButtonText
|
|
84
86
|
}) : /*#__PURE__*/jsxRuntime.jsx(icons.Upload, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadImageStep.js","sources":["../../../../src/upload/steps/uploadImageStep/uploadImageStep.tsx"],"sourcesContent":["import { Upload as UploadIcon } from '@transferwise/icons';\nimport { createRef, PureComponent } from 'react';\nimport StatusIcon from '../../../statusIcon';\nimport { Sentiment, Size } from '../../../common';\nimport InlineAlert from '../../../inlineAlert';\n\nexport interface UploadImageStepProps {\n fileDropped: (file: File) => void;\n isComplete: boolean;\n usAccept: string;\n usButtonText: string;\n usDisabled: boolean;\n usHelpImage: React.ReactNode;\n usLabel: string;\n usPlaceholder: string;\n errorMessage?: string | string[];\n}\n\nexport default class UploadImageStep extends PureComponent<UploadImageStepProps> {\n uploadInputRef = createRef<HTMLInputElement>();\n\n onManualUpload = () => {\n const { fileDropped } = this.props;\n const file = this.uploadInputRef.current?.files?.[0];\n if (file != null) {\n fileDropped(file);\n }\n };\n\n getImage = () => {\n const { usHelpImage, usLabel } = this.props;\n const { errorMessage } = this.props;\n\n if (errorMessage) {\n return (\n <div className=\"d-flex flex-column align-items-center\">\n <StatusIcon size={Size.LARGE} sentiment={Sentiment.NEGATIVE} />\n </div>\n );\n }\n\n if (!usHelpImage) {\n return (\n <div className=\"circle circle-sm circle-inverse p-t-1\">\n <UploadIcon size={24} />\n </div>\n );\n }\n\n if (typeof usHelpImage === 'string') {\n return <img src={usHelpImage} alt={usLabel} className=\"thumbnail text-xs-center\" />;\n }\n\n return usHelpImage;\n };\n\n render() {\n const { isComplete, usAccept, usButtonText, usDisabled, usLabel, usPlaceholder, errorMessage } =\n this.props;\n\n return (\n <div className=\"droppable-default-card\" aria-hidden={isComplete}>\n <div className=\"droppable-card-content\">\n <div className=\"m-b-3\">{this.getImage()}</div>\n {usLabel && <h4 className=\"np-text-title-body m-b-1\">{usLabel}</h4>}\n {usPlaceholder && <p className=\"np-text-body-large m-b-3\">{String(usPlaceholder)}</p>}\n <label
|
|
1
|
+
{"version":3,"file":"uploadImageStep.js","sources":["../../../../src/upload/steps/uploadImageStep/uploadImageStep.tsx"],"sourcesContent":["import { Upload as UploadIcon } from '@transferwise/icons';\nimport { createRef, PureComponent } from 'react';\nimport StatusIcon from '../../../statusIcon';\nimport { Sentiment, Size } from '../../../common';\nimport InlineAlert from '../../../inlineAlert';\n\nexport interface UploadImageStepProps {\n fileDropped: (file: File) => void;\n isComplete: boolean;\n usAccept: string;\n usButtonText: string;\n usDisabled: boolean;\n usHelpImage: React.ReactNode;\n usLabel: string;\n usPlaceholder: string;\n errorMessage?: string | string[];\n}\n\nexport default class UploadImageStep extends PureComponent<UploadImageStepProps> {\n uploadInputRef = createRef<HTMLInputElement>();\n\n onManualUpload = () => {\n const { fileDropped } = this.props;\n const file = this.uploadInputRef.current?.files?.[0];\n if (file != null) {\n fileDropped(file);\n }\n };\n\n getImage = () => {\n const { usHelpImage, usLabel } = this.props;\n const { errorMessage } = this.props;\n\n if (errorMessage) {\n return (\n <div className=\"d-flex flex-column align-items-center\">\n <StatusIcon size={Size.LARGE} sentiment={Sentiment.NEGATIVE} />\n </div>\n );\n }\n\n if (!usHelpImage) {\n return (\n <div className=\"circle circle-sm circle-inverse p-t-1\">\n <UploadIcon size={24} />\n </div>\n );\n }\n\n if (typeof usHelpImage === 'string') {\n return <img src={usHelpImage} alt={usLabel} className=\"thumbnail text-xs-center\" />;\n }\n\n return usHelpImage;\n };\n\n render() {\n const { isComplete, usAccept, usButtonText, usDisabled, usLabel, usPlaceholder, errorMessage } =\n this.props;\n\n return (\n <div className=\"droppable-default-card\" aria-hidden={isComplete}>\n <div className=\"droppable-card-content\">\n <div className=\"m-b-3\">{this.getImage()}</div>\n {usLabel && <h4 className=\"np-text-title-body m-b-1\">{usLabel}</h4>}\n {usPlaceholder && <p className=\"np-text-body-large m-b-3\">{String(usPlaceholder)}</p>}\n <label\n className={`btn btn-primary btn-md ${usDisabled ? 'disabled' : ''}`}\n role=\"button\"\n aria-disabled={usDisabled}\n >\n {usButtonText ? (\n <span>{usButtonText}</span>\n ) : (\n <UploadIcon size={24} className=\"m-r-0\" />\n )}\n <input\n ref={this.uploadInputRef}\n type=\"file\"\n accept={usAccept === '*' ? undefined : usAccept}\n className=\"tw-droppable-input hidden\"\n disabled={usDisabled}\n name=\"file-upload\"\n onChange={() => this.onManualUpload()}\n />\n </label>\n {errorMessage && (\n <div className=\"upload-error-message\">\n <div className=\"m-t-3 has-error\">\n <InlineAlert type={Sentiment.NEGATIVE}>{errorMessage}</InlineAlert>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n"],"names":["UploadImageStep","PureComponent","uploadInputRef","createRef","onManualUpload","fileDropped","props","file","current","files","getImage","usHelpImage","usLabel","errorMessage","_jsx","className","children","StatusIcon","size","Size","LARGE","sentiment","Sentiment","NEGATIVE","UploadIcon","src","alt","render","isComplete","usAccept","usButtonText","usDisabled","usPlaceholder","_jsxs","String","role","ref","type","accept","undefined","disabled","name","onChange","InlineAlert"],"mappings":";;;;;;;;;;AAkBqB,MAAAA,eAAgB,SAAQC,mBAAmC,CAAA;EAC9EC,cAAc,gBAAGC,eAAS,EAAoB,CAAA;EAE9CC,cAAc,GAAGA,MAAK;IACpB,MAAM;AAAEC,MAAAA,WAAAA;KAAa,GAAG,IAAI,CAACC,KAAK,CAAA;IAClC,MAAMC,IAAI,GAAG,IAAI,CAACL,cAAc,CAACM,OAAO,EAAEC,KAAK,GAAG,CAAC,CAAC,CAAA;IACpD,IAAIF,IAAI,IAAI,IAAI,EAAE;MAChBF,WAAW,CAACE,IAAI,CAAC,CAAA;AACnB,KAAA;GACD,CAAA;EAEDG,QAAQ,GAAGA,MAAK;IACd,MAAM;MAAEC,WAAW;AAAEC,MAAAA,OAAAA;KAAS,GAAG,IAAI,CAACN,KAAK,CAAA;IAC3C,MAAM;AAAEO,MAAAA,YAAAA;KAAc,GAAG,IAAI,CAACP,KAAK,CAAA;AAEnC,IAAA,IAAIO,YAAY,EAAE;AAChB,MAAA,oBACEC,cAAA,CAAA,KAAA,EAAA;AAAKC,QAAAA,SAAS,EAAC,uCAAuC;QAAAC,QAAA,eACpDF,cAAA,CAACG,UAAU,EAAA;UAACC,IAAI,EAAEC,SAAI,CAACC,KAAM;UAACC,SAAS,EAAEC,mBAAS,CAACC,QAAAA;SACrD,CAAA;AAAA,OAAK,CAAC,CAAA;AAEV,KAAA;IAEA,IAAI,CAACZ,WAAW,EAAE;AAChB,MAAA,oBACEG,cAAA,CAAA,KAAA,EAAA;AAAKC,QAAAA,SAAS,EAAC,uCAAuC;QAAAC,QAAA,eACpDF,cAAA,CAACU,YAAU,EAAA;AAACN,UAAAA,IAAI,EAAE,EAAA;SACpB,CAAA;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AAE,CAAG,CAAA;AACpEI,UAAAA,IAAI,EAAC,QAAQ;AACb,UAAA,eAAA,EAAeJ,UAAW;UAAAf,QAAA,EAAA,CAEzBc,YAAY,gBACXhB,cAAA,CAAA,MAAA,EAAA;AAAAE,YAAAA,QAAA,EAAOc,YAAAA;AAAY,WAAO,CAAC,gBAE3BhB,cAAA,CAACU,YAAU,EAAA;AAACN,YAAAA,IAAI,EAAE,EAAG;AAACH,YAAAA,SAAS,EAAC,OAAA;WAAO,CACxC,eACDD,cAAA,CAAA,OAAA,EAAA;YACEsB,GAAG,EAAE,IAAI,CAAClC,cAAe;AACzBmC,YAAAA,IAAI,EAAC,MAAM;AACXC,YAAAA,MAAM,EAAET,QAAQ,KAAK,GAAG,GAAGU,SAAS,GAAGV,QAAS;AAChDd,YAAAA,SAAS,EAAC,2BAA2B;AACrCyB,YAAAA,QAAQ,EAAET,UAAW;AACrBU,YAAAA,IAAI,EAAC,aAAa;AAClBC,YAAAA,QAAQ,EAAEA,MAAM,IAAI,CAACtC,cAAc,EAAE;AAAC,WAE1C,CAAA,CAAA;AAAA,SAAO,CACP,EAACS,YAAY,iBACXC,cAAA,CAAA,KAAA,EAAA;AAAKC,UAAAA,SAAS,EAAC,sBAAsB;AAAAC,UAAAA,QAAA,eACnCF,cAAA,CAAA,KAAA,EAAA;AAAKC,YAAAA,SAAS,EAAC,iBAAiB;YAAAC,QAAA,eAC9BF,cAAA,CAAC6B,WAAW,EAAA;cAACN,IAAI,EAAEf,mBAAS,CAACC,QAAS;AAAAP,cAAAA,QAAA,EAAEH,YAAAA;aAA0B,CAAA;WAC/D,CAAA;AACP,SAAK,CACN,CAAA;OACE,CAAA;AACP,KAAK,CAAC,CAAA;AAEV,GAAA;AACD;;;;"}
|
|
@@ -77,6 +77,8 @@ class UploadImageStep extends PureComponent {
|
|
|
77
77
|
children: String(usPlaceholder)
|
|
78
78
|
}), /*#__PURE__*/jsxs("label", {
|
|
79
79
|
className: `btn btn-primary btn-md ${usDisabled ? 'disabled' : ''}`,
|
|
80
|
+
role: "button",
|
|
81
|
+
"aria-disabled": usDisabled,
|
|
80
82
|
children: [usButtonText ? /*#__PURE__*/jsx("span", {
|
|
81
83
|
children: usButtonText
|
|
82
84
|
}) : /*#__PURE__*/jsx(Upload, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadImageStep.mjs","sources":["../../../../src/upload/steps/uploadImageStep/uploadImageStep.tsx"],"sourcesContent":["import { Upload as UploadIcon } from '@transferwise/icons';\nimport { createRef, PureComponent } from 'react';\nimport StatusIcon from '../../../statusIcon';\nimport { Sentiment, Size } from '../../../common';\nimport InlineAlert from '../../../inlineAlert';\n\nexport interface UploadImageStepProps {\n fileDropped: (file: File) => void;\n isComplete: boolean;\n usAccept: string;\n usButtonText: string;\n usDisabled: boolean;\n usHelpImage: React.ReactNode;\n usLabel: string;\n usPlaceholder: string;\n errorMessage?: string | string[];\n}\n\nexport default class UploadImageStep extends PureComponent<UploadImageStepProps> {\n uploadInputRef = createRef<HTMLInputElement>();\n\n onManualUpload = () => {\n const { fileDropped } = this.props;\n const file = this.uploadInputRef.current?.files?.[0];\n if (file != null) {\n fileDropped(file);\n }\n };\n\n getImage = () => {\n const { usHelpImage, usLabel } = this.props;\n const { errorMessage } = this.props;\n\n if (errorMessage) {\n return (\n <div className=\"d-flex flex-column align-items-center\">\n <StatusIcon size={Size.LARGE} sentiment={Sentiment.NEGATIVE} />\n </div>\n );\n }\n\n if (!usHelpImage) {\n return (\n <div className=\"circle circle-sm circle-inverse p-t-1\">\n <UploadIcon size={24} />\n </div>\n );\n }\n\n if (typeof usHelpImage === 'string') {\n return <img src={usHelpImage} alt={usLabel} className=\"thumbnail text-xs-center\" />;\n }\n\n return usHelpImage;\n };\n\n render() {\n const { isComplete, usAccept, usButtonText, usDisabled, usLabel, usPlaceholder, errorMessage } =\n this.props;\n\n return (\n <div className=\"droppable-default-card\" aria-hidden={isComplete}>\n <div className=\"droppable-card-content\">\n <div className=\"m-b-3\">{this.getImage()}</div>\n {usLabel && <h4 className=\"np-text-title-body m-b-1\">{usLabel}</h4>}\n {usPlaceholder && <p className=\"np-text-body-large m-b-3\">{String(usPlaceholder)}</p>}\n <label
|
|
1
|
+
{"version":3,"file":"uploadImageStep.mjs","sources":["../../../../src/upload/steps/uploadImageStep/uploadImageStep.tsx"],"sourcesContent":["import { Upload as UploadIcon } from '@transferwise/icons';\nimport { createRef, PureComponent } from 'react';\nimport StatusIcon from '../../../statusIcon';\nimport { Sentiment, Size } from '../../../common';\nimport InlineAlert from '../../../inlineAlert';\n\nexport interface UploadImageStepProps {\n fileDropped: (file: File) => void;\n isComplete: boolean;\n usAccept: string;\n usButtonText: string;\n usDisabled: boolean;\n usHelpImage: React.ReactNode;\n usLabel: string;\n usPlaceholder: string;\n errorMessage?: string | string[];\n}\n\nexport default class UploadImageStep extends PureComponent<UploadImageStepProps> {\n uploadInputRef = createRef<HTMLInputElement>();\n\n onManualUpload = () => {\n const { fileDropped } = this.props;\n const file = this.uploadInputRef.current?.files?.[0];\n if (file != null) {\n fileDropped(file);\n }\n };\n\n getImage = () => {\n const { usHelpImage, usLabel } = this.props;\n const { errorMessage } = this.props;\n\n if (errorMessage) {\n return (\n <div className=\"d-flex flex-column align-items-center\">\n <StatusIcon size={Size.LARGE} sentiment={Sentiment.NEGATIVE} />\n </div>\n );\n }\n\n if (!usHelpImage) {\n return (\n <div className=\"circle circle-sm circle-inverse p-t-1\">\n <UploadIcon size={24} />\n </div>\n );\n }\n\n if (typeof usHelpImage === 'string') {\n return <img src={usHelpImage} alt={usLabel} className=\"thumbnail text-xs-center\" />;\n }\n\n return usHelpImage;\n };\n\n render() {\n const { isComplete, usAccept, usButtonText, usDisabled, usLabel, usPlaceholder, errorMessage } =\n this.props;\n\n return (\n <div className=\"droppable-default-card\" aria-hidden={isComplete}>\n <div className=\"droppable-card-content\">\n <div className=\"m-b-3\">{this.getImage()}</div>\n {usLabel && <h4 className=\"np-text-title-body m-b-1\">{usLabel}</h4>}\n {usPlaceholder && <p className=\"np-text-body-large m-b-3\">{String(usPlaceholder)}</p>}\n <label\n className={`btn btn-primary btn-md ${usDisabled ? 'disabled' : ''}`}\n role=\"button\"\n aria-disabled={usDisabled}\n >\n {usButtonText ? (\n <span>{usButtonText}</span>\n ) : (\n <UploadIcon size={24} className=\"m-r-0\" />\n )}\n <input\n ref={this.uploadInputRef}\n type=\"file\"\n accept={usAccept === '*' ? undefined : usAccept}\n className=\"tw-droppable-input hidden\"\n disabled={usDisabled}\n name=\"file-upload\"\n onChange={() => this.onManualUpload()}\n />\n </label>\n {errorMessage && (\n <div className=\"upload-error-message\">\n <div className=\"m-t-3 has-error\">\n <InlineAlert type={Sentiment.NEGATIVE}>{errorMessage}</InlineAlert>\n </div>\n </div>\n )}\n </div>\n </div>\n );\n }\n}\n"],"names":["UploadImageStep","PureComponent","uploadInputRef","createRef","onManualUpload","fileDropped","props","file","current","files","getImage","usHelpImage","usLabel","errorMessage","_jsx","className","children","StatusIcon","size","Size","LARGE","sentiment","Sentiment","NEGATIVE","UploadIcon","src","alt","render","isComplete","usAccept","usButtonText","usDisabled","usPlaceholder","_jsxs","String","role","ref","type","accept","undefined","disabled","name","onChange","InlineAlert"],"mappings":";;;;;;;;AAkBqB,MAAAA,eAAgB,SAAQC,aAAmC,CAAA;EAC9EC,cAAc,gBAAGC,SAAS,EAAoB,CAAA;EAE9CC,cAAc,GAAGA,MAAK;IACpB,MAAM;AAAEC,MAAAA,WAAAA;KAAa,GAAG,IAAI,CAACC,KAAK,CAAA;IAClC,MAAMC,IAAI,GAAG,IAAI,CAACL,cAAc,CAACM,OAAO,EAAEC,KAAK,GAAG,CAAC,CAAC,CAAA;IACpD,IAAIF,IAAI,IAAI,IAAI,EAAE;MAChBF,WAAW,CAACE,IAAI,CAAC,CAAA;AACnB,KAAA;GACD,CAAA;EAEDG,QAAQ,GAAGA,MAAK;IACd,MAAM;MAAEC,WAAW;AAAEC,MAAAA,OAAAA;KAAS,GAAG,I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AA,CAAA;AAAA,SAAO,CACP,EAACS,YAAY,iBACXC,GAAA,CAAA,KAAA,EAAA;AAAKC,UAAAA,SAAS,EAAC,sBAAsB;AAAAC,UAAAA,QAAA,eACnCF,GAAA,CAAA,KAAA,EAAA;AAAKC,YAAAA,SAAS,EAAC,iBAAiB;YAAAC,QAAA,eAC9BF,GAAA,CAAC6B,WAAW,EAAA;cAACN,IAAI,EAAEf,SAAS,CAACC,QAAS;AAAAP,cAAAA,QAAA,EAAEH,YAAAA;aAA0B,CAAA;WAC/D,CAAA;AACP,SAAK,CACN,CAAA;OACE,CAAA;AACP,KAAK,CAAC,CAAA;AAEV,GAAA;AACD;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transferwise/components",
|
|
3
|
-
"version": "46.
|
|
3
|
+
"version": "46.56.0",
|
|
4
4
|
"description": "Neptune React components",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"rollup-preserve-directives": "^1.1.1",
|
|
94
94
|
"storybook": "^8.2.2",
|
|
95
95
|
"@transferwise/less-config": "3.1.0",
|
|
96
|
-
"@
|
|
97
|
-
"@
|
|
96
|
+
"@wise/components-theming": "1.5.0",
|
|
97
|
+
"@transferwise/neptune-css": "14.13.2"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
100
100
|
"@transferwise/icons": "^3.7.0",
|
|
@@ -123,7 +123,6 @@
|
|
|
123
123
|
"lodash.debounce": "^4.0.8",
|
|
124
124
|
"lodash.topairs": "^4.3.0",
|
|
125
125
|
"merge-props": "^6.0.0",
|
|
126
|
-
"prop-types": "^15.8.1",
|
|
127
126
|
"react-popper": "^2.3.0",
|
|
128
127
|
"react-transition-group": "^4.4.5",
|
|
129
128
|
"virtua": "^0.33.3"
|
|
@@ -142,7 +141,6 @@
|
|
|
142
141
|
"build:clean": "rm -rf lib build",
|
|
143
142
|
"build:crowdin-source-file": "formatjs extract 'src/**/*.messages.+(js|ts|tsx)' --out-file src/i18n/en.json --format simple && prettier --write src/i18n/*.json",
|
|
144
143
|
"build:js": "rollup --config --sourcemap",
|
|
145
|
-
"build:generate-types": "node ./scripts/generate-type-declarations.js",
|
|
146
144
|
"build:copy-files": "cpx 'src/**/!(db)/*.{json,svg}' build",
|
|
147
145
|
"build:copy-css": "cpx 'src/main.css' build/ & cpx 'src/**/*.css' build/styles/",
|
|
148
146
|
"build:copy-lang": "cpx 'src/i18n/*.json' build/i18n && cpx 'src/i18n/index.js' build/i18n",
|
package/src/button/Button.tsx
CHANGED
|
@@ -33,8 +33,8 @@ type CommonProps = {
|
|
|
33
33
|
block?: boolean;
|
|
34
34
|
disabled?: boolean;
|
|
35
35
|
loading?: boolean;
|
|
36
|
-
type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes;
|
|
37
|
-
priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary;
|
|
36
|
+
type?: ControlTypeAccent | ControlTypeNegative | ControlTypePositive | DeprecatedTypes | null;
|
|
37
|
+
priority?: PriorityPrimary | PrioritySecondary | PriorityTertiary | null;
|
|
38
38
|
size?: SizeSmall | SizeMedium | SizeLarge | DeprecatedSizes;
|
|
39
39
|
};
|
|
40
40
|
|
package/src/index.ts
CHANGED
|
@@ -67,6 +67,12 @@ export type { RadioProps } from './radio';
|
|
|
67
67
|
export type { RadioGroupProps, RadioGroupRadio } from './radioGroup';
|
|
68
68
|
export type { RadioOptionProps } from './radioOption';
|
|
69
69
|
export type { SegmentedControlProps } from './segmentedControl';
|
|
70
|
+
export type {
|
|
71
|
+
SelectItem,
|
|
72
|
+
SelectItemWithPlaceholder,
|
|
73
|
+
SelectOptionItem,
|
|
74
|
+
SelectProps,
|
|
75
|
+
} from './select';
|
|
70
76
|
export type { SlidingPanelProps } from './slidingPanel';
|
|
71
77
|
export type { SnackbarProps } from './snackbar/Snackbar';
|
|
72
78
|
export type { SnackbarContextType } from './snackbar/SnackbarContext';
|
|
@@ -2,6 +2,7 @@ import { Breakpoint } from '../common';
|
|
|
2
2
|
import { render, screen, userEvent, waitFor, mockMatchMedia } from '../test-utils';
|
|
3
3
|
|
|
4
4
|
import Select from '.';
|
|
5
|
+
import { SelectItemWithPlaceholder } from './Select';
|
|
5
6
|
|
|
6
7
|
mockMatchMedia();
|
|
7
8
|
|
|
@@ -42,7 +43,7 @@ describe('Select', () => {
|
|
|
42
43
|
global.requestAnimationFrame = originalRAF;
|
|
43
44
|
});
|
|
44
45
|
|
|
45
|
-
const openSelect = async (container) => {
|
|
46
|
+
const openSelect = async (container: HTMLElement) => {
|
|
46
47
|
const button = screen.getByRole('button');
|
|
47
48
|
await userEvent.click(button);
|
|
48
49
|
};
|
|
@@ -81,7 +82,7 @@ describe('Select', () => {
|
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
describe('when options contain searchables', () => {
|
|
84
|
-
let input;
|
|
85
|
+
let input: HTMLElement;
|
|
85
86
|
|
|
86
87
|
const searchableOptions = [
|
|
87
88
|
{
|
|
@@ -207,8 +208,8 @@ describe('Select', () => {
|
|
|
207
208
|
container.querySelector('.np-dropdown-item'),
|
|
208
209
|
);
|
|
209
210
|
expect(
|
|
210
|
-
screen.getByText('Hungarian forint').parentElement
|
|
211
|
-
|
|
211
|
+
screen.getByText('Hungarian forint').parentElement?.parentElement?.parentElement
|
|
212
|
+
?.parentElement,
|
|
212
213
|
).toHaveClass('np-dropdown-item clickable np-dropdown-item--focused');
|
|
213
214
|
});
|
|
214
215
|
|
|
@@ -231,7 +232,7 @@ describe('Select', () => {
|
|
|
231
232
|
expect(container.querySelector('.np-dropdown-item.np-dropdown-item--focused')).toStrictEqual(
|
|
232
233
|
container.querySelector('.np-dropdown-item'),
|
|
233
234
|
);
|
|
234
|
-
expect(screen.getByText('Estonia').parentElement
|
|
235
|
+
expect(screen.getByText('Estonia').parentElement?.parentElement).toHaveClass(
|
|
235
236
|
'np-dropdown-item clickable np-dropdown-item--focused',
|
|
236
237
|
);
|
|
237
238
|
});
|
|
@@ -247,7 +248,8 @@ describe('Select', () => {
|
|
|
247
248
|
});
|
|
248
249
|
|
|
249
250
|
it('should filter the options with a custom search function with 3 results', async () => {
|
|
250
|
-
const searchFunction = (option, searchValue) =>
|
|
251
|
+
const searchFunction = (option: SelectItemWithPlaceholder, searchValue: string) =>
|
|
252
|
+
typeof option.label === 'string' && option.label.includes(searchValue);
|
|
251
253
|
const { container } = render(<Select {...props} search={searchFunction} />);
|
|
252
254
|
await openSelect(container);
|
|
253
255
|
|