playbook_ui 14.15.0.pre.alpha.PBNTR900phonenumberinputhidden6620 → 14.15.0.pre.alpha.PBNTR902multilevelselecthiddeninputbug6580

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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
  3. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  4. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +12 -0
  5. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +1 -1
  6. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +0 -6
  7. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.html.erb +1 -1
  8. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +1 -3
  9. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
  10. data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
  11. data/app/pb_kits/playbook/pb_popover/popover.test.js +1 -1
  12. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +3 -2
  13. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb +10 -0
  14. data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -1
  15. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -16
  16. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
  17. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +1 -1
  18. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -1
  19. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
  20. data/dist/chunks/_typeahead-CaXmU2Fm.js +36 -0
  21. data/dist/chunks/{_weekday_stacked-BAbPkPFp.js → _weekday_stacked-C7auj4WH.js} +1 -1
  22. data/dist/chunks/vendor.js +1 -1
  23. data/dist/playbook-doc.js +1 -1
  24. data/dist/playbook-rails-react-bindings.js +1 -1
  25. data/dist/playbook-rails.js +1 -1
  26. data/lib/playbook/version.rb +1 -1
  27. metadata +5 -9
  28. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.html.erb +0 -5
  29. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.md +0 -1
  30. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon_rails.html.erb +0 -22
  31. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +0 -66
  32. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.md +0 -1
  33. data/dist/chunks/_typeahead-ClZGb4WZ.js +0 -36
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af5f1da0aaf0cd40aafd6b96b9a779b53e4c14c4ce9c787b0340cafca230c9d1
4
- data.tar.gz: c39d210a4ca1ae7188b4663835bece3f3aa9fa3ba95ab11b9d650937d16285a1
3
+ metadata.gz: 0a00831a74f0cc915ba685be7843a1f75e06e3e07d9b8a040de46d64fee8ee61
4
+ data.tar.gz: c72c150c0375716b34e2345b4e2795f23bf31de4a2cd4be89bf2c512707193f2
5
5
  SHA512:
6
- metadata.gz: 9b160464434afb7a464003a1161d572d9dd41711914a4ee149d486d9091ea4de027ae01b5c119174931f4ba563db9b79940c3a198bb73eea9f0e2034a896e8a1
7
- data.tar.gz: 0da85724ed33fb7d80e560585831f94e743b7f3d8cf8d23e86b19bd5c269d2ce6769c4744f14c15805c9e62ae91b74dc1c7b6c761e22f4767cc3f3d1cf5b5e70
6
+ metadata.gz: 93c741d7b069ba3993f69c2a6ec8ad74d226b0914788ad20d849907fc5698003ea68eaaf0b4e5b4232d3a1a4b6abfcd1cf3ee95546a83d0ad91112f56b840e3f
7
+ data.tar.gz: 9463bcb48229ea23e51a054f3d4ba539233c668fd4ad893f7a8846b30bbb4ef86372b25cfcb4f8fe97609d4edb22e0f4b62567ec0e4f041df21cc62653474e1f
@@ -25,7 +25,7 @@
25
25
  <%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
26
26
  <%= form.typeahead :example_typeahead, props: { data: { typeahead_example1: true, user: {} }, label: true, placeholder: "Search for a user" } %>
27
27
  <%= form.text_field :example_text_field, props: { label: true } %>
28
- <%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field", hidden_inputs: true } %>
28
+ <%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
29
29
  <%= form.email_field :example_email_field, props: { label: true } %>
30
30
  <%= form.number_field :example_number_field, props: { label: true } %>
31
31
  <%= form.search_field :example_search_field, props: { label: true } %>
@@ -24,7 +24,7 @@
24
24
  <%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
25
25
  <%= form.typeahead :example_typeahead_validation, props: { data: { typeahead_example2: true, user: {} }, label: true, placeholder: "Search for a user", required: true, validation: { message: "Please select a user." } } %>
26
26
  <%= form.text_field :example_text_field_validation, props: { label: true, required: true } %>
27
- <%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field", hidden_inputs: true } %>
27
+ <%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field" } %>
28
28
  <%= form.email_field :example_email_field_validation, props: { label: true, required: true } %>
29
29
  <%= form.number_field :example_number_field_validation, props: { label: true, required: true } %>
30
30
  <%= form.search_field :example_project_number_validation, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
@@ -459,6 +459,18 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
459
459
  ))
460
460
  : null}
461
461
 
