playbook_ui 15.3.0.pre.alpha.play199912042 → 15.3.0.pre.alpha.play202412165

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +2 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +1 -1
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +4 -4
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +68 -5
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.html.erb +4 -0
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_background_control_rails.md +1 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +3 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +2 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_column_headers.jsx +1 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.html.erb +1 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_rails.md +2 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.jsx +9 -1
  14. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_padding_control.md +1 -1
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header.jsx +16 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.html.erb +104 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_multi_header_rails.md +1 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_with_custom_header_rails.html.erb +1 -1
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  20. data/app/pb_kits/playbook/pb_advanced_table/flat_advanced_table.js +2 -2
  21. data/app/pb_kits/playbook/pb_advanced_table/index.js +7 -7
  22. data/app/pb_kits/playbook/pb_advanced_table/scss_partials/advanced_table_sticky_mixin.scss +2 -2
  23. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +90 -20
  24. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +32 -3
  25. data/app/pb_kits/playbook/pb_background/background.html.erb +10 -2
  26. data/app/pb_kits/playbook/pb_currency/_currency.tsx +20 -7
  27. data/app/pb_kits/playbook/pb_currency/currency.rb +35 -8
  28. data/app/pb_kits/playbook/pb_currency/currency.test.js +47 -0
  29. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.html.erb +1 -1
  30. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.jsx +1 -1
  31. data/app/pb_kits/playbook/pb_currency/docs/_currency_variants.md +1 -0
  32. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +16 -4
  33. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.jsx +38 -0
  34. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_and_dropdown_range.md +14 -0
  35. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -1
  36. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -1
  37. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -0
  38. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +111 -6
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.jsx +18 -0
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick.md +4 -0
  41. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.jsx +18 -0
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_default_dates.md +1 -0
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.jsx +19 -0
  44. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_range_end.md +1 -0
  45. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.jsx +38 -0
  46. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_quickpick_with_date_pickers.md +14 -0
  47. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +5 -0
  48. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +5 -1
  49. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +148 -2
  50. data/app/pb_kits/playbook/pb_dropdown/quickpick/index.ts +60 -0
  51. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.html.erb +15 -1
  52. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line.html.erb +9 -8
  53. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions.html.erb +11 -10
  54. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +44 -11
  55. data/app/pb_kits/playbook/pb_nav/_item.tsx +18 -4
  56. data/app/pb_kits/playbook/pb_nav/_nav.scss +30 -5
  57. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +192 -0
  58. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  59. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.html.erb +21 -0
  60. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.jsx +113 -0
  61. data/app/pb_kits/playbook/pb_nav/docs/_horizontal_nav_disabled.md +1 -0
  62. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.html.erb +30 -0
  63. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.jsx +117 -0
  64. data/app/pb_kits/playbook/pb_nav/docs/_vertical_nav_disabled.md +1 -0
  65. data/app/pb_kits/playbook/pb_nav/docs/example.yml +4 -0
  66. data/app/pb_kits/playbook/pb_nav/docs/index.js +3 -1
  67. data/app/pb_kits/playbook/pb_nav/item.html.erb +6 -4
  68. data/app/pb_kits/playbook/pb_nav/item.rb +11 -2
  69. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +110 -17
  70. data/dist/chunks/{_line_graph-BmABJlze.js → _line_graph-B4qHP_oq.js} +1 -1
  71. data/dist/chunks/{_typeahead-57mB4EsR.js → _typeahead-NlACFNiN.js} +2 -2
  72. data/dist/chunks/_weekday_stacked-NviJgRIS.js +37 -0
  73. data/dist/chunks/{lib-CGxXTQ75.js → lib-BXBHAZMY.js} +1 -1
  74. data/dist/chunks/pb_form_validation-BNfSnIUF.js +1 -0
  75. data/dist/chunks/vendor.js +1 -1
  76. data/dist/playbook-doc.js +1 -1
  77. data/dist/playbook-rails-react-bindings.js +1 -1
  78. data/dist/playbook-rails.js +1 -1
  79. data/dist/playbook.css +1 -1
  80. data/lib/playbook/version.rb +1 -1
  81. metadata +27 -7
  82. data/dist/chunks/_weekday_stacked-Bjc5rN-H.js +0 -37
  83. data/dist/chunks/pb_form_validation-DebqlUKZ.js +0 -1
@@ -0,0 +1,117 @@
1
+ import React from 'react'
2
+
3
+ import Nav from '../_nav'
4
+ import NavItem from '../_item'
5
+ import Caption from '../../pb_caption/_caption'
6
+ import Flex from '../../pb_flex/_flex'
7
+
8
+ const VerticalNavDisabled = (props) => {
9
+ return (
10
+ <Flex justify="between"
11
+ wrap
12
+ >
13
+ <Flex orientation="column">
14
+ <Caption marginBottom="sm">Default Variant</Caption>
15
+ <Nav
16
+ link="#"
17
+ {...props}
18
+ >
19
+ <NavItem
20
+ link="#"
21
+ text="About"
22
+ {...props}
23
+ />
24
+ <NavItem
25
+ active
26
+ link="#"
27
+ text="Case Studies"
28
+ {...props}
29
+ />
30
+ <NavItem
31
+ disabled
32
+ link="#"
33
+ text="Service"
34
+ {...props}
35
+ />
36
+ <NavItem
37
+ link="#"
38
+ text="Contacts"
39
+ {...props}
40
+ />
41
+ </Nav>
42
+ </Flex>
43
+ <Flex orientation="column">
44
+ <Caption
45
+ marginBottom="sm"
46
+ >
47
+ Subtle Variant
48
+ </Caption>
49
+ <Nav
50
+ link="#"
51
+ variant="subtle"
52
+ {...props}
53
+ >
54
+ <NavItem
55
+ link="#"
56
+ text="About"
57
+ {...props}
58
+ />
59
+ <NavItem
60
+ active
61
+ link="#"
62
+ text="Case Studies"
63
+ {...props}
64
+ />
65
+ <NavItem
66
+ disabled
67
+ link="#"
68
+ text="Service"
69
+ {...props}
70
+ />
71
+ <NavItem
72
+ link="#"
73
+ text="Contacts"
74
+ {...props}
75
+ />
76
+ </Nav>
77
+ </Flex>
78
+ <Flex orientation="column">
79
+ <Caption
80
+ marginBottom="sm"
81
+ >
82
+ Bold Variant
83
+ </Caption>
84
+ <Nav
85
+ link="#"
86
+ variant="bold"
87
+ {...props}
88
+ >
89
+ <NavItem
90
+ link="#"
91
+ text="About"
92
+ {...props}
93
+ />
94
+ <NavItem
95
+ active
96
+ link="#"
97
+ text="Case Studies"
98
+ {...props}
99
+ />
100
+ <NavItem
101
+ disabled
102
+ link="#"
103
+ text="Service"
104
+ {...props}
105
+ />
106
+ <NavItem
107
+ link="#"
108
+ text="Contacts"
109
+ {...props}
110
+ />
111
+ </Nav>
112
+ </Flex>
113
+ </Flex>
114
+ )
115
+ }
116
+
117
+ export default VerticalNavDisabled
@@ -0,0 +1 @@
1
+ Use the `disabled` prop on a `navItem`/`nav_item` within a vertical nav to set it as disabled. This will render the UI as disabled, prevent clicks and not allow for tabIndex to access the item.
@@ -18,6 +18,8 @@ examples:
18
18
  - subtle_horizontal_nav: Subtle Horizontal Nav
19
19
  - bold_horizontal_nav: Bold Horizontal Nav
20
20
  - horizontal_nav_extendedunderline: Horizontal Nav With Extended Underline
21
+ - horizontal_nav_disabled: Horizontal Nav With Disabled Item
22
+ - vertical_nav_disabled: Vertical Nav With Disabled Item
21
23
  - block_nav: Block
22
24
  - block_no_title_nav: Without Title
23
25
  - new_tab: Open in a New Tab
@@ -44,6 +46,8 @@ examples:
44
46
  - subtle_horizontal_nav: Subtle Horizontal Nav
45
47
  - bold_horizontal_nav: Bold Horizontal Nav
46
48
  - horizontal_nav_extendedunderline: Horizontal Nav With Extended Underline
49
+ - horizontal_nav_disabled: Horizontal Nav With Disabled Item
50
+ - vertical_nav_disabled: Vertical Nav With Disabled Item
47
51
  - block_nav: Block
48
52
  - block_no_title_nav: Without Title
49
53
  - new_tab: Open in a New Tab
@@ -20,4 +20,6 @@ export { default as NavWithFontControl } from "./_nav_with_font_control.jsx"
20
20
  export { default as NavWithSpacingControl } from "./_nav_with_spacing_control.jsx"
21
21
  export { default as CollapsibleNavItemSpacing } from "./_collapsible_nav_item_spacing.jsx"
22
22
  export { default as CollapsibleNavNoIcon } from "./_collapsible_nav_no_icon.jsx"
23
- export { default as HorizontalNavExtendedunderline } from './_horizontal_nav_extendedunderline.jsx'
23
+ export { default as HorizontalNavExtendedunderline } from './_horizontal_nav_extendedunderline.jsx'
24
+ export { default as HorizontalNavDisabled } from './_horizontal_nav_disabled.jsx'
25
+ export { default as VerticalNavDisabled } from './_vertical_nav_disabled.jsx'
@@ -24,10 +24,12 @@
24
24
  <% end %>
25
25
  <% else %>
26
26
  <%= pb_content_tag( object.tag,
27
- href: object.link && object.link,
28
- target: object.link && object.target,
29
- onkeydown: !object.link ? "if(event.key==='Enter'||event.key===' '){event.preventDefault(); this.click();}" : nil,
30
- tabindex: object.link ? nil : 0,
27
+ aria: { disabled: object.disabled },
28
+ href: object.is_link ? object.link : nil,
29
+ target: object.is_link ? object.target : nil,
30
+ onclick: object.disabled ? "event.preventDefault(); event.stopPropagation(); return false;" : nil,
31
+ onkeydown: object.disabled ? nil : (!object.is_link ? "if(event.key==='Enter'||event.key===' '){event.preventDefault(); this.click();}" : nil),
32
+ tabindex: object.disabled ? -1 : (object.is_link ? nil : 0),
31
33
  ) do %>
32
34
  <% if object.image_url %>
33
35
  <%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
@@ -4,6 +4,7 @@ module Playbook
4
4
  module PbNav
5
5
  class Item < Playbook::KitBase
6
6
  prop :active, type: Playbook::Props::Boolean, default: false
7
+ prop :disabled, type: Playbook::Props::Boolean, default: false
7
8
  prop :font_size, type: Playbook::Props::Enum,
8
9
  values: %w[normal small],
9
10
  default: "normal"
@@ -26,7 +27,7 @@ module Playbook
26
27
  if collapsible
27
28
  "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link_collapsible"
28
29
  else
29
- "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link"
30
+ "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link#{disabled_class}"
30
31
  end
31
32
  end
32
33
 
@@ -81,7 +82,11 @@ module Playbook
81
82
  end
82
83
 
83
84
  def tag
84
- link ? "a" : "div"
85
+ link && !disabled ? "a" : "div"
86
+ end
87
+
88
+ def is_link
89
+ link && !disabled
85
90
  end
86
91
 
87
92
  def collapsible_icons
@@ -98,6 +103,10 @@ module Playbook
98
103
  active ? "active" : nil
99
104
  end
100
105
 
106
+ def disabled_class
107
+ disabled ? " pb_nav_item_disabled" : nil
108
+ end
109
+
101
110
  def highlighted_border_class
102
111
  !highlighted_border && active ? "highlighted_border_none" : nil
103
112
  end
@@ -55,7 +55,6 @@ const formatToGlobalCountryName = (countryName: string) => {
55
55
 
56
56
  const formatAllCountries = () => {
57
57
  const countryData = intlTelInput.getCountryData()
58
-
59
58
  for (let i = 0; i < countryData.length; i++) {
60
59
  const country = countryData[i]
61
60
  country.name = formatToGlobalCountryName(country.name)
@@ -110,18 +109,54 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
110
109
 
111
110
  const inputRef = useRef<HTMLInputElement | null>(null)
112
111
  const itiRef = useRef<any>(null);
112
+ const wrapperRef = useRef<HTMLDivElement | null>(null);
113
113
  const [inputValue, setInputValue] = useState(value)
114
114
  const [error, setError] = useState(props.error || "")
115
115
  const [dropDownIsOpen, setDropDownIsOpen] = useState(false)
116
116
  const [selectedData, setSelectedData] = useState()
117
117
  const [hasTyped, setHasTyped] = useState(false)
118
+ const [formSubmitted, setFormSubmitted] = useState(false)
119
+ const [hasStartedValidating, setHasStartedValidating] = useState(false)
120
+
121
+ // Only sync initial error from props, not continuous updates
122
+ // Once validation starts, internal validation takes over
123
+ useEffect(() => {
124
+ if (props.error && !hasStartedValidating) {
125
+ setError(props.error)
126
+ // If there's an initial error from props, mark as submitted so it shows
127
+ if (props.error) {
128
+ setFormSubmitted(true)
129
+ }
130
+ }
131
+ }, [props.error, hasStartedValidating])
132
+
133
+ // Function to update validation state on the wrapper element
134
+ // Only applies when input is required
135
+ const updateValidationState = (hasError: boolean) => {
136
+ if (wrapperRef.current && required) {
137
+ if (hasError) {
138
+ wrapperRef.current.setAttribute('data-pb-phone-validation-error', 'true')
139
+ } else {
140
+ wrapperRef.current.removeAttribute('data-pb-phone-validation-error')
141
+ }
142
+ }
143
+ }
144
+
145
+ // Determine which error to display
146
+ // Show internal errors on blur (hasTyped) or on form submission (formSubmitted)
147
+ const shouldShowInternalError = (hasTyped || formSubmitted) && required && error
148
+ const displayError = shouldShowInternalError ? error : ""
118
149
 
119
150
  useEffect(() => {
120
- if ((error ?? '').length > 0) {
151
+ const hasError = (error ?? '').length > 0
152
+ if (hasError) {
121
153
  onValidate(false)
122
154
  } else {
123
155
  onValidate(true)
124
156
  }
157
+
158
+ // Update validation state whenever error changes
159
+ updateValidationState(hasError)
125
160
  }, [error, onValidate])
126
161
 
127
162
  const unformatNumber = (formattedNumber: any) => {
@@ -137,6 +172,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
137
172
 
138
173
  const validateTooLongNumber = (itiInit: any) => {
139
174
  if (!itiInit) return
175
+
140
176
  if (itiInit.getValidationError() === ValidationError.TooLong) {
141
177
  return showFormattedError('too long')
142
178
  } else {
@@ -146,13 +182,11 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
146
182
 
147
183
  const validateTooShortNumber = (itiInit: any) => {
148
184
  if (!itiInit) return
149
-
150
185
  // If field is empty, don't show "too short" error
151
186
  if (!inputValue || inputValue.trim() === '') {
152
187
  setError('')
153
188
  return false
154
189
  }
155
-
156
190
  if (itiInit.getValidationError() === ValidationError.TooShort) {
157
191
  return showFormattedError('too short')
158
192
  } else {
@@ -172,7 +206,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
172
206
  }
173
207
 
174
208
  const validateUnhandledError = (itiInit: any) => {
175
- if (!itiInit) return
209
+ if (!required || !itiInit) return
176
210
  if (itiInit.getValidationError() === ValidationError.SomethingWentWrong) {
177
211
  if (inputValue.length === 1) {
178
212
  return showFormattedError('too short')
@@ -184,7 +218,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
184
218
  }
185
219
  }
186
220
  }
187
-
188
221
  const validateMissingAreaCode = (itiInit: any) => {
189
222
  if (!itiInit) return
190
223
  if (itiInit.getValidationError() === ValidationError.MissingAreaCode) {
@@ -201,8 +234,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
201
234
  }
202
235
  }
203
236
 
237
+ // Validation for required empty fields
204
238
  const validateRequiredField = () => {
205
- if (!inputValue || inputValue.trim() === '') {
239
+ if (required && (!inputValue || inputValue.trim() === '')) {
206
240
  setError('Missing phone number')
207
241
  return true
208
242
  }
@@ -210,14 +244,24 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
210
244
  }
211
245
 
212
246
  const validateErrors = () => {
213
- // If field is empty, show error message
247
+ // Signal validation has started, so prop errors won't override internal validation
248
+ if (!hasStartedValidating) {
249
+ setHasStartedValidating(true)
250
+ }
251
+
252
+ // If field is empty, only show required field error if applicable
214
253
  if (!inputValue || inputValue.trim() === '') {
215
254
  if (validateRequiredField()) return
255
+ // Clear any existing errors if field is empty and not required
256
+ if (!required) {
257
+ setError('')
258
+ }
216
259
  return
217
260
  }
218
261
 
219
- if (!hasTyped && !error) return
262
+ if (!hasTyped && !error) return
220
263
 
264
+ // Run validation checks
221
265
  if (itiRef.current) isValid(itiRef.current.isValidNumber())
222
266
  if (validateOnlyNumbers(itiRef.current)) return
223
267
  if (validateTooLongNumber(itiRef.current)) return
@@ -227,6 +271,29 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
227
271
  if (validateRepeatCountryCode(itiRef.current)) return
228
272
  }
229
273
 
274
+ // Add listener for form validation to track when validation should be shown
275
+ useEffect(() => {
276
+ const handleInvalid = (event: Event) => {
277
+ const target = event.target as HTMLInputElement
278
+ const phoneNumberContainer = target.closest('.pb_phone_number_input')
279
+
280
+ if (phoneNumberContainer && phoneNumberContainer === wrapperRef.current) {
281
+ const invalidInputName = target.name || target.getAttribute('name')
282
+ if (invalidInputName === name) {
283
+ setFormSubmitted(true)
284
+ // Trigger validation when form is submitted
285
+ validateErrors()
286
+ }
287
+ }
288
+ }
289
+
290
+ document.addEventListener('invalid', handleInvalid, true)
291
+
292
+ return () => {
293
+ document.removeEventListener('invalid', handleInvalid, true)
294
+ }
295
+ }, [name, inputValue])
296
+
230
297
  /*
231
298
  useImperativeHandle exposes the kit's input element to a parent component via a ref.
232
299
  See the Playbook docs for use cases.
@@ -238,6 +305,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
238
305
  setInputValue("")
239
306
  setError("")
240
307
  setHasTyped(false)
308
+ setFormSubmitted(false)
309
+ setHasStartedValidating(false)
310
+ // Only clear validation state if field was required
311
+ if (required) {
312
+ updateValidationState(false)
313
+ }
241
314
  },
242
315
  inputNode() {
243
316
  return inputRef.current
@@ -247,6 +320,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
247
320
  // Run validation and return error message or true
248
321
  const isEmpty = !inputValue || inputValue.trim() === ''
249
322
 
323
+ if (required && isEmpty) {
324
+ setError('Missing phone number')
325
+ setFormSubmitted(true)
326
+ return 'Missing phone number'
327
+ }
328
+
250
329
  if (isEmpty) {
251
330
  // Show missing phone number error
252
331
  const errorMessage = 'Missing phone number'
@@ -266,6 +345,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
266
345
  const countryName = itiRef.current.getSelectedCountryData().name
267
346
  const errorMessage = `Invalid ${countryName} phone number (repeat country code)`
268
347
  setError(errorMessage)
348
+ setFormSubmitted(true)
269
349
  setHasTyped(true)
270
350
  return errorMessage
271
351
  }
@@ -275,6 +355,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
275
355
  const countryName = itiRef.current.getSelectedCountryData().name
276
356
  const errorMessage = `Invalid ${countryName} phone number (enter numbers only)`
277
357
  setError(errorMessage)
358
+ setFormSubmitted(true)
278
359
  setHasTyped(true)
279
360
  return errorMessage
280
361
  }
@@ -295,7 +376,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
295
376
  errorMessage = `Invalid ${countryName} phone number`
296
377
  }
297
378
 
379
+ // Set the error state so the validation attribute gets added
298
380
  setError(errorMessage)
381
+ setFormSubmitted(true)
299
382
  setHasTyped(true)
300
383
 
301
384
  return errorMessage
@@ -314,11 +397,16 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
314
397
 
315
398
  const handleOnChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
316
399
  if (!hasTyped) setHasTyped(true)
317
-
318
400
  setInputValue(evt.target.value)
319
401
 
402
+ // Reset form submitted state when user types
403
+ if (formSubmitted) {
404
+ setFormSubmitted(false)
405
+ }
406
+
320
407
  let phoneNumberData
321
408
 
409
+ // Handle formatAsYouType with input event
322
410
  if (formatAsYouType) {
323
411
  const formattedPhoneNumberData = getCurrentSelectedData(itiRef.current, evt.target.value)
324
412
  phoneNumberData = {...formattedPhoneNumberData, number: unformatNumber(formattedPhoneNumberData.number)}
@@ -329,12 +417,15 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
329
417
  setSelectedData(phoneNumberData)
330
418
  onChange(phoneNumberData)
331
419
  isValid(itiRef.current.isValidNumber())
420
+
421
+ // Trigger validation after onChange for React Hook Form
422
+ // This ensures validation state is up-to-date
423
+ setTimeout(() => validateErrors(), 0)
332
424
  }
333
425
 
334
426
  // Separating Concerns as React Docs Recommend
335
427
  // This also Fixes things for our react_component rendering on the Rails Side
336
428
  useEffect(formatAllCountries, [])
337
-
338
429
  // If an initial country is not specified, the "globe" icon will show
339
430
  // Always set a country
340
431
  const fallbackCountry =
@@ -375,9 +466,9 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
375
466
  inputRef.current.addEventListener("open:countrydropdown", () => setDropDownIsOpen(true))
376
467
  inputRef.current.addEventListener("close:countrydropdown", () => setDropDownIsOpen(false))
377
468
 
378
- // Handle formatAsYouType with input event
379
- if (formatAsYouType) {
380
- inputRef.current.addEventListener("input", (evt: Event) => {
469
+ // Handle formatAsYouType with input event
470
+ if (formatAsYouType) {
471
+ inputRef.current.addEventListener("input", (evt: Event) => {
381
472
  const target = evt.target as HTMLInputElement
382
473
  const formattedValue = target.value
383
474
 
@@ -396,13 +487,12 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
396
487
  }
397
488
  }
398
489
  }, [])
399
-
400
490
  let textInputProps: {[key: string]: any} = {
401
491
  className: dropDownIsOpen ? 'dropdown_open' : '',
402
492
  dark,
403
493
  "data-phone-number": JSON.stringify(selectedData),
404
494
  disabled,
405
- error: hasTyped ? error : props.error,
495
+ error: hasTyped ? error : props.error || displayError,
406
496
  type: 'tel',
407
497
  id,
408
498
  label,
@@ -412,7 +502,10 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
412
502
  value: inputValue
413
503
  }
414
504
 
415
- let wrapperProps: Record<string, unknown> = { className: classes }
505
+ let wrapperProps: Record<string, unknown> = {
506
+ className: classes,
507
+ ref: wrapperRef
508
+ }
416
509
 
417
510
  if (!isEmpty(aria)) textInputProps = {...textInputProps, ...ariaProps}
418
511
  if (!isEmpty(data)) wrapperProps = {...wrapperProps, ...dataProps}
@@ -1 +1 @@
1
- import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{f as buildAriaProps,g as buildDataProps,h as buildHtmlProps,H as HighchartsReact,i as Highcharts,j as classnames,k as globalProps,l as HighchartsMore,S as SolidGauge,m as buildCss}from"./_typeahead-57mB4EsR.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CGxXTQ75.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{f as buildAriaProps,g as buildDataProps,h as buildHtmlProps,H as HighchartsReact,i as Highcharts,j as classnames,k as globalProps,l as HighchartsMore,S as SolidGauge,m as buildCss}from"./_typeahead-NlACFNiN.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-BXBHAZMY.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};