playbook_ui_docs 16.1.0 → 16.2.0.pre.alpha.PLAY2719atpinnedrowsrails14398
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_advanced_table/docs/_advanced_table_column_styling_background_custom.jsx +71 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.md +4 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.html.erb +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pinned_rows_rails.md +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant.html.erb +21 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant.jsx +180 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant_rails.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant_react.md +1 -0
- data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.html.erb +6 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.jsx +17 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_required_indicator.html.erb +5 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_required_indicator.jsx +13 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_required_indicator.md +1 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_required_indicator.html.erb +14 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_required_indicator.jsx +42 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +52 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +72 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +5 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +20 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +8 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +8 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +6 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +1 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +3 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +33 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +3 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +8 -2
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +16 -9
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +156 -2
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_button.jsx +1 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_date_picker.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_date_picker.jsx +1 -0
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_default.html.erb +3 -3
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_default.jsx +4 -1
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.html.erb +4 -4
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_full_width.jsx +4 -1
- data/app/pb_kits/playbook/pb_form_group/docs/_form_group_typeahead.jsx +1 -0
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +3 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +4 -7
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_required_indicator.html.erb +72 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_required_indicator.jsx +87 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +18 -17
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_max_displayed_users.jsx +71 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +2 -1
- data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.html.erb +24 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.jsx +87 -0
- data/app/pb_kits/playbook/pb_nav/docs/example.yml +2 -6
- data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +1 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +7 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +24 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_passphrase/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +5 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +14 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.jsx +44 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.jsx +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +28 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.html.erb +1 -1
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.jsx +1 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.html.erb +3 -3
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +3 -0
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.md +1 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +5 -2
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.html.erb +6 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.jsx +16 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_time_picker/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.html.erb +16 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.jsx +23 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.md +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +22 -21
- metadata +56 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 642f355d02eb89d3ea626cadbd833cfae6dff9dc4dbed8a0379dc01209c67305
|
|
4
|
+
data.tar.gz: 57b20527744b34be8e1cb7603baf0cd57e101247b72dc56610c7e1dc47dd7800
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3aee40e197d57063a09a16b7f79c951ba8c3a5506bb07b61ef5bcb3a9d0586889a06a8bf8e73dc40ddd8a76f8cff1b96cb1fc79593b77d94f7827f8055f13e60
|
|
7
|
+
data.tar.gz: 2119609051919165117513faa4b023e0f7a7a60bc45f0b912aea63c7db499fefbdbd319744ec3588e840f8155ccd5d61fe9650b9be921861418fb9cfbdd6b9f6
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import AdvancedTable from '../_advanced_table'
|
|
3
|
+
import colors from '../../tokens/exports/_colors.module.scss'
|
|
4
|
+
import MOCK_DATA from "./advanced_table_mock_data.json"
|
|
5
|
+
import Flex from '../../pb_flex/_flex'
|
|
6
|
+
import Title from '../../pb_title/_title'
|
|
7
|
+
import Body from '../../pb_body/_body'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const AdvancedTableColumnStylingBackgroundCustom = (props) => {
|
|
11
|
+
const columnDefinitions = [
|
|
12
|
+
{
|
|
13
|
+
accessor: "year",
|
|
14
|
+
label: "Year",
|
|
15
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
16
|
+
customRenderer: (row, value) => (
|
|
17
|
+
<Flex flexDirection="column">
|
|
18
|
+
<Title size={4}
|
|
19
|
+
text={value}
|
|
20
|
+
/>
|
|
21
|
+
<Body text="lorem ipsum" />
|
|
22
|
+
<Body text="lorem ipsum" />
|
|
23
|
+
</Flex>
|
|
24
|
+
),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
accessor: "newEnrollments",
|
|
28
|
+
label: "New Enrollments",
|
|
29
|
+
columnStyling:{
|
|
30
|
+
cellBackgroundColor: (row) => row.original.newEnrollments > 15 ? colors.success_subtle : colors.error_subtle,
|
|
31
|
+
fontColor: (row) => row.original.newEnrollments > 15 ? colors.success : colors.error,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
accessor: "scheduledMeetings",
|
|
36
|
+
label: "Scheduled Meetings",
|
|
37
|
+
columnStyling:{
|
|
38
|
+
cellBackgroundColor: (row) => row.original.scheduledMeetings >= 15 ? colors.info_subtle : colors.warning_subtle
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
accessor: "attendanceRate",
|
|
43
|
+
label: "Attendance Rate",
|
|
44
|
+
columnStyling:{cellBackgroundColor: colors.info, headerBackgroundColor: colors.info, fontColor: colors.white, headerFontColor: colors.white},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
accessor: "completedClasses",
|
|
48
|
+
label: "Completed Classes",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
accessor: "classCompletionRate",
|
|
52
|
+
label: "Class Completion Rate",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
accessor: "graduatedStudents",
|
|
56
|
+
label: "Graduated Students",
|
|
57
|
+
},
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div>
|
|
62
|
+
<AdvancedTable
|
|
63
|
+
columnDefinitions={columnDefinitions}
|
|
64
|
+
tableData={MOCK_DATA}
|
|
65
|
+
{...props}
|
|
66
|
+
/>
|
|
67
|
+
</div>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export default AdvancedTableColumnStylingBackgroundCustom
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<%# Example sort method for demonstration purposes %>
|
|
2
|
+
<% if params["sort"] %>
|
|
3
|
+
<% sort_param = params["sort"].gsub(/_(asc|desc)\z/, "") %>
|
|
4
|
+
<% sort_direction = params["sort"].end_with?("_asc") ? 1 : -1 %>
|
|
5
|
+
<% @table_data_with_id.sort! do |a, b|
|
|
6
|
+
value_a = a[sort_param] || a[sort_param.to_sym]
|
|
7
|
+
value_b = b[sort_param] || b[sort_param.to_sym]
|
|
8
|
+
|
|
9
|
+
value_a = value_a.to_i if value_a.is_a?(String) && value_a.match?(/^\d+$/)
|
|
10
|
+
value_b = value_b.to_i if value_b.is_a?(String) && value_b.match?(/^\d+$/)
|
|
11
|
+
|
|
12
|
+
sort_direction * (value_a <=> value_b)
|
|
13
|
+
end %>
|
|
14
|
+
<% end %>
|
|
15
|
+
|
|
16
|
+
<% column_definitions = [
|
|
17
|
+
{
|
|
18
|
+
accessor: "year",
|
|
19
|
+
label: "Year",
|
|
20
|
+
cellAccessors: ["quarter", "month", "day"],
|
|
21
|
+
sort_menu: [
|
|
22
|
+
{ item: "Year", link: "?sort=year_asc#pinned_rows_table", active: params["sort"] == "year_asc", direction: "asc" },
|
|
23
|
+
{ item: "Year", link: "?sort=year_desc#pinned_rows_table", active: params["sort"] == "year_desc", direction: "desc" }
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
accessor: "newEnrollments",
|
|
28
|
+
label: "New Enrollments",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
accessor: "scheduledMeetings",
|
|
32
|
+
label: "Scheduled Meetings",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
accessor: "attendanceRate",
|
|
36
|
+
label: "Attendance Rate",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
accessor: "completedClasses",
|
|
40
|
+
label: "Completed Classes",
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
accessor: "classCompletionRate",
|
|
44
|
+
label: "Class Completion Rate",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
accessor: "graduatedStudents",
|
|
48
|
+
label: "Graduated Students",
|
|
49
|
+
}
|
|
50
|
+
] %>
|
|
51
|
+
|
|
52
|
+
<% pinned_rows = { top: ["8"] } %>
|
|
53
|
+
|
|
54
|
+
<%= pb_rails("advanced_table", props: { id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, max_height: "xs", pinned_rows: pinned_rows, responsive: "none", table_props: { sticky: true }}) do %>
|
|
55
|
+
<%= pb_rails("advanced_table/table_header", props: { table_id: "pinned_rows_table", column_definitions: column_definitions }) %>
|
|
56
|
+
<%= pb_rails("advanced_table/table_body", props: { table_id: "pinned_rows_table", table_data: @table_data_with_id, column_definitions: column_definitions, pinned_rows: pinned_rows }) %>
|
|
57
|
+
<% end %>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Use the `pinned_rows` prop to pin specific rows to the top of an Advanced Table. Pinned rows will remain at the top when scrolling through table data and will not change position if sorting is used.
|
|
2
|
+
|
|
3
|
+
**NOTE:**
|
|
4
|
+
- Sticky header required: Pinned rows must be used with `sticky: true` via `table_props` (works with both responsive and non-responsive tables)
|
|
5
|
+
- Row ids required: Each object within the `table_data` array must contain a unique `id` in order to attach an id to all Rows for this to function.
|
|
6
|
+
- `pinned_rows` takes a hash with a `top` key containing an array of row ids, as shown in the code snippet below.
|
|
7
|
+
- For expandable rows, use the parent id in `pinned_rows[:top]`; all its children will automatically be pinned with it. If a child id is passed without the parent being pinned, nothing will be pinned.
|
|
@@ -2,4 +2,4 @@ the `enableSorting` prop is a boolean prop set to false by default. If true, the
|
|
|
2
2
|
|
|
3
3
|
### sortIcon
|
|
4
4
|
|
|
5
|
-
An optional prop, `sortIcon` allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when sort direction is desc, and the second value will replace the default icon when sort direction is asc. `sortIcon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the sort state. Default for this prop is `["arrow-up-short
|
|
5
|
+
An optional prop, `sortIcon` allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when sort direction is desc, and the second value will replace the default icon when sort direction is asc. `sortIcon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the sort state. Default for this prop is `["arrow-up-wide-short", "arrow-down-short-wide"]`. All strings must be valid FA icons.
|
|
@@ -7,6 +7,7 @@ examples:
|
|
|
7
7
|
- advanced_table_table_props: Table Props
|
|
8
8
|
- advanced_table_sticky_header_rails: Sticky Header
|
|
9
9
|
- advanced_table_table_props_sticky_header: Sticky Header for Responsive Table
|
|
10
|
+
- advanced_table_pinned_rows_rails: Pinned Rows
|
|
10
11
|
- advanced_table_beta_sort: Enable Sorting
|
|
11
12
|
- advanced_table_responsive: Responsive Tables
|
|
12
13
|
- advanced_table_custom_cell_rails: Custom Components for Cells
|
|
@@ -78,6 +79,7 @@ examples:
|
|
|
78
79
|
- advanced_table_column_styling: Column Styling
|
|
79
80
|
- advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
|
|
80
81
|
- advanced_table_column_styling_background: Column Styling Background Color
|
|
82
|
+
- advanced_table_column_styling_background_custom: Column Styling Background Color (Custom)
|
|
81
83
|
- advanced_table_column_styling_background_multi: Column Styling Background Color with Multiple Headers
|
|
82
84
|
- advanced_table_padding_control: Padding Control using Column Styling
|
|
83
85
|
- advanced_table_column_border_color: Column Group Border Color
|
|
@@ -47,4 +47,5 @@ export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced
|
|
|
47
47
|
export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
|
|
48
48
|
export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
|
|
49
49
|
export { default as AdvancedTableColumnStylingBackground } from './_advanced_table_column_styling_background.jsx'
|
|
50
|
-
export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
|
|
50
|
+
export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
|
|
51
|
+
export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%= pb_rails("caption", props: { margin_y: "md", text: "Small Size (sm)" }) %>
|
|
2
|
+
<%= pb_rails("button", props: { icon: "plus", size: "sm", margin_right: "lg" }) %>
|
|
3
|
+
<%= pb_rails("button", props: { icon: "plus", size: "sm", variant: "secondary", margin_right: "lg" }) %>
|
|
4
|
+
<%= pb_rails("button", props: { icon: "plus", size: "sm", variant: "link", margin_right: "lg" }) %>
|
|
5
|
+
<%= pb_rails("button", props: { icon: "plus", size: "sm", variant: "danger", margin_right: "lg" }) %>
|
|
6
|
+
<%= pb_rails("button", props: { icon: "plus", size: "sm", disabled: true, margin_right: "lg" }) %>
|
|
7
|
+
<%= pb_rails("button", props: { icon: "plus", size: "sm", loading: true, margin_right: "lg" }) %>
|
|
8
|
+
<%= pb_rails("caption", props: { margin_y: "md", text: "Medium Size (md)" }) %>
|
|
9
|
+
<%= pb_rails("button", props: { icon: "plus", size: "md", margin_right: "lg" }) %>
|
|
10
|
+
<%= pb_rails("button", props: { icon: "plus", size: "md", variant: "secondary", margin_right: "lg" }) %>
|
|
11
|
+
<%= pb_rails("button", props: { icon: "plus", size: "md", variant: "link", margin_right: "lg" }) %>
|
|
12
|
+
<%= pb_rails("button", props: { icon: "plus", size: "md", variant: "danger", margin_right: "lg" }) %>
|
|
13
|
+
<%= pb_rails("button", props: { icon: "plus", size: "md", disabled: true, margin_right: "lg" }) %>
|
|
14
|
+
<%= pb_rails("button", props: { icon: "plus", size: "md", loading: true, margin_right: "lg" }) %>
|
|
15
|
+
<%= pb_rails("caption", props: { margin_y: "md", text: "Large Size (lg)" }) %>
|
|
16
|
+
<%= pb_rails("button", props: { icon: "plus", size: "lg", margin_right: "lg" }) %>
|
|
17
|
+
<%= pb_rails("button", props: { icon: "plus", size: "lg", variant: "secondary", margin_right: "lg" }) %>
|
|
18
|
+
<%= pb_rails("button", props: { icon: "plus", size: "lg", variant: "link", margin_right: "lg" }) %>
|
|
19
|
+
<%= pb_rails("button", props: { icon: "plus", size: "lg", variant: "danger", margin_right: "lg" }) %>
|
|
20
|
+
<%= pb_rails("button", props: { icon: "plus", size: "lg", disabled: true, margin_right: "lg" }) %>
|
|
21
|
+
<%= pb_rails("button", props: { icon: "plus", size: "lg", loading: true, margin_right: "lg" }) %>
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Button from "../../pb_button/_button"
|
|
3
|
+
import Caption from "../../pb_caption/_caption"
|
|
4
|
+
|
|
5
|
+
const ButtonIconVariant = (props) => (
|
|
6
|
+
<div>
|
|
7
|
+
<Caption
|
|
8
|
+
marginY="md"
|
|
9
|
+
text="Small Size (sm)"
|
|
10
|
+
/>
|
|
11
|
+
<Button
|
|
12
|
+
icon="plus"
|
|
13
|
+
marginRight='lg'
|
|
14
|
+
size="sm"
|
|
15
|
+
tabIndex={0}
|
|
16
|
+
{...props}
|
|
17
|
+
/>
|
|
18
|
+
{' '}
|
|
19
|
+
<Button
|
|
20
|
+
icon="plus"
|
|
21
|
+
marginRight='lg'
|
|
22
|
+
size="sm"
|
|
23
|
+
tabIndex={0}
|
|
24
|
+
variant="secondary"
|
|
25
|
+
{...props}
|
|
26
|
+
/>
|
|
27
|
+
{' '}
|
|
28
|
+
<Button
|
|
29
|
+
icon="plus"
|
|
30
|
+
marginRight='lg'
|
|
31
|
+
size="sm"
|
|
32
|
+
tabIndex={0}
|
|
33
|
+
variant="link"
|
|
34
|
+
{...props}
|
|
35
|
+
/>
|
|
36
|
+
{' '}
|
|
37
|
+
<Button
|
|
38
|
+
icon="plus"
|
|
39
|
+
marginRight='lg'
|
|
40
|
+
size="sm"
|
|
41
|
+
tabIndex={0}
|
|
42
|
+
variant="danger"
|
|
43
|
+
{...props}
|
|
44
|
+
/>
|
|
45
|
+
{' '}
|
|
46
|
+
<Button
|
|
47
|
+
disabled
|
|
48
|
+
icon="plus"
|
|
49
|
+
marginRight='lg'
|
|
50
|
+
size="sm"
|
|
51
|
+
tabIndex={0}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
{' '}
|
|
55
|
+
<Button
|
|
56
|
+
icon="plus"
|
|
57
|
+
loading
|
|
58
|
+
marginRight='lg'
|
|
59
|
+
size="sm"
|
|
60
|
+
tabIndex={0}
|
|
61
|
+
{...props}
|
|
62
|
+
/>
|
|
63
|
+
<br/>
|
|
64
|
+
<Caption
|
|
65
|
+
marginY="md"
|
|
66
|
+
text="Medium Size (md)"
|
|
67
|
+
/>
|
|
68
|
+
<Button
|
|
69
|
+
icon="plus"
|
|
70
|
+
marginRight='lg'
|
|
71
|
+
size="md"
|
|
72
|
+
tabIndex={0}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
{' '}
|
|
76
|
+
<Button
|
|
77
|
+
icon="plus"
|
|
78
|
+
marginRight='lg'
|
|
79
|
+
size="md"
|
|
80
|
+
tabIndex={0}
|
|
81
|
+
variant="secondary"
|
|
82
|
+
{...props}
|
|
83
|
+
/>
|
|
84
|
+
{' '}
|
|
85
|
+
<Button
|
|
86
|
+
icon="plus"
|
|
87
|
+
marginRight='lg'
|
|
88
|
+
size="md"
|
|
89
|
+
tabIndex={0}
|
|
90
|
+
variant="link"
|
|
91
|
+
{...props}
|
|
92
|
+
/>
|
|
93
|
+
{' '}
|
|
94
|
+
<Button
|
|
95
|
+
icon="plus"
|
|
96
|
+
marginRight='lg'
|
|
97
|
+
size="md"
|
|
98
|
+
tabIndex={0}
|
|
99
|
+
variant="danger"
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
{' '}
|
|
103
|
+
<Button
|
|
104
|
+
disabled
|
|
105
|
+
icon="plus"
|
|
106
|
+
marginRight='lg'
|
|
107
|
+
size="md"
|
|
108
|
+
tabIndex={0}
|
|
109
|
+
{...props}
|
|
110
|
+
/>
|
|
111
|
+
{' '}
|
|
112
|
+
<Button
|
|
113
|
+
icon="plus"
|
|
114
|
+
loading
|
|
115
|
+
marginRight='lg'
|
|
116
|
+
size="md"
|
|
117
|
+
tabIndex={0}
|
|
118
|
+
{...props}
|
|
119
|
+
/>
|
|
120
|
+
<br/>
|
|
121
|
+
<Caption
|
|
122
|
+
marginY="md"
|
|
123
|
+
text="Large Size (lg)"
|
|
124
|
+
/>
|
|
125
|
+
<Button
|
|
126
|
+
icon="plus"
|
|
127
|
+
marginRight='lg'
|
|
128
|
+
size="lg"
|
|
129
|
+
tabIndex={0}
|
|
130
|
+
{...props}
|
|
131
|
+
/>
|
|
132
|
+
{' '}
|
|
133
|
+
<Button
|
|
134
|
+
icon="plus"
|
|
135
|
+
marginRight='lg'
|
|
136
|
+
size="lg"
|
|
137
|
+
tabIndex={0}
|
|
138
|
+
variant="secondary"
|
|
139
|
+
{...props}
|
|
140
|
+
/>
|
|
141
|
+
{' '}
|
|
142
|
+
<Button
|
|
143
|
+
icon="plus"
|
|
144
|
+
marginRight='lg'
|
|
145
|
+
size="lg"
|
|
146
|
+
tabIndex={0}
|
|
147
|
+
variant="link"
|
|
148
|
+
{...props}
|
|
149
|
+
/>
|
|
150
|
+
{' '}
|
|
151
|
+
<Button
|
|
152
|
+
icon="plus"
|
|
153
|
+
marginRight='lg'
|
|
154
|
+
size="lg"
|
|
155
|
+
tabIndex={0}
|
|
156
|
+
variant="danger"
|
|
157
|
+
{...props}
|
|
158
|
+
/>
|
|
159
|
+
{' '}
|
|
160
|
+
<Button
|
|
161
|
+
disabled
|
|
162
|
+
icon="plus"
|
|
163
|
+
marginRight='lg'
|
|
164
|
+
size="lg"
|
|
165
|
+
tabIndex={0}
|
|
166
|
+
{...props}
|
|
167
|
+
/>
|
|
168
|
+
{' '}
|
|
169
|
+
<Button
|
|
170
|
+
icon="plus"
|
|
171
|
+
loading
|
|
172
|
+
marginRight='lg'
|
|
173
|
+
size="lg"
|
|
174
|
+
tabIndex={0}
|
|
175
|
+
{...props}
|
|
176
|
+
/>
|
|
177
|
+
</div>
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
export default ButtonIconVariant
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The icon button variant automatically renders when you provide an `icon` prop without a corresponding `text` prop. The button will only display an icon (no text) and will be wrapped with the icon button styling. This works with all button variants including "link", "primary", "secondary", etc. Simply use `<%= pb_rails("button", props: { icon: "plus", variant: "secondary" }) %>` to get an icon button.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The icon button variant automatically renders when you provide an `icon` prop without a corresponding `text` prop. The button will only display an icon (no text) and will be wrapped with the icon button styling. This works with all button variants including "link", "primary", "secondary", etc. Simply use `<Button icon="rocket" variant="primary" />` to get an icon button.
|
|
@@ -13,6 +13,7 @@ examples:
|
|
|
13
13
|
- button_form: Button Form Attribute
|
|
14
14
|
- button_managed_disabled: Button Toggle Disabled State
|
|
15
15
|
- button_managed_disabled_helper: Button Toggle Disabled State Helper
|
|
16
|
+
- button_icon_variant: Icon Button Variant
|
|
16
17
|
|
|
17
18
|
react:
|
|
18
19
|
- button_default: Button Variants
|
|
@@ -27,6 +28,7 @@ examples:
|
|
|
27
28
|
- button_size: Button Size
|
|
28
29
|
- button_form: Button Form Attribute
|
|
29
30
|
- button_hover: Button Hover
|
|
31
|
+
- button_icon_variant: Icon Button Variant
|
|
30
32
|
|
|
31
33
|
swift:
|
|
32
34
|
- button_default_swift: Button Variants
|
|
@@ -4,6 +4,7 @@ export { default as ButtonLink } from './_button_link.jsx'
|
|
|
4
4
|
export { default as ButtonLoading } from './_button_loading.jsx'
|
|
5
5
|
export { default as ButtonBlockContent } from './_button_block_content.jsx'
|
|
6
6
|
export { default as ButtonIconOptions } from './_button_icon_options.jsx'
|
|
7
|
+
export { default as ButtonIconVariant } from './_button_icon_variant.jsx'
|
|
7
8
|
export { default as ButtonAccessibility } from './_button_accessibility.jsx'
|
|
8
9
|
export { default as ButtonOptions } from './_button_options.jsx'
|
|
9
10
|
export { default as ButtonSize } from './_button_size.jsx'
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Checkbox from '../_checkbox'
|
|
3
|
+
|
|
4
|
+
const CheckboxRequiredIndicator = () => {
|
|
5
|
+
return (
|
|
6
|
+
<div>
|
|
7
|
+
<Checkbox
|
|
8
|
+
name="checkbox-name"
|
|
9
|
+
requiredIndicator
|
|
10
|
+
text="Checkbox label"
|
|
11
|
+
value="check-box value"
|
|
12
|
+
/>
|
|
13
|
+
</div>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default CheckboxRequiredIndicator
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The `requiredIndicator`/`required_indicator` prop displays a red asterisk (*) next to the label, visually indicating that the field is required. This is purely visual and does not enforce validation.
|
|
2
|
+
|
|
3
|
+
You can use `requiredIndicator`/`required_indicator` with any validation approach: HTML5 validation via the `required` prop, client-side validation, or backend validation. For this reason, it works independently and doesn't need to be paired with the `required` prop.
|
|
@@ -8,6 +8,7 @@ examples:
|
|
|
8
8
|
- checkbox_indeterminate: Indeterminate Checkbox
|
|
9
9
|
- checkbox_disabled: Disabled Checkbox
|
|
10
10
|
- checkbox_form: Form and Hidden Input
|
|
11
|
+
# - checkbox_required_indicator: Required Indicator
|
|
11
12
|
|
|
12
13
|
react:
|
|
13
14
|
- checkbox_default: Default
|
|
@@ -17,6 +18,7 @@ examples:
|
|
|
17
18
|
- checkbox_error: Default w/ Error
|
|
18
19
|
- checkbox_indeterminate: Indeterminate Checkbox
|
|
19
20
|
- checkbox_disabled: Disabled Checkbox
|
|
21
|
+
# - checkbox_required_indicator: Required Indicator
|
|
20
22
|
|
|
21
23
|
swift:
|
|
22
24
|
- checkbox_default_swift: Default
|
|
@@ -5,3 +5,4 @@ export { default as CheckboxError } from './_checkbox_error.jsx'
|
|
|
5
5
|
export { default as CheckboxChecked } from './_checkbox_checked.jsx'
|
|
6
6
|
export { default as CheckboxIndeterminate } from './_checkbox_indeterminate.jsx'
|
|
7
7
|
export { default as CheckboxDisabled } from './_checkbox_disabled.jsx'
|
|
8
|
+
export { default as CheckboxRequiredIndicator } from './_checkbox_required_indicator.jsx'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
`pickerId`/`picker_id` is a **required prop** to instantiate the Date Picker. The presence of `pickerId`/`picker_id` in your Date Picker also associates the label with the input, providing the ability to focus the Date Picker by clicking the label.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import DatePicker from "../_date_picker"
|
|
3
|
+
|
|
4
|
+
const DatePickerRequiredIndicator = (props) => (
|
|
5
|
+
<DatePicker
|
|
6
|
+
label="Required Date Picker"
|
|
7
|
+
pickerId="date_picker_required_indicator"
|
|
8
|
+
requiredIndicator
|
|
9
|
+
{...props}
|
|
10
|
+
/>
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
export default DatePickerRequiredIndicator
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
The `requiredIndicator`/`required_indicator` prop displays a red asterisk (*) next to the label to visually indicate that the field is required. This is purely visual and does not enforce validation—you can pair it with HTML `required`, client-side validation, or server-side validation as needed.
|
|
@@ -31,6 +31,7 @@ examples:
|
|
|
31
31
|
- date_picker_time: Time Selection
|
|
32
32
|
- date_picker_positions: Custom Positions
|
|
33
33
|
- date_picker_positions_element: Custom Position (based on element)
|
|
34
|
+
- date_picker_required_indicator: Required Indicator
|
|
34
35
|
- date_picker_turbo_frames: Within Turbo Frames
|
|
35
36
|
|
|
36
37
|
react:
|
|
@@ -64,3 +65,4 @@ examples:
|
|
|
64
65
|
- date_picker_time: Time Selection
|
|
65
66
|
- date_picker_positions: Custom Positions
|
|
66
67
|
- date_picker_positions_element: Custom Position (based on element)
|
|
68
|
+
- date_picker_required_indicator: Required Indicator
|
|
@@ -27,4 +27,5 @@ export { default as DatePickerQuickPickCustom } from './_date_picker_quick_pick_
|
|
|
27
27
|
export { default as DatePickerQuickPickCustomOverride } from './_date_picker_quick_pick_custom_override'
|
|
28
28
|
export { default as DatePickerQuickPickDefaultDate } from './_date_picker_quick_pick_default_date'
|
|
29
29
|
export { default as DatePickerRangePattern } from './_date_picker_range_pattern'
|
|
30
|
-
export { default as DatePickerAndDropdownRange } from './_date_picker_and_dropdown_range.jsx'
|
|
30
|
+
export { default as DatePickerAndDropdownRange } from './_date_picker_and_dropdown_range.jsx'
|
|
31
|
+
export { default as DatePickerRequiredIndicator } from "./_date_picker_required_indicator.jsx";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The `blank_selection` prop adds a blank option at the top of the dropdown options list. This allows users to explicitly clear their selection by choosing the blank option.
|
|
2
|
+
|
|
3
|
+
The blank selection option appears as the first item in the dropdown and has an empty value (`id: ""`, `value: ""`). When selected, it effectively clears the dropdown selection.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The `blankSelection` prop adds a blank option at the top of the dropdown options list. This allows users to explicitly clear their selection by choosing the blank option.
|
|
2
|
+
|
|
3
|
+
The blank selection option appears as the first item in the dropdown and has an empty value (`id: ""`, `value: ""`). When selected, it effectively clears the dropdown selection.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<%
|
|
2
|
+
options = [
|
|
3
|
+
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
|
4
|
+
{ label: 'Canada', value: 'canada', id: 'ca' },
|
|
5
|
+
{ label: 'Pakistan', value: 'pakistan', id: 'pk' }
|
|
6
|
+
]
|
|
7
|
+
%>
|
|
8
|
+
|
|
9
|
+
<%= pb_rails("dropdown", props: {
|
|
10
|
+
id: "dropdown_required_indicator",
|
|
11
|
+
label: "Select a Country",
|
|
12
|
+
options: options,
|
|
13
|
+
required_indicator: true
|
|
14
|
+
}) %>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Dropdown from "../../pb_dropdown/_dropdown";
|
|
3
|
+
|
|
4
|
+
const DropdownRequiredIndicator = (props) => {
|
|
5
|
+
const options = [
|
|
6
|
+
{
|
|
7
|
+
label: "United States",
|
|
8
|
+
value: "unitedStates",
|
|
9
|
+
id: "us",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "Canada",
|
|
13
|
+
value: "canada",
|
|
14
|
+
id: "ca",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: "Pakistan",
|
|
18
|
+
value: "pakistan",
|
|
19
|
+
id: "pk",
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<Dropdown
|
|
26
|
+
label="Select a Country"
|
|
27
|
+
options={options}
|
|
28
|
+
requiredIndicator
|
|
29
|
+
{...props}
|
|
30
|
+
>
|
|
31
|
+
{options.map((option) => (
|
|
32
|
+
<Dropdown.Option
|
|
33
|
+
key={option.id}
|
|
34
|
+
option={option}
|
|
35
|
+
/>
|
|
36
|
+
))}
|
|
37
|
+
</Dropdown>
|
|
38
|
+
</div>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default DropdownRequiredIndicator;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
The `requiredIndicator`/`required_indicator` prop displays a red asterisk (\*) next to the label, visually indicating that the field is required. This is purely visual and does not enforce validation.
|
|
2
|
+
|
|
3
|
+
You can use `requiredIndicator`/`required_indicator` with any validation approach: HTML5 validation via the `required` prop, client-side validation, or backend validation. For this reason, it works independently and doesn't need to be paired with the `required` prop.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<%
|
|
2
|
+
options = [
|
|
3
|
+
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
|
4
|
+
{ label: 'Canada', value: 'canada', id: 'ca' },
|
|
5
|
+
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
|
6
|
+
]
|
|
7
|
+
%>
|
|
8
|
+
|
|
9
|
+
<%= pb_rails("dropdown", props: {
|
|
10
|
+
id: "date-range-quickpick-reset-closeable",
|
|
11
|
+
label: "Quick Pick",
|
|
12
|
+
variant: "quickpick",
|
|
13
|
+
clearable: false
|
|
14
|
+
}) %>
|
|
15
|
+
|
|
16
|
+
<%= pb_rails("button", props: {
|
|
17
|
+
margin_y: "md",
|
|
18
|
+
text: "Reset",
|
|
19
|
+
html_options: {
|
|
20
|
+
onclick: "handleReset()"
|
|
21
|
+
}
|
|
22
|
+
}) %>
|
|
23
|
+
|
|
24
|
+
<%= pb_rails("dropdown", props: {
|
|
25
|
+
id: "closeable-default",
|
|
26
|
+
options: options,
|
|
27
|
+
clearable: false,
|
|
28
|
+
default_value: options.last,
|
|
29
|
+
margin_bottom: "md",
|
|
30
|
+
label: "Default"
|
|
31
|
+
}) %>
|
|
32
|
+
|
|
33
|
+
<%= pb_rails("dropdown", props: {
|
|
34
|
+
id: "closeable-subtle",
|
|
35
|
+
options: options,
|
|
36
|
+
clearable: false,
|
|
37
|
+
default_value: options.second,
|
|
38
|
+
variant: "subtle",
|
|
39
|
+
separators: false,
|
|
40
|
+
label: "Subtle"
|
|
41
|
+
}) %>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
function handleReset() {
|
|
45
|
+
const dropdown = document.querySelector("#date-range-quickpick-reset-closeable[data-pb-dropdown]");
|
|
46
|
+
const instance = dropdown?._pbDropdownInstance;
|
|
47
|
+
|
|
48
|
+
if (instance) {
|
|
49
|
+
instance.clearSelection();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
</script>
|