playbook_ui 14.20.0 → 14.21.0.pre.rc.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +8 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +16 -8
  4. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +9 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.md +6 -2
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +1 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.html.erb +137 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_actions_rails.md +3 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.html.erb +40 -0
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_selectable_rows_header_rails.md +1 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/index.js +155 -12
  13. data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.html.erb +23 -0
  14. data/app/pb_kits/playbook/pb_advanced_table/table_action_bar.rb +19 -0
  15. data/app/pb_kits/playbook/pb_advanced_table/table_header.rb +4 -0
  16. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +8 -12
  17. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +3 -6
  18. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +2 -48
  19. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate_rails.md +1 -0
  20. data/app/pb_kits/playbook/pb_checkbox/index.js +56 -0
  21. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +108 -2
  22. data/app/pb_kits/playbook/pb_dropdown/index.js +24 -0
  23. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +4 -0
  24. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.html.erb +4 -0
  25. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.jsx +15 -0
  26. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_exclude_countries.md +1 -0
  27. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_only_countries.jsx +1 -1
  28. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +4 -3
  29. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  30. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
  31. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.html.erb +12 -0
  32. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.jsx +31 -0
  33. data/app/pb_kits/playbook/pb_select/docs/_select_custom_select_subheaders.md +1 -0
  34. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  35. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  36. data/dist/chunks/_typeahead-CRW6dJbW.js +22 -0
  37. data/dist/chunks/{_weekday_stacked-CZJor-EY.js → _weekday_stacked-C4d17aYW.js} +1 -1
  38. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  39. data/dist/chunks/lib-D5R1BjUn.js +29 -0
  40. data/dist/chunks/{pb_form_validation-D1Bwm-op.js → pb_form_validation-BZ2AVAi_.js} +1 -1
  41. data/dist/chunks/vendor.js +1 -1
  42. data/dist/menu.yml +1 -1
  43. data/dist/playbook-doc.js +2 -2
  44. data/dist/playbook-rails-react-bindings.js +1 -1
  45. data/dist/playbook-rails.js +1 -1
  46. data/dist/playbook.css +1 -1
  47. data/lib/playbook/version.rb +2 -2
  48. metadata +21 -7
  49. data/dist/chunks/_typeahead-MUu4QW0I.js +0 -22
  50. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
  51. data/dist/chunks/lib-DFF1N868.js +0 -29
@@ -9,11 +9,10 @@
9
9
  <tr>
10
10
  <th>
11
11
  <%= pb_rails("checkbox", props: {
12
- checked: true,
13
12
  text: "Uncheck All",
14
13
  value: "checkbox-value",
15
14
  name: "main-checkbox",
16
- indeterminate: true,
15
+ indeterminate_main: true,
17
16
  id: "indeterminate-checkbox"
18
17
  }) %>
19
18
  </th>
@@ -30,55 +29,10 @@
30
29
  value: checkbox[:id],
31
30
  name: "#{checkbox[:id]}-indeterminate-checkbox",
32
31
  id: "#{checkbox[:id]}-indeterminate-checkbox",
32
+ indeterminate_parent: "indeterminate-checkbox",
33
33
  }) %>
34
34
  </td>
35
35
  </tr>
36
36
  <% end %>
37
37
  </tbody>
38
38
  <% end %>
