playbook_ui 14.3.1 → 14.3.2.pre.alpha.PBNTR417addcolorsupdatedefaultcolor3791

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_collapsible/_helper_functions.ts +4 -0
  3. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +245 -23
  4. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
  5. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.html.erb +117 -0
  6. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.jsx +227 -0
  7. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.md +1 -0
  8. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
  9. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
  10. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -1
  11. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
  12. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +5 -1
  13. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +72 -0
  14. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +91 -0
  15. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_rails.md +1 -0
  16. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_react.md +1 -0
  17. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -0
  18. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
  19. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +4 -0
  20. data/app/pb_kits/playbook/pb_radio/_radio.tsx +50 -100
  21. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.html.erb +48 -0
  22. data/app/pb_kits/playbook/pb_radio/docs/_radio_custom_children.md +1 -0
  23. data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -1
  24. data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
  25. data/app/pb_kits/playbook/pb_radio/index.js +17 -0
  26. data/app/pb_kits/playbook/pb_radio/radio.html.erb +35 -13
  27. data/app/pb_kits/playbook/pb_radio/radio.rb +3 -1
  28. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +0 -1
  29. data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +0 -1
  30. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +16 -0
  31. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -0
  32. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -18
  33. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.html.erb +31 -0
  34. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.jsx +26 -0
  35. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_rails.md +1 -0
  36. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_react.md +1 -0
  37. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  38. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  39. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +4 -0
  40. data/app/pb_kits/playbook/tokens/_colors.scss +2 -0
  41. data/dist/chunks/_typeahead-B2zRxReA.js +22 -0
  42. data/dist/chunks/{_weekday_stacked-DAoF6PiA.js → _weekday_stacked-CvAnMnnS.js} +2 -2
  43. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  44. data/dist/chunks/lib-D2U4I1U6.js +16 -0
  45. data/dist/chunks/{pb_form_validation-u2wnZ3oe.js → pb_form_validation-zV9OpdSt.js} +1 -1
  46. data/dist/chunks/vendor.js +1 -1
  47. data/dist/playbook-doc.js +1 -1
  48. data/dist/playbook-rails-react-bindings.js +1 -1
  49. data/dist/playbook-rails.js +1 -1
  50. data/dist/playbook.css +1 -1
  51. data/lib/playbook/version.rb +2 -2
  52. metadata +24 -11
  53. data/app/pb_kits/playbook/pb_radio/docs/_radio_children.jsx +0 -56
  54. data/dist/chunks/_typeahead-BWUFVlae.js +0 -22
  55. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
  56. data/dist/chunks/lib-D9uVVKnh.js +0 -16
@@ -1,27 +1,28 @@
1
- import React, { forwardRef, isValidElement, useRef } from 'react'
1
+ /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
2
+
3
+ import React, { forwardRef } from 'react'
2
4
  import Body from '../pb_body/_body'
3
- import Flex from '../pb_flex/_flex'
4
5
  import classnames from 'classnames'
5
6
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
6
7
  import { globalProps, GlobalProps } from '../utilities/globalProps'
7
8
 
8
9
  type RadioProps = {
9
- aria?: { [key: string]: string },
10
+ aria?: {[key: string]: string},
10
11
  alignment?: string,
11
12
  checked?: boolean,
12
13
  children?: React.ReactChild[] | React.ReactChild,
13
14
  className?: string,
14
15
  dark?: boolean,
15
- data?: { [key: string]: string },
16
+ data?: {[key: string]: string},
16
17
  disabled?: boolean,
17
18
  error?: boolean,
18
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
19
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
20
  id?: string,
20
21
  label: string,
21
22
  name?: string,
22
23
  value?: string,
23
24
  text?: string,
24
- onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
25
+ onChange: (event: React.FormEvent<HTMLInputElement> | null)=>void,
25
26
  } & GlobalProps
26
27
 
