diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index b9a243f..00c85d8 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -17,6 +17,20 @@ jobs:
- run: mix docs
- name: Check if versions showcase mix script finishes
run: mix run scripts/generate_version_showcase.ex
+
+ test-unlocked-deps:
+ runs-on: ubuntu-latest
+ name: unit (unlocked deps)
+ steps:
+ - uses: actions/checkout@v2
+ - uses: erlef/setup-beam@v1
+ with:
+ otp-version: '25.1'
+ elixir-version: '1.14.5'
+ - run: mix deps.unlock --all
+ - run: mix deps.get
+ - run: mix test
+
demo:
runs-on: ubuntu-latest
name: demo
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8542bad..0d029f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,7 @@
## Unreleased
+- Added support for phoenix_html `v4`. You can also continue using phoenix_html `v3`. To replace `Phoenix.HTML.Form` input helpers removed in phoenix_html `v4`, new components `ui_raw_input` and `ui_raw_label` were added.
- Added support for bitstyles `v5.0.0`. You can continue using bitstyles_phoenix with a lower bitstyles version, or migrate your codebase to bitstyles `v5.0.0`.
### How to migrate to bitstyles `v5.0.0`
diff --git a/lib/bitstyles_phoenix.ex b/lib/bitstyles_phoenix.ex
index ea62c15..9c677f9 100644
--- a/lib/bitstyles_phoenix.ex
+++ b/lib/bitstyles_phoenix.ex
@@ -59,7 +59,7 @@ defmodule BitstylesPhoenix do
### Translating error messages
- Generated phoenix apps usally come with a helper for [translating error messages](https://github.com/phoenixframework/phoenix/blob/496123b66c03c9764be623d2c32b4af611837eb0/installer/templates/phx_web/views/error_helpers.ex#L23-L46)
+ Generated phoenix apps usually come with a helper for [translating error messages](https://github.com/phoenixframework/phoenix/blob/496123b66c03c9764be623d2c32b4af611837eb0/installer/templates/phx_web/views/error_helpers.ex#L23-L46)
using `gettext`. This helper can be used to translate error messages rendered with `bitstyles_phoenix`.
In order to do so you can configure the generated helper or write your own with the MFA configuration.
diff --git a/lib/bitstyles_phoenix/component/form.ex b/lib/bitstyles_phoenix/component/form.ex
index 7b542ae..cbfd34e 100644
--- a/lib/bitstyles_phoenix/component/form.ex
+++ b/lib/bitstyles_phoenix/component/form.ex
@@ -7,60 +7,48 @@ defmodule BitstylesPhoenix.Component.Form do
@moduledoc """
Components for rendering input elements.
+ Use `ui_input`, `ui_select`, `ui_textarea` to render the respective inputs together with a label and errors.
+ Alternatively, this module also provides `input` and `label` functions that can be used to render only an input or only a label.
+
## Common attributes
- All helpers in this module accept the following attributes.
+ All `ui_*` components in this module accept the following attributes.
- `form` *(required)* - The form to render the input form.
- `field` *(required)* - The name of the field for the input.
- - `label` - The text to be used as label. Defaults to `Phoenix.HTML.Form.humanize/1`.
- - `label_opts` - The options passed to the label element generated with `Phoenix.HTML.Form.label/4`.
+ - `label` - The text to be used as label. Defaults to a title-cased name of the field.
+ - `label_opts` - The options passed to the label element generated with `BitstylesPhoenix.Component.Form.label/1`.
- See `Phoenix.HTML.Form.form_for/4` or LiveView `form` component for details on how to render a form.
+ For details on how to render a form, see:
+ - `simple_form` core component in a freshly-generated Phoenix app, or
+ - `Phoenix.Component.form/1`, or
+ - `Phoenix.HTML.Form.form_for/4` if using phoenix_html v3 or phoenix_html_helpers
"""
- @input_mapping %{
- color: :color_input,
- checkbox: :checkbox,
- date: :date_input,
- datetime_local: :datetime_local_input,
- email: :email_input,
- file: :file_input,
- number: :number_input,
- password: :password_input,
- range: :range_input,
- search: :search_input,
- telephone: :telephone_input,
- text: :text_input,
- time: :time_input,
- url: :url_input
- }
-
@wrapper_assigns_keys [:field, :form, :label, :label_opts, :hidden_label]
- @type_doc_table @input_mapping
- |> Enum.map(fn {type, helper} ->
- "| `:#{type}` | `Phoenix.HTML.Form.#{helper}/3` |\n"
- end)
-
@doc """
Renders various types of `` element, with the associated `
-
+
"""
'''
)
@@ -118,7 +124,7 @@ defmodule BitstylesPhoenix.Component.Form do