playbook_ui 15.5.0.pre.alpha.play250212696 → 15.5.0.pre.alpha.play260612706

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: 68e50dc389b41862430cc0615991fb9e83f733981412aeb7ce348cc851f19325
4
+ data.tar.gz: a59b600809d8eac2c4d1718c904196de1879fd1c4307433734fd90e77a27d48c
5
5
  SHA512:
6
- metadata.gz: 3f81a0dbf26bbbe3705c641959e175d4d4807690c16c672200e0a75a9fda6929eefe20ed29305f863c2229c6b5427a61327372364c4adb4f043ede86ac58cfb0
7
- data.tar.gz: 9e0869caebd6545288ebe34e1df3d8c3f51faf21c915237aae222029abe6274c934ba2453b46c59f476ea3b38f58e0be319817b5f3d017fef7b915232a5fc5aa
6
+ metadata.gz: 512a1c1bc6effa4642eaa6c75f95e0403ecd1f6c33bb87bb8cb2270f9758b6f1d2f103b96180dc4303d74991a176820ba351521fa677c288e0df7d838517b380
7
+ data.tar.gz: 6a9959a608a5aae7a45bb4f98afb1e54feca7a1b6fe5a8a70a2fa4edb60f31e01c27bba37dbfc0feabd41dc7370b23be6152ab43f1e2579e1d0863fc3bf2dc08
@@ -102,16 +102,16 @@ const Background = (props: BackgroundProps): React.ReactElement => {
102
102
  useEffect(() => {
103
103
  const updateResponsiveProps = () => {
104
104
  setResponsiveProps({
105
- backgroundSize: getResponsiveValue(props.backgroundSize),
106
- backgroundPosition: getResponsiveValue(props.backgroundPosition),
107
- backgroundRepeat: getResponsiveValue(props.backgroundRepeat),
108
- backgroundColor: getResponsiveValue(props.backgroundColor),
109
- imageUrl: getResponsiveValue(props.imageUrl),
105
+ backgroundSize: getResponsiveValue(backgroundSize),
106
+ backgroundPosition: getResponsiveValue(backgroundPosition),
107
+ backgroundRepeat: getResponsiveValue(backgroundRepeat),
108
+ backgroundColor: getResponsiveValue(backgroundColor),
109
+ imageUrl: getResponsiveValue(imageUrl),
110
110
  });
111
111
  };
112
112
  window.addEventListener('resize', updateResponsiveProps);
113
113
  return () => window.removeEventListener('resize', updateResponsiveProps);
114
- }, [props]);
114
+ }, [backgroundSize, backgroundPosition, backgroundRepeat, backgroundColor, imageUrl]);
115
115
 
116
116
 
117
117
  // Extract currently applicable responsive values.
@@ -4,7 +4,6 @@ import Background from './_background'
4
4
 
5
5
  const props = {
6
6
  data: { testid: 'background' },
7
- backgroundColor: null,
8
7
  }
9
8
 
10
9
  it('Should be accessible', async () => {
@@ -42,3 +41,8 @@ test('applies correct overlay class when imageOverlay prop is provided', () => {
42
41
  const kit = renderKit(Background, props, { imageOverlay: 'opacity_6' });
43
42
  expect(kit).toHaveClass('imageoverlay_opacity_6');
44
43
  });
44
+
45
+ test('Sets backgroundColor to light as default when no backgroundColor prop is provided', () => {
46
+ const kit = renderKit(Background, props);
47
+ expect(kit).toHaveClass('pb_background_color_light');
48
+ });
@@ -1,3 +1,3 @@
1
- <%= pb_rails("background", props: { background_color: "light", padding: "xl" }) do %>
1
+ <%= pb_rails("background", props: { padding: "xl" }) do %>
2
2
 
3
3
  <% end %>
@@ -3,7 +3,6 @@ import Background from '../../pb_background/_background'
3
3
 
4
4
  const BackgroundLight = (props) => (
5
5
  <Background
6
- backgroundColor="light"
7
6
  padding="xl"
8
7
  {...props}
9
8
  />
@@ -0,0 +1 @@
1
+ By default, the Background kit sets background color to 'light' as seen here.
@@ -1,7 +1,7 @@
1
1
  examples:
2
2
 
3
3
  rails:
4
- - background_light: Light
4
+ - background_light: Default
5
5
  - background_white: White
6
6
  - background_gradient: Gradient
7
7
  - background_image: Image
@@ -11,7 +11,7 @@ examples:
11
11
  - background_size: Size
12
12
 
13
13
  react:
14
- - background_light: Light
14
+ - background_light: Default
15
15
  - background_white: White
16
16
  - background_gradient: Gradient
17
17
  - background_image: Image
@@ -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,
@@ -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,