"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = exports.RegressionValueIsPositiveButRoundedValueIs0 = exports.Regression0ShouldBe0 = exports.NumberWithSign = exports.NumberWithPercentage = exports.NumberWithMinMaxDigits = exports.NumberWithCurrencyAsDifferentSize = exports.NumberWithCurrency = exports.NumberWith2Decimals = exports.NumberTicks = exports.NullCurrency = exports.MaskValue = exports.InvalidValue = exports.IntegrationWithDifferentTypographies = exports.Documentation = exports.Default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactMarkdown = _interopRequireDefault(require("react-markdown"));
var _reactIntl = require("react-intl");
var _ = require("../..");
var _Number = _interopRequireDefault(require("./Number.md"));
var _Display = require("../../common/Display");
var _Typography = require("../../Atoms/Typography/Typography");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = exports.default = {
  title: 'Molecules / Number',
  parameters: {
    component: _.Number
  }
};
var Documentation = exports.Documentation = function Documentation() {
  return _react.default.createElement(_reactIntl.IntlProvider, {
    locale: "en"
  }, _react.default.createElement(_.Typography, null, _react.default.createElement(_reactMarkdown.default, null, _Number.default), _react.default.createElement("div", null, _react.default.createElement(_.Number, {
    value: 1000000
  })), _react.default.createElement("div", null, _react.default.createElement(_.Number, {
    value: 3400,
    currency: "SEK"
  }))));
};
var Default = exports.Default = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_Display.Display, {
      items: [{
        title: 'value = 1000',
        component: _react.default.createElement(_.Number, {
          value: 1000
        })
      }, {
        title: 'value = 9000000',
        component: _react.default.createElement(_.Number, {
          value: 9000000
        })
      }, {
        title: 'value = 0.01',
        component: _react.default.createElement(_.Number, {
          value: 0.01
        })
      }, {
        title: 'value = 111.2',
        component: _react.default.createElement(_.Number, {
          value: 111.2
        })
      }]
    }));
  }
};
var NumberWith2Decimals = exports.NumberWith2Decimals = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_Display.Display, {
      items: [{
        title: 'value = 10.378',
        component: _react.default.createElement(_.Number, {
          value: 10.378,
          decimals: 2
        })
      }, {
        title: 'value = 10.333',
        component: _react.default.createElement(_.Number, {
          value: 10.333,
          decimals: 2
        })
      }, {
        title: 'value = 10',
        component: _react.default.createElement(_.Number, {
          value: 10,
          decimals: 2
        })
      }, {
        title: 'value = 10.5',
        component: _react.default.createElement(_.Number, {
          value: 10.5,
          decimals: 2
        })
      }]
    }));
  }
};
var NumberWithMinMaxDigits = exports.NumberWithMinMaxDigits = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_.Number, {
      value: 10.378,
      maximumDecimals: 2
    }), _react.default.createElement(_.Number, {
      value: 10.1,
      minimumDecimals: 2
    }), _react.default.createElement(_.Number, {
      value: 10.333,
      minimumDecimals: 2,
      maximumDecimals: 4
    }), _react.default.createElement(_.Number, {
      value: 10.1,
      minimumDecimals: 2,
      maximumDecimals: 4
    }), _react.default.createElement(_.Number, {
      value: 10.66666,
      minimumDecimals: 2,
      maximumDecimals: 4
    }), _react.default.createElement(_.Number, {
      value: 10,
      minimumDecimals: 2,
      maximumDecimals: 4
    }));
  },
  name: 'Number with min/max digits'
};
var NumberTicks = exports.NumberTicks = {
  render: function render() {
    var ticks = [{
      decimals: 4,
      fromPrice: 0,
      toPrice: 0.9999,
      tick: 0.0001
    }, {
      decimals: 2,
      fromPrice: 1,
      toPrice: 99999.98,
      tick: 0.01
    }, {
      decimals: 1,
      fromPrice: 100000,
      toPrice: 999999.89,
      tick: 0.1
    }];
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement("pre", null, "ticks = ".concat(JSON.stringify(ticks, null, 2))), _react.default.createElement(_Display.Display, {
      items: [{
        title: 'value = 0.55555',
        component: _react.default.createElement(_.Number, {
          value: 0.55555,
          ticks: ticks
        })
      }, {
        title: 'value = 10.333',
        component: _react.default.createElement(_.Number, {
          value: 10.333,
          ticks: ticks
        })
      }, {
        title: 'value = 10.5',
        component: _react.default.createElement(_.Number, {
          value: 10.5,
          ticks: ticks
        })
      }, {
        title: 'value = 100001.22',
        component: _react.default.createElement(_.Number, {
          value: 100001.22,
          ticks: ticks
        })
      }]
    }));
  }
};
var NumberWithPercentage = exports.NumberWithPercentage = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_.Number, {
      value: 2.3,
      percentage: true
    }));
  }
};
var NumberWithCurrency = exports.NumberWithCurrency = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_.Number, {
      value: 2.3,
      currency: "SEK"
    }));
  }
};
var NumberWithCurrencyAsDifferentSize = exports.NumberWithCurrencyAsDifferentSize = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_.Typography, {
      type: "title2",
      as: "div"
    }, _react.default.createElement(_.Number, {
      value: 2.3,
      currency: "SEK",
      currencySize: "title3"
    })), _react.default.createElement(_.Typography, {
      type: "primary",
      weight: "bold",
      as: "div"
    }, _react.default.createElement(_.Number, {
      value: 2.3,
      currency: "SEK",
      currencySize: "secondary"
    })));
  }
};
var NumberWithSign = exports.NumberWithSign = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_Display.Display, {
      items: [{
        title: 'value = 2',
        component: _react.default.createElement(_.Number, {
          value: 2,
          sign: true
        })
      }, {
        title: 'value = 0',
        component: _react.default.createElement(_.Number, {
          value: 0,
          sign: true
        })
      }, {
        title: 'value = -1',
        component: _react.default.createElement(_.Number, {
          value: -1,
          sign: true
        })
      }]
    }));
  }
};
var InvalidValue = exports.InvalidValue = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_.Number, {
      value: null
    }));
  }
};
var MaskValue = exports.MaskValue = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_Display.Display, {
      items: [{
        title: 'maskValue',
        component: _react.default.createElement(_.Number, {
          value: 9999,
          sign: true,
          maskValue: true
        })
      }, {
        title: 'maskValue with currency',
        component: _react.default.createElement(_.Number, {
          value: 9999,
          maskValue: true,
          currency: "SEK"
        })
      }]
    }));
  },
  name: 'Number with masked value'
};
var NullCurrency = exports.NullCurrency = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_.Number, {
      value: 10,
      currency: null
    }));
  }
};
var RegressionValueIsPositiveButRoundedValueIs0 = exports.RegressionValueIsPositiveButRoundedValueIs0 = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_Display.Display, {
      items: [{
        title: 'value = 0.1',
        component: _react.default.createElement(_.Number, {
          value: 0.1,
          sign: true,
          decimals: 0
        })
      }]
    }));
  },
  name: 'Regression: value is positive, but rounded value is 0'
};
var Regression0ShouldBe0 = exports.Regression0ShouldBe0 = {
  render: function render() {
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_react.default.Fragment, null, _react.default.createElement(_Display.Display, {
      items: [{
        title: 'value = 0.1',
        component: _react.default.createElement(_.Number, {
          value: -0.1,
          sign: true,
          decimals: 0
        })
      }]
    }), _react.default.createElement(_Display.Display, {
      items: [{
        title: 'value = 0.1',
        component: _react.default.createElement(_.Number, {
          value: -0.1,
          sign: true,
          decimals: 0
        })
      }]
    })));
  },
  name: 'Regression: -0 should be 0'
};
var IntegrationWithDifferentTypographies = exports.IntegrationWithDifferentTypographies = {
  render: function render() {
    var _Object$values;
    var items = (_Object$values = Object.values(_Typography.TYPOGRAPHY_TYPES)) === null || _Object$values === void 0 ? void 0 : _Object$values.map(function (type) {
      return {
        title: type,
        component: _react.default.createElement(_.Typography, {
          type: type
        }, _react.default.createElement(_Display.Display, {
          items: [{
            title: 'value = 1000',
            component: _react.default.createElement(_.Number, {
              value: 1000
            })
          }, {
            title: 'value = 9000000',
            component: _react.default.createElement(_.Number, {
              value: 9000000
            })
          }, {
            title: 'value = 0.01',
            component: _react.default.createElement(_.Number, {
              value: 0.01
            })
          }, {
            title: 'value = 111.2',
            component: _react.default.createElement(_.Number, {
              value: 111.2
            })
          }]
        }))
      };
    });
    return _react.default.createElement(_reactIntl.IntlProvider, {
      locale: "en"
    }, _react.default.createElement(_Display.Display, {
      items: items
    }));
  },
  name: 'Integration: with different typographies'
};