playbook_ui 16.1.0.pre.alpha.play2771passphraseaccessibility14033 → 16.1.0.pre.alpha.play264213817

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_card/docs/_card_light.html.erb +35 -3
  3. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +5 -14
  4. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +6 -8
  5. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -6
  6. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +2 -37
  7. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -6
  8. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -4
  9. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +2 -2
  10. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -6
  11. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -94
  12. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +1 -5
  13. data/app/pb_kits/playbook/pb_dropdown/index.js +4 -59
  14. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +0 -3
  15. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +1 -2
  16. data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +1 -1
  17. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
  18. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +9 -16
  19. data/app/pb_kits/playbook/pb_filter/filter.rb +2 -2
  20. data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +0 -2
  21. data/app/pb_kits/playbook/pb_form/pb_form_validation.js +2 -9
  22. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
  23. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
  24. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +0 -4
  25. data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +7 -40
  26. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +0 -1
  27. data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +0 -2
  28. data/app/pb_kits/playbook/pb_passphrase/docs/index.js +0 -1
  29. data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +0 -2
  30. data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +1 -30
  31. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +0 -3
  32. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
  33. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
  34. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
  35. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +3 -34
  36. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +0 -10
  37. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.html.erb +3 -3
  38. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +0 -3
  39. data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +9 -25
  40. data/app/pb_kits/playbook/pb_textarea/textarea.rb +1 -7
  41. data/app/pb_kits/playbook/pb_time_picker/_time_picker.tsx +11 -97
  42. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +2 -5
  43. data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +0 -2
  44. data/app/pb_kits/playbook/pb_time_picker/docs/index.js +0 -1
  45. data/app/pb_kits/playbook/pb_time_picker/time_picker.rb +0 -3
  46. data/app/pb_kits/playbook/pb_time_picker/time_picker.test.jsx +1 -47
  47. data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +1 -24
  48. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -2
  49. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -4
  50. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
  51. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
  52. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +0 -4
  53. data/dist/chunks/_typeahead-B9a6ZsEP.js +1 -0
  54. data/dist/chunks/vendor.js +3 -3
  55. data/dist/menu.yml +1 -1
  56. data/dist/playbook-rails-react-bindings.js +1 -1
  57. data/dist/playbook-rails.js +1 -1
  58. data/dist/playbook.css +1 -1
  59. data/lib/playbook/forms/builder/phone_number_field.rb +0 -9
  60. data/lib/playbook/truncate.rb +1 -1
  61. data/lib/playbook/version.rb +1 -1
  62. metadata +3 -26
  63. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.md +0 -1
  64. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +0 -3
  65. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +0 -3
  66. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +0 -52
  67. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +0 -72
  68. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +0 -5
  69. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +0 -33
  70. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +0 -20
  71. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +0 -8
  72. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +0 -8
  73. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +0 -9
  74. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +0 -33
  75. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +0 -3
  76. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +0 -7
  77. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +0 -24
  78. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +0 -3
  79. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +0 -5
  80. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +0 -14
  81. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +0 -3
  82. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.md +0 -1
  83. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.html.erb +0 -6
  84. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.jsx +0 -16
  85. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.md +0 -3
  86. data/dist/chunks/_typeahead-D-8xZ__X.js +0 -1
@@ -1,4 +1,4 @@
1
- import React, { useState } from 'react'
1
+ import React from 'react'
2
2
 
3
3
  import Button from '../../pb_button/_button'
4
4
  import Filter from '../../pb_filter/_filter'
@@ -6,18 +6,11 @@ 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 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
- }
9
+ const SortingChangeCallback = (sortOptions) => {
10
+ alert(JSON.stringify(sortOptions[0]))
11
+ }
17
12
 
