playbook_ui 14.23.0.pre.alpha.PLAY2283multiheaderverticalbordersdoc9335 → 14.23.0.pre.alpha.PLAY2303optD9000
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/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/CustomCell.tsx +6 -7
- data/app/pb_kits/playbook/pb_advanced_table/Components/SortIconButton.tsx +25 -24
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +10 -10
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +12 -11
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +4 -7
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +2 -78
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -13
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +2 -14
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -34
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table_action_bar.js +0 -16
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_rails.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -4
- data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +11 -4
- data/app/pb_kits/playbook/pb_advanced_table/index.js +125 -108
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +1 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_body.rb +4 -7
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +1 -5
- data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -46
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +4 -13
- data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +5 -24
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_legend_position.md +1 -1
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +1 -12
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -2
- data/app/pb_kits/playbook/pb_checkbox/index.js +26 -218
- data/app/pb_kits/playbook/pb_circle_chart/docs/_circle_chart_legend_position.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -17
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +0 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options.jsx +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_radio_options_react.md +1 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -24
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -11
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors.jsx +15 -32
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex.jsx +9 -35
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_default.jsx +14 -26
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_disable_animation.jsx +15 -32
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_full_circle.jsx +17 -45
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_height.jsx +22 -59
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_live_data.jsx +9 -40
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_min_max.jsx +18 -50
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.jsx +30 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_sizing.jsx +18 -31
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_title.jsx +17 -34
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units.jsx +23 -64
- data/app/pb_kits/playbook/pb_gauge/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_gauge/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gauge/gaugeTheme.ts +1 -7
- data/app/pb_kits/playbook/pb_line_graph/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors.jsx +17 -36
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_default.jsx +16 -31
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.jsx +31 -63
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend.jsx +16 -35
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_nonclickable.jsx +16 -41
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.jsx +62 -107
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_legend_position.md +7 -4
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.jsx +52 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_pb_styles.md +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_line_graph/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_line_graph/lineGraphTheme.ts +1 -16
- data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +9 -18
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +1 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -3
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -4
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md +1 -3
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -3
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_select/select.rb +2 -4
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.scss +0 -0
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +202 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_continuous.jsx +69 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_default.jsx +71 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_multi_beacon.jsx +110 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_beacon.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_no_overlay.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/_walkthrough_styled.jsx +76 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/example.yml +10 -0
- data/app/pb_kits/playbook/pb_walkthrough/docs/index.js +6 -0
- data/app/pb_kits/playbook/pb_walkthrough/walkthrough.test.jsx +34 -0
- data/dist/chunks/_circle_chart-BZmlhBs2.js +1 -0
- data/dist/chunks/_typeahead-B1tu_vWi.js +22 -0
- data/dist/chunks/_weekday_stacked-CKk0dR5s.js +45 -0
- data/dist/chunks/lib-DYpq0k8j.js +29 -0
- data/dist/chunks/{pb_form_validation-D3b0JKHH.js → pb_form_validation-BUOKwfvW.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +10 -3
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +26 -38
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +0 -43
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +0 -64
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling.html.erb +0 -46
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_row_styling_rails.md +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.jsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column.md +0 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.jsx +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_per_column_for_multi_column.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +0 -107
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.md +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +0 -51
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown_mixin.scss +0 -36
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options.jsx +0 -90
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_active_style_options_react.md +0 -4
- data/app/pb_kits/playbook/pb_gauge/docs/_description.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_colors_react.md +0 -2
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_complex_react.md +0 -1
- data/app/pb_kits/playbook/pb_gauge/docs/_gauge_units_react.md +0 -1
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_colors_react.md +0 -3
- data/app/pb_kits/playbook/pb_line_graph/docs/_line_graph_height.md +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.html.erb +0 -75
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.jsx +0 -94
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_show_checked_children.md +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.html.erb +0 -10
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.jsx +0 -26
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_strict_mode.md +0 -3
- data/dist/chunks/_line_graph-D7DgMqnT.js +0 -1
- data/dist/chunks/_typeahead-BzYZCpJO.js +0 -6
- data/dist/chunks/_weekday_stacked-CCn-qLh_.js +0 -37
- data/dist/chunks/lib-CY5ZPzic.js +0 -29
- /data/app/pb_kits/playbook/pb_advanced_table/docs/{_advanced_table_row_styling_react.md → _advanced_table_row_styling.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_colors_rails.md → _gauge_colors.md} +0 -0
- /data/app/pb_kits/playbook/pb_gauge/docs/{_gauge_complex_rails.md → _gauge_complex.md} +0 -0
- /data/app/pb_kits/playbook/pb_line_graph/docs/{_line_graph_colors_rails.md → _line_graph_colors.md} +0 -0
@@ -143,8 +143,7 @@ export const recursiveCheckParent = (
|
|
143
143
|
|
144
144
|
export const getExpandedItems = (
|
145
145
|
treeData: { [key: string]: string }[],
|
146
|
-
selectedIds: string[]
|
147
|
-
showCheckedChildren = true
|
146
|
+
selectedIds: string[]
|
148
147
|
): any[] => {
|
149
148
|
const expandedItems: any[] = [];
|
150
149
|
|
@@ -153,27 +152,19 @@ export const getExpandedItems = (
|
|
153
152
|
const item = items[i];
|
154
153
|
const itemAncestors = [...ancestors, item];
|
155
154
|
|
156
|
-
// Always honor explicit expanded: true
|
157
155
|
if (item.expanded) {
|
158
156
|
expandedItems.push(item.id);
|
159
157
|
}
|
160
|
-
|
161
|
-
|
162
|
-
if (showCheckedChildren) {
|
163
|
-
if (selectedIds && selectedIds.length && selectedIds.includes(item.id)) {
|
164
|
-
expandedItems.push(...itemAncestors.map((ancestor: any) => ancestor.id));
|
165
|
-
}
|
166
|
-
if (Array.isArray(item.children)) {
|
167
|
-
const hasCheckedChildren = item.children.some(
|
168
|
-
(child: { [key: string]: string }) => child.checked
|
169
|
-
);
|
170
|
-
if (hasCheckedChildren) {
|
171
|
-
expandedItems.push(...itemAncestors.map((ancestor: any) => ancestor.id));
|
172
|
-
}
|
173
|
-
}
|
158
|
+
if (selectedIds && selectedIds.length && selectedIds.includes(item.id)) {
|
159
|
+
expandedItems.push(...itemAncestors.map((ancestor) => ancestor.id));
|
174
160
|
}
|
175
|
-
|
176
161
|
if (Array.isArray(item.children)) {
|
162
|
+
const hasCheckedChildren = item.children.some(
|
163
|
+
(child: { [key: string]: string }) => child.checked
|
164
|
+
);
|
165
|
+
if (hasCheckedChildren) {
|
166
|
+
expandedItems.push(...itemAncestors.map((ancestor) => ancestor.id));
|
167
|
+
}
|
177
168
|
traverse(item.children, itemAncestors);
|
178
169
|
}
|
179
170
|
}
|
@@ -47,7 +47,6 @@ type MultiLevelSelectProps = {
|
|
47
47
|
name?: string
|
48
48
|
required?: boolean
|
49
49
|
returnAllSelected?: boolean
|
50
|
-
showCheckedChildren?: boolean
|
51
50
|
treeData?: { [key: string]: string; }[] | any
|
52
51
|
onChange?: (event: { target: { name?: string; value: any } }) => void
|
53
52
|
onSelect?: (prop: { [key: string]: any }) => void
|
@@ -72,7 +71,6 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
72
71
|
label,
|
73
72
|
required = false,
|
74
73
|
returnAllSelected = false,
|
75
|
-
showCheckedChildren = true,
|
76
74
|
treeData,
|
77
75
|
onChange = () => null,
|
78
76
|
onSelect = () => null,
|
@@ -106,7 +104,7 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
106
104
|
// State for default return
|
107
105
|
const [defaultReturn, setDefaultReturn] = useState([]);
|
108
106
|
// Get expanded items from treeData
|
109
|
-
const initialExpandedItems = getExpandedItems(treeData, selectedIds
|
107
|
+
const initialExpandedItems = getExpandedItems(treeData, selectedIds);
|
110
108
|
// Initialize state with expanded items
|
111
109
|
const [expanded, setExpanded] = useState(initialExpandedItems);
|
112
110
|
|
@@ -13,4 +13,4 @@ export { default as MultiLevelSelectDisabledOptions } from './_multi_level_selec
|
|
13
13
|
export { default as MultiLevelSelectDisabledOptionsParent } from './_multi_level_select_disabled_options_parent.jsx'
|
14
14
|
export { default as MultiLevelSelectDisabledOptionsParentDefault } from './_multi_level_select_disabled_options_parent_default.jsx'
|
15
15
|
export { default as MultiLevelSelectDisabledOptionsDefault } from './_multi_level_select_disabled_options_default.jsx'
|
16
|
-
export { default as MultiLevelSelectLabel } from './_multi_level_select_label.jsx'
|
16
|
+
export { default as MultiLevelSelectLabel } from './_multi_level_select_label.jsx'
|
@@ -32,8 +32,6 @@ module Playbook
|
|
32
32
|
default: ""
|
33
33
|
prop :label, type: Playbook::Props::String,
|
34
34
|
default: ""
|
35
|
-
prop :show_checked_children, type: Playbook::Props::Boolean,
|
36
|
-
default: true
|
37
35
|
|
38
36
|
def classname
|
39
37
|
generate_classname("pb_multi_level_select")
|
@@ -56,7 +54,6 @@ module Playbook
|
|
56
54
|
variant: variant,
|
57
55
|
pillColor: pill_color,
|
58
56
|
wrapped: wrapped,
|
59
|
-
showCheckedChildren: show_checked_children,
|
60
57
|
}
|
61
58
|
end
|
62
59
|
end
|
@@ -3,6 +3,4 @@ Our Pagination kit depends on the <a href="https://github.com/mislav/will_pagina
|
|
3
3
|
|
4
4
|
Once you have perfomed the paginated query in your controller file you can use our kit (see code example below) instead of `<%= will_paginate @users %>` in your view file.
|
5
5
|
|
6
|
-
You need to add: <code>require "playbook/pagination_renderer"</code> in your apps controller file.
|
7
|
-
|
8
|
-
Note: If the total page count is 0 or 1, the Pagination kit will not be displayed as there aren't multiple pages to navigate.
|
6
|
+
You need to add: <code>require "playbook/pagination_renderer"</code> in your apps controller file.
|
@@ -1,3 +1 @@
|
|
1
|
-
The `range` prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the `range` prop.
|
2
|
-
|
3
|
-
Note: If the `total` pages prop is 0 or 1, the Pagination component will not be displayed, as there aren't multiple pages to navigate.
|
1
|
+
The `range` prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the `range` prop.
|
@@ -38,7 +38,6 @@ type PhoneNumberInputProps = {
|
|
38
38
|
required?: boolean,
|
39
39
|
value?: string,
|
40
40
|
formatAsYouType?: boolean,
|
41
|
-
strictMode?: boolean,
|
42
41
|
countrySearch?: boolean,
|
43
42
|
}
|
44
43
|
|
@@ -95,7 +94,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
95
94
|
preferredCountries = [],
|
96
95
|
value = "",
|
97
96
|
formatAsYouType = false,
|
98
|
-
strictMode = false,
|
99
97
|
countrySearch = false,
|
100
98
|
} = props
|
101
99
|
|
@@ -258,7 +256,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
|
|
258
256
|
countrySearch: countrySearch,
|
259
257
|
fixDropdownWidth: false,
|
260
258
|
formatAsYouType: formatAsYouType,
|
261
|
-
strictMode: strictMode,
|
262
259
|
hiddenInput: hiddenInputs ? () => ({
|
263
260
|
phone: `${name}_full`,
|
264
261
|
country: `${name}_country_code`,
|
@@ -10,7 +10,6 @@ examples:
|
|
10
10
|
- phone_number_input_clear_field: Clearing the Input Field
|
11
11
|
- phone_number_input_access_input_element: Accessing the Input Element
|
12
12
|
- phone_number_input_format: Format as You Type
|
13
|
-
- phone_number_input_strict_mode: Strict Mode
|
14
13
|
- phone_number_input_country_search: Country Search
|
15
14
|
|
16
15
|
rails:
|
@@ -21,6 +20,5 @@ examples:
|
|
21
20
|
- phone_number_input_exclude_countries: Exclude Countries
|
22
21
|
- phone_number_input_validation: Form Validation
|
23
22
|
- phone_number_input_format: Format as You Type
|
24
|
-
- phone_number_input_strict_mode: Strict Mode
|
25
23
|
- phone_number_input_hidden_inputs: Hidden Inputs
|
26
24
|
- phone_number_input_country_search: Country Search
|
@@ -7,5 +7,4 @@ export { default as PhoneNumberInputValidation } from './_phone_number_input_val
|
|
7
7
|
export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
|
8
8
|
export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
|
9
9
|
export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
|
10
|
-
export { default as PhoneNumberInputStrictMode } from './_phone_number_input_strict_mode'
|
11
10
|
export { default as PhoneNumberInputCountrySearch } from './_phone_number_input_country_search'
|
@@ -25,8 +25,6 @@ module Playbook
|
|
25
25
|
default: ""
|
26
26
|
prop :format_as_you_type, type: Playbook::Props::Boolean,
|
27
27
|
default: false
|
28
|
-
prop :strict_mode, type: Playbook::Props::Boolean,
|
29
|
-
default: false
|
30
28
|
prop :hidden_inputs, type: Playbook::Props::Boolean,
|
31
29
|
default: false
|
32
30
|
prop :country_search, type: Playbook::Props::Boolean,
|
@@ -43,7 +41,6 @@ module Playbook
|
|
43
41
|
disabled: disabled,
|
44
42
|
error: error,
|
45
43
|
formatAsYouType: format_as_you_type,
|
46
|
-
strictMode: strict_mode,
|
47
44
|
hiddenInputs: hidden_inputs,
|
48
45
|
initialCountry: initial_country,
|
49
46
|
label: label,
|
@@ -24,9 +24,7 @@ module Playbook
|
|
24
24
|
prop :validation_message, type: Playbook::Props::String, default: ""
|
25
25
|
|
26
26
|
def classnames
|
27
|
-
|
28
|
-
.reject(&:empty?)
|
29
|
-
.join(" ")
|
27
|
+
classname + inline_class + compact_class + show_arrow_class
|
30
28
|
end
|
31
29
|
|
32
30
|
def all_attributes
|
@@ -46,7 +44,7 @@ module Playbook
|
|
46
44
|
end
|
47
45
|
|
48
46
|
def inline_class
|
49
|
-
inline ? "inline" : ""
|
47
|
+
inline ? " inline " : " "
|
50
48
|
end
|
51
49
|
|
52
50
|
def compact_class
|
File without changes
|
@@ -0,0 +1,202 @@
|
|
1
|
+
/* eslint-disable react/no-multi-comp */
|
2
|
+
|
3
|
+
import React from 'react'
|
4
|
+
import classnames from 'classnames'
|
5
|
+
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
6
|
+
import { globalProps } from '../utilities/globalProps'
|
7
|
+
import Joyride, { TooltipRenderProps } from 'react-joyride'
|
8
|
+
import Button from '../pb_button/_button'
|
9
|
+
import Flex from '../pb_flex/_flex'
|
10
|
+
import SectionSeparator from '../pb_section_separator/_section_separator'
|
11
|
+
import Title from '../pb_title/_title'
|
12
|
+
|
13
|
+
type WalkthroughProps = {
|
14
|
+
aria?: { [key: string]: string },
|
15
|
+
callback?: () => void,
|
16
|
+
className?: string,
|
17
|
+
continuous?: boolean,
|
18
|
+
data?: { [key: string]: string },
|
19
|
+
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
20
|
+
id?: string,
|
21
|
+
run?: boolean,
|
22
|
+
steps?: [],
|
23
|
+
stepIndex?: number,
|
24
|
+
debug?: boolean,
|
25
|
+
disableCloseOnEsc?: boolean,
|
26
|
+
disableOverlay?: boolean,
|
27
|
+
disableOverlayClose?: boolean,
|
28
|
+
disableScrolling?: boolean,
|
29
|
+
floaterProps?: Record<string, unknown>,
|
30
|
+
hideBackButton?: boolean,
|
31
|
+
hideCloseButton?: boolean,
|
32
|
+
showProgress?: boolean,
|
33
|
+
showSkipButton?: boolean,
|
34
|
+
spotlightClicks?: boolean,
|
35
|
+
spotlightPadding?: number,
|
36
|
+
styles?: {
|
37
|
+
options: {
|
38
|
+
beaconSize?: number,
|
39
|
+
arrowColor?: string,
|
40
|
+
backgroundColor?: string,
|
41
|
+
primaryColor?: string,
|
42
|
+
overlayColor?: string,
|
43
|
+
spotlightShadow?: string,
|
44
|
+
width?: number,
|
45
|
+
zIndex?: number,
|
46
|
+
},
|
47
|
+
},
|
48
|
+
}
|
49
|
+
|
50
|
+
type TooltipProps = {
|
51
|
+
continuous?: boolean,
|
52
|
+
className?: string,
|
53
|
+
index?: number,
|
54
|
+
isLastStep?: boolean,
|
55
|
+
size?: number,
|
56
|
+
step: {
|
57
|
+
title?: string,
|
58
|
+
content?: React.ReactNode[] | React.ReactNode | string,
|
59
|
+
target: string,
|
60
|
+
disableBeacon?: boolean,
|
61
|
+
},
|
62
|
+
skip?: boolean,
|
63
|
+
backProps?: Record<string, unknown>,
|
64
|
+
closeProps?: Record<string, unknown>,
|
65
|
+
primaryProps?: Record<string, unknown>,
|
66
|
+
skipProps?: Record<string, unknown>,
|
67
|
+
tooltipProps?: Record<string, unknown>,
|
68
|
+
}
|
69
|
+
|
70
|
+
// eslint-disable-next-line react/display-name
|
71
|
+
const Tooltip = React.forwardRef((props: TooltipProps) => (
|
72
|
+
<div
|
73
|
+
className="pb_card_kit_border_none p_none"
|
74
|
+
{...props.tooltipProps}
|
75
|
+
>
|
76
|
+
{props.step.title && <div>
|
77
|
+
<Flex
|
78
|
+
align="center"
|
79
|
+
justify="between"
|
80
|
+
padding="xs"
|
81
|
+
>
|
82
|
+
<Title
|
83
|
+
paddingLeft="xs"
|
84
|
+
size={4}
|
85
|
+
>
|
86
|
+
{props.step.title}
|
87
|
+
</Title>
|
88
|
+
{props.skip && (
|
89
|
+
<Button
|
90
|
+
{...props.skipProps}
|
91
|
+
id="skip"
|
92
|
+
text="Skip Tour"
|
93
|
+
variant="link"
|
94
|
+
/>
|
95
|
+
)}
|
96
|
+
<Button
|
97
|
+
{...props.skipProps}
|
98
|
+
id="skip"
|
99
|
+
text="Skip Tour"
|
100
|
+
variant="link"
|
101
|
+
/>
|
102
|
+
</Flex>
|
103
|
+
<SectionSeparator />
|
104
|
+
</div>}
|
105
|
+
|
106
|
+
<Flex padding="sm">{props.step.content}</Flex>
|
107
|
+
<SectionSeparator />
|
108
|
+
<Flex
|
109
|
+
justify={props.index == 0 ? 'end' : 'between'}
|
110
|
+
padding="xs"
|
111
|
+
>
|
112
|
+
|
113
|
+
{props.index > 0 && (
|
114
|
+
<Button
|
115
|
+
{...props.backProps}
|
116
|
+
id="back"
|
117
|
+
text="Back"
|
118
|
+
/>
|
119
|
+
)}
|
120
|
+
|
121
|
+
{props.continuous && !props.isLastStep &&
|
122
|
+
<Button
|
123
|
+
{...props.primaryProps}
|
124
|
+
id="next"
|
125
|
+
text="Next"
|
126
|
+
/>
|
127
|
+
}
|
128
|
+
|
129
|
+
{!props.continuous &&
|
130
|
+
<Button
|
131
|
+
{...props.closeProps}
|
132
|
+
id="close"
|
133
|
+
text="Close"
|
134
|
+
/>
|
135
|
+
}
|
136
|
+
|
137
|
+
{!((props.continuous && !props.isLastStep) || (!props.continuous)) &&
|
138
|
+
<Button
|
139
|
+
{...props.closeProps}
|
140
|
+
id="close"
|
141
|
+
text="Close"
|
142
|
+
/>
|
143
|
+
}
|
144
|
+
</Flex>
|
145
|
+
</div>
|
146
|
+
)) as unknown as React.ForwardRefRenderFunction<HTMLDivElement, TooltipRenderProps>
|
147
|
+
|
148
|
+
const Walkthrough = (props: WalkthroughProps): React.ReactElement => {
|
149
|
+
const {
|
150
|
+
aria = {},
|
151
|
+
callback,
|
152
|
+
className,
|
153
|
+
continuous = false,
|
154
|
+
data = {},
|
155
|
+
disableOverlay,
|
156
|
+
floaterProps = {
|
157
|
+
offset: 50,
|
158
|
+
},
|
159
|
+
htmlOptions = {},
|
160
|
+
id,
|
161
|
+
run = false,
|
162
|
+
steps,
|
163
|
+
styles = {
|
164
|
+
options: {
|
165
|
+
zIndex: 20000,
|
166
|
+
},
|
167
|
+
},
|
168
|
+
showSkipButton,
|
169
|
+
} = props
|
170
|
+
|
171
|
+
const ariaProps = buildAriaProps(aria)
|
172
|
+
const dataProps = buildDataProps(data)
|
173
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
174
|
+
const classes = classnames(buildCss('pb_walkthrough'), globalProps(props), className)
|
175
|
+
|
176
|
+
return (
|
177
|
+
<div
|
178
|
+
{...ariaProps}
|
179
|
+
{...dataProps}
|
180
|
+
{...htmlProps}
|
181
|
+
className={classes}
|
182
|
+
id={id}
|
183
|
+
>
|
184
|
+
<Joyride
|
185
|
+
callback={callback}
|
186
|
+
continuous={continuous}
|
187
|
+
disableOverlay={disableOverlay}
|
188
|
+
disableScrolling
|
189
|
+
floaterProps={floaterProps}
|
190
|
+
run={run}
|
191
|
+
showSkipButton={showSkipButton}
|
192
|
+
steps={steps}
|
193
|
+
styles={styles}
|
194
|
+
tooltipComponent={Tooltip}
|
195
|
+
{...props}
|
196
|
+
/>
|
197
|
+
</div>
|
198
|
+
|
199
|
+
)
|
200
|
+
}
|
201
|
+
|
202
|
+
export default Walkthrough
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import Button from '../../pb_button/_button'
|
3
|
+
import Walkthrough from '../../pb_walkthrough/_walkthrough'
|
4
|
+
|
5
|
+
const WalkthroughContinuous = (props) => {
|
6
|
+
const [state, setState] = useState({
|
7
|
+
run: false,
|
8
|
+
steps: [
|
9
|
+
{
|
10
|
+
title: 'Example Title',
|
11
|
+
content: 'Setting the prop - continuous allows the next button to appear and lets the user move to the next step by pressing the next button instead of the beacon',
|
12
|
+
target: '.examplePaused',
|
13
|
+
},
|
14
|
+
{
|
15
|
+
title: 'Toggle',
|
16
|
+
content: 'Setting the prop - continuous allows the next button to appear and lets the user move to the next step by pressing the next button instead of the beacon',
|
17
|
+
target: '.pb_toggle_control',
|
18
|
+
},
|
19
|
+
{
|
20
|
+
title: 'Top Nav',
|
21
|
+
content: 'Setting the prop - continuous allows the next button to appear and lets the user move to the next step by pressing the next button instead of the beacon',
|
22
|
+
target: '.pb--page--topNav',
|
23
|
+
},
|
24
|
+
],
|
25
|
+
})
|
26
|
+
|
27
|
+
return (
|
28
|
+
<div>
|
29
|
+
<div
|
30
|
+
className="examplePaused"
|
31
|
+
style={{ 'display': 'inline' }}
|
32
|
+
>
|
33
|
+
{'Start the Tour. Then click the Beacon to demo the default behavior of the Walkthrough Kit'}
|
34
|
+
</div>
|
35
|
+
<br />
|
36
|
+
<br />
|
37
|
+
<Button
|
38
|
+
onClick={() => {
|
39
|
+
setState({ ...state,
|
40
|
+
run: true,
|
41
|
+
})
|
42
|
+
}}
|
43
|
+
>
|
44
|
+
{'Start Tour'}
|
45
|
+
</Button>
|
46
|
+
<br />
|
47
|
+
<br />
|
48
|
+
<Button
|
49
|
+
onClick={() => {
|
50
|
+
setState({
|
51
|
+
...state,
|
52
|
+
run: false,
|
53
|
+
})
|
54
|
+
}}
|
55
|
+
>
|
56
|
+
{'Reset/Stop Tour'}
|
57
|
+
</Button>
|
58
|
+
|
59
|
+
<Walkthrough
|
60
|
+
run={state.run}
|
61
|
+
steps={state.steps}
|
62
|
+
{...props}
|
63
|
+
continuous
|
64
|
+
/>
|
65
|
+
</div>
|
66
|
+
)
|
67
|
+
}
|
68
|
+
|
69
|
+
export default WalkthroughContinuous
|
@@ -0,0 +1,71 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import Button from '../../pb_button/_button'
|
3
|
+
import Walkthrough from '../../pb_walkthrough/_walkthrough'
|
4
|
+
|
5
|
+
const WalkthroughDefault = (props) => {
|
6
|
+
const [state, setState] = useState({
|
7
|
+
run: false,
|
8
|
+
steps: [
|
9
|
+
{
|
10
|
+
title: 'Example title',
|
11
|
+
content:
|
12
|
+
'This was an example of a Beacon in the Walkthrough Kit it is used as a simple indicator to inform users about a particular thing',
|
13
|
+
target: '.example',
|
14
|
+
},
|
15
|
+
{
|
16
|
+
title: 'Toggle',
|
17
|
+
content:
|
18
|
+
'By default the walkthrough kit will cycle through each step provided.',
|
19
|
+
target: '.pb_toggle_control',
|
20
|
+
},
|
21
|
+
{
|
22
|
+
title: 'Top Nav',
|
23
|
+
content:
|
24
|
+
'By default the walkthrough kit will cycle through each step provided.',
|
25
|
+
target: '.pb--page--topNav',
|
26
|
+
},
|
27
|
+
],
|
28
|
+
})
|
29
|
+
|
30
|
+
return (
|
31
|
+
<div>
|
32
|
+
<div
|
33
|
+
className="example"
|
34
|
+
style={{ 'display': 'inline' }}
|
35
|
+
>
|
36
|
+
{'Start the Tour. Then click the Beacon to demo the default behavior of the Walkthrough Kit'}
|
37
|
+
</div>
|
38
|
+
<br />
|
39
|
+
<br />
|
40
|
+
<Button
|
41
|
+
onClick={() => {
|
42
|
+
setState({ ...state,
|
43
|
+
run: true,
|
44
|
+
})
|
45
|
+
}}
|
46
|
+
>
|
47
|
+
{'Start Tour'}
|
48
|
+
</Button>
|
49
|
+
<br />
|
50
|
+
<br />
|
51
|
+
<Button
|
52
|
+
onClick={() => {
|
53
|
+
setState({
|
54
|
+
...state,
|
55
|
+
run: false,
|
56
|
+
})
|
57
|
+
}}
|
58
|
+
>
|
59
|
+
{'Reset/Stop Tour'}
|
60
|
+
</Button>
|
61
|
+
|
62
|
+
<Walkthrough
|
63
|
+
run={state.run}
|
64
|
+
steps={state.steps}
|
65
|
+
{...props}
|
66
|
+
/>
|
67
|
+
</div>
|
68
|
+
)
|
69
|
+
}
|
70
|
+
|
71
|
+
export default WalkthroughDefault
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import Button from '../../pb_button/_button'
|
3
|
+
import Walkthrough from '../../pb_walkthrough/_walkthrough'
|
4
|
+
|
5
|
+
const WalkthroughMultiBeacon = (props) => {
|
6
|
+
const [stateA, setStateA] = useState({
|
7
|
+
run: false,
|
8
|
+
steps: [
|
9
|
+
{
|
10
|
+
title: 'Example title',
|
11
|
+
content:
|
12
|
+
'This was an example of a Beacon in the Walkthrough Kit it is used as a simple indicator to inform users about a particular thing',
|
13
|
+
target: '.exampleMulti',
|
14
|
+
},
|
15
|
+
],
|
16
|
+
})
|
17
|
+
|
18
|
+
const [stateB, setStateB] = useState({
|
19
|
+
run: false,
|
20
|
+
steps: [
|
21
|
+
{
|
22
|
+
title: 'Toggle',
|
23
|
+
content:
|
24
|
+
'By default the walkthrough kit will cycle through each step provided.',
|
25
|
+
target: '.pb_toggle_control',
|
26
|
+
},
|
27
|
+
],
|
28
|
+
})
|
29
|
+
|
30
|
+
const [stateC, setStateC] = useState({
|
31
|
+
run: false,
|
32
|
+
steps: [
|
33
|
+
{
|
34
|
+
title: 'Top Nav',
|
35
|
+
content:
|
36
|
+
'By default the walkthrough kit will cycle through each step provided.',
|
37
|
+
target: '.pb--page--topNav',
|
38
|
+
},
|
39
|
+
],
|
40
|
+
})
|
41
|
+
|
42
|
+
return (
|
43
|
+
<div>
|
44
|
+
<div
|
45
|
+
className="exampleMulti"
|
46
|
+
style={{ 'display': 'inline' }}
|
47
|
+
>
|
48
|
+
{'Start the Tour. Then click the Beacon to demo the default behavior of the Walkthrough Kit'}
|
49
|
+
</div>
|
50
|
+
<br />
|
51
|
+
<br />
|
52
|
+
<Button
|
53
|
+
onClick={() => {
|
54
|
+
setStateA({
|
55
|
+
...stateA,
|
56
|
+
run: true,
|
57
|
+
})
|
58
|
+
setStateB({
|
59
|
+
...stateB,
|
60
|
+
run: true,
|
61
|
+
})
|
62
|
+
setStateC({
|
63
|
+
...stateC,
|
64
|
+
run: true,
|
65
|
+
})
|
66
|
+
}}
|
67
|
+
>
|
68
|
+
{'Start Tour'}
|
69
|
+
</Button>
|
70
|
+
<br />
|
71
|
+
<br />
|
72
|
+
<Button
|
73
|
+
onClick={() => {
|
74
|
+
setStateA({
|
75
|
+
...stateA,
|
76
|
+
run: false,
|
77
|
+
})
|
78
|
+
setStateB({
|
79
|
+
...stateB,
|
80
|
+
run: false,
|
81
|
+
})
|
82
|
+
setStateC({
|
83
|
+
...stateC,
|
84
|
+
run: false,
|
85
|
+
})
|
86
|
+
}}
|
87
|
+
>
|
88
|
+
{'Reset/Stop Tour'}
|
89
|
+
</Button>
|
90
|
+
|
91
|
+
<Walkthrough
|
92
|
+
run={stateA.run}
|
93
|
+
steps={stateA.steps}
|
94
|
+
{...props}
|
95
|
+
/>
|
96
|
+
<Walkthrough
|
97
|
+
run={stateB.run}
|
98
|
+
steps={stateB.steps}
|
99
|
+
{...props}
|
100
|
+
/>
|
101
|
+
<Walkthrough
|
102
|
+
run={stateC.run}
|
103
|
+
steps={stateC.steps}
|
104
|
+
{...props}
|
105
|
+
/>
|
106
|
+
</div>
|
107
|
+
)
|
108
|
+
}
|
109
|
+
|
110
|
+
export default WalkthroughMultiBeacon
|