Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slot defaults #212

Merged
merged 12 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
[
import_deps: [:ecto, :phoenix],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{ex,exs}", "{config,lib,test}/**/*.{ex,exs}"],
inputs: ["*.{ex,exs}", "{scripts,config,lib,test}/**/*.{ex,exs}"],
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ node_modules
.elixir-tools
.elixir_ls
/priv/test_results

/test/assertion_failures/*
!/test/assertion_failures/README.md
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,46 @@ The [box](`PrimerLive.Component.box/1`) component now supports streams:

This includes a breaking change: `let` is now reserved for stream data, so the callback data no longer contains `classes`.

#### Event attributes for slots

Slots now accept these "all-purpose" event attributes:

- `phx-click`
- `phx-target`
- `phx-value-item`

Components:

- `box`: slot `row`
- `breadcrumb`: slot `item`
- `dialog`: slot `row`
- `dropdown`: slot `item`
- `filter_list`: slot `item`
- `header`: slot `item`
- `menu`: slot `item`
- `select_menu`: slot `item`
- `side_nav`: slot `item`
- `subnav_links`: slot `item`
- `tabnav`: slot `item`
- `truncate`: slot `item`
- `underline_nav`: slot `item`

Example with `tabnav`:

```
<:item
:for={%{label: label, id: tab_id} <- @tabs}
is_selected={id == @selected_tab}
phx-click="set_tab"
phx-value-item={tab_id}
>
...

def handle_event(
"set_tab", %{"item" => tab_id}, socket) do
...
```

#### Fieldset wrapper for checkbox_group and radio_group

The form group created by [checkbox_group](`PrimerLive.Component.checkbox_group/1`) and [radio_group](`PrimerLive.Component.radio_group/1`) is now automatically wrapped in a fieldset. The `label` attribute generates a `legend` element.
Expand Down
2 changes: 1 addition & 1 deletion assets/css/primercss-overrides.css
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ input:not(:placeholder-shown)+.FormControl-input-trailingAction.pl-trailingActio
}

.pl-valid+.FormControl-inlineValidation--success.phx-no-feedback {
display: block;
display: flex;
}

/* Style links inside validation messages. */
Expand Down
Loading