playbook_ui 16.1.0.pre.alpha.play2712navkitadddisabledstatecollapsible13821 → 16.1.0.pre.alpha.play2724typeaheadindicator13970

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 (116) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +1 -1
  3. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +17 -0
  4. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +10 -1
  5. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +2 -0
  6. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.html.erb +6 -0
  7. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.jsx +17 -0
  8. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.md +3 -0
  9. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
  10. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  11. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +8 -6
  12. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +6 -0
  13. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +37 -2
  14. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +3 -0
  15. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +3 -0
  16. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +52 -0
  17. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +72 -0
  18. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +5 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +33 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +20 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +8 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +8 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +9 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +33 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +3 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +4 -1
  28. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +2 -2
  29. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +6 -0
  30. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +94 -0
  31. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +5 -1
  32. data/app/pb_kits/playbook/pb_dropdown/index.js +59 -4
  33. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +3 -0
  34. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +2 -1
  35. data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +1 -1
  36. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
  37. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +16 -9
  38. data/app/pb_kits/playbook/pb_filter/filter.rb +2 -2
  39. data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +5 -2
  40. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
  41. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
  42. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +4 -0
  43. data/app/pb_kits/playbook/pb_nav/_item.tsx +1 -5
  44. data/app/pb_kits/playbook/pb_nav/_nav.scss +1 -27
  45. data/app/pb_kits/playbook/pb_nav/docs/example.yml +0 -2
  46. data/app/pb_kits/playbook/pb_nav/docs/index.js +1 -2
  47. data/app/pb_kits/playbook/pb_nav/item.rb +2 -7
  48. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +20 -5
  49. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +1 -0
  50. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +7 -0
  51. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +24 -0
  52. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +3 -0
  53. data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +2 -0
  54. data/app/pb_kits/playbook/pb_passphrase/docs/index.js +1 -0
  55. data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +2 -0
  56. data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +30 -1
  57. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +3 -0
  58. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +5 -0
  59. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +14 -0
  60. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +3 -0
  61. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
  62. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  63. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
  64. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +34 -3
  65. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +4 -3
  66. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +0 -1
  67. data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +10 -10
  68. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +24 -1
  69. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +412 -324
  70. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +2 -0
  71. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +4 -1
  72. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.html.erb +16 -0
  73. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.jsx +23 -0
  74. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.md +3 -0
  75. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
  76. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
  77. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  78. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +22 -21
  79. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +3 -2
  80. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +7 -1
  81. data/dist/chunks/{_pb_line_graph-BgKF_zz1.js → _pb_line_graph-CFpRBk64.js} +1 -1
  82. data/dist/chunks/_typeahead-D2EbYcmG.js +1 -0
  83. data/dist/chunks/{globalProps-BhVYCqRf.js → globalProps-CXOg_9fx.js} +1 -1
  84. data/dist/chunks/lib-DTxpoePf.js +29 -0
  85. data/dist/chunks/vendor.js +2 -2
  86. data/dist/playbook-rails-react-bindings.js +1 -1
  87. data/dist/playbook-rails.js +1 -1
  88. data/dist/playbook.css +1 -1
  89. data/lib/playbook/align_content.rb +13 -3
  90. data/lib/playbook/align_items.rb +13 -3
  91. data/lib/playbook/align_self.rb +13 -3
  92. data/lib/playbook/display.rb +5 -0
  93. data/lib/playbook/flex.rb +13 -3
  94. data/lib/playbook/flex_direction.rb +13 -3
  95. data/lib/playbook/flex_grow.rb +13 -3
  96. data/lib/playbook/flex_shrink.rb +13 -3
  97. data/lib/playbook/flex_wrap.rb +13 -3
  98. data/lib/playbook/forms/builder/form_field_builder.rb +1 -1
  99. data/lib/playbook/forms/builder/phone_number_field.rb +9 -0
  100. data/lib/playbook/forms/builder/typeahead_field.rb +15 -1
  101. data/lib/playbook/forms/builder.rb +2 -2
  102. data/lib/playbook/justify_content.rb +13 -3
  103. data/lib/playbook/justify_self.rb +13 -3
  104. data/lib/playbook/order.rb +13 -3
  105. data/lib/playbook/spacing.rb +39 -9
  106. data/lib/playbook/text_align.rb +13 -3
  107. data/lib/playbook/truncate.rb +1 -1
  108. data/lib/playbook/version.rb +1 -1
  109. data/lib/playbook/vertical_align.rb +13 -3
  110. data/lib/playbook/z_index.rb +5 -0
  111. metadata +30 -9
  112. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.html.erb +0 -24
  113. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.jsx +0 -89
  114. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_rows.jsx +0 -67
  115. data/dist/chunks/_typeahead-BvrkfO0L.js +0 -1
  116. data/dist/chunks/lib-DD34ZrWL.js +0 -29