39
-
40
- <script>
41
- document.addEventListener('DOMContentLoaded', function() {
42
- const mainCheckboxWrapper = document.getElementById('indeterminate-checkbox');
43
- const mainCheckbox = document.getElementsByName("main-checkbox")[0];
44
- const childCheckboxes = document.querySelectorAll('input[type="checkbox"][id$="indeterminate-checkbox"]');
45
-
46
- const updateMainCheckbox = () => {
47
- // Count the number of checked child checkboxes
48
- const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
49
- // Determine if the main checkbox should be in an indeterminate state
50
- const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
51
-
52
- // Set the main checkbox states
53
- mainCheckbox.indeterminate = indeterminate;
54
- mainCheckbox.checked = checkedCount > 0;
55
-
56
- // Determine the main checkbox label based on the number of checked checkboxes
57
- const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
58
-
59
- // Determine the icon class to add and remove based on the number of checked checkboxes
60
- const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
61
- const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
62
-
63
- // Update main checkbox label
64
- mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
65
-
66
- // Add and remove the icon class to the main checkbox wrapper
67
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
68
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
69
-
70
- // Toggle the visibility of the checkbox icon based on the indeterminate state
71
- mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
72
- mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
73
- };
74
-
75
- mainCheckbox.addEventListener('change', function() {
76
- childCheckboxes.forEach(cb => cb.checked = this.checked);
77
- updateMainCheckbox();
78
- });
79
-
80
- childCheckboxes.forEach(cb => {
81
- cb.addEventListener('change', updateMainCheckbox);
82
- });
83
- });
84
- </script>
@@ -0,0 +1 @@
1
+ If you want to use indeterminate, "check/uncheck all" checkboxes, add `indeterminate_main: true` and an `id` to the main checkbox. Then, add an `indeterminate_parent` prop with the main checkbox's `id` to the children checkboxes.
@@ -0,0 +1,56 @@
1
+ import PbEnhancedElement from "../pb_enhanced_element"
2
+
3
+ const INDETERMINATE_MAIN_CHECKBOX_SELECTOR = "[data-pb-checkbox-indeterminate-main='true']"
4
+
5
+ export default class PbCheckbox extends PbEnhancedElement {
6
+ static get selector() {
7
+ return INDETERMINATE_MAIN_CHECKBOX_SELECTOR
8
+ }
9
+
10
+ connect() {
11
+ const mainCheckboxWrapper = this.element;
12
+ const mainCheckbox = mainCheckboxWrapper.querySelector('input')
13
+ const childCheckboxes = document.querySelectorAll(`[data-pb-checkbox-indeterminate-parent="${this.element.id}"] input[type="checkbox"]`);
14
+
15
+ const updateMainCheckbox = () => {
16
+ // Count the number of checked child checkboxes
17
+ const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
18
+ // Determine if the main checkbox should be in an indeterminate state
19
+ const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
20
+
21
+ // Set the main checkbox states
22
+ mainCheckbox.indeterminate = indeterminate;
23
+ mainCheckbox.checked = checkedCount > 0;
24
+
25
+ // Determine the main checkbox label based on the number of checked checkboxes
26
+ const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
27
+
28
+ // Determine the icon class to add and remove based on the number of checked checkboxes
29
+ const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
30
+ const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
31
+
32
+ // Update main checkbox label
33
+ mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
34
+
35
+ // Add and remove the icon class to the main checkbox wrapper
36
+ mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
37
+ mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
38
+
39
+ // Toggle the visibility of the checkbox icon based on the indeterminate state
40
+ mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
41
+ mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
42
+ };
43
+
44
+ // Set indeterminate icon on main checkbox if initial children checkboxes are checked
45
+ updateMainCheckbox();
46
+
47
+ this.element.querySelector('input').addEventListener('change', function() {
48
+ childCheckboxes.forEach(cb => cb.checked = this.checked);
49
+ updateMainCheckbox();
50
+ });
51
+
52
+ childCheckboxes.forEach(cb => {
53
+ cb.addEventListener('change', updateMainCheckbox);
54
+ });
55
+ }
56
+ }
@@ -1,5 +1,5 @@
1
1
  import React from "react"
2
- import { render, screen } from "../utilities/test-utils"
2
+ import { render, screen, fireEvent } from "../utilities/test-utils"
3
3
 
4
4
  import { Dropdown, Icon, IconCircle } from 'playbook-ui'
5
5
 
