playbook_ui 15.0.0.pre.alpha.removewebpacker10550 → 15.0.0.pre.alpha.removewebpacker10589

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 (62) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -0
  3. data/app/pb_kits/playbook/pb_card/_card.scss +12 -4
  4. data/app/pb_kits/playbook/pb_card/_card.tsx +3 -3
  5. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +10 -0
  6. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.html.erb +3 -0
  7. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.jsx +8 -0
  8. data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +1 -0
  9. data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +2 -1
  10. data/app/pb_kits/playbook/pb_nav/_item.tsx +19 -5
  11. data/app/pb_kits/playbook/pb_nav/item.html.erb +6 -2
  12. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb +3 -3
  13. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_common.html.erb +3 -3
  14. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_confirmation.html.erb +3 -3
  15. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.html.erb +3 -3
  16. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.html.erb +3 -3
  17. data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.scss +3 -0
  18. data/app/pb_kits/playbook/pb_pb_circle_chart/_pb_circle_chart.tsx +62 -0
  19. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.html.erb +31 -0
  20. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_block_content.jsx +81 -0
  21. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.html.erb +25 -0
  22. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.jsx +40 -0
  23. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_color_overrides.md +5 -0
  24. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.html.erb +27 -0
  25. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.jsx +39 -0
  26. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_custom_tooltip.md +5 -0
  27. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.html.erb +93 -0
  28. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.jsx +131 -0
  29. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_legend_position.md +14 -0
  30. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.html.erb +42 -0
  31. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_labels.jsx +58 -0
  32. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.html.erb +24 -0
  33. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_data_with_legend.jsx +38 -0
  34. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.html.erb +22 -0
  35. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_default.jsx +33 -0
  36. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.html.erb +118 -0
  37. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_inner_sizes.jsx +144 -0
  38. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_live_data.jsx +60 -0
  39. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.html.erb +24 -0
  40. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_rounded.jsx +42 -0
  41. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.html.erb +38 -0
  42. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/_pb_circle_chart_with_title.jsx +52 -0
  43. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/example.yml +29 -0
  44. data/app/pb_kits/playbook/pb_pb_circle_chart/docs/index.js +11 -0
  45. data/app/pb_kits/playbook/pb_pb_circle_chart/pbCircleChartTheme.ts +88 -0
  46. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.html.erb +1 -0
  47. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.rb +28 -0
  48. data/app/pb_kits/playbook/pb_pb_circle_chart/pb_circle_chart.test.jsx +51 -0
  49. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +2 -2
  50. data/dist/chunks/{_line_graph-BgI_x0Qp.js → _line_graph-DeH7NK-i.js} +1 -1
  51. data/dist/chunks/{_typeahead-DCpj5VBx.js → _typeahead-CCGp0OQe.js} +1 -1
  52. data/dist/chunks/{_weekday_stacked-Bq-Luje1.js → _weekday_stacked-BHLwECdV.js} +2 -2
  53. data/dist/chunks/vendor.js +1 -1
  54. data/dist/menu.yml +6 -0
  55. data/dist/playbook-doc.js +2 -2
  56. data/dist/playbook-rails-react-bindings.js +1 -1
  57. data/dist/playbook-rails.js +1 -1
  58. data/dist/playbook.css +1 -1
  59. data/lib/playbook/forms/builder/form_field_builder.rb +28 -1
  60. data/lib/playbook/kit_base.rb +3 -0
  61. data/lib/playbook/version.rb +1 -1
  62. metadata +37 -5
