# Upgrading to v0.16

## Bump Your Deps

Update Backpex to the latest version:

```elixir
defp deps do
  [
    {:backpex, "~> 0.16.0"}
  ]
end
```

## Refactoring of filter components

We have enhanced and refactored the filter components, introducing some breaking changes.

- `index_` prefix from filter component names has been removed
- `filter_badge/1` component has been moved to `Backpex.HTML.Resource`

Note that you will only be affected by these changes if you use filter components manually on custom pages.

Due to the refactoring of the filter components, there may be other unexpected errors, so we recommend looking into
[the changes of the PR](https://github.com/naymspace/backpex/pull/1553) in detail if you manually insert filter components to pages.

## `Backpex.Fields.Currency` has been updated

The appearance of the currency field has changed completely. We now use a custom masked input instead of a number input which improves UX a lot.
In addition we've removed the `money` dependency from Backpex so you can use whatever library you want to use for currencies in your app.
The removal of `money` includes our custom [`Backpex.Ecto.AmountType`]() ecto type.

If you used the `money` library before, these are the changes you have to make:

1. Configure `unit`, `unit_position`, `radix` and `thousands_separator` for `Backpex.Fields.Currency`

```elixir
def fields do
  [
    price: %{
      module: Backpex.Fields.Currency,
      label: "Price",
      unit: "€",
      unit_position: :after,
      radix: ",",
      thousands_separator: ".",
      symbol_space: true
    },
    ...
  ]
end
```

See [field-specific options](`Backpex.Fields.Currency`) for default values.

2. Configure defaults for `money` in your `config/config.exs`

```elixir
config :money,
  default_currency: :EUR,
  separator: ".",
  delimiter: ",",
  symbol_on_right: true,
  symbol_space: true
```

The default values should ideally match the field options from step 1.

3. Replace [`Backpex.Ecto.AmountType`]() with [`Money.Ecto.Amount.Type`]()

```elixir
schema "products" do
  field :price, Money.Ecto.Amount.Type
  ...
end
```

4. Add money dependency to your app

```elixir
def deps do
  [
    {:money, "~> 1.14"},
    ...
  ]
end
```

## Component changes

- `Backpex.HTML.Layout.field_container/1` now uses a `dl` element instead of a `div` element to better align with HTML semantics
- `Backpex.HTML.Layout.input_label/1` has been enhanced by adding `as`, `for` and `rest` attribute

We've created a `Backpex.HTML.CoreComponents.dropdown/1`, which is now used for all Backpex dropdowns.
