playbook_ui 14.4.0.pre.rc.14 → 14.4.0.pre.rc.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +245 -23
  3. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +1 -1
  4. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.html.erb +117 -0
  5. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.jsx +227 -0
  6. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_colors.md +1 -0
  7. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
  8. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
  9. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +1 -1
  10. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +5 -1
  11. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.html.erb +72 -0
  12. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color.jsx +91 -0
  13. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_rails.md +1 -0
  14. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_color_react.md +1 -0
  15. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +2 -0
  16. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +4 -0
  18. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +16 -0
  19. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -0
  20. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -18
  21. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.html.erb +31 -0
  22. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color.jsx +26 -0
  23. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_rails.md +1 -0
  24. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_color_react.md +1 -0
  25. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  26. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  27. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +4 -0
  28. data/app/pb_kits/playbook/tokens/_colors.scss +2 -0
  29. data/dist/chunks/{_typeahead-BAFhtQtP.js → _typeahead-B2zRxReA.js} +2 -2
  30. data/dist/chunks/{_weekday_stacked-V_fGN_e4.js → _weekday_stacked-CvAnMnnS.js} +1 -1
  31. data/dist/chunks/{lib--ErPKv63.js → lib-D2U4I1U6.js} +1 -1
  32. data/dist/chunks/{pb_form_validation-CHMFwDfe.js → pb_form_validation-zV9OpdSt.js} +1 -1
  33. data/dist/chunks/vendor.js +1 -1
  34. data/dist/playbook-doc.js +1 -1
  35. data/dist/playbook-rails-react-bindings.js +1 -1
  36. data/dist/playbook-rails.js +1 -1
  37. data/dist/playbook.css +1 -1
  38. data/lib/playbook/version.rb +1 -1
  39. metadata +16 -5
@@ -6,6 +6,7 @@ examples:
6
6
  - form_pill_tag: Form Pill Tag
7
7
  - form_pill_example: Example
8
8
  - form_pill_icon: Form Pill Icon
9
+ - form_pill_colors: Form Pill Colors
9
10
 
10
11
  react:
11
12
  - form_pill_user: Form Pill User
@@ -13,3 +14,4 @@ examples:
13
14
  - form_pill_tag: Form Pill Tag
14
15
  - form_pill_example: Example
15
16
  - form_pill_icon: Form Pill Icon
17
+ - form_pill_colors: Form Pill Colors
@@ -3,3 +3,4 @@ export { default as FormPillSize } from './_form_pill_size.jsx'
3
3
  export { default as FormPillTag } from './_form_pill_tag.jsx'
4
4
  export { default as FormPillExample } from './_form_pill_example.jsx'
5
5
  export { default as FormPillIcon } from './_form_pill_icon.jsx'
6
+ export { default as FormPillColors } from './_form_pill_colors.jsx'
@@ -12,7 +12,7 @@ module Playbook
12
12
  values: %w[none lowercase],
13
13
  default: "none"
14
14
  prop :color, type: Playbook::Props::Enum,
15
- values: %w[primary neutral],
15
+ 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],
16
16
  default: "primary"
17
17
  prop :tabindex
18
18
  prop :icon
@@ -34,6 +34,7 @@ type MultiLevelSelectProps = {
34
34
  onSelect?: (prop: { [key: string]: any }) => void
35
35
  selectedIds?: string[]
36
36
  variant?: "multi" | "single"
37
+ 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",
37
38
  } & GlobalProps
38
39
 
39
40
  const MultiLevelSelect = (props: MultiLevelSelectProps) => {
@@ -50,7 +51,8 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
50
51
  treeData,
51
52
  onSelect = () => null,
52
53
  selectedIds,
53
- variant = "multi"
54
+ variant = "multi",
55
+ pillColor = "primary"
54
56
  } = props
55
57
 
56
58
  const ariaProps = buildAriaProps(aria)
@@ -467,6 +469,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
467
469
  inputDisplay === "pills"
