playbook_ui 16.7.0.pre.alpha.PLAY2932datepickerinlineproponly16247 → 16.7.0.pre.alpha.play2924tooltipmisalignment16199

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 565d8cd7eb822030903f71d51b92426f330b7baeecf691207f1a82b3950ff41a
4
- data.tar.gz: c6478e1ae1e8b441d59206c3abd47a63a1e231eed35eebf357bcd2849e17df0b
3
+ metadata.gz: 3c7c7804406ddf89dd94895bb1223d17244e37fd4b62648847708557f0c879c6
4
+ data.tar.gz: bb3cad46ebc29326ce281440c1b6d17ac65c45e7d794cd80011d9d57ce1d3cf6
5
5
  SHA512:
6
- metadata.gz: bbd0f4ace6597d6849ced75952307d949e895541c6347b56cc9c1777e8972e97e6a0589bfbe66736c23e3f37047356fa221014ce3bcd7b09554bf3e46819200b
7
- data.tar.gz: f0160cd0552d3c0764ee4c968cd0aa4d921ed85ad396aa33b0ae8d6fb79e66f985d3ef77d9739c325d09095d8807b62ae5dcac2b7d951cb99339367425cd6636
6
+ metadata.gz: be4d9cfd2a3dc813d0746783e14fb55d6ff4c3d9f003bb0cd62efb80ffeaa4ea2bd82a908b1b8acb772019a27292aca2b0d81df29356829ff8011672e1c500c4
7
+ data.tar.gz: 1b395492389b12ee2c69d690a954720b809e3cd0b61d9f7c2182256ca79c34aec2e2b593cc326cca84b9166df778cdd6ab2a060f9f2d5e286a33443ae53c1051
@@ -180,7 +180,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
180
180
  //@ts-ignore
181
181
  globalProps(filteredProps),
182
182
  error ? 'error' : null,
183
- inLine && 'inline-date-picker',
184
183
  className
185
184
  )
186
185
 
@@ -263,7 +262,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
263
262
  }
264
263
  </div>
265
264
 
