playbook_ui 12.18.0.pre.alpha.PLAY747carddarktokens610 → 12.18.0.pre.alpha.PLAY785typeaheadts607

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: df71e45e88ac711bf2e8d7a0a06a9074f6580abac8fd1be01d821f9c62251f24
4
- data.tar.gz: c17c7ae38668ef45dcfbd38ea53483fd7190b5f5401183ab73b40e8c0c882bf8
3
+ metadata.gz: 26572c40e5d01c7e43872cbabc7fb5692159287552edf439189033a879962309
4
+ data.tar.gz: 2b4fa17409946d56f3de6a7150362bcb1f101cc1431bcfb247c7da19a936959c
5
5
  SHA512:
6
- metadata.gz: b7f1abd7f565054f92b56797b7b8958a051585540dd0c7060b05db7377b11d7aed7914f2d76b6826f0f5cd02dfccf9cd5e4a681373ac23bf2a5b28ce8b875217
7
- data.tar.gz: 167d35e3b3112d6b3b7d5dde51f2c5687b913f63c9522db9763c312b59164d826f69b25316bc2aac0a8978098eaef91808dcd62cc98cdde816b56103b889ffaf
6
+ metadata.gz: 3d9fc0dd67507536902b9712ebf6180ef820a5d5d9cc526813836de94588e492500008c0d38e954a4b9201c65ecc4b19352498489c5af75762d4a424ac2e3e06
7
+ data.tar.gz: '008db1997c35cb3ee24943d003b2adc8a4d6ca1e3409ff86bc27591f09bb3369dba691d67a51c55abbd621155a0b7a3ceebd9db04a8c5552fd1e37141c13d613'
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import Select from 'react-select'
5
3
  import AsyncSelect from 'react-select/async'
@@ -19,6 +17,7 @@ import Placeholder from './components/Placeholder'
19
17
  import ValueContainer from './components/ValueContainer'
20
18
 
21
19
  import { noop, buildDataProps } from '../utilities/props'
20
+ import { Noop } from '../types'
22
21
 
