playbook_ui 14.5.0.pre.alpha.PLAY1486highchartscssdrivenPOC3954 → 14.5.0.pre.alpha.PLAY1510railsformloading3976

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -1
  3. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.scss +1 -3
  4. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +184 -5
  5. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -1
  6. data/app/pb_kits/playbook/pb_circle_chart/_circle_chart.tsx +216 -5
  7. data/app/pb_kits/playbook/pb_circle_chart/circleChart.test.js +1 -1
  8. data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +11 -3
  9. data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +13 -3
  10. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +30 -7
  11. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +0 -2
  12. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +8 -0
  13. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.md +1 -0
  14. data/app/pb_kits/playbook/pb_form/docs/example.yml +1 -0
  15. data/app/pb_kits/playbook/pb_form/form.rb +2 -0
  16. data/app/pb_kits/playbook/pb_form/formHelper.js +39 -0
  17. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +9 -1
  18. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +19 -0
  19. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +27 -0
  20. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.md +1 -0
  21. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
  22. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
  23. data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +64 -3
  24. data/app/pb_kits/playbook/pb_gauge/_gauge.tsx +203 -5
  25. data/app/pb_kits/playbook/pb_gauge/gauge.test.js +1 -1
  26. data/app/pb_kits/playbook/pb_line_graph/_line_graph.tsx +154 -5
  27. data/app/pb_kits/playbook/pb_line_graph/lineGraph.test.js +1 -1
  28. data/app/pb_kits/playbook/pb_map/pbMapTheme.ts +17 -195
  29. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +113 -5
  30. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +1 -1
  31. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -1
  32. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +3 -1
  33. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +3 -1
  34. data/dist/chunks/_typeahead-uXdXDcXW.js +22 -0
  35. data/dist/chunks/_weekday_stacked-t67FO9CK.js +45 -0
  36. data/dist/chunks/lib-DO3XYwLd.js +29 -0
  37. data/dist/chunks/{pb_form_validation-Bu-tMfIi.js → pb_form_validation-BMrySPn2.js} +1 -1
  38. data/dist/chunks/vendor.js +1 -1
  39. data/dist/playbook-doc.js +1 -1
  40. data/dist/playbook-rails-react-bindings.js +1 -1
  41. data/dist/playbook-rails.js +1 -1
  42. data/dist/playbook.css +1 -1
  43. data/lib/playbook/pb_forms_helper.rb +3 -1
  44. data/lib/playbook/version.rb +1 -1
  45. metadata +12 -7
  46. data/app/pb_kits/playbook/pb_dashboard/_highcharts_theme.scss +0 -52
  47. data/dist/chunks/_typeahead-D84d1KBa.js +0 -22
  48. data/dist/chunks/_weekday_stacked-CmT_2e83.js +0 -45
  49. data/dist/chunks/lib-BCt68dVK.js +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5daa365c41ed9327bba1499769eed256b0dad354cb6eb38a522723885329127b
4
- data.tar.gz: ab0a8207ba8250f6cfd189c1dcd09706ea22e74485e458567490cf1db87a23a3
3
+ metadata.gz: a6af44f906d83c8278089d9d5a1e69a926f9eb7349c955d7d9383d189a0e676a
4
+ data.tar.gz: 0b760c392b934a26664d5d4b0d4ebe59d149e80faf5cd7d88f47dc7d85ee070d
5
5
  SHA512:
6
- metadata.gz: f34fff2a97be348639735790f39740bfc6a44113c7dccc99e7a5651bcb2babf3a1ca946c7a872929d00b53f800895ad79a1f64d0be63ab56914981af42682cbb
7
- data.tar.gz: 6052de28664531556ce2ed71d373af06677c5c6100d3b1379d36ee7ca701a761f2f43ef1006993d6eb96f8040ad69f9b88221febdaf96cea2b552a62b235742d
6
+ metadata.gz: 1e57b8211ee33e8e586ad1a4bfa23207d8ab4dd815713c7e50ecc8b39cc3316579b6c50d6d33db4a7c14eedf85b1ea7dec3991818c62ea241b8f9b14f2fc30f1
7
+ data.tar.gz: 90866ebecb53a331d92c42284d30ce063d1a0ae23b68438670ef416418fcae2e254fdf107394fed30421894cff69966195b32bebacd194caede6254ec2353e56
@@ -17,7 +17,6 @@
17
17
  @import 'pb_collapsible/collapsible';
18
18
  @import 'pb_contact/contact';
19
19
  @import 'pb_currency/currency';
