playbook_ui 13.24.0 → 13.25.0.pre.alpha.PLAY761globalpaddingpropsbuttons2713

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +2 -0
  3. data/app/pb_kits/playbook/index.js +1 -0
  4. data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +1 -6
  5. data/app/pb_kits/playbook/pb_background/_background.tsx +7 -5
  6. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +41 -6
  7. data/app/pb_kits/playbook/pb_bar_graph/bar_graph.rb +4 -0
  8. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.html.erb +23 -0
  9. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_negative_numbers.jsx +35 -0
  10. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.html.erb +26 -0
  11. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.jsx +36 -0
  12. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_secondary_y_axis.md +3 -0
  13. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.html.erb +22 -0
  14. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.jsx +34 -0
  15. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_stacked.md +1 -0
  16. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +6 -0
  17. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +3 -0
  18. data/app/pb_kits/playbook/pb_body/_body.scss +3 -3
  19. data/app/pb_kits/playbook/pb_button/_button.scss +1 -1
  20. data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -1
  21. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +98 -0
  22. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +186 -0
  23. data/app/pb_kits/playbook/pb_dropdown/context/index.tsx +5 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.jsx +50 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +102 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +66 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +77 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +9 -0
  29. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +4 -0
  30. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +17 -0
  31. data/app/pb_kits/playbook/pb_dropdown/hooks/useDropdown.tsx +17 -0
  32. data/app/pb_kits/playbook/pb_dropdown/hooks/useHandleOnKeydown.tsx +56 -0
  33. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +95 -0
  34. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +91 -0
  35. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +128 -0
  36. data/app/pb_kits/playbook/pb_dropdown/utilities/subComponentHelper.tsx +59 -0
  37. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +1 -1
  38. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +1 -1
  39. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +1 -1
  40. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.test.js +3 -3
  41. data/app/pb_kits/playbook/pb_list/_list_item.tsx +2 -2
  42. data/app/pb_kits/playbook/pb_source/source.test.js +2 -2
  43. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +27 -19
  44. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +4 -2
  45. data/app/pb_kits/playbook/pb_typeahead/components/index.tsx +19 -0
  46. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +51 -0
  47. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +1 -1
  48. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +1 -0
  49. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  50. data/app/pb_kits/playbook/playbook-doc.js +2 -0
  51. data/app/pb_kits/playbook/tokens/_colors.scss +1 -1
  52. data/dist/menu.yml +5 -1
  53. data/dist/playbook-rails.js +6 -6
  54. data/lib/playbook/kit_base.rb +21 -1
  55. data/lib/playbook/version.rb +2 -2
  56. metadata +32 -6
  57. /data/app/pb_kits/playbook/pb_dialog/docs/{_dialog_props_table.md → _dialog_props_swift.md} +0 -0
