playbook_ui 14.24.0 → 14.25.0.pre.alpha.PLAY2369textinputautocompleteprop9970

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 (81) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +8 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +1 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +34 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +56 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.html.erb +43 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_vertical_border.jsx +64 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +60 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +3 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.jsx +57 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control_per_row.md +1 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +4 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +4 -1
  14. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +1 -1
  15. data/app/pb_kits/playbook/pb_advanced_table/table_subrow_header.rb +1 -1
  16. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.html.erb +10 -1
  17. data/app/pb_kits/playbook/pb_circle_icon_button/circle_icon_button.rb +2 -0
  18. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.html.erb +24 -0
  19. data/app/pb_kits/playbook/pb_circle_icon_button/docs/_circle_icon_button_input_options.md +3 -0
  20. data/app/pb_kits/playbook/pb_circle_icon_button/docs/example.yml +1 -0
  21. data/app/pb_kits/playbook/pb_date/_date.tsx +5 -3
  22. data/app/pb_kits/playbook/pb_date/date.html.erb +6 -6
  23. data/app/pb_kits/playbook/pb_date/date.rb +2 -0
  24. data/app/pb_kits/playbook/pb_date/date.test.js +506 -0
  25. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.html.erb +4 -0
  26. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.jsx +17 -0
  27. data/app/pb_kits/playbook/pb_date/docs/_date_with_show_current_year.md +1 -0
  28. data/app/pb_kits/playbook/pb_date/docs/example.yml +2 -0
  29. data/app/pb_kits/playbook/pb_date/docs/index.js +1 -0
  30. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +19 -0
  31. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -0
  32. data/app/pb_kits/playbook/pb_dropdown/index.js +3 -0
  33. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +2 -2
  34. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.html.erb +22 -0
  35. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.jsx +43 -0
  36. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_no_icon.md +1 -0
  37. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +3 -2
  38. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  39. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  40. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +2 -1
  41. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +1 -1
  42. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +6 -0
  43. data/app/pb_kits/playbook/pb_flex/_flex.tsx +9 -6
  44. data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.html.erb +12 -1
  45. data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.jsx +26 -1
  46. data/app/pb_kits/playbook/pb_flex/docs/_flex_gap_rails.md +11 -0
  47. data/app/pb_kits/playbook/pb_flex/docs/_flex_gap_react.md +11 -0
  48. data/app/pb_kits/playbook/pb_flex/flex.rb +6 -12
  49. data/app/pb_kits/playbook/pb_icon/_icon.scss +4 -0
  50. data/app/pb_kits/playbook/pb_pagination/_pagination.test.jsx +212 -0
  51. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +8 -1
  52. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control.jsx +112 -0
  53. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_external_control_react.md +3 -0
  54. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -0
  55. data/app/pb_kits/playbook/pb_pagination/docs/index.js +1 -0
  56. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +11 -1
  57. data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -1
  58. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +3 -0
  59. data/app/pb_kits/playbook/pb_text_input/text_input.rb +17 -3
  60. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +38 -0
  61. data/app/pb_kits/playbook/pb_user/docs/_user_props_table.md +14 -7
  62. data/app/pb_kits/playbook/utilities/_gap.scss +12 -24
  63. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +2 -0
  64. data/app/pb_kits/playbook/utilities/globalProps.ts +28 -4
  65. data/dist/chunks/{_line_graph-BLS62QjW.js → _line_graph-QVm2TVXJ.js} +1 -1
  66. data/dist/chunks/_typeahead-DENY2KW9.js +6 -0
  67. data/dist/chunks/{_weekday_stacked-Cv8-Sf6X.js → _weekday_stacked-DOM5KkBF.js} +3 -3
  68. data/dist/chunks/{lib-DgtxnJqa.js → lib-CY5ZPzic.js} +2 -2
  69. data/dist/chunks/{pb_form_validation-_NsOWfBS.js → pb_form_validation-D3b0JKHH.js} +1 -1
  70. data/dist/chunks/vendor.js +1 -1
  71. data/dist/menu.yml +2 -2
  72. data/dist/playbook-doc.js +1 -1
  73. data/dist/playbook-rails-react-bindings.js +1 -1
  74. data/dist/playbook-rails.js +1 -1
  75. data/dist/playbook.css +1 -1
  76. data/lib/playbook/classnames.rb +2 -0
  77. data/lib/playbook/spacing.rb +53 -1
  78. data/lib/playbook/version.rb +2 -2
  79. metadata +27 -8
  80. data/app/pb_kits/playbook/pb_flex/docs/_flex_gap.md +0 -9
  81. data/dist/chunks/_typeahead-CZL6rvfn.js +0 -6