20
- @import 'pb_dashboard/highcharts_theme.scss';
21
20
  @import 'pb_dashboard_value/dashboard_value';
22
21
  @import 'pb_date/date';
23
22
  @import 'pb_date_picker/date_picker';
@@ -1,8 +1,6 @@
1
- @import "../tokens/colors";
2
- @import "../tokens/typography";
3
-
4
1
  .pb_bar_graph {
5
2
  rect.highcharts-background {
6
3
  fill: #0000 !important;
7
4
  }
8
5
  }
6
+
@@ -1,10 +1,189 @@
1
- import React from 'react';
1
+ import React, { useState, useEffect } from "react";
2
+ import { globalProps } from "../utilities/globalProps";
3
+ import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
4
+
5
+ import HighchartsReact from "highcharts-react-official";
6
+ import Highcharts from "highcharts";
7
+ import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
8
+ import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
9
+ import mapColors from "../pb_dashboard/pbChartsColorsHelper";
10
+ import { merge } from 'lodash'
11
+
12
+ import classnames from "classnames";
13
+
14
+ type BarGraphProps = {
15
+ align?: "left" | "right" | "center";
16
+ axisTitle: { name: string; }[] | string;
17
+ dark?: boolean;
18
+ xAxisCategories: [];
19
+ yAxisMin: number;
20
+ yAxisMax: number;
21
+ chartData: { name: string; data: number[], yAxis: number }[];
22
+ className?: string;
23
+ customOptions?: Partial<Highcharts.Options>;
24
+ id: string;
25
+ pointStart: number;
26
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
27
+ subTitle?: string;
28
+ title: string;
29
+ type?: string;
30
+ legend?: boolean;
31
+ toggleLegendClick?: boolean;
32
+ height?: string;
33
+ colors: string[];
34
+ layout?: "horizontal" | "vertical" | "proximate";
35
+ verticalAlign?: "top" | "middle" | "bottom";
36
+ x?: number;
37
+ y?: number;
38
+ aria?: { [key: string]: string };
39
+ data?: { [key: string]: string };
40
+ stacking?: "normal" | "percent"
41
+ axisFormat?: { format: string; }[] | string;
42
+ };
43
+
44
+
45
+ const BarGraph = ({
46
+ aria = {},
47
+ data = {},
48
+ align = "center",
49
+ axisTitle,
50
+ dark = false,
51
+ chartData,
52
+ className = "pb_bar_graph",
53
+ colors,
54
+ htmlOptions = {},
55
+ customOptions = {},
56
+ axisFormat,
57
+ id,
58
+ pointStart,
59
+ stacking,
60
+ subTitle,
61
+ type = "column",
62
+ title = "Title",
63
+ xAxisCategories,
64
+ yAxisMin,
65
+ yAxisMax,
66
+ legend = false,
67
+ toggleLegendClick = true,
68
+ height,
69
+ layout = "horizontal",
70
+ verticalAlign = "bottom",
71
+ x = 0,
72
+ y = 0,
73
+ ...props
74
+ }: BarGraphProps): React.ReactElement => {
75
+ const ariaProps = buildAriaProps(aria);
76
+ const dataProps = buildDataProps(data)
77
+ const htmlProps = buildHtmlProps(htmlOptions);
78
+ const setupTheme = () => {
79
+ dark
80
+ ? Highcharts.setOptions(highchartsDarkTheme)
81
+ : Highcharts.setOptions(highchartsTheme);
82
+ };
83
+ setupTheme();
84
+
85
+ const staticOptions = {
86
+ title: {
87
+ text: title,
88
+ },
89
+ chart: {
90
+ height: height,
91
+ type: type,
92
+ },
93
+ subtitle: {
94
+ text: subTitle,
95
+ },
96
+ yAxis: [{
97
+ labels: {
98
+ format: typeof axisFormat === 'string' ? axisFormat : (axisFormat && axisFormat[0] ? axisFormat[0].format : "")
99
+
100
+ },
101
+ min: yAxisMin,
102
+ max: yAxisMax,
103
+ opposite: false,
104
+ title: {
105
+ text: Array.isArray(axisTitle) ? (axisTitle.length > 0 ? axisTitle[0].name : null) : axisTitle,
106
+ },
107
+ plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
108
+ value: 0,
109
+ zIndex: 10,
110
+ color: "#E4E8F0"
111
+ }],
112
+ }],
113
+ xAxis: {
114
+ categories: xAxisCategories,
115
+ },
116
+ legend: {
117
+ enabled: legend,
118
+ align: align,
119
+ verticalAlign: verticalAlign,
120
+ layout: layout,
121
+ x: x,
122
+ y: y,
123
+ },
124
+ colors:
125
+ colors !== undefined && colors.length > 0
126
+ ? mapColors(colors)
127
+ : highchartsTheme.colors,
128
+ plotOptions: {
129
+ series: {
130
+ stacking: stacking,
131
+ pointStart: pointStart,
132
+ borderWidth: stacking ? 0 : "",
133
+ events: {},
134
+ dataLabels: {
135
+ enabled: false,
136
+ },
137
+ },
138
+ },
139
+ series: chartData,
140
+ credits: false,
141
+ };
142
+
143
+ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
144
+ staticOptions.yAxis.push({
145
+ labels: {
146
+ format: typeof axisFormat === 'string' ? axisFormat : axisFormat[1].format,
147
+ },
148
+ min: yAxisMin,
149
+ max: yAxisMax,
150
+ opposite: true,
151
+ title: {
152
+ text: axisTitle[1].name,
153
+ },
154
+ plotLines: typeof yAxisMin !== 'undefined' && yAxisMin !== null ? [] : [{
155
+ value: 0,
156
+ zIndex: 10,
157
+ color: "#E4E8F0"
158
+ }],
159
+ });
160
+ }
161
+
162
+ if (!toggleLegendClick) {
163
+ staticOptions.plotOptions.series.events = { legendItemClick: () => false };
164
+ }
165
+
166
+ const filteredProps: any = {...props};
167
+ delete filteredProps.verticalAlign;
168
+
169
+ const [options, setOptions] = useState({});
170
+
171
+ useEffect(() => {
172
+ setOptions(merge(staticOptions, customOptions));
173
+ }, [chartData]);
2
174
 