468
470
  ? returnedArray.map((item, index) => (
469
471
  <FormPill
472
+ color={pillColor}
470
473
  key={index}
471
474
  onClick={(event: any) => handlePillClose(event, item)}
472
475
  text={item.label}
@@ -479,6 +482,7 @@ const MultiLevelSelect = (props: MultiLevelSelectProps) => {
479
482
  inputDisplay === "pills"
480
483
  ? defaultReturn.map((item, index) => (
481
484
  <FormPill
485
+ color={pillColor}
482
486
  key={index}
483
487
  onClick={(event: any) => handlePillClose(event, item)}
484
488
  text={item.label}
@@ -0,0 +1,72 @@
1
+ <% treeData = [{
2
+ label: "Power Home Remodeling",
3
+ value: "Power Home Remodeling",
4
+ id: "100",
5
+ expanded: true,
6
+ children: [
7
+ {
8
+ label: "People",
9
+ value: "People",
10
+ id: "101",
11
+ expanded: true,
12
+ children: [
13
+ {
14
+ label: "Talent Acquisition",
15
+ value: "Talent Acquisition",
16
+ id: "102",
17
+ },
18
+ {
19
+ label: "Business Affairs",
20
+ value: "Business Affairs",
21
+ id: "103",
22
+ children: [
23
+ {
24
+ label: "Initiatives",
25
+ value: "Initiatives",
26
+ id: "104",
27
+ },
28
+ {
29
+ label: "Learning & Development",
30
+ value: "Learning & Development",
31
+ id: "105",
32
+ },
33
+ ],
34
+ },
35
+ {
36
+ label: "People Experience",
37
+ value: "People Experience",
38
+ id: "106",
39
+ },
40
+ ],
41
+ },
42
+ {
43
+ label: "Contact Center",
44
+ value: "Contact Center",
45
+ id: "107",
46
+ children: [
47
+ {
48
+ label: "Appointment Management",
49
+ value: "Appointment Management",
50
+ id: "108",
51
+ },
52
+ {
53
+ label: "Customer Service",
54
+ value: "Customer Service",
55
+ id: "109",
56
+ },
57
+ {
58
+ label: "Energy",
59
+ value: "Energy",
60
+ id: "110",
61
+ },
62
+ ],
63
+ },
64
+ ],
65
+ }] %>
66
+
67
+ <%= pb_rails("multi_level_select", props: {
68
+ id: "multi-level-select-default-rails",
69
+ name: "my_array",
70
+ tree_data: treeData,
71
+ pill_color: "neutral"
72
+ }) %>
@@ -0,0 +1,91 @@
1
+ import React from "react";
2
+ import MultiLevelSelect from "../_multi_level_select";
3
+
4
+ const treeData = [
5
+ {
6
+ label: "Power Home Remodeling",
7
+ value: "Power Home Remodeling",
8
+ id: "powerhome1",
9
+ expanded: true,
10
+ children: [
11
+ {
12
+ label: "People",
13
+ value: "People",
14
+ id: "people1",
15
+ expanded: true,
16
+ children: [
17
+ {
18
+ label: "Talent Acquisition",
19
+ value: "Talent Acquisition",
20
+ id: "talent1",
21
+ },
22
+ {
23
+ label: "Business Affairs",
24
+ value: "Business Affairs",
25
+ id: "business1",
26
+ children: [
27
+ {
28
+ label: "Initiatives",
29
+ value: "Initiatives",
30
+ id: "initiative1",
31
+ },
32
+ {
33
+ label: "Learning & Development",
34
+ value: "Learning & Development",
35
+ id: "development1",
36
+ },
37
+ ],
38
+ },
39
+ {
40
+ label: "People Experience",
41
+ value: "People Experience",
42
+ id: "experience1",
43
+ },
44
+ ],
45
+ },
46
+ {
47
+ label: "Contact Center",
48
+ value: "Contact Center",
49
+ id: "contact1",
50
+ children: [
51
+ {
52
+ label: "Appointment Management",
53
+ value: "Appointment Management",
54
+ id: "appointment1",
55
+ },
56
+ {
57
+ label: "Customer Service",
58
+ value: "Customer Service",
59
+ id: "customer1",
60
+ },
61
+ {
62
+ label: "Energy",
63
+ value: "Energy",
64
+ id: "energy1",
65
+ },
66
+ ],
67
+ },
68
+ ],
69
+ },
70
+ ];
71
+
72
+ const MultiLevelSelectColor = (props) => {
73
+ return (
74
+ <div>
75
+ <MultiLevelSelect
76
+ id='multiselect-color'
77
+ onSelect={(selectedNodes) =>
78
+ console.log(
79
+ "Selected Items",
80
+ selectedNodes
81
+ )
82
+ }
83
+ pillColor="neutral"
84
+ treeData={treeData}
85
+ {...props}
86
+ />
87
+ </div>
88
+ )
89
+ };
90
+
91
+ export default MultiLevelSelectColor;
@@ -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.
@@ -6,6 +6,7 @@ examples:
6
6
  - multi_level_select_return_all_selected: Return All Selected
7
7
  - multi_level_select_selected_ids: Selected Ids
8
8
  - multi_level_select_with_form: With Form
9
+ - multi_level_select_color: With Pills (Custom Color)
9
10
 
10
11
  react:
11
12
  - multi_level_select_default: Default
@@ -13,3 +14,4 @@ examples:
13
14
  - multi_level_select_single_children_only: Single Select w/ Hidden Radios
14
15
  - multi_level_select_return_all_selected: Return All Selected
15
16
  - multi_level_select_selected_ids_react: Selected Ids
17
+ - multi_level_select_color: With Pills (Custom Color)
@@ -3,3 +3,4 @@ export { default as MultiLevelSelectSingle } from './_multi_level_select_single.
3
3
  export { default as MultiLevelSelectSingleChildrenOnly } from './_multi_level_select_single_children_only.jsx'
4
4
  export { default as MultiLevelSelectReturnAllSelected } from './_multi_level_select_return_all_selected.jsx'
5
5
  export { default as MultiLevelSelectSelectedIdsReact } from "./_multi_level_select_selected_ids_react.jsx"
6
+ export { default as MultiLevelSelectColor } from './_multi_level_select_color.jsx'
@@ -19,6 +19,9 @@ module Playbook
19
19
  prop :variant, type: Playbook::Props::Enum,
20
20
  values: %w[multi single],
21
21
  default: "multi"
22
+ prop :pill_color, type: Playbook::Props::Enum,
23
+ 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],
24
+ default: "primary"
22
25
 
23
26
  def classname
24
27
  generate_classname("pb_multi_level_select")
@@ -34,6 +37,7 @@ module Playbook
34
37
  selectedIds: selected_ids,
35
38
  input_name: input_name,
36
39
  variant: variant,
40
+ pillColor: pill_color,
37
41
  }
38
42
  end
39
43
  end
@@ -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,