@transferwise/components 46.8.0 → 46.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.
- package/build/index.esm.js +50 -72
- package/build/index.esm.js.map +1 -1
- package/build/index.js +50 -72
- package/build/index.js.map +1 -1
- package/build/types/checkboxOption/CheckboxOption.d.ts +2 -2
- package/build/types/checkboxOption/CheckboxOption.d.ts.map +1 -1
- package/build/types/index.d.ts +2 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/snackbar/Snackbar.d.ts +30 -22
- package/build/types/snackbar/Snackbar.d.ts.map +1 -1
- package/build/types/snackbar/SnackbarContext.d.ts +7 -2
- package/build/types/snackbar/SnackbarContext.d.ts.map +1 -1
- package/build/types/snackbar/SnackbarProvider.d.ts +7 -12
- package/build/types/snackbar/SnackbarProvider.d.ts.map +1 -1
- package/build/types/snackbar/index.d.ts +2 -0
- package/build/types/snackbar/index.d.ts.map +1 -0
- package/build/types/snackbar/useSnackbar.d.ts +1 -1
- package/build/types/snackbar/useSnackbar.d.ts.map +1 -1
- package/build/types/withNextPortal/withNextPortal.d.ts +1 -1
- package/build/types/withNextPortal/withNextPortal.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/checkboxOption/CheckboxOption.tsx +2 -2
- package/src/index.ts +2 -0
- package/src/snackbar/{Snackbar.story.js → Snackbar.story.tsx} +2 -1
- package/src/snackbar/{Snackbar.js → Snackbar.tsx} +31 -32
- package/src/snackbar/SnackbarContext.ts +11 -0
- package/src/snackbar/SnackbarProvider.tsx +39 -0
- package/src/withNextPortal/withNextPortal.tsx +1 -1
- package/src/snackbar/SnackbarContext.js +0 -4
- package/src/snackbar/SnackbarProvider.js +0 -51
- /package/src/snackbar/{index.js → index.ts} +0 -0
- /package/src/snackbar/{useSnackbar.js → useSnackbar.ts} +0 -0
package/build/index.js
CHANGED
|
@@ -2612,7 +2612,7 @@ const CheckboxOption = /*#__PURE__*/React.forwardRef(({
|
|
|
2612
2612
|
button: /*#__PURE__*/jsxRuntime.jsx(CheckboxButton$1, {
|
|
2613
2613
|
checked: checked,
|
|
2614
2614
|
disabled: disabled,
|
|
2615
|
-
onChange: () => onChange(!checked)
|
|
2615
|
+
onChange: () => onChange?.(!checked)
|
|
2616
2616
|
})
|
|
2617
2617
|
});
|
|
2618
2618
|
});
|
|
@@ -11181,18 +11181,19 @@ const SegmentedControl = ({
|
|
|
11181
11181
|
|
|
11182
11182
|
const CSS_TRANSITION_DURATION = 400;
|
|
11183
11183
|
class Snackbar extends React.Component {
|
|
11184
|
-
/** @type {RefObject<HTMLSpanElement>} */
|
|
11185
11184
|
bodyRef = /*#__PURE__*/React.createRef();
|
|
11186
|
-
|
|
11187
|
-
|
|
11185
|
+
timeout = 0;
|
|
11186
|
+
transitionTimeout = 0;
|
|
11187
|
+
constructor(props) {
|
|
11188
|
+
super(props);
|
|
11188
11189
|
this.state = {
|
|
11189
11190
|
visible: false,
|
|
11190
11191
|
text: ''
|
|
11191
11192
|
};
|
|
11192
11193
|
}
|
|
11193
11194
|
componentWillUnmount() {
|
|
11194
|
-
clearTimeout(this.timeout);
|
|
11195
|
-
clearTimeout(this.transitionTimeout);
|
|
11195
|
+
window.clearTimeout(this.timeout);
|
|
11196
|
+
window.clearTimeout(this.transitionTimeout);
|
|
11196
11197
|
}
|
|
11197
11198
|
shouldComponentUpdate(nextProps, nextState) {
|
|
11198
11199
|
if (!nextProps.text) {
|
|
@@ -11207,7 +11208,7 @@ class Snackbar extends React.Component {
|
|
|
11207
11208
|
const {
|
|
11208
11209
|
timeout
|
|
11209
11210
|
} = this.props;
|
|
11210
|
-
this.timeout = setTimeout(() => {
|
|
11211
|
+
this.timeout = window.setTimeout(() => {
|
|
11211
11212
|
this.setState({
|
|
11212
11213
|
visible: false
|
|
11213
11214
|
});
|
|
@@ -11230,12 +11231,12 @@ class Snackbar extends React.Component {
|
|
|
11230
11231
|
this.setLeaveTimeout();
|
|
11231
11232
|
});
|
|
11232
11233
|
} else if (previousProps.timestamp !== timestamp) {
|
|
11233
|
-
clearTimeout(this.timeout);
|
|
11234
|
+
window.clearTimeout(this.timeout);
|
|
11234
11235
|
if (this.state.visible) {
|
|
11235
11236
|
this.setState({
|
|
11236
11237
|
visible: false
|
|
11237
11238
|
}, () => {
|
|
11238
|
-
this.transitionTimeout = setTimeout(() => {
|
|
11239
|
+
this.transitionTimeout = window.setTimeout(() => {
|
|
11239
11240
|
this.setState({
|
|
11240
11241
|
visible: true,
|
|
11241
11242
|
action,
|
|
@@ -11260,7 +11261,7 @@ class Snackbar extends React.Component {
|
|
|
11260
11261
|
const {
|
|
11261
11262
|
action,
|
|
11262
11263
|
text,
|
|
11263
|
-
theme,
|
|
11264
|
+
theme = exports.Theme.LIGHT,
|
|
11264
11265
|
visible
|
|
11265
11266
|
} = this.state;
|
|
11266
11267
|
const {
|
|
@@ -11294,74 +11295,51 @@ class Snackbar extends React.Component {
|
|
|
11294
11295
|
}
|
|
11295
11296
|
}
|
|
11296
11297
|
Snackbar.contextType = DirectionContext;
|
|
11297
|
-
Snackbar.propTypes = {
|
|
11298
|
-
action: PropTypes__default.default.shape({
|
|
11299
|
-
label: PropTypes__default.default.string.isRequired,
|
|
11300
|
-
onClick: PropTypes__default.default.func
|
|
11301
|
-
}),
|
|
11302
|
-
text: PropTypes__default.default.node.isRequired,
|
|
11303
|
-
theme: PropTypes__default.default.oneOf(['light', 'dark']),
|
|
11304
|
-
timeout: PropTypes__default.default.number.isRequired,
|
|
11305
|
-
timestamp: PropTypes__default.default.number.isRequired
|
|
11306
|
-
};
|
|
11307
|
-
Snackbar.defaultProps = {
|
|
11308
|
-
action: null,
|
|
11309
|
-
theme: exports.Theme.LIGHT
|
|
11310
|
-
};
|
|
11311
11298
|
var SnackbarPortal = withNextPortalWrapper(Snackbar);
|
|
11312
11299
|
|
|
11313
|
-
const SnackbarContext = /*#__PURE__*/React.createContext(
|
|
11300
|
+
const SnackbarContext = /*#__PURE__*/React.createContext({
|
|
11301
|
+
createSnackbar: () => {}
|
|
11302
|
+
});
|
|
11314
11303
|
const SnackbarConsumer = SnackbarContext.Consumer;
|
|
11315
11304
|
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
}
|
|
11324
|
-
|
|
11305
|
+
function SnackbarProvider({
|
|
11306
|
+
timeout = 4500,
|
|
11307
|
+
children
|
|
11308
|
+
}) {
|
|
11309
|
+
const [state, setState] = React.useState({
|
|
11310
|
+
text: '',
|
|
11311
|
+
timestamp: 0
|
|
11312
|
+
});
|
|
11313
|
+
const {
|
|
11325
11314
|
action,
|
|
11326
11315
|
text,
|
|
11327
|
-
theme
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
}), this.props.children]
|
|
11354
|
-
});
|
|
11355
|
-
}
|
|
11316
|
+
theme,
|
|
11317
|
+
timestamp
|
|
11318
|
+
} = state;
|
|
11319
|
+
return /*#__PURE__*/jsxRuntime.jsxs(SnackbarContext.Provider, {
|
|
11320
|
+
value: React.useMemo(() => ({
|
|
11321
|
+
createSnackbar: ({
|
|
11322
|
+
action,
|
|
11323
|
+
text,
|
|
11324
|
+
theme
|
|
11325
|
+
}) => {
|
|
11326
|
+
setState({
|
|
11327
|
+
action,
|
|
11328
|
+
text,
|
|
11329
|
+
theme,
|
|
11330
|
+
timestamp: Date.now()
|
|
11331
|
+
});
|
|
11332
|
+
}
|
|
11333
|
+
}), []),
|
|
11334
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(SnackbarPortal, {
|
|
11335
|
+
action: action,
|
|
11336
|
+
text: text,
|
|
11337
|
+
timestamp: timestamp,
|
|
11338
|
+
timeout: timeout,
|
|
11339
|
+
theme: theme
|
|
11340
|
+
}), children]
|
|
11341
|
+
});
|
|
11356
11342
|
}
|
|
11357
|
-
SnackbarProvider.propTypes = {
|
|
11358
|
-
children: PropTypes__default.default.node.isRequired,
|
|
11359
|
-
timeout: PropTypes__default.default.number
|
|
11360
|
-
};
|
|
11361
|
-
SnackbarProvider.defaultProps = {
|
|
11362
|
-
timeout: 4500
|
|
11363
|
-
};
|
|
11364
|
-
var SnackbarProvider$1 = SnackbarProvider;
|
|
11365
11343
|
|
|
11366
11344
|
const Sticky = ({
|
|
11367
11345
|
open,
|
|
@@ -15655,7 +15633,7 @@ exports.SlidingPanel = SlidingPanel$1;
|
|
|
15655
15633
|
exports.SnackbarConsumer = SnackbarConsumer;
|
|
15656
15634
|
exports.SnackbarContext = SnackbarContext;
|
|
15657
15635
|
exports.SnackbarPortal = SnackbarPortal;
|
|
15658
|
-
exports.SnackbarProvider = SnackbarProvider
|
|
15636
|
+
exports.SnackbarProvider = SnackbarProvider;
|
|
15659
15637
|
exports.StatusIcon = StatusIcon;
|
|
15660
15638
|
exports.Stepper = Stepper;
|
|
15661
15639
|
exports.Sticky = Sticky$1;
|