27
28
  const Radio = ({
@@ -30,9 +31,9 @@ const Radio = ({
30
31
  children,
31
32
  className,
32
33
  dark = false,
34
+ data = {},
33
35
  disabled = false,
34
36
  error = false,
35
- data = {},
36
37
  htmlOptions = {},
37
38
  id,
38
39
  label,
@@ -41,103 +42,52 @@ const Radio = ({
41
42
  value = 'radio_text',
42
43
  onChange = () => { void 0 },
43
44
  ...props
44
- }: RadioProps ) => {
45
- const radioRef = useRef(null);
46
-
47
- const ariaProps = buildAriaProps(aria);
48
- const dataProps = buildDataProps(data);
49
- const htmlProps = buildHtmlProps(htmlOptions);
45
+ }: RadioProps, ref: any) => {
46
+ const ariaProps = buildAriaProps(aria)
47
+ const dataProps = buildDataProps(data)
48
+ const htmlProps = buildHtmlProps(htmlOptions)
50
49
  const classes = classnames(
51
- buildCss('pb_radio_kit', alignment),
52
- dark ? 'dark' : null,
53
- error ? 'error' : null,
50
+ buildCss('pb_radio_kit', alignment ),
51
+ dark ? 'dark': null, error ? 'error': null,
54
52
  globalProps(props),
55
- className
56
- );
57
-
58
- const classesCustom = classnames(
59
- dark ? 'dark' : null,
60
- error ? 'error' : null,
61
- globalProps(props),
62
- className
63
- );
64
-
65
- const isCustomChild = children && isValidElement(children) && children.type !== 'input';
53
+ className)
66
54
 
67
55
  const displayRadio = (props: RadioProps & any) => {
68
- if (isValidElement(children) && children.type === 'input') {
69
- return children;
70
- } else if (isCustomChild || !children) {
71
- return (
72
- <input
73
- disabled={disabled}
74
- id={id}
75
- name={name}
76
- onChange={onChange}
77
- ref={radioRef}
78
- text={text}
79
- type="radio"
80
- value={value}
81
- {...props}
82
- />
83
- );
84
- }
85
- };
86
-
87
- const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
88
- if (event) {
89
- const target = event.target as HTMLElement;
90
- if (
91
- target.id === 'pb-radio-children-wrapper' ||
92
- target.closest('#pb-radio-children-wrapper')
93
- ) {
94
- radioRef.current?.click();
95
- }
96
- }
97
- };
56
+ if (children)
57
+ return (children)
58
+ else
59
+ return (
60
+ <input
61
+ disabled={disabled}
62
+ id={id}
63
+ name={name}
64
+ onChange={onChange}
65
+ ref={ref}
66
+ text={text}
67
+ type="radio"
68
+ value={value}
69
+ {...props}
70
+ />
71
+ )}
98
72
 
99
73
  return (
100
- isCustomChild ? (
101
- <Flex
102
- {...ariaProps}
103
- {...dataProps}
104
- {...htmlProps}
105
- align='center'
106
- className={classesCustom}
107
- cursor='pointer'
108
- htmlFor={id}
109
- htmlOptions={{
110
- onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
111
- handleContainerClick(event);
112
- }) as unknown as () => void
113
- }}
114
- id="radio-container"
115
- >
116
- <label className={buildCss('pb_radio_kit', alignment)}>
117
- <>{displayRadio(props)}</>
118
- <span className="pb_radio_button" />
119
- </label>
120
- <div id="pb-radio-children-wrapper"> {children} </div>
121
- </Flex>
122
- ) : (
123
- <label
124
- {...ariaProps}
125
- {...dataProps}
126
- {...htmlProps}
127
- className={classes}
128
- htmlFor={id}
129
- >
130
- <>{displayRadio(props)}</>
131
- <span className="pb_radio_button" />
132
- <Body
133
- dark={dark}
134
- status={error ? 'negative' : null}
135
- text={label}
136
- variant={null}
137
- />
138
- </label>
139
- )
140
- );
141
- };
74
+ <label
75
+ {...ariaProps}
76
+ {...dataProps}
77
+ {...htmlProps}
78
+ className={classes}
79
+ htmlFor={id}
80
+ >
81
+ <>{displayRadio(props)}</>
82
+ <span className="pb_radio_button" />
83
+ <Body
84
+ dark={dark}
85
+ status={error ? 'negative' : null}
86
+ text={label}
87
+ variant={null}
88
+ />
89
+ </label>
90
+ )
91
+ }
142
92
 