@@ -0,0 +1,60 @@
1
+ import React, { useState } from "react";
2
+ import { PbCircleChart, Button } from "playbook-ui";
3
+
4
+ const chartData = [
5
+ {
6
+ name: "Waiting for Calls",
7
+ y: 41,
8
+ },
9
+ {
10
+ name: "On Call",
11
+ y: 49,
12
+ },
13
+ {
14
+ name: "After Call",
15
+ y: 10,
16
+ },
17
+ ];
18
+
19
+ const chartData2 = [
20
+ {
21
+ name: "Waiting for Calls",
22
+ y: 48,
23
+ },
24
+ {
25
+ name: "On Call",
26
+ y: 12,
27
+ },
28
+ {
29
+ name: "After Call",
30
+ y: 140,
31
+ },
32
+ ];
33
+
34
+
35
+ const PbCircleChartLiveData = (props) => {
36
+
37
+ const [data, setData] = useState(chartData);
38
+
39
+ const updateValue = () => {
40
+ setData(chartData2)
41
+ }
42
+ const chartOptions = {
43
+ series: [{ data: data }],
44
+ }
45
+
46
+ return (
47
+ <div>
48
+ <Button
49
+ onClick={updateValue}
50
+ text="Update Value"
51
+ />
52
+ <PbCircleChart
53
+ options={chartOptions}
54
+ {...props}
55
+ />
56
+ </div>
57
+ );
58
+ };
59
+
60
+ export default PbCircleChartLiveData;
@@ -0,0 +1,24 @@
1
+ <% data = [
2
+ {
3
+ name: "Waiting for Calls",
4
+ y: 41,
5
+ },
6
+ {
7
+ name: "On Call",
8
+ y: 49,
9
+ },
10
+ {
11
+ name: "After Call",
12
+ y: 10,
13
+ },
14
+ ] %>
15
+
16
+ <% chart_options = {
17
+ series: [{
18
+ data: data,
19
+ innerSize: '100%',
20
+ borderWidth: '20',
21
+ }],
22
+ } %>
23
+
24
+ <%= pb_rails("pb_circle_chart", props: { options: chart_options }) %>
@@ -0,0 +1,42 @@
1
+ import React from "react";
2
+ import { PbCircleChart } from "playbook-ui";
3
+
4
+ const data= [
5
+ {
6
+ name: "Waiting for Calls",
7
+ y: 41,
8
+ },
9
+ {
10
+ name: "On Call",
11
+ y: 49,
12
+ },
13
+ {
14
+ name: "After Call",
15
+ y: 10,
16
+ },
17
+ ]
18
+
19
+
20
+ const PbCircleChartRounded = (props) => {
21
+ const chartOptions = {
22
+ series: [{ data: data }],
23
+ plotOptions: {
24
+ pie: {
25
+ borderColor: null,
26
+ borderWidth: 20,
27
+ innerSize: '100%',
28
+ },
29
+ },
30
+ };
31
+
32
+ return (
33
+ <div>
34
+ <PbCircleChart
35
+ options={chartOptions}
36
+ {...props}
37
+ />
38
+ </div>
39
+ );
40
+ };
41
+
42
+ export default PbCircleChartRounded;
@@ -0,0 +1,38 @@
1
+ <% data = [
2
+ {
3
+ name: 'Facebook',
4
+ y: 2498,
5
+ },
6
+ {
7
+ name: 'YouTube',
8
+ y: 2000,
9
+ },
10
+ {
11
+ name: 'WhatsApp',
12
+ y: 2000,
13
+ },
14
+ {
15
+ name: 'Facebook Messenger',
16
+ y: 1300,
17
+ },
18
+ {
19
+ name: 'WeChat',
20
+ y: 1165,
21
+ },
22
+ {
23
+ name: 'Instagram',
24
+ y: 1000,
25
+ },
26
+ {
27
+ name: 'Tik Tok',
28
+ y: 800,
29
+ },
30
+ ] %>
31
+
32
+ <% chart_options = {
33
+ series: [{ data: data }],
34
+ title: { text: "Active Users on Social Media" },
35
+ } %>
36
+
37
+
38
+ <%= pb_rails("pb_circle_chart", props: { options: chart_options }) %>
@@ -0,0 +1,52 @@
1
+ import React from "react";
2
+ import { PbCircleChart } from "playbook-ui";
3
+
4
+ const data= [
5
+ {
6
+ name: 'Facebook',
7
+ y: 2498,
8
+ },
9
+ {
10
+ name: 'YouTube',
11
+ y: 2000,
12
+ },
13
+ {
14
+ name: 'WhatsApp',
15
+ y: 2000,
16
+ },
17
+ {
18
+ name: 'Facebook Messenger',
19
+ y: 1300,
20
+ },
21
+ {
22
+ name: 'WeChat',
23
+ y: 1165,
24
+ },
25
+ {
26
+ name: 'Instagram',
27
+ y: 1000,
28
+ },
29
+ {
30
+ name: 'Tik Tok',
31
+ y: 800,
32
+ },
33
+ ]
34
+
35
+
36
+ const PbCircleChartWithTitle = (props) => {
37
+ const chartOptions = {
38
+ title: { text: "Active Users on Social Media" },
39
+ series: [{ data: data }],
40
+ };
41
+
42
+ return (
43
+ <div>
44
+ <PbCircleChart
45
+ options={chartOptions}
46
+ {...props}
47
+ />
48
+ </div>
49
+ );
50
+ };
51
+
52
+ export default PbCircleChartWithTitle;
@@ -0,0 +1,29 @@
1
+ examples:
2
+
3
+ rails:
4
+ - pb_circle_chart_default: Default
5
+ - pb_circle_chart_rounded: Rounded Corners
6
+ - pb_circle_chart_block_content: Accepts Any Block
7
+ - pb_circle_chart_color_overrides: Color Overrides
8
+ - pb_circle_chart_data_with_labels: Data with Labels
9
+ - pb_circle_chart_data_with_legend: Data with Legend
10
+ - pb_circle_chart_data_legend_position: Legend Position
11
+ - pb_circle_chart_with_title: With Title
12
+ - pb_circle_chart_inner_sizes: Inner Circle Size Options
13
+ - pb_circle_chart_custom_tooltip: Tooltip Customization
14
+
15
+
16
+ react:
17
+ - pb_circle_chart_default: Default
18
+ - pb_circle_chart_live_data: Live Data
19
+ - pb_circle_chart_rounded: Rounded Corners
20
+ - pb_circle_chart_block_content: Accepts Any Block
21
+ - pb_circle_chart_color_overrides: Color Overrides
22
+ - pb_circle_chart_data_with_labels: Data with Labels
23
+ - pb_circle_chart_data_with_legend: Data with Legend
24
+ - pb_circle_chart_data_legend_position: Legend Position
25
+ - pb_circle_chart_with_title: With Title
26
+ - pb_circle_chart_inner_sizes: Inner Circle Size Options
27
+ - pb_circle_chart_custom_tooltip: Tooltip Customization
28
+
29
+
@@ -0,0 +1,11 @@
1
+ export { default as PbCircleChartDefault } from './_pb_circle_chart_default.jsx'
2
+ export { default as PbCircleChartLiveData } from './_pb_circle_chart_live_data.jsx'
3
+ export { default as PbCircleChartRounded } from './_pb_circle_chart_rounded.jsx'
4
+ export { default as PbCircleChartBlockContent } from './_pb_circle_chart_block_content.jsx'
5
+ export { default as PbCircleChartColorOverrides } from './_pb_circle_chart_color_overrides.jsx'
6
+ export { default as PbCircleChartDataWithLabels } from './_pb_circle_chart_data_with_labels.jsx'
7
+ export { default as PbCircleChartDataWithLegend } from './_pb_circle_chart_data_with_legend.jsx'
8
+ export { default as PbCircleChartDataLegendPosition } from './_pb_circle_chart_data_legend_position.jsx'
9
+ export { default as PbCircleChartWithTitle } from './_pb_circle_chart_with_title.jsx'
10
+ export { default as PbCircleChartInnerSizes } from './_pb_circle_chart_inner_sizes.jsx'
11
+ export { default as PbCircleChartCustomTooltip } from './_pb_circle_chart_custom_tooltip.jsx'
@@ -0,0 +1,88 @@
1
+ import colors from '../tokens/exports/_colors.module.scss'
2
+ import typography from '../tokens/exports/_typography.module.scss'
3
+
4
+ const pbCircleChartTheme = {
5
+ title: {
6
+ text: "",
7
+ style: {
8
+ color: colors.text_lt_default,
9
+ fontFamily: typography.font_family_base,
10
+ fontWeight: typography.bold,
11
+ fontSize: typography.heading_3,
12
+ },
13
+ },
14
+ chart: {
15
+ type: "pie",
16
+ },
17
+ tooltip: {
18
+ backgroundColor: {
19
+ linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
20
+ stops: [
21
+ [0, colors.bg_dark],
22
+ [1, colors.bg_dark],
23
+ ],
24
+ },
25
+ pointFormat:
26
+ '<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: ' +
27
+ "<b>{point.y}</b>",
28
+ followPointer: true,
29
+ shadow: false,
30
+ borderWidth: 0,
31
+ borderRadius: 10,
32
+ style: {
33
+ fontFamily: typography.font_family_base,
34
+ color: colors.text_dk_default,
35
+ fontWeight: typography.regular,
36
+ fontSize: typography.text_smaller,
37
+ },
38
+ },
39
+ plotOptions: {
40
+ pie: {
41
+ dataLabels: {
42
+ enabled: false,
43
+ connectorShape: "straight",
44
+ connectorWidth: 3,
45
+ format: "<div>{point.name}</div>",
46
+ style: {
47
+ fontFamily: typography.font_family_base,
48
+ fontSize: typography.text_smaller,
49
+ color: colors.text_lt_light,
50
+ fontWeight: typography.regular,
51
+ textOutline: '2px $white',
52
+ },
53
+ },
54
+ innerSize: '50%',
55
+ borderColor: "",
56
+ borderWidth: null as number | null,
57
+ colors: [
58
+ colors.data_1,
59
+ colors.data_2,
60
+ colors.data_3,
61
+ colors.data_4,
62
+ colors.data_5,
63
+ colors.data_6,
64
+ colors.data_7,
65
+ ],
66
+ },
67
+ },
68
+ legend: {
69
+ layout: 'horizontal',
70
+ align: 'center',
71
+ verticalAlign: 'bottom',
72
+ itemStyle: {
73
+ fontFamily: typography.font_family_base,
74
+ color: colors.text_lt_light,
75
+ fontWeight: typography.regular,
76
+ fontSize: typography.text_smaller,
77
+ },
78
+ itemHoverStyle: {
79
+ color: colors.text_lt_default,
80
+ },
81
+ itemHiddenStyle: {
82
+ color: colors.text_lt_lighter,
83
+ },
84
+ },
85
+ credits: { enabled: false }
86
+ }
87
+
88
+ export default pbCircleChartTheme;
@@ -0,0 +1 @@
1
+ <%= react_component('PbCircleChart', object.react_props) %>
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbPbCircleChart
5
+ class PbCircleChart < ::Playbook::KitBase
6
+ prop :options, default: {}
7
+ prop :container_props, default: {}
8
+
9
+ def react_props
10
+ {
11
+ options: options,
12
+ containerProps: container_props_hash,
13
+ }
14
+ end
15
+
16
+ def container_props_hash
17
+ container_props.merge({
18
+ id: id,
19
+ className: classname,
20
+ }).compact
21
+ end
22
+
23
+ def classname
24
+ generate_classname("pb_pb_circle_chart")
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,51 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+
4
+ import { PbCircleChart } from 'playbook-ui'
5
+
6
+ beforeEach(() => {
7
+ // Silences error logs within the test suite.
8
+ jest.spyOn(console, 'error');
9
+ jest.spyOn(console, 'warn');
10
+ console.error.mockImplementation(() => {});
11
+ console.warn.mockImplementation(() => {});
12
+ });
13
+
14
+ afterEach(() => {
15
+ console.error.mockRestore();
16
+ console.warn.mockRestore();
17
+ });
18
+
19
+ const chartOptions = {
20
+ series: [
21
+ {
22
+ data: [
23
+ {
24
+ name: "Waiting for Calls",
25
+ y: 41,
26
+ },
27
+ {
28
+ name: "On Call",
29
+ y: 49,
30
+ },
31
+ {
32
+ name: "After Call",
33
+ y: 10,
34
+ },
35
+ ],
36
+ },
37
+ ],
38
+ };
39
+
40
+ const testId = 'pbcirclechart1';
41
+
42
+ test('Kit to exist', () => {
43
+ render(
44
+ <PbCircleChart
45
+ data={{testid: testId}}
46
+ options={chartOptions}
47
+ />
48
+ )
49
+ expect(screen.getByTestId(testId)).toBeInTheDocument()
50
+ })
51
+
@@ -13,8 +13,8 @@
13
13
  <script>
