playbook_ui 15.6.0.pre.alpha.play265012993 → 15.6.0.pre.rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +163 -1
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +190 -0
  4. data/app/pb_kits/playbook/pb_background/_background.tsx +6 -6
  5. data/app/pb_kits/playbook/pb_background/background.test.js +1 -5
  6. data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
  7. data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +1 -0
  8. data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
  9. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -6
  10. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
  11. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
  12. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
  13. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +8 -10
  14. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +1 -0
  15. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +3 -0
  16. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +0 -24
  17. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +3 -181
  18. data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +0 -31
  19. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
  20. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +7 -458
  21. data/app/pb_kits/playbook/pb_draggable/context/types.ts +3 -8
  22. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +2 -3
  23. data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
  24. data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +1 -77
  25. data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +4 -4
  26. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +22 -34
  27. data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +12 -16
  28. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +12 -16
  30. data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +12 -16
  31. data/app/pb_kits/playbook/pb_legend/_legend.tsx +1 -6
  32. data/app/pb_kits/playbook/pb_legend/legend.html.erb +0 -1
  33. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +0 -10
  34. data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +15 -66
  35. data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +0 -1
  36. data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +0 -1
  37. data/app/pb_kits/playbook/pb_multiple_users/multiple_users.test.js +0 -25
  38. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +10 -44
  39. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +4 -34
  40. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +7 -16
  41. data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
  42. data/app/pb_kits/playbook/pb_select/_select.tsx +3 -8
  43. data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
  44. data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -2
  45. data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
  46. data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
  47. data/app/pb_kits/playbook/pb_select/select.rb +1 -3
  48. data/app/pb_kits/playbook/pb_select/select.test.js +0 -23
  49. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
  50. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
  51. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +0 -15
  52. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +0 -3
  53. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +2 -13
  54. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -6
  55. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -34
  56. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
  57. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -2
  58. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -6
  59. data/app/pb_kits/playbook/tokens/_colors.scss +1 -2
  60. data/dist/chunks/_typeahead-kRdz5zPn.js +6 -0
  61. data/dist/chunks/lib-CgpqUb6l.js +29 -0
  62. data/dist/chunks/vendor.js +2 -2
  63. data/dist/menu.yml +2 -3
  64. data/dist/playbook-rails-react-bindings.js +1 -1
  65. data/dist/playbook-rails.js +1 -1
  66. data/dist/playbook.css +1 -1
  67. data/lib/playbook/forms/builder/collection_select_field.rb +1 -9
  68. data/lib/playbook/forms/builder/select_field.rb +1 -9
  69. data/lib/playbook/forms/builder/time_zone_select_field.rb +1 -9
  70. data/lib/playbook/pb_kit_helper.rb +0 -35
  71. data/lib/playbook/version.rb +2 -2
  72. metadata +4 -16
  73. data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
  74. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +0 -180
  75. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +0 -22
  76. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +0 -42
  77. data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +0 -1
  78. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb +0 -16
  79. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +0 -30
  80. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +0 -1
  81. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +0 -30
  82. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +0 -37
  83. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +0 -3
  84. data/app/pb_kits/playbook/utilities/deprecated.ts +0 -73
  85. data/dist/chunks/_typeahead-DMyvWpig.js +0 -6
  86. data/dist/chunks/lib-DDDLiZuu.js +0 -29