143
- export default forwardRef(Radio);
93
+ export default forwardRef(Radio)
@@ -0,0 +1,48 @@
1
+ <%
2
+ options = [
3
+ { label: "Orange", value: "Orange" },
4
+ { label: "Red", value: "Red" },
5
+ { label: "Green", value: "Green" },
6
+ { label: "Blue", value: "Blue" },
7
+ ]
8
+ %>
9
+
10
+ <%= pb_rails("radio", props: {
11
+ custom_children: true,
12
+ label: "Select",
13
+ name: "Group1",
14
+ value: "Select",
15
+ }) do %>
16
+ <%= pb_rails("select", props: {
17
+ min_width: "xs",
18
+ options: options,
19
+ }) %>
20
+ <% end %>
21
+
22
+ <%= pb_rails("radio", props: {
23
+ custom_children: true,
24
+ label: "Typeahead",
25
+ name: "Group1",
26
+ value: "Typeahead",
27
+ }) do %>
28
+ <%= pb_rails("typeahead", props: {
29
+ id: "typeahead-radio",
30
+ is_multi: false,
31
+ min_width: "xs",
32
+ options: options,
33
+ placeholder: "Select...",
34
+ })
35
+ %>
36
+ <% end %>
37
+
38
+ <%= pb_rails("radio", props: {
39
+ custom_children: true,
40
+ label: "Typography",
41
+ name: "Group1",
42
+ value: "Typography",
43
+ }) do %>
44
+ <%= pb_rails("title", props: {
45
+ text: "Custom Typography",
46
+ })
47
+ %>
48
+ <% end %>
@@ -0,0 +1 @@
1
+ Use the `custom_children` prop to enable the use of kits instead of text labels.
@@ -7,6 +7,7 @@ examples:
7
7
  - radio_options: With Options
8
8
  - radio_alignment: Alignment
9
9
  - radio_disabled: Disabled
10
+ - radio_custom_children: Custom Children
10
11
 
11
12
  react:
12
13
  - radio_default: Default
@@ -14,7 +15,6 @@ examples:
14
15
  - radio_error: With Error
15
16
  - radio_alignment: Alignment
16
17
  - radio_disabled: Disabled
17
- - radio_children: Children
18
18
 
19
19
  swift:
20
20
  - radio_default_swift: Default
@@ -3,4 +3,3 @@ export { default as RadioCustom } from './_radio_custom.jsx'
3
3
  export { default as RadioError } from './_radio_error.jsx'
4
4
  export { default as RadioAlignment } from './_radio_alignment.jsx'
5
5
  export { default as RadioDisabled } from './_radio_disabled.jsx'
6
- export { default as RadioChildren } from './_radio_children.jsx'
@@ -0,0 +1,17 @@
1
+ import PbEnhancedElement from "../pb_enhanced_element"
2
+
3
+ const RADIO_SELECTOR = "[data-pb-radio-children]"
4
+ const RADIO_WRAPPER_SELECTOR = "[data-pb-radio-children-wrapper]"
5
+
6
+ export default class PbRadio extends PbEnhancedElement {
7
+ static get selector() {
8
+ return RADIO_SELECTOR
9
+ }
10
+
11
+ connect() {
12
+ const radioWrapperElement = this.element.parentElement.querySelector(RADIO_WRAPPER_SELECTOR)
13
+ radioWrapperElement.addEventListener("click", () => {
14
+ this.element.querySelector("input[type='radio']").click()
15
+ })
16
+ }
17
+ }
@@ -1,18 +1,40 @@
1
- <%= content_tag(:label,
1
+ <% if object.custom_children %>
2
+ <%= pb_rails("flex", props: {
2
3
  aria: object.aria,
3
- checked: object.checked,
4
+ align: "center",
4
5
  class: object.classname,
6
+ cursor: "pointer",
5
7
  data: object.data,
6
- id: object.id,
7
- value: object.value,
8
- **combined_html_options) do %>
9
-
10
- <% if content.present? %>
11
- <%= content %>
12
- <% else %>
13
- <%= radio_button_tag object.name, object.value, object.selected, object.input_options %>
8
+ **combined_html_options
9
+ }) do %>
10
+ <%= content_tag(:label,
11
+ 'data-pb-radio-children': 'true',
12
+ checked: object.checked,
13
+ class: object.classname,
14
+ id: object.id,
15
+ value: object.value) do %>
16
+ <%= input %>
17
+ <span class="pb_radio_button"></span>
14
18
  <% end %>
