playbook_ui 14.5.0.pre.alpha.PLAY1485selectablecardoverflowoutlinebug4216 → 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3930
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +7 -25
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_advanced_table/index.js +0 -60
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.html.erb +9 -1
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +54 -0
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +5 -184
- data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_card/_card.tsx +1 -5
- data/app/pb_kits/playbook/pb_card/_card_mixin.scss +2 -1
- data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +5 -216
- data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +7 -30
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +2 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +3 -84
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +5 -28
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +1 -10
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.tsx +0 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +0 -2
- data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.tsx +1 -4
- data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx +2 -4
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/example.yml +0 -3
- data/app/pb_kits/playbook/pb_filter/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/filter.rb +0 -2
- data/app/pb_kits/playbook/pb_flex/_flex.tsx +1 -3
- data/app/pb_kits/playbook/pb_flex/_flex_item.tsx +2 -8
- data/app/pb_kits/playbook/pb_flex/flex_item.html.erb +6 -3
- data/app/pb_kits/playbook/pb_flex/flex_item.rb +2 -7
- data/app/pb_kits/playbook/pb_form/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_form/form.rb +0 -2
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -9
- 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_gantt_chart/_gantt_chart.tsx +3 -64
- data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +5 -203
- data/app/pb_kits/playbook/pb_gauge/gauge.test.js +1 -1
- data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +5 -154
- data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +227 -211
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -4
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +65 -169
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.test.js +5 -5
- data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.tsx +9 -15
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.html.erb +6 -28
- data/app/pb_kits/playbook/pb_multiple_users_stacked/multiple_users_stacked.rb +1 -31
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +18 -86
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +6 -15
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_preferred_countries.md +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/intlTelInput.scss +931 -849
- data/app/pb_kits/playbook/pb_phone_number_input/types.d.ts +1 -4
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +2 -6
- data/app/pb_kits/playbook/pb_popover/docs/_popover_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_popover/popover.rb +1 -3
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +1 -67
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.tsx +0 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/selectable_card.rb +1 -5
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +5 -113
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +1 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -4
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -3
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -3
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +0 -3
- data/app/pb_kits/playbook/utilities/globalProps.ts +2 -39
- data/dist/chunks/_typeahead-BywvWGAm.js +22 -0
- data/dist/chunks/_weekday_stacked-5OGZKZeo.js +45 -0
- data/dist/chunks/lib-DMOmCoAX.js +29 -0
- data/dist/chunks/{pb_form_validation-BkWGwJsl.js → pb_form_validation-Dna2I7fw.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- 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/kit_base.rb +1 -21
- data/lib/playbook/pb_doc_helper.rb +5 -5
- data/lib/playbook/pb_forms_helper.rb +1 -3
- data/lib/playbook/version.rb +1 -1
- metadata +6 -35
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.jsx +0 -72
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell.md +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +0 -45
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.html.erb +0 -9
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_separators_hidden.jsx +0 -33
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.html.erb +0 -10
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.jsx +0 -34
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subtle_variant.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.html.erb +0 -41
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props.jsx +0 -71
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_rails.md +0 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_popover_props_react.md +0 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +0 -39
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.md +0 -1
- data/app/pb_kits/playbook/pb_form/formHelper.js +0 -27
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +0 -19
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +0 -27
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/context/index.tsx +0 -5
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.html.erb +0 -93
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_reset.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.jsx +0 -105
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.jsx +0 -106
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_with_children_with_radios.md +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select_options.tsx +0 -149
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.html.erb +0 -336
- data/app/pb_kits/playbook/pb_multiple_users_stacked/docs/_multiple_users_stacked_size.jsx +0 -97
- data/dist/chunks/_typeahead-BhHnXJjy.js +0 -22
- data/dist/chunks/_weekday_stacked-B9Sy5PN8.js +0 -45
- data/dist/chunks/lib-D-mTv-kp.js +0 -29
@@ -1,221 +1,10 @@
|
|
1
|
-
import React
|
2
|
-
import classnames from "classnames";
|
3
|
-
import HighchartsReact from "highcharts-react-official";
|
4
|
-
import highchartsMore from "highcharts/highcharts-more";
|
5
|
-
|
6
|
-
import Highcharts from "highcharts";
|
7
|
-
|
8
|
-
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
|
-
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
|
-
import mapColors from "../pb_dashboard/pbChartsColorsHelper";
|
11
|
-
import { globalProps } from "../utilities/globalProps";
|
12
|
-
import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
|
13
|
-
import { merge } from 'lodash'
|
14
|
-
|
15
|
-
type CircleChartProps = {
|
16
|
-
align?: "left" | "right" | "center";
|
17
|
-
aria: { [key: string]: string };
|
18
|
-
chartData?: [];
|
19
|
-
children?: Node;
|
20
|
-
className?: string;
|
21
|
-
colors?: string[];
|
22
|
-
customOptions?: Partial<Highcharts.Options>;
|
23
|
-
dark?: boolean;
|
24
|
-
data?: {[key: string]: string},
|
25
|
-
dataLabelHtml?: string;
|
26
|
-
dataLabels?: boolean;
|
27
|
-
height?: string;
|
28
|
-
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
29
|
-
id?: string;
|
30
|
-
innerSize?: "sm" | "md" | "lg" | "none";
|
31
|
-
legend?: boolean;
|
32
|
-
maxPointSize?: number;
|
33
|
-
minPointSize?: number;
|
34
|
-
rounded?: boolean;
|
35
|
-
startAngle?: number;
|
36
|
-
style?: string;
|
37
|
-
title?: string;
|
38
|
-
tooltipHtml: string;
|
39
|
-
useHtml?: boolean;
|
40
|
-
zMin?: number;
|
41
|
-
layout?: "horizontal" | "vertical" | "proximate";
|
42
|
-
verticalAlign?: "top" | "middle" | "bottom";
|
43
|
-
x?: number;
|
44
|
-
y?: number;
|
45
|
-
borderColor?: string;
|
46
|
-
borderWidth?: number;
|
47
|
-
};
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
const alignBlockElement = (event: any) => {
|
52
|
-
const itemToMove = document.querySelector<HTMLElement>(
|
53
|
-
`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`
|
54
|
-
);
|
55
|
-
const chartContainer = document.querySelector(`#${event.target.renderTo.id}`);
|
56
|
-
|
57
|
-
if (itemToMove !== null && chartContainer !== null) {
|
58
|
-
itemToMove.style.height = `${event.target.chartHeight}px`;
|
59
|
-
itemToMove.style.width = `${event.target.chartWidth}px`;
|
60
|
-
if (chartContainer.firstChild !== null) {
|
61
|
-
chartContainer.firstChild.before(itemToMove);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
};
|
65
|
-
|
66
|
-
const CircleChart = ({
|
67
|
-
align = "center",
|
68
|
-
aria = {},
|
69
|
-
rounded = false,
|
70
|
-
borderColor = rounded ? null : "",
|
71
|
-
borderWidth = rounded ? 20 : null,
|
72
|
-
chartData,
|
73
|
-
children,
|
74
|
-
className,
|
75
|
-
colors = [],
|
76
|
-
customOptions = {},
|
77
|
-
dark = false,
|
78
|
-
data = {},
|
79
|
-
dataLabelHtml = "<div>{point.name}</div>",
|
80
|
-
dataLabels = false,
|
81
|
-
height,
|
82
|
-
htmlOptions = {},
|
83
|
-
id,
|
84
|
-
innerSize = "md",
|
85
|
-
legend = false,
|
86
|
-
maxPointSize = null,
|
87
|
-
minPointSize = null,
|
88
|
-
startAngle = null,
|
89
|
-
style = "pie",
|
90
|
-
title,
|
91
|
-
tooltipHtml,
|
92
|
-
useHtml = false,
|
93
|
-
zMin = null,
|
94
|
-
layout = "horizontal",
|
95
|
-
verticalAlign = "bottom",
|
96
|
-
x = 0,
|
97
|
-
y = 0,
|
98
|
-
...props
|
99
|
-
}: CircleChartProps) => {
|
100
|
-
const ariaProps = buildAriaProps(aria);
|
101
|
-
const dataProps = buildDataProps(data)
|
102
|
-
const htmlProps = buildHtmlProps(htmlOptions);
|
103
|
-
highchartsMore(Highcharts);
|
104
|
-
|
105
|
-
const setupTheme = () => {
|
106
|
-
dark
|
107
|
-
? Highcharts.setOptions(highchartsDarkTheme)
|
108
|
-
: Highcharts.setOptions(highchartsTheme);
|
109
|
-
};
|
110
|
-
setupTheme();
|
111
|
-
|
112
|
-
Highcharts.setOptions({
|
113
|
-
tooltip: {
|
114
|
-
headerFormat: null,
|
115
|
-
pointFormat: tooltipHtml ? tooltipHtml : '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' + "<b>{point.y}</b>",
|
116
|
-
useHTML: useHtml,
|
117
|
-
},
|
118
|
-
});
|
119
|
-
|
120
|
-
const innerSizes = { sm: "35%", md: "50%", lg: "85%", none: "0%" };
|
121
|
-
const innerSizeFormat = (size: "sm" | "md" | "lg" | "none") =>
|
122
|
-
innerSizes[size];
|
123
|
-
|
124
|
-
|
125
|
-
const filteredProps: any = {...props};
|
126
|
-
delete filteredProps.verticalAlign;
|
127
|
-
|
128
|
-
const [options, setOptions] = useState({});
|
129
|
-
|
130
|
-
useEffect(() => {
|
131
|
-
const formattedChartData = chartData.map((obj: any) => {
|
132
|
-
obj.y = obj.value;
|
133
|
-
delete obj.value;
|
134
|
-
return obj;
|
135
|
-
});
|
136
|
-
|
137
|
-
const staticOptions = {
|
138
|
-
title: {
|
139
|
-
text: title,
|
140
|
-
},
|
141
|
-
chart: {
|
142
|
-
height: height,
|
143
|
-
type: style,
|
144
|
-
events: {
|
145
|
-
render: (event: any) => alignBlockElement(event),
|
146
|
-
redraw: (event: any) => alignBlockElement(event),
|
147
|
-
},
|
148
|
-
},
|
149
|
-
|
150
|
-
legend: {
|
151
|
-
align: align,
|
152
|
-
verticalAlign: verticalAlign,
|
153
|
-
layout: layout,
|
154
|
-
x: x,
|
155
|
-
y: y,
|
156
|
-
},
|
157
|
-
plotOptions: {
|
158
|
-
pie: {
|
159
|
-
colors:
|
160
|
-
colors.length > 0 ? mapColors(colors) : highchartsTheme.colors,
|
161
|
-
dataLabels: {
|
162
|
-
enabled: dataLabels,
|
163
|
-
connectorShape: "straight",
|
164
|
-
connectorWidth: 3,
|
165
|
-
format: dataLabelHtml,
|
166
|
-
},
|
167
|
-
showInLegend: legend,
|
168
|
-
},
|
169
|
-
},
|
170
|
-
series: [
|
171
|
-
{
|
172
|
-
minPointSize: minPointSize,
|
173
|
-
maxPointSize: maxPointSize,
|
174
|
-
innerSize: borderWidth == 20 ? "100%" : innerSizeFormat(innerSize),
|
175
|
-
data: formattedChartData,
|
176
|
-
zMin: zMin,
|
177
|
-
startAngle: startAngle,
|
178
|
-
borderWidth: borderWidth,
|
179
|
-
borderColor: borderColor,
|
180
|
-
},
|
181
|
-
],
|
182
|
-
credits: false,
|
183
|
-
};
|
184
|
-
setOptions(merge(staticOptions, customOptions));
|
185
|
-
}, [chartData]);
|
186
|
-
|
1
|
+
import React from 'react';
|
187
2
|
|
3
|
+
const CircleChart: React.FC = () => {
|
188
4
|
return (
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
<HighchartsReact
|
193
|
-
containerProps={{
|
194
|
-
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
195
|
-
id: id,
|
196
|
-
...ariaProps,
|
197
|
-
...dataProps,
|
198
|
-
...htmlProps,
|
199
|
-
}}
|
200
|
-
highcharts={Highcharts}
|
201
|
-
options={options}
|
202
|
-
/>
|
203
|
-
<div className="pb-circle-chart-block">{children}</div>
|
204
|
-
</div>
|
205
|
-
) : (
|
206
|
-
<HighchartsReact
|
207
|
-
containerProps={{
|
208
|
-
className: classnames("pb_circle_chart", globalProps(filteredProps)),
|
209
|
-
id: id,
|
210
|
-
...ariaProps,
|
211
|
-
...dataProps,
|
212
|
-
...htmlProps,
|
213
|
-
}}
|
214
|
-
highcharts={Highcharts}
|
215
|
-
options={options}
|
216
|
-
/>
|
217
|
-
)}
|
218
|
-
</>
|
5
|
+
<div>
|
6
|
+
This is a simple div component.
|
7
|
+
</div>
|
219
8
|
);
|
220
9
|
};
|
221
10
|
|
@@ -6,7 +6,7 @@ import classnames from "classnames";
|
|
6
6
|
import Modal from "react-modal";
|
7
7
|
|
8
8
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
9
|
-
import { globalProps
|
9
|
+
import { globalProps } from "../utilities/globalProps";
|
10
10
|
|
11
11
|
import Body from "../pb_body/_body";
|
12
12
|
import Button from "../pb_button/_button";
|
@@ -91,8 +91,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
91
91
|
beforeClose: "pb_dialog_overlay_before_close",
|
92
92
|
};
|
93
93
|
|
94
|
-
const dynamicInlineProps = globalInlineProps(props);
|
95
|
-
|
96
94
|
const classes = classnames(
|
97
95
|
buildCss("pb_dialog_wrapper"),
|
98
96
|
globalProps(props),
|
@@ -186,7 +184,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
186
184
|
overlayClassName={overlayClassNames}
|
187
185
|
portalClassName={portalClassName}
|
188
186
|
shouldCloseOnOverlayClick={shouldCloseOnOverlayClick && !loading}
|
189
|
-
style={{ content: dynamicInlineProps }}
|
190
187
|
>
|
191
188
|
<>
|
192
189
|
{title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
|
@@ -195,7 +192,6 @@ const Dialog = (props: DialogProps): React.ReactElement => {
|
|
195
192
|
<Dialog.Body
|
196
193
|
className="dialog_status_text_align"
|
197
194
|
padding="md"
|
198
|
-
|
199
195
|
>
|
200
196
|
<Flex align="center"
|
201
197
|
orientation="column"
|
@@ -1,36 +1,13 @@
|
|
1
1
|
<%= pb_rails("button", props: { text: "Open Dialog", data: {"open-dialog": "dialog-loading"} }) %>
|
2
2
|
|
3
|
-
<%= pb_rails("dialog", props: {
|
4
|
-
id:"dialog-loading",
|
5
|
-
size: "sm",
|
6
|
-
title: "Loading
|
7
|
-
text: "Make a loading request?",
|
8
|
-
cancel_button: "Cancel Button",
|
3
|
+
<%= pb_rails("dialog", props: {
|
4
|
+
id:"dialog-loading",
|
5
|
+
size: "sm",
|
6
|
+
title: "Loading Exmaple",
|
7
|
+
text: "Make a loading request?",
|
8
|
+
cancel_button: "Cancel Button",
|
9
9
|
cancel_button_id: "cancel-button-loading",
|
10
|
-
confirm_button: "Okay",
|
10
|
+
confirm_button: "Okay",
|
11
11
|
confirm_button_id: "confirm-button-loading",
|
12
12
|
loading: true,
|
13
13
|
}) %>
|
14
|
-
|
15
|
-
<script>
|
16
|
-
const loadingButton = document.querySelector('[data-disable-with="Loading"]');
|
17
|
-
if (loadingButton) {
|
18
|
-
loadingButton.addEventListener("click", function() {
|
19
|
-
const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]');
|
20
|
-
const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]');
|
21
|
-
let currentClass = okayLoadingButton.className;
|
22
|
-
let cancelClass = cancelButton ? cancelButton.className : "";
|
23
|
-
|
24
|
-
setTimeout(function() {
|
25
|
-
okayLoadingButton.disabled = false;
|
26
|
-
okayLoadingButton.className = currentClass.replace("_disabled_loading", "_enabled");
|
27
|
-
|
28
|
-
if (cancelButton) {
|
29
|
-
cancelButton.disabled = false;
|
30
|
-
cancelButton.className = cancelClass.replace("_disabled", "_enabled");
|
31
|
-
}
|
32
|
-
}, 5000);
|
33
|
-
|
34
|
-
});
|
35
|
-
}
|
36
|
-
</script>
|
@@ -69,21 +69,15 @@
|
|
69
69
|
padding-bottom: $space_xs;
|
70
70
|
cursor: pointer;
|
71
71
|
&:hover {
|
72
|
-
background-color: $
|
72
|
+
background-color: $border_light;
|
73
73
|
}
|
74
74
|
|
75
75
|
&[class*="_focused"] {
|
76
|
-
background-color: $
|
76
|
+
background-color: $border_light;
|
77
77
|
}
|
78
78
|
|
79
79
|
&[class*="_list"] {
|
80
80
|
border-bottom: 1px solid $border_light;
|
81
|
-
|
82
|
-
&:hover, &:focus {
|
83
|
-
.pb_body_kit {
|
84
|
-
color: $primary;
|
85
|
-
}
|
86
|
-
}
|
87
81
|
}
|
88
82
|
&[class*="selected"] {
|
89
83
|
background-color: $primary;
|
@@ -93,7 +87,7 @@
|
|
93
87
|
color: $white !important;
|
94
88
|
}
|
95
89
|
&:hover {
|
96
|
-
background-color: $
|
90
|
+
background-color: $primary !important;
|
97
91
|
}
|
98
92
|
}
|
99
93
|
}
|
@@ -131,81 +125,6 @@
|
|
131
125
|
}
|
132
126
|
}
|
133
127
|
|
134
|
-
&.separators_hidden {
|
135
|
-
.dropdown_wrapper {
|
136
|
-
.pb_dropdown_container {
|
137
|
-
|
138
|
-
[class*="pb_dropdown_option"] {
|
139
|
-
border: none;
|
140
|
-
}
|
141
|
-
}
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
&.subtle {
|
146
|
-
.dropdown_wrapper {
|
147
|
-
.pb_dropdown_container {
|
148
|
-
|
149
|
-
[class*="pb_dropdown_option"]:first-child {
|
150
|
-
margin-top: $space_xs;
|
151
|
-
}
|
152
|
-
|
153
|
-
[class*="pb_dropdown_option"]:last-child {
|
154
|
-
margin-bottom: $space_xs;
|
155
|
-
}
|
156
|
-
|
157
|
-
[class*="pb_dropdown_option"] {
|
158
|
-
margin: $space_xs;
|
159
|
-
padding: $space_xs;
|
160
|
-
border-radius: $border_radius_md;
|
161
|
-
border-bottom: none;
|
162
|
-
position: relative;
|
163
|
-
|
164
|
-
&::after {
|
165
|
-
content: "";
|
166
|
-
position: absolute;
|
167
|
-
left: -$space_xs;
|
168
|
-
right: -$space_xs;
|
169
|
-
bottom: -4.5px;
|
170
|
-
height: 1px;
|
171
|
-
background: $border_light;
|
172
|
-
}
|
173
|
-
}
|
174
|
-
|
175
|
-
[class*="pb_dropdown_option"]:last-child::after {
|
176
|
-
display: none;
|
177
|
-
}
|
178
|
-
}
|
179
|
-
}
|
180
|
-
|
181
|
-
&.separators_hidden {
|
182
|
-
.dropdown_wrapper {
|
183
|
-
.pb_dropdown_container {
|
184
|
-
[class*="pb_dropdown_option"]:first-child {
|
185
|
-
margin-top: $space_xs;
|
186
|
-
}
|
187
|
-
|
188
|
-
[class*="pb_dropdown_option"]:last-child {
|
189
|
-
margin-bottom: $space_xs;
|
190
|
-
}
|
191
|
-
|
192
|
-
[class*="pb_dropdown_option"] {
|
193
|
-
padding: $space_xxs $space_xs;
|
194
|
-
margin: $space_xxs $space_xs;
|
195
|
-
|
196
|
-
&::after {
|
197
|
-
height: 0px;
|
198
|
-
}
|
199
|
-
|
200
|
-
&[class*="selected"] {
|
201
|
-
border-bottom: none;
|
202
|
-
}
|
203
|
-
}
|
204
|
-
}
|
205
|
-
}
|
206
|
-
}
|
207
|
-
}
|
208
|
-
|
209
128
|
&.dark {
|
210
129
|
.dropdown_wrapper {
|
211
130
|
[class*="dropdown_trigger_wrapper"] {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useRef, useEffect
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
4
4
|
import { globalProps } from "../utilities/globalProps";
|
@@ -35,19 +35,10 @@ type DropdownProps = {
|
|
35
35
|
label?: string;
|
36
36
|
onSelect?: (arg: GenericObject) => null;
|
37
37
|
options: GenericObject;
|
38
|
-
separators: boolean;
|
39
38
|
triggerRef?: any;
|
40
|
-
variant?: "default" | "subtle";
|
41
39
|
};
|
42
40
|
|
43
|
-
|
44
|
-
extends React.ForwardRefExoticComponent<DropdownProps & React.RefAttributes<unknown>> {
|
45
|
-
Option: typeof DropdownOption;
|
46
|
-
Trigger: typeof DropdownTrigger;
|
47
|
-
Container: typeof DropdownContainer;
|
48
|
-
}
|
49
|
-
|
50
|
-
const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
41
|
+
const Dropdown = (props: DropdownProps) => {
|
51
42
|
const {
|
52
43
|
aria = {},
|
53
44
|
autocomplete = false,
|
@@ -64,20 +55,15 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
64
55
|
label,
|
65
56
|
onSelect,
|
66
57
|
options,
|
67
|
-
|
68
|
-
triggerRef,
|
69
|
-
variant = "default",
|
58
|
+
triggerRef
|
70
59
|
} = props;
|
71
60
|
|
72
61
|
const ariaProps = buildAriaProps(aria);
|
73
62
|
const dataProps = buildDataProps(data);
|
74
63
|
const htmlProps = buildHtmlProps(htmlOptions);
|
75
|
-
const separatorsClass = separators ? '' : 'separators_hidden'
|
76
64
|
const classes = classnames(
|
77
65
|
buildCss("pb_dropdown"),
|
78
66
|
globalProps(props),
|
79
|
-
variant,
|
80
|
-
separatorsClass,
|
81
67
|
className
|
82
68
|
);
|
83
69
|
|
@@ -139,7 +125,7 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
139
125
|
const filteredOptions = optionsWithBlankSelection?.filter((option: GenericObject) => {
|
140
126
|
const label = typeof option.label === 'string' ? option.label.toLowerCase() : option.label;
|
141
127
|
return String(label).toLowerCase().includes(filterItem.toLowerCase());
|
142
|
-
});
|
128
|
+
});
|
143
129
|
|
144
130
|
// For keyboard accessibility: Set focus within dropdown to selected item if it exists
|
145
131
|
useEffect(() => {
|
@@ -189,14 +175,6 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
189
175
|
dark
|
190
176
|
});
|
191
177
|
|
192
|
-
useImperativeHandle(ref, () => ({
|
193
|
-
clearSelected: () => {
|
194
|
-
setSelected({});
|
195
|
-
setFilterItem("");
|
196
|
-
setIsDropDownClosed(true);
|
197
|
-
onSelect && onSelect(null);
|
198
|
-
},
|
199
|
-
}));
|
200
178
|
|
201
179
|
return (
|
202
180
|
<div {...ariaProps}
|
@@ -280,9 +258,8 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
|
|
280
258
|
</DropdownContext.Provider>
|
281
259
|
</div>
|
282
260
|
)
|
283
|
-
}
|
261
|
+
};
|
284
262
|
|
285
|
-
Dropdown.displayName = "Dropdown";
|
286
263
|
Dropdown.Option = DropdownOption;
|
287
264
|
Dropdown.Trigger = DropdownTrigger;
|
288
265
|
Dropdown.Container = DropdownContainer;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- dropdown_default: Default
|
4
|
-
- dropdown_subtle_variant: Subtle Variant
|
5
4
|
- dropdown_subcomponent_structure_rails: Subcomponent Structure
|
6
5
|
- dropdown_with_label: With Label
|
7
6
|
- dropdown_with_custom_options_rails: Custom Options
|
@@ -11,11 +10,9 @@ examples:
|
|
11
10
|
- dropdown_error: Dropdown with Error
|
12
11
|
- dropdown_default_value: Default Value
|
13
12
|
- dropdown_blank_selection: Blank Selection
|
14
|
-
- dropdown_separators_hidden: Separators Hidden
|
15
13
|
|
16
14
|
react:
|
17
15
|
- dropdown_default: Default
|
18
|
-
- dropdown_subtle_variant: Subtle Variant
|
19
16
|
- dropdown_subcomponent_structure: Subcomponent Structure
|
20
17
|
- dropdown_with_label: With Label
|
21
18
|
- dropdown_with_custom_options: Custom Options
|
@@ -25,8 +22,6 @@ examples:
|
|
25
22
|
- dropdown_error: Dropdown with Error
|
26
23
|
- dropdown_default_value: Default Value
|
27
24
|
- dropdown_blank_selection: Blank Selection
|
28
|
-
- dropdown_clear_selection: Clear Selection
|
29
|
-
- dropdown_separators_hidden: Separators Hidden
|
30
25
|
# - dropdown_with_autocomplete: Autocomplete
|
31
26
|
# - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
|
32
27
|
# - dropdown_with_external_control: useDropdown Hook
|
@@ -12,6 +12,3 @@ export { default as DropdownSubcomponentStructure } from './_dropdown_subcompone
|
|
12
12
|
export { default as DropdownError } from './_dropdown_error.jsx'
|
13
13
|
export { default as DropdownDefaultValue } from './_dropdown_default_value.jsx'
|
14
14
|
export { default as DropdownBlankSelection } from './_dropdown_blank_selection.jsx'
|
15
|
-
export { default as DropdownClearSelection } from './_dropdown_clear_selection.jsx'
|
16
|
-
export { default as DropdownSubtleVariant } from './_dropdown_subtle_variant.jsx'
|
17
|
-
export { default as DropdownSeparatorsHidden } from './_dropdown_separators_hidden.jsx'
|
@@ -13,18 +13,13 @@ module Playbook
|
|
13
13
|
prop :default_value
|
14
14
|
prop :blank_selection, type: Playbook::Props::String,
|
15
15
|
default: ""
|
16
|
-
prop :variant, type: Playbook::Props::Enum,
|
17
|
-
values: %w[default subtle],
|
18
|
-
default: "default"
|
19
|
-
prop :separators, type: Playbook::Props::Boolean,
|
20
|
-
default: true
|
21
16
|
|
22
17
|
def data
|
23
18
|
Hash(prop(:data)).merge(pb_dropdown: true)
|
24
19
|
end
|
25
20
|
|
26
21
|
def classname
|
27
|
-
generate_classname("pb_dropdown"
|
22
|
+
generate_classname("pb_dropdown")
|
28
23
|
end
|
29
24
|
|
30
25
|
private
|
@@ -37,10 +32,6 @@ module Playbook
|
|
37
32
|
default_value.present? ? default_value.transform_keys(&:to_s)["id"] : ""
|
38
33
|
end
|
39
34
|
|
40
|
-
def separators_class
|
41
|
-
separators ? "" : "separators_hidden"
|
42
|
-
end
|
43
|
-
|
44
35
|
def options_with_blank
|
45
36
|
blank_selection.present? ? [{ id: "", value: "", label: blank_selection }] + options : options
|
46
37
|
end
|
@@ -73,7 +73,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
73
73
|
!autocomplete && "select_only"
|
74
74
|
);
|
75
75
|
|
76
|
-
const customDisplayPlaceholder = selected
|
76
|
+
const customDisplayPlaceholder = selected.label ? (
|
77
77
|
<b>{selected.label}</b>
|
78
78
|
) : autocomplete ? (
|
79
79
|
""
|
@@ -83,7 +83,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
83
83
|
"Select..."
|
84
84
|
);
|
85
85
|
|
86
|
-
const defaultDisplayPlaceholder = selected
|
86
|
+
const defaultDisplayPlaceholder = selected.label
|
87
87
|
? selected.label
|
88
88
|
: autocomplete
|
89
89
|
? ""
|
@@ -34,7 +34,6 @@ const FilterDouble = ({
|
|
34
34
|
maxHeight,
|
35
35
|
minWidth,
|
36
36
|
placement,
|
37
|
-
popoverProps,
|
38
37
|
...bgProps
|
39
38
|
}: FilterDoubleProps): React.ReactElement => (
|
40
39
|
<FilterBackground
|
@@ -50,7 +49,6 @@ const FilterDouble = ({
|
|
50
49
|
maxHeight={maxHeight}
|
51
50
|
minWidth={minWidth}
|
52
51
|
placement={placement}
|
53
|
-
popoverProps={popoverProps}
|
54
52
|
>
|
55
53
|
{children}
|
56
54
|
</FiltersPopover>
|
@@ -33,7 +33,6 @@ const FilterSingle = ({
|
|
33
33
|
maxHeight,
|
34
34
|
minWidth,
|
35
35
|
placement,
|
36
|
-
popoverProps,
|
37
36
|
...bgProps
|
38
37
|
}: FilterSingleProps): React.ReactElement => {
|
39
38
|
return (
|
@@ -53,7 +52,6 @@ const FilterSingle = ({
|
|
53
52
|
maxHeight={maxHeight}
|
54
53
|
minWidth={minWidth}
|
55
54
|
placement={placement}
|
56
|
-
popoverProps={popoverProps}
|
57
55
|
>
|
58
56
|
{children}
|
59
57
|
</FiltersPopover>
|
@@ -2,7 +2,6 @@ import React, { ReactNode, useState } from 'react'
|
|
2
2
|
|
3
3
|
import CircleIconButton from '../../pb_circle_icon_button/_circle_icon_button'
|
4
4
|
import PbReactPopover from '../../pb_popover/_popover'
|
5
|
-
import { GenericObject } from '../../types'
|
6
5
|
|
7
6
|
type FiltersPopoverProps = {
|
8
7
|
children?: React.ReactChild[] | React.ReactChild | (({closePopover}: {closePopover: () => void}) => ReactNode),
|
@@ -10,9 +9,8 @@ type FiltersPopoverProps = {
|
|
10
9
|
maxHeight?: string,
|
11
10
|
minWidth?: string,
|
12
11
|
placement?: "top" | "right" | "bottom" | "left" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "right-start" | "right-end" | "left-start" | "left-end",
|
13
|
-
popoverProps?: GenericObject,
|
14
12
|
}
|
15
|
-
const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bottom-start"
|
13
|
+
const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bottom-start" }: FiltersPopoverProps): React.ReactElement => {
|
16
14
|
const [hide, updateHide] = useState(true)
|
17
15
|
const toggle = () => updateHide(!hide)
|
18
16
|
|
@@ -35,7 +33,6 @@ const FiltersPopover = ({ children, dark, maxHeight, minWidth, placement = "bott
|
|
35
33
|
reference={filterButton}
|
36
34
|
shouldClosePopover={updateHide}
|
37
35
|
show={!hide}
|
38
|
-
{...popoverProps}
|
39
36
|
>
|
40
37
|
<div className="pb-form">
|
41
38
|
{typeof children === 'function'
|