playbook_ui 14.24.0.pre.alpha.play23479502 → 14.24.0.pre.alpha.play23649503

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 (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +26 -175
  3. data/app/pb_kits/playbook/pb_bar_graph/barGraph.test.js +1 -2
  4. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +12 -78
  6. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_default.html.erb +21 -9
  7. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
  8. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +0 -2
  9. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +0 -1
  10. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +1 -2
  11. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
  12. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +0 -6
  13. data/dist/chunks/_line_graph-BsZ3DcJo.js +1 -0
  14. data/dist/chunks/{_typeahead-BzYZCpJO.js → _typeahead-CKvqSXWH.js} +2 -2
  15. data/dist/chunks/{_weekday_stacked-irgZUVGj.js → _weekday_stacked-tedYzlIq.js} +2 -2
  16. data/dist/chunks/{lib-CY5ZPzic.js → lib-BplzvaaY.js} +2 -2
  17. data/dist/chunks/{pb_form_validation-D3b0JKHH.js → pb_form_validation-CA_noofR.js} +1 -1
  18. data/dist/chunks/vendor.js +1 -1
  19. data/dist/playbook-doc.js +1 -1
  20. data/dist/playbook-rails-react-bindings.js +1 -1
  21. data/dist/playbook-rails.js +1 -1
  22. data/lib/playbook/version.rb +1 -1
  23. metadata +6 -9
  24. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +0 -22
  25. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +0 -43
  26. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +0 -1
  27. data/dist/chunks/_line_graph-D7DgMqnT.js +0 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4ccc02520ca6f12c398e5c4417dcfeb08b24b1b68bed3ca430137584fd25bf8
4
- data.tar.gz: d916bb54b939ce9cbec50449fe9bf90791ae6ac0e330337f54c8fc8f5375c5cb
3
+ metadata.gz: 7b6125bc029c939ad15a726d63897d11251203a4b3529c1e5909cf5a017938a1
4
+ data.tar.gz: 03153bcee4384a533f7e1b9c91447ee748077b8f52b097e3cee2134f3a14afa6
5
5
  SHA512:
6
- metadata.gz: d3c9a37eb5044d3a60ac5d4843fec307a2c183ac800d9fdb940a93503a00cd1dd21f5c28df556096909eae5e7f6369df0f78ea108a0ca37761a595390ead7c0e
7
- data.tar.gz: '0845b9c473a82d7322b6ee1d1d9a17e1a4221453ef23a105d66b01d6de4682fdfd6abe77ba38877ae66cdfa3dae70a2b4bfa9602d1808ba11df4aece44607714'
6
+ metadata.gz: c635cb4af1e58eaddb56b5ba82f10e440e70201aa6eab3a1d469b4b568335ef1099cfd5986ac53dd841fb1b0cb2f4f796d33eb1155f5b5bde188f664f64e5b38
7
+ data.tar.gz: 76080ead057d43b8d5b794bdd4eadca9abe86495b1d1281edb677d58dfc1fe53dabf98269326b5623974543188da4e83191b01c28d74206512c9bc3b70cab646
@@ -1,190 +1,41 @@
1
- import React, { useState, useEffect } from "react";
2
- import { globalProps } from "../utilities/globalProps";
1
+ import React, { useMemo } from "react"
3
2
  import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
3
+ import Highcharts from "highcharts"
4
+ import HighchartsReact from "highcharts-react-official"
4
5
 
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 '../utilities/object'
11
-
12
- import classnames from "classnames";
6
+ import barGraphTheme from "./barGraphTheme"
13
7
 
14
8
  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
- });
9
+ options: Record<string, unknown>
10
+ containerProps?: React.HTMLProps<HTMLDivElement>
11
+ data?: Record<string, unknown>
160
12
  }
161
13
 
162
- if (!toggleLegendClick) {
163
- staticOptions.plotOptions.series.events = { legendItemClick: () => false };
164
- }
14
+ const BarGraph = ({
15
+ options,
16
+ containerProps = {},
17
+ data = {}
18
+ }: BarGraphProps): React.ReactElement => {
165
19
 
166
- const filteredProps: any = {...props};
167
- delete filteredProps.verticalAlign;
20
+ const dataProps = buildDataProps(data)
168
21
 
169
- const [options, setOptions] = useState({});
22
+ const mergedOptions = useMemo(() => {
23
+ if (!options || typeof options !== "object") {
24
+ // eslint-disable-next-line no-console
25
+ console.error("❌ Invalid options passed to <BarGraph />", options)
26
+ return {}
27
+ }
170
28
 
171
- useEffect(() => {
172
- setOptions(merge(staticOptions, customOptions));
173
- }, [chartData]);
29
+ return Highcharts.merge({}, barGraphTheme, options)
30
+ }, [options])
174
31
 
175
32
  return (
176
33
  <HighchartsReact
177
- containerProps={{
178
- className: classnames(globalProps(filteredProps), className),
179
- id: id,
180
- ...ariaProps,
181
- ...dataProps,
182
- ...htmlProps
183
- }}
34
+ containerProps={{ ...containerProps, ...dataProps }}
184
35
  highcharts={Highcharts}
185
- options={options}
36
+ options={mergedOptions}
186
37
  />
187
- );
188
- };
38
+ )
39
+ }
189
40
 