19
+ <div data-pb-radio-children-wrapper="true"> <%= content %> </div>
20
+ <% end %>
21
+ <% else %>
22
+ <%= content_tag(:label,
23
+ aria: object.aria,
24
+ checked: object.checked,
25
+ class: object.classname,
26
+ data: object.data,
27
+ id: object.id,
28
+ value: object.value,
29
+ **combined_html_options) do %>
30
+
31
+ <% if content.present? %>
32
+ <%= content %>
33
+ <% else %>
34
+ <%= radio_button_tag object.name, object.value, object.selected, object.input_options %>
35
+ <% end %>
15
36
 
16
- <span class="pb_radio_button"></span>
17
- <%= pb_rails("body", props: { status: object.body_status, text: object.text, dark: object.dark }) %>
18
- <% end %>
37
+ <span class="pb_radio_button"></span>
38
+ <%= pb_rails("body", props: { status: object.body_status, text: object.text, dark: object.dark }) %>
39
+ <% end %>
40
+ <% end %>
@@ -20,6 +20,8 @@ module Playbook
20
20
  default: "Radio Text"
21
21
  prop :value, type: Playbook::Props::String,
22
22
  default: "radio_text"
23
+ prop :custom_children, type: Playbook::Props::Boolean,
24
+ default: false
23
25
 
24
26
  def classname
25
27
  generate_classname("pb_radio_kit") + error_class + alignment_class
@@ -34,7 +36,7 @@ module Playbook
34
36
  end
35
37
 
36
38
  def input
37
- radio_button_tag(name, value, checked, input_options.merge(disabled: disabled))
39
+ radio_button_tag(name, value, checked, input_options.merge(disabled: disabled || input_options[:disabled]))
38
40
  end
39
41
 
40
42
  private
