playbook_ui 14.15.0.pre.alpha.play1917lodashremoval2of36615 → 14.15.0.pre.rc.0
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/Context/AdvancedTableContext.tsx +3 -143
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +99 -45
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +7 -123
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +299 -153
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -2
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -4
- data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +0 -2
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +6 -5
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +0 -2
- data/app/pb_kits/playbook/pb_drawer/_drawer.scss +3 -43
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -3
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +37 -20
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +1 -20
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +6 -6
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +12 -20
- data/app/pb_kits/playbook/pb_drawer/drawer.rb +1 -49
- data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +4 -5
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +1 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +2 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +2 -9
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +0 -4
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -7
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slide.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Slides.tsx +1 -1
- data/app/pb_kits/playbook/pb_lightbox/Carousel/Thumbnails.tsx +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +0 -7
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +3 -13
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +0 -6
- data/app/pb_kits/playbook/pb_overlay/_overlay.scss +0 -13
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +1 -7
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +3 -5
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +1 -16
- data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +0 -12
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +2 -2
- data/app/pb_kits/playbook/pb_popover/popover.test.js +1 -1
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +74 -85
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_radio/radio.test.js +0 -16
- data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_select/select.html.erb +5 -3
- data/app/pb_kits/playbook/pb_select/select.rb +0 -8
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +5 -1
- data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +4 -1
- data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +5 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +3 -2
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -2
- data/app/pb_kits/playbook/pb_title/_title.scss +0 -32
- data/app/pb_kits/playbook/pb_title/_title.tsx +1 -10
- data/app/pb_kits/playbook/pb_title/docs/_title_default.html.erb +2 -1
- data/app/pb_kits/playbook/pb_title/docs/_title_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_title/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_title/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_title/title.rb +1 -10
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +3 -0
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +0 -25
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb +10 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +1 -4
- data/app/pb_kits/playbook/pb_tooltip/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_tooltip/index.js +1 -1
- data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +2 -10
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +5 -51
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_typeahead/index.ts +8 -61
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +2 -17
- data/app/pb_kits/playbook/utilities/object.ts +1 -103
- data/app/pb_kits/playbook/utilities/text.ts +1 -1
- data/dist/chunks/_typeahead-PqkcDf1H.js +36 -0
- data/dist/chunks/_weekday_stacked-BrSrpj7J.js +45 -0
- data/dist/chunks/{lib-e7oBFFDo.js → lib-D3us1bGD.js} +2 -2
- data/dist/chunks/{pb_form_validation-CMXevI1t.js → pb_form_validation-BpihMSOQ.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +2 -2
- data/dist/playbook-doc.js +1 -1
- 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 +2 -2
- metadata +7 -61
- data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +0 -127
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +0 -55
- data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +0 -275
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +0 -66
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +0 -195
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +0 -73
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +0 -52
- data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +0 -80
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +0 -50
- data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_infinite_scroll.json +0 -152002
- data/app/pb_kits/playbook/pb_date_picker/index.ts +0 -38
- data/app/pb_kits/playbook/pb_dialog/index.js +0 -75
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +0 -8
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +0 -33
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +0 -24
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +0 -21
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +0 -1
- data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +0 -49
- data/app/pb_kits/playbook/pb_drawer/index.js +0 -257
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.html.erb +0 -40
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +0 -50
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.md +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +0 -72
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +0 -91
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.html.erb +0 -11
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.jsx +0 -37
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_rails.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_react.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +0 -11
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +0 -1
- data/app/pb_kits/playbook/pb_overlay/index.js +0 -61
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +0 -60
- data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +0 -1
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +0 -58
- data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.md +0 -1
- data/app/pb_kits/playbook/pb_select/index.js +0 -38
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.html.erb +0 -7
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.jsx +0 -54
- data/app/pb_kits/playbook/pb_title/docs/_title_display_size.md +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +0 -39
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +0 -3
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon_rails.html.erb +0 -22
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +0 -26
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +0 -69
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.md +0 -3
- data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +0 -282
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb +0 -45
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md +0 -5
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb +0 -33
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.md +0 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +0 -66
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.md +0 -1
- data/app/pb_kits/playbook/utilities/object.test.js +0 -237
- data/dist/chunks/_typeahead-CdVbIURO.js +0 -36
- data/dist/chunks/_weekday_stacked-BSTKfYPJ.js +0 -45
@@ -5,7 +5,6 @@ examples:
|
|
5
5
|
- title_colors: Colors
|
6
6
|
- title_responsive: Responsive
|
7
7
|
- title_truncate: Truncate
|
8
|
-
- title_display_size: Display Size
|
9
8
|
|
10
9
|
react:
|
11
10
|
- title_default: Default UI
|
@@ -13,4 +12,3 @@ examples:
|
|
13
12
|
- title_colors: Colors
|
14
13
|
- title_responsive: Responsive
|
15
14
|
- title_truncate: Truncate
|
16
|
-
- title_display_size: Display Size
|
@@ -3,4 +3,3 @@ export { default as TitleLightWeight } from './_title_light_weight.jsx'
|
|
3
3
|
export { default as TitleColors } from './_title_colors.jsx'
|
4
4
|
export { default as TitleResponsive } from './_title_responsive.jsx'
|
5
5
|
export { default as TitleTruncate } from './_title_truncate.jsx'
|
6
|
-
export { default as TitleDisplaySize } from './_title_display_size.jsx'
|
@@ -16,15 +16,12 @@ module Playbook
|
|
16
16
|
default: nil,
|
17
17
|
deprecated: true
|
18
18
|
prop :bold, type: Playbook::Props::Boolean, default: true
|
19
|
-
prop :display_size, type: Playbook::Props::Enum,
|
20
|
-
values: [nil, "xs", "sm", "md", "lg", "xl", "xxl"],
|
21
|
-
default: nil
|
22
19
|
|
23
20
|
def classname
|
24
21
|
if is_size_responsive
|
25
22
|
generate_classname("pb_title_kit", variant, color, is_bold) + generate_responsive_size_classname
|
26
23
|
else
|
27
|
-
generate_classname("pb_title_kit", size, variant, color, is_bold)
|
24
|
+
generate_classname("pb_title_kit", size, variant, color, is_bold)
|
28
25
|
end
|
29
26
|
end
|
30
27
|
|
@@ -32,12 +29,6 @@ module Playbook
|
|
32
29
|
bold ? nil : "thin"
|
33
30
|
end
|
34
31
|
|
35
|
-
def generate_display_size
|
36
|
-
return "" if display_size.nil?
|
37
|
-
|
38
|
-
" pb_title_kit_dynamic_#{display_size}"
|
39
|
-
end
|
40
|
-
|
41
32
|
def is_size_responsive
|
42
33
|
try(:size).is_a?(::Hash)
|
43
34
|
end
|
@@ -141,6 +141,7 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
141
141
|
|
142
142
|
&[data-popper-placement="right"] {
|
143
143
|
box-shadow: -8px 0 28px 0 $tooltip_shadow;
|
144
|
+
margin: 0 0 0 $space_sm;
|
144
145
|
.arrow {
|
145
146
|
left: -18px;
|
146
147
|
right: auto;
|
@@ -155,6 +156,7 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
155
156
|
|
156
157
|
&[data-popper-placement="bottom"] {
|
157
158
|
box-shadow: 0 -12px 28px 0 $tooltip_shadow;
|
159
|
+
margin: $space_sm 0 0 0;
|
158
160
|
.arrow {
|
159
161
|
top: -18px;
|
160
162
|
margin-bottom: 0;
|
@@ -167,6 +169,7 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
|
|
167
169
|
|
168
170
|
&[data-popper-placement="left"] {
|
169
171
|
box-shadow: 8px 0 28px 0 $tooltip_shadow;
|
172
|
+
margin: 0 $space_sm 0 0;
|
170
173
|
.arrow {
|
171
174
|
margin-bottom: 0;
|
172
175
|
right: -18px;
|
@@ -25,18 +25,12 @@ type TooltipProps = {
|
|
25
25
|
children: JSX.Element,
|
26
26
|
data?: { [key: string]: string },
|
27
27
|
delay?: number | Partial<{open: number; close: number}>,
|
28
|
-
height?: string,
|
29
28
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
30
29
|
icon?: string,
|
31
30
|
interaction?: boolean,
|
32
|
-
maxHeight?: string,
|
33
|
-
maxWidth?: string,
|
34
|
-
minHeight?: string,
|
35
|
-
minWidth?: string,
|
36
31
|
placement?: Placement,
|
37
32
|
position?: "absolute" | "fixed";
|
38
33
|
text: string,
|
39
|
-
width: string,
|
40
34
|
showTooltip?: boolean,
|
41
35
|
forceOpenTooltip?: boolean,
|
42
36
|
} & GlobalProps
|
@@ -48,19 +42,13 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
48
42
|
children,
|
49
43
|
data = {},
|
50
44
|
delay = 0,
|
51
|
-
height,
|
52
45
|
htmlOptions = {},
|
53
46
|
icon = null,
|
54
47
|
interaction = false,
|
55
|
-
maxHeight,
|
56
|
-
maxWidth,
|
57
|
-
minHeight,
|
58
|
-
minWidth,
|
59
48
|
placement: preferredPlacement = "top",
|
60
49
|
position = "absolute",
|
61
50
|
text,
|
62
51
|
showTooltip = true,
|
63
|
-
width,
|
64
52
|
zIndex,
|
65
53
|
forceOpenTooltip = false,
|
66
54
|
...rest
|
@@ -127,18 +115,6 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
127
115
|
top: "bottom",
|
128
116
|
}[placement.split("-")[0]]
|
129
117
|
|
130
|
-
const tooltipSizing = () => {
|
131
|
-
return Object.assign(
|
132
|
-
{},
|
133
|
-
height ? { height: height } : {},
|
134
|
-
maxHeight ? { maxHeight: maxHeight } : {},
|
135
|
-
maxWidth ? { maxWidth: maxWidth } : {},
|
136
|
-
minHeight ? { minHeight: minHeight } : {},
|
137
|
-
minWidth ? { minWidth: minWidth } : {},
|
138
|
-
width ? { width: width } : {}
|
139
|
-
);
|
140
|
-
};
|
141
|
-
|
142
118
|
return (
|
143
119
|
<>
|
144
120
|
<div
|
@@ -168,7 +144,6 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
|
|
168
144
|
ref: refs.setFloating,
|
169
145
|
role: "tooltip",
|
170
146
|
style: {
|
171
|
-
...tooltipSizing(),
|
172
147
|
position: strategy,
|
173
148
|
top: y ?? 0,
|
174
149
|
left: x ?? 0,
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= pb_rails("icon_circle", props: { icon: "paper-plane", id: "result-1-sample-email-link" }) %>
|
2
|
+
|
3
|
+
<%= pb_rails("tooltip", props: {
|
4
|
+
trigger_element_id: "result-1-sample-email-link",
|
5
|
+
tooltip_id: "sample-email-tooltip-result-1",
|
6
|
+
position: "top",
|
7
|
+
dark: true
|
8
|
+
}) do %>
|
9
|
+
Send Email
|
10
|
+
<% end %>
|
@@ -2,18 +2,15 @@ examples:
|
|
2
2
|
|
3
3
|
rails:
|
4
4
|
- tooltip_default: Default
|
5
|
-
- tooltip_interaction: Content Interaction
|
6
5
|
- tooltip_selectors: Using Common Selectors
|
7
|
-
- tooltip_icon_rails: Tooltip with Icon
|
8
6
|
- tooltip_with_icon_circle: Icon Circle Tooltip
|
9
|
-
- tooltip_delay_rails: Delay
|
10
7
|
- tooltip_show_tooltip: Show Tooltip
|
11
8
|
|
12
9
|
react:
|
13
10
|
- tooltip_default_react: Default
|
14
11
|
- tooltip_interaction: Content Interaction
|
15
12
|
- tooltip_margin: Margin
|
16
|
-
- tooltip_sizing: Tooltip Sizing
|
17
13
|
- tooltip_icon: Tooltip with Icon
|
18
14
|
- tooltip_delay: Delay
|
19
15
|
- tooltip_show_tooltip_react: Show Tooltip
|
16
|
+
|
@@ -1,7 +1,6 @@
|
|
1
1
|
export { default as TooltipDefaultReact } from './_tooltip_default_react'
|
2
2
|
export { default as TooltipInteraction } from './_tooltip_interaction'
|
3
3
|
export { default as TooltipMargin } from './_tooltip_margin'
|
4
|
-
export { default as TooltipSizing } from './_tooltip_sizing'
|
5
4
|
export { default as TooltipIcon } from './_tooltip_icon'
|
6
5
|
export { default as TooltipDelay } from './_tooltip_delay'
|
7
6
|
export { default as TooltipShowTooltipReact } from './_tooltip_show_tooltip_react'
|
@@ -11,7 +11,7 @@ const TOOLTIP_TIMEOUT = 250
|
|
11
11
|
|
12
12
|
export default class PbTooltip extends PbEnhancedElement {
|
13
13
|
static get selector() {
|
14
|
-
return '[data-pb-tooltip-kit
|
14
|
+
return '[data-pb-tooltip-kit]'
|
15
15
|
}
|
16
16
|
|
17
17
|
connect() {
|
@@ -7,10 +7,6 @@ module Playbook
|
|
7
7
|
prop :trigger_element_selector
|
8
8
|
prop :trigger_element_id, deprecated: true
|
9
9
|
prop :tooltip_id
|
10
|
-
prop :interaction, type: Playbook::Props::Boolean,
|
11
|
-
default: false
|
12
|
-
prop :delay_open
|
13
|
-
prop :delay_close
|
14
10
|
prop :dark, type: Playbook::Props::Boolean,
|
15
11
|
default: false
|
16
12
|
prop :trigger_method, type: Playbook::Props::Enum,
|
@@ -22,19 +18,15 @@ module Playbook
|
|
22
18
|
end
|
23
19
|
|
24
20
|
def data
|
25
|
-
|
21
|
+
Hash(values[:data]).merge(
|
26
22
|
pb_tooltip_kit: true,
|
27
23
|
pb_tooltip_position: position,
|
28
24
|
pb_tooltip_trigger_element_selector: trigger_element_selector,
|
29
25
|
pb_tooltip_trigger_element_id: trigger_element_id,
|
30
26
|
pb_tooltip_tooltip_id: tooltip_id,
|
31
27
|
pb_tooltip_show_tooltip: true,
|
32
|
-
pb_tooltip_trigger_method: trigger_method
|
33
|
-
pb_tooltip_interaction: interaction
|
28
|
+
pb_tooltip_trigger_method: trigger_method
|
34
29
|
)
|
35
|
-
data = data.merge(pb_tooltip_delay_open: delay_open) if delay_open
|
36
|
-
data = data.merge(pb_tooltip_delay_close: delay_close) if delay_close
|
37
|
-
data
|
38
30
|
end
|
39
31
|
|
40
32
|
private
|
@@ -10,7 +10,7 @@ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
|
10
10
|
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
11
11
|
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
12
12
|
import treemap from 'highcharts/modules/treemap'
|
13
|
-
import { merge } from '
|
13
|
+
import { merge } from 'lodash'
|
14
14
|
|
15
15
|
type TreemapChartProps = {
|
16
16
|
chartData: {
|
@@ -1,10 +1,9 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react'
|
2
2
|
import Select from 'react-select'
|
3
3
|
import AsyncSelect from 'react-select/async'
|
4
4
|
import CreateableSelect from 'react-select/creatable'
|
5
5
|
import AsyncCreateableSelect from 'react-select/async-creatable'
|
6
|
-
import { get, isString, uniqueId } from '
|
7
|
-
|
6
|
+
import { get, isString, uniqueId } from 'lodash'
|
8
7
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
9
8
|
import classnames from 'classnames'
|
10
9
|
|
@@ -46,13 +45,8 @@ type TypeaheadProps = {
|
|
46
45
|
getOptionLabel?: string | (() => string),
|
47
46
|
getOptionValue?: string | (() => string),
|
48
47
|
name?: string,
|
49
|
-
options?: Array<{ label: string; value?: string }>,
|
50
48
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
51
49
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
52
|
-
onChange?: any,
|
53
|
-
optionsByContext?: Record<string, Array<{ label: string; value?: string }>>
|
54
|
-
searchContextSelector?: string,
|
55
|
-
clearOnContextChange?: boolean,
|
56
50
|
} & GlobalProps
|
57
51
|
|
58
52
|
export type SelectValueType = {
|
@@ -72,7 +66,8 @@ type TagOnChangeValues = {
|
|
72
66
|
* @constant {React.ReactComponent} Typeahead
|
73
67
|
* @param {TypeaheadProps} props - props as described at https://react-select.com/props
|
74
68
|
*/
|
75
|
-
|
69
|
+
|
70
|
+
const Typeahead = ({
|
76
71
|
async,
|
77
72
|
className,
|
78
73
|
components = {},
|
@@ -83,14 +78,9 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
83
78
|
getOptionValue,
|
84
79
|
htmlOptions = {},
|
85
80
|
id,
|
86
|
-
name,
|
87
81
|
loadOptions = noop,
|
88
82
|
marginBottom = "sm",
|
89
83
|
pillColor,
|
90
|
-
onChange,
|
91
|
-
optionsByContext = {},
|
92
|
-
searchContextSelector,
|
93
|
-
clearOnContextChange = false,
|
94
84
|
...props
|
95
85
|
}: TypeaheadProps) => {
|
96
86
|
const selectProps = {
|
@@ -125,32 +115,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
125
115
|
...props,
|
126
116
|
}
|
127
117
|
|
128
|
-
const [contextValue, setContextValue] = useState("")
|
129
|
-
|
130
|
-
useEffect(() => {
|
131
|
-
if (searchContextSelector) {
|
132
|
-
const searchContextElement = document.getElementById(searchContextSelector)
|
133
|
-
|
134
|
-
setContextValue((searchContextElement as HTMLInputElement)?.value)
|
135
|
-
const handleContextChange = (e: Event) => {
|
136
|
-
const target = e.target as HTMLInputElement;
|
137
|
-
setContextValue(target.value);
|
138
|
-
if (clearOnContextChange) document.dispatchEvent(new CustomEvent(`pb-typeahead-kit-${selectProps.id}:clear`))
|
139
|
-
}
|
140
|
-
|
141
|
-
if (searchContextElement) searchContextElement.addEventListener('change', handleContextChange)
|
142
|
-
|
143
|
-
return () => {
|
144
|
-
if (searchContextElement) searchContextElement.removeEventListener('change', handleContextChange)
|
145
|
-
}
|
146
|
-
}
|
147
|
-
}, [searchContextSelector])
|
148
|
-
|
149
|
-
const contextArray = optionsByContext[contextValue]
|
150
|
-
if (Array.isArray(contextArray) && contextArray.length > 0) {
|
151
|
-
selectProps.options = contextArray
|
152
|
-
}
|
153
|
-
|
154
118
|
const Tag = (
|
155
119
|
createable
|
156
120
|
? (async ? AsyncCreateableSelect : CreateableSelect)
|
@@ -158,15 +122,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
158
122
|
)
|
159
123
|
|
160
124
|
const handleOnChange = (_data: SelectValueType, { action, option, removedValue }: TagOnChangeValues) => {
|
161
|
-
if (onChange) {
|
162
|
-
const isReactHookForm = onChange.toString().includes("target")
|
163
|
-
if (isReactHookForm) {
|
164
|
-
onChange({ target: { name, value: _data } })
|
165
|
-
} else {
|
166
|
-
onChange(_data)
|
167
|
-
}
|
168
|
-
}
|
169
|
-
|
170
125
|
if (action === 'select-option') {
|
171
126
|
if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
|
172
127
|
const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
|
@@ -210,11 +165,10 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
210
165
|
/>
|
211
166
|
</div>
|
212
167
|
)
|
213
|
-
}
|
168
|
+
}
|
214
169
|
|
215
170
|
Object.keys(kitComponents).forEach((k) => {
|
216
171
|
(Typeahead as GenericObject)[k] = (kitComponents as {[key: string]: unknown})[k]
|
217
172
|
})
|
218
173
|
|
219
|
-
Typeahead.displayName = 'Typeahead'
|
220
174
|
export default Typeahead
|
@@ -8,17 +8,15 @@ import { SelectValueType } from '../_typeahead'
|
|
8
8
|
type Props = {
|
9
9
|
data: SelectValueType,
|
10
10
|
multiValueTemplate: any,
|
11
|
-
wrapped?: boolean,
|
12
11
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
13
12
|
removeProps: any,
|
14
13
|
selectProps: any,
|
15
14
|
}
|
16
15
|
|
17
|
-
|
18
16
|
const MultiValue = (props: Props) => {
|
19
17
|
const { removeProps } = props
|
20
18
|
const { imageUrl, label } = props.data
|
21
|
-
const { dark, multiKit, pillColor, truncate
|
19
|
+
const { dark, multiKit, pillColor, truncate } = props.selectProps
|
22
20
|
|
23
21
|
const formPillProps = {
|
24
22
|
marginRight: 'xs',
|
@@ -54,7 +52,6 @@ const MultiValue = (props: Props) => {
|
|
54
52
|
size={multiKit === 'smallPill' ? 'small' : ''}
|
55
53
|
text=''
|
56
54
|
truncate={truncate}
|
57
|
-
wrapped={wrapped}
|
58
55
|
{...props}
|
59
56
|
/>
|
60
57
|
}
|
@@ -69,7 +66,6 @@ const MultiValue = (props: Props) => {
|
|
69
66
|
size={multiKit === 'smallPill' ? 'small' : ''}
|
70
67
|
text={label}
|
71
68
|
truncate={truncate}
|
72
|
-
wrapped={wrapped}
|
73
69
|
{...props}
|
74
70
|
/>
|
75
71
|
}
|
@@ -49,7 +49,7 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
|
|
49
49
|
* @summary - for doc example purposes only
|
50
50
|
*/
|
51
51
|
const handleOnMultiValueClick = (value) => {
|
52
|
-
alert(`You
|
52
|
+
alert(`You removed the user: "${value.label}"`)
|
53
53
|
}
|
54
54
|
|
55
55
|
return (
|
@@ -56,7 +56,7 @@ const TypeaheadWithPillsAsyncUsers = (props) => {
|
|
56
56
|
* @summary - for doc example purposes only
|
57
57
|
*/
|
58
58
|
const handleOnMultiValueClick = (value) => {
|
59
|
-
alert(`You
|
59
|
+
alert(`You removed the user: "${value.label}"`)
|
60
60
|
}
|
61
61
|
|
62
62
|
return (
|
@@ -12,12 +12,9 @@ examples:
|
|
12
12
|
- typeahead_margin_bottom: Margin Bottom
|
13
13
|
- typeahead_with_pills_color: With Pills (Custom Color)
|
14
14
|
- typeahead_truncated_text: Truncated Text
|
15
|
-
- typeahead_dynamic_options: Dynamic Options
|
16
|
-
- typeahead_dynamic_options_pure_rails: Dynamic Options (Pure Rails)
|
17
15
|
|
18
16
|
react:
|
19
17
|
- typeahead_default: Default
|
20
|
-
- typeahead_react_hook: React Hook
|
21
18
|
- typeahead_with_highlight: With Highlight
|
22
19
|
- typeahead_with_pills: With Pills
|
23
20
|
- typeahead_with_pills_async: With Pills (Async Data)
|
@@ -13,4 +13,3 @@ export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_lis
|
|
13
13
|
export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
|
14
14
|
export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
|
15
15
|
export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
|
16
|
-
export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
|
@@ -20,34 +20,6 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
20
20
|
this.searchInput.addEventListener('focus', () => this.debouncedSearch())
|
21
21
|
this.searchInput.addEventListener('input', () => this.debouncedSearch())
|
22
22
|
this.resultsElement.addEventListener('click', (event: MouseEvent) => this.optionSelected(event))
|
23
|
-
|
24
|
-
if (this.clearOnContextChange && this.searchContextElement) {
|
25
|
-
this.searchContextElement.addEventListener('change', () => {
|
26
|
-
this.searchInputClear()
|
27
|
-
this.resultsCacheClear()
|
28
|
-
this.clearResults()
|
29
|
-
})
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
get optionsByContext() {
|
34
|
-
return (this.element as HTMLElement).dataset.pbTypeaheadKitOptionsByContext
|
35
|
-
? JSON.parse((this.element as HTMLElement).dataset.pbTypeaheadKitOptionsByContext)
|
36
|
-
: null
|
37
|
-
}
|
38
|
-
|
39
|
-
get searchContextElement() {
|
40
|
-
const selector = (this.element as HTMLElement).dataset.pbTypeaheadKitSearchContextSelector
|
41
|
-
if (!selector) return null
|
42
|
-
|
43
|
-
const found = this.element.parentNode?.querySelector(`#${selector}`)
|
44
|
-
|| this.element.closest(selector)
|
45
|
-
|
46
|
-
return found || null
|
47
|
-
}
|
48
|
-
|
49
|
-
get clearOnContextChange() {
|
50
|
-
return (this.element as HTMLElement).dataset.pbTypeaheadKitClearOnContextChange === 'true'
|
51
23
|
}
|
52
24
|
|
53
25
|
handleKeydown(event: KeyboardEvent) {
|
@@ -68,32 +40,14 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
68
40
|
|
69
41
|
const searchTerm = this.searchTerm
|
70
42
|
const searchContext = this.searchContext
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
&& obj.label.toLowerCase().includes(searchTerm.toLowerCase())
|
78
|
-
})
|
79
|
-
|
80
|
-
const optionFragments = filteredResults.map((obj: { label: string, value: string }) => {
|
81
|
-
const singleOption = document.createDocumentFragment()
|
82
|
-
singleOption.appendChild(document.createTextNode(obj.label))
|
83
|
-
return singleOption
|
84
|
-
})
|
85
|
-
|
86
|
-
this.resultsCacheUpdate(searchTerm, searchContext, optionFragments)
|
87
|
-
} else {
|
88
|
-
const search = {
|
89
|
-
searchingFor: searchTerm,
|
90
|
-
searchingContext: searchContext,
|
91
|
-
setResults: (results: Array<DocumentFragment>) => {
|
92
|
-
this.resultsCacheUpdate(searchTerm, searchContext, results)
|
93
|
-
},
|
94
|
-
}
|
95
|
-
this.element.dispatchEvent(new CustomEvent('pb-typeahead-kit-search', { bubbles: true, detail: search }))
|
43
|
+
const search = {
|
44
|
+
searchingFor: searchTerm,
|
45
|
+
searchingContext: searchContext,
|
46
|
+
setResults: (results: Array<DocumentFragment>) => {
|
47
|
+
this.resultsCacheUpdate(searchTerm, searchContext, results)
|
48
|
+
},
|
96
49
|
}
|
50
|
+
this.element.dispatchEvent(new CustomEvent('pb-typeahead-kit-search', { bubbles: true, detail: search }))
|
97
51
|
}
|
98
52
|
|
99
53
|
resultsCacheUpdate(searchTerm: string, searchContext: string, results: Array<DocumentFragment>) {
|
@@ -133,15 +87,11 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
133
87
|
const resultOption = (event.target as Element).closest('[data-result-option-item]')
|
134
88
|
if (!resultOption) return
|
135
89
|
|
136
|
-
const selectedText = resultOption.textContent.trim()
|
137
|
-
|
138
90
|
this._validSelection = true
|
139
91
|
this.removeValidationError()
|
140
92
|
|
141
|
-
if (this.searchContextElement) this.searchInput.value = selectedText
|
142
|
-
|
143
93
|
this.resultsCacheClear()
|
144
|
-
|
94
|
+
this.searchInputClear()
|
145
95
|
this.clearResults()
|
146
96
|
|
147
97
|
this.element.dispatchEvent(new CustomEvent('pb-typeahead-kit-result-option-selected', { bubbles: true, detail: { selected: resultOption, typeahead: this } }))
|
@@ -223,9 +173,6 @@ export default class PbTypeahead extends PbEnhancedElement {
|
|
223
173
|
this.element.parentNode.querySelector(selector) ||
|
224
174
|
this.element.closest(selector)
|
225
175
|
) as HTMLInputElement).value
|
226
|
-
else if (this.searchContextElement) {
|
227
|
-
return (this.searchContextElement as HTMLInputElement).value
|
228
|
-
}
|
229
176
|
|
230
177
|
return null
|
231
178
|
}
|
@@ -44,14 +44,6 @@ module Playbook
|
|
44
44
|
default: false
|
45
45
|
prop :validation, type: Playbook::Props::HashProp,
|
46
46
|
default: {}
|
47
|
-
prop :wrapped, type: Playbook::Props::Boolean,
|
48
|
-
default: false
|
49
|
-
prop :clear_on_context_change, type: Playbook::Props::Boolean,
|
50
|
-
default: true
|
51
|
-
prop :options_by_context, type: Playbook::Props::HashProp,
|
52
|
-
default: {}
|
53
|
-
prop :search_context_selector, type: Playbook::Props::String,
|
54
|
-
default: nil
|
55
47
|
|
56
48
|
def classname
|
57
49
|
default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
|
@@ -66,15 +58,12 @@ module Playbook
|
|
66
58
|
Hash(values[:data]).merge(
|
67
59
|
pb_typeahead_kit: true,
|
68
60
|
pb_typeahead_kit_search_term_minimum_length: search_term_minimum_length,
|
69
|
-
pb_typeahead_kit_search_debounce_timeout: search_debounce_timeout
|
70
|
-
pb_typeahead_kit_clear_on_context_change: clear_on_context_change,
|
71
|
-
pb_typeahead_kit_search_context_selector: search_context_selector,
|
72
|
-
pb_typeahead_kit_options_by_context: options_by_context.to_json
|
61
|
+
pb_typeahead_kit_search_debounce_timeout: search_debounce_timeout
|
73
62
|
)
|
74
63
|
end
|
75
64
|
|
76
65
|
def is_react?
|
77
|
-
pills || !is_multi
|
66
|
+
pills || !is_multi
|
78
67
|
end
|
79
68
|
|
80
69
|
def typeahead_react_options
|
@@ -96,10 +85,6 @@ module Playbook
|
|
96
85
|
placeholder: placeholder,
|
97
86
|
plusIcon: plus_icon,
|
98
87
|
truncate: truncate,
|
99
|
-
wrapped: wrapped,
|
100
|
-
searchContextSelector: search_context_selector,
|
101
|
-
optionsByContext: options_by_context,
|
102
|
-
clearOnContextChange: clear_on_context_change,
|
103
88
|
}
|
104
89
|
|
105
90
|
base_options[:getOptionLabel] = get_option_label if get_option_label.present?
|