462
+ {!returnAllSelected
463
+ ? defaultReturn.map((item) => (
464
+ <input
465
+ disabled={disabled}
466
+ key={item.id}
467
+ name={`${name}[]`}
468
+ type="hidden"
469
+ value={item.id}
470
+ />
471
+ ))
472
+ : null}
473
+
462
474
  {returnAllSelected &&
463
475
  returnedArray.length !== 0 &&
464
476
  inputDisplay === "pills"
@@ -40,7 +40,7 @@ module Playbook
40
40
  treeData: tree_data,
41
41
  returnAllSelected: return_all_selected,
42
42
  selectedIds: selected_ids,
43
- input_name: input_name,
43
+ inputName: input_name,
44
44
  variant: variant,
45
45
  pillColor: pill_color,
46
46
  wrapped: wrapped,
@@ -23,7 +23,6 @@ type PhoneNumberInputProps = {
23
23
  data?: { [key: string]: string },
24
24
  disabled?: boolean,
25
25
  error?: string,
26
- hiddenInputs?: boolean,
27
26
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
28
27
  id?: string,
29
28
  initialCountry?: string,
@@ -73,7 +72,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
73
72
  dark = false,
74
73
  data = {},
75
74
  disabled = false,
76
- hiddenInputs = false,
77
75
  htmlOptions = {},
78
76
  id = "",
79
77
  initialCountry = "",
@@ -245,10 +243,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
245
243
  countrySearch: false,
246
244
  fixDropdownWidth: false,
247
245
  formatAsYouType: formatAsYouType,
248
- hiddenInput: hiddenInputs ? () => ({
249
- phone: `${name}_full`,
250
- country: `${name}_country_code`,
251
- }) : null,
252
246
  })
253
247
 
254
248
  itiRef.current = telInputInit;
@@ -1,3 +1,3 @@
1
1
  <%= pb_rails("phone_number_input", props: {
2
- id: "hello",
2
+ id: "hello"
3
3
  }) %>
@@ -16,6 +16,4 @@ examples:
16
16
  - phone_number_input_initial_country: Initial Country
17
17
  - phone_number_input_only_countries: Limited Countries
18
18
  - phone_number_input_validation: Form Validation
19
- - phone_number_input_format: Format as You Type
20
- - phone_number_input_hidden_inputs: Hidden Inputs
21
-
19
+ - phone_number_input_format: Format as You Type
@@ -23,8 +23,6 @@ module Playbook
23
23
  default: ""
24
24
  prop :format_as_you_type, type: Playbook::Props::Boolean,
25
25
  default: false
26
- prop :hidden_inputs, type: Playbook::Props::Boolean,
27
- default: false
28
26
 
29
27
  def classname
30
28
  generate_classname("pb_phone_number_input")
@@ -37,7 +35,6 @@ module Playbook
37
35
  disabled: disabled,
38
36
  error: error,
39
37
  formatAsYouType: format_as_you_type,
40
- hiddenInputs: hidden_inputs,
41
38
  initialCountry: initial_country,
42
39
  label: label,
43
40
  name: name,
@@ -84,7 +84,7 @@ const Popover = (props: PbPopoverProps) => {
84
84
  } = props;
85
85
 
86
86
  const items = globalProps(props).split(' ')
87
- const filteredItems = items.filter(item => !item.includes('min-width') && !item.includes('width'))
87
+ const filteredItems = items.filter(item => !item.includes('min_width'))
88
88
  const filteredGlobalProps = filteredItems.join(' ')
89
89
  const popoverSpacing =
90
90
  filteredGlobalProps.includes("dark") || !filteredGlobalProps
@@ -181,7 +181,7 @@ const PopoverTestClicktoClose3 = () => {
181
181
  const btn = screen.getByText(/click me/i)
182
182
  fireEvent.click(btn);
183
183
  const kit = screen.getByText("Click Anywhere");
184
- expect(kit).toHaveClass("pb_popover_body p_sm overflow_handling");
184
+ expect(kit).toHaveClass("pb_popover_body max_width_240px overflow_handling");
185
185
  });
186
186
 