@@ -1,2 +1,3 @@
1
1
  export { default as PaginationDefault } from './_pagination_default.jsx'
2
2
  export { default as PaginationPageChange } from './_pagination_page_change.jsx'
3
+ export { default as PaginationExternalControl } from './_pagination_external_control.jsx'
@@ -197,13 +197,22 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
197
197
  }
198
198
 
199
199
  const validateMissingAreaCode = (itiInit: any) => {
200
- if (!required || !itiInit) return
200
+ if (!itiInit) return
201
201
  if (itiInit.getValidationError() === ValidationError.MissingAreaCode) {
202
202
  showFormattedError('missing area code')
203
203
  return true
204
204
  }
205
205
  }
206
206
 
207
+ const validateRepeatCountryCode = (itiInit: any) => {
208
+ if (!itiInit) return
209
+ const countryDialCode = itiInit.getSelectedCountryData().dialCode;
210
+ if (unformatNumber(inputValue).startsWith(countryDialCode)) {
211
+ return showFormattedError('repeat country code')
212
+ }
213
+ }
214
+
215
+
207
216
  const validateErrors = () => {
208
217
  if (!hasTyped && !error) return
209
218
 
@@ -213,6 +222,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
213
222
  if (validateTooShortNumber(itiRef.current)) return
214
223
  if (validateUnhandledError(itiRef.current)) return
215
224
  if (validateMissingAreaCode(itiRef.current)) return
225
+ if (validateRepeatCountryCode(itiRef.current)) return
216
226
  }
217
227
 
218
228
  const getCurrentSelectedData = (itiInit: any, inputValue: string) => {
@@ -7,7 +7,7 @@
7
7
  thead tr:not(:first-child) th {
8
8
  border-right: 1px solid $border_light !important;
9
9
  }
10
-
10
+
11
11
  @media screen and (min-width: $screen-xs-min) {
12
12
  tr:hover, .pb_table_tr:hover {
13
13
  td:last-child, .pb_table_td:last-child {
@@ -15,5 +15,53 @@
15
15
  }
16
16
  }
17
17
  }
18
+
19
+ // Firefox-specific fix for sticky elements
20
+ @-moz-document url-prefix() {
21
+ // Target sticky headers
22
+ &.sticky-header {
23
+ th:not(:last-child) {
24
+ border-right: none !important;
25
+ box-shadow: 1px 0 0 0 $border_light !important;
26
+ }
27
+
28
+ .pb_advanced_table_body {
29
+ .pinned-row {
30
+ td:not(:first-child):not(:last-child) {
31
+ border-right: none !important;
32
+ box-shadow: 1px 0 0 0 $border_light !important;
33
+ }
34
+ }
35
+ }
36
+ }
37
+
38
+ // Target sticky left columns
39
+ &.sticky-left-column {
40
+ td[style="left"], th[style="left"] {
41
+ border-right: none !important;
42
+ box-shadow: 1px 0 0 0 $border_light !important;
43
+ }
44
+ }
45
+
46
+ // Target sticky right columns
47
+ &.sticky-right-column {
48
+ td[style="right"], th[style="right"] {
49
+ border-right: none !important;
50
+ box-shadow: 1px 0 0 0 $border_light !important;
51
+ }
52
+ }
53
+
54
+ // Handle hover states in Firefox
55
+ @media screen and (min-width: $screen-xs-min) {
56
+ tr:hover, .pb_table_tr:hover {
57
+ td:last-child, .pb_table_td:last-child {
58
+ &[style="left"], &[style="right"] {
59
+ border-right: none !important;
60
+ box-shadow: 1px 0 0 0 darken($border_light, 10%) !important;
61
+ }
62
+ }
63
+ }
64
+ }
65
+ }
18
66
  }
