playbook_ui 14.3.0.pre.rc.12 → 14.3.1.pre.alpha.PBNTR515typeaheadmarginbottomredux3746

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1c4b9a8a3a0ff2e5d43f0bcc65572db1317c9180de07d59be728a3326567623
4
- data.tar.gz: 819569eaeab4b6f6490d6249a2ea217024faf58fc1048aed222c35d1ed72a32e
3
+ metadata.gz: f422119e094bb65421697ac44567037f7dc9f7c1a6fa490b696245accea173d2
4
+ data.tar.gz: a9513ac152f0b28da77fcd545c9c288b1935d46c90f2c7e777b85a8edd57a2c5
5
5
  SHA512:
6
- metadata.gz: 05bb16de81a0fcfbce3473ed5e1f03d9bd7827d93c65c2a1499fd8c0d0769b3a4e21ac9f75fbeaaa24c2f493098f3f3891b74bda3bd046e5ca7cb521c5f8605a
7
- data.tar.gz: 91590aa419b5f263a9d80a07ff97c5b978736ebcfef10465f01448de127c2c8baf336bdac0b8e06fd78422a3a71b19df9b2dc75e564cd7354c0103ec2c50455e
6
+ metadata.gz: c717f2203155c2e7acfee431ba79a78e6e6f392a3bc4fe57b50063067ad217fb95304818a563aa1009dc6369f95952dcbee28ca6746aeee8f5af1d891d85a873
7
+ data.tar.gz: a23cf73a0bbcd1cf5482469fc3786f1c857bceb090ab7f5e1fed709ff022ad95246b34be5be65d0696e55cb8c971ec4f145c9e17f94ed7855861f348c7cf05c2
@@ -6,6 +6,10 @@ export const showElement = (elem: HTMLElement) => {
6
6
  elem.style.overflow = "hidden"
7
7
  // Once the transition is complete, remove the inline max-height so the content can scale responsively
8
8
  window.setTimeout(() => {
9
+ // If a user toggles multiple times quickly in a row, 'is-visible' can be removed by hideElement's timeout
10
+ if (!elem.classList.contains('is-visible')) {
11
+ elem.classList.add('is-visible')
12
+ }
9
13
  elem.style.height = '';
10
14
  elem.style.overflow = "visible"
11
15
  }, 300);
@@ -18,32 +18,29 @@ const RadioChildren = (props) => {
18
18
  <div>
19
19
  <Radio
20
20
  label="Select"
21
- marginBottom="sm"
22
21
  name="Group1"
23
22
  tabIndex={0}
24
23
  value="Select"
25
24
  {...props}
26
25
  >
27
26
  <Select
28
- marginBottom="none"
29
27
  minWidth="xs"
30
28
  options={options}
31
29
  />
32
30
  </Radio>
33
31
  <Radio
34
32
  label="Typeahead"
35
- marginBottom="sm"
36
33
  name="Group1"
37
34
  tabIndex={0}
38
35
  value="Typeahead"
39
36
  {...props}
40
37
  >
41
38
  <Typeahead
42
- marginBottom="none"
43
39
  minWidth="xs"
44
40
  options={options}
45
41
  />
46
42
  </Radio>
43
+ <br />
47
44
  <Radio
48
45
  defaultChecked={false}
49
46
  label="Typography"
@@ -45,6 +45,7 @@
45
45
  }
46
46
  }