@@ -92,7 +92,6 @@ const Textarea = ({
92
92
  <Caption text={label} />
93
93
  {children || (
94
94
  <textarea
95
- className="pb_textarea_kit"
96
95
  disabled={disabled}
97
96
  name={name}
98
97
  onChange={onChange}
@@ -15,7 +15,6 @@
15
15
  <%= text_area(
16
16
  :object,
17
17
  :method,
18
- :class => "#{object.classname}",
19
18
  :max_characters => object.max_characters,
20
19
  :name => object.name,
21
20
  :onkeyup => object.onkeyup,
@@ -107,4 +107,20 @@ 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 with colored pills', () => {
113
+ render(
114
+ <Typeahead
115
+ data={{ testid: 'pills-color-test' }}
116
+ defaultValue={[options[0]]}
117
+ isMulti
118
+ options={options}
119
+ pillColor="neutral"
120
+ />
121
+ )
122
+
123
+ const kit = screen.getByTestId('pills-color-test')
124
+ const pill = kit.querySelector(".pb_form_pill_kit_neutral")
125
+ expect(pill).toBeInTheDocument()
110
126
  })
@@ -45,12 +45,14 @@ type TypeaheadProps = {
45
45
  getOptionLabel?: string | (() => any),
46
46
  getOptionValue?: string | (() => any),
47
47
  name?: string,
48
+ pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
48
49
  } & GlobalProps
49
50
 
50
51
  export type SelectValueType = {
51
52
  label: string,
52
53
  value: string,
53
54
  imageUrl?: string,
55
+ pillColor?: string,
54
56
  }
55
57
 
56
58
  type TagOnChangeValues = {
@@ -76,6 +78,7 @@ const Typeahead = ({
76
78
  htmlOptions = {},
77
79
  id,
78
80
  loadOptions = noop,
81
+ pillColor,
79
82
  ...props
80
83
  }: TypeaheadProps) => {
81
84
  const selectProps = {
@@ -105,6 +108,7 @@ const Typeahead = ({
105
108
  onCreateOption: null as null,
106
109
  plusIcon: false,
107
110
  onMultiValueClick: (_option: SelectValueType): any => undefined,
111
+ pillColor: pillColor,
108
112
  ...props,
109
113
  }
110
114
 
@@ -8,6 +8,7 @@ import { SelectValueType } from '../_typeahead'
8
8
  type Props = {
9
9
  data: SelectValueType,
10
10
  multiValueTemplate: any,
11
+ pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
11
12
  removeProps: any,
12
13
  selectProps: any,
13
14
  }
@@ -15,48 +16,55 @@ type Props = {
15
16
  const MultiValue = (props: Props) => {
16
17
  const { removeProps } = props
17
18
  const { imageUrl, label } = props.data
18
- const { multiKit } = props.selectProps
19
+ const { dark, multiKit, pillColor } = props.selectProps
19
20
 
20
21
  const formPillProps = {
21
22
  marginRight: 'xs',
22
23
  name: label,
23
24
  avatarUrl: '',
25
+ dark,
24
26
  }
25
27
 
26
28
  if (typeof imageUrl === 'string') formPillProps.avatarUrl = imageUrl
27
29
 
28
30
  return (
29
31
  <components.MultiValueContainer
30
- className="text_input_multivalue_container"
31
- {...props}
32
+ className="text_input_multivalue_container"
33
+ {...props}
32
34
  >
33
35
  {multiKit === 'badge' &&
34
36
  <Badge
35
- closeProps={removeProps}
36
- removeIcon
37
- text={label}
38
- variant="primary"
37
+ closeProps={removeProps}
38
+ removeIcon
39
+ text={label}
40
+ variant="primary"
39
41
  />
40
42
  }
41
43
 
42
44
  {multiKit !== 'badge' && imageUrl &&
43
45
  <FormPill
44
- avatarUrl={imageUrl}
45
- closeProps={removeProps}
46
- marginRight="xs"
47
- name={label}
48
- size={multiKit === 'smallPill' ? 'small' : ''}
49
- text=''
46
+ avatarUrl={imageUrl}
47
+ closeProps={removeProps}
48
+ color={pillColor}
49
+ dark={dark}
50
+ marginRight="xs"
51
+ name={label}
52
+ size={multiKit === 'smallPill' ? 'small' : ''}
53
+ text=''
54
+ {...props}
50
55
  />
51
56
  }
52
57
 
53
58
  {multiKit !== 'badge' && !imageUrl &&
54
59
  <FormPill
55
- closeProps={removeProps}
56
- marginRight="xs"
57
- name=''
58
- size={multiKit === 'smallPill' ? 'small' : ''}
59
- text={label}
60
+ closeProps={removeProps}
61
+ color={pillColor}
62
+ dark={dark}
63
+ marginRight="xs"
64
+ name=''
65
+ size={multiKit === 'smallPill' ? 'small' : ''}
66
+ text={label}
67
+ {...props}
60
68
  />
61
69
  }
62
70
  </components.MultiValueContainer>
@@ -0,0 +1,31 @@
1
+ <%
2
+ options = [
3
+ { label: 'Windows', value: '#FFA500' },
4
+ { label: 'Siding', value: '#FF0000' },
5
+ { label: 'Doors', value: '#00FF00' },
6
+ { label: 'Roofs', value: '#0000FF' },
7
+ ]
8
+ %>
9
+
10
+ <%= pb_rails("typeahead", props: { id: "typeahead-pills-example1", pill_color: "neutral", default_options: [options.first], options: options, label: "Colors", name: :foo, pills: true }) %>
11
+
12
+ <%= pb_rails("button", props: {id: "clear-pills", text: "Clear All Options", variant: "secondary"}) %>
13
+
14
+ <!-- This section is an example of the available JavaScript event hooks -->
15
+ <%= javascript_tag defer: "defer" do %>
16
+ document.addEventListener("pb-typeahead-kit-typeahead-pills-example1-result-option-select", function(event) {
17
+ console.log('Option selected')
18
+ console.dir(event.detail)
19
+ })
20
+ document.addEventListener("pb-typeahead-kit-typeahead-pills-example1-result-option-remove", function(event) {
21
+ console.log('Option removed')
22
+ console.dir(event.detail)
23
+ })
24
+ document.addEventListener("pb-typeahead-kit-typeahead-pills-example1-result-clear", function() {
25
+ console.log('All options cleared')
26
+ })
27
+
28
+ document.querySelector('#clear-pills').addEventListener('click', function() {
29
+ document.dispatchEvent(new CustomEvent('pb-typeahead-kit-typeahead-pills-example1:clear'))
30
+ })
31
+ <% end %>
@@ -0,0 +1,26 @@
1
+ import React from 'react'
2
+ import { Typeahead } from 'playbook-ui'
3
+
4
+ const options = [
5
+ { label: 'Windows', value: '#FFA500' },
6
+ { label: 'Siding', value: '#FF0000' },
7
+ { label: 'Doors', value: '#00FF00' },
8
+ { label: 'Roofs', value: '#0000FF' },
9
+ ]
10
+
11
+ const TypeaheadWithPills = (props) => {
12
+ return (
13
+ <>
14
+ <Typeahead
15
+ isMulti
16
+ label="Colors"
17
+ options={options}
18
+ pillColor="neutral"
19
+ placeholder=""
20
+ {...props}
21
+ />
22
+ </>
23
+ )
24
+ }
25
+
26
+ export default TypeaheadWithPills
@@ -0,0 +1 @@
1
+ Change the form pill color by passing the optional `pill_color` prop. Product, Data, and Status colors are available options. Check them out <a href="https://playbook.powerapp.cloud/kits/form_pill#form-pill-colors" target="_blank">here</a> in the Form Pill colors example.
@@ -0,0 +1 @@
1
+ Change the form pill color by passing the optional `pillColor` prop. Product, Data, and Status colors are available options. Check them out <a href="https://playbook.powerapp.cloud/kits/form_pill/react#form-pill-colors" target="_blank">here</a> in the Form Pill colors example.
@@ -9,6 +9,7 @@ examples:
9
9
  - typeahead_inline: Inline
10
10
  - typeahead_multi_kit: Multi Kit Options
11
11
  - typeahead_error_state: Error State
12
+ - typeahead_with_pills_color: With Pills (Custom Color)
12
13
 
13
14
  react:
14
15
  - typeahead_default: Default
@@ -23,3 +24,4 @@ examples:
23
24
  - typeahead_async_createable: Createable (+ Async Data)
24
25
  - typeahead_error_state: Error State
25
26
  - typeahead_custom_menu_list: Custom MenuList
27
+ - typeahead_with_pills_color: With Pills (Custom Color)
@@ -10,3 +10,4 @@ export { default as TypeaheadCreateable } from './_typeahead_createable.jsx'
10
10
  export { default as TypeaheadAsyncCreateable } from './_typeahead_async_createable.jsx'
11
11
  export { default as TypeaheadErrorState } from './_typeahead_error_state.jsx'
12
12
  export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_list.jsx'
13
+ export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
@@ -34,6 +34,9 @@ module Playbook
34
34
  prop :search_term_minimum_length, default: 3
35
35
  prop :search_debounce_timeout, default: 250
36
36
  prop :value
37
+ prop :pill_color, type: Playbook::Props::Enum,
38
+ values: %w[primary neutral success warning error info data_1 data_2 data_3 data_4 data_5 data_6 data_7 data_8 windows siding roofing doors gutters solar insulation accessories],
39
+ default: "primary"
37
40
 
38
41
  def classname
39
42
  generate_classname("pb_typeahead_kit")
@@ -58,6 +61,7 @@ module Playbook
58
61
  def typeahead_react_options
59
62
  base_options = {
60
63
  className: classname,
64
+ pillColor: pill_color,
61
65
  dark: dark,
62
66
  defaultValue: default_options,
63
67
  error: error,
@@ -259,6 +259,7 @@ $solar: $product_4_background !default; // deprecated
259
259
  $roofing: $product_5_background !default; // deprecated
260
260
  $gutters: $product_6_background !default; // deprecated
261
261
  $insulation: $product_7_background !default; // deprecated
262
+ $accessories: $product_8_background !default; // added specifically for form_pill product map
262
263
  $product_colors: (
263
264
  windows: $windows,
264
265
  siding: $siding,
@@ -267,6 +268,7 @@ $product_colors: (
267
268
  roofing: $roofing,
268
269
  gutters: $gutters,
269
270
  insulation: $insulation,
271
+ accessories: $accessories,
270
272
  product_1_background: $product_1_background,
271
273
  product_1_highlight: $product_1_highlight,
272
274
  product_2_background: $product_2_background,