19
67
  }
@@ -36,6 +36,7 @@ type TextInputProps = {
36
36
  alignment?: "right" | "left",
37
37
  border?: boolean,
38
38
  },
39
+ autoComplete?: boolean | string,
39
40
  } & GlobalProps
40
41
 
41
42
  const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>) => {
@@ -59,6 +60,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
59
60
  type = 'text',
60
61
  value = '',
61
62
  children = null,
63
+ autoComplete = true,
62
64
  } = props
63
65
 
64
66
  const ariaProps = buildAriaProps(aria)
@@ -142,6 +144,7 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
142
144
  childInput ? React.cloneElement(children, { className: "text_input" }) :
143
145
  (<input
144
146
  {...domSafeProps(props)}
147
+ autoComplete={typeof autoComplete === "string" ? autoComplete : ( autoComplete ? undefined : "off" )}
145
148
  className="text_input"
146
149
  disabled={disabled}
147
150
  id={id}
@@ -15,8 +15,7 @@ module Playbook
15
15
  "cvv" => '\d{3,4}',
16
16
  }.freeze
17
17
 
18
- prop :autocomplete, type: Playbook::Props::Boolean,
19
- default: true
18
+ prop :autocomplete, default: true
20
19
  prop :disabled, type: Playbook::Props::Boolean,
21
20
  default: false
22
21
  prop :error
@@ -69,7 +68,7 @@ module Playbook
69
68
 
70
69
  def all_input_options
71
70
  {
72
- autocomplete: autocomplete ? nil : "off",
71
+ autocomplete: autocomplete == true ? nil : (autocomplete.presence || "off"),
73
72
  class: "text_input #{input_options.dig(:classname) || ''}",
74
73
  data: validation_data,
75
74
  disabled: disabled,
@@ -77,6 +76,7 @@ module Playbook
77
76
  name: mask.present? ? "" : name,
78
77
  pattern: validation_pattern || mask_pattern,
79
78
  placeholder: placeholder,
79
+ style: "cursor: #{cursor_style}",
80
80
  required: required,
81
81
  type: type,
82
82
  value: value,
@@ -84,6 +84,20 @@ module Playbook
84
84
  }.merge(input_options)
85
85
  end
86
86
 
87
+ def cursor_style
88
+ # If input is disabled, always use 'not-allowed'
89
+ return "not-allowed" if disabled
90
+
91
+ # If cursor prop is provided, convert it to kebab-case
92
+ if cursor.present?
93
+ # Convert camelCase (ex. notAllowed) to kebab-case (ex. not-allowed)
94
+ cursor.to_s.gsub(/([a-z\d])([A-Z])/, '\1-\2').downcase
95
+ else
96
+ # Default to 'pointer'
97
+ "pointer"
98
+ end
99
+ end
100
+
87
101
  def validation_message
88
102
  validation[:message] || ""
89
103
  end
@@ -306,3 +306,41 @@ test('returns masked CVV value', () => {
306
306
 
307
307
  expect(input.value).toBe('')
308
308
  })
