UNPKG

@atlaskit/onboarding

Version:

An onboarding spotlight introduces new features to users through focused messages or multi-step tours.

34 lines 1.81 kB
import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; import _createClass from "@babel/runtime/helpers/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn"; import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/inherits"; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } import React from 'react'; // This component was born from the pain of using render props in lifecycle methods. // On update, it checks whether the current value prop is equal to the previous value prop. // If they are different, it calls the onChange function. // We use this for updating Popper when the SpotlightDialog width changes. // eslint-disable-next-line @repo/internal/react/no-class-components var ValueChanged = /*#__PURE__*/function (_React$Component) { function ValueChanged() { _classCallCheck(this, ValueChanged); return _callSuper(this, ValueChanged, arguments); } _inherits(ValueChanged, _React$Component); return _createClass(ValueChanged, [{ key: "componentDidUpdate", value: function componentDidUpdate(prevProps) { if (prevProps.value !== this.props.value) { this.props.onChange(); } } }, { key: "render", value: function render() { return this.props.children; } }]); }(React.Component); export { ValueChanged as default };