23
22
  /**
24
23
  * @typedef {object} Props
@@ -33,16 +32,28 @@ type TypeaheadProps = {
33
32
  components?: object,
34
33
  createable?: boolean,
35
34
  dark?: boolean,
36
- data?: object,
35
+ data?: { [key: string]: string },
37
36
  error?: string,
38
37
  id?: string,
39
38
  label?: string,
40
- loadOptions?: string,
39
+ loadOptions?: string | Noop,
41
40
  getOptionLabel?: string | (() => any),
42
41
  getOptionValue?: string | (() => any),
43
42
  name?: string,
44
43
  }
45
44
 
45
+ export type SelectValueType = {
46
+ label: string,
47
+ value: string,
48
+ imageUrl?: string,
49
+ }
50
+
51
+ type TagOnChangeValues = {
52
+ action?: string,
53
+ option?: SelectValueType,
54
+ removedValue?: string,
55
+ }
56
+
46
57
  /**
47
58
  * @constant {React.ReactComponent} Typeahead
48
59
  * @param {TypeaheadProps} props - props as described at https://react-select.com/props
@@ -67,7 +78,6 @@ const Typeahead = ({
67
78
  Control,
68
79
  ClearIndicator,
69
80
  IndicatorsContainer,
70
- IndicatorSeparator: null,
71
81
  MenuList,
72
82
  MultiValue,
73
83
  Option,
@@ -85,8 +95,8 @@ const Typeahead = ({
85
95
  isSearchable: true,
86
96
  name,
87
97
  multiKit: '',
88
- onCreateOption: null,
89
98
  plusIcon: false,
99
+ onMultiValueClick: (_option: SelectValueType) => { },
90
100
  ...props,
91
101
  }
92
102
 
@@ -96,7 +106,7 @@ const Typeahead = ({
96
106
  : (async ? AsyncSelect : Select)
97
107
  )
98
108
 
99
- const handleOnChange = (_data, { action, option, removedValue }) => {
109
+ const handleOnChange = (_data: SelectValueType, { action, option, removedValue }: TagOnChangeValues) => {
100
110
  if (action === 'select-option') {
101
111
  if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
102
112
  const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
@@ -123,13 +133,13 @@ const Typeahead = ({
123
133
 
124
134
  return (
125
135
  <div {...dataProps}
126
- className={classnames(classes, inlineClass)}
136
+ className={classnames(classes, inlineClass)}
127
137
  >
128
138
  <Tag
129
- classNamePrefix="typeahead-kit-select"
130
- error={error}
131
- onChange={handleOnChange}
132
- {...selectProps}
139
+ classNamePrefix="typeahead-kit-select"
140
+ error={error}
141
+ onChange={handleOnChange}
142
+ {...selectProps}
133
143
  />
134
144
  </div>
135
145
  )
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React, { useEffect } from 'react'
4
2
  import { components } from 'react-select'
5
3
 
@@ -11,8 +9,8 @@ const ClearContainer = (props: any) => {
11
9
 
12
10
  return (
13
11
  <components.ClearIndicator
14
- className="clear_indicator"
15
- {...props}
12
+ className="clear_indicator"
13
+ {...props}
16
14
  />
17
15
  )
18
16
  }
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import { components } from 'react-select'
5
3
 
@@ -13,14 +11,14 @@ type Props = {
13
11
  const TypeaheadControl = (props: Props) => (
14
12
  <div className="pb_typeahead_wrapper">
15
13
  <TextInput
16
- dark={props.selectProps.dark}
17
- error={props.selectProps.error}
18
- label={props.selectProps.label}
14
+ dark={props.selectProps.dark}
15
+ error={props.selectProps.error}
16
+ label={props.selectProps.label}
19
17
  >
20
18
  <Flex>
21
19
  <components.Control
22
- className="text_input"
23
- {...props}
20
+ className="text_input"
21
+ {...props}
24
22
  />
25
23
  </Flex>
26
24
  </TextInput>
@@ -1,12 +1,10 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import { components } from 'react-select'
5
3
 
6
4
  const IndicatorsContainer = (props: any) => (
7
5
  <components.IndicatorsContainer
8
- className="text_input_indicators"
9
- {...props}
6
+ className="text_input_indicators"
7
+ {...props}
10
8
  />
11
9
  )
12
10
 
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import { components } from 'react-select'
5
3
 
@@ -0,0 +1,66 @@
1
+ import React from 'react'
2
+ import { components } from 'react-select'
3
+
4
+ import Badge from '../../pb_badge/_badge'
5
+ import FormPill from '../../pb_form_pill/_form_pill'
6
+ import { SelectValueType } from '../_typeahead'
7
+
8
+ type Props = {
9
+ data: SelectValueType,
10
+ multiValueTemplate: any,
11
+ removeProps: any,
12
+ selectProps: any,
13
+ }
14
+
15
+ const MultiValue = (props: Props) => {
16
+ const { removeProps } = props
17
+ const { imageUrl, label } = props.data
18
+ const { multiKit } = props.selectProps
19
+
20
+ const formPillProps = {
21
+ marginRight: 'xs',
22
+ name: label,
23
+ avatarUrl: '',
24
+ }
25
+
26
+ if (typeof imageUrl === 'string') formPillProps.avatarUrl = imageUrl
27
+
28
+ return (
29
+ <components.MultiValueContainer
30
+ className="text_input_multivalue_container"
31
+ {...props}
32
+ >
33
+ {multiKit === 'badge' &&
34
+ <Badge
35
+ closeProps={removeProps}
36
+ removeIcon
37
+ text={label}
38
+ variant="primary"
39
+ />
40
+ }
41
+
42
+ {multiKit !== 'badge' && imageUrl &&
43
+ <FormPill
44
+ avatarUrl={imageUrl}
45
+ closeProps={removeProps}
46
+ marginRight="xs"
47
+ name={label}
48
+ size={multiKit === 'smallPill' ? 'small' : ''}
49
+ text=''
50
+ />
51
+ }
52
+
53
+ {multiKit !== 'badge' && !imageUrl &&
54
+ <FormPill
55
+ closeProps={removeProps}
56
+ marginRight="xs"
57
+ name=''
58
+ size={multiKit === 'smallPill' ? 'small' : ''}
59
+ text={label}
60
+ />
61
+ }
62
+ </components.MultiValueContainer>
63
+ )
64
+ }
65
+
66
+ export default MultiValue
@@ -0,0 +1,37 @@
1
+ import React from 'react'
2
+ import { components } from 'react-select'
3
+
4
+ import User from '../../pb_user/_user'
5
+
6
+ const Option = (props: any) => {
7
+ const {
8
+ imageUrl,
9
+ } = props.data
10
+ const { valueComponent } = props.selectProps
11
+
12
+ return (
13
+ <components.Option {...props}>
14
+ <>
15
+ {!valueComponent && imageUrl &&
16
+ <User
17
+ align="left"
18
+ avatarUrl={imageUrl}
19
+ dark={props.selectProps.dark}
20
+ name={props.label}
21
+ orientation="horizontal"
22
+ />
23
+ }
24
+
25
+ {valueComponent &&
26
+ valueComponent(props.data)
27
+ }
28
+
29
+ {!valueComponent && !imageUrl &&
30
+ props.label
31
+ }
32
+ </>
33
+ </components.Option>
34
+ )
35
+ }
36
+
37
+ export default Option
@@ -1,5 +1,3 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import { components } from 'react-select'
5
3
 
@@ -9,18 +7,18 @@ import Icon from '../../pb_icon/_icon'
9
7
  const Placeholder = (props: any) => (
10
8
  <>
11
9
  <Flex
12
- align="center"
13
- className="placeholder"
10
+ align="center"
11
+ className="placeholder"
14
12
  >
15
13
  <components.IndicatorsContainer
16
- {...props}
14
+ {...props}
17
15
  />
18
- <If condition={props.selectProps.plusIcon}>
16
+ {props.selectProps.plusIcon &&
19
17
  <Icon
20
- className="typeahead-plus-icon"
21
- icon="plus"
18
+ className="typeahead-plus-icon"
19
+ icon="plus"
22
20
  />
23
- </If>
21
+ }
24
22
  </Flex>
25
23
  </>
26
24
  )
@@ -1,12 +1,10 @@
1
- /* @flow */
2
-
3
1
  import React from 'react'
