playbook_ui 15.5.0.pre.alpha.play250212696 → 15.5.0.pre.alpha.play250612607

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0f25d8e230fb6f3cf92eac4b1e458b83579eba7a8f201a70f84c54fb97698b6b
4
- data.tar.gz: f63d76ad13dada00d5d24667c202d4b8de8b29559fe5b6c0fbcf28eb8e3205f8
3
+ metadata.gz: 2b5ffde9745ceb25129d5ef341dd3dda350a7cc52f0db4be00ffd873e90912a4
4
+ data.tar.gz: 4ba6f0e94b76a8b45bc12853f81c160dc54f31e4d671292e7c447df040bdc17c
5
5
  SHA512:
6
- metadata.gz: 3f81a0dbf26bbbe3705c641959e175d4d4807690c16c672200e0a75a9fda6929eefe20ed29305f863c2229c6b5427a61327372364c4adb4f043ede86ac58cfb0
7
- data.tar.gz: 9e0869caebd6545288ebe34e1df3d8c3f51faf21c915237aae222029abe6274c934ba2453b46c59f476ea3b38f58e0be319817b5f3d017fef7b915232a5fc5aa
6
+ metadata.gz: 32d276f58d1ac23aa1a37911eac0142b1e0f1d4b959a51edbf14e3a6c8aad19ec3875e28cc5828372f07853c4d3ae6e27c320e5ea7a957e79032b19026b97a60
7
+ data.tar.gz: 47f2381f3a46b5c8b0c5bc80080ca2ed7268c706a8cd27f592fa1ebe61587d67b3d72d06a3afabf89449b43a12e0ebc7db8de08ca8108fa5f37535d2f3589711
@@ -1,24 +1,3 @@
1
- <%
2
- options = [
3
- {
4
- label: "United States",
5
- value: "unitedStates",
6
- id: "us"
7
- },
8
- {
9
- label: "United Kingdom",
10
- value: "unitedKingdom",
11
- id: "gb"
12
- },
13
- {
14
- label: "Pakistan",
15
- value: "pakistan",
16
- id: "pk"
17
- }
18
- ]
19
- %>
20
-
21
-
22
1
  <%= pb_rails("button", props: { text: "Open Complex Dialog", data:{"open-dialog": "dialog-complex"} }) %>
23
2
 
24
3
  <%= pb_rails("dialog", props: { id:"dialog-complex", size: "lg", full_height: true }) do %>
@@ -31,16 +10,6 @@
31
10
  <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %>
32
11
  <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %>
33
12
  <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %>
34
- <%= pb_rails("dropdown", props: {options: options, autocomplete: true}) %>
35
- <%= pb_rails("typeahead", props: {
36
- id: "typeahead-default",
37
- placeholder: "Select one...",
38
- options: options,
39
- name: :foo,
40
- margin_top: "sm",
41
- is_multi: false
42
- })
43
- %>
44
13
 
45
14
  <% end %>
46
15
  <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-complex"}) %>
@@ -143,30 +143,25 @@ export default class PbDialog extends PbEnhancedElement {
143
143
 
144
144
  // Close dialog box on outside click
145
145
  dialogs.forEach((dialogElement) => {
146
- const originalClickHandler = dialogElement._outsideClickHandler
147
- if (originalClickHandler) dialogElement.removeEventListener("click", originalClickHandler)
148
-
146
+ const originalMousedownHandler = dialogElement._outsideClickHandler
147
+ if (originalMousedownHandler) dialogElement.removeEventListener("mousedown", originalMousedownHandler)
149
148
  dialogElement._outsideClickHandler = (event) => {
150
149
  const dialogParentDataset = dialogElement.parentElement.dataset
151
150
  if (dialogParentDataset.overlayClick === "overlay_close") return
152
151
 
153
- // Get the dialog's bounding box (the actual content area)
154
- const rect = dialogElement.getBoundingClientRect()
155
- const clickedInDialog = (
156
- event.clientX >= rect.left &&
157
- event.clientX <= rect.right &&
158
- event.clientY >= rect.top &&
159
- event.clientY <= rect.bottom
160
- )
161
-
162
- // Only close if clicked outside the dialog content (on the backdrop)
163
- if (!clickedInDialog) {
152
+ const dialogModal = event.target.getBoundingClientRect()
153
+ const clickedOutsideDialogModal = event.clientX < dialogModal.left ||
154
+ event.clientX > dialogModal.right ||
155
+ event.clientY < dialogModal.top ||
156
+ event.clientY > dialogModal.bottom
157
+
158
+ if (clickedOutsideDialogModal) {
164
159
  dialogElement.close()
165
160
  event.stopPropagation()
166
161
  }
167
162
  }
168
163
 
169
- dialogElement.addEventListener("click", dialogElement._outsideClickHandler);
164
+ dialogElement.addEventListener("mousedown", dialogElement._outsideClickHandler);
170
165
  })
171
166
  }
172
167
  }
@@ -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,