@@ -29,7 +29,6 @@ type SelectProps = {
29
29
  id?: string,
30
30
  includeBlank?: string,
31
31
  inline?: boolean,
32
- inputOptions?: {[key: string]: string | number | boolean | (() => void)},
33
32
  label?: string,
34
33
  margin: string,
35
34
  marginBottom: string,
@@ -64,7 +63,6 @@ const Select = ({
64
63
  label,
65
64
  htmlOptions = {},
66
65
  inline = false,
67
- inputOptions = {},
68
66
  multiple = false,
69
67
  name,
70
68
  onChange = () => undefined,
@@ -96,17 +94,14 @@ const Select = ({
96
94
  const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
97
95
 
98
96
  const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
99
- const selectId = (inputOptions?.id as string) || name
100
-
101
97
  const selectBody =(() =>{
102
98
  if (children) return children
103
99
  return (
104
100
  <select
105
101
  {...htmlOptions}
106
102
  {...domSafeProps(props)}
107
- {...inputOptions}
108
103
  disabled={disabled}
109
- id={selectId}
104
+ id={name}
110
105
  multiple={multiple}
111
106
  name={name}
112
107
  onChange={onChange}
@@ -130,7 +125,7 @@ const Select = ({
130
125
  {label &&
131
126
  <label
132
127
  className="pb_select_kit_label"
133
- htmlFor={selectId}
128
+ htmlFor={name}
134
129
  >
135
130
  <Caption
136
131
  dark={props.dark}
@@ -140,7 +135,7 @@ const Select = ({
140
135
  }
141
136
  <label
142
137
  className={selectWrapperClass}
143
- htmlFor={selectId}
138
+ htmlFor={name}
144
139
  >
145
140
  {selectBody}
146
141
  { multiple !== true ?
@@ -1 +1 @@
1
- Select w/ Error shows that an option must be selected or is invalid (i.e. when used in a form it signals a user to fix an error).
1
+ Select w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
@@ -15,7 +15,6 @@ examples:
15
15
  - select_inline_compact: Select Inline Compact
16
16
  - select_attributes: Select W/ Attributes
17
17
  - select_multiple: Select Multiple
18
- - select_input_options: Input Options
19
18
 
20
19
 
21
20
 
@@ -34,7 +33,6 @@ examples:
34
33
  - select_inline_compact: Select Inline Compact
35
34
  - select_multiple: Select Multiple
36
35
  - select_react_hook: React Hook
37
- - select_input_options: Input Options
38
36
 
39
37
  swift:
40
38
  - select_default_swift: Default
@@ -12,4 +12,3 @@ export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
12
12
  export { default as SelectMultiple } from './_select_multiple.jsx'
13
13
  export { default as SelectReactHook } from './_select_react_hook.jsx'
14
14
  export { default as SelectCustomSelectSubheaders } from './_select_custom_select_subheaders.jsx'
15
- export { default as SelectInputOptions } from './_select_input_options.jsx'
@@ -2,11 +2,11 @@
2
2
  id: nil,
3
3
  class: object.classnames ) do %>
4
4
  <% if object.label %>
5
- <label class="pb_select_kit_label" for="<%= object.input_options[:id] || object.name %>">
5
+ <label class="pb_select_kit_label" for="<%= object.name %>">
6
6
  <%= pb_rails("caption", props: { text: object.label, dark: object.dark }) %>
7
7
  </label>
8
8
  <% end %>
9
- <label class="<%= object.select_wrapper_class %>" for="<%= object.input_options[:id] || object.name %>">
9
+ <label class="<%= object.select_wrapper_class %>" for="<%= object.name %>">
10
10
  <% if content.present? %>
11
11
  <%= content %>
12
12
  <%= pb_rails("body", props: { status: "negative", text: object.error }) %>
@@ -14,8 +14,6 @@ module Playbook
14
14
  prop :error
15
15
  prop :include_blank
16
16
  prop :inline, type: Playbook::Props::Boolean, default: false
17
- prop :input_options, type: Playbook::Props::HashProp,
18
- default: {}
19
17
  prop :label
20
18
  prop :multiple, type: Playbook::Props::Boolean, default: false
21
19
  prop :name
@@ -40,7 +38,7 @@ module Playbook
40
38
  multiple: multiple,
41
39
  onchange: onchange,
42
40
  include_blank: include_blank,
43
- }.merge(attributes).merge(input_options)
41
+ }.merge(attributes)
44
42
  end
45
43
 
46
44
  def classname
@@ -65,27 +65,4 @@ test('returns multiple variant', () => {
65
65
  const selectElement = kit.querySelector('select');
66
66
 
67
67
  expect(selectElement).toHaveAttribute('multiple', '');
68
- });
69
-
70
- test('inputOptions are passed to select element', () => {
71
- render(
72
- <Select
73
- data={{ testid: testId }}
74
- inputOptions={{
75
- id: 'custom-select-id',
76
- className: 'custom-select-class',
77
- 'aria-label': 'Custom aria label',
78
- }}
79
- label="Favorite Food"
80
- name="food"
81
- options={options}
82
- />
83
- )
84
-
85
- const kit = screen.getByTestId(testId)
86
- const selectElement = kit.querySelector('select')
87
-
88
- expect(selectElement).toHaveAttribute('id', 'custom-select-id')
89
- expect(selectElement).toHaveClass('custom-select-class')
90
- expect(selectElement).toHaveAttribute('aria-label', 'Custom aria label')
91
68
  });
@@ -1 +1 @@
1
- Text Input w/ Error shows that the input must be filled out (i.e. when used in a form it signals a user to fix an error).
1
+ Text Input w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
@@ -1 +1 @@
1
- Textarea w/ Error shows that the input must be filled out (i.e. when used in a form it signals a user to fix an error).
1
+ Textarea w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
@@ -276,18 +276,3 @@ test('multi-value badges have tabIndex and focus class when focused', () => {
276
276
  })
277
277
  })
278
278
 
279
- test('input display none shows number of selected items', () => {
280
- render(
281
- <Typeahead
282
- data={{ testid: 'input-display-none-test' }}
283
- defaultValue={[options[0], options[1]]}
284
- inputDisplay="none"
285
- isMulti
286
- options={options}
287
- />
288
- )
289
-
290
- const kit = screen.getByTestId('input-display-none-test')
291
- const inputDisplayDiv = kit.querySelector(".pb_typeahead_selection_count")
292
- expect(inputDisplayDiv).toHaveTextContent("2 items selected")
293
- })
@@ -43,7 +43,6 @@ type TypeaheadProps = {
43
43
  error?: string,
44
44
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
45
45
  id?: string,
46
- inputDisplay?: "pills" | "none",
47
46
  label?: string,
48
47
  loadOptions?: string | Noop,
49
48
  getOptionLabel?: string | (() => string),
@@ -90,7 +89,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
90
89
  getOptionValue,
91
90
  htmlOptions = {},
92
91
  id,
93
- inputDisplay = "pills",
94
92
  name,
95
93
  loadOptions = noop,
96
94
  marginBottom = "sm",
@@ -240,7 +238,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
240
238
  getOptionValue: isString(getOptionValue) ? get(window, getOptionValue) : getOptionValue,
241
239
  defaultOptions: true,
242
240
  id: id || uniqueId(),
243
- inputDisplay: inputDisplay,
244
241
  inline: false,
245
242
  isClearable: true,
246
243
  isSearchable: true,
@@ -7,29 +7,18 @@ type ClearContainerProps = {
7
7
  id: string,
8
8
  },
9
9
  clearValue: () => void,
10
- innerProps?: any,
11
10
  }
12
11
 
13
- const ClearContainer = (props: ClearContainerProps | any): React.ReactElement => {
14
- const { selectProps, clearValue, innerProps } = props
12
+ const ClearContainer = (props: ClearContainerProps): React.ReactElement => {
13
+ const { selectProps, clearValue } = props
15
14
  useEffect(() => {
16
15
  document.addEventListener(`pb-typeahead-kit-${selectProps.id}:clear`, clearValue)
17
16
  }, [clearValue, selectProps.id])
18
17
 
19
- // To stop this from bubbling up when inside a dialog or other modal
20
- const handleMouseDown = (event: React.MouseEvent) => {
21
- event.stopPropagation()
22
- innerProps?.onMouseDown?.(event)
23
- }
24
-
25
18
  return (
26
19
  <components.ClearIndicator
27
20
  className="clear_indicator"
28
21
  {...props}
29
- innerProps={{
30
- ...innerProps,
31
- onMouseDown: handleMouseDown,
32
- }}
33
22
  />
34
23
  )
35
24
  }
@@ -19,12 +19,7 @@ type Props = {
19
19
  const MultiValue = (props: Props) => {
20
20
  const { removeProps, isFocused } = props
21
21
  const { imageUrl, label } = props.data
22
- const { dark, multiKit, pillColor, truncate, wrapped, inputDisplay } = props.selectProps
23
-
24
- // If inputDisplay is "none", don't render the pill/badge, just return null (the count handled in ValueContainer file)
25
- if (inputDisplay === 'none') {
26
- return null
27
- }
22
+ const { dark, multiKit, pillColor, truncate, wrapped } = props.selectProps
28
23
 
29
24
  const formPillProps = {
30
25
  marginRight: 'xs',
@@ -1,42 +1,15 @@
1
1
  import React from 'react'
2
2
  import { components } from 'react-select'
3
- import Body from '../../pb_body/_body'
4
3
 
5
4
  type ValueContainerProps = {
6
- children: React.ReactNode | React.ReactNode[],
7
- selectProps?: Record<string, unknown>,
8
- hasValue?: boolean,
5
+ children: React.ReactNode,
9
6
  }
10
7
 
11
- const ValueContainer = (props: ValueContainerProps | any): React.ReactElement => {
12
- const { children, selectProps, hasValue } = props
13
- const inputDisplay = (selectProps as any)?.inputDisplay
14
- const value = (selectProps as any)?.value
15
-
16
- // When inputDisplay is "none" and there are selected values, show count text (this is for multi-select only)
17
- if (inputDisplay === 'none' && hasValue && value) {
18
- const selectedCount = Array.isArray(value) ? value.length : 0
19
-
20
- return (
21
- <components.ValueContainer
22
- className="text_input_value_container"
23
- {...props}
24
- >
25
- <Body
26
- className="pb_typeahead_selection_count"
27
- text={`${selectedCount} item${selectedCount !== 1 ? 's' : ''} selected`}
28
- />
29
- {children}
30
- </components.ValueContainer>
31
- )
32
- }
33
-
34
- return (
35
- <components.ValueContainer
36
- className="text_input_value_container"
37
- {...props}
38
- />
39
- )
40
- }
8
+ const ValueContainer = (props: ValueContainerProps): React.ReactElement => (
9
+ <components.ValueContainer
10
+ className="text_input_value_container"
11
+ {...props}
12
+ />
13
+ )
41
14
 
42
15
  export default ValueContainer
@@ -5,7 +5,6 @@ examples:
5
5
  - typeahead_default_options: With Default Options
6
6
  - typeahead_with_context: With Context
7
7
  - typeahead_with_pills: With Pills
8
- - typeahead_input_display: Input Display
9
8
  - typeahead_without_pills: Without Pills (Single Select)
10
9
  - typeahead_with_pills_async: With Pills (Async Data)
11
10
  - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
@@ -27,7 +26,6 @@ examples:
27
26
  - typeahead_react_hook: React Hook
28
27
  - typeahead_with_highlight: With Highlight
29
28
  - typeahead_with_pills: With Pills
30
- - typeahead_input_display: Input Display
31
29
  - typeahead_with_pills_async: With Pills (Async Data)
32
30
  - typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
33
31
  - typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
@@ -17,5 +17,4 @@ export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
17
17
  export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
18
18
  export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'
19
19
  export { default as TypeaheadDefaultValue } from './_typeahead_default_value.jsx'
20
- export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
21
- export { default as TypeaheadInputDisplay } from './_typeahead_input_display.jsx'
20
+ export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
@@ -25,10 +25,6 @@ module Playbook
25
25
  prop :is_multi, type: Playbook::Props::Boolean,
26
26
  default: true
27
27
 
28
- prop :input_display, type: Playbook::Props::Enum,
29
- values: %w[none pills],
30
- default: "pills"
31
-
32
28
  prop :pills, type: Playbook::Props::Boolean,
33
29
  default: false
34
30
 
@@ -82,7 +78,7 @@ module Playbook
82
78
  end
83
79
 
84
80
  def is_react?
85
- pills || !is_multi || wrapped || input_display == "none"
81
+ pills || !is_multi || wrapped
86
82
  end
87
83
 
88
84
  def typeahead_react_options
@@ -95,7 +91,6 @@ module Playbook
95
91
  id: id,
96
92
  inline: inline,
97
93
  isMulti: is_multi,
98
- inputDisplay: input_display,
99
94
  label: label,
100
95
  marginBottom: margin_bottom,
101
96
  multiKit: multi_kit,
@@ -139,8 +139,7 @@ $text_colors: (
139
139
  text_lt_lighter: $text_lt_lighter,
140
140
  text_dk_default: $text_dk_default,
141
141
  text_dk_light: $text_dk_light,
142
- text_dk_lighter: $text_dk_lighter,
143
- text_dk_success_sm: $text_dk_success_sm
142
+ text_dk_lighter: $text_dk_lighter
144
143
  );
145
144
 
146
145
  /* Data colors ------------------------*/