playbook_ui 15.2.0.pre.alpha.toastfixes11417 → 15.2.0.pre.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +0 -7
  3. data/app/pb_kits/playbook/pb_button/_button.scss +0 -6
  4. data/app/pb_kits/playbook/pb_button/docs/_button_loading.html.erb +3 -7
  5. data/app/pb_kits/playbook/pb_button/docs/_button_loading.jsx +0 -29
  6. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +0 -4
  7. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.html.erb +16 -16
  8. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_stacked_alert.jsx +1 -2
  9. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.html.erb +31 -31
  10. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_status.jsx +3 -4
  11. data/app/pb_kits/playbook/pb_draggable/_draggable.scss +0 -8
  12. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +29 -105
  13. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +1 -0
  14. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +3 -5
  15. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_description.md +0 -2
  16. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -4
  17. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +0 -10
  18. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -12
  19. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +2 -2
  20. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.scss +21 -15
  21. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +5 -6
  22. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +0 -2
  23. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +3 -11
  24. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +8 -9
  25. data/app/pb_kits/playbook/pb_multiple_users_stacked/_multiple_users_stacked.scss +9 -36
  26. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +22 -105
  27. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +0 -3
  28. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +6 -14
  29. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb +4 -8
  30. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +0 -5
  31. data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +1 -3
  32. data/app/pb_kits/playbook/pb_text_input/text_input.rb +0 -6
  33. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +233 -250
  34. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  35. data/app/pb_kits/playbook/pb_timeline/timeline.test.js +2 -2
  36. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +10 -10
  37. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -39
  38. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +0 -2
  39. data/app/pb_kits/playbook/tokens/_positioning.scss +0 -1
  40. data/app/pb_kits/playbook/utilities/_hover.scss +2 -2
  41. data/app/pb_kits/playbook/utilities/_positioning.scss +1 -6
  42. data/app/pb_kits/playbook/utilities/globalProps.ts +3 -5
  43. data/dist/chunks/{_line_graph-BmLd7KGj.js → _line_graph-C9stNsP3.js} +1 -1
  44. data/dist/chunks/_typeahead-D3MtsWXG.js +6 -0
  45. data/dist/chunks/{_weekday_stacked-5TWRvQol.js → _weekday_stacked-Bvc7R5vH.js} +3 -3
  46. data/dist/chunks/vendor.js +1 -1
  47. data/dist/playbook-doc.js +2 -2
  48. data/dist/playbook-rails-react-bindings.js +1 -1
  49. data/dist/playbook-rails.js +1 -1
  50. data/dist/playbook.css +1 -1
  51. data/lib/playbook/hover.rb +1 -5
  52. data/lib/playbook/pb_forms_helper.rb +6 -7
  53. data/lib/playbook/version.rb +2 -2
  54. data/lib/playbook/z_index.rb +1 -1
  55. metadata +5 -6
  56. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.md +0 -1
  57. data/dist/chunks/_typeahead-BhGFKFka.js +0 -6
@@ -4,7 +4,7 @@
4
4
  @import "../tokens/shadows";
5
5
  @import "../tokens/positioning";
6
6
 
7
- .pb_typeahead_kit {
7
+ [class^=pb_typeahead_kit] {
8
8
  .typeahead-kit-select__option {
9
9
  cursor: pointer;
10
10
  }
@@ -28,7 +28,7 @@
28
28
  transition: opacity .15s ease-in-out;
29
29
  }
30
30
  }