@@ -0,0 +1,91 @@
1
+ import React, { useContext } from "react";
2
+ import classnames from "classnames";
3
+ import {
4
+ buildAriaProps,
5
+ buildCss,
6
+ buildDataProps,
7
+ } from "../../utilities/props";
8
+ import { globalProps } from "../../utilities/globalProps";
9
+
10
+ import DropdownContext from "../context";
11
+
12
+ import Flex from "../../pb_flex/_flex";
13
+ import Body from "../../pb_body/_body";
14
+ import ListItem from "../../pb_list/_list_item";
15
+ import { GenericObject } from "../../types";
16
+
17
+ type DropdownOptionProps = {
18
+ aria?: { [key: string]: string };
19
+ className?: string;
20
+ children?: React.ReactChild[] | React.ReactChild;
21
+ data?: { [key: string]: string };
22
+ id?: string;
23
+ option?: GenericObject;
24
+ key?: string;
25
+ };
26
+
27
+ const DropdownOption = (props: DropdownOptionProps) => {
28
+ const { aria = {}, className, children, data = {}, id, option, key } = props;
29
+
30
+ const { handleOptionClick, selected, filterItem, filteredOptions, focusedOptionIndex } =
31
+ useContext(DropdownContext);
32
+
33
+ const isItemMatchingFilter = (option: GenericObject) =>
34
+ option?.label.toLowerCase().includes(filterItem.toLowerCase());
35
+
36
+ if (!isItemMatchingFilter(option)) {
37
+ return null;
38
+ }
39
+ const isFocused = focusedOptionIndex >= 0 && filteredOptions[focusedOptionIndex].label === option.label
40
+ const focusedClass = isFocused && "dropdown_option_focused"
41
+
42
+ const selectedClass = `${
43
+ selected.label === option.label
44
+ ? "dropdown_option_selected"
45
+ : "dropdown_option_list"
46
+ }`
47
+ const ariaProps = buildAriaProps(aria);
48
+ const dataProps = buildDataProps(data);
49
+ const classes = classnames(
50
+ buildCss("pb_dropdown_option"),
51
+ selectedClass,
52
+ focusedClass,
53
+ globalProps(props),
54
+ className
55
+ );
56
+
57
+ return (
58
+ <div {...ariaProps}
59
+ {...dataProps}
60
+ className={classes}
61
+ id={id}
62
+ key={key}
63
+ >
64
+ <ListItem
65
+ cursor="pointer"
66
+ data-name={option.value}
67
+ htmlOptions={{ onClick: () => handleOptionClick(option) }}
68
+ key={option.label}
69
+ padding="xs"
70
+ >
71
+ <Flex
72
+ align="center"
73
+ className="dropdown_option"
74
+ justify="between"
75
+ paddingX="sm"
76
+ paddingY="xxs"
77
+ >
78
+ {
79
+ children ? (
80
+ children
81
+ ) : (
82
+ <Body text={option.label}/>
83
+ )
84
+ }
85
+ </Flex>
86
+ </ListItem>
87
+ </div>
88
+ );
89
+ };
90
+
91
+ export default DropdownOption;
@@ -0,0 +1,128 @@
1
+ import React, { useContext } from "react";
2
+ import classnames from "classnames";
3
+ import {
4
+ buildAriaProps,
5
+ buildCss,
6
+ buildDataProps,
7
+ } from "../../utilities/props";
8
+ import { globalProps } from "../../utilities/globalProps";
9
+ import { useHandleOnKeyDown } from "../hooks/useHandleOnKeydown";
10
+
11
+ import DropdownContext from "../context";
12
+
13
+ import Body from "../../pb_body/_body";
14
+ import Icon from "../../pb_icon/_icon";
15
+ import Flex from "../../pb_flex/_flex";
16
+ import FlexItem from "../../pb_flex/_flex_item";
17
+
18
+ type DropdownTriggerProps = {
19
+ aria?: { [key: string]: string };
20
+ children?: React.ReactChild[] | React.ReactChild;
21
+ className?: string;
22
+ customDisplay?: React.ReactChild[] | React.ReactChild;
23
+ data?: { [key: string]: string };
24
+ id?: string;
25
+ };
26
+
27
+ const DropdownTrigger = (props: DropdownTriggerProps) => {
28
+ const { aria = {}, className, children, customDisplay, data = {}, id } = props;
29
+
30
+ const {
31
+ autocomplete,
32
+ handleWrapperClick,
33
+ selected,
34
+ filterItem,
35
+ handleChange,
36
+ toggleDropdown,
37
+ isDropDownClosed,
38
+ inputRef,
39
+ isInputFocused,
40
+ setIsInputFocused
41
+ } = useContext(DropdownContext);
42
+
43
+ const handleKeyDown = useHandleOnKeyDown();
44
+
45
+ const ariaProps = buildAriaProps(aria);
46
+ const dataProps = buildDataProps(data);
47
+ const classes = classnames(
48
+ buildCss("pb_dropdown_trigger"),
49
+ globalProps(props),
50
+ className
51
+ );
52
+
53
+ return (
54
+ <div {...ariaProps}
55
+ {...dataProps}
56
+ className={classes}
57
+ id={id}
58
+ >
59
+ {children ? (
60
+ <div
61
+ onClick={() => toggleDropdown()}
62
+ style={{ display: "inline-block" }}
63
+ >
64
+ {children}
65
+ </div>
66
+ ) : (
67
+ <>
68
+ <Flex align="center"
69
+ borderRadius="lg"
70
+ className={`dropdown_trigger_wrapper ${isInputFocused && 'dropdown_trigger_wrapper_focus'}`}
71
+ cursor="pointer"
72
+ htmlOptions={{
73
+ onClick: () => handleWrapperClick(),
74
+ onKeyDown: handleKeyDown,
75
+ tabIndex:"0",
76
+ }}
77
+ justify="between"
78
+ paddingX="sm"
79
+ paddingY="xs"
80
+ >
81
+ <FlexItem>
82
+ <Flex align="center">
83
+ {customDisplay ? (
84
+ <Flex align="center">
85
+ {customDisplay}
86
+ <Body paddingLeft={`${selected.label ? "xs" : "none"}`}>
87
+ {selected.label ? <b>{selected.label}</b> : autocomplete ? "" : "Select..." }
88
+ </Body>
89
+ </Flex>
90
+ ) : (
91
+ <Body text={selected.label ? selected.label : autocomplete ? "" : "Select..."} />
92
+ )
93
+ }
94
+ {
95
+ autocomplete && (
96
+ <input
97
+ className="dropdown_input"
98
+ onChange={handleChange}
99
+ onClick={() => toggleDropdown()}
100
+ onFocus={() => setIsInputFocused(true)}
101
+ onKeyDown={handleKeyDown}
102
+ placeholder={selected.label ? "" : "Select..."}
103
+ ref={inputRef}
104
+ value={filterItem}
105
+ />
106
+ )
107
+ }
108
+
109
+ </Flex>
110
+ </FlexItem>
111
+ <FlexItem>
112
+ <Body display="flex"
113
+ key={`${isDropDownClosed ? "chevron-down" : 'chevron-up'}`}
114
+ >
115
+ <Icon cursor="pointer"
116
+ icon={`${isDropDownClosed ? "chevron-down" : 'chevron-up'}`}
117
+ size="sm"
118
+ />
119
+ </Body>
120
+ </FlexItem>
121
+ </Flex>
122
+ </>
123
+ )}
124
+ </div>
125
+ );
126
+ };
127
+
128
+ export default DropdownTrigger;
@@ -0,0 +1,59 @@
1
+ import React, { ReactElement } from "react";
2
+ import DropdownTrigger from "../subcomponents/DropdownTrigger";
3
+ import DropdownContainer from "../subcomponents/DropdownContainer";
4
+
5
+ type PrepareComponentsProps = {
6
+ children: React.ReactChild[] | React.ReactChild;
7
+ hasTriggerSubcomponent: boolean;
8
+ hasContainerSubcomponent: boolean;
9
+ trigger: React.ReactChild;
10
+ container: React.ReactChild;
11
+ otherChildren: React.ReactChild[];
12
+ };
13
+
14
+ export const separateChildComponents = (children: React.ReactChild[] | React.ReactChild | ReactElement[]) => {
15
+ let trigger: React.ReactChild = null;
16
+ let container: React.ReactChild = null;
17
+ const otherChildren: React.ReactChild[] = [];
18
+
19
+ React.Children.forEach(children, (child) => {
20
+ if (child && (child as ReactElement).type === DropdownTrigger) {
21
+ trigger = child;
22
+ } else if (child && (child as ReactElement).type === DropdownContainer) {
23
+ container = child;
24
+ } else {
25
+ otherChildren.push(child);
26
+ }
27
+ });
28
+
29
+ return { trigger, container, otherChildren };
30
+ };
31
+
32
+ export const prepareSubcomponents = ({
33
+ children,
34
+ hasTriggerSubcomponent,
35
+ hasContainerSubcomponent,
36
+ trigger,
37
+ container,
38
+ otherChildren,
39
+ }: PrepareComponentsProps) => {
40
+ const componentsToRender = [];
41
+
42
+ if (!hasTriggerSubcomponent && !hasContainerSubcomponent) {
43
+ componentsToRender.push(<DropdownTrigger />);
44
+ componentsToRender.push(<DropdownContainer>{children}</DropdownContainer>);
45
+ } else if (!hasTriggerSubcomponent && hasContainerSubcomponent) {
46
+ componentsToRender.push(<DropdownTrigger />);
47
+ componentsToRender.push(children);
48
+ } else if (hasTriggerSubcomponent && !hasContainerSubcomponent) {
49
+ componentsToRender.push(trigger);
50
+ componentsToRender.push(
51
+ <DropdownContainer>{otherChildren}</DropdownContainer>
52
+ );
53
+ } else {
54
+ componentsToRender.push(trigger);
55
+ componentsToRender.push(container);
56
+ }
57
+
58
+ return componentsToRender;
59
+ };
@@ -51,7 +51,7 @@ $pb_icon_circle_sizes: (
51
51
  }