4
2
  import { components } from 'react-select'
5
3
 
6
- const ValueContainer = (props: Props) => (
4
+ const ValueContainer = (props: any) => (
7
5
  <components.ValueContainer
8
- className="text_input_value_container"
9
- {...props}
6
+ className="text_input_value_container"
7
+ {...props}
10
8
  />
11
9
  )
12
10
 
@@ -2,18 +2,26 @@ import PbEnhancedElement from '../pb_enhanced_element'
2
2
  import { debounce } from 'lodash'
3
3
 
4
4
  export default class PbTypeahead extends PbEnhancedElement {
5
+ _searchInput: HTMLInputElement
6
+ _resultsElement: HTMLElement
7
+ _debouncedSearch: Function
8
+ _resultsLoadingIndicator: HTMLElement
9
+ _resultOptionTemplate: HTMLElement
10
+ _resultsOptionCache: Map<string, Array<DocumentFragment>>
11
+ _searchContext: string
12
+
5
13
  static get selector() {
6
14
  return '[data-pb-typeahead-kit]'
7
15
  }
8
16
 
9
17
  connect() {
10
- this.element.addEventListener('keydown', (event) => this.handleKeydown(event))
18
+ this.element.addEventListener('keydown', (event: KeyboardEvent) => this.handleKeydown(event))
11
19
  this.searchInput.addEventListener('focus', () => this.debouncedSearch())
12
20
  this.searchInput.addEventListener('input', () => this.debouncedSearch())
13
- this.resultsElement.addEventListener('click', (event) => this.optionSelected(event))
21
+ this.resultsElement.addEventListener('click', (event: MouseEvent) => this.optionSelected(event))
14
22
  }
15
23
 
16
- handleKeydown(event) {
24
+ handleKeydown(event: KeyboardEvent) {
17
25
  if (event.key === 'ArrowUp') {
18
26
  event.preventDefault()
19
27
  this.focusPreviousOption()
@@ -24,7 +32,7 @@ export default class PbTypeahead extends PbEnhancedElement {
24
32
  }
25
33
 
26
34
  search() {
27
- if (this.searchTerm.length < this.searchTermMinimumLength) return this.clearResults()
35
+ if (this.searchTerm.length < parseInt(this.searchTermMinimumLength)) return this.clearResults()
28
36
 
29
37
  this.toggleResultsLoadingIndicator(true)
30
38
  this.showResults()
@@ -34,17 +42,17 @@ export default class PbTypeahead extends PbEnhancedElement {
34
42
  const search = {
35
43
  searchingFor: searchTerm,
36
44
  searchingContext: searchContext,
37
- setResults: (results) => {
45
+ setResults: (results: Array<DocumentFragment>) => {
38
46
  this.resultsCacheUpdate(searchTerm, searchContext, results)
39
47
  },
40
48
  }
41
49
  this.element.dispatchEvent(new CustomEvent('pb-typeahead-kit-search', { bubbles: true, detail: search }))
42
50
  }
43
51
 
44
- resultsCacheUpdate(searchTerm, searchContext, results) {
52
+ resultsCacheUpdate(searchTerm: string, searchContext: string, results: Array<DocumentFragment>) {
45
53
  const searchTermAndContext = this.cacheKeyFor(searchTerm, searchContext)
46
54
  if (this.resultsOptionCache.has(searchTermAndContext)) this.resultsOptionCache.delete(searchTermAndContext)
47
- if (this.resultsOptionCache.size > 32) this.resultsOptionCache.delete(this.resultsOptionCache.keys[0])
55
+ if (this.resultsOptionCache.size > 32) this.resultsOptionCache.delete(this.resultsOptionCache.keys().next().value)
48
56
 
49
57
  this.resultsOptionCache.set(searchTermAndContext, results)
50
58
  this.showResults()
@@ -57,7 +65,7 @@ export default class PbTypeahead extends PbEnhancedElement {
57
65
  get debouncedSearch() {
58
66
  return this._debouncedSearch = (
59
67
  this._debouncedSearch ||
60
- debounce(this.search, this.searchDebounceTimeout).bind(this)
68
+ debounce(this.search, parseInt(this.searchDebounceTimeout)).bind(this)
61
69
  )
62
70
  }
63
71
 
@@ -70,12 +78,12 @@ export default class PbTypeahead extends PbEnhancedElement {
70
78
  this.resultsElement.appendChild(this.newResultOption(result.cloneNode(true)))
71
79
  }
72
80
  for (const result of this.resultsElement.querySelectorAll('[data-result-option-item]')) {
73
- result.addEventListener('mousedown', (event) => this.optionSelected(event))
81
+ result.addEventListener('mousedown', (event: MouseEvent) => this.optionSelected(event))
74
82
  }
75
83
  }
76
84
 
77
- optionSelected(event) {
78
- const resultOption = event.target.closest('[data-result-option-item]')
85
+ optionSelected(event: MouseEvent) {
86
+ const resultOption = (event.target as Element).closest('[data-result-option-item]')
79
87
  if (!resultOption) return
80
88
 
81
89
  this.resultsCacheClear()
@@ -89,8 +97,8 @@ export default class PbTypeahead extends PbEnhancedElement {
89
97
  this.resultsElement.innerHTML = ''
90
98
  }
91
99
 
92
- newResultOption(content) {
93
- const resultOption = this.resultOptionTemplate.content.cloneNode(true)
100
+ newResultOption(content: DocumentFragment) {
101
+ const resultOption = (this.resultOptionTemplate as HTMLTemplateElement).content.cloneNode(true) as Element
94
102
  resultOption.querySelector('slot[name="content"]').replaceWith(content)
95
103
  return resultOption
96
104
  }
@@ -100,9 +108,9 @@ export default class PbTypeahead extends PbEnhancedElement {
100
108
  const previousIndex = currentIndex - 1
101
109
  const previousOptionItem = (
102
110
  this.resultOptionItems[previousIndex] ||
103
- this.resultOptionItems[this.resultOptionItems.length - 1]
104
- )
105
- previousOptionItem.focus()
111
+ this.resultOptionItems[this.resultOptionItems.length - 1]
112
+ );
113
+ (previousOptionItem as HTMLElement).focus()
106
114
  }
107
115
 
108
116
  focusNextOption() {
@@ -110,9 +118,9 @@ export default class PbTypeahead extends PbEnhancedElement {
110
118
  const nextIndex = currentIndex + 1
111
119
  const nextOptionItem = (
112
120
  this.resultOptionItems[nextIndex] ||
113
- this.resultOptionItems[0]
114
- )
115
- nextOptionItem.focus()
121
+ this.resultOptionItems[0]
122
+ );
123
+ (nextOptionItem as HTMLElement).focus()
116
124
  }
117
125
 
118
126
  get resultOptionItems() {
@@ -134,11 +142,11 @@ export default class PbTypeahead extends PbEnhancedElement {
134
142
  get searchContext() {
135
143
  if (this._searchContext) return this._searchContext
136
144
 
137
- const selector = this.element.dataset.searchContextValueSelector
138
- if (selector) return (
145
+ const selector = (this.element as HTMLElement).dataset.searchContextValueSelector
146
+ if (selector) return ((
139
147
  this.element.parentNode.querySelector(selector) ||
140
- this.element.closest(selector)
141
- ).value
148
+ this.element.closest(selector)
149
+ ) as HTMLInputElement).value
142
150
 
143
151
  return null
144
152
  }
@@ -151,7 +159,7 @@ export default class PbTypeahead extends PbEnhancedElement {
151
159
  return this.cacheKeyFor(this.searchTerm, this.searchContext)
152
160
  }
153
161
 
154
- cacheKeyFor(searchTerm, searchContext) {
162
+ cacheKeyFor(searchTerm: string, searchContext: string) {
155
163
  return [searchTerm, JSON.stringify(searchContext)].join()
156
164
  }
157
165
 
@@ -160,11 +168,11 @@ export default class PbTypeahead extends PbEnhancedElement {
160
168
  }
161
169
 
162
170
  get searchTermMinimumLength() {
163
- return this.element.dataset.pbTypeaheadKitSearchTermMinimumLength
171
+ return (this.element as HTMLElement).dataset.pbTypeaheadKitSearchTermMinimumLength
164
172
  }
165
173
 
166
174
  get searchDebounceTimeout() {
167
- return this.element.dataset.pbTypeaheadKitSearchDebounceTimeout
175
+ return (this.element as HTMLElement).dataset.pbTypeaheadKitSearchDebounceTimeout
168
176
  }
169
177
 
170
178
  get resultsElement() {
@@ -192,9 +200,9 @@ export default class PbTypeahead extends PbEnhancedElement {
192
200
  )
193
201
  }
194
202
 
195
- toggleResultsLoadingIndicator(visible) {
196
- var visibilityProperty = 0
197
- if (visible) visibilityProperty = 1
203
+ toggleResultsLoadingIndicator(visible: boolean) {
204
+ var visibilityProperty = '0'
205
+ if (visible) visibilityProperty = '1'
198
206
  this.resultsLoadingIndicator.style.opacity = visibilityProperty
199
207
  }
200
208
  }
@@ -0,0 +1,2 @@
1
+ declare module 'react-select'
2
+ declare module 'react-select/*'
@@ -18,7 +18,7 @@ type UserProps = {
18
18
  data?: {[key: string]: string},
19
19
  id?: string,
20
20
  name?: string,
21
- orientation?: "horiztonal" | "vertical",
21
+ orientation?: "horizontal" | "vertical",
22
22
  size?: "sm" | "md" | "lg",
23
23
  subtitle?: string | Array<Node> | Node,
24
24
  territory?: string,
@@ -68,7 +68,7 @@ $background_colors: (
68
68
 
69
69
  /* Card colors ------------------*/
70
70
  $card_light: $white !default;
71
- $card_dark: mix(white, $bg_dark, 10%) !default;
71
+ $card_dark: rgba($white, $opacity_1) !default;
72
72
  $card_colors: (
73
73
  card_light: $card_light,
74
74
  card_dark: $card_dark
@@ -109,18 +109,16 @@ $focus_input_colors: (
109
109
 
110
110
  /* Border colors ----------------------*/
111
111
  $border_light: #E4E8F0 !default;
112
- $border_dark: mix(white, $bg_dark, 20%) !default;
112
+ $border_dark: rgba($white, $opacity_1) !default;
113
113
  $border_colors: (
114
114
  border_light: $border_light,
115
115
  border_dark: $border_dark
116
116
  );
117
117
 
118
118
  /* Shadow colors ----------------------*/
119
- $shadow: rgba(#3C6AAC, $opacity_2) !default;
120
- $shadow_dark: $bg_dark !default;
119
+ $shadow: rgba(#3C6AAC, $opacity_2) !default;
121
120
  $shadow_colors: (
122
121
  shadow: $shadow,
123
- shadow_dark: $shadow_dark,
124
122
  );
125
123
 
126
124
  /* Text colors ------------------------*/
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "12.18.0"
5
- VERSION = "12.18.0.pre.alpha.PLAY747carddarktokens610"
5
+ VERSION = "12.18.0.pre.alpha.PLAY785typeaheadts607"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.18.0.pre.alpha.PLAY747carddarktokens610
4
+ version: 12.18.0.pre.alpha.PLAY785typeaheadts607
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -2248,17 +2248,17 @@ files:
2248
2248
  - app/pb_kits/playbook/pb_treemap_chart/docs/index.js
2249
2249
  - app/pb_kits/playbook/pb_treemap_chart/treemap_chart.html.erb
2250
2250
  - app/pb_kits/playbook/pb_treemap_chart/treemap_chart.rb
2251
- - app/pb_kits/playbook/pb_typeahead/_typeahead.jsx
2252
2251
  - app/pb_kits/playbook/pb_typeahead/_typeahead.scss
2253
2252
  - app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx
2254
- - app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.jsx
2255
- - app/pb_kits/playbook/pb_typeahead/components/Control.jsx
2256
- - app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.jsx
2257
- - app/pb_kits/playbook/pb_typeahead/components/MenuList.jsx
2258
- - app/pb_kits/playbook/pb_typeahead/components/MultiValue.jsx
2259
- - app/pb_kits/playbook/pb_typeahead/components/Option.jsx
2260
- - app/pb_kits/playbook/pb_typeahead/components/Placeholder.jsx
2261
- - app/pb_kits/playbook/pb_typeahead/components/ValueContainer.jsx
2253
+ - app/pb_kits/playbook/pb_typeahead/_typeahead.tsx
2254
+ - app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx
2255
+ - app/pb_kits/playbook/pb_typeahead/components/Control.tsx
2256
+ - app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx
2257
+ - app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx
2258
+ - app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx
2259
+ - app/pb_kits/playbook/pb_typeahead/components/Option.tsx
2260
+ - app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx
2261
+ - app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx
2262
2262
  - app/pb_kits/playbook/pb_typeahead/docs/_description.md
2263
2263
  - app/pb_kits/playbook/pb_typeahead/docs/_footer.md
2264
2264
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_async_createable.jsx
@@ -2289,9 +2289,10 @@ files:
2289
2289
  - app/pb_kits/playbook/pb_typeahead/docs/_typeahead_without_pills.md
2290
2290
  - app/pb_kits/playbook/pb_typeahead/docs/example.yml
2291
2291
  - app/pb_kits/playbook/pb_typeahead/docs/index.js
2292
- - app/pb_kits/playbook/pb_typeahead/index.js
2292
+ - app/pb_kits/playbook/pb_typeahead/index.ts
2293
2293
  - app/pb_kits/playbook/pb_typeahead/typeahead.html.erb
2294
2294
  - app/pb_kits/playbook/pb_typeahead/typeahead.rb
2295
+ - app/pb_kits/playbook/pb_typeahead/types.d.ts
2295
2296
  - app/pb_kits/playbook/pb_user/_user.scss
2296
2297
  - app/pb_kits/playbook/pb_user/_user.tsx
2297
2298
  - app/pb_kits/playbook/pb_user/docs/_description.md
@@ -1,62 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import { components } from 'react-select'
5
-
6
- import Badge from '../../pb_badge/_badge'
7
- import FormPill from '../../pb_form_pill/_form_pill'
8
-
9
- type Props = {
10
- data: object,
11
- multiValueTemplate: any,
12
- removeProps: any,
13
- selectProps: any,
14
- }
15
-
16
- const MultiValue = (props: Props) => {
17
- const { removeProps } = props
18
- const { imageUrl, label } = props.data
19
- const { multiKit } = props.selectProps
20
-
21
- const formPillProps = {
22
- marginRight: 'xs',
23
- name: label,
24
- }
25
-
26
- if (typeof imageUrl === 'string') formPillProps.avatarUrl = imageUrl
27
-
28
- return (
29
- <components.MultiValueContainer
30
- className="text_input_multivalue_container"
31
- {...props}
32
- >
33
- <If condition={multiKit === 'badge'}>
34
- <Badge
35
- closeProps={removeProps}
36
- removeIcon
37
- text={label}
38
- variant="primary"
39
- />
40
- <Else />
41
- <If condition={imageUrl}>
42
- <FormPill
43
- avatarUrl={imageUrl}
44
- closeProps={removeProps}
45
- marginRight="xs"
46
- name={label}
47
- size={multiKit === 'smallPill' ? 'small' : ''}
48
- />
49
- <Else />
50
- <FormPill
51
- closeProps={removeProps}
52
- marginRight="xs"
53
- size={multiKit === 'smallPill' ? 'small' : ''}
54
- text={label}
55
- />
56
- </If>
57
- </If>
58
- </components.MultiValueContainer>
59
- )
60
- }
61
-
62
- export default MultiValue
@@ -1,39 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import { components } from 'react-select'
5
-
6
- import User from '../../pb_user/_user'
7
-
8
- const Option = (props: any) => {
9
- const {
10
- imageUrl,
11
- } = props.data
12
- const { valueComponent } = props.selectProps
13
-
14
- return (
15
- <components.Option {...props}>
16
- <div>
17
- <Choose>
18
- <When condition={!valueComponent && imageUrl}>
19
- <User
20
- align="left"
21
- avatarUrl={imageUrl}
22
- dark={props.selectProps.dark}
23
- name={props.label}
24
- orientation="horizontal"
25
- />
26
- </When>
27
- <When condition={valueComponent}>
28
- { valueComponent(props.data) }
29
- </When>
30
- <Otherwise>
31
- {props.label}
32
- </Otherwise>
33
- </Choose>
34
- </div>
35
- </components.Option>
36
- )
37
- }
38
-
39
- export default Option