playbook_ui_docs 16.5.0.pre.rc.2 → 16.5.0.pre.rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_table/docs/_sections.yml +1 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.html.erb +45 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md +39 -0
- data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md +2 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +20 -8
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.md +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 839516e9716d02d22f9b9d4d44d33784870e986c3922a01bb618ee907a5a58cf
|
|
4
|
+
data.tar.gz: 20c9271658ccf91f59f6cbcd284ab4bca5fbd8b645e434b99375a411f98cb1cd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e1aa4a2c2ff2764629476a9f6a3e5ba8db370e357ff058cf0a03c3fd26581a6cbebfc6e04b2ee3d23120d789592519c5bb771276c701ef3d9c52c8d4e75b6b4
|
|
7
|
+
data.tar.gz: 8ff8c83ec568815d73c1e74b05314eacd25bdc0970e86dca7222f4d44a5cae482b3f4f713c57d2c529fb748e96575e337622aeafeb0d4127a21015c83ac05fe8
|
data/app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.html.erb
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<%# External filter: capture any filter markup and pass it via the filter prop.
|
|
2
|
+
Use your own helper (e.g. a search/filter form) or pb_rails("filter") as shown here. %>
|
|
3
|
+
<% users = [
|
|
4
|
+
{ name: "Alex", role: "Engineer" },
|
|
5
|
+
{ name: "Sam", role: "Designer" },
|
|
6
|
+
{ name: "Jordan", role: "Manager" },
|
|
7
|
+
] %>
|
|
8
|
+
|
|
9
|
+
<% filter_output = capture do %>
|
|
10
|
+
<%= pb_rails("filter", props: {
|
|
11
|
+
id: "external-filter-demo",
|
|
12
|
+
template: "single",
|
|
13
|
+
results: 3,
|
|
14
|
+
background: false,
|
|
15
|
+
sort_menu: [
|
|
16
|
+
{ item: "Name", link: "#", active: true, direction: "asc" },
|
|
17
|
+
{ item: "Role", link: "#", active: false },
|
|
18
|
+
],
|
|
19
|
+
}) do %>
|
|
20
|
+
<%= pb_rails("text_input", props: { label: "Name", placeholder: "Search by name" }) %>
|
|
21
|
+
<%= pb_rails("text_input", props: { label: "Role", placeholder: "e.g. Engineer, Designer" }) %>
|
|
22
|
+
<%= pb_rails("button", props: { text: "Apply" }) %>
|
|
23
|
+
<% end %>
|
|
24
|
+
<% end %>
|
|
25
|
+
|
|
26
|
+
<%= pb_rails("table", props: {
|
|
27
|
+
variant: "with_filter",
|
|
28
|
+
title: "Table with External Filter",
|
|
29
|
+
filter: filter_output,
|
|
30
|
+
}) do %>
|
|
31
|
+
<%= pb_rails("table/table_head") do %>
|
|
32
|
+
<%= pb_rails("table/table_row") do %>
|
|
33
|
+
<%= pb_rails("table/table_header", props: { text: "Name" }) %>
|
|
34
|
+
<%= pb_rails("table/table_header", props: { text: "Role" }) %>
|
|
35
|
+
<% end %>
|
|
36
|
+
<% end %>
|
|
37
|
+
<%= pb_rails("table/table_body") do %>
|
|
38
|
+
<% users.each do |user| %>
|
|
39
|
+
<%= pb_rails("table/table_row") do %>
|
|
40
|
+
<%= pb_rails("table/table_cell") { user[:name] } %>
|
|
41
|
+
<%= pb_rails("table/table_cell") { user[:role] } %>
|
|
42
|
+
<% end %>
|
|
43
|
+
<% end %>
|
|
44
|
+
<% end %>
|
|
45
|
+
<% end %>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Use the **"with_filter"** variant with an **external filter** (Option B): pass pre-rendered filter markup via the `filter` prop. Same layout as Variant with Filter (card, title, separator, flex); only the filter slot is supplied by you. Use this when you need:
|
|
2
|
+
|
|
3
|
+
- **Manual filter submission** – Apply / Filter button instead of automatic application
|
|
4
|
+
- **Full control** – Over filter props, template, sort menu, and submission
|
|
5
|
+
- **Custom or app-specific filter helpers** – Any helper that returns filter markup (e.g. search/filter forms)
|
|
6
|
+
|
|
7
|
+
#### Required props
|
|
8
|
+
|
|
9
|
+
- `variant: "with_filter"`
|
|
10
|
+
- `filter` – Pre-rendered filter HTML (e.g. from `capture { ... }`)
|
|
11
|
+
|
|
12
|
+
When `filter` is present, `filter_content` and `filter_props` are ignored.
|
|
13
|
+
|
|
14
|
+
#### How to do it
|
|
15
|
+
|
|
16
|
+
1. **Render your filter** (e.g. `pb_rails("filter", ...)` or any helper that returns filter markup).
|
|
17
|
+
2. **Capture the output** with `capture do ... end`.
|
|
18
|
+
3. **Pass it to the Table** as the `filter` prop.
|
|
19
|
+
|
|
20
|
+
**Example (generic pattern):**
|
|
21
|
+
|
|
22
|
+
```erb
|
|
23
|
+
<% filter_output = capture do %>
|
|
24
|
+
<%= pb_rails("filter", props: { template: "single", results: 10, background: false }) do %>
|
|
25
|
+
<%= pb_rails("text_input", props: { label: "Name", placeholder: "Search by name" }) %>
|
|
26
|
+
<%= pb_rails("button", props: { text: "Apply" }) %>
|
|
27
|
+
<% end %>
|
|
28
|
+
<% end %>
|
|
29
|
+
|
|
30
|
+
<%= pb_rails("table", props: {
|
|
31
|
+
variant: "with_filter",
|
|
32
|
+
title: "My Table",
|
|
33
|
+
filter: filter_output,
|
|
34
|
+
}) do %>
|
|
35
|
+
<%# table_head / table_body ... %>
|
|
36
|
+
<% end %>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
For Nitro apps that use a shared search/filter pattern, reference the example on Alpha for implementation details.
|
|
@@ -26,8 +26,9 @@ The Table kit automatically sets these Filter defaults (which you can override v
|
|
|
26
26
|
- `min_width: "xs"`
|
|
27
27
|
- `popover_props: { width: "350px" }`
|
|
28
28
|
|
|
29
|
+
Alternatively, you can pass pre-rendered filter markup via the `filter` prop (e.g. for manual submission or custom filter helpers)—scroll down for that approach.
|
|
29
30
|
|
|
30
31
|
**IMPORTANT NOTE**:
|
|
31
32
|
The purpose of this variant is to provide an easy way to set up a Table with a Filter with Design standards applied by default.
|
|
32
33
|
|
|
33
|
-
If you are looking for more customization than this embedded variant provides, you may be better served by using the individual kits as
|
|
34
|
+
If you are looking for more customization than this embedded variant provides, you may be better served by using the individual kits as demonstrated in our Table Filter Card Building Block as seen [here](https://playbook.powerapp.cloud/building_blocks/table_filter_card/rails).
|
|
@@ -41,6 +41,7 @@ examples:
|
|
|
41
41
|
- table_with_header_style_borderless: Header Style Borderless
|
|
42
42
|
- table_with_header_style_floating: Header Style Floating
|
|
43
43
|
- table_with_filter_variant_rails: Variant with Filter
|
|
44
|
+
- table_with_filter_variant_external_filter_rails: Variant with Filter (External Filter)
|
|
44
45
|
- table_with_filter_variant_with_pagination_rails: Variant with Filter and Pagination
|
|
45
46
|
- table_with_filter_with_card_title_props_rails: Variant with Filter (with Card and Title Props)
|
|
46
47
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable react/no-danger */
|
|
2
1
|
/* eslint-disable react/no-multi-comp */
|
|
3
2
|
|
|
4
3
|
import React, { useState } from 'react'
|
|
@@ -38,14 +37,26 @@ const TypeaheadWithHighlight = (props) => {
|
|
|
38
37
|
const [selectedUser, setSelectedUser] = useState()
|
|
39
38
|
|
|
40
39
|
const formatOptionLabel = ({name, territory, title}, {inputValue}) => {
|
|
40
|
+
const escapeRegExp = (value = "") => (
|
|
41
|
+
value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")
|
|
42
|
+
)
|
|
41
43
|
|
|
42
|
-
const highlighted = (text) => {
|
|
44
|
+
const highlighted = (text = "") => {
|
|
43
45
|
if (!inputValue.length) return text
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
)
|
|
46
|
+
|
|
47
|
+
const escapedInputValue = escapeRegExp(inputValue)
|
|
48
|
+
const regex = new RegExp(`(${escapedInputValue})`, 'gi')
|
|
49
|
+
const parts = text.split(regex)
|
|
50
|
+
|
|
51
|
+
return parts.map((part, index) => {
|
|
52
|
+
if (part.toLowerCase() === inputValue.toLowerCase()) {
|
|
53
|
+
return <mark key={`${part}-${index}`}>{part}</mark>
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return <React.Fragment key={`${part}-${index}`}>{part}</React.Fragment>
|
|
57
|
+
})
|
|
48
58
|
}
|
|
59
|
+
|
|
49
60
|
return (
|
|
50
61
|
<Flex>
|
|
51
62
|
<FlexItem>
|
|
@@ -61,11 +72,12 @@ const TypeaheadWithHighlight = (props) => {
|
|
|
61
72
|
size={4}
|
|
62
73
|
{...props}
|
|
63
74
|
>
|
|
64
|
-
|
|
75
|
+
{highlighted(name)}
|
|
76
|
+
</Title>
|
|
65
77
|
<Body color="light"
|
|
66
78
|
{...props}
|
|
67
79
|
>
|
|
68
|
-
|
|
80
|
+
{highlighted(title)}{" • "}
|
|
69
81
|
{territory}
|
|
70
82
|
</Body>
|
|
71
83
|
</FlexItem>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
Use `formatOptionLabel` to customize each option row and highlight text that matches the current search input. Split each field (for example, `name` and `title`) by the typed value, then render matching parts inside `<mark>` so users can quickly see why a result matched.
|
|
2
|
+
|
|
3
|
+
See the code snippet below for more details.
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: playbook_ui_docs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 16.5.0.pre.rc.
|
|
4
|
+
version: 16.5.0.pre.rc.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Power UX
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2026-03-
|
|
12
|
+
date: 2026-03-25 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: playbook_ui
|
|
@@ -2304,6 +2304,8 @@ files:
|
|
|
2304
2304
|
- app/pb_kits/playbook/pb_table/docs/_table_with_dynamic_collapsible_react.md
|
|
2305
2305
|
- app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.jsx
|
|
2306
2306
|
- app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant.md
|
|
2307
|
+
- app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.html.erb
|
|
2308
|
+
- app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_external_filter_rails.md
|
|
2307
2309
|
- app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.html.erb
|
|
2308
2310
|
- app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_rails.md
|
|
2309
2311
|
- app/pb_kits/playbook/pb_table/docs/_table_with_filter_variant_with_pagination.jsx
|
|
@@ -2660,6 +2662,7 @@ files:
|
|
|
2660
2662
|
- app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.md
|
|
2661
2663
|
- app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_context.html.erb
|
|
2662
2664
|
- app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx
|
|
2665
|
+
- app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.md
|
|
2663
2666
|
- app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.html.erb
|
|
2664
2667
|
- app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.jsx
|
|
2665
2668
|
- app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills.md
|