14
14
  document.addEventListener('DOMContentLoaded', () => {
15
15
  function handleButtonClick() {
16
- const editorContainer = [...document.querySelectorAll('[data-react-props]')]
17
- .find(element => element.getAttribute('data-react-props')?.includes('"id":"content-preview-editor"'))
16
+ const editorContainer = [...document.querySelectorAll('[data-pb-react-props]')]
17
+ .find(element => element.getAttribute('data-pb-react-props')?.includes('"id":"content-preview-editor"'))
18
18
 
19
19
  const editorElement = editorContainer?.querySelector('trix-editor')
20
20
  const inputId = editorElement?.getAttribute('input')
@@ -1 +1 @@
1
- import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{c as buildAriaProps,d as buildDataProps,e as buildHtmlProps,H as HighchartsReact,f as Highcharts,g as classnames,h as globalProps,i as HighchartsMore,S as SolidGauge,j as buildCss}from"./_typeahead-DCpj5VBx.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-QZuu1ltS.js";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 BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,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);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],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:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}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})};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};
1
+ import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{d as buildAriaProps,e as buildDataProps,f as buildHtmlProps,H as HighchartsReact,g as Highcharts,h as classnames,i as globalProps,j as HighchartsMore,S as SolidGauge,k as buildCss}from"./_typeahead-CCGp0OQe.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-QZuu1ltS.js";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 BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,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);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],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:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}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})};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};