18
- const handleSortChange2 = (sortOptions) => {
19
- setSortValue2(sortOptions)
20
- }
13
+ const FilterDefault = (props) => {
21
14
  const options = [
22
15
  { value: 'USA' },
23
16
  { value: 'Canada' },
@@ -36,7 +29,7 @@ const FilterDefault = (props) => {
36
29
  }}
37
30
  marginBottom="xl"
38
31
  minWidth="375px"
39
- onSortChange={handleSortChange}
32
+ onSortChange={SortingChangeCallback}
40
33
  results={1}
41
34
  sortOptions={{
42
35
  popularity: 'Popularity',
@@ -45,7 +38,7 @@ const FilterDefault = (props) => {
45
38
  // eslint-disable-next-line
46
39
  manager_name: 'Manager\'s Name',
47
40
  }}
48
- sortValue={sortValue}
41
+ sortValue={[{ name: 'popularity', dir: 'desc' }]}
49
42
  {...props}
50
43
  >
51
44
  {({ closePopover }) => (
@@ -89,7 +82,7 @@ const FilterDefault = (props) => {
89
82
  <Filter
90
83
  double
91
84
  minWidth="375px"
92
- onSortChange={handleSortChange2}
85
+ onSortChange={SortingChangeCallback}
93
86
  results={0}
94
87
  sortOptions={{
95
88
  popularity: 'Popularity',
@@ -98,7 +91,7 @@ const FilterDefault = (props) => {
98
91
  // eslint-disable-next-line
99
92
  manager_name: 'Manager\'s Name',
100
93
  }}
101
- sortValue={sortValue2}
94
+ sortValue={[{ name: 'popularity', dir: 'desc' }]}
102
95
  {...props}
103
96
  >
104
97
  {({ closePopover }) => (
@@ -44,9 +44,9 @@ module Playbook
44
44
  def sort_icon(direction)
45
45
  case direction
46
46
  when "asc"
47
- "arrow-up-short-wide"
47
+ "sort-amount-up"
48
48
  when "desc"
49
- "arrow-down-wide-short"
49
+ "sort-amount-down"
50
50
  else
51
51
  ""
52
52
  end
@@ -8,8 +8,6 @@
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.phone_number_field :example_phone_number_field, props: { label: true, required: true, required_indicator: true } %>
12
- <%= form.time_picker :example_time_picker_required_indicator, props: { label: true, required: true, required_indicator: true } %>
13
11
 
14
12
  <%= form.actions do |action| %>
15
13
  <%= action.submit %>
@@ -26,10 +26,6 @@ class PbFormValidation extends PbEnhancedElement {
26
26
  const isPhoneNumberInput = field.closest('.pb_phone_number_input')
27
27
  if (isPhoneNumberInput) return
28
28
 
29
- // Skip TimePicker inputs - they handle their own validation
30
- const isTimePickerInput = field.closest('.pb_time_picker')
31
- if (isTimePickerInput) return
32
-
33
29
  FIELD_EVENTS.forEach((e) => {
34
30
  field.addEventListener(e, debounce((event) => {
35
31
  this.validateFormField(event)
@@ -71,16 +67,13 @@ class PbFormValidation extends PbEnhancedElement {
71
67
 
72
68
  // Check if this is a phone number input
73
69
  const isPhoneNumberInput = kitElement.classList.contains('pb_phone_number_input')
74
-
75
- // Check if this is a TimePicker input
76
- const isTimePickerInput = kitElement.classList.contains('pb_time_picker')
77
70
 
78
71
  // ensure clean error message state
79
72
  this.clearError(target)
80
73
  kitElement.classList.add('error')
81
74
 
82
- // Only add error message if it's NOT a phone number input or TimePicker input
83
- if (!isPhoneNumberInput && !isTimePickerInput) {
75
+ // Only add error message if it's NOT a phone number input
76
+ if (!isPhoneNumberInput) {
84
77
  // set the error message element
85
78
  const errorMessageContainer = this.errorMessageContainer
86
79
 
@@ -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,10 +49,6 @@ module Playbook
49
49
  def wrapped_class
50
50
  wrapped ? "wrapped" : nil
51
51
  end
52
-
53
- def truncate_props
54
- nil
55
- end
56
52
  end
57
53
  end
58
54
  end
@@ -7,7 +7,6 @@ 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'
11
10
  import Flex from '../pb_flex/_flex'
12
11
  import Icon from '../pb_icon/_icon'
13
12
  import PbReactPopover from '../pb_popover/_popover'
@@ -26,7 +25,6 @@ type PassphraseProps = {
26
25
  inputProps?: GenericObject,
27
26
  label?: string,
28
27
  onChange: (inputValue: string) => void,
29
- requiredIndicator?: boolean,
30
28
  showTipsBelow?: "always" | "xs" | "sm" | "md" | "lg" | "xl",
31
29
  tips?: Array<string>,
32
30
  uncontrolled?: boolean,
@@ -45,7 +43,6 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
45
43
  inputProps = {},
46
44
  label = confirmation ? "Confirm Passphrase" : "Passphrase",
47
45
  onChange = () => undefined,
48
- requiredIndicator = false,
49
46
  showTipsBelow = "always",
50
47
  tips = [],
51
48
  uncontrolled = false,
@@ -102,7 +99,6 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
102
99
 
103
100
  const shieldIcon = getAllIcons()["shieldCheck"]
104
101
  const eyeIcon = getAllIcons()["eye"]
105
- const hasLabel = label && label !== ""
106
102
 
107
103
  return (
108
104
  <div
@@ -113,22 +109,11 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
113
109
  id={id}
114
110
  >
115
111
  <label>
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
- ))}
112
+ <Flex align="baseline">
113
+ <Caption
114
+ className="passphrase-label"
115
+ text={label}
116
+ />
132
117
  {tips.length > 0 && !confirmation &&
133
118
  <PbReactPopover
134
119
  className="passphrase-tips"
@@ -178,40 +163,22 @@ const Passphrase = (props: PassphraseProps): React.ReactElement => {
178
163
  {...inputProps}
179
164
  />
180
165
  <span
181
- aria-label={
182
- showPassphrase
183
- ? "Passphrase currently visible. Click icon to hide password"
184
- : "Passphrase currently hidden. Click icon to reveal password"
185
- }
186
- aria-pressed={showPassphrase}
187
166
  className="show-passphrase-icon"
188
167
  onClick={toggleShowPassphrase}
189
- onKeyDown={(e) => {
190
- if (e.key === "Enter" || e.key === " ") {
191
- e.preventDefault()
192
- toggleShowPassphrase(e as any)
193
- }
194
- }}
195
- role="button"
196
- tabIndex={0}
197
168
  >
198
169
  <Body
199
170
  className={showPassphrase ? "hide-icon" : ""}
200
171
  color="light"
201
172
  dark={dark}
202
173
  >
203
- <Icon
204
- aria={{ label: "eye icon" }}
205
- icon="eye-slash"
206
- />
174
+ <Icon icon="eye-slash" />
207
175
  </Body>
208
176
  <Body
209
177
  className={showPassphrase ? "" : "hide-icon"}
210
178
  color="light"
211
179
  dark={dark}
212
180
  >
213
- <Icon
214
- aria={{ label: "eye icon" }}
181
+ <Icon
215
182
  className="svg-inline--fa"
216
183
  customIcon={eyeIcon.icon as unknown as { [key: string]: SVGElement }}
217
184
  />
@@ -120,7 +120,6 @@ const PassphraseMeterSettings = (props) => {
120
120
  "These examples will all share the same input value. Type in any of the inputs to see how the strength meter changes in response to different settings."
121
121
  }
122
122
  </Body>
123
- <br/>
124
123
  <Passphrase
125
124
  label={"Type your passphrase"}
126
125
  onChange={handleChange}
@@ -9,7 +9,6 @@ examples:
9
9
  - passphrase_strength_change: Strength Change
10
10
  - passphrase_common: Common Passphrases
11
11
  - passphrase_breached: Breached Passphrases
12
- - passphrase_required_indicator: Required Indicator
13
12
 
14
13
  react:
15
14
  - passphrase_default: Default
@@ -20,4 +19,3 @@ examples:
20
19
  - passphrase_strength_change: Strength Change
21
20
  - passphrase_common: Common Passphrases
22
21
  - passphrase_breached: Breached Passphrases
23
- - passphrase_required_indicator: Required Indicator
@@ -6,4 +6,3 @@ export { default as PassphraseTips } from './_passphrase_tips'
6
6
  export { default as PassphraseStrengthChange } from './_passphrase_strength_change'
7
7
  export { default as PassphraseCommon } from './_passphrase_common'
8
8
  export { default as PassphraseBreached } from './_passphrase_breached'
9
- export { default as PassphraseRequiredIndicator } from './_passphrase_required_indicator.jsx'
@@ -10,7 +10,6 @@ module Playbook
10
10
  values: %w[always xs sm md lg xl],
11
11
  default: "always"
12
12
  prop :tips, type: Playbook::Props::Array, default: []
13
- prop :required_indicator, type: Playbook::Props::Boolean, default: false
14
13
  prop :value, type: Playbook::Props::String
15
14
 
16
15
  def classname
@@ -24,7 +23,6 @@ module Playbook
24
23
  confirmation: confirmation,
25
24
  inputProps: input_props,
26
25
  label: label,
27
- requiredIndicator: required_indicator,
28
26
  showTipsBelow: show_tips_below,
29
27
  tips: tips,
30
28
  uncontrolled: true,
@@ -1,5 +1,5 @@
1
1
  import React from 'react'
2
- import { render, screen, within } from '../utilities/test-utils'
2
+ import { render, screen } from '../utilities/test-utils'
3
3
  import { Passphrase } from 'playbook-ui'
4
4
 
5
5
  const testId = 'text-input1',
@@ -86,32 +86,3 @@ test('popover target does not show when tips are not given', () => {
86
86
  const kit = screen.getByTestId(testId)
87
87
  expect(kit.querySelector('[class^=pb_popover_reference_wrapper]')).toBeNull()
88
88
  })
89
-
90
- test('renders required indicator asterisk when requiredIndicator is true', () => {
91
- render(
92
- <Passphrase
93
- data={{ testid: testId }}
94
- label="Passphrase"
95
- requiredIndicator
96
- />
97
- )
98
-
99
- const kit = screen.getByTestId(testId)
100
- const label = within(kit).getByText(/Passphrase/)
101
- expect(label).toBeInTheDocument()
102
- expect(kit).toHaveTextContent('*')
103
- })
104
-
105
- test('does not render required indicator asterisk when requiredIndicator is false', () => {
106
- render(
107
- <Passphrase
108
- data={{ testid: testId }}
109
- label="Passphrase"
110
- />
111
- )
112
-
113
- const kit = screen.getByTestId(testId)
114
- const label = within(kit).getByText(/Passphrase/)
115
- expect(label).toBeInTheDocument()
116
- expect(kit).not.toHaveTextContent('*')
117
- })
@@ -36,7 +36,6 @@ type PhoneNumberInputProps = {
36
36
  excludeCountries: string[],
37
37
  preferredCountries?: string[],
38
38
  required?: boolean,
39
- requiredIndicator?: boolean,
40
39
  value?: string,
41
40
  formatAsYouType?: boolean,
42
41
  strictMode?: boolean,
@@ -92,7 +91,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
92
91
  onlyCountries = [],
93
92
  excludeCountries = [],
94
93
  required = false,
95
- requiredIndicator = false,
96
94
  preferredCountries = [],
97
95
  value = "",
98
96
  formatAsYouType = false,
@@ -535,7 +533,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.Ref<unknown>
535
533
  validateErrors()
536
534
  },
537
535
  onChange: formatAsYouType ? undefined : handleOnChange,
538
- requiredIndicator,
539
536
  value: inputValue
540
537
  }
541
538
 
@@ -12,7 +12,6 @@ examples:
12
12
  - phone_number_input_format: Format as You Type
13
13
  - phone_number_input_strict_mode: Strict Mode
14
14
  - phone_number_input_country_search: Country Search
15
- - phone_number_input_required_indicator: Required Indicator
16
15
 
17
16
  rails:
18
17
  - phone_number_input_default: Default
@@ -25,4 +24,3 @@ examples:
25
24
  - phone_number_input_strict_mode: Strict Mode
26
25
  - phone_number_input_hidden_inputs: Hidden Inputs
27
26
  - phone_number_input_country_search: Country Search
28
- - phone_number_input_required_indicator: Required Indicator
@@ -9,4 +9,3 @@ export { default as PhoneNumberInputAccessInputElement } from './_phone_number_i
9
9
  export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
10
10
  export { default as PhoneNumberInputStrictMode } from './_phone_number_input_strict_mode'
11
11
  export { default as PhoneNumberInputCountrySearch } from './_phone_number_input_country_search'
12
- export { default as PhoneNumberInputRequiredIndicator } from './_phone_number_input_required_indicator.jsx'
@@ -7,8 +7,6 @@ module Playbook
7
7
  default: false
8
8
  prop :required, type: Playbook::Props::Boolean,
9
9
  default: false
10
- prop :required_indicator, type: Playbook::Props::Boolean,
11
- default: false
12
10
  prop :initial_country, type: Playbook::Props::String,
13
11
  default: ""
14
12
  prop :label, type: Playbook::Props::String,
@@ -54,7 +52,6 @@ module Playbook
54
52
  excludeCountries: exclude_countries,
55
53
  preferredCountries: preferred_countries,
56
54
  required: required,
57
- requiredIndicator: required_indicator,
58
55
  value: value,
59
56
  countrySearch: country_search,
60
57
  }
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { render, screen, act, within } from "../utilities/test-utils";
2
+ import { render, screen, act } from "../utilities/test-utils";
3
3
  import PhoneNumberInput from "./_phone_number_input";
4
4
 
5
5
  const testId = "phoneNumberInput";
@@ -129,7 +129,7 @@ test("should format phone number as '555-555-5555' with formatAsYouType and 'us'
129
129
  };
130
130
 
131
131
  render(<PhoneNumberInput {...props} />);
132
-
132
+
133
133
  const input = screen.getByRole("textbox");
134
134
 
135
135
  act(() => {
@@ -154,38 +154,7 @@ test("should pass countrySearch prop to component", () => {
154
154
  };
155
155
 
156
156
  render(<PhoneNumberInput {...props} />);
157
-
157
+
158
158
  const wrapper = screen.getByTestId('phone-input-with-search');
159
159
  expect(wrapper).toBeInTheDocument();
160
160
  });
161
-
162
- test("renders required indicator asterisk when requiredIndicator is true", () => {
163
- const props = {
164
- data: { testid: testId },
165
- id: testId,
166
- label: "Required Phone Number",
167
- requiredIndicator: true,
168
- };
169
-
170
- render(<PhoneNumberInput {...props} />);
171
-
172
- const kit = screen.getByTestId(testId);
173
- const label = within(kit).getByText(/Required Phone Number/);
174
- expect(label).toBeInTheDocument();
175
- expect(kit).toHaveTextContent("*");
176
- });
177
-
178
- test("does not render required indicator asterisk when requiredIndicator is false", () => {
179
- const props = {
180
- data: { testid: testId },
181
- id: testId,
182
- label: "Phone Number",
183
- };
184
-
185
- render(<PhoneNumberInput {...props} />);
186
-
187
- const kit = screen.getByTestId(testId);
188
- const label = within(kit).getByText(/Phone Number/);
189
- expect(label).toBeInTheDocument();
190
- expect(kit).not.toHaveTextContent("*");
191
- });
@@ -120,7 +120,6 @@ const Textarea = ({
120
120
  const characterCounter = () => {
121
121
  return maxCharacters && characterCount ? `${checkIfZero(characterCount)} / ${maxCharacters}` : `${checkIfZero(characterCount)}`
122
122
  }
123
- const errorId = error ? `${id}-error` : undefined
124
123
 
125
124
  return (
126
125
  <div
@@ -146,10 +145,7 @@ const Textarea = ({
146
145
  )}
147
146
  {children || (
148
147
  <textarea
149
- aria-describedby={errorId}
150
- aria-invalid={!!error}
151
148
  disabled={disabled}
152
- id={id}
153
149
  name={name}
154
150
  onChange={emojiMask ? handleChange : onChange}
155
151
  onPaste={emojiMask ? handlePaste : undefined}
@@ -171,9 +167,6 @@ const Textarea = ({
171
167
  >
172
168
  <FlexItem>
173
169
  <Body
174
- aria={{ atomic: "true", live: "polite" }}
175
- htmlOptions={{ role: "alert" }}
176
- id={errorId}
177
170
  margin="none"
178
171
  status="negative"
179
172
  text={error}
@@ -189,9 +182,6 @@ const Textarea = ({
189
182
  </Flex>
190
183
  ) : (
191
184
  <Body
192
- aria={{ atomic: "true", live: "polite" }}
193
- htmlOptions={{ role: "alert" }}
194
- id={errorId}
195
185
  status="negative"
196
186
  text={error}
197
187
  />
@@ -1,9 +1,9 @@
1
- <%= pb_rails("textarea", props: { label: "Label", rows: 4, id: "default-example-1" }) %>
1
+ <%= pb_rails("textarea", props: { label: "Label", rows: 4}) %>
2
2
 
3
3
  <br/>
4
4
 
5
- <%= pb_rails("textarea", props: { label: "Label", placeholder: "Placeholder text", id: "default-example-2" }) %>
5
+ <%= pb_rails("textarea", props: { label: "Label", placeholder: "Placeholder text" }) %>
6
6
 
7
7
  <br/>
8
8
 
9
- <%= pb_rails("textarea", props: { label: "Label", name: "comment", value: "Default value text", id: "default-example-3" }) %>
9
+ <%= pb_rails("textarea", props: { label: "Label", name: "comment", value: "Default value text" }) %>
@@ -13,7 +13,6 @@ const TextareaDefault = (props) => {
13
13
  label="Label"
14
14
  rows={4}
15
15
  {...props}
16
- id="default-example-1"
17
16
  />
18
17
 
19
18
  <br />
@@ -22,7 +21,6 @@ const TextareaDefault = (props) => {
22
21
  label="Label"
23
22
  placeholder="Placeholder text"
24
23
  {...props}
25
- id="default-example-2"
26
24
  />
27
25
 
28
26
  <br />
@@ -34,7 +32,6 @@ const TextareaDefault = (props) => {
34
32
  placeholder="Placeholder text"
35
33
  value={value}
36
34
  {...props}
37
- id="default-example-3"
38
35
  />
39
36
 
40
37
  </div>
@@ -1,14 +1,12 @@
1
- <%= pb_content_tag(:div, id: nil) do %>
1
+ <%= pb_content_tag do %>
2
2
  <% if object.label.present? %>
3
- <label for="<%= object.input_options[:id] || object.id %>" >
4
- <% if object.required_indicator %>
5
- <%= pb_rails("caption", props: { text: object.label, dark: object.dark }) do %>
6
- <%= object.label %><span style="color: #DA0014;"> *</span>
7
- <% end %>
8
- <% else %>
9
- <%= pb_rails("caption", props: {text: object.label, dark: object.dark}) %>
3
+ <% if object.required_indicator %>
4
+ <%= pb_rails("caption", props: { text: object.label, dark: object.dark }) do %>
5
+ <%= object.label %><span style="color: #DA0014;"> *</span>
10
6
  <% end %>
11
- </label>
7
+ <% else %>
8
+ <%= pb_rails("caption", props: {text: object.label, dark: object.dark}) %>
9
+ <% end %>
12
10
  <% end %>
13
11
  <% if content.present? %>
14
12
  <%= content %>
@@ -24,28 +22,14 @@
24
22
  <% if object.character_count %>
25
23
  <%= pb_rails("flex", props: { spacing: "between", vertical: "center" }) do %>
26
24
  <%= pb_rails("flex/flex_item") do %>
27
- <%= pb_rails("body", props: {
28
- dark: object.dark,
29
- status: "negative",
30
- text: object.error,
31
- id: object.error_id,
32
- aria: { atomic: "true", live: "polite" },
33
- html_options: { role: "alert" },
34
- }) %>
25
+ <%= pb_rails("body", props: { dark: object.dark, status: "negative", text: object.error }) %>
35
26
  <% end %>
36
27
  <%= pb_rails("flex/flex_item") do %>
37
28
  <%= pb_rails("caption", props: { margin: "none", size: "xs", text: object.character_counter }) %>
38
29
  <% end %>
39
30
  <% end %>
40
31
  <% else %>
41
- <%= pb_rails("body", props: {
42
- dark: object.dark,
43
- status: "negative",
44
- text: object.error,
45
- id: object.error_id,
46
- aria: { atomic: "true", live: "polite" },
47
- html_options: { role: "alert" },
48
- }) %>
32
+ <%= pb_rails("body", props: { dark: object.dark, status: "negative", text: object.error }) %>
49
33
  <% end %>
50
34
  <% else %>
51
35
  <%= pb_rails("caption", props: { margin: "none", size: "xs", text: object.character_counter }) %>
@@ -47,9 +47,7 @@ module Playbook
47
47
  merged_data = data_attrs.merge(input_data)
48
48
 
49
49
  base_attributes = {
50
- 'aria-describedby': error.present? ? error_id : nil,
51
- 'aria-invalid': error.present?,
52
- id: input_options[:id] || id || "object_method",
50
+ id: input_options[:id] || "object_method",
53
51
  max_characters: max_characters,
54
52
  name: name,
55
53
  onkeyup: onkeyup,
@@ -68,10 +66,6 @@ module Playbook
68
66
  result
69
67
  end
70
68
 
71
- def error_id
72
- "#{id}-error" if error.present?
73
- end
74
-
75
69
  private
76
70
 
77
71
  def error_class