47
47
  .text_input_wrapper {
48
+ margin-bottom: 1rem;
48
49
  input::placeholder,
49
50
  .text_input .placeholder {
50
51
  @include pb_body_light_dark;
@@ -107,17 +107,4 @@ test('should pass className prop', () => {
107
107
 
108
108
  const kit = screen.getByTestId('typeahead-test')
109
109
  expect(kit).toHaveClass(className)
110
- })
111
-
112
- test('typeahead textinput has mb_sm class by default', () => {
113
- render(
114
- <Typeahead
115
- data={{ testid: 'default-mb-test' }}
116
- options={options}
117
- />
118
- )
119
-
120
- const kit = screen.getByTestId('default-mb-test')
121
- const textInput = kit.querySelector(".pb_text_input_kit")
122
- expect(textInput).toHaveClass("mb_sm")
123
110
  })
@@ -83,12 +83,7 @@ const Typeahead = ({
83
83
  const selectProps = {
84
84
  cacheOptions: true,
85
85
  components: {
86
- Control: (controlProps: any) => (
87
- <Control
88
- {...controlProps}
89
- marginBottom={marginBottom}
90
- />
91
- ),
86
+ Control,
92
87
  ClearIndicator,
93
88
  IndicatorsContainer,
94
89
  IndicatorSeparator: null as null,
@@ -141,6 +136,7 @@ const Typeahead = ({
141
136
  const htmlProps = buildHtmlProps(htmlOptions)
142
137
  const classes = classnames(
143
138
  'pb_typeahead_kit react-select',
139
+ `mb_${marginBottom}`,
144
140
  globalProps(props),
145
141
  className
146
142
  )
@@ -3,14 +3,15 @@ import { components } from 'react-select'
3
3
 
4
4
  import Flex from '../../pb_flex/_flex'
5
5
  import TextInput from '../../pb_text_input/_text_input'
6
+ import { MarginBottomType } from '../_typeahead'
7
+
6
8
 
7
9
  type Props = {
8
10
  selectProps: any,
9
- marginBottom?: string,
10
11
  }
11
12
 
12
13
  const TypeaheadControl = (props: Props) => {
13
- const { selectProps, marginBottom } = props
14
+ const { selectProps } = props
14
15
  const { dark, error, label } = selectProps
15
16
 
16
17
  return (
@@ -19,7 +20,7 @@ const TypeaheadControl = (props: Props) => {
19
20
  dark={dark}
20
21
  error={error}
21
22
  label={label}
22
- marginBottom={marginBottom}
23
+ marginBottom="none"
23
24
  >
24
25
  <Flex>
25
26
  <components.Control
@@ -57,4 +57,4 @@ const TypeaheadMarginBottom = (props) => {
57
57
  )
58
58
  }
59
59
 
60
- export default TypeaheadMarginBottom
60
+ export default TypeaheadMarginBottom
@@ -9,7 +9,6 @@ examples:
9
9
  - typeahead_inline: Inline
10
10
  - typeahead_multi_kit: Multi Kit Options
11
11
  - typeahead_error_state: Error State
12
- - typeahead_margin_bottom: Margin Bottom
13
12
 
14
13
  react:
15
14
  - typeahead_default: Default
@@ -20,8 +20,7 @@
20
20
  label: object.label,
21
21
  name: object.name,
22
22
  value: object.value,
23
- placeholder: object.placeholder,
24
- margin_bottom: "none",
23
+ placeholder: object.placeholder
25
24
  }) %>
26
25
  <%= pb_rails("list", props: { ordered: false, borderless: false, xpadding: true, role: "status", aria: { live: "polite" }, data: { pb_typeahead_kit_results: true } }) do %>
27
26
  <% end %>
@@ -14,9 +14,6 @@ module Playbook
14
14
  default: false
15
15
  prop :label
16
16
  prop :load_options
17
- prop :margin_bottom, type: Playbook::Props::Enum,
18
- values: %w[none xxs xs sm md lg xl],
19
- default: "sm"
20
17
  prop :multi_kit, type: Playbook::Props::String,
21
18
  default: ""
22
19
  prop :name
@@ -39,8 +36,7 @@ module Playbook
39
36
  prop :value
40
37
 
41
38
  def classname
42
- default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
43
- generate_classname("pb_typeahead_kit") + default_margin_bottom
39
+ generate_classname("pb_typeahead_kit")
44
40
  end
45
41
 
46
42
  def inline_class
@@ -69,7 +65,6 @@ module Playbook
69
65
  inline: inline,
70
66
  isMulti: is_multi,
71
67
  label: label,
72
- marginBottom: margin_bottom,
73
68
  multiKit: multi_kit,
74
69
  name: name,
75
70
  options: options,