309
+
310
+ test('adds autocomplete string attribute', () => {
311
+ render(
312
+ <TextInput
313
+ autoComplete="family-name"
314
+ data={{ testid: testId }}
315
+ />
316
+ )
317
+
318
+ const kit = screen.getByTestId(testId)
319
+ const input = within(kit).getByRole('textbox')
320
+ expect(input).toHaveAttribute("autocomplete", "family-name")
321
+ })
322
+
323
+ test('adds autocomplete "off" attribute', () => {
324
+ render(
325
+ <TextInput
326
+ autoComplete={false}
327
+ data={{ testid: testId }}
328
+ />
329
+ )
330
+
331
+ const kit = screen.getByTestId(testId)
332
+ const input = within(kit).getByRole('textbox')
333
+ expect(input).toHaveAttribute("autocomplete", "off")
334
+ })
335
+
336
+ test('does not add autocomplete attribute otherwise', () => {
337
+ render(
338
+ <TextInput
339
+ data={{ testid: testId }}
340
+ />
341
+ )
342
+
343
+ const kit = screen.getByTestId(testId)
344
+ const input = within(kit).getByRole('textbox')
345
+ expect(input).not.toHaveAttribute("autocomplete")
346
+ })
@@ -1,11 +1,18 @@
1
1
  ### Props
2
2
  | Name | Type | Description | Default | Values |
3
3
  | --- | ----------- | --------- | --------- | --------- |
4
- | **name** | `String` | Sets the User's name | | |
4
+ | **name** | `String` | Sets the User's name | `""` | |
5
+ | **nameFont** | `Typography` | Font styling for the user's name | `.init(font: .title4, variant: .bold)` | |
6
+ | **image** | `Image?` | Sets image for the avatar | `nil` | |
7
+ | **orientation** | `Orientation` | Changes the orientation of the User | `.horizontal` | `.horizontal` `.vertical` |
8
+ | **size** | `Size` | Changes the size of the User | `.medium` | `.xxSmall` `.xSmall` `.small` `.medium` `.large` `.xLarge` |
9
+ | **territory** | `String?` | Adds the User's territory | `nil` | |
10
+ | **title** | `String?` | Adds a title | `nil` | |
11
+ | **subtitle** | `AnyView?` | Adds a subtitle view | `nil` | |
12
+ | **status** | `PBOnlineStatus.Status?` | An indicator for the current status of the user | `nil` | `.online` `.away` `.offline` |
5
13
  | **displayAvatar** | `Bool` | Displays the User's avatar | `true` | `true` `false` |
6
- | **image** | `Image` | Sets image for the avatar | | |
7
- | **orientation** | `Orientation` | Changes the orientation of the User | `.horizontal` | `.horizontal` `.verticle` |
8
- | **size** | `UserAvatarSize` | Changes the size of the User | `.medium` | `.small` `.medium` `.large` |
9
- | **territory** | `String` | Adds the User's territory | | |
10
- | **title** | `String` | Adds a title | | |
11
- | **status** | `PBAvatar.PresenceStatus?` | An idicator for the current status of the user | `.none` | `.online` `.away` `.offline` |
14
+ | **territoryTitleFont** | `PBFont` | Font for territory and title text | `.subcaption` | `.title1` `.body` `.caption` `.subcaption` `.badgeText` `.title4` |
15
+ | **isActive** | `Bool` | Sets whether the user is active | `true` | `true` `false` |
16
+ | **hasInactiveBadge** | `Bool` | Shows inactive badge when user is not active | `false` | `true` `false` |
17
+ | **spacing** | `CGFloat` | Controls spacing between elements | `Spacing.small` | `.none` `.xxSmall` `.xSmall` `.small` `.medium` `.large` `.xLarge` |
18
+
@@ -1,29 +1,17 @@
1
1
  @import "spacing";
2
2
 
3
- .gap_none {
4
- gap: 0;
5
- }
3
+ $gap_values: (
4
+ none: 0,
5
+ xxs: $space_xxs,
6
+ xs: $space_xs,
7
+ sm: $space_sm,
8
+ md: $space_md,
9
+ lg: $space_lg,
10
+ xl: $space_xl,
11
+ );
6
12
 
7
- .gap_xxs {
8
- gap: $space_xxs;
9
- }
13
+ @include global_props_responsive_css($gap_values, 'gap', 'gap');
10
14
 
11
- .gap_xs {
12
- gap: $space_xs;
13
- }
15
+ @include global_props_responsive_css($gap_values, 'column_gap', 'column-gap');
14
16
 