266
- {!hideIcon && !inLine &&
265
+ {!hideIcon &&
267
266
  <div
268
267
  className={iconWrapperClass()}
269
268
  id={`cal-icon-${pickerId}`}
@@ -275,7 +274,7 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
275
274
  </div>
276
275
  }
277
276
 
278
- {inLine ?
277
+ {hideIcon && inLine ?
279
278
  <div>
280
279
  <div
281
280
  className={`${iconWrapperClass()} date-picker-inline-icon-plus`}
@@ -39,7 +39,7 @@
39
39
  <input type="hidden" id="<%= "#{object.end_date_id}" %>" name="<%= "#{object.end_date_name}" %>">
40
40
  <% end %>
41
41
 
42
- <% if !object.hide_icon && !object.inline %>
42
+ <% if !object.hide_icon %>
43
43
  <div
44
44
  class="<%= object.icon_wrapper_class %>"
45
45
  id="cal-icon-<%= object.picker_id %>"
@@ -52,7 +52,7 @@
52
52
  <% end %>
53
53
 
54
54
  <!-- Inline -->
55
- <% if object.inline %>
55
+ <% if object.hide_icon && object.inline %>
56
56
  <!-- Plus Icon -->
57
57
  <div
58
58
  class="<%= object.icon_wrapper_class %> date-picker-inline-icon-plus"
@@ -92,8 +92,7 @@ module Playbook
92
92
 
93
93
  def classname
94
94
  default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
95
- inline_class = inline ? " inline-date-picker" : ""
96
- generate_classname("pb_date_picker_kit") + default_margin_bottom + inline_class
95
+ generate_classname("pb_date_picker_kit") + default_margin_bottom
97
96
  end
98
97
 
99
98
  def date_picker_config
@@ -40,37 +40,6 @@ describe('DatePicker Kit', () => {
40
40
  expect(kit).toHaveClass('pb_date_picker_kit mb_sm')
41
41
  })
42
42
 
43
- test('inLine alone adds inline-date-picker class and inline control icons, not the calendar icon', () => {
44
- const testId = 'datepicker-inline-only'
45
- render(
46
- <DatePicker
47
- data={{ testid: testId }}
48
- inLine
49
- pickerId="date-picker-inline-only"
50
- />
51
- )
52
-
53
- const kit = screen.getByTestId(testId)
54
- expect(kit).toHaveClass('inline-date-picker')
55
- expect(kit.querySelector('#cal-icon-date-picker-inline-only')).not.toBeInTheDocument()
56
- expect(kit.querySelector('#date-picker-inline-only-icon-plus')).toBeInTheDocument()
57
- expect(kit.querySelector('#date-picker-inline-only-angle-down')).toBeInTheDocument()
58
- })
59
-
60
- test('hideIcon without inLine does not render inline control icons', () => {
61
- const testId = 'datepicker-hide-icon-only'
62
- render(
63
- <DatePicker
64
- data={{ testid: testId }}
65
- hideIcon
66
- pickerId="date-picker-hide-icon-only"
67
- />
68
- )
69
-
70
- const kit = screen.getByTestId(testId)
71
- expect(kit.querySelector('#date-picker-hide-icon-only-icon-plus')).not.toBeInTheDocument()
72
- })
73
-
74
43
  test('shows DatePicker date format m/d/Y', async () => {
75
44
  const testId = 'datepicker-date'
76
45
  render(
@@ -1,4 +1,6 @@
1
1
  <%= pb_rails("date_picker", props: {
2
+ classname: "inline-date-picker",
3
+ hide_icon: true,
2
4
  inline: true,
3
5
  picker_id: "date-picker-inline"
4
6
  }) %>
@@ -6,6 +6,8 @@ const DatePickerInline = (props) => {
6
6
  return (
7
7
  <div>
8
8
  <DatePicker
9
+ className="inline-date-picker"
10
+ hideIcon
9
11
  inLine
10
12
  pickerId="date-picker-inline"
11
13
  {...props}
@@ -113,7 +113,9 @@
113
113
  "name": "inline_date",
114
114
  "pickerId": "playground-date-inline",
115
115
  "label": "Inline",
116
- "inLine": true
116
+ "className": "inline-date-picker",
117
+ "inLine": true,
118
+ "hideIcon": true
117
119
  }
118
120
  },
119
121
  {
@@ -88,7 +88,9 @@
88
88
  "name": "inline_date",
89
89
  "pickerId": "playground-date-inline",
90
90
  "label": "Inline",
91
- "inLine": true
91
+ "className": "inline-date-picker",
92
+ "inLine": true,
93
+ "hideIcon": true
92
94
  }
93
95
  },
94
96
  {
@@ -22,7 +22,10 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
22
22
  }
23
23
  }
24
24
 
25
+ $arrow_vertical_offset: calc(50% - #{$space_xs * 1.2});
26
+
25
27
  .pb_tooltip_kit {
28
+ &.tooltip_tooltip,
26
29
  ~ .tooltip_tooltip,
27
30
  .tooltip_tooltip {
28
31
  display: block;
@@ -66,15 +69,6 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
66
69
  &.visible {
67
70
  color: $white;
68
71
  background-color: rgba($black, $opacity_9);
69
- &.right {
70
- box-shadow: -8px 0 28px 0 $tooltip_shadow;
71
- }
72
- &.bottom {
73
- box-shadow: 0 -12px 28px 0 $tooltip_shadow;
74
- }
75
- &.left {
76
- box-shadow: 8px 0 28px 0 $tooltip_shadow;
77
- }
78
72
  // react arrow
79
73
  .arrow_bg {
80
74
  width: 10px;
@@ -104,7 +98,8 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
104
98
  }
105
99
 
106
100
  &.dark {
107
- ~.tooltip_tooltip,
101
+ &.tooltip_tooltip,
102
+ ~ .tooltip_tooltip,
108
103
  .tooltip_tooltip {
109
104
  //react
110
105
  &.visible {
@@ -134,11 +129,41 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
134
129
  }
135
130
  }
136
131
 
137
- // Right
138
- .pb_tooltip_kit .tooltip_tooltip {
139
- $arrow_vertical_offset: calc(50% - #{$space_xs * 1.2});
132
+ .pb_tooltip_kit.dark.tooltip_tooltip,
133
+ .pb_tooltip_kit.dark ~ .tooltip_tooltip,
134
+ .pb_tooltip_kit.dark .tooltip_tooltip {
135
+ //react
136
+ &.visible {
137
+ color: $charcoal;
138
+ background-color: $white;
139
+ }
140
+ //rails
141
+ &.show {
142
+ color: $charcoal;
143
+ background-color: $white;
144
+ }
145
+ .arrow {
146
+ border-color: $white transparent transparent transparent;
147
+ opacity: $opacity_10;
148
+ }
149
+ // react arrow
150
+ .arrow_bg {
151
+ background-color: $white;
152
+ }
153
+ &.flipped {
154
+ .arrow {
155
+ border-color: transparent transparent $black transparent;
156
+ opacity: $opacity_9;
157
+ }
158
+ }
159
+ }
140
160
 
141
- &[data-popper-placement="right"] {
161
+ .pb_tooltip_kit.tooltip_tooltip,
162
+ .pb_tooltip_kit ~ .tooltip_tooltip,
163
+ .pb_tooltip_kit .tooltip_tooltip {
164
+ &[data-placement="right"],
165
+ &[data-placement="right-start"],
166
+ &[data-placement="right-end"] {
142
167
  box-shadow: -8px 0 28px 0 $tooltip_shadow;
143
168
  .arrow {
144
169
  left: -18px;
@@ -148,11 +173,13 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
148
173
  transform: rotate(90deg);
149
174
  }
150
175
  &.flipped .arrow {
151
- transform: rotate(270deg);
176
+ transform: rotate(270deg);
152
177
  }
153
178
  }
154
179
 
155
- &[data-popper-placement="bottom"] {
180
+ &[data-placement="bottom"],
181
+ &[data-placement="bottom-start"],
182
+ &[data-placement="bottom-end"] {
156
183
  box-shadow: 0 -12px 28px 0 $tooltip_shadow;
157
184
  .arrow {
158
185
  top: -18px;
@@ -164,7 +191,9 @@ $tooltip_shadow: rgba(60, 106, 172, 0.18);
164
191
  }
165
192
  }
166
193
 
167
- &[data-popper-placement="left"] {
194
+ &[data-placement="left"],
195
+ &[data-placement="left-start"],
196
+ &[data-placement="left-end"] {
168
197
  box-shadow: 8px 0 28px 0 $tooltip_shadow;
169
198
  .arrow {
170
199
  margin-bottom: 0;
@@ -1,7 +1,9 @@
1
1
  import React, { useRef, useState, forwardRef, ForwardedRef } from "react"
2
2
 
3
3
  import {
4
+ autoUpdate,
4
5
  arrow,
6
+ FloatingPortal,
5
7
  flip,
6
8
  offset,
7
9
  Placement,
@@ -43,6 +45,8 @@ type TooltipProps = {
43
45
  forceOpenTooltip?: boolean,
44
46
  } & GlobalProps
45
47
 
48
+ const TOOLTIP_BOUNDARY_PADDING = 8
49
+
46
50
  const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): React.ReactElement => {
47
51
  const {
48
52
  aria = {},
@@ -82,7 +86,7 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
82
86
 
83
87
  const {
84
88
  context,
85
- middlewareData: { arrow: { x: arrowX, y: arrowY } = {}, },
89
+ middlewareData: { arrow: { centerOffset = 0, x: arrowX, y: arrowY } = {}, },
86
90
  placement,
87
91
  refs,
88
92
  strategy,
@@ -90,17 +94,20 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
90
94
  y,
91
95
  } = useFloating({
92
96
  strategy: position,
97
+ whileElementsMounted: autoUpdate,
93
98
  middleware: [
94
- arrow({
95
- element: arrowRef,
96
- }),
99
+ offset(10),
97
100
  flip({
98
101
  fallbackPlacements: ["top", "right", "bottom", "left"],
99
102
  fallbackStrategy: "initialPlacement",
100
103
  flipAlignment: false,
104
+ padding: TOOLTIP_BOUNDARY_PADDING,
105
+ }),
106
+ shift({ padding: TOOLTIP_BOUNDARY_PADDING }),
107
+ arrow({
108
+ element: arrowRef,
109
+ padding: TOOLTIP_BOUNDARY_PADDING,
101
110
  }),
102
- offset(10),
103
- shift()
104
111
  ],
105
112
  open,
106
113
  onOpenChange(open) {
@@ -136,6 +143,8 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
136
143
  right: "left",
137
144
  top: "bottom",
138
145
  }[placement.split("-")[0]]
146
+ const arrowPlacementStyle = staticSide ? { [staticSide]: "-5px" } : {}
147
+ const shouldHideArrow = centerOffset !== 0
139
148
 
140
149
  const tooltipSizing = () => {
141
150
  return Object.assign(
@@ -174,43 +183,49 @@ const Tooltip = forwardRef((props: TooltipProps, ref: ForwardedRef<unknown>): Re
174
183
  {children}
175
184
  </div>
176
185
  {(open || forceOpenTooltip) && (
177
- <div
178
- {...getFloatingProps({
179
- className: `tooltip_tooltip ${placement} visible`,
180
- ref: refs.setFloating,
181
- role: "tooltip",
182
- style: {
183
- ...tooltipSizing(),
184
- position: strategy,
185
- top: y ?? 0,
186
- left: x ?? 0,
187
- zIndex: zIndex ?? 0,
188
- },
189
- })}
190
- >
191
- <Flex
192
- align="center"
193
- gap="xs"
194
- >
195
- {icon && (
196
- <i className={`pb_icon_kit`}>
197
- <Icon
198
- icon={icon}
199
- />
200
- </i>)}
201
- {text}
202
- </Flex>
186
+ <FloatingPortal>
203
187
  <div
204
- className="arrow_bg"
205
- ref={arrowRef}
206
- style={{
207
- position: "absolute",
208
- left: arrowX != null ? `${arrowX}px` : "",
209
- top: arrowY != null ? `${arrowY}px` : "",
210
- [staticSide]: "-5px",
211
- }}
212
- />
213
- </div>
188
+ data-placement={placement}
189
+ {...getFloatingProps({
190
+ className: classnames("pb_tooltip_kit", `tooltip_tooltip ${placement} visible`, {
191
+ dark: rest.dark,
192
+ }),
193
+ ref: refs.setFloating,
194
+ role: "tooltip",
195
+ style: {
196
+ ...tooltipSizing(),
197
+ position: strategy,
198
+ top: y ?? 0,
199
+ left: x ?? 0,
200
+ ...(zIndex ? { zIndex } : {}),
201
+ },
202
+ })}
203
+ >
204
+ <Flex
205
+ align="center"
206
+ gap="xs"
207
+ >
208
+ {icon && (
209
+ <i className={`pb_icon_kit`}>
210
+ <Icon
211
+ icon={icon}
212
+ />
213
+ </i>)}
214
+ {text}
215
+ </Flex>
216
+ <div
217
+ className="arrow_bg"
218
+ ref={arrowRef}
219
+ style={{
220
+ opacity: shouldHideArrow ? 0 : 1,
221
+ position: "absolute",
222
+ left: arrowX != null ? `${arrowX}px` : "",
223
+ top: arrowY != null ? `${arrowY}px` : "",
224
+ ...arrowPlacementStyle,
225
+ }}
226
+ />
227
+ </div>
228
+ </FloatingPortal>
214
229
  )}
215
230
  </>
216
231
  )
@@ -35,7 +35,10 @@ test("opens on mouseenter", async () => {
35
35
 
36
36
  fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
37
37
  await waitFor(() => {
38
- expect(screen.queryByRole("tooltip")).toBeInTheDocument();
38
+ const tooltip = screen.queryByRole("tooltip");
39
+
40
+ expect(tooltip).toBeInTheDocument();
41
+ expect(tooltip?.closest("[data-floating-ui-portal]")).toBeInTheDocument();
39
42
  cleanup();
40
43
  })
41
44
  });
@@ -72,6 +75,7 @@ test("has default position absolute", async () => {
72
75
  fireEvent.mouseEnter(screen.getByRole("tooltip_trigger"));
73
76
  await waitFor(() => {
74
77
  expect(screen.queryByRole("tooltip")).toHaveStyle({"position": "absolute"});
78
+ expect(screen.queryByRole("tooltip")).not.toHaveStyle({"z-index": "0"});
75
79
  cleanup();
76
80
  })
77
81
 
@@ -1 +1 @@
1
- import{jsx}from"react/jsx-runtime";import{useMemo}from"react";import{b as buildAriaProps,a as buildDataProps,c as buildHtmlProps,d as classnames,e as buildCss,g as globalProps}from"./globalProps-BwwZkfTI.js";import Highcharts from"highcharts";import HighchartsReact from"highcharts-react-official";import{t as typography,c as colors}from"./lib-Ch18RlJa.js";import highchartsMore from"highcharts/highcharts-more";import solidGauge from"highcharts/modules/solid-gauge";const barGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"column"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],credits:{enabled:false},legend:{enabled:false,itemStyle:{color:colors.text_lt_light,fill:colors.text_lt_light,fontSize:typography.text_smaller}},xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbBarGraph=props=>{const{aria:aria={},data:data={},id:id,htmlOptions:htmlOptions={},options:options,className:className}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_bar_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbBarGraph />",options);return{}}return Highcharts.merge({},barGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbCircleChartTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},chart:{type:"pie"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{pie:{dataLabels:{enabled:false,connectorShape:"straight",connectorWidth:3,format:"<div>{point.name}</div>",style:{fontFamily:typography.font_family_base,fontSize:typography.text_smaller,color:colors.text_lt_light,fontWeight:typography.regular,textOutline:"2px $white"}},innerSize:"50%",borderColor:"",borderWidth:null,colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7]}},legend:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},credits:{enabled:false}};const PbCircleChart=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_circle_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbCircleChart />",options);return{}}return Highcharts.merge({},pbCircleChartTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbGaugeGraphTheme={title:{text:"",style:{fontFamily:typography.font_family_base,fontSize:typography.text_larger}},chart:{type:"solidgauge",events:{render(){this.container;const arc=this.container.querySelector("path.gauge-pane");if(arc)arc.setAttribute("stroke-linejoin","round")}}},pane:{size:"90%",startAngle:-100,endAngle:100,background:[{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane",borderColor:colors.border_light,borderRadius:"50%"}]},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},yAxis:{min:0,max:100,lineWidth:0,tickPositions:[]},plotOptions:{solidgauge:{borderColor:colors.data_1,borderWidth:20,color:colors.data_1,radius:90,innerRadius:"90%",y:-26,dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:'<span class="fix">{y:,f}</span>',style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}},credits:{enabled:false}};const PbGaugeChart=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,ref:ref,options:options={}}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_gauge_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbGaugeGraphTheme,options)}),[options]);highchartsMore(Highcharts);solidGauge(Highcharts);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,ref:ref,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbLineGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"line"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{line:{dataLabels:{enabled:false}}},credits:{enabled:false},legend:{enabled:false,itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,tickPixelInterval:50,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbLineGraph=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_line_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbLineGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};export{PbBarGraph as P,PbCircleChart as a,PbGaugeChart as b,PbLineGraph as c};
1
+ import{jsx}from"react/jsx-runtime";import{useMemo}from"react";import{b as buildAriaProps,a as buildDataProps,c as buildHtmlProps,d as classnames,e as buildCss,g as globalProps}from"./globalProps-DOB47YGB.js";import Highcharts from"highcharts";import HighchartsReact from"highcharts-react-official";import{t as typography,c as colors}from"./lib-BzglXly2.js";import highchartsMore from"highcharts/highcharts-more";import solidGauge from"highcharts/modules/solid-gauge";const barGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"column"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],credits:{enabled:false},legend:{enabled:false,itemStyle:{color:colors.text_lt_light,fill:colors.text_lt_light,fontSize:typography.text_smaller}},xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbBarGraph=props=>{const{aria:aria={},data:data={},id:id,htmlOptions:htmlOptions={},options:options,className:className}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_bar_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbBarGraph />",options);return{}}return Highcharts.merge({},barGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbCircleChartTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},chart:{type:"pie"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{pie:{dataLabels:{enabled:false,connectorShape:"straight",connectorWidth:3,format:"<div>{point.name}</div>",style:{fontFamily:typography.font_family_base,fontSize:typography.text_smaller,color:colors.text_lt_light,fontWeight:typography.regular,textOutline:"2px $white"}},innerSize:"50%",borderColor:"",borderWidth:null,colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7]}},legend:{layout:"horizontal",align:"center",verticalAlign:"bottom",itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},credits:{enabled:false}};const PbCircleChart=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_circle_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbCircleChart />",options);return{}}return Highcharts.merge({},pbCircleChartTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbGaugeGraphTheme={title:{text:"",style:{fontFamily:typography.font_family_base,fontSize:typography.text_larger}},chart:{type:"solidgauge",events:{render(){this.container;const arc=this.container.querySelector("path.gauge-pane");if(arc)arc.setAttribute("stroke-linejoin","round")}}},pane:{size:"90%",startAngle:-100,endAngle:100,background:[{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane",borderColor:colors.border_light,borderRadius:"50%"}]},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},pointFormat:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},yAxis:{min:0,max:100,lineWidth:0,tickPositions:[]},plotOptions:{solidgauge:{borderColor:colors.data_1,borderWidth:20,color:colors.data_1,radius:90,innerRadius:"90%",y:-26,dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:'<span class="fix">{y:,f}</span>',style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}},credits:{enabled:false}};const PbGaugeChart=props=>{const{aria:aria={},className:className,data:data={},htmlOptions:htmlOptions={},id:id,ref:ref,options:options={}}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_gauge_chart"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbGaugeGraphTheme,options)}),[options]);highchartsMore(Highcharts);solidGauge(Highcharts);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,ref:ref,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};const pbLineGraphTheme={title:{text:"",style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.bold,fontSize:typography.heading_3}},subtitle:{text:"",style:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_base}},chart:{type:"line"},tooltip:{backgroundColor:{linearGradient:{x1:0,y1:0,x2:0,y2:1},stops:[[0,colors.bg_dark],[1,colors.bg_dark]]},followPointer:true,shadow:false,borderWidth:0,borderRadius:10,style:{fontFamily:typography.font_family_base,color:colors.text_dk_default,fontWeight:typography.regular,fontSize:typography.text_smaller}},plotOptions:{line:{dataLabels:{enabled:false}}},credits:{enabled:false},legend:{enabled:false,itemStyle:{fontFamily:typography.font_family_base,color:colors.text_lt_light,fontWeight:typography.regular,fontSize:typography.text_smaller},itemHoverStyle:{color:colors.text_lt_default},itemHiddenStyle:{color:colors.text_lt_lighter}},colors:[colors.data_1,colors.data_2,colors.data_3,colors.data_4,colors.data_5,colors.data_6,colors.data_7],xAxis:{gridLineWidth:0,lineColor:colors.border_light,tickColor:colors.border_light,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{color:colors.text_lt_default,fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_4}}},yAxis:{alternateGridColor:void 0,minorTickInterval:null,gridLineColor:colors.border_light,minorGridLineColor:colors.border_light,lineWidth:0,tickWidth:0,tickPixelInterval:50,labels:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}},title:{style:{fontFamily:typography.font_family_base,color:colors.text_lt_lighter,fontWeight:typography.bold,fontSize:typography.text_smaller}}}};const PbLineGraph=props=>{const{aria:aria={},className:className,data:data={},id:id,htmlOptions:htmlOptions={},options:options}=props;const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const classes=classnames(buildCss("pb_pb_line_graph"),globalProps(props),className);const mergedOptions=useMemo((()=>{if(!options||typeof options!=="object"){console.error("❌ Invalid options passed to <PbLineGraph />",options);return{}}return Highcharts.merge({},pbLineGraphTheme,options)}),[options]);return jsx("div",{children:jsx(HighchartsReact,{containerProps:{className:classnames(classes),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:mergedOptions})})};export{PbBarGraph as P,PbCircleChart as a,PbGaugeChart as b,PbLineGraph as c};