52
52
 
53
53
  @each $name, $size in $pb_icon_circle_sizes {
54
- &[class*=_#{$name}] {
54
+ &[class*=_size_#{$name}] {
55
55
  width: $size;
56
56
  height: $size;
57
57
  border-radius: $size/2;
@@ -43,7 +43,7 @@ const IconCircle = (props: IconCircleProps) => {
43
43
  const ariaProps = buildAriaProps(aria)
44
44
  const dataProps = buildDataProps(data)
45
45
  const htmlProps = buildHtmlProps(htmlOptions)
46
- const classes = classnames(buildCss('pb_icon_circle_kit', size, variant), globalProps(props), className)
46
+ const classes = classnames(buildCss('pb_icon_circle_kit', `size_${size}`, variant), globalProps(props), className)
47
47
 
48
48
 
49
49
  return (
@@ -14,7 +14,7 @@ module Playbook
14
14
  default: "default"
15
15
 
16
16
  def classname
17
- generate_classname("pb_icon_circle_kit", size, variant)
17
+ generate_classname("pb_icon_circle_kit", "size_#{size}", variant)
18
18
  end
19
19
  end
20
20
  end
@@ -16,7 +16,7 @@ describe("IconCircle Kit", () => {
16
16
  )
17
17
 
18
18
  const kit = screen.getByTestId(testId)
19
- expect(kit).toHaveClass("pb_icon_circle_kit_md_default")
19
+ expect(kit).toHaveClass("pb_icon_circle_kit_size_md_default")
20
20
  })
21
21
 
22
22
  test("renders icon", () => {
@@ -66,7 +66,7 @@ describe("IconCircle Kit", () => {
66
66
  />
67
67
  )
68
68
  const kit = screen.getByTestId(testId)
69
- expect(kit).toHaveClass(`pb_icon_circle_kit_sm_${colorVariant}`)
69
+ expect(kit).toHaveClass(`pb_icon_circle_kit_size_sm_${colorVariant}`)
70
70
 
71
71
  cleanup()
72
72
  })
@@ -89,7 +89,7 @@ describe("IconCircle Kit", () => {
89
89
  />
90
90
  )
91
91
  const kit = screen.getByTestId(testId)
92
- expect(kit).toHaveClass(`pb_icon_circle_kit_${sizeVariant}_default`)
92
+ expect(kit).toHaveClass(`pb_icon_circle_kit_size_${sizeVariant}_default`)
93
93
 
94
94
  cleanup()
95
95
  })
@@ -1,7 +1,7 @@
1
1
  import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
- import { globalProps } from '../utilities/globalProps'
4
+ import { globalProps, GlobalProps } from '../utilities/globalProps'
5
5
 
6
6
  type ListItemProps = {
7
7
  aria?: { [key: string]: string },
@@ -11,7 +11,7 @@ type ListItemProps = {
11
11
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
12
12
  id?: string,
13
13
  tabIndex?: number,
14
- }
14
+ } & GlobalProps
15
15
 
16
16
  const ListItem = (props: ListItemProps) => {
17
17
  const {
@@ -52,13 +52,13 @@ test('should pass source prop', () => {
52
52
  test('should not hide icon by default', () => {
53
53
  render(<SourceDefault />)
54
54
  const kit = screen.getByTestId(testId)
55
- expect(kit.querySelector('.pb_icon_circle_kit_sm_default')).toBeTruthy()
55
+ expect(kit.querySelector('.pb_icon_circle_kit_size_sm_default')).toBeTruthy()
56
56
  })
57
57
 
58
58
  test('should hide icon', () => {
59
59
  render(<SourceDefault hideIcon />)
60
60
  const kit = screen.getByTestId(testId)
61
- expect(kit.querySelector('.pb_icon_circle_kit_sm_default')).toBeFalsy()
61
+ expect(kit.querySelector('.pb_icon_circle_kit_size_sm_default')).toBeFalsy()
62
62
  })
63
63
 
64
64
  test('should pass user prop', () => {
@@ -7,17 +7,21 @@ import { get, isString, uniqueId } from 'lodash'
7
7
  import { globalProps } from '../utilities/globalProps'
8
8
  import classnames from 'classnames'
9
9
 
10
- import Control from './components/Control'
11
- import ClearIndicator from './components/ClearIndicator'
12
- import IndicatorsContainer from './components/IndicatorsContainer'
13
- import MenuList from './components/MenuList'
14
- import MultiValue from './components/MultiValue'
15
- import Option from './components/Option'
16
- import Placeholder from './components/Placeholder'
17
- import ValueContainer from './components/ValueContainer'
10
+ import {
11
+ Control,
12
+ ClearIndicator,
13
+ IndicatorsContainer,
14
+ MenuList,
15
+ MultiValue,
16
+ Option,
17
+ Placeholder,
18
+ ValueContainer,
19
+ } from "./components"
20
+
21
+ import * as kitComponents from "./components"
18
22
 
19
23
  import { noop, buildDataProps, buildHtmlProps } from '../utilities/props'
20
- import { Noop } from '../types'
24
+ import { GenericObject, Noop } from '../types'
21
25
 
22
26
  /**
23
27
  * @typedef {object} Props
@@ -29,7 +33,7 @@ import { Noop } from '../types'
29
33
  type TypeaheadProps = {
30
34
  async?: boolean,
31
35
  className?: string,
32
- components?: object,
36
+ components?: GenericObject,
33
37
  createable?: boolean,
34
38
  dark?: boolean,
35
39
  data?: { [key: string]: string },
@@ -100,7 +104,7 @@ const Typeahead = ({
100
104
  multiKit: '',
101
105
  onCreateOption: null as null,
102
106
  plusIcon: false,
103
- onMultiValueClick: (_option: SelectValueType) => { },
107
+ onMultiValueClick: (_option: SelectValueType): any => undefined,
104
108
  ...props,
105
109
  }
106
110
 
@@ -137,19 +141,23 @@ const Typeahead = ({
137
141
  const inlineClass = selectProps.inline ? 'inline' : null
138
142
 
139
143
  return (
140
- <div
141
- {...dataProps}
142
- {...htmlProps}
143
- className={classnames(classes, inlineClass)}
144
+ <div
145
+ {...dataProps}
146
+ {...htmlProps}
147
+ className={classnames(classes, inlineClass)}
144
148
  >
145
149
  <Tag
146
- classNamePrefix="typeahead-kit-select"
147
- error={error}
148
- onChange={handleOnChange}
149
- {...selectProps}
150
+ classNamePrefix="typeahead-kit-select"
151
+ error={error}
152
+ onChange={handleOnChange}
153
+ {...selectProps}
150
154
  />
151
155
  </div>
152
156
  )
153
157
  }
154
158
 
159
+ Object.keys(kitComponents).forEach((k) => {
160
+ (Typeahead as GenericObject)[k] = (kitComponents as {[key: string]: unknown})[k]
161
+ })
162
+
155
163
  export default Typeahead
@@ -1,10 +1,12 @@
1
1
  import React from 'react'
2
2
  import { components } from 'react-select'
3
3
 
4
- const MenuList = (props: any) => (
4
+ const MenuList = (props: any) => {
5
+ return (
5
6
  <components.MenuList {...props}>
6
7
  {props.children}
8
+ {props.footer}
7
9
  </components.MenuList>
8
- )
10
+ )}
9
11
 
10
12
  export default MenuList
@@ -0,0 +1,19 @@
1
+ import Control from './Control'
2
+ import ClearIndicator from './ClearIndicator'
3
+ import IndicatorsContainer from './IndicatorsContainer'
4
+ import MenuList from './MenuList'
5
+ import MultiValue from './MultiValue'
6
+ import Option from './Option'
7
+ import Placeholder from './Placeholder'
8
+ import ValueContainer from './ValueContainer'
9
+
10
+ export {
11
+ Control,
12
+ ClearIndicator,
13
+ IndicatorsContainer,
14
+ MenuList,
15
+ MultiValue,
16
+ Option,
17
+ Placeholder,
18
+ ValueContainer,
19
+ }
@@ -0,0 +1,51 @@
1
+ import React, { useState } from 'react'
2
+
3
+ import {
4
+ Button,
5
+ } from '../..'
6
+
7
+ import Typeahead from '../_typeahead'
8
+
9
+ const options = [
10
+ { label: 'Orange', value: '#FFA500' },
11
+ { label: 'Red', value: '#FF0000' },
12
+ { label: 'Green', value: '#00FF00' },
13
+ { label: 'Blue', value: '#0000FF' },
14
+ { label: 'Amaranth', value: '#9F2B68' },
15
+ { label: 'Key Lime', value: '#DAF7A6' },
16
+ { label: 'Turquois', value: '#00FFD0' },
17
+ ]
18
+
19
+ const TypeaheadCustomMenuList = (props) => {
20
+ const defaultColorOptions = options.slice(0, 3)
21
+ const [colorOptions, setColorOptions] = useState(defaultColorOptions)
22
+
23
+ const moreToLoad = colorOptions.length == defaultColorOptions.length
24
+ const loadColors = moreToLoad ? () => setColorOptions(options) : () => setColorOptions(defaultColorOptions)
25
+
26
+ const menuListProps = {
27
+ footer: (<Button
28
+ margin="sm"
29
+ onClick={loadColors}
30
+ text={`Load ${moreToLoad ? "More" : "Less"}`}
31
+ />)
32
+ }
33
+
34
+ const MenuList = (props) => (
35
+ <Typeahead.MenuList
36
+ {...menuListProps}
37
+ {...props}
38
+ />
39
+ )
40
+
41
+ return (
42
+ <Typeahead
43
+ components={{ MenuList }}
44
+ label="Colors"
45
+ options={colorOptions}
46
+ {...props}
47
+ />
48
+ )
49
+ }
50
+
51
+ export default TypeaheadCustomMenuList
@@ -46,7 +46,7 @@ const TypeaheadWithHighlight = (props) => {
46
46
  if (!inputValue.length) return text
47
47
  return text.replace(
48
48
  new RegExp(inputValue, 'gi'),
49
- highlighted => `<mark>${highlighted}</mark>`
49
+ (highlighted) => `<mark>${highlighted}</mark>`
50
50
  )
51
51
  }
52
52
  return (
@@ -22,3 +22,4 @@ examples:
22
22
  - typeahead_createable: Createable
23
23
  - typeahead_async_createable: Createable (+ Async Data)
24
24
  - typeahead_error_state: Error State
25
+ - typeahead_custom_menu_list: Custom MenuList
@@ -9,3 +9,4 @@ export { default as TypeaheadMultiKit } from './_typeahead_multi_kit.jsx'
9
9
  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
+ export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_list.jsx'
@@ -34,6 +34,7 @@ import * as DateYearStacked from 'pb_date_year_stacked/docs'
34
34
  import * as Detail from 'pb_detail/docs'
35
35
  import * as Dialog from 'pb_dialog/docs'
36
36
  import * as DistributionBarDocs from 'pb_distribution_bar/docs'
37
+ import * as Dropdown from 'pb_dropdown/docs'
37
38
  import * as FileUpload from 'pb_file_upload/docs'
38
39
  import * as Filter from 'pb_filter/docs'
39
40
  import * as FixedConfirmationToast from 'pb_fixed_confirmation_toast/docs'
@@ -136,6 +137,7 @@ WebpackerReact.registerComponents({
136
137
  ...Detail,
137
138
  ...Dialog,
138
139
  ...DistributionBarDocs,
140
+ ...Dropdown,
139
141
  ...FileUpload,
140
142
  ...Filter,
141
143
  ...FixedConfirmationToast,
@@ -213,7 +213,7 @@ $status_color_text: (
213
213
  warning: darken($warning, 10%),
214
214
  error: $error,
215
215
  info: $info,
216
- neutral: darken($neutral, 15%),
216
+ neutral: $text_lt_light,
217
217
  primary: $primary
218
218
  );
219
219
 
data/dist/menu.yml CHANGED
@@ -254,6 +254,10 @@ kits:
254
254
  platforms: *web
255
255
  description: Playbook's date picker is built using flatpickr, a vanilla js library. Common date picker use cases and features have been adapted into simple prop based configuration detailed in the docs below.
256
256
  status: "stable"
257
+ - name: dropdown
258
+ platforms: *react_only
259
+ description: ""
260
+ status: "beta"
257
261
  - name: "multi_level_select"
258
262
  platforms: *web
259
263
  description: The MultiLevelSelect kit renders a multi leveled select dropdown based on data from the user.
@@ -460,4 +464,4 @@ kits:
460
464
  - name: "user"
461
465
  platforms: *web
462
466
  description: This kit was created for having a systematic way of displaying users with avatar, titles, name and territory. This is a versatile kit with features than can be added to display more info.
463
- status: "stable"
467
+ status: "stable"