190
- export default BarGraph;
41
+ export default BarGraph
@@ -20,9 +20,8 @@ const testId = 'bargraph1';
20
20
  test('bargraph uses exact classname', () => {
21
21
  render(
22
22
  <BarGraph
23
- className='super_important_class'
23
+ containerProps={{ className: 'super_important_class' }}
24
24
  data={{ testid: testId }}
25
- id='bar-default'
26
25
  />
27
26
  );
28
27
 
@@ -1 +1 @@
1
- <%= react_component('BarGraph', object.chart_options) %>
1
+ <%= react_component('BarGraph', object.react_props) %>
@@ -3,91 +3,25 @@
3
3
  module Playbook
4
4
  module PbBarGraph
5
5
  class BarGraph < Playbook::KitBase
6
- prop :align, type: Playbook::Props::Enum,
7
- values: %w[left right center],
8
- default: "center"
9
- prop :axis_title
10
- prop :axis_format
11
- prop :chart_data, type: Playbook::Props::Array,
12
- default: []
13
- prop :custom_options, default: {}
14
- prop :orientation, type: Playbook::Props::Enum,
15
- values: %w[vertical horizontal],
16
- default: "vertical"
17
- prop :point_start, type: Playbook::Props::Numeric
18
- prop :stacking
19
- prop :subtitle
20
- prop :title
21
- prop :x_axis_categories, type: Playbook::Props::Array,
22
- default: []
23
- prop :y_axis_min, type: Playbook::Props::Numeric
24
- prop :y_axis_max, type: Playbook::Props::Numeric
25
- prop :legend, type: Playbook::Props::Boolean,
26
- default: false
27
- prop :toggle_legend_click, type: Playbook::Props::Boolean,
28
- default: true
29
- prop :height
30
- prop :colors, type: Playbook::Props::Array,
31
- default: []
32
- prop :layout, type: Playbook::Props::Enum,
33
- values: %w[horizontal vertical proximate],
34
- default: "horizontal"
35
- prop :vertical_align, type: Playbook::Props::Enum,
36
- values: %w[top middle bottom],
37
- default: "bottom"
38
- prop :x, type: Playbook::Props::Numeric
39
- prop :y, type: Playbook::Props::Numeric
6
+ prop :options, default: {}
7
+ prop :container_props, default: {}
40
8
 
41
- def chart_type
42
- orientation == "horizontal" ? "bar" : "column"
9
+ def chart_options
10
+ options
43
11
  end
44
12
 
45
- def standard_options
13
+ def react_props
46
14
  {
47
- align: align,
48
- id: id,
49
- className: classname,
50
- chartData: chart_data,
51
- dark: dark ? "dark" : "",
52
- type: chart_type,
53
- title: title,
54
- stacking: stacking,
55
- subTitle: subtitle,
56
- axisTitle: axis_title,
57
- axisFormat: axis_format,
58
- pointStart: point_start,
59
- xAxisCategories: x_axis_categories,
60
- yAxisMin: y_axis_min,
61
- yAxisMax: y_axis_max,
62
- legend: legend,
63
- toggleLegendClick: toggle_legend_click,
64
- height: height,
65
- colors: colors,
66
- layout: layout,
67
- verticalAlign: vertical_align,
68
- x: x,
69
- y: y,
15
+ options: options,
16
+ containerProps: container_props_hash,
70
17
  }
71
18
  end
72
19
 
73
- def chart_options
74
- standard_options.deep_merge(custom_options)
75
- end
76
-
77
- def vertical_align_props
78
- if vertical_align
79
- if object.vertical_align
80
- original_result = super
81
- class_to_remove = "vertical_align_#{object.vertical_align}"
82
-
83
- modified_result = original_result.gsub(class_to_remove, "").strip
84
- modified_result.empty? ? nil : modified_result
85
- else
86
- super
87
- end
88
- else
89
- super
90
- end
20
+ def container_props_hash
21
+ container_props.merge({
22
+ id: id,
23
+ className: classname,
24
+ }).compact
91
25
  end
92
26
 
93
27
  def classname
@@ -15,12 +15,24 @@
15
15
  data: [1111,677,3245,500,200]
16
16
  }] %>
17
17
 