31
- .pb_text_input_kit {
31
+ [class^=pb_text_input_kit] {
32
32
  .text_input_wrapper {
33
33
  .text_input {
34
34
  max-height: none;
@@ -47,7 +47,7 @@
47
47
  }
48
48
  }
49
49
  }
50
- .pb_list_kit_xpadding_borderless_ {
50
+ [class^=pb_list_kit] {
51
51
  max-height: 18em;
52
52
  overflow-y: auto;
53
53
  overscroll-behavior: contain;
@@ -60,15 +60,15 @@
60
60
  border-radius: $border_rad_heavier;
61
61
  transition: opacity .25s ease-in-out;
62
62
  }
63
- &:focus-within .pb_list_kit_xpadding_borderless_ {
63
+ &:focus-within [class^=pb_list_kit] {
64
64
  display: block;
65
65
  opacity: 1;
66
66
  }
67
- &:not(:focus-within) .pb_list_kit_xpadding_borderless_ {
67
+ &:not(:focus-within) [class^=pb_list_kit] {
68
68
  display: none;
69
69
  opacity: 0;
70
70
  }
71
- .pb_list_kit_xpadding_borderless_ {
71
+ [class^=pb_list_kit] {
72
72
  li {
73
73
  transition: background-color .25s ease-in-out;
74
74
  }
@@ -161,7 +161,7 @@
161
161
  .typeahead-plus-icon {
162
162
  color: $text_lt_lighter;
163
163
  }
164
- .pb_badge_kit_primary span {
164
+ [class^=pb_badge_kit] span {
165
165
  line-height: 16.5px;
166
166
  letter-spacing: normal;
167
167
  }
@@ -176,14 +176,14 @@
176
176
  }
177
177
  }
178
178
 
179
- &.dark {
179
+ &[class*=dark] {
180
180
  .pb_typeahead_wrapper .pb_typeahead_loading_indicator {
181
181
  color: $text_dk_light;
182
182
  }
183
183
  .pb_text_input_kit_label {
184
184
  color: $text_dk_light;
185
185
  }
186
- .pb_text_input_kit.dark .text_input_wrapper .text_input {
186
+ [class^=pb_text_input_kit].dark .text_input_wrapper .text_input {
187
187
  display: inherit !important;
188
188
  }
189
189
  .typeahead-kit-select__menu {
@@ -227,7 +227,7 @@
227
227
  .typeahead-kit-select__option--is-focused {
228
228
  background-color: $active_dark;
229
229
  }
230
- .pb_list_kit_xpadding_borderless_ {
230
+ [class^=pb_list_kit] {
231
231
  background-color: $bg_dark;
232
232
  }
233
233
  .pb_item_kit {
@@ -53,8 +53,6 @@ type TypeaheadProps = {
53
53
  pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
54
54
  onChange?: any,
55
55
  optionsByContext?: Record<string, Array<{ label: string; value?: string }>>
56
- required?: boolean,
57
- validation?: { message: string },
58
56
  searchContextSelector?: string,
59
57
  clearOnContextChange?: boolean,
60
58
  preserveSearchInput?: boolean,
@@ -96,16 +94,12 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
96
94
  onChange,
97
95
  optionsByContext = {},
98
96
  searchContextSelector,
99
- required = false,
100
- validation,
101
97
  clearOnContextChange = false,
102
98
  preserveSearchInput = false, // Default to false to maintain backward compatibility
103
99
  ...props
104
100
  }: TypeaheadProps) => {
105
101
  // State to manage the input value when preserveSearchInput is true
106
102
  const [inputValue, setInputValue] = useState("")
107
- // State to track if form has been submitted to control validation display for react rendered rails kit
108
- const [formSubmitted, setFormSubmitted] = useState(false)
109
103
 
110
104
  // If preserveSearchInput is true, we need to control the input value
111
105
  const handleInputChange = preserveSearchInput
@@ -141,7 +135,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
141
135
 
142
136
  const selectProps = {
143
137
  cacheOptions: true,
144
- required,
145
138
  components: {
146
139
  Control,
147
140
  ClearIndicator,
@@ -177,27 +170,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
177
170
 
178
171
  const [contextValue, setContextValue] = useState("")
179
172
 
180
- // Add listener for form validation to track when validation should be shown (needed for react rendered rails kit)
181
- useEffect(() => {
182
- const handleInvalid = (event: Event) => {
183
- const target = event.target as HTMLInputElement
184
- const typeaheadContainer = target.closest('[data-pb-react-component="Typeahead"]')
185
-
186
- if (typeaheadContainer) {
187
- // Check if this invalid event is specifically for our typeahead by comparing names so we do not have to require ids
188
- const invalidInputName = target.name || target.getAttribute('name')
189
- if (invalidInputName === name) {
190
- setFormSubmitted(true)
191
- }
192
- }
193
- }
194
- document.addEventListener('invalid', handleInvalid, true)
195
-
196
- return () => {
197
- document.removeEventListener('invalid', handleInvalid, true)
198
- }
199
- }, [name])
200
-
201
173
  // Add listener for clearing
202
174
  useEffect(() => {
203
175
  const handleClear = () => {
@@ -258,11 +230,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
258
230
  }
259
231
  }
260
232
 
261
- // Reset form submitted state when a selection is made (this is all for react rendered rails kit)
262
- if (action === 'select-option') {
263
- setFormSubmitted(false)
264
- }
265
-
266
233
  // If a value is selected and we're preserving input on blur, clear the input
267
234
  if (action === 'select-option' && preserveSearchInput) {
268
235
  setInputValue('')
@@ -301,11 +268,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
301
268
 
302
269
  const inlineClass = selectProps.inline ? 'inline' : null
303
270
 
304
- const shouldShowValidationError = required &&
305
- formSubmitted
306
-
307
- const errorDisplay = error || (shouldShowValidationError ? validation?.message || "Please fill out this field." : "")
308
-
309
271
  return (
310
272
  <div
311
273
  {...dataProps}
@@ -314,7 +276,7 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
314
276
  >
315
277
  <Tag
316
278
  classNamePrefix="typeahead-kit-select"
317
- error={errorDisplay}
279
+ error={error}
318
280
  isDisabled={disabled}
319
281
  onChange={handleOnChange}
320
282
  {...selectProps}
@@ -101,8 +101,6 @@ module Playbook
101
101
  plusIcon: plus_icon,
102
102
  truncate: truncate,
103
103
  wrapped: wrapped,
104
- required: required,
105
- validation: validation,
106
104
  searchContextSelector: search_context_selector,
107
105
  optionsByContext: options_by_context,
108
106
  clearOnContextChange: clear_on_context_change,
@@ -22,7 +22,6 @@ $z_7: 700 !default;
22
22
  $z_8: 800 !default;
23
23
  $z_9: 900 !default;
24
24
  $z_10: 1000 !default;
25
- $z_max: 999999 !default;
26
25
  $z_index: (
27
26
  zindex_1: $z_1,
28
27
  zindex_2: $z_1,
@@ -60,7 +60,7 @@
60
60
  @include hover-color-classes($text_colors);
61
61
  @include hover-color-classes($category_colors);
62
62
 
63
- .hover_visible_true {
63
+ .hover_visibility {
64
64
  opacity: 0;
65
65
  transition: opacity $transition-speed ease;
66
66
 
@@ -70,7 +70,7 @@
70
70
  }
71
71
 
72
72
  .group_hover:hover {
73
- .group_hover.hover_visible_true {
73
+ .group_hover.hover_visibility {
74
74
  opacity: 1;
75
75
  }
76
76
  }
@@ -58,10 +58,6 @@
58
58
  z-index: $z_10 !important;
59
59
  }
60
60
 
61
- .z_index_max {
62
- z-index: $z_max !important;
63
- }
64
-
65
61
  $zIndex_values: (
66
62
  1: $z_1,
67
63
  2: $z_2,
@@ -72,8 +68,7 @@ $zIndex_values: (
72
68
  7: $z_7,
73
69
  8: $z_8,
74
70
  9: $z_9,
75
- 10: $z_10,
76
- max: $z_max
71
+ 10: $z_10
77
72
  );
78
73
 
79
74
  @each $size, $size_value in $breakpoints_grid {
@@ -65,7 +65,7 @@ type Hover = Shadow & {
65
65
  color?: string,
66
66
  scale?: "sm" | "md" | "lg",
67
67
  underline?: boolean,
68
- visible?: boolean,
68
+ visibility?: boolean,
69
69
  }
70
70
 
71
71
  type GroupHover = {
@@ -186,7 +186,7 @@ type VerticalAlign = {
186
186
  verticalAlign?: "baseline" | "super" | "top" | "middle" | "bottom" | "sub" | "text-top" | "text-bottom"
187
187
  }
188
188
 
189
- type ZIndexType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 'max'
189
+ type ZIndexType = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
190
190
  type ZIndexResponsiveType = {[key: string]: ZIndexType}
191
191
  type ZIndex = {
192
192
  zIndex?: ZIndexType,
@@ -252,7 +252,7 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
252
252
  css += hover.underline ? `hover_underline ` : '';
253
253
  css += hover.scale ? `hover_scale_${hover.scale} ` : '';
254
254
  css += hover.color ? `hover_color-${hover.color } ` : '';
255
- css += hover.visible ? `hover_visible_true` : '';
255
+ css += hover.visibility ? `hover_visibility` : '';
256
256
  return css;
257
257
  },
258
258
 
@@ -439,8 +439,6 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
439
439
  Object.entries(zIndexEntry[1]).forEach((zIndexObj) => {
440
440
  css += `z_index_${zIndexObj[0]}_${zIndexObj[1]} `
441
441
  })
442
- } else if (zIndexEntry[1] === 'max') {
443
- css += `z_index_max `
444
442
  }
445
443
  }
446
444
  })
@@ -1 +1 @@
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-BhGFKFka.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-D3MtsWXG.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};