3
- const BarGraph: React.FC = () => {
4
175
  return (
5
- <div>
6
- This is a simple div component.
7
- </div>
176
+ <HighchartsReact
177
+ containerProps={{
178
+ className: classnames(globalProps(filteredProps), className),
179
+ id: id,
180
+ ...ariaProps,
181
+ ...dataProps,
182
+ ...htmlProps
183
+ }}
184
+ highcharts={Highcharts}
185
+ options={options}
186
+ />
8
187
  );
9
188
  };
10
189
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'bargraph1';
19
19
 
20
- test.skip('bargraph uses exact classname', () => {
20
+ test('bargraph uses exact classname', () => {
21
21
  render(
22
22
  <BarGraph
23
23
  className='super_important_class'
@@ -1,10 +1,221 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from "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
+
2
187
 
3
- const CircleChart: React.FC = () => {
4
188
  return (
5
- <div>
6
- This is a simple div component.
7
- </div>
189
+ <>
190
+ {children ? (
191
+ <div id={`wrapper-circle-chart-${id}`}>
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
+ </>
8
219
  );
9
220
  };
10
221
 
@@ -17,7 +17,7 @@ afterEach(() => {
17
17
 
18
18
  const testId = 'circlechart1';
19
19
 
20
- test.skip('uses exact classname', () => {
20
+ test('uses exact classname', () => {
21
21
  const data = [
22
22
  {
23
23
  name: 'Waiting for Calls',
@@ -1,7 +1,11 @@
1
1
  import colors from '../tokens/exports/_colors.module.scss'
2
2
  import typography from '../tokens/exports/_typography.module.scss'
3
3
 
4
- const highchartsDarkTheme = {
4
+ import { ThemeProps } from './themeTypes'
5
+
6
+ import { PlotTreemapOptions } from "highcharts";
7
+
8
+ const highchartsDarkTheme: ThemeProps = {
5
9
  lang: {
6
10
  thousandsSep: ',',
7
11
  },
@@ -17,6 +21,7 @@ const highchartsDarkTheme = {
17
21
  chart: {
18
22
  borderWidth: 0,
19
23
  borderRadius: 0,
24
+ plotBackgroundColor: undefined,
20
25
  plotShadow: false,
21
26
  plotBorderWidth: 0,
22
27
  },
@@ -58,6 +63,8 @@ const highchartsDarkTheme = {
58
63
  },
59
64
  },
60
65
  yAxis: {
66
+ alternateGridColor: undefined,
67
+ minorTickInterval: null,
61
68
  gridLineColor: colors.border_dark,
62
69
  minorGridLineColor: colors.border_dark,
63
70
  lineWidth: 0,
@@ -128,6 +135,7 @@ const highchartsDarkTheme = {
128
135
  series: {
129
136
  borderColor: colors.bg_dark_card,
130
137
  borderWidth: 2,
138
+ threshold: null,
131
139
  },
132
140
  // PIE STYLES
133
141
  pie: {
@@ -194,11 +202,11 @@ const highchartsDarkTheme = {
194
202
  traverseUpButton: {
195
203
  position: { y: -50 },
196
204
  },
197
- },
205
+ } as PlotTreemapOptions,
198
206
  },
199
207
  credits: {
200
208
  enabled: false
201
209
  },
202
210
  }
203
211
 
204
- export default highchartsDarkTheme
212
+ export { highchartsDarkTheme }
@@ -1,7 +1,11 @@
1
1
  import colors from '../tokens/exports/_colors.module.scss'
2
2
  import typography from '../tokens/exports/_typography.module.scss'
3
3
 
4
- const highchartsTheme = {
4
+ import { ThemeProps } from './themeTypes'
5
+
6
+ import { PlotTreemapOptions } from "highcharts";
7
+
8
+ const highchartsTheme: ThemeProps = {
5
9
  lang: {
6
10
  thousandsSep: ',',
7
11
  },
@@ -17,6 +21,7 @@ const highchartsTheme = {
17
21
  chart: {
18
22
  borderWidth: 0,
19
23
  borderRadius: 0,
24
+ plotBackgroundColor: undefined,
20
25
  plotShadow: false,
21
26
  plotBorderWidth: 0,
22
27
  },
@@ -58,6 +63,8 @@ const highchartsTheme = {
58
63
  },
59
64
  },
60
65
  yAxis: {
66
+ alternateGridColor: undefined,
67
+ minorTickInterval: null,
61
68
  gridLineColor: colors.border_light,
62
69
  minorGridLineColor: colors.border_light,
63
70
  lineWidth: 0,
@@ -125,6 +132,9 @@ const highchartsTheme = {
125
132
  },
126
133
 
127
134
  plotOptions: {
135
+ series: {
136
+ threshold: null,
137
+ },
128
138
  // PIE STYLES
129
139
  pie: {
130
140
  colors: [
@@ -191,11 +201,11 @@ const highchartsTheme = {
191
201
  traverseUpButton: {
192
202
  position: { y: -50 },
193
203
  },
194
- },
204
+ } as PlotTreemapOptions,
195
205
  },
196
206
  credits: {
197
207
  enabled: false
198
208
  },
199
209
  }
200
210
 
201
- export default highchartsTheme
211
+ export { highchartsTheme }
@@ -1,13 +1,36 @@
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 Exmaple",
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 Example",
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>
@@ -1,3 +1 @@
1
1
  Pressing the "Okay" button will trigger a loading state where the button content is replaced by a spinner icon and both buttons are disabled.
2
-
3
- Currently, the loading state cannot be undone and will require a page refresh to reset the dialog.
@@ -0,0 +1,8 @@
1
+ <%= pb_form_with(scope: :example, url: "", method: :get, loading: true) do |form| %>
2
+ <%= form.text_field :example_text_field, props: { label: true } %>
3
+
4
+ <%= form.actions do |action| %>
5
+ <%= action.submit %>
6
+ <%= action.button props: { type: "reset", text: "Cancel", variant: "secondary" } %>
7
+ <% end %>
8
+ <% end %>
@@ -0,0 +1 @@
1
+ Pressing Submit will trigger a loading state where the button content is replaced by a spinner icon and the submit button will be disabled.
@@ -3,3 +3,4 @@ examples:
3
3
  rails:
4
4
  - form_form_with: Default
5
5
  - form_form_with_validate: Default + Validation
6
+ - form_form_with_loading: Default + Loading
@@ -7,6 +7,7 @@ module Playbook
7
7
  type: Playbook::Props::Base
8
8
  prop :form_system_options, deprecated: "Use options instead",
9
9
  type: Playbook::Props::Base
10
+ prop :loading, type: Playbook::Props::Boolean, default: false
10
11
  prop :options, type: Playbook::Props::Base
11
12
  prop :validate, type: Playbook::Props::Boolean, default: false
12
13
 
@@ -22,6 +23,7 @@ module Playbook
22
23
  aria: aria,
23
24
  class: classname,
24
25
  data: data,
26
+ loading: loading,
25
27
  validate: validate,
26
28
  }.merge(prop(:options) || prop(:form_system_options) || {})
27
29
  end