18
- <%= pb_rails("bar_graph", props: {
19
- axis_title: 'Number of Employees',
20
- chart_data: data,
21
- id: "bar-default",
22
- y_axis_min: 0,
23
- x_axis_categories:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
24
- subtitle: 'Source: thesolarfoundation.com',
25
- title: 'Solar Employment Growth by Sector, 2010-2016',
26
- }) %>
18
+
19
+ <% chart_options = {
20
+ series: data,
21
+ title: {
22
+ text: 'Solar Employment Growth by Sector, 2010-2016',
23
+ },
24
+ subtitle: {
25
+ text: 'Source: thesolarfoundation.com',
26
+ },
27
+ xAxis: {
28
+ categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May'],
29
+ },
30
+ yAxis: {
31
+ title: {
32
+ text: 'Number of Employees',
33
+ },
34
+ },
35
+ }
36
+ %>
37
+
38
+ <%= pb_rails("bar_graph", props: {options: chart_options}) %>
@@ -52,7 +52,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
52
52
  } = props;
53
53
 
54
54
  const returnedIcon = icon || iconMap[status]
55
- const iconClass = icon && icon !== "none" ? "custom_icon" : ""
55
+ const iconClass = icon ? "custom_icon" : ""
56
56
 
57
57
  const css = classnames(
58
58
  `pb_fixed_confirmation_toast_kit_${status}`,
@@ -92,7 +92,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
92
92
  onClick={handleClick}
93
93
  {...htmlProps}
94
94
  >
95
- {returnedIcon && icon !== "none" && (
95
+ {returnedIcon && (
96
96
  <Icon
97
97
  className="pb_icon"
98
98
  fixedWidth
@@ -8,7 +8,6 @@ examples:
8
8
  - fixed_confirmation_toast_auto_close: Click to Show Auto Close
9
9
  - fixed_confirmation_toast_children: Children
10
10
  - fixed_confirmation_toast_custom_icon: Custom Icon
11
- - fixed_confirmation_toast_no_icon: No Icon
12
11
 
13
12
  react:
14
13
  - fixed_confirmation_toast_default: Default
@@ -18,7 +17,6 @@ examples:
18
17
  - fixed_confirmation_toast_auto_close: Click to Show Auto Close
19
18
  - fixed_confirmation_toast_children: Children
20
19
  - fixed_confirmation_toast_custom_icon: Custom Icon
21
- - fixed_confirmation_toast_no_icon: No Icon
22
20
 
23
21
  swift:
24
22
  - fixed_confirmation_toast_default_swift: Default
@@ -5,4 +5,3 @@ export { default as FixedConfirmationToastPositions } from './_fixed_confirmatio
5
5
  export { default as FixedConfirmationToastAutoClose } from './_fixed_confirmation_toast_auto_close.jsx'
6
6
  export { default as FixedConfirmationToastChildren } from './_fixed_confirmation_toast_children.jsx'
7
7
  export { default as FixedConfirmationToastCustomIcon } from './_fixed_confirmation_toast_custom_icon.jsx'
8
- export { default as FixedConfirmationToastNoIcon } from './_fixed_confirmation_toast_no_icon.jsx'
@@ -1,7 +1,6 @@
1
1
  <%= pb_content_tag do %>
2
- <% if object.icon_value && object.icon_value != "none" %>
3
2
  <%= pb_rails("icon", props: { icon: object.icon_value, classname: "pb_icon", fixed_width: true }) %>
4
- <% end %>
3
+
5
4
  <% if content %>
6
5
  <%= content %>
7
6
  <% elsif object.show_text? %>
@@ -56,7 +56,7 @@ module Playbook
56
56
  end
57
57
 
58
58
  def icon_class
59
- icon.present? && icon != "none" ? " custom_icon" : ""
59
+ icon.present? ? " custom_icon" : ""
60
60
  end
61
61
 
62
62
  def classname
@@ -56,12 +56,6 @@ test('renders custom icon when provided', () => {
56
56
  expect(container.querySelector('.custom_icon')).toBeInTheDocument();
57
57
  });
58
58
 
59
- test("renders no icon when icon prop is 'none'", () => {
60
- const { container } = render(<FixedConfirmationToast icon="none" />);
61
- expect(container.querySelector('.pb_icon')).not.toBeInTheDocument();
62
- expect(container.querySelector('.custom_icon')).not.toBeInTheDocument();
63
- });
64
-
65
59
  test('renders correctly with multiLine prop', () => {
66
60
  const { container } = render(<FixedConfirmationToast multiLine />);
67
61
  expect(container.querySelector('._multi_line')).toBeInTheDocument();
@@ -0,0 +1 @@
1
+ import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useMemo,useState,useEffect}from"react";import{b as buildDataProps,H as Highcharts,c as HighchartsReact,d as buildAriaProps,e as buildHtmlProps,f as HighchartsMore,g as classnames,h as globalProps,S as SolidGauge,i as buildCss}from"./_typeahead-CKvqSXWH.js";import{b as barGraphTheme,c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-BplzvaaY.js";const BarGraph=({options:options,containerProps:containerProps={},data:data={}})=>{const dataProps=buildDataProps(data);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <BarGraph />",options);return{}}return Highcharts.merge({},barGraphTheme,options)}),[options]);return jsx(HighchartsReact,{containerProps:{...containerProps,...dataProps},highcharts:Highcharts,options:mergedOptions})};const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors2=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors2.length>0?mapColors(colors2):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};