15
- .gap_sm {
16
- gap: $space_sm;
17
- }
18
-
19
- .gap_md {
20
- gap: $space_md;
21
- }
22
-
23
- .gap_lg {
24
- gap: $space_lg;
25
- }
26
-
27
- .gap_xl {
28
- gap: $space_xl;
29
- }
17
+ @include global_props_responsive_css($gap_values, 'row_gap', 'row-gap');
@@ -27,6 +27,8 @@ export default [
27
27
  "overflow",
28
28
  "order",
29
29
  "numberSpacing",
30
+ "rowGap",
31
+ "columnGap",
30
32
  "gap",
31
33
  "maxWidth",
32
34
  "minWidth",
@@ -112,6 +112,14 @@ type Gap = {
112
112
  gap?: string,
113
113
  }
114
114
 
115
+ type ColumnGap = {
116
+ columnGap?: string,
117
+ }
118
+
119
+ type RowGap = {
120
+ rowGap?: string,
121
+ }
122
+
115
123
  type NumberSpacing = {
116
124
  numberSpacing?: "tabular",
117
125
  }
@@ -200,7 +208,7 @@ type MinHeight = {
200
208
  export type GlobalProps = AlignContent & AlignItems & AlignSelf &
201
209
  BorderRadius & Cursor & Dark & Display & DisplaySizes & Flex & FlexDirection &
202
210
  FlexGrow & FlexShrink & FlexWrap & JustifyContent & JustifySelf &
203
- LineHeight & Margin & Width & MinWidth & MaxWidth & Gap & NumberSpacing & Order & Overflow & Padding &
211
+ LineHeight & Margin & Width & MinWidth & MaxWidth & Gap & ColumnGap & RowGap & NumberSpacing & Order & Overflow & Padding &
204
212
  Position & Shadow & TextAlign & Truncate & VerticalAlign & ZIndex & { hover?: string } & Top & Right & Bottom & Left & Height & MaxHeight & MinHeight;
205
213
 
206
214
  const getResponsivePropClasses = (prop: {[key: string]: string}, classPrefix: string) => {
@@ -377,9 +385,25 @@ const PROP_CATEGORIES: {[key:string]: (props: {[key: string]: any}) => string} =
377
385
  return css.trimEnd()
378
386
  },
379
387
  gapProps: ({ gap }: Gap) => {
380
- let css = ''
381
- css += gap ? `gap_${gap} ` : ''
382
- return css.trimEnd()
388
+ if (typeof gap === 'object') {
389
+ return getResponsivePropClasses(gap, 'gap')
390
+ } else {
391
+ return gap ? `gap_${gap}` : ''
392
+ }
393
+ },
394
+ columnGapProps: ({ columnGap }: ColumnGap) => {
395
+ if (typeof columnGap === 'object') {
396
+ return getResponsivePropClasses(columnGap, 'column_gap')
397
+ } else {
398
+ return columnGap ? `column_gap_${columnGap}` : ''
399
+ }
400
+ },
401
+ rowGapProps: ({ rowGap }: RowGap) => {
402
+ if (typeof rowGap === 'object') {
403
+ return getResponsivePropClasses(rowGap, 'row_gap')
404
+ } else {
405
+ return rowGap ? `row_gap_${rowGap}` : ''
406
+ }
383
407
  },
384
408
  minHeightProps: ({ minHeight }: MinHeight) => {
385
409
  const heightValues = ["auto", "xs", "sm", "md", "lg", "xl", "xxl", "xxxl"]
@@ -1 +1 @@
1
- import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{b as buildAriaProps,c as buildDataProps,d as buildHtmlProps,H as HighchartsReact,e as Highcharts,f as classnames,g as globalProps,h as HighchartsMore,S as SolidGauge,i as buildCss}from"./_typeahead-CZL6rvfn.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-DgtxnJqa.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{b as buildAriaProps,c as buildDataProps,d as buildHtmlProps,H as HighchartsReact,e as Highcharts,f as classnames,g as globalProps,h as HighchartsMore,S as SolidGauge,i as buildCss}from"./_typeahead-DENY2KW9.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CY5ZPzic.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};