@@ -263,4 +263,110 @@ test("searchbar prop to render TextInput in container", () => {
263
263
  const kit = screen.getByTestId(testId)
264
264
  const searchbar = kit.querySelector('.pb_text_input_kit')
265
265
  expect(searchbar).toBeInTheDocument()
266
- })
266
+ })
267
+
268
+ test("MultiSelect prop to allow multiple selections + add correct Form Pills", () => {
269
+ render(
270
+ <Dropdown
271
+ data={{ testid: testId }}
272
+ multiSelect
273
+ options={options}
274
+ />
275
+ );
276
+
277
+ const kit = screen.getByTestId(testId);
278
+ const option = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
279
+ fireEvent.click(option[0]); // Select first option
280
+ fireEvent.click(option[1]); // Select second option
281
+ const formPills = kit.querySelectorAll(".pb_form_pill_kit_primary");
282
+ expect(formPills.length).toBe(2);
283
+ expect(formPills[0]).toHaveTextContent("United States");
284
+ expect(formPills[1]).toHaveTextContent("Canada");
285
+ });
286
+
287
+ test("hides each selected option from the dropdown", () => {
288
+
289
+ render(
290
+ <Dropdown
291
+ data={{ testid: testId }}
292
+ multiSelect
293
+ options={options}
294
+ />
295
+ );
296
+
297
+ const kit = screen.getByTestId(testId);
298
+ const option = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
299
+ const firstOpt = options[0].label
300
+ fireEvent.click(option[0]);
301
+ const option2 = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
302
+ expect(option2[0]).not.toHaveTextContent(firstOpt)
303
+ })
304
+
305
+ test("renders form pills inside trigger", () => {
306
+ render(
307
+ <Dropdown
308
+ data={{ testid: testId }}
309
+ multiSelect
310
+ options={options}
311
+ />
312
+ );
313
+
314
+ const kit = screen.getByTestId(testId)
315
+ const option = kit.querySelector('.pb_dropdown_option_list')
316
+ fireEvent.click(option)
317
+ const formPill = kit.querySelector(".pb_form_pill_kit_primary")
318
+ expect(formPill).toBeInTheDocument()
319
+ })
320
+
321
+ test("multiSelect and autocomplete to work together", () => {
322
+ render (
323
+ <Dropdown
324
+ autocomplete
325
+ data={{ testid: testId }}
326
+ multiSelect
327
+ options={options}
328
+ />
329
+ )
330
+
331
+ const kit = screen.getByTestId(testId)
332
+ const input = kit.querySelector('.dropdown_input')
333
+ expect(input).toBeInTheDocument()
334
+ const option = kit.querySelector('.pb_dropdown_option_list')
335
+ fireEvent.click(option)
336
+ const formPill = kit.querySelector(".pb_form_pill_kit_primary")
337
+ expect(formPill).toBeInTheDocument()
338
+ })
339
+
340
+ test("renders form pills with size and color", () => {
341
+ render(
342
+ <Dropdown
343
+ data={{ testid: testId }}
344
+ formPillProps={{ size: "small", color: "neutral" }}
345
+ multiSelect
346
+ options={options}
347
+ />
348
+ );
349
+
350
+ const kit = screen.getByTestId(testId)
351
+ const option = kit.querySelector('.pb_dropdown_option_list')
352
+ fireEvent.click(option)
353
+ const formPill = kit.querySelector(".pb_form_pill_kit_neutral")
354
+ expect(formPill).toBeInTheDocument()
355
+ expect(formPill).toHaveClass("small")
356
+ })
357
+
358
+ test("defaultValue works with multiSelect", () => {
359
+ render(
360
+ <Dropdown
361
+ data={{ testid: testId }}
362
+ defaultValue={[options[0], options[2]]}
363
+ multiSelect
364
+ options={options}
365
+ />
366
+ )
367
+ const kit = screen.getByTestId(testId)
368
+ expect(kit.querySelectorAll(".pb_form_pill_kit_primary")).toHaveLength(2)
369
+ const option2 = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
370
+ const firstOpt = options[0].label
371
+ expect(option2[0]).not.toHaveTextContent(firstOpt)
372
+ })
@@ -115,6 +115,7 @@ export default class PbDropdown extends PbEnhancedElement {
115
115
 
116
116
  handleSearch(term = "") {
117
117
  const lcTerm = term.toLowerCase();
118
+ let hasMatch = false
118
119
  this.element.querySelectorAll(OPTION_SELECTOR).forEach((opt) => {
119
120
  //make it so that if the option is selected, it will not show up in the search results
120
121
  if (this.isMultiSelect && this.selectedOptions.has(opt.dataset.dropdownOptionLabel)) {
@@ -128,9 +129,32 @@ export default class PbDropdown extends PbEnhancedElement {
128
129
  // hide or show option
129
130
  const match = label.includes(lcTerm);
130
131
  opt.style.display = match ? "" : "none";
132
+ if (match) hasMatch = true
131
133
  });
132
134
 
133
135
  this.adjustDropdownHeight();
136
+
137
+ this.removeNoOptionsMessage()
138
+ if (!hasMatch) {
139
+ this.showNoOptionsMessage()
140
+ }
141
+ }
142
+
143
+ showNoOptionsMessage() {
144
+ if (this.element.querySelector(".dropdown_no_options")) return;
145
+
146
+ const noOptionElement = document.createElement("div");
147
+ noOptionElement.className = "pb_body_kit_light dropdown_no_options pb_item_kit p_xs display_flex justify_content_center";
148
+ noOptionElement.textContent = "no option";
149
+
150
+ this.target.appendChild(noOptionElement);
151
+ }
152
+
153
+ removeNoOptionsMessage() {
154
+ const existing = this.element.querySelector(".dropdown_no_options");
155
+ if (existing) {
156
+ existing.remove();
157
+ }
134
158
  }
135
159
 
136
160
  handleOptionClick(event) {
@@ -33,6 +33,7 @@ type PhoneNumberInputProps = {
33
33
  onChange?: (e: React.FormEvent<HTMLInputElement>) => void,
34
34
  onValidate?: Callback<boolean, void>,
35
35
  onlyCountries: string[],
36
+ excludeCountries: string[],
36
37
  preferredCountries?: string[],
37
38
  required?: boolean,
38
39
  value?: string,
@@ -88,6 +89,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
88
89
  },
89
90
  onValidate = () => null,
90
91
  onlyCountries = [],
92
+ excludeCountries = [],
91
93
  required = false,
92
94
  preferredCountries = [],
93
95
  value = "",
@@ -234,6 +236,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
234
236
  const fallbackCountry =
235
237
  preferredCountries.length > 0 ? preferredCountries[0] :
236
238
  onlyCountries.length > 0 ? onlyCountries.sort()[0] :
239
+ excludeCountries.length > 0 ? excludeCountries.sort()[0] :
237
240
  "af";
238
241
 
239
242
  useEffect(() => {
@@ -244,6 +247,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
244
247
  autoInsertDialCode: false,
245
248
  initialCountry: initialCountry || fallbackCountry,
246
249
  onlyCountries,
250
+ excludeCountries,
247
251
  countrySearch: countrySearch,
248
252
  fixDropdownWidth: false,
249
253
  formatAsYouType: formatAsYouType,
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("phone_number_input", props: {
2
+ initial_country: 'gb',
3
+ exclude_countries: ['us', 'br']
4
+ }) %>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import PhoneNumberInput from '../../pb_phone_number_input/_phone_number_input'
3
+
4
+ const PhoneNumberInputExcludeCountries = (props) => (
5
+ <>
6
+ <PhoneNumberInput
7
+ excludeCountries={['us', 'br']}
8
+ id='exclude'
9
+ initialCountry='gb'
10
+ {...props}
11
+ />
12
+ </>
13
+ )
14
+
15
+ export default PhoneNumberInputExcludeCountries
@@ -0,0 +1 @@
1
+ Excluding countries removes the selected countries from the dropdown.
@@ -6,7 +6,7 @@ const PhoneNumberInputOnlyCountries = (props) => (
6
6
  <PhoneNumberInput
7
7
  id='only'
8
8
  onlyCountries={['us', 'br']}
9
- {...props}
9
+ {...props}
10
10
  />
11
11
  </>
12
12
  )
@@ -4,7 +4,8 @@ examples:
4
4
  - phone_number_input_default: Default
5
5
  - phone_number_input_preferred_countries: Preferred Countries
6
6
  - phone_number_input_initial_country: Initial Country
7
- - phone_number_input_only_countries: Limited Countries
7
+ - phone_number_input_only_countries: Only Countries
8
+ - phone_number_input_exclude_countries: Exclude Countries
8
9
  - phone_number_input_validation: Form Validation
9
10
  - phone_number_input_clear_field: Clearing the Input Field
10
11
  - phone_number_input_access_input_element: Accessing the Input Element
@@ -15,9 +16,9 @@ examples:
15
16
  - phone_number_input_default: Default
16
17
  - phone_number_input_preferred_countries: Preferred Countries
17
18
  - phone_number_input_initial_country: Initial Country
18
- - phone_number_input_only_countries: Limited Countries
19
+ - phone_number_input_only_countries: Only Countries
20
+ - phone_number_input_exclude_countries: Exclude Countries
19
21
  - phone_number_input_validation: Form Validation
20
22
  - phone_number_input_format: Format as You Type
21
23
  - phone_number_input_hidden_inputs: Hidden Inputs
22
24
  - phone_number_input_country_search: Country Search
23
-
@@ -2,6 +2,7 @@ export { default as PhoneNumberInputDefault } from './_phone_number_input_defaul
2
2
  export { default as PhoneNumberInputPreferredCountries } from './_phone_number_input_preferred_countries'
3
3
  export { default as PhoneNumberInputInitialCountry } from './_phone_number_input_initial_country'
4
4
  export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_only_countries'
5
+ export { default as PhoneNumberInputExcludeCountries } from './_phone_number_input_exclude_countries'
5
6
  export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
6
7
  export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
7
8
  export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
@@ -15,6 +15,8 @@ module Playbook
15
15
  default: ""
16
16
  prop :only_countries, type: Playbook::Props::Array,
17
17
  default: []
18
+ prop :exclude_countries, type: Playbook::Props::Array,
19
+ default: []
18
20
  prop :preferred_countries, type: Playbook::Props::Array,
19
21
  default: []
20
22
  prop :error, type: Playbook::Props::String,
@@ -44,6 +46,7 @@ module Playbook
44
46
  label: label,
45
47
  name: name,
46
48
  onlyCountries: only_countries,
49
+ excludeCountries: exclude_countries,
47
50
  preferredCountries: preferred_countries,
48
51
  required: required,
49
52
  value: value,
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("select", props: { label: "Favorite Animal" }) do %>
2
+ <select name="animal" id="animal">
3
+ <optgroup label="Mammal">
4
+ <option value="1">Cat</option>
5
+ <option value="2">Dog</option>
6
+ </optgroup>
7
+ <optgroup label="Amphibian">
8
+ <option value="3">Frog</option>
9
+ <option value="4">Salamander</option>
10
+ </optgroup>
11
+ </select>
12
+ <% end %>
@@ -0,0 +1,31 @@
1
+ import React from 'react'
2
+
3
+ import Select from '../_select'
4
+
5
+ const SelectCustomSelectSubheaders = (props) => {
6
+ return (
7
+ <div>
8
+ <Select
9
+ label="Favorite Animal"
10
+ {...props}
11
+ >
12
+ <select
13
+ id="animal"
14
+ name="animal"
15
+ {...props}
16
+ >
17
+ <optgroup label="Mammal">
18
+ <option value="1">{'Cat'}</option>
19
+ <option value="2">{'Dog'}</option>
20
+ </optgroup>
21
+ <optgroup label="Amphibian">
22
+ <option value="3">{'Frog'}</option>
23
+ <option value="4">{'Salamander'}</option>
24
+ </optgroup>
25
+ </select>
26
+ </Select>
27
+ </div>
28
+ )
29
+ }
30
+
31
+ export default SelectCustomSelectSubheaders
@@ -0,0 +1 @@
1
+ To create a select with non-selectable subheaders, use a Custom Select component to render a native `<select>` containing `<optgroup>` elements. The [optgroup HTML element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/optgroup) groups related options under a non-selectable label in the dropdown.
@@ -8,6 +8,7 @@ examples:
8
8
  - select_required: Required Select Field
9
9
  - select_value_text_same: Equal option value and value text
10
10
  - select_custom_select: Custom Select
11
+ - select_custom_select_subheaders: Custom Select Subheaders
11
12
  - select_error: Select w/ Error
12
13
  - select_inline: Select Inline
13
14
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -25,6 +26,7 @@ examples:
25
26
  - select_required: Required Select Field
26
27
  - select_value_text_same: Equal option value and value text
27
28
  - select_custom_select: Custom Select
29
+ - select_custom_select_subheaders: Custom Select Subheaders
28
30
  - select_error: Select w/ Error
29
31
  - select_inline: Select Inline
30
32
  - select_inline_show_arrow: Select Inline (Always Show Arrow)
@@ -11,3 +11,4 @@ export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.js
11
11
  export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
12
12
  export { default as SelectMultiple } from './_select_multiple.jsx'
13
13
  export { default as SelectReactHook } from './_select_react_hook.jsx'
14
+ export { default as SelectCustomSelectSubheaders } from './_select_custom_select_subheaders.jsx'