@@ -122,6 +122,80 @@ test('generated placeholder prop', () => {
122
122
 
123
123
  })
124
124
 
125
+ test('placeholder prop passed directly to Dropdown', () => {
126
+ render(
127
+ <Dropdown
128
+ data={{ testid: testId }}
129
+ options={options}
130
+ placeholder="Choose a country"
131
+ />
132
+ )
133
+
134
+ const kit = screen.getByTestId(testId)
135
+ const trigger = kit.querySelector('.pb_dropdown_trigger')
136
+ expect(trigger).toHaveTextContent('Choose a country')
137
+ })
138
+
139
+ test('placeholder works with default variant', () => {
140
+ render(
141
+ <Dropdown
142
+ data={{ testid: testId }}
143
+ options={options}
144
+ placeholder="Select an option"
145
+ variant="default"
146
+ />
147
+ )
148
+
149
+ const kit = screen.getByTestId(testId)
150
+ const trigger = kit.querySelector('.pb_dropdown_trigger')
151
+ expect(trigger).toHaveTextContent('Select an option')
152
+ })
153
+
154
+ test('placeholder works with subtle variant', () => {
155
+ render(
156
+ <Dropdown
157
+ data={{ testid: testId }}
158
+ options={options}
159
+ placeholder="Pick an option"
160
+ separators={false}
161
+ variant="subtle"
162
+ />
163
+ )
164
+
165
+ const kit = screen.getByTestId(testId)
166
+ expect(kit).toHaveClass('pb_dropdown_subtle_separators_hidden')
167
+ const trigger = kit.querySelector('.pb_dropdown_trigger')
168
+ expect(trigger).toHaveTextContent('Pick an option')
169
+ })
170
+
171
+ test('placeholder works with quickpick variant', () => {
172
+ render(
173
+ <Dropdown
174
+ data={{ testid: testId }}
175
+ placeholder="Select a date range"
176
+ variant="quickpick"
177
+ />
178
+ )
179
+
180
+ const kit = screen.getByTestId(testId)
181
+ expect(kit).toHaveClass('pb_dropdown_quickpick')
182
+ const trigger = kit.querySelector('.pb_dropdown_trigger')
183
+ expect(trigger).toHaveTextContent('Select a date range')
184
+ })
185
+
186
+ test('placeholder shows default "Select..." when not provided', () => {
187
+ render(
188
+ <Dropdown
189
+ data={{ testid: testId }}
190
+ options={options}
191
+ />
192
+ )
193
+
194
+ const kit = screen.getByTestId(testId)
195
+ const trigger = kit.querySelector('.pb_dropdown_trigger')
196
+ expect(trigger).toHaveTextContent('Select...')
197
+ })
198
+
125
199
  test('generated label prop', () => {
126
200
  render (
127
201
  <Dropdown
@@ -466,7 +540,27 @@ test("quickpick clears selection when clicking X icon", () => {
466
540
  expect(trigger).toHaveTextContent("Select...")
467
541
  })
468
542
 
543
+ test("quickpick hides clear icon when clearable is false", () => {
544
+ render(
545
+ <Dropdown
546
+ clearable={false}
547
+ data={{ testid: testId }}
548
+ defaultValue="This Week"
549
+ variant="quickpick"
550
+ />
551
+ )
552
+
553
+ const kit = screen.getByTestId(testId)
554
+ const trigger = kit.querySelector('.pb_dropdown_trigger')
555
+
556
+ expect(trigger).toHaveTextContent("This Week")
557
+
558
+ const clearIcon = kit.querySelector('[aria-label="times icon"]')
559
+ expect(clearIcon).not.toBeInTheDocument()
560
+ })
561
+
469
562
  test("quickpick returns date array values when option selected", () => {
563
+ // eslint-disable-next-line react/no-multi-comp
470
564
  const TestComponent = () => {
471
565
  const [selected, setSelected] = useState(null)
472
566
  return (
@@ -5,9 +5,13 @@ module Playbook
5
5
  class DropdownContainer < Playbook::KitBase
6
6
  prop :searchbar, type: Playbook::Props::Boolean,
7
7
  default: false
8
+ prop :constrain_height, type: Playbook::Props::Boolean,
9
+ default: false
8
10
 
9
11
  def classname
10
- generate_classname("pb_dropdown_container", "close", separator: " ")
12
+ classes = %w[pb_dropdown_container close]
13
+ classes << "constrain_height" if constrain_height
14
+ generate_classname(*classes, separator: " ")
11
15
  end
12
16
 
13
17
  def data
@@ -48,6 +48,7 @@ export default class PbDropdown extends PbEnhancedElement {
48
48
  this.updatePills();
49
49
 
50
50
  this.clearBtn = this.element.querySelector(CLEAR_ICON_SELECTOR);
51
+ this.isClearable = this.element.dataset.pbDropdownClearable !== "false";
51
52
  if (this.clearBtn) {
52
53
  this.clearBtn.style.display = "none";
53
54
  this.clearBtn.addEventListener("click", (e) => {
@@ -60,6 +61,10 @@ export default class PbDropdown extends PbEnhancedElement {
60
61
 
61
62
  updateClearButton() {
62
63
  if (!this.clearBtn) return;
64
+ if (!this.isClearable) {
65
+ this.clearBtn.style.display = "none";
66
+ return;
67
+ }
63
68
  const hasSelection = this.isMultiSelect
64
69
  ? this.selectedOptions.size > 0
65
70
  : Boolean(this.element.querySelector(DROPDOWN_INPUT).value);
@@ -109,15 +114,51 @@ export default class PbDropdown extends PbEnhancedElement {
109
114
  adjustDropdownHeight() {
110
115
  if (this.target.classList.contains("open")) {
111
116
  const el = this.target;
117
+ const shouldConstrain = el.classList.contains("constrain_height");
112
118
  el.style.height = "auto";
113
119
  requestAnimationFrame(() => {
114
- const newHeight = el.scrollHeight + "px";
115
- el.offsetHeight; // force reflow
116
- el.style.height = newHeight;
120
+ if (shouldConstrain) {
121
+ // Calculate 18em in pixels (matches SCSS max-height: 18em)
122
+ const fontSize = parseFloat(getComputedStyle(el).fontSize) || 16;
123
+ const maxHeight = fontSize * 18;
124
+ const scrollHeight = el.scrollHeight;
125
+ const newHeight = Math.min(scrollHeight, maxHeight);
126
+ el.offsetHeight; // force reflow
127
+ el.style.height = newHeight + "px";
128
+ } else {
129
+ el.offsetHeight; // force reflow
130
+ el.style.height = el.scrollHeight + "px";
131
+ }
117
132
  });
118
133
  }
119
134
  }
120
135
 
136
+ adjustDropdownPosition(container) {
137
+ if (!container) return;
138
+
139
+ const wrapper = this.element.querySelector(".dropdown_wrapper");
140
+ if (!wrapper) return;
141
+
142
+ const wrapperRect = wrapper.getBoundingClientRect();
143
+ const h = container.getBoundingClientRect().height || container.scrollHeight;
144
+ const spaceBelow = window.innerHeight - wrapperRect.bottom;
145
+ const spaceAbove = wrapperRect.top;
146
+
147
+ // If not enough space below but enough space above, position above
148
+ if (spaceBelow < h + 10 && spaceAbove >= h + 10) {
149
+ container.style.top = "auto";
150
+ container.style.bottom = "calc(100% + 5px)";
151
+ container.style.marginTop = "0";
152
+ container.style.marginBottom = "0";
153
+ } else {
154
+ // Default: position below
155
+ container.style.top = "";
156
+ container.style.bottom = "";
157
+ container.style.marginTop = "";
158
+ container.style.marginBottom = "";
159
+ }
160
+ }
161
+
121
162
  handleSearch(term = "") {
122
163
  const lcTerm = term.toLowerCase();
123
164
  let hasMatch = false
@@ -365,7 +406,21 @@ export default class PbDropdown extends PbEnhancedElement {
365
406
  showElement(elem) {
366
407
  elem.classList.remove("close");
367
408
  elem.classList.add("open");
368
- elem.style.height = elem.scrollHeight + "px";
409
+
410
+ const shouldConstrain = elem.classList.contains("constrain_height");
411
+ if (shouldConstrain) {
412
+ // Calculate height respecting max-height constraint (18em)
413
+ const fontSize = parseFloat(getComputedStyle(elem).fontSize) || 16;
414
+ const maxHeight = fontSize * 18; // matches SCSS max-height: 18em
415
+ const scrollHeight = elem.scrollHeight;
416
+ const height = Math.min(scrollHeight, maxHeight);
417
+ elem.style.height = height + "px";
418
+ } else {
419
+ elem.style.height = elem.scrollHeight + "px";
420
+ }
421
+
422
+ // Auto-position dropdown above if not enough space below
423
+ this.adjustDropdownPosition(elem);
369
424
  }
370
425
 
371
426
  hideElement(elem) {
@@ -19,6 +19,7 @@ type DropdownContainerProps = {
19
19
  aria?: { [key: string]: string };
20
20
  children?: React.ReactChild[] | React.ReactChild;
21
21
  className?: string;
22
+ constrainHeight?: boolean;
22
23
  dark?: boolean;
23
24
  data?: { [key: string]: string };
24
25
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -31,6 +32,7 @@ const DropdownContainer = (props: DropdownContainerProps) => {
31
32
  aria = {},
32
33
  children,
33
34
  className,
35
+ constrainHeight = false,
34
36
  dark = false,
35
37
  data = {},
36
38
  htmlOptions = {},
@@ -54,6 +56,7 @@ const DropdownContainer = (props: DropdownContainerProps) => {
54
56
  const classes = classnames(
55
57
  buildCss("pb_dropdown_container"),
56
58
  `${isDropDownClosed ? "close" : "open"}`,
59
+ constrainHeight && "constrain_height",
57
60
  globalProps(props),
58
61
  className
59
62
  );
@@ -44,6 +44,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
44
44
 
45
45
  const {
46
46
  autocomplete,
47
+ clearable,
47
48
  filterItem,
48
49
  handleBackspace,
49
50
  handleChange,
@@ -225,7 +226,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
225
226
  key={`${isDropDownClosed ? "chevron-down" : "chevron-up"}`}
226
227
  >
227
228
  {
228
- selectedArray.length > 0 && (
229
+ clearable !== false && selectedArray.length > 0 && (
229
230
  <div onClick={(e)=>{e.stopPropagation();handleBackspace()}}>
230
231
  <Icon
231
232
  cursor="pointer"
@@ -21,7 +21,7 @@ const nextValue = (value: SortValue[], name: string): SortValue => {
21
21
  }
22
22
 
23
23
  const directionIcon = (dir: Direction) => (
24
- dir == 'asc' ? 'sort-amount-up' : 'sort-amount-down'
24
+ dir == 'asc' ? 'arrow-up-short-wide' : 'arrow-down-wide-short'
25
25
  )
26
26
 
27
27
  const renderOptions = (options: SortOptions, value: SortValue[], handleChange: (arg0: SortValue) => void) => (
@@ -1,7 +1,7 @@
1
1
  <%=
2
2
  pb_rails("filter", props: {
3
3
  min_width: "360px",
4
- id: "1",
4
+ id: "filter-demo-1",
5
5
  margin_bottom: "xl",
6
6
  filters: [
7
7
  { name: "name", value: "John Wick" },
@@ -44,7 +44,7 @@
44
44
  <%=
45
45
  pb_rails("filter", props: {
46
46
  min_width: "360px",
47
- id: "def2",
47
+ id: "filter-demo-2",
48
48
  sort_menu: [
49
49
  { item: "Popularity", link: "?q[sorts]=managers_popularity+asc", active: true, direction: "desc" },
50
50
  { item: "Mananger's Title", link: "?q[sorts]=managers_title+asc", active: false },
@@ -1,4 +1,4 @@
1
- import React from 'react'
1
+ import React, { useState } from 'react'
2
2
 
3
3
  import Button from '../../pb_button/_button'
4
4
  import Filter from '../../pb_filter/_filter'
@@ -6,11 +6,18 @@ import Flex from '../../pb_flex/_flex'
6
6
  import Select from '../../pb_select/_select'
7
7
  import TextInput from '../../pb_text_input/_text_input'
8
8
 
9
- const SortingChangeCallback = (sortOptions) => {
10
- alert(JSON.stringify(sortOptions[0]))
11
- }
12
-
13
9
  const FilterDefault = (props) => {
10
+ const [sortValue, setSortValue] = useState([{ name: 'popularity', dir: 'desc' }])
11
+ const [sortValue2, setSortValue2] = useState([{ name: 'popularity', dir: 'desc' }])
12
+
13
+ const handleSortChange = (sortOptions) => {
14
+ setSortValue(sortOptions)
15
+ alert(JSON.stringify(sortOptions[0]))
16
+ }
17
+
18
+ const handleSortChange2 = (sortOptions) => {
19
+ setSortValue2(sortOptions)
20
+ }
14
21
  const options = [
15
22
  { value: 'USA' },
16
23
  { value: 'Canada' },
@@ -29,7 +36,7 @@ const FilterDefault = (props) => {
29
36
  }}
30
37
  marginBottom="xl"
31
38
  minWidth="375px"
32
- onSortChange={SortingChangeCallback}
39
+ onSortChange={handleSortChange}
33
40
  results={1}
34
41
  sortOptions={{
35
42
  popularity: 'Popularity',
@@ -38,7 +45,7 @@ const FilterDefault = (props) => {
38
45
  // eslint-disable-next-line
39
46
  manager_name: 'Manager\'s Name',
40
47
  }}
41
- sortValue={[{ name: 'popularity', dir: 'desc' }]}
48
+ sortValue={sortValue}
42
49
  {...props}
43
50
  >
44
51
  {({ closePopover }) => (
@@ -82,7 +89,7 @@ const FilterDefault = (props) => {
82
89
  <Filter
83
90
  double
84
91
  minWidth="375px"
85
- onSortChange={SortingChangeCallback}
92
+ onSortChange={handleSortChange2}
86
93
  results={0}
87
94
  sortOptions={{
88
95
  popularity: 'Popularity',
@@ -91,7 +98,7 @@ const FilterDefault = (props) => {
91
98
  // eslint-disable-next-line
92
99
  manager_name: 'Manager\'s Name',
93
100
  }}
94
- sortValue={[{ name: 'popularity', dir: 'desc' }]}
101
+ sortValue={sortValue2}
95
102
  {...props}
96
103
  >
97
104
  {({ closePopover }) => (
@@ -44,9 +44,9 @@ module Playbook
44
44
  def sort_icon(direction)
45
45
  case direction
46
46
  when "asc"
47
- "sort-amount-up"
47
+ "arrow-up-short-wide"
48
48
  when "desc"
49
- "sort-amount-down"
49
+ "arrow-down-wide-short"
50
50
  else
51
51
  ""
52
52
  end
@@ -1,13 +1,16 @@
1
1
  <%= pb_form_with(scope: :example, url: "", method: :get, validate: true) do |form| %>
2
+ <%= form.typeahead :example_typeahead_field, props: { label: true, required: true, required_indicator: true } %>
2
3
  <%= form.text_field :example_text_field, props: { label: true, required: true, required_indicator: true } %>
3
4
  <%= form.text_field :example_text_field_2, props: { label: "Text Field Custom Label", required: true, required_indicator: true } %>
4
- <%= form.text_area :example_text_area, props: { label: true, required: true, required_indicator: true } %>
5
- <%= form.text_area :example_text_area_2, props: { label: "Textarea Custom Label", required: true, required_indicator: true } %>
5
+ <%= form.phone_number_field :example_phone_number_field, props: { label: true, required: true, required_indicator: true } %>
6
6
  <%= form.email_field :example_email_field, props: { label: true, required: true, required_indicator: true } %>
7
7
  <%= form.number_field :example_number_field, props: { label: true, required: true, required_indicator: true } %>
8
8
  <%= form.search_field :example_search_field, props: { label: true, required: true, required_indicator: true } %>
9
9
  <%= form.password_field :example_password_field, props: { label: true, required: true, required_indicator: true } %>
10
10
  <%= form.url_field :example_url_field, props: { label: true, required: true, required_indicator: true } %>
11
+ <%= form.text_area :example_text_area, props: { label: true, required: true, required_indicator: true } %>
12
+ <%= form.text_area :example_text_area_2, props: { label: "Textarea Custom Label", required: true, required_indicator: true } %>
13
+ <%# <%= form.check_box :example_checkbox, props: { label: true, text: "Checkbox Label", required: true, required_indicator: true } %>
11
14
 
12
15
  <%= form.actions do |action| %>
13
16
  <%= action.submit %>
@@ -15,7 +15,7 @@
15
15
  options: names,
16
16
  label: "Truncation Within Typeahead",
17
17
  pills: true,
18
- truncate: 1,
18
+ truncate: "1",
19
19
  }) %>
20
20
 
21
21
  <%= pb_rails("caption", props: { text: "Form Pill Truncation" }) %>
@@ -24,19 +24,19 @@
24
24
  name: "Princess Amelia Mignonette Grimaldi Thermopolis Renaldo",
25
25
  avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
26
26
  tabindex: 0,
27
- truncate: 1,
27
+ truncate: "1",
28
28
  id: "truncation-1"
29
29
  }) %>
30
30
  <%= pb_rails("form_pill", props: {
31
31
  icon: "badge-check",
32
32
  text: "icon and a very long tag to show truncation",
33
33
  tabindex: 0,
34
- truncate: 1,
34
+ truncate: "1",
35
35
  id: "truncation-2"
36
36
  }) %>
37
37
  <%= pb_rails("form_pill", props: {
38
38
  text: "form pill long tag no tooltip show truncation",
39
39
  tabindex: 0,
40
- truncate: 1,
40
+ truncate: "1",
41
41
  }) %>
42
- <% end %>
42
+ <% end %>
@@ -21,7 +21,7 @@ const FormPillTruncatedText = (props) => {
21
21
  isMulti
22
22
  label="Truncation Within Typeahead"
23
23
  options={names}
24
- truncate={1}
24
+ truncate={"1"}
25
25
  {...props}
26
26
  />
27
27
  <Caption text="Form Pill Truncation"/>
@@ -31,20 +31,20 @@ const FormPillTruncatedText = (props) => {
31
31
  name="Princess Amelia Mignonette Grimaldi Thermopolis Renaldo"
32
32
  onClick={() => alert('Click!')}
33
33
  tabIndex={0}
34
- truncate={1}
34
+ truncate={"1"}
35
35
  />
36
36
  <FormPill
37
37
  icon="badge-check"
38
38
  onClick={() => {alert('Click!')}}
39
39
  tabIndex={0}
40
40
  text="icon and a very long tag to show truncation"
41
- truncate={1}
41
+ truncate={"1"}
42
42
  />
43
43
  <FormPill
44
44
  onClick={() => {alert('Click!')}}
45
45
  tabIndex={0}
46
46
  text="form pill with a very long tag to show truncation"
47
- truncate={1}
47
+ truncate={"1"}
48
48
  />
49
49
  </Card>
50
50
  </>
@@ -49,6 +49,10 @@ module Playbook
49
49
  def wrapped_class
50
50
  wrapped ? "wrapped" : nil
51
51
  end
52
+
53
+ def truncate_props
54
+ nil
55
+ end
52
56
  end
53
57
  end
54
58
  end
@@ -44,7 +44,6 @@ type NavItemProps = {
44
44
  marginX?: Spacing;
45
45
  marginY?: Spacing;
46
46
  disabled?: boolean;
47
- inactive?: boolean;
48
47
  } & GlobalProps;
49
48
 
50
49
  const NavItem = (props: NavItemProps) => {
@@ -92,7 +91,6 @@ const NavItem = (props: NavItemProps) => {
92
91
  marginX,
93
92
  marginY,
94
93
  disabled = false,
95
- inactive = false,
96
94
  } = props;
97
95
 
98
96
  const spacingMarginProps = {
@@ -150,7 +148,6 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
150
148
  const highlightedBorderClass = active === true && highlighted_border === false ? "highlighted_border_none" : "";
151
149
  const collapsibleTrailClass = collapsible && collapsibleTrail ? "collapsible_trail" : "";
152
150
  const disabledClass = disabled ? "pb_nav_item_disabled" : "";
153
- const inactiveClass = inactive ? "pb_nav_item_inactive" : "";
154
151
 
155
152
  const fontSizeMapping = {
156
153
  "small": "font_size_small",
@@ -184,7 +181,6 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
184
181
  tagClasses,
185
182
  collapsible ? globalProps(filteredProps, {...filteredPadding}) : globalProps(props, {...itemSpacing}),
186
183
  disabledClass,
187
- inactiveClass,
188
184
  className
189
185
  );
190
186
 
@@ -230,7 +226,7 @@ const { filteredPadding, filteredMargin } = filterItemSpacing(itemSpacing);
230
226
  {collapsible ? (
231
227
  <>
232
228
  <Collapsible
233
- className={collapsibleClasses + ` ${inactiveClass}`}
229
+ className={collapsibleClasses}
234
230
  collapsed={collapsed}
235
231
  icon={iconRight && iconRight}
236
232
  iconSize="xs"
@@ -79,8 +79,7 @@
79
79
  }
80
80
 
81
81
  // Disabled scss
82
- .pb_nav_item_disabled,
83
- .pb_nav_item_inactive {
82
+ .pb_nav_item_disabled {
84
83
  cursor: not-allowed !important;
85
84
  .pb_nav_list_item_text,
86
85
  .pb_nav_list_item_icon_left,
@@ -101,28 +100,3 @@
101
100
  }
102
101
  }
103
102
  }
104
-
105
- .pb_nav_item_inactive {
106
- .pb_nav_list_item_text_collapsible {
107
- color: $text_lt_lighter !important;
108
- cursor: not-allowed !important;
109
- }
110
- }
111
-
112
- .pb_nav_item_inactive {
113
- .pb_collapsible_content_kit {
114
- .pb_nav_list_item_text_collapsible {
115
- color: $text_lt_lighter !important;
116
- cursor: not-allowed !important;
117
- }
118
- }
119
- @media (hover: hover) {
120
- &:hover {
121
- .pb_nav_list_item_icon_section_collapsible {
122
- path {
123
- color: $text_lt_lighter !important;
124
- }
125
- }
126
- }
127
- }
128
- }
@@ -1,6 +1,5 @@
1
1
  examples:
2
2
  rails:
3
- - collapsible_nav_disabled_item: Collapsible Nav With Disabled Item
4
3
  - default_nav: Default
5
4
  - with_icons_nav: With Icons
6
5
  - with_img_nav: With Custom Icon
@@ -27,7 +26,6 @@ examples:
27
26
  - tab_nav: Tab Nav
28
27
 
29
28
  react:
30
- - collapsible_nav_disabled_item: Collapsible Nav With Disabled Item
31
29
  - default_nav: Default
32
30
  - with_icons_nav: With Icons
33
31
  - with_img_nav: With Custom Icon
@@ -22,5 +22,4 @@ export { default as CollapsibleNavItemSpacing } from "./_collapsible_nav_item_sp
22
22
  export { default as CollapsibleNavNoIcon } from "./_collapsible_nav_no_icon.jsx"
23
23
  export { default as HorizontalNavExtendedunderline } from './_horizontal_nav_extendedunderline.jsx'
24
24
  export { default as HorizontalNavDisabled } from './_horizontal_nav_disabled.jsx'
25
- export { default as VerticalNavDisabled } from './_vertical_nav_disabled.jsx'
26
- export { default as CollapsibleNavDisabledItem } from './_collapsible_nav_disabled_item.jsx'
25
+ export { default as VerticalNavDisabled } from './_vertical_nav_disabled.jsx'
@@ -20,7 +20,6 @@ module Playbook
20
20
  prop :icon_left
21
21
  prop :icon_right
22
22
  prop :image_url
23
- prop :inactive, type: Playbook::Props::Boolean, default: false
24
23
  prop :target, type: Playbook::Props::Enum,
25
24
  values: %w[_blank _self _parent _top],
26
25
  default: "_self"
@@ -28,7 +27,7 @@ module Playbook
28
27
  if collapsible
29
28
  "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{generate_classname('pb_collapsible_nav_item', active_class, collapsible_trail_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link_collapsible"
30
29
  else
31
- "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{font_size_class} #{font_weight_class} #{inactive_class} pb_nav_list_item_link#{disabled_class}"
30
+ "#{generate_classname('pb_nav_list_kit_item', active_class, highlighted_border_class)} #{font_size_class} #{font_weight_class} pb_nav_list_item_link#{disabled_class}"
32
31
  end
33
32
  end
34
33
 
@@ -95,7 +94,7 @@ module Playbook
95
94
  end
96
95
 
97
96
  def collapsible_nav_classname
98
- generate_classname("collapsible_nav_wrapper", active_class, collapsible_trail_class, inactive_class)
97
+ generate_classname("collapsible_nav_wrapper", active_class, collapsible_trail_class)
99
98
  end
100
99
 
101
100
  private
@@ -108,10 +107,6 @@ module Playbook
108
107
  disabled ? " pb_nav_item_disabled" : nil
109
108
  end
110
109
 
111
- def inactive_class
112
- inactive ? " pb_nav_item_inactive" : nil
113
- end
114
-
115
110
  def highlighted_border_class
116
111
  !highlighted_border && active ? "highlighted_border_none" : nil
117
112
  end
@@ -7,6 +7,7 @@ import { globalProps } from "../utilities/globalProps"
7
7
  import Body from '../pb_body/_body'
8
8
  import Caption from '../pb_caption/_caption'
9
9
  import CircleIconButton from '../pb_circle_icon_button/_circle_icon_button'
10
+ import colors from '../tokens/exports/_colors.module.scss'
10
11
  import Flex from '../pb_flex/_flex'
11
12
  import Icon from '../pb_icon/_icon'
12
13
  import PbReactPopover from '../pb_popover/_popover'
@@ -25,6 +26,7 @@ type PassphraseProps = {
25
26
  inputProps?: GenericObject,
26
27
  label?: string,
27
28
  onChange: (inputValue: string) => void,
29
+ requiredIndicator?: boolean,
28
30
  showTipsBelow?: "always" | "xs" | "sm" | "md" | "lg" | "xl",
29
31
  tips?: Array<string>,
30
32
  uncontrolled?: boolean,
@@ -43,6 +45,7 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
43
45
  inputProps = {},
44
46
  label = confirmation ? "Confirm Passphrase" : "Passphrase",
45
47
  onChange = () => undefined,
48
+ requiredIndicator = false,
46
49
  showTipsBelow = "always",
47
50
  tips = [],
48
51
  uncontrolled = false,
@@ -99,6 +102,7 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
99
102
 
100
103
  const shieldIcon = getAllIcons()["shieldCheck"]
101
104
  const eyeIcon = getAllIcons()["eye"]
105
+ const hasLabel = label && label !== ""
102
106
 
103
107
  return (
104
108
  <div
@@ -109,11 +113,22 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
109
113
  id={id}
110
114
  >
111
115
  <label>
112
- <Flex align="baseline">
113
- <Caption
114
- className="passphrase-label"
115
- text={label}
116
- />
116
+ <Flex
117
+ align="baseline"
118
+ {...(hasLabel ? { marginBottom: "xs" } : {})}
119
+ >
120
+ {hasLabel && (requiredIndicator ? (
121
+ <Caption
122
+ className="passphrase-label"
123
+ >
124
+ {label} <span style={{ color: `${colors.error}` }}>*</span>
125
+ </Caption>
126
+ ) : (
127
+ <Caption
128
+ className="passphrase-label"
129
+ text={label}
130
+ />
131
+ ))}
117
132
  {tips.length > 0 && !confirmation &&
118
133
  <PbReactPopover
119
134
  className="passphrase-tips"