187
187
  test("closes Popover on click anywhere", async () => {
@@ -17,7 +17,7 @@ const formatCurrencyDefaultValue = (value: string): string => {
17
17
 
18
18
  // Parse the numeric value as a float to handle decimals
19
19
  const dollars = parseFloat(numericValue)
20
- if (isNaN(dollars)) return ''
20
+ if (isNaN(dollars) || dollars === 0) return ''
21
21
 
22
22
  // Format as currency
23
23
  return new Intl.NumberFormat('en-US', {
@@ -30,9 +30,10 @@ const formatCurrencyDefaultValue = (value: string): string => {
30
30
  const formatCurrency = (value: string): string => {
31
31
  const numericValue = value.replace(/[^0-9]/g, '').slice(0, 15)
32
32
 
33
- if (!numericValue || numericValue === "00") return ''
33
+ if (!numericValue) return ''
34
34
 
35
35
  const dollars = parseFloat((parseInt(numericValue) / 100).toFixed(2))
36
+ if (dollars === 0) return ''
36
37
 
37
38
  return new Intl.NumberFormat('en-US', {
38
39
  style: 'currency',
@@ -0,0 +1,10 @@
1
+ <%= pb_rails("icon_circle", props: { icon: "paper-plane", id: "result-1-sample-email-link" }) %>
2
+
3
+ <%= pb_rails("tooltip", props: {
4
+ trigger_element_id: "result-1-sample-email-link",
5
+ tooltip_id: "sample-email-tooltip-result-1",
6
+ position: "top",
7
+ dark: true
8
+ }) do %>
9
+ Send Email
10
+ <% end %>
@@ -4,7 +4,6 @@ examples:
4
4
  - tooltip_default: Default
5
5
  - tooltip_interaction: Content Interaction
6
6
  - tooltip_selectors: Using Common Selectors
7
- - tooltip_icon_rails: Tooltip with Icon
8
7
  - tooltip_with_icon_circle: Icon Circle Tooltip
9
8
  - tooltip_delay_rails: Delay
10
9
  - tooltip_show_tooltip: Show Tooltip
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, forwardRef} from 'react'
1
+ import React, { useState, useEffect} from 'react'
2
2
  import Select from 'react-select'
3
3
  import AsyncSelect from 'react-select/async'
4
4
  import CreateableSelect from 'react-select/creatable'
@@ -49,7 +49,6 @@ type TypeaheadProps = {
49
49
  options?: Array<{ label: string; value?: string }>,
50
50
  marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
51
51
  pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
52
- onChange?: any,
53
52
  optionsByContext?: Record<string, Array<{ label: string; value?: string }>>
54
53
  searchContextSelector?: string,
55
54
  clearOnContextChange?: boolean,
@@ -72,7 +71,8 @@ type TagOnChangeValues = {
72
71
  * @constant {React.ReactComponent} Typeahead
73
72
  * @param {TypeaheadProps} props - props as described at https://react-select.com/props
74
73
  */
75
- const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
74
+
75
+ const Typeahead = ({
76
76
  async,
77
77
  className,
78
78
  components = {},
@@ -83,11 +83,9 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
83
83
  getOptionValue,
84
84
  htmlOptions = {},
85
85
  id,
86
- name,
87
86
  loadOptions = noop,
88
87
  marginBottom = "sm",
89
88
  pillColor,
90
- onChange,
91
89
  optionsByContext = {},
92
90
  searchContextSelector,
93
91
  clearOnContextChange = false,
@@ -158,15 +156,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
158
156
  )
159
157
 
160
158
  const handleOnChange = (_data: SelectValueType, { action, option, removedValue }: TagOnChangeValues) => {
161
- if (onChange) {
162
- const isReactHookForm = onChange.toString().includes("target")
163
- if (isReactHookForm) {
164
- onChange({ target: { name, value: _data } })
165
- } else {
166
- onChange(_data)
167
- }
168
- }
169
-
170
159
  if (action === 'select-option') {
171
160
  if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
172
161
  const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
@@ -210,11 +199,10 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
210
199
  />
211
200
  </div>
212
201
  )
213
- })
202
+ }
214
203
 
215
204
  Object.keys(kitComponents).forEach((k) => {
216
205
  (Typeahead as GenericObject)[k] = (kitComponents as {[key: string]: unknown})[k]
217
206
  })
218
207
 
219
- Typeahead.displayName = 'Typeahead'
220
208
  export default Typeahead
@@ -49,7 +49,7 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
49
49
  * @summary - for doc example purposes only
50
50
  */
51
51
  const handleOnMultiValueClick = (value) => {
52
- alert(`You added the user: "${value.label}"`)
52
+ alert(`You removed the user: "${value.label}"`)
53
53
  }
54
54
 
55
55
  return (
@@ -56,7 +56,7 @@ const TypeaheadWithPillsAsyncUsers = (props) => {
56
56
  * @summary - for doc example purposes only
57
57
  */
58
58
  const handleOnMultiValueClick = (value) => {
59
- alert(`You added the user: "${value.label}"`)
59
+ alert(`You removed the user: "${value.label}"`)
60
60
  }
61
61
 
62
62
  return (
@@ -17,7 +17,6 @@ examples:
17
17
 
18
18
  react:
19
19
  - typeahead_default: Default
20
- - typeahead_react_hook: React Hook
21
20
  - typeahead_with_highlight: With Highlight
22
21
  - typeahead_with_pills: With Pills
23
22
  - typeahead_with_pills_async: With Pills (Async Data)
@@ -13,4 +13,3 @@ export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_lis
13
13
  export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
14
14
  